vendor.js 940 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],[
  2. /* 0 */,
  3. /* 1 */
  4. /*!************************************************************!*\
  5. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  6. \************************************************************/
  7. /*! no static exports found */
  8. /***/ (function(module, exports, __webpack_require__) {
  9. "use strict";
  10. Object.defineProperty(exports, "__esModule", { value: true });exports.createApp = createApp;exports.createComponent = createComponent;exports.createPage = createPage;exports.createSubpackageApp = createSubpackageApp;exports.default = void 0;var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 2));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}
  11. var _toString = Object.prototype.toString;
  12. var hasOwnProperty = Object.prototype.hasOwnProperty;
  13. function isFn(fn) {
  14. return typeof fn === 'function';
  15. }
  16. function isStr(str) {
  17. return typeof str === 'string';
  18. }
  19. function isPlainObject(obj) {
  20. return _toString.call(obj) === '[object Object]';
  21. }
  22. function hasOwn(obj, key) {
  23. return hasOwnProperty.call(obj, key);
  24. }
  25. function noop() {}
  26. /**
  27. * Create a cached version of a pure function.
  28. */
  29. function cached(fn) {
  30. var cache = Object.create(null);
  31. return function cachedFn(str) {
  32. var hit = cache[str];
  33. return hit || (cache[str] = fn(str));
  34. };
  35. }
  36. /**
  37. * Camelize a hyphen-delimited string.
  38. */
  39. var camelizeRE = /-(\w)/g;
  40. var camelize = cached(function (str) {
  41. return str.replace(camelizeRE, function (_, c) {return c ? c.toUpperCase() : '';});
  42. });
  43. var HOOKS = [
  44. 'invoke',
  45. 'success',
  46. 'fail',
  47. 'complete',
  48. 'returnValue'];
  49. var globalInterceptors = {};
  50. var scopedInterceptors = {};
  51. function mergeHook(parentVal, childVal) {
  52. var res = childVal ?
  53. parentVal ?
  54. parentVal.concat(childVal) :
  55. Array.isArray(childVal) ?
  56. childVal : [childVal] :
  57. parentVal;
  58. return res ?
  59. dedupeHooks(res) :
  60. res;
  61. }
  62. function dedupeHooks(hooks) {
  63. var res = [];
  64. for (var i = 0; i < hooks.length; i++) {
  65. if (res.indexOf(hooks[i]) === -1) {
  66. res.push(hooks[i]);
  67. }
  68. }
  69. return res;
  70. }
  71. function removeHook(hooks, hook) {
  72. var index = hooks.indexOf(hook);
  73. if (index !== -1) {
  74. hooks.splice(index, 1);
  75. }
  76. }
  77. function mergeInterceptorHook(interceptor, option) {
  78. Object.keys(option).forEach(function (hook) {
  79. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  80. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  81. }
  82. });
  83. }
  84. function removeInterceptorHook(interceptor, option) {
  85. if (!interceptor || !option) {
  86. return;
  87. }
  88. Object.keys(option).forEach(function (hook) {
  89. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  90. removeHook(interceptor[hook], option[hook]);
  91. }
  92. });
  93. }
  94. function addInterceptor(method, option) {
  95. if (typeof method === 'string' && isPlainObject(option)) {
  96. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  97. } else if (isPlainObject(method)) {
  98. mergeInterceptorHook(globalInterceptors, method);
  99. }
  100. }
  101. function removeInterceptor(method, option) {
  102. if (typeof method === 'string') {
  103. if (isPlainObject(option)) {
  104. removeInterceptorHook(scopedInterceptors[method], option);
  105. } else {
  106. delete scopedInterceptors[method];
  107. }
  108. } else if (isPlainObject(method)) {
  109. removeInterceptorHook(globalInterceptors, method);
  110. }
  111. }
  112. function wrapperHook(hook) {
  113. return function (data) {
  114. return hook(data) || data;
  115. };
  116. }
  117. function isPromise(obj) {
  118. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  119. }
  120. function queue(hooks, data) {
  121. var promise = false;
  122. for (var i = 0; i < hooks.length; i++) {
  123. var hook = hooks[i];
  124. if (promise) {
  125. promise = Promise.resolve(wrapperHook(hook));
  126. } else {
  127. var res = hook(data);
  128. if (isPromise(res)) {
  129. promise = Promise.resolve(res);
  130. }
  131. if (res === false) {
  132. return {
  133. then: function then() {} };
  134. }
  135. }
  136. }
  137. return promise || {
  138. then: function then(callback) {
  139. return callback(data);
  140. } };
  141. }
  142. function wrapperOptions(interceptor) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  143. ['success', 'fail', 'complete'].forEach(function (name) {
  144. if (Array.isArray(interceptor[name])) {
  145. var oldCallback = options[name];
  146. options[name] = function callbackInterceptor(res) {
  147. queue(interceptor[name], res).then(function (res) {
  148. /* eslint-disable no-mixed-operators */
  149. return isFn(oldCallback) && oldCallback(res) || res;
  150. });
  151. };
  152. }
  153. });
  154. return options;
  155. }
  156. function wrapperReturnValue(method, returnValue) {
  157. var returnValueHooks = [];
  158. if (Array.isArray(globalInterceptors.returnValue)) {
  159. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(globalInterceptors.returnValue));
  160. }
  161. var interceptor = scopedInterceptors[method];
  162. if (interceptor && Array.isArray(interceptor.returnValue)) {
  163. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(interceptor.returnValue));
  164. }
  165. returnValueHooks.forEach(function (hook) {
  166. returnValue = hook(returnValue) || returnValue;
  167. });
  168. return returnValue;
  169. }
  170. function getApiInterceptorHooks(method) {
  171. var interceptor = Object.create(null);
  172. Object.keys(globalInterceptors).forEach(function (hook) {
  173. if (hook !== 'returnValue') {
  174. interceptor[hook] = globalInterceptors[hook].slice();
  175. }
  176. });
  177. var scopedInterceptor = scopedInterceptors[method];
  178. if (scopedInterceptor) {
  179. Object.keys(scopedInterceptor).forEach(function (hook) {
  180. if (hook !== 'returnValue') {
  181. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  182. }
  183. });
  184. }
  185. return interceptor;
  186. }
  187. function invokeApi(method, api, options) {for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {params[_key - 3] = arguments[_key];}
  188. var interceptor = getApiInterceptorHooks(method);
  189. if (interceptor && Object.keys(interceptor).length) {
  190. if (Array.isArray(interceptor.invoke)) {
  191. var res = queue(interceptor.invoke, options);
  192. return res.then(function (options) {
  193. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  194. });
  195. } else {
  196. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  197. }
  198. }
  199. return api.apply(void 0, [options].concat(params));
  200. }
  201. var promiseInterceptor = {
  202. returnValue: function returnValue(res) {
  203. if (!isPromise(res)) {
  204. return res;
  205. }
  206. return res.then(function (res) {
  207. return res[1];
  208. }).catch(function (res) {
  209. return res[0];
  210. });
  211. } };
  212. var SYNC_API_RE =
  213. /^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
  214. var CONTEXT_API_RE = /^create|Manager$/;
  215. // Context例外情况
  216. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  217. // 同步例外情况
  218. var ASYNC_API = ['createBLEConnection'];
  219. var CALLBACK_API_RE = /^on|^off/;
  220. function isContextApi(name) {
  221. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  222. }
  223. function isSyncApi(name) {
  224. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  225. }
  226. function isCallbackApi(name) {
  227. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  228. }
  229. function handlePromise(promise) {
  230. return promise.then(function (data) {
  231. return [null, data];
  232. }).
  233. catch(function (err) {return [err];});
  234. }
  235. function shouldPromise(name) {
  236. if (
  237. isContextApi(name) ||
  238. isSyncApi(name) ||
  239. isCallbackApi(name))
  240. {
  241. return false;
  242. }
  243. return true;
  244. }
  245. /* eslint-disable no-extend-native */
  246. if (!Promise.prototype.finally) {
  247. Promise.prototype.finally = function (callback) {
  248. var promise = this.constructor;
  249. return this.then(
  250. function (value) {return promise.resolve(callback()).then(function () {return value;});},
  251. function (reason) {return promise.resolve(callback()).then(function () {
  252. throw reason;
  253. });});
  254. };
  255. }
  256. function promisify(name, api) {
  257. if (!shouldPromise(name)) {
  258. return api;
  259. }
  260. return function promiseApi() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {params[_key2 - 1] = arguments[_key2];}
  261. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  262. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  263. }
  264. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  265. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  266. success: resolve,
  267. fail: reject })].concat(
  268. params));
  269. })));
  270. };
  271. }
  272. var EPS = 1e-4;
  273. var BASE_DEVICE_WIDTH = 750;
  274. var isIOS = false;
  275. var deviceWidth = 0;
  276. var deviceDPR = 0;
  277. function checkDeviceWidth() {var _wx$getSystemInfoSync =
  278. wx.getSystemInfoSync(),platform = _wx$getSystemInfoSync.platform,pixelRatio = _wx$getSystemInfoSync.pixelRatio,windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  279. deviceWidth = windowWidth;
  280. deviceDPR = pixelRatio;
  281. isIOS = platform === 'ios';
  282. }
  283. function upx2px(number, newDeviceWidth) {
  284. if (deviceWidth === 0) {
  285. checkDeviceWidth();
  286. }
  287. number = Number(number);
  288. if (number === 0) {
  289. return 0;
  290. }
  291. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  292. if (result < 0) {
  293. result = -result;
  294. }
  295. result = Math.floor(result + EPS);
  296. if (result === 0) {
  297. if (deviceDPR === 1 || !isIOS) {
  298. result = 1;
  299. } else {
  300. result = 0.5;
  301. }
  302. }
  303. return number < 0 ? -result : result;
  304. }
  305. var interceptors = {
  306. promiseInterceptor: promiseInterceptor };
  307. var baseApi = /*#__PURE__*/Object.freeze({
  308. __proto__: null,
  309. upx2px: upx2px,
  310. addInterceptor: addInterceptor,
  311. removeInterceptor: removeInterceptor,
  312. interceptors: interceptors });
  313. function findExistsPageIndex(url) {
  314. var pages = getCurrentPages();
  315. var len = pages.length;
  316. while (len--) {
  317. var page = pages[len];
  318. if (page.$page && page.$page.fullPath === url) {
  319. return len;
  320. }
  321. }
  322. return -1;
  323. }
  324. var redirectTo = {
  325. name: function name(fromArgs) {
  326. if (fromArgs.exists === 'back' && fromArgs.delta) {
  327. return 'navigateBack';
  328. }
  329. return 'redirectTo';
  330. },
  331. args: function args(fromArgs) {
  332. if (fromArgs.exists === 'back' && fromArgs.url) {
  333. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  334. if (existsPageIndex !== -1) {
  335. var delta = getCurrentPages().length - 1 - existsPageIndex;
  336. if (delta > 0) {
  337. fromArgs.delta = delta;
  338. }
  339. }
  340. }
  341. } };
  342. var previewImage = {
  343. args: function args(fromArgs) {
  344. var currentIndex = parseInt(fromArgs.current);
  345. if (isNaN(currentIndex)) {
  346. return;
  347. }
  348. var urls = fromArgs.urls;
  349. if (!Array.isArray(urls)) {
  350. return;
  351. }
  352. var len = urls.length;
  353. if (!len) {
  354. return;
  355. }
  356. if (currentIndex < 0) {
  357. currentIndex = 0;
  358. } else if (currentIndex >= len) {
  359. currentIndex = len - 1;
  360. }
  361. if (currentIndex > 0) {
  362. fromArgs.current = urls[currentIndex];
  363. fromArgs.urls = urls.filter(
  364. function (item, index) {return index < currentIndex ? item !== urls[currentIndex] : true;});
  365. } else {
  366. fromArgs.current = urls[0];
  367. }
  368. return {
  369. indicator: false,
  370. loop: false };
  371. } };
  372. var UUID_KEY = '__DC_STAT_UUID';
  373. var deviceId;
  374. function addUuid(result) {
  375. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  376. if (!deviceId) {
  377. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  378. wx.setStorage({
  379. key: UUID_KEY,
  380. data: deviceId });
  381. }
  382. result.deviceId = deviceId;
  383. }
  384. function addSafeAreaInsets(result) {
  385. if (result.safeArea) {
  386. var safeArea = result.safeArea;
  387. result.safeAreaInsets = {
  388. top: safeArea.top,
  389. left: safeArea.left,
  390. right: result.windowWidth - safeArea.right,
  391. bottom: result.windowHeight - safeArea.bottom };
  392. }
  393. }
  394. var getSystemInfo = {
  395. returnValue: function returnValue(result) {
  396. addUuid(result);
  397. addSafeAreaInsets(result);
  398. } };
  399. // import navigateTo from 'uni-helpers/navigate-to'
  400. var protocols = {
  401. redirectTo: redirectTo,
  402. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  403. previewImage: previewImage,
  404. getSystemInfo: getSystemInfo,
  405. getSystemInfoSync: getSystemInfo };
  406. var todos = [
  407. 'vibrate',
  408. 'preloadPage',
  409. 'unPreloadPage',
  410. 'loadSubPackage'];
  411. var canIUses = [];
  412. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  413. function processCallback(methodName, method, returnValue) {
  414. return function (res) {
  415. return method(processReturnValue(methodName, res, returnValue));
  416. };
  417. }
  418. function processArgs(methodName, fromArgs) {var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  419. if (isPlainObject(fromArgs)) {// 一般 api 的参数解析
  420. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  421. if (isFn(argsOption)) {
  422. argsOption = argsOption(fromArgs, toArgs) || {};
  423. }
  424. for (var key in fromArgs) {
  425. if (hasOwn(argsOption, key)) {
  426. var keyOption = argsOption[key];
  427. if (isFn(keyOption)) {
  428. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  429. }
  430. if (!keyOption) {// 不支持的参数
  431. console.warn("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F ".concat(methodName, "\u6682\u4E0D\u652F\u6301").concat(key));
  432. } else if (isStr(keyOption)) {// 重写参数 key
  433. toArgs[keyOption] = fromArgs[key];
  434. } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value
  435. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  436. }
  437. } else if (CALLBACKS.indexOf(key) !== -1) {
  438. if (isFn(fromArgs[key])) {
  439. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  440. }
  441. } else {
  442. if (!keepFromArgs) {
  443. toArgs[key] = fromArgs[key];
  444. }
  445. }
  446. }
  447. return toArgs;
  448. } else if (isFn(fromArgs)) {
  449. fromArgs = processCallback(methodName, fromArgs, returnValue);
  450. }
  451. return fromArgs;
  452. }
  453. function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  454. if (isFn(protocols.returnValue)) {// 处理通用 returnValue
  455. res = protocols.returnValue(methodName, res);
  456. }
  457. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  458. }
  459. function wrapper(methodName, method) {
  460. if (hasOwn(protocols, methodName)) {
  461. var protocol = protocols[methodName];
  462. if (!protocol) {// 暂不支持的 api
  463. return function () {
  464. console.error("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F \u6682\u4E0D\u652F\u6301".concat(methodName));
  465. };
  466. }
  467. return function (arg1, arg2) {// 目前 api 最多两个参数
  468. var options = protocol;
  469. if (isFn(protocol)) {
  470. options = protocol(arg1);
  471. }
  472. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  473. var args = [arg1];
  474. if (typeof arg2 !== 'undefined') {
  475. args.push(arg2);
  476. }
  477. if (isFn(options.name)) {
  478. methodName = options.name(arg1);
  479. } else if (isStr(options.name)) {
  480. methodName = options.name;
  481. }
  482. var returnValue = wx[methodName].apply(wx, args);
  483. if (isSyncApi(methodName)) {// 同步 api
  484. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  485. }
  486. return returnValue;
  487. };
  488. }
  489. return method;
  490. }
  491. var todoApis = Object.create(null);
  492. var TODOS = [
  493. 'onTabBarMidButtonTap',
  494. 'subscribePush',
  495. 'unsubscribePush',
  496. 'onPush',
  497. 'offPush',
  498. 'share'];
  499. function createTodoApi(name) {
  500. return function todoApi(_ref)
  501. {var fail = _ref.fail,complete = _ref.complete;
  502. var res = {
  503. errMsg: "".concat(name, ":fail:\u6682\u4E0D\u652F\u6301 ").concat(name, " \u65B9\u6CD5") };
  504. isFn(fail) && fail(res);
  505. isFn(complete) && complete(res);
  506. };
  507. }
  508. TODOS.forEach(function (name) {
  509. todoApis[name] = createTodoApi(name);
  510. });
  511. var providers = {
  512. oauth: ['weixin'],
  513. share: ['weixin'],
  514. payment: ['wxpay'],
  515. push: ['weixin'] };
  516. function getProvider(_ref2)
  517. {var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete;
  518. var res = false;
  519. if (providers[service]) {
  520. res = {
  521. errMsg: 'getProvider:ok',
  522. service: service,
  523. provider: providers[service] };
  524. isFn(success) && success(res);
  525. } else {
  526. res = {
  527. errMsg: 'getProvider:fail:服务[' + service + ']不存在' };
  528. isFn(fail) && fail(res);
  529. }
  530. isFn(complete) && complete(res);
  531. }
  532. var extraApi = /*#__PURE__*/Object.freeze({
  533. __proto__: null,
  534. getProvider: getProvider });
  535. var getEmitter = function () {
  536. var Emitter;
  537. return function getUniEmitter() {
  538. if (!Emitter) {
  539. Emitter = new _vue.default();
  540. }
  541. return Emitter;
  542. };
  543. }();
  544. function apply(ctx, method, args) {
  545. return ctx[method].apply(ctx, args);
  546. }
  547. function $on() {
  548. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  549. }
  550. function $off() {
  551. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  552. }
  553. function $once() {
  554. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  555. }
  556. function $emit() {
  557. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  558. }
  559. var eventApi = /*#__PURE__*/Object.freeze({
  560. __proto__: null,
  561. $on: $on,
  562. $off: $off,
  563. $once: $once,
  564. $emit: $emit });
  565. var api = /*#__PURE__*/Object.freeze({
  566. __proto__: null });
  567. var MPPage = Page;
  568. var MPComponent = Component;
  569. var customizeRE = /:/g;
  570. var customize = cached(function (str) {
  571. return camelize(str.replace(customizeRE, '-'));
  572. });
  573. function initTriggerEvent(mpInstance) {
  574. {
  575. if (!wx.canIUse('nextTick')) {
  576. return;
  577. }
  578. }
  579. var oldTriggerEvent = mpInstance.triggerEvent;
  580. mpInstance.triggerEvent = function (event) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];}
  581. return oldTriggerEvent.apply(mpInstance, [customize(event)].concat(args));
  582. };
  583. }
  584. function initHook(name, options) {
  585. var oldHook = options[name];
  586. if (!oldHook) {
  587. options[name] = function () {
  588. initTriggerEvent(this);
  589. };
  590. } else {
  591. options[name] = function () {
  592. initTriggerEvent(this);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}
  593. return oldHook.apply(this, args);
  594. };
  595. }
  596. }
  597. if (!MPPage.__$wrappered) {
  598. MPPage.__$wrappered = true;
  599. Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  600. initHook('onLoad', options);
  601. return MPPage(options);
  602. };
  603. Page.after = MPPage.after;
  604. Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  605. initHook('created', options);
  606. return MPComponent(options);
  607. };
  608. }
  609. var PAGE_EVENT_HOOKS = [
  610. 'onPullDownRefresh',
  611. 'onReachBottom',
  612. 'onAddToFavorites',
  613. 'onShareTimeline',
  614. 'onShareAppMessage',
  615. 'onPageScroll',
  616. 'onResize',
  617. 'onTabItemTap'];
  618. function initMocks(vm, mocks) {
  619. var mpInstance = vm.$mp[vm.mpType];
  620. mocks.forEach(function (mock) {
  621. if (hasOwn(mpInstance, mock)) {
  622. vm[mock] = mpInstance[mock];
  623. }
  624. });
  625. }
  626. function hasHook(hook, vueOptions) {
  627. if (!vueOptions) {
  628. return true;
  629. }
  630. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  631. return true;
  632. }
  633. vueOptions = vueOptions.default || vueOptions;
  634. if (isFn(vueOptions)) {
  635. if (isFn(vueOptions.extendOptions[hook])) {
  636. return true;
  637. }
  638. if (vueOptions.super &&
  639. vueOptions.super.options &&
  640. Array.isArray(vueOptions.super.options[hook])) {
  641. return true;
  642. }
  643. return false;
  644. }
  645. if (isFn(vueOptions[hook])) {
  646. return true;
  647. }
  648. var mixins = vueOptions.mixins;
  649. if (Array.isArray(mixins)) {
  650. return !!mixins.find(function (mixin) {return hasHook(hook, mixin);});
  651. }
  652. }
  653. function initHooks(mpOptions, hooks, vueOptions) {
  654. hooks.forEach(function (hook) {
  655. if (hasHook(hook, vueOptions)) {
  656. mpOptions[hook] = function (args) {
  657. return this.$vm && this.$vm.__call_hook(hook, args);
  658. };
  659. }
  660. });
  661. }
  662. function initVueComponent(Vue, vueOptions) {
  663. vueOptions = vueOptions.default || vueOptions;
  664. var VueComponent;
  665. if (isFn(vueOptions)) {
  666. VueComponent = vueOptions;
  667. } else {
  668. VueComponent = Vue.extend(vueOptions);
  669. }
  670. vueOptions = VueComponent.options;
  671. return [VueComponent, vueOptions];
  672. }
  673. function initSlots(vm, vueSlots) {
  674. if (Array.isArray(vueSlots) && vueSlots.length) {
  675. var $slots = Object.create(null);
  676. vueSlots.forEach(function (slotName) {
  677. $slots[slotName] = true;
  678. });
  679. vm.$scopedSlots = vm.$slots = $slots;
  680. }
  681. }
  682. function initVueIds(vueIds, mpInstance) {
  683. vueIds = (vueIds || '').split(',');
  684. var len = vueIds.length;
  685. if (len === 1) {
  686. mpInstance._$vueId = vueIds[0];
  687. } else if (len === 2) {
  688. mpInstance._$vueId = vueIds[0];
  689. mpInstance._$vuePid = vueIds[1];
  690. }
  691. }
  692. function initData(vueOptions, context) {
  693. var data = vueOptions.data || {};
  694. var methods = vueOptions.methods || {};
  695. if (typeof data === 'function') {
  696. try {
  697. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  698. } catch (e) {
  699. if (Object({"VUE_APP_NAME":"sqxp-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  700. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  701. }
  702. }
  703. } else {
  704. try {
  705. // 对 data 格式化
  706. data = JSON.parse(JSON.stringify(data));
  707. } catch (e) {}
  708. }
  709. if (!isPlainObject(data)) {
  710. data = {};
  711. }
  712. Object.keys(methods).forEach(function (methodName) {
  713. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  714. data[methodName] = methods[methodName];
  715. }
  716. });
  717. return data;
  718. }
  719. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  720. function createObserver(name) {
  721. return function observer(newVal, oldVal) {
  722. if (this.$vm) {
  723. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  724. }
  725. };
  726. }
  727. function initBehaviors(vueOptions, initBehavior) {
  728. var vueBehaviors = vueOptions.behaviors;
  729. var vueExtends = vueOptions.extends;
  730. var vueMixins = vueOptions.mixins;
  731. var vueProps = vueOptions.props;
  732. if (!vueProps) {
  733. vueOptions.props = vueProps = [];
  734. }
  735. var behaviors = [];
  736. if (Array.isArray(vueBehaviors)) {
  737. vueBehaviors.forEach(function (behavior) {
  738. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  739. if (behavior === 'uni://form-field') {
  740. if (Array.isArray(vueProps)) {
  741. vueProps.push('name');
  742. vueProps.push('value');
  743. } else {
  744. vueProps.name = {
  745. type: String,
  746. default: '' };
  747. vueProps.value = {
  748. type: [String, Number, Boolean, Array, Object, Date],
  749. default: '' };
  750. }
  751. }
  752. });
  753. }
  754. if (isPlainObject(vueExtends) && vueExtends.props) {
  755. behaviors.push(
  756. initBehavior({
  757. properties: initProperties(vueExtends.props, true) }));
  758. }
  759. if (Array.isArray(vueMixins)) {
  760. vueMixins.forEach(function (vueMixin) {
  761. if (isPlainObject(vueMixin) && vueMixin.props) {
  762. behaviors.push(
  763. initBehavior({
  764. properties: initProperties(vueMixin.props, true) }));
  765. }
  766. });
  767. }
  768. return behaviors;
  769. }
  770. function parsePropType(key, type, defaultValue, file) {
  771. // [String]=>String
  772. if (Array.isArray(type) && type.length === 1) {
  773. return type[0];
  774. }
  775. return type;
  776. }
  777. function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  778. var properties = {};
  779. if (!isBehavior) {
  780. properties.vueId = {
  781. type: String,
  782. value: '' };
  783. // 用于字节跳动小程序模拟抽象节点
  784. properties.generic = {
  785. type: Object,
  786. value: null };
  787. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  788. type: null,
  789. value: [],
  790. observer: function observer(newVal, oldVal) {
  791. var $slots = Object.create(null);
  792. newVal.forEach(function (slotName) {
  793. $slots[slotName] = true;
  794. });
  795. this.setData({
  796. $slots: $slots });
  797. } };
  798. }
  799. if (Array.isArray(props)) {// ['title']
  800. props.forEach(function (key) {
  801. properties[key] = {
  802. type: null,
  803. observer: createObserver(key) };
  804. });
  805. } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String}
  806. Object.keys(props).forEach(function (key) {
  807. var opts = props[key];
  808. if (isPlainObject(opts)) {// title:{type:String,default:''}
  809. var value = opts.default;
  810. if (isFn(value)) {
  811. value = value();
  812. }
  813. opts.type = parsePropType(key, opts.type);
  814. properties[key] = {
  815. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  816. value: value,
  817. observer: createObserver(key) };
  818. } else {// content:String
  819. var type = parsePropType(key, opts);
  820. properties[key] = {
  821. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  822. observer: createObserver(key) };
  823. }
  824. });
  825. }
  826. return properties;
  827. }
  828. function wrapper$1(event) {
  829. // TODO 又得兼容 mpvue 的 mp 对象
  830. try {
  831. event.mp = JSON.parse(JSON.stringify(event));
  832. } catch (e) {}
  833. event.stopPropagation = noop;
  834. event.preventDefault = noop;
  835. event.target = event.target || {};
  836. if (!hasOwn(event, 'detail')) {
  837. event.detail = {};
  838. }
  839. if (hasOwn(event, 'markerId')) {
  840. event.detail = typeof event.detail === 'object' ? event.detail : {};
  841. event.detail.markerId = event.markerId;
  842. }
  843. if (isPlainObject(event.detail)) {
  844. event.target = Object.assign({}, event.target, event.detail);
  845. }
  846. return event;
  847. }
  848. function getExtraValue(vm, dataPathsArray) {
  849. var context = vm;
  850. dataPathsArray.forEach(function (dataPathArray) {
  851. var dataPath = dataPathArray[0];
  852. var value = dataPathArray[2];
  853. if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable']
  854. var propPath = dataPathArray[1];
  855. var valuePath = dataPathArray[3];
  856. var vFor;
  857. if (Number.isInteger(dataPath)) {
  858. vFor = dataPath;
  859. } else if (!dataPath) {
  860. vFor = context;
  861. } else if (typeof dataPath === 'string' && dataPath) {
  862. if (dataPath.indexOf('#s#') === 0) {
  863. vFor = dataPath.substr(3);
  864. } else {
  865. vFor = vm.__get_value(dataPath, context);
  866. }
  867. }
  868. if (Number.isInteger(vFor)) {
  869. context = value;
  870. } else if (!propPath) {
  871. context = vFor[value];
  872. } else {
  873. if (Array.isArray(vFor)) {
  874. context = vFor.find(function (vForItem) {
  875. return vm.__get_value(propPath, vForItem) === value;
  876. });
  877. } else if (isPlainObject(vFor)) {
  878. context = Object.keys(vFor).find(function (vForKey) {
  879. return vm.__get_value(propPath, vFor[vForKey]) === value;
  880. });
  881. } else {
  882. console.error('v-for 暂不支持循环数据:', vFor);
  883. }
  884. }
  885. if (valuePath) {
  886. context = vm.__get_value(valuePath, context);
  887. }
  888. }
  889. });
  890. return context;
  891. }
  892. function processEventExtra(vm, extra, event) {
  893. var extraObj = {};
  894. if (Array.isArray(extra) && extra.length) {
  895. /**
  896. *[
  897. * ['data.items', 'data.id', item.data.id],
  898. * ['metas', 'id', meta.id]
  899. *],
  900. *[
  901. * ['data.items', 'data.id', item.data.id],
  902. * ['metas', 'id', meta.id]
  903. *],
  904. *'test'
  905. */
  906. extra.forEach(function (dataPath, index) {
  907. if (typeof dataPath === 'string') {
  908. if (!dataPath) {// model,prop.sync
  909. extraObj['$' + index] = vm;
  910. } else {
  911. if (dataPath === '$event') {// $event
  912. extraObj['$' + index] = event;
  913. } else if (dataPath === 'arguments') {
  914. if (event.detail && event.detail.__args__) {
  915. extraObj['$' + index] = event.detail.__args__;
  916. } else {
  917. extraObj['$' + index] = [event];
  918. }
  919. } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value
  920. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  921. } else {
  922. extraObj['$' + index] = vm.__get_value(dataPath);
  923. }
  924. }
  925. } else {
  926. extraObj['$' + index] = getExtraValue(vm, dataPath);
  927. }
  928. });
  929. }
  930. return extraObj;
  931. }
  932. function getObjByArray(arr) {
  933. var obj = {};
  934. for (var i = 1; i < arr.length; i++) {
  935. var element = arr[i];
  936. obj[element[0]] = element[1];
  937. }
  938. return obj;
  939. }
  940. function processEventArgs(vm, event) {var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];var isCustom = arguments.length > 4 ? arguments[4] : undefined;var methodName = arguments.length > 5 ? arguments[5] : undefined;
  941. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  942. if (isCustom) {// 自定义事件
  943. isCustomMPEvent = event.currentTarget &&
  944. event.currentTarget.dataset &&
  945. event.currentTarget.dataset.comType === 'wx';
  946. if (!args.length) {// 无参数,直接传入 event 或 detail 数组
  947. if (isCustomMPEvent) {
  948. return [event];
  949. }
  950. return event.detail.__args__ || event.detail;
  951. }
  952. }
  953. var extraObj = processEventExtra(vm, extra, event);
  954. var ret = [];
  955. args.forEach(function (arg) {
  956. if (arg === '$event') {
  957. if (methodName === '__set_model' && !isCustom) {// input v-model value
  958. ret.push(event.target.value);
  959. } else {
  960. if (isCustom && !isCustomMPEvent) {
  961. ret.push(event.detail.__args__[0]);
  962. } else {// wxcomponent 组件或内置组件
  963. ret.push(event);
  964. }
  965. }
  966. } else {
  967. if (Array.isArray(arg) && arg[0] === 'o') {
  968. ret.push(getObjByArray(arg));
  969. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  970. ret.push(extraObj[arg]);
  971. } else {
  972. ret.push(arg);
  973. }
  974. }
  975. });
  976. return ret;
  977. }
  978. var ONCE = '~';
  979. var CUSTOM = '^';
  980. function isMatchEventType(eventType, optType) {
  981. return eventType === optType ||
  982. optType === 'regionchange' && (
  983. eventType === 'begin' ||
  984. eventType === 'end');
  985. }
  986. function getContextVm(vm) {
  987. var $parent = vm.$parent;
  988. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  989. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  990. $parent = $parent.$parent;
  991. }
  992. return $parent && $parent.$parent;
  993. }
  994. function handleEvent(event) {var _this = this;
  995. event = wrapper$1(event);
  996. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  997. var dataset = (event.currentTarget || event.target).dataset;
  998. if (!dataset) {
  999. return console.warn('事件信息不存在');
  1000. }
  1001. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1002. if (!eventOpts) {
  1003. return console.warn('事件信息不存在');
  1004. }
  1005. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1006. var eventType = event.type;
  1007. var ret = [];
  1008. eventOpts.forEach(function (eventOpt) {
  1009. var type = eventOpt[0];
  1010. var eventsArray = eventOpt[1];
  1011. var isCustom = type.charAt(0) === CUSTOM;
  1012. type = isCustom ? type.slice(1) : type;
  1013. var isOnce = type.charAt(0) === ONCE;
  1014. type = isOnce ? type.slice(1) : type;
  1015. if (eventsArray && isMatchEventType(eventType, type)) {
  1016. eventsArray.forEach(function (eventArray) {
  1017. var methodName = eventArray[0];
  1018. if (methodName) {
  1019. var handlerCtx = _this.$vm;
  1020. if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1021. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1022. }
  1023. if (methodName === '$emit') {
  1024. handlerCtx.$emit.apply(handlerCtx,
  1025. processEventArgs(
  1026. _this.$vm,
  1027. event,
  1028. eventArray[1],
  1029. eventArray[2],
  1030. isCustom,
  1031. methodName));
  1032. return;
  1033. }
  1034. var handler = handlerCtx[methodName];
  1035. if (!isFn(handler)) {
  1036. throw new Error(" _vm.".concat(methodName, " is not a function"));
  1037. }
  1038. if (isOnce) {
  1039. if (handler.once) {
  1040. return;
  1041. }
  1042. handler.once = true;
  1043. }
  1044. var params = processEventArgs(
  1045. _this.$vm,
  1046. event,
  1047. eventArray[1],
  1048. eventArray[2],
  1049. isCustom,
  1050. methodName);
  1051. params = Array.isArray(params) ? params : [];
  1052. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1053. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1054. // eslint-disable-next-line no-sparse-arrays
  1055. params = params.concat([,,,,,,,,,, event]);
  1056. }
  1057. ret.push(handler.apply(handlerCtx, params));
  1058. }
  1059. });
  1060. }
  1061. });
  1062. if (
  1063. eventType === 'input' &&
  1064. ret.length === 1 &&
  1065. typeof ret[0] !== 'undefined')
  1066. {
  1067. return ret[0];
  1068. }
  1069. }
  1070. var eventChannels = {};
  1071. var eventChannelStack = [];
  1072. function getEventChannel(id) {
  1073. if (id) {
  1074. var eventChannel = eventChannels[id];
  1075. delete eventChannels[id];
  1076. return eventChannel;
  1077. }
  1078. return eventChannelStack.shift();
  1079. }
  1080. var hooks = [
  1081. 'onShow',
  1082. 'onHide',
  1083. 'onError',
  1084. 'onPageNotFound',
  1085. 'onThemeChange',
  1086. 'onUnhandledRejection'];
  1087. function initEventChannel() {
  1088. _vue.default.prototype.getOpenerEventChannel = function () {
  1089. // 微信小程序使用自身getOpenerEventChannel
  1090. {
  1091. return this.$scope.getOpenerEventChannel();
  1092. }
  1093. };
  1094. var callHook = _vue.default.prototype.__call_hook;
  1095. _vue.default.prototype.__call_hook = function (hook, args) {
  1096. if (hook === 'onLoad' && args && args.__id__) {
  1097. this.__eventChannel__ = getEventChannel(args.__id__);
  1098. delete args.__id__;
  1099. }
  1100. return callHook.call(this, hook, args);
  1101. };
  1102. }
  1103. function parseBaseApp(vm, _ref3)
  1104. {var mocks = _ref3.mocks,initRefs = _ref3.initRefs;
  1105. initEventChannel();
  1106. if (vm.$options.store) {
  1107. _vue.default.prototype.$store = vm.$options.store;
  1108. }
  1109. _vue.default.prototype.mpHost = "mp-weixin";
  1110. _vue.default.mixin({
  1111. beforeCreate: function beforeCreate() {
  1112. if (!this.$options.mpType) {
  1113. return;
  1114. }
  1115. this.mpType = this.$options.mpType;
  1116. this.$mp = _defineProperty({
  1117. data: {} },
  1118. this.mpType, this.$options.mpInstance);
  1119. this.$scope = this.$options.mpInstance;
  1120. delete this.$options.mpType;
  1121. delete this.$options.mpInstance;
  1122. if (this.mpType !== 'app') {
  1123. initRefs(this);
  1124. initMocks(this, mocks);
  1125. }
  1126. } });
  1127. var appOptions = {
  1128. onLaunch: function onLaunch(args) {
  1129. if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  1130. return;
  1131. }
  1132. {
  1133. if (!wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  1134. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  1135. }
  1136. }
  1137. this.$vm = vm;
  1138. this.$vm.$mp = {
  1139. app: this };
  1140. this.$vm.$scope = this;
  1141. // vm 上也挂载 globalData
  1142. this.$vm.globalData = this.globalData;
  1143. this.$vm._isMounted = true;
  1144. this.$vm.__call_hook('mounted', args);
  1145. this.$vm.__call_hook('onLaunch', args);
  1146. } };
  1147. // 兼容旧版本 globalData
  1148. appOptions.globalData = vm.$options.globalData || {};
  1149. // 将 methods 中的方法挂在 getApp() 中
  1150. var methods = vm.$options.methods;
  1151. if (methods) {
  1152. Object.keys(methods).forEach(function (name) {
  1153. appOptions[name] = methods[name];
  1154. });
  1155. }
  1156. initHooks(appOptions, hooks);
  1157. return appOptions;
  1158. }
  1159. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1160. function findVmByVueId(vm, vuePid) {
  1161. var $children = vm.$children;
  1162. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1163. for (var i = $children.length - 1; i >= 0; i--) {
  1164. var childVm = $children[i];
  1165. if (childVm.$scope._$vueId === vuePid) {
  1166. return childVm;
  1167. }
  1168. }
  1169. // 反向递归查找
  1170. var parentVm;
  1171. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1172. parentVm = findVmByVueId($children[_i], vuePid);
  1173. if (parentVm) {
  1174. return parentVm;
  1175. }
  1176. }
  1177. }
  1178. function initBehavior(options) {
  1179. return Behavior(options);
  1180. }
  1181. function isPage() {
  1182. return !!this.route;
  1183. }
  1184. function initRelation(detail) {
  1185. this.triggerEvent('__l', detail);
  1186. }
  1187. function selectAllComponents(mpInstance, selector, $refs) {
  1188. var components = mpInstance.selectAllComponents(selector);
  1189. components.forEach(function (component) {
  1190. var ref = component.dataset.ref;
  1191. $refs[ref] = component.$vm || component;
  1192. {
  1193. if (component.dataset.vueGeneric === 'scoped') {
  1194. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1195. selectAllComponents(scopedComponent, selector, $refs);
  1196. });
  1197. }
  1198. }
  1199. });
  1200. }
  1201. function initRefs(vm) {
  1202. var mpInstance = vm.$scope;
  1203. Object.defineProperty(vm, '$refs', {
  1204. get: function get() {
  1205. var $refs = {};
  1206. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1207. // TODO 暂不考虑 for 中的 scoped
  1208. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  1209. forComponents.forEach(function (component) {
  1210. var ref = component.dataset.ref;
  1211. if (!$refs[ref]) {
  1212. $refs[ref] = [];
  1213. }
  1214. $refs[ref].push(component.$vm || component);
  1215. });
  1216. return $refs;
  1217. } });
  1218. }
  1219. function handleLink(event) {var _ref4 =
  1220. event.detail || event.value,vuePid = _ref4.vuePid,vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  1221. var parentVm;
  1222. if (vuePid) {
  1223. parentVm = findVmByVueId(this.$vm, vuePid);
  1224. }
  1225. if (!parentVm) {
  1226. parentVm = this.$vm;
  1227. }
  1228. vueOptions.parent = parentVm;
  1229. }
  1230. function parseApp(vm) {
  1231. return parseBaseApp(vm, {
  1232. mocks: mocks,
  1233. initRefs: initRefs });
  1234. }
  1235. function createApp(vm) {
  1236. App(parseApp(vm));
  1237. return vm;
  1238. }
  1239. var encodeReserveRE = /[!'()*]/g;
  1240. var encodeReserveReplacer = function encodeReserveReplacer(c) {return '%' + c.charCodeAt(0).toString(16);};
  1241. var commaRE = /%2C/g;
  1242. // fixed encodeURIComponent which is more conformant to RFC3986:
  1243. // - escapes [!'()*]
  1244. // - preserve commas
  1245. var encode = function encode(str) {return encodeURIComponent(str).
  1246. replace(encodeReserveRE, encodeReserveReplacer).
  1247. replace(commaRE, ',');};
  1248. function stringifyQuery(obj) {var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  1249. var res = obj ? Object.keys(obj).map(function (key) {
  1250. var val = obj[key];
  1251. if (val === undefined) {
  1252. return '';
  1253. }
  1254. if (val === null) {
  1255. return encodeStr(key);
  1256. }
  1257. if (Array.isArray(val)) {
  1258. var result = [];
  1259. val.forEach(function (val2) {
  1260. if (val2 === undefined) {
  1261. return;
  1262. }
  1263. if (val2 === null) {
  1264. result.push(encodeStr(key));
  1265. } else {
  1266. result.push(encodeStr(key) + '=' + encodeStr(val2));
  1267. }
  1268. });
  1269. return result.join('&');
  1270. }
  1271. return encodeStr(key) + '=' + encodeStr(val);
  1272. }).filter(function (x) {return x.length > 0;}).join('&') : null;
  1273. return res ? "?".concat(res) : '';
  1274. }
  1275. function parseBaseComponent(vueComponentOptions)
  1276. {var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},isPage = _ref5.isPage,initRelation = _ref5.initRelation;var _initVueComponent =
  1277. initVueComponent(_vue.default, vueComponentOptions),_initVueComponent2 = _slicedToArray(_initVueComponent, 2),VueComponent = _initVueComponent2[0],vueOptions = _initVueComponent2[1];
  1278. var options = _objectSpread({
  1279. multipleSlots: true,
  1280. addGlobalClass: true },
  1281. vueOptions.options || {});
  1282. {
  1283. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  1284. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  1285. Object.assign(options, vueOptions['mp-weixin'].options);
  1286. }
  1287. }
  1288. var componentOptions = {
  1289. options: options,
  1290. data: initData(vueOptions, _vue.default.prototype),
  1291. behaviors: initBehaviors(vueOptions, initBehavior),
  1292. properties: initProperties(vueOptions.props, false, vueOptions.__file),
  1293. lifetimes: {
  1294. attached: function attached() {
  1295. var properties = this.properties;
  1296. var options = {
  1297. mpType: isPage.call(this) ? 'page' : 'component',
  1298. mpInstance: this,
  1299. propsData: properties };
  1300. initVueIds(properties.vueId, this);
  1301. // 处理父子关系
  1302. initRelation.call(this, {
  1303. vuePid: this._$vuePid,
  1304. vueOptions: options });
  1305. // 初始化 vue 实例
  1306. this.$vm = new VueComponent(options);
  1307. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  1308. initSlots(this.$vm, properties.vueSlots);
  1309. // 触发首次 setData
  1310. this.$vm.$mount();
  1311. },
  1312. ready: function ready() {
  1313. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  1314. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  1315. if (this.$vm) {
  1316. this.$vm._isMounted = true;
  1317. this.$vm.__call_hook('mounted');
  1318. this.$vm.__call_hook('onReady');
  1319. }
  1320. },
  1321. detached: function detached() {
  1322. this.$vm && this.$vm.$destroy();
  1323. } },
  1324. pageLifetimes: {
  1325. show: function show(args) {
  1326. this.$vm && this.$vm.__call_hook('onPageShow', args);
  1327. },
  1328. hide: function hide() {
  1329. this.$vm && this.$vm.__call_hook('onPageHide');
  1330. },
  1331. resize: function resize(size) {
  1332. this.$vm && this.$vm.__call_hook('onPageResize', size);
  1333. } },
  1334. methods: {
  1335. __l: handleLink,
  1336. __e: handleEvent } };
  1337. // externalClasses
  1338. if (vueOptions.externalClasses) {
  1339. componentOptions.externalClasses = vueOptions.externalClasses;
  1340. }
  1341. if (Array.isArray(vueOptions.wxsCallMethods)) {
  1342. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  1343. componentOptions.methods[callMethod] = function (args) {
  1344. return this.$vm[callMethod](args);
  1345. };
  1346. });
  1347. }
  1348. if (isPage) {
  1349. return componentOptions;
  1350. }
  1351. return [componentOptions, VueComponent];
  1352. }
  1353. function parseComponent(vueComponentOptions) {
  1354. return parseBaseComponent(vueComponentOptions, {
  1355. isPage: isPage,
  1356. initRelation: initRelation });
  1357. }
  1358. var hooks$1 = [
  1359. 'onShow',
  1360. 'onHide',
  1361. 'onUnload'];
  1362. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  1363. function parseBasePage(vuePageOptions, _ref6)
  1364. {var isPage = _ref6.isPage,initRelation = _ref6.initRelation;
  1365. var pageOptions = parseComponent(vuePageOptions);
  1366. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  1367. pageOptions.methods.onLoad = function (query) {
  1368. this.options = query;
  1369. var copyQuery = Object.assign({}, query);
  1370. delete copyQuery.__id__;
  1371. this.$page = {
  1372. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery) };
  1373. this.$vm.$mp.query = query; // 兼容 mpvue
  1374. this.$vm.__call_hook('onLoad', query);
  1375. };
  1376. return pageOptions;
  1377. }
  1378. function parsePage(vuePageOptions) {
  1379. return parseBasePage(vuePageOptions, {
  1380. isPage: isPage,
  1381. initRelation: initRelation });
  1382. }
  1383. function createPage(vuePageOptions) {
  1384. {
  1385. return Component(parsePage(vuePageOptions));
  1386. }
  1387. }
  1388. function createComponent(vueOptions) {
  1389. {
  1390. return Component(parseComponent(vueOptions));
  1391. }
  1392. }
  1393. function createSubpackageApp(vm) {
  1394. var appOptions = parseApp(vm);
  1395. var app = getApp({
  1396. allowDefault: true });
  1397. var globalData = app.globalData;
  1398. if (globalData) {
  1399. Object.keys(appOptions.globalData).forEach(function (name) {
  1400. if (!hasOwn(globalData, name)) {
  1401. globalData[name] = appOptions.globalData[name];
  1402. }
  1403. });
  1404. }
  1405. Object.keys(appOptions).forEach(function (name) {
  1406. if (!hasOwn(app, name)) {
  1407. app[name] = appOptions[name];
  1408. }
  1409. });
  1410. if (isFn(appOptions.onShow) && wx.onAppShow) {
  1411. wx.onAppShow(function () {for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}
  1412. appOptions.onShow.apply(app, args);
  1413. });
  1414. }
  1415. if (isFn(appOptions.onHide) && wx.onAppHide) {
  1416. wx.onAppHide(function () {for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {args[_key6] = arguments[_key6];}
  1417. appOptions.onHide.apply(app, args);
  1418. });
  1419. }
  1420. if (isFn(appOptions.onLaunch)) {
  1421. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  1422. appOptions.onLaunch.call(app, args);
  1423. }
  1424. return vm;
  1425. }
  1426. todos.forEach(function (todoApi) {
  1427. protocols[todoApi] = false;
  1428. });
  1429. canIUses.forEach(function (canIUseApi) {
  1430. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  1431. canIUseApi;
  1432. if (!wx.canIUse(apiName)) {
  1433. protocols[canIUseApi] = false;
  1434. }
  1435. });
  1436. var uni = {};
  1437. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  1438. uni = new Proxy({}, {
  1439. get: function get(target, name) {
  1440. if (hasOwn(target, name)) {
  1441. return target[name];
  1442. }
  1443. if (baseApi[name]) {
  1444. return baseApi[name];
  1445. }
  1446. if (api[name]) {
  1447. return promisify(name, api[name]);
  1448. }
  1449. {
  1450. if (extraApi[name]) {
  1451. return promisify(name, extraApi[name]);
  1452. }
  1453. if (todoApis[name]) {
  1454. return promisify(name, todoApis[name]);
  1455. }
  1456. }
  1457. if (eventApi[name]) {
  1458. return eventApi[name];
  1459. }
  1460. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  1461. return;
  1462. }
  1463. return promisify(name, wrapper(name, wx[name]));
  1464. },
  1465. set: function set(target, name, value) {
  1466. target[name] = value;
  1467. return true;
  1468. } });
  1469. } else {
  1470. Object.keys(baseApi).forEach(function (name) {
  1471. uni[name] = baseApi[name];
  1472. });
  1473. {
  1474. Object.keys(todoApis).forEach(function (name) {
  1475. uni[name] = promisify(name, todoApis[name]);
  1476. });
  1477. Object.keys(extraApi).forEach(function (name) {
  1478. uni[name] = promisify(name, todoApis[name]);
  1479. });
  1480. }
  1481. Object.keys(eventApi).forEach(function (name) {
  1482. uni[name] = eventApi[name];
  1483. });
  1484. Object.keys(api).forEach(function (name) {
  1485. uni[name] = promisify(name, api[name]);
  1486. });
  1487. Object.keys(wx).forEach(function (name) {
  1488. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  1489. uni[name] = promisify(name, wrapper(name, wx[name]));
  1490. }
  1491. });
  1492. }
  1493. wx.createApp = createApp;
  1494. wx.createPage = createPage;
  1495. wx.createComponent = createComponent;
  1496. wx.createSubpackageApp = createSubpackageApp;
  1497. var uni$1 = uni;var _default =
  1498. uni$1;exports.default = _default;
  1499. /***/ }),
  1500. /* 2 */
  1501. /*!******************************************************************************************!*\
  1502. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  1503. \******************************************************************************************/
  1504. /*! exports provided: default */
  1505. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1506. "use strict";
  1507. __webpack_require__.r(__webpack_exports__);
  1508. /* WEBPACK VAR INJECTION */(function(global) {/*!
  1509. * Vue.js v2.6.11
  1510. * (c) 2014-2021 Evan You
  1511. * Released under the MIT License.
  1512. */
  1513. /* */
  1514. var emptyObject = Object.freeze({});
  1515. // These helpers produce better VM code in JS engines due to their
  1516. // explicitness and function inlining.
  1517. function isUndef (v) {
  1518. return v === undefined || v === null
  1519. }
  1520. function isDef (v) {
  1521. return v !== undefined && v !== null
  1522. }
  1523. function isTrue (v) {
  1524. return v === true
  1525. }
  1526. function isFalse (v) {
  1527. return v === false
  1528. }
  1529. /**
  1530. * Check if value is primitive.
  1531. */
  1532. function isPrimitive (value) {
  1533. return (
  1534. typeof value === 'string' ||
  1535. typeof value === 'number' ||
  1536. // $flow-disable-line
  1537. typeof value === 'symbol' ||
  1538. typeof value === 'boolean'
  1539. )
  1540. }
  1541. /**
  1542. * Quick object check - this is primarily used to tell
  1543. * Objects from primitive values when we know the value
  1544. * is a JSON-compliant type.
  1545. */
  1546. function isObject (obj) {
  1547. return obj !== null && typeof obj === 'object'
  1548. }
  1549. /**
  1550. * Get the raw type string of a value, e.g., [object Object].
  1551. */
  1552. var _toString = Object.prototype.toString;
  1553. function toRawType (value) {
  1554. return _toString.call(value).slice(8, -1)
  1555. }
  1556. /**
  1557. * Strict object type check. Only returns true
  1558. * for plain JavaScript objects.
  1559. */
  1560. function isPlainObject (obj) {
  1561. return _toString.call(obj) === '[object Object]'
  1562. }
  1563. function isRegExp (v) {
  1564. return _toString.call(v) === '[object RegExp]'
  1565. }
  1566. /**
  1567. * Check if val is a valid array index.
  1568. */
  1569. function isValidArrayIndex (val) {
  1570. var n = parseFloat(String(val));
  1571. return n >= 0 && Math.floor(n) === n && isFinite(val)
  1572. }
  1573. function isPromise (val) {
  1574. return (
  1575. isDef(val) &&
  1576. typeof val.then === 'function' &&
  1577. typeof val.catch === 'function'
  1578. )
  1579. }
  1580. /**
  1581. * Convert a value to a string that is actually rendered.
  1582. */
  1583. function toString (val) {
  1584. return val == null
  1585. ? ''
  1586. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  1587. ? JSON.stringify(val, null, 2)
  1588. : String(val)
  1589. }
  1590. /**
  1591. * Convert an input value to a number for persistence.
  1592. * If the conversion fails, return original string.
  1593. */
  1594. function toNumber (val) {
  1595. var n = parseFloat(val);
  1596. return isNaN(n) ? val : n
  1597. }
  1598. /**
  1599. * Make a map and return a function for checking if a key
  1600. * is in that map.
  1601. */
  1602. function makeMap (
  1603. str,
  1604. expectsLowerCase
  1605. ) {
  1606. var map = Object.create(null);
  1607. var list = str.split(',');
  1608. for (var i = 0; i < list.length; i++) {
  1609. map[list[i]] = true;
  1610. }
  1611. return expectsLowerCase
  1612. ? function (val) { return map[val.toLowerCase()]; }
  1613. : function (val) { return map[val]; }
  1614. }
  1615. /**
  1616. * Check if a tag is a built-in tag.
  1617. */
  1618. var isBuiltInTag = makeMap('slot,component', true);
  1619. /**
  1620. * Check if an attribute is a reserved attribute.
  1621. */
  1622. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  1623. /**
  1624. * Remove an item from an array.
  1625. */
  1626. function remove (arr, item) {
  1627. if (arr.length) {
  1628. var index = arr.indexOf(item);
  1629. if (index > -1) {
  1630. return arr.splice(index, 1)
  1631. }
  1632. }
  1633. }
  1634. /**
  1635. * Check whether an object has the property.
  1636. */
  1637. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1638. function hasOwn (obj, key) {
  1639. return hasOwnProperty.call(obj, key)
  1640. }
  1641. /**
  1642. * Create a cached version of a pure function.
  1643. */
  1644. function cached (fn) {
  1645. var cache = Object.create(null);
  1646. return (function cachedFn (str) {
  1647. var hit = cache[str];
  1648. return hit || (cache[str] = fn(str))
  1649. })
  1650. }
  1651. /**
  1652. * Camelize a hyphen-delimited string.
  1653. */
  1654. var camelizeRE = /-(\w)/g;
  1655. var camelize = cached(function (str) {
  1656. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  1657. });
  1658. /**
  1659. * Capitalize a string.
  1660. */
  1661. var capitalize = cached(function (str) {
  1662. return str.charAt(0).toUpperCase() + str.slice(1)
  1663. });
  1664. /**
  1665. * Hyphenate a camelCase string.
  1666. */
  1667. var hyphenateRE = /\B([A-Z])/g;
  1668. var hyphenate = cached(function (str) {
  1669. return str.replace(hyphenateRE, '-$1').toLowerCase()
  1670. });
  1671. /**
  1672. * Simple bind polyfill for environments that do not support it,
  1673. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  1674. * since native bind is now performant enough in most browsers.
  1675. * But removing it would mean breaking code that was able to run in
  1676. * PhantomJS 1.x, so this must be kept for backward compatibility.
  1677. */
  1678. /* istanbul ignore next */
  1679. function polyfillBind (fn, ctx) {
  1680. function boundFn (a) {
  1681. var l = arguments.length;
  1682. return l
  1683. ? l > 1
  1684. ? fn.apply(ctx, arguments)
  1685. : fn.call(ctx, a)
  1686. : fn.call(ctx)
  1687. }
  1688. boundFn._length = fn.length;
  1689. return boundFn
  1690. }
  1691. function nativeBind (fn, ctx) {
  1692. return fn.bind(ctx)
  1693. }
  1694. var bind = Function.prototype.bind
  1695. ? nativeBind
  1696. : polyfillBind;
  1697. /**
  1698. * Convert an Array-like object to a real Array.
  1699. */
  1700. function toArray (list, start) {
  1701. start = start || 0;
  1702. var i = list.length - start;
  1703. var ret = new Array(i);
  1704. while (i--) {
  1705. ret[i] = list[i + start];
  1706. }
  1707. return ret
  1708. }
  1709. /**
  1710. * Mix properties into target object.
  1711. */
  1712. function extend (to, _from) {
  1713. for (var key in _from) {
  1714. to[key] = _from[key];
  1715. }
  1716. return to
  1717. }
  1718. /**
  1719. * Merge an Array of Objects into a single Object.
  1720. */
  1721. function toObject (arr) {
  1722. var res = {};
  1723. for (var i = 0; i < arr.length; i++) {
  1724. if (arr[i]) {
  1725. extend(res, arr[i]);
  1726. }
  1727. }
  1728. return res
  1729. }
  1730. /* eslint-disable no-unused-vars */
  1731. /**
  1732. * Perform no operation.
  1733. * Stubbing args to make Flow happy without leaving useless transpiled code
  1734. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  1735. */
  1736. function noop (a, b, c) {}
  1737. /**
  1738. * Always return false.
  1739. */
  1740. var no = function (a, b, c) { return false; };
  1741. /* eslint-enable no-unused-vars */
  1742. /**
  1743. * Return the same value.
  1744. */
  1745. var identity = function (_) { return _; };
  1746. /**
  1747. * Check if two values are loosely equal - that is,
  1748. * if they are plain objects, do they have the same shape?
  1749. */
  1750. function looseEqual (a, b) {
  1751. if (a === b) { return true }
  1752. var isObjectA = isObject(a);
  1753. var isObjectB = isObject(b);
  1754. if (isObjectA && isObjectB) {
  1755. try {
  1756. var isArrayA = Array.isArray(a);
  1757. var isArrayB = Array.isArray(b);
  1758. if (isArrayA && isArrayB) {
  1759. return a.length === b.length && a.every(function (e, i) {
  1760. return looseEqual(e, b[i])
  1761. })
  1762. } else if (a instanceof Date && b instanceof Date) {
  1763. return a.getTime() === b.getTime()
  1764. } else if (!isArrayA && !isArrayB) {
  1765. var keysA = Object.keys(a);
  1766. var keysB = Object.keys(b);
  1767. return keysA.length === keysB.length && keysA.every(function (key) {
  1768. return looseEqual(a[key], b[key])
  1769. })
  1770. } else {
  1771. /* istanbul ignore next */
  1772. return false
  1773. }
  1774. } catch (e) {
  1775. /* istanbul ignore next */
  1776. return false
  1777. }
  1778. } else if (!isObjectA && !isObjectB) {
  1779. return String(a) === String(b)
  1780. } else {
  1781. return false
  1782. }
  1783. }
  1784. /**
  1785. * Return the first index at which a loosely equal value can be
  1786. * found in the array (if value is a plain object, the array must
  1787. * contain an object of the same shape), or -1 if it is not present.
  1788. */
  1789. function looseIndexOf (arr, val) {
  1790. for (var i = 0; i < arr.length; i++) {
  1791. if (looseEqual(arr[i], val)) { return i }
  1792. }
  1793. return -1
  1794. }
  1795. /**
  1796. * Ensure a function is called only once.
  1797. */
  1798. function once (fn) {
  1799. var called = false;
  1800. return function () {
  1801. if (!called) {
  1802. called = true;
  1803. fn.apply(this, arguments);
  1804. }
  1805. }
  1806. }
  1807. var ASSET_TYPES = [
  1808. 'component',
  1809. 'directive',
  1810. 'filter'
  1811. ];
  1812. var LIFECYCLE_HOOKS = [
  1813. 'beforeCreate',
  1814. 'created',
  1815. 'beforeMount',
  1816. 'mounted',
  1817. 'beforeUpdate',
  1818. 'updated',
  1819. 'beforeDestroy',
  1820. 'destroyed',
  1821. 'activated',
  1822. 'deactivated',
  1823. 'errorCaptured',
  1824. 'serverPrefetch'
  1825. ];
  1826. /* */
  1827. var config = ({
  1828. /**
  1829. * Option merge strategies (used in core/util/options)
  1830. */
  1831. // $flow-disable-line
  1832. optionMergeStrategies: Object.create(null),
  1833. /**
  1834. * Whether to suppress warnings.
  1835. */
  1836. silent: false,
  1837. /**
  1838. * Show production mode tip message on boot?
  1839. */
  1840. productionTip: "development" !== 'production',
  1841. /**
  1842. * Whether to enable devtools
  1843. */
  1844. devtools: "development" !== 'production',
  1845. /**
  1846. * Whether to record perf
  1847. */
  1848. performance: false,
  1849. /**
  1850. * Error handler for watcher errors
  1851. */
  1852. errorHandler: null,
  1853. /**
  1854. * Warn handler for watcher warns
  1855. */
  1856. warnHandler: null,
  1857. /**
  1858. * Ignore certain custom elements
  1859. */
  1860. ignoredElements: [],
  1861. /**
  1862. * Custom user key aliases for v-on
  1863. */
  1864. // $flow-disable-line
  1865. keyCodes: Object.create(null),
  1866. /**
  1867. * Check if a tag is reserved so that it cannot be registered as a
  1868. * component. This is platform-dependent and may be overwritten.
  1869. */
  1870. isReservedTag: no,
  1871. /**
  1872. * Check if an attribute is reserved so that it cannot be used as a component
  1873. * prop. This is platform-dependent and may be overwritten.
  1874. */
  1875. isReservedAttr: no,
  1876. /**
  1877. * Check if a tag is an unknown element.
  1878. * Platform-dependent.
  1879. */
  1880. isUnknownElement: no,
  1881. /**
  1882. * Get the namespace of an element
  1883. */
  1884. getTagNamespace: noop,
  1885. /**
  1886. * Parse the real tag name for the specific platform.
  1887. */
  1888. parsePlatformTagName: identity,
  1889. /**
  1890. * Check if an attribute must be bound using property, e.g. value
  1891. * Platform-dependent.
  1892. */
  1893. mustUseProp: no,
  1894. /**
  1895. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  1896. * This will significantly reduce performance if set to false.
  1897. */
  1898. async: true,
  1899. /**
  1900. * Exposed for legacy reasons
  1901. */
  1902. _lifecycleHooks: LIFECYCLE_HOOKS
  1903. });
  1904. /* */
  1905. /**
  1906. * unicode letters used for parsing html tags, component names and property paths.
  1907. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  1908. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  1909. */
  1910. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  1911. /**
  1912. * Check if a string starts with $ or _
  1913. */
  1914. function isReserved (str) {
  1915. var c = (str + '').charCodeAt(0);
  1916. return c === 0x24 || c === 0x5F
  1917. }
  1918. /**
  1919. * Define a property.
  1920. */
  1921. function def (obj, key, val, enumerable) {
  1922. Object.defineProperty(obj, key, {
  1923. value: val,
  1924. enumerable: !!enumerable,
  1925. writable: true,
  1926. configurable: true
  1927. });
  1928. }
  1929. /**
  1930. * Parse simple path.
  1931. */
  1932. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  1933. function parsePath (path) {
  1934. if (bailRE.test(path)) {
  1935. return
  1936. }
  1937. var segments = path.split('.');
  1938. return function (obj) {
  1939. for (var i = 0; i < segments.length; i++) {
  1940. if (!obj) { return }
  1941. obj = obj[segments[i]];
  1942. }
  1943. return obj
  1944. }
  1945. }
  1946. /* */
  1947. // can we use __proto__?
  1948. var hasProto = '__proto__' in {};
  1949. // Browser environment sniffing
  1950. var inBrowser = typeof window !== 'undefined';
  1951. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  1952. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  1953. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  1954. var isIE = UA && /msie|trident/.test(UA);
  1955. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  1956. var isEdge = UA && UA.indexOf('edge/') > 0;
  1957. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  1958. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  1959. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  1960. var isPhantomJS = UA && /phantomjs/.test(UA);
  1961. var isFF = UA && UA.match(/firefox\/(\d+)/);
  1962. // Firefox has a "watch" function on Object.prototype...
  1963. var nativeWatch = ({}).watch;
  1964. if (inBrowser) {
  1965. try {
  1966. var opts = {};
  1967. Object.defineProperty(opts, 'passive', ({
  1968. get: function get () {
  1969. }
  1970. })); // https://github.com/facebook/flow/issues/285
  1971. window.addEventListener('test-passive', null, opts);
  1972. } catch (e) {}
  1973. }
  1974. // this needs to be lazy-evaled because vue may be required before
  1975. // vue-server-renderer can set VUE_ENV
  1976. var _isServer;
  1977. var isServerRendering = function () {
  1978. if (_isServer === undefined) {
  1979. /* istanbul ignore if */
  1980. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  1981. // detect presence of vue-server-renderer and avoid
  1982. // Webpack shimming the process
  1983. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  1984. } else {
  1985. _isServer = false;
  1986. }
  1987. }
  1988. return _isServer
  1989. };
  1990. // detect devtools
  1991. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  1992. /* istanbul ignore next */
  1993. function isNative (Ctor) {
  1994. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  1995. }
  1996. var hasSymbol =
  1997. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  1998. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  1999. var _Set;
  2000. /* istanbul ignore if */ // $flow-disable-line
  2001. if (typeof Set !== 'undefined' && isNative(Set)) {
  2002. // use native Set when available.
  2003. _Set = Set;
  2004. } else {
  2005. // a non-standard Set polyfill that only works with primitive keys.
  2006. _Set = /*@__PURE__*/(function () {
  2007. function Set () {
  2008. this.set = Object.create(null);
  2009. }
  2010. Set.prototype.has = function has (key) {
  2011. return this.set[key] === true
  2012. };
  2013. Set.prototype.add = function add (key) {
  2014. this.set[key] = true;
  2015. };
  2016. Set.prototype.clear = function clear () {
  2017. this.set = Object.create(null);
  2018. };
  2019. return Set;
  2020. }());
  2021. }
  2022. /* */
  2023. var warn = noop;
  2024. var tip = noop;
  2025. var generateComponentTrace = (noop); // work around flow check
  2026. var formatComponentName = (noop);
  2027. if (true) {
  2028. var hasConsole = typeof console !== 'undefined';
  2029. var classifyRE = /(?:^|[-_])(\w)/g;
  2030. var classify = function (str) { return str
  2031. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  2032. .replace(/[-_]/g, ''); };
  2033. warn = function (msg, vm) {
  2034. var trace = vm ? generateComponentTrace(vm) : '';
  2035. if (config.warnHandler) {
  2036. config.warnHandler.call(null, msg, vm, trace);
  2037. } else if (hasConsole && (!config.silent)) {
  2038. console.error(("[Vue warn]: " + msg + trace));
  2039. }
  2040. };
  2041. tip = function (msg, vm) {
  2042. if (hasConsole && (!config.silent)) {
  2043. console.warn("[Vue tip]: " + msg + (
  2044. vm ? generateComponentTrace(vm) : ''
  2045. ));
  2046. }
  2047. };
  2048. formatComponentName = function (vm, includeFile) {
  2049. if (vm.$root === vm) {
  2050. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  2051. return ('') + vm.$options.__file
  2052. }
  2053. return '<Root>'
  2054. }
  2055. var options = typeof vm === 'function' && vm.cid != null
  2056. ? vm.options
  2057. : vm._isVue
  2058. ? vm.$options || vm.constructor.options
  2059. : vm;
  2060. var name = options.name || options._componentTag;
  2061. var file = options.__file;
  2062. if (!name && file) {
  2063. var match = file.match(/([^/\\]+)\.vue$/);
  2064. name = match && match[1];
  2065. }
  2066. return (
  2067. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  2068. (file && includeFile !== false ? (" at " + file) : '')
  2069. )
  2070. };
  2071. var repeat = function (str, n) {
  2072. var res = '';
  2073. while (n) {
  2074. if (n % 2 === 1) { res += str; }
  2075. if (n > 1) { str += str; }
  2076. n >>= 1;
  2077. }
  2078. return res
  2079. };
  2080. generateComponentTrace = function (vm) {
  2081. if (vm._isVue && vm.$parent) {
  2082. var tree = [];
  2083. var currentRecursiveSequence = 0;
  2084. while (vm && vm.$options.name !== 'PageBody') {
  2085. if (tree.length > 0) {
  2086. var last = tree[tree.length - 1];
  2087. if (last.constructor === vm.constructor) {
  2088. currentRecursiveSequence++;
  2089. vm = vm.$parent;
  2090. continue
  2091. } else if (currentRecursiveSequence > 0) {
  2092. tree[tree.length - 1] = [last, currentRecursiveSequence];
  2093. currentRecursiveSequence = 0;
  2094. }
  2095. }
  2096. !vm.$options.isReserved && tree.push(vm);
  2097. vm = vm.$parent;
  2098. }
  2099. return '\n\nfound in\n\n' + tree
  2100. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  2101. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  2102. : formatComponentName(vm))); })
  2103. .join('\n')
  2104. } else {
  2105. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  2106. }
  2107. };
  2108. }
  2109. /* */
  2110. var uid = 0;
  2111. /**
  2112. * A dep is an observable that can have multiple
  2113. * directives subscribing to it.
  2114. */
  2115. var Dep = function Dep () {
  2116. this.id = uid++;
  2117. this.subs = [];
  2118. };
  2119. Dep.prototype.addSub = function addSub (sub) {
  2120. this.subs.push(sub);
  2121. };
  2122. Dep.prototype.removeSub = function removeSub (sub) {
  2123. remove(this.subs, sub);
  2124. };
  2125. Dep.prototype.depend = function depend () {
  2126. if (Dep.SharedObject.target) {
  2127. Dep.SharedObject.target.addDep(this);
  2128. }
  2129. };
  2130. Dep.prototype.notify = function notify () {
  2131. // stabilize the subscriber list first
  2132. var subs = this.subs.slice();
  2133. if ( true && !config.async) {
  2134. // subs aren't sorted in scheduler if not running async
  2135. // we need to sort them now to make sure they fire in correct
  2136. // order
  2137. subs.sort(function (a, b) { return a.id - b.id; });
  2138. }
  2139. for (var i = 0, l = subs.length; i < l; i++) {
  2140. subs[i].update();
  2141. }
  2142. };
  2143. // The current target watcher being evaluated.
  2144. // This is globally unique because only one watcher
  2145. // can be evaluated at a time.
  2146. // fixed by xxxxxx (nvue shared vuex)
  2147. /* eslint-disable no-undef */
  2148. Dep.SharedObject = {};
  2149. Dep.SharedObject.target = null;
  2150. Dep.SharedObject.targetStack = [];
  2151. function pushTarget (target) {
  2152. Dep.SharedObject.targetStack.push(target);
  2153. Dep.SharedObject.target = target;
  2154. Dep.target = target;
  2155. }
  2156. function popTarget () {
  2157. Dep.SharedObject.targetStack.pop();
  2158. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  2159. Dep.target = Dep.SharedObject.target;
  2160. }
  2161. /* */
  2162. var VNode = function VNode (
  2163. tag,
  2164. data,
  2165. children,
  2166. text,
  2167. elm,
  2168. context,
  2169. componentOptions,
  2170. asyncFactory
  2171. ) {
  2172. this.tag = tag;
  2173. this.data = data;
  2174. this.children = children;
  2175. this.text = text;
  2176. this.elm = elm;
  2177. this.ns = undefined;
  2178. this.context = context;
  2179. this.fnContext = undefined;
  2180. this.fnOptions = undefined;
  2181. this.fnScopeId = undefined;
  2182. this.key = data && data.key;
  2183. this.componentOptions = componentOptions;
  2184. this.componentInstance = undefined;
  2185. this.parent = undefined;
  2186. this.raw = false;
  2187. this.isStatic = false;
  2188. this.isRootInsert = true;
  2189. this.isComment = false;
  2190. this.isCloned = false;
  2191. this.isOnce = false;
  2192. this.asyncFactory = asyncFactory;
  2193. this.asyncMeta = undefined;
  2194. this.isAsyncPlaceholder = false;
  2195. };
  2196. var prototypeAccessors = { child: { configurable: true } };
  2197. // DEPRECATED: alias for componentInstance for backwards compat.
  2198. /* istanbul ignore next */
  2199. prototypeAccessors.child.get = function () {
  2200. return this.componentInstance
  2201. };
  2202. Object.defineProperties( VNode.prototype, prototypeAccessors );
  2203. var createEmptyVNode = function (text) {
  2204. if ( text === void 0 ) text = '';
  2205. var node = new VNode();
  2206. node.text = text;
  2207. node.isComment = true;
  2208. return node
  2209. };
  2210. function createTextVNode (val) {
  2211. return new VNode(undefined, undefined, undefined, String(val))
  2212. }
  2213. // optimized shallow clone
  2214. // used for static nodes and slot nodes because they may be reused across
  2215. // multiple renders, cloning them avoids errors when DOM manipulations rely
  2216. // on their elm reference.
  2217. function cloneVNode (vnode) {
  2218. var cloned = new VNode(
  2219. vnode.tag,
  2220. vnode.data,
  2221. // #7975
  2222. // clone children array to avoid mutating original in case of cloning
  2223. // a child.
  2224. vnode.children && vnode.children.slice(),
  2225. vnode.text,
  2226. vnode.elm,
  2227. vnode.context,
  2228. vnode.componentOptions,
  2229. vnode.asyncFactory
  2230. );
  2231. cloned.ns = vnode.ns;
  2232. cloned.isStatic = vnode.isStatic;
  2233. cloned.key = vnode.key;
  2234. cloned.isComment = vnode.isComment;
  2235. cloned.fnContext = vnode.fnContext;
  2236. cloned.fnOptions = vnode.fnOptions;
  2237. cloned.fnScopeId = vnode.fnScopeId;
  2238. cloned.asyncMeta = vnode.asyncMeta;
  2239. cloned.isCloned = true;
  2240. return cloned
  2241. }
  2242. /*
  2243. * not type checking this file because flow doesn't play well with
  2244. * dynamically accessing methods on Array prototype
  2245. */
  2246. var arrayProto = Array.prototype;
  2247. var arrayMethods = Object.create(arrayProto);
  2248. var methodsToPatch = [
  2249. 'push',
  2250. 'pop',
  2251. 'shift',
  2252. 'unshift',
  2253. 'splice',
  2254. 'sort',
  2255. 'reverse'
  2256. ];
  2257. /**
  2258. * Intercept mutating methods and emit events
  2259. */
  2260. methodsToPatch.forEach(function (method) {
  2261. // cache original method
  2262. var original = arrayProto[method];
  2263. def(arrayMethods, method, function mutator () {
  2264. var args = [], len = arguments.length;
  2265. while ( len-- ) args[ len ] = arguments[ len ];
  2266. var result = original.apply(this, args);
  2267. var ob = this.__ob__;
  2268. var inserted;
  2269. switch (method) {
  2270. case 'push':
  2271. case 'unshift':
  2272. inserted = args;
  2273. break
  2274. case 'splice':
  2275. inserted = args.slice(2);
  2276. break
  2277. }
  2278. if (inserted) { ob.observeArray(inserted); }
  2279. // notify change
  2280. ob.dep.notify();
  2281. return result
  2282. });
  2283. });
  2284. /* */
  2285. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  2286. /**
  2287. * In some cases we may want to disable observation inside a component's
  2288. * update computation.
  2289. */
  2290. var shouldObserve = true;
  2291. function toggleObserving (value) {
  2292. shouldObserve = value;
  2293. }
  2294. /**
  2295. * Observer class that is attached to each observed
  2296. * object. Once attached, the observer converts the target
  2297. * object's property keys into getter/setters that
  2298. * collect dependencies and dispatch updates.
  2299. */
  2300. var Observer = function Observer (value) {
  2301. this.value = value;
  2302. this.dep = new Dep();
  2303. this.vmCount = 0;
  2304. def(value, '__ob__', this);
  2305. if (Array.isArray(value)) {
  2306. if (hasProto) {
  2307. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  2308. if(value.push !== value.__proto__.push){
  2309. copyAugment(value, arrayMethods, arrayKeys);
  2310. } else {
  2311. protoAugment(value, arrayMethods);
  2312. }
  2313. }
  2314. } else {
  2315. copyAugment(value, arrayMethods, arrayKeys);
  2316. }
  2317. this.observeArray(value);
  2318. } else {
  2319. this.walk(value);
  2320. }
  2321. };
  2322. /**
  2323. * Walk through all properties and convert them into
  2324. * getter/setters. This method should only be called when
  2325. * value type is Object.
  2326. */
  2327. Observer.prototype.walk = function walk (obj) {
  2328. var keys = Object.keys(obj);
  2329. for (var i = 0; i < keys.length; i++) {
  2330. defineReactive$$1(obj, keys[i]);
  2331. }
  2332. };
  2333. /**
  2334. * Observe a list of Array items.
  2335. */
  2336. Observer.prototype.observeArray = function observeArray (items) {
  2337. for (var i = 0, l = items.length; i < l; i++) {
  2338. observe(items[i]);
  2339. }
  2340. };
  2341. // helpers
  2342. /**
  2343. * Augment a target Object or Array by intercepting
  2344. * the prototype chain using __proto__
  2345. */
  2346. function protoAugment (target, src) {
  2347. /* eslint-disable no-proto */
  2348. target.__proto__ = src;
  2349. /* eslint-enable no-proto */
  2350. }
  2351. /**
  2352. * Augment a target Object or Array by defining
  2353. * hidden properties.
  2354. */
  2355. /* istanbul ignore next */
  2356. function copyAugment (target, src, keys) {
  2357. for (var i = 0, l = keys.length; i < l; i++) {
  2358. var key = keys[i];
  2359. def(target, key, src[key]);
  2360. }
  2361. }
  2362. /**
  2363. * Attempt to create an observer instance for a value,
  2364. * returns the new observer if successfully observed,
  2365. * or the existing observer if the value already has one.
  2366. */
  2367. function observe (value, asRootData) {
  2368. if (!isObject(value) || value instanceof VNode) {
  2369. return
  2370. }
  2371. var ob;
  2372. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  2373. ob = value.__ob__;
  2374. } else if (
  2375. shouldObserve &&
  2376. !isServerRendering() &&
  2377. (Array.isArray(value) || isPlainObject(value)) &&
  2378. Object.isExtensible(value) &&
  2379. !value._isVue
  2380. ) {
  2381. ob = new Observer(value);
  2382. }
  2383. if (asRootData && ob) {
  2384. ob.vmCount++;
  2385. }
  2386. return ob
  2387. }
  2388. /**
  2389. * Define a reactive property on an Object.
  2390. */
  2391. function defineReactive$$1 (
  2392. obj,
  2393. key,
  2394. val,
  2395. customSetter,
  2396. shallow
  2397. ) {
  2398. var dep = new Dep();
  2399. var property = Object.getOwnPropertyDescriptor(obj, key);
  2400. if (property && property.configurable === false) {
  2401. return
  2402. }
  2403. // cater for pre-defined getter/setters
  2404. var getter = property && property.get;
  2405. var setter = property && property.set;
  2406. if ((!getter || setter) && arguments.length === 2) {
  2407. val = obj[key];
  2408. }
  2409. var childOb = !shallow && observe(val);
  2410. Object.defineProperty(obj, key, {
  2411. enumerable: true,
  2412. configurable: true,
  2413. get: function reactiveGetter () {
  2414. var value = getter ? getter.call(obj) : val;
  2415. if (Dep.SharedObject.target) { // fixed by xxxxxx
  2416. dep.depend();
  2417. if (childOb) {
  2418. childOb.dep.depend();
  2419. if (Array.isArray(value)) {
  2420. dependArray(value);
  2421. }
  2422. }
  2423. }
  2424. return value
  2425. },
  2426. set: function reactiveSetter (newVal) {
  2427. var value = getter ? getter.call(obj) : val;
  2428. /* eslint-disable no-self-compare */
  2429. if (newVal === value || (newVal !== newVal && value !== value)) {
  2430. return
  2431. }
  2432. /* eslint-enable no-self-compare */
  2433. if ( true && customSetter) {
  2434. customSetter();
  2435. }
  2436. // #7981: for accessor properties without setter
  2437. if (getter && !setter) { return }
  2438. if (setter) {
  2439. setter.call(obj, newVal);
  2440. } else {
  2441. val = newVal;
  2442. }
  2443. childOb = !shallow && observe(newVal);
  2444. dep.notify();
  2445. }
  2446. });
  2447. }
  2448. /**
  2449. * Set a property on an object. Adds the new property and
  2450. * triggers change notification if the property doesn't
  2451. * already exist.
  2452. */
  2453. function set (target, key, val) {
  2454. if ( true &&
  2455. (isUndef(target) || isPrimitive(target))
  2456. ) {
  2457. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  2458. }
  2459. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2460. target.length = Math.max(target.length, key);
  2461. target.splice(key, 1, val);
  2462. return val
  2463. }
  2464. if (key in target && !(key in Object.prototype)) {
  2465. target[key] = val;
  2466. return val
  2467. }
  2468. var ob = (target).__ob__;
  2469. if (target._isVue || (ob && ob.vmCount)) {
  2470. true && warn(
  2471. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  2472. 'at runtime - declare it upfront in the data option.'
  2473. );
  2474. return val
  2475. }
  2476. if (!ob) {
  2477. target[key] = val;
  2478. return val
  2479. }
  2480. defineReactive$$1(ob.value, key, val);
  2481. ob.dep.notify();
  2482. return val
  2483. }
  2484. /**
  2485. * Delete a property and trigger change if necessary.
  2486. */
  2487. function del (target, key) {
  2488. if ( true &&
  2489. (isUndef(target) || isPrimitive(target))
  2490. ) {
  2491. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  2492. }
  2493. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2494. target.splice(key, 1);
  2495. return
  2496. }
  2497. var ob = (target).__ob__;
  2498. if (target._isVue || (ob && ob.vmCount)) {
  2499. true && warn(
  2500. 'Avoid deleting properties on a Vue instance or its root $data ' +
  2501. '- just set it to null.'
  2502. );
  2503. return
  2504. }
  2505. if (!hasOwn(target, key)) {
  2506. return
  2507. }
  2508. delete target[key];
  2509. if (!ob) {
  2510. return
  2511. }
  2512. ob.dep.notify();
  2513. }
  2514. /**
  2515. * Collect dependencies on array elements when the array is touched, since
  2516. * we cannot intercept array element access like property getters.
  2517. */
  2518. function dependArray (value) {
  2519. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  2520. e = value[i];
  2521. e && e.__ob__ && e.__ob__.dep.depend();
  2522. if (Array.isArray(e)) {
  2523. dependArray(e);
  2524. }
  2525. }
  2526. }
  2527. /* */
  2528. /**
  2529. * Option overwriting strategies are functions that handle
  2530. * how to merge a parent option value and a child option
  2531. * value into the final value.
  2532. */
  2533. var strats = config.optionMergeStrategies;
  2534. /**
  2535. * Options with restrictions
  2536. */
  2537. if (true) {
  2538. strats.el = strats.propsData = function (parent, child, vm, key) {
  2539. if (!vm) {
  2540. warn(
  2541. "option \"" + key + "\" can only be used during instance " +
  2542. 'creation with the `new` keyword.'
  2543. );
  2544. }
  2545. return defaultStrat(parent, child)
  2546. };
  2547. }
  2548. /**
  2549. * Helper that recursively merges two data objects together.
  2550. */
  2551. function mergeData (to, from) {
  2552. if (!from) { return to }
  2553. var key, toVal, fromVal;
  2554. var keys = hasSymbol
  2555. ? Reflect.ownKeys(from)
  2556. : Object.keys(from);
  2557. for (var i = 0; i < keys.length; i++) {
  2558. key = keys[i];
  2559. // in case the object is already observed...
  2560. if (key === '__ob__') { continue }
  2561. toVal = to[key];
  2562. fromVal = from[key];
  2563. if (!hasOwn(to, key)) {
  2564. set(to, key, fromVal);
  2565. } else if (
  2566. toVal !== fromVal &&
  2567. isPlainObject(toVal) &&
  2568. isPlainObject(fromVal)
  2569. ) {
  2570. mergeData(toVal, fromVal);
  2571. }
  2572. }
  2573. return to
  2574. }
  2575. /**
  2576. * Data
  2577. */
  2578. function mergeDataOrFn (
  2579. parentVal,
  2580. childVal,
  2581. vm
  2582. ) {
  2583. if (!vm) {
  2584. // in a Vue.extend merge, both should be functions
  2585. if (!childVal) {
  2586. return parentVal
  2587. }
  2588. if (!parentVal) {
  2589. return childVal
  2590. }
  2591. // when parentVal & childVal are both present,
  2592. // we need to return a function that returns the
  2593. // merged result of both functions... no need to
  2594. // check if parentVal is a function here because
  2595. // it has to be a function to pass previous merges.
  2596. return function mergedDataFn () {
  2597. return mergeData(
  2598. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  2599. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  2600. )
  2601. }
  2602. } else {
  2603. return function mergedInstanceDataFn () {
  2604. // instance merge
  2605. var instanceData = typeof childVal === 'function'
  2606. ? childVal.call(vm, vm)
  2607. : childVal;
  2608. var defaultData = typeof parentVal === 'function'
  2609. ? parentVal.call(vm, vm)
  2610. : parentVal;
  2611. if (instanceData) {
  2612. return mergeData(instanceData, defaultData)
  2613. } else {
  2614. return defaultData
  2615. }
  2616. }
  2617. }
  2618. }
  2619. strats.data = function (
  2620. parentVal,
  2621. childVal,
  2622. vm
  2623. ) {
  2624. if (!vm) {
  2625. if (childVal && typeof childVal !== 'function') {
  2626. true && warn(
  2627. 'The "data" option should be a function ' +
  2628. 'that returns a per-instance value in component ' +
  2629. 'definitions.',
  2630. vm
  2631. );
  2632. return parentVal
  2633. }
  2634. return mergeDataOrFn(parentVal, childVal)
  2635. }
  2636. return mergeDataOrFn(parentVal, childVal, vm)
  2637. };
  2638. /**
  2639. * Hooks and props are merged as arrays.
  2640. */
  2641. function mergeHook (
  2642. parentVal,
  2643. childVal
  2644. ) {
  2645. var res = childVal
  2646. ? parentVal
  2647. ? parentVal.concat(childVal)
  2648. : Array.isArray(childVal)
  2649. ? childVal
  2650. : [childVal]
  2651. : parentVal;
  2652. return res
  2653. ? dedupeHooks(res)
  2654. : res
  2655. }
  2656. function dedupeHooks (hooks) {
  2657. var res = [];
  2658. for (var i = 0; i < hooks.length; i++) {
  2659. if (res.indexOf(hooks[i]) === -1) {
  2660. res.push(hooks[i]);
  2661. }
  2662. }
  2663. return res
  2664. }
  2665. LIFECYCLE_HOOKS.forEach(function (hook) {
  2666. strats[hook] = mergeHook;
  2667. });
  2668. /**
  2669. * Assets
  2670. *
  2671. * When a vm is present (instance creation), we need to do
  2672. * a three-way merge between constructor options, instance
  2673. * options and parent options.
  2674. */
  2675. function mergeAssets (
  2676. parentVal,
  2677. childVal,
  2678. vm,
  2679. key
  2680. ) {
  2681. var res = Object.create(parentVal || null);
  2682. if (childVal) {
  2683. true && assertObjectType(key, childVal, vm);
  2684. return extend(res, childVal)
  2685. } else {
  2686. return res
  2687. }
  2688. }
  2689. ASSET_TYPES.forEach(function (type) {
  2690. strats[type + 's'] = mergeAssets;
  2691. });
  2692. /**
  2693. * Watchers.
  2694. *
  2695. * Watchers hashes should not overwrite one
  2696. * another, so we merge them as arrays.
  2697. */
  2698. strats.watch = function (
  2699. parentVal,
  2700. childVal,
  2701. vm,
  2702. key
  2703. ) {
  2704. // work around Firefox's Object.prototype.watch...
  2705. if (parentVal === nativeWatch) { parentVal = undefined; }
  2706. if (childVal === nativeWatch) { childVal = undefined; }
  2707. /* istanbul ignore if */
  2708. if (!childVal) { return Object.create(parentVal || null) }
  2709. if (true) {
  2710. assertObjectType(key, childVal, vm);
  2711. }
  2712. if (!parentVal) { return childVal }
  2713. var ret = {};
  2714. extend(ret, parentVal);
  2715. for (var key$1 in childVal) {
  2716. var parent = ret[key$1];
  2717. var child = childVal[key$1];
  2718. if (parent && !Array.isArray(parent)) {
  2719. parent = [parent];
  2720. }
  2721. ret[key$1] = parent
  2722. ? parent.concat(child)
  2723. : Array.isArray(child) ? child : [child];
  2724. }
  2725. return ret
  2726. };
  2727. /**
  2728. * Other object hashes.
  2729. */
  2730. strats.props =
  2731. strats.methods =
  2732. strats.inject =
  2733. strats.computed = function (
  2734. parentVal,
  2735. childVal,
  2736. vm,
  2737. key
  2738. ) {
  2739. if (childVal && "development" !== 'production') {
  2740. assertObjectType(key, childVal, vm);
  2741. }
  2742. if (!parentVal) { return childVal }
  2743. var ret = Object.create(null);
  2744. extend(ret, parentVal);
  2745. if (childVal) { extend(ret, childVal); }
  2746. return ret
  2747. };
  2748. strats.provide = mergeDataOrFn;
  2749. /**
  2750. * Default strategy.
  2751. */
  2752. var defaultStrat = function (parentVal, childVal) {
  2753. return childVal === undefined
  2754. ? parentVal
  2755. : childVal
  2756. };
  2757. /**
  2758. * Validate component names
  2759. */
  2760. function checkComponents (options) {
  2761. for (var key in options.components) {
  2762. validateComponentName(key);
  2763. }
  2764. }
  2765. function validateComponentName (name) {
  2766. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  2767. warn(
  2768. 'Invalid component name: "' + name + '". Component names ' +
  2769. 'should conform to valid custom element name in html5 specification.'
  2770. );
  2771. }
  2772. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  2773. warn(
  2774. 'Do not use built-in or reserved HTML elements as component ' +
  2775. 'id: ' + name
  2776. );
  2777. }
  2778. }
  2779. /**
  2780. * Ensure all props option syntax are normalized into the
  2781. * Object-based format.
  2782. */
  2783. function normalizeProps (options, vm) {
  2784. var props = options.props;
  2785. if (!props) { return }
  2786. var res = {};
  2787. var i, val, name;
  2788. if (Array.isArray(props)) {
  2789. i = props.length;
  2790. while (i--) {
  2791. val = props[i];
  2792. if (typeof val === 'string') {
  2793. name = camelize(val);
  2794. res[name] = { type: null };
  2795. } else if (true) {
  2796. warn('props must be strings when using array syntax.');
  2797. }
  2798. }
  2799. } else if (isPlainObject(props)) {
  2800. for (var key in props) {
  2801. val = props[key];
  2802. name = camelize(key);
  2803. res[name] = isPlainObject(val)
  2804. ? val
  2805. : { type: val };
  2806. }
  2807. } else if (true) {
  2808. warn(
  2809. "Invalid value for option \"props\": expected an Array or an Object, " +
  2810. "but got " + (toRawType(props)) + ".",
  2811. vm
  2812. );
  2813. }
  2814. options.props = res;
  2815. }
  2816. /**
  2817. * Normalize all injections into Object-based format
  2818. */
  2819. function normalizeInject (options, vm) {
  2820. var inject = options.inject;
  2821. if (!inject) { return }
  2822. var normalized = options.inject = {};
  2823. if (Array.isArray(inject)) {
  2824. for (var i = 0; i < inject.length; i++) {
  2825. normalized[inject[i]] = { from: inject[i] };
  2826. }
  2827. } else if (isPlainObject(inject)) {
  2828. for (var key in inject) {
  2829. var val = inject[key];
  2830. normalized[key] = isPlainObject(val)
  2831. ? extend({ from: key }, val)
  2832. : { from: val };
  2833. }
  2834. } else if (true) {
  2835. warn(
  2836. "Invalid value for option \"inject\": expected an Array or an Object, " +
  2837. "but got " + (toRawType(inject)) + ".",
  2838. vm
  2839. );
  2840. }
  2841. }
  2842. /**
  2843. * Normalize raw function directives into object format.
  2844. */
  2845. function normalizeDirectives (options) {
  2846. var dirs = options.directives;
  2847. if (dirs) {
  2848. for (var key in dirs) {
  2849. var def$$1 = dirs[key];
  2850. if (typeof def$$1 === 'function') {
  2851. dirs[key] = { bind: def$$1, update: def$$1 };
  2852. }
  2853. }
  2854. }
  2855. }
  2856. function assertObjectType (name, value, vm) {
  2857. if (!isPlainObject(value)) {
  2858. warn(
  2859. "Invalid value for option \"" + name + "\": expected an Object, " +
  2860. "but got " + (toRawType(value)) + ".",
  2861. vm
  2862. );
  2863. }
  2864. }
  2865. /**
  2866. * Merge two option objects into a new one.
  2867. * Core utility used in both instantiation and inheritance.
  2868. */
  2869. function mergeOptions (
  2870. parent,
  2871. child,
  2872. vm
  2873. ) {
  2874. if (true) {
  2875. checkComponents(child);
  2876. }
  2877. if (typeof child === 'function') {
  2878. child = child.options;
  2879. }
  2880. normalizeProps(child, vm);
  2881. normalizeInject(child, vm);
  2882. normalizeDirectives(child);
  2883. // Apply extends and mixins on the child options,
  2884. // but only if it is a raw options object that isn't
  2885. // the result of another mergeOptions call.
  2886. // Only merged options has the _base property.
  2887. if (!child._base) {
  2888. if (child.extends) {
  2889. parent = mergeOptions(parent, child.extends, vm);
  2890. }
  2891. if (child.mixins) {
  2892. for (var i = 0, l = child.mixins.length; i < l; i++) {
  2893. parent = mergeOptions(parent, child.mixins[i], vm);
  2894. }
  2895. }
  2896. }
  2897. var options = {};
  2898. var key;
  2899. for (key in parent) {
  2900. mergeField(key);
  2901. }
  2902. for (key in child) {
  2903. if (!hasOwn(parent, key)) {
  2904. mergeField(key);
  2905. }
  2906. }
  2907. function mergeField (key) {
  2908. var strat = strats[key] || defaultStrat;
  2909. options[key] = strat(parent[key], child[key], vm, key);
  2910. }
  2911. return options
  2912. }
  2913. /**
  2914. * Resolve an asset.
  2915. * This function is used because child instances need access
  2916. * to assets defined in its ancestor chain.
  2917. */
  2918. function resolveAsset (
  2919. options,
  2920. type,
  2921. id,
  2922. warnMissing
  2923. ) {
  2924. /* istanbul ignore if */
  2925. if (typeof id !== 'string') {
  2926. return
  2927. }
  2928. var assets = options[type];
  2929. // check local registration variations first
  2930. if (hasOwn(assets, id)) { return assets[id] }
  2931. var camelizedId = camelize(id);
  2932. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  2933. var PascalCaseId = capitalize(camelizedId);
  2934. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  2935. // fallback to prototype chain
  2936. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  2937. if ( true && warnMissing && !res) {
  2938. warn(
  2939. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  2940. options
  2941. );
  2942. }
  2943. return res
  2944. }
  2945. /* */
  2946. function validateProp (
  2947. key,
  2948. propOptions,
  2949. propsData,
  2950. vm
  2951. ) {
  2952. var prop = propOptions[key];
  2953. var absent = !hasOwn(propsData, key);
  2954. var value = propsData[key];
  2955. // boolean casting
  2956. var booleanIndex = getTypeIndex(Boolean, prop.type);
  2957. if (booleanIndex > -1) {
  2958. if (absent && !hasOwn(prop, 'default')) {
  2959. value = false;
  2960. } else if (value === '' || value === hyphenate(key)) {
  2961. // only cast empty string / same name to boolean if
  2962. // boolean has higher priority
  2963. var stringIndex = getTypeIndex(String, prop.type);
  2964. if (stringIndex < 0 || booleanIndex < stringIndex) {
  2965. value = true;
  2966. }
  2967. }
  2968. }
  2969. // check default value
  2970. if (value === undefined) {
  2971. value = getPropDefaultValue(vm, prop, key);
  2972. // since the default value is a fresh copy,
  2973. // make sure to observe it.
  2974. var prevShouldObserve = shouldObserve;
  2975. toggleObserving(true);
  2976. observe(value);
  2977. toggleObserving(prevShouldObserve);
  2978. }
  2979. if (
  2980. true
  2981. ) {
  2982. assertProp(prop, key, value, vm, absent);
  2983. }
  2984. return value
  2985. }
  2986. /**
  2987. * Get the default value of a prop.
  2988. */
  2989. function getPropDefaultValue (vm, prop, key) {
  2990. // no default, return undefined
  2991. if (!hasOwn(prop, 'default')) {
  2992. return undefined
  2993. }
  2994. var def = prop.default;
  2995. // warn against non-factory defaults for Object & Array
  2996. if ( true && isObject(def)) {
  2997. warn(
  2998. 'Invalid default value for prop "' + key + '": ' +
  2999. 'Props with type Object/Array must use a factory function ' +
  3000. 'to return the default value.',
  3001. vm
  3002. );
  3003. }
  3004. // the raw prop value was also undefined from previous render,
  3005. // return previous default value to avoid unnecessary watcher trigger
  3006. if (vm && vm.$options.propsData &&
  3007. vm.$options.propsData[key] === undefined &&
  3008. vm._props[key] !== undefined
  3009. ) {
  3010. return vm._props[key]
  3011. }
  3012. // call factory function for non-Function types
  3013. // a value is Function if its prototype is function even across different execution context
  3014. return typeof def === 'function' && getType(prop.type) !== 'Function'
  3015. ? def.call(vm)
  3016. : def
  3017. }
  3018. /**
  3019. * Assert whether a prop is valid.
  3020. */
  3021. function assertProp (
  3022. prop,
  3023. name,
  3024. value,
  3025. vm,
  3026. absent
  3027. ) {
  3028. if (prop.required && absent) {
  3029. warn(
  3030. 'Missing required prop: "' + name + '"',
  3031. vm
  3032. );
  3033. return
  3034. }
  3035. if (value == null && !prop.required) {
  3036. return
  3037. }
  3038. var type = prop.type;
  3039. var valid = !type || type === true;
  3040. var expectedTypes = [];
  3041. if (type) {
  3042. if (!Array.isArray(type)) {
  3043. type = [type];
  3044. }
  3045. for (var i = 0; i < type.length && !valid; i++) {
  3046. var assertedType = assertType(value, type[i]);
  3047. expectedTypes.push(assertedType.expectedType || '');
  3048. valid = assertedType.valid;
  3049. }
  3050. }
  3051. if (!valid) {
  3052. warn(
  3053. getInvalidTypeMessage(name, value, expectedTypes),
  3054. vm
  3055. );
  3056. return
  3057. }
  3058. var validator = prop.validator;
  3059. if (validator) {
  3060. if (!validator(value)) {
  3061. warn(
  3062. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  3063. vm
  3064. );
  3065. }
  3066. }
  3067. }
  3068. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  3069. function assertType (value, type) {
  3070. var valid;
  3071. var expectedType = getType(type);
  3072. if (simpleCheckRE.test(expectedType)) {
  3073. var t = typeof value;
  3074. valid = t === expectedType.toLowerCase();
  3075. // for primitive wrapper objects
  3076. if (!valid && t === 'object') {
  3077. valid = value instanceof type;
  3078. }
  3079. } else if (expectedType === 'Object') {
  3080. valid = isPlainObject(value);
  3081. } else if (expectedType === 'Array') {
  3082. valid = Array.isArray(value);
  3083. } else {
  3084. valid = value instanceof type;
  3085. }
  3086. return {
  3087. valid: valid,
  3088. expectedType: expectedType
  3089. }
  3090. }
  3091. /**
  3092. * Use function string name to check built-in types,
  3093. * because a simple equality check will fail when running
  3094. * across different vms / iframes.
  3095. */
  3096. function getType (fn) {
  3097. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  3098. return match ? match[1] : ''
  3099. }
  3100. function isSameType (a, b) {
  3101. return getType(a) === getType(b)
  3102. }
  3103. function getTypeIndex (type, expectedTypes) {
  3104. if (!Array.isArray(expectedTypes)) {
  3105. return isSameType(expectedTypes, type) ? 0 : -1
  3106. }
  3107. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  3108. if (isSameType(expectedTypes[i], type)) {
  3109. return i
  3110. }
  3111. }
  3112. return -1
  3113. }
  3114. function getInvalidTypeMessage (name, value, expectedTypes) {
  3115. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  3116. " Expected " + (expectedTypes.map(capitalize).join(', '));
  3117. var expectedType = expectedTypes[0];
  3118. var receivedType = toRawType(value);
  3119. var expectedValue = styleValue(value, expectedType);
  3120. var receivedValue = styleValue(value, receivedType);
  3121. // check if we need to specify expected value
  3122. if (expectedTypes.length === 1 &&
  3123. isExplicable(expectedType) &&
  3124. !isBoolean(expectedType, receivedType)) {
  3125. message += " with value " + expectedValue;
  3126. }
  3127. message += ", got " + receivedType + " ";
  3128. // check if we need to specify received value
  3129. if (isExplicable(receivedType)) {
  3130. message += "with value " + receivedValue + ".";
  3131. }
  3132. return message
  3133. }
  3134. function styleValue (value, type) {
  3135. if (type === 'String') {
  3136. return ("\"" + value + "\"")
  3137. } else if (type === 'Number') {
  3138. return ("" + (Number(value)))
  3139. } else {
  3140. return ("" + value)
  3141. }
  3142. }
  3143. function isExplicable (value) {
  3144. var explicitTypes = ['string', 'number', 'boolean'];
  3145. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  3146. }
  3147. function isBoolean () {
  3148. var args = [], len = arguments.length;
  3149. while ( len-- ) args[ len ] = arguments[ len ];
  3150. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  3151. }
  3152. /* */
  3153. function handleError (err, vm, info) {
  3154. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  3155. // See: https://github.com/vuejs/vuex/issues/1505
  3156. pushTarget();
  3157. try {
  3158. if (vm) {
  3159. var cur = vm;
  3160. while ((cur = cur.$parent)) {
  3161. var hooks = cur.$options.errorCaptured;
  3162. if (hooks) {
  3163. for (var i = 0; i < hooks.length; i++) {
  3164. try {
  3165. var capture = hooks[i].call(cur, err, vm, info) === false;
  3166. if (capture) { return }
  3167. } catch (e) {
  3168. globalHandleError(e, cur, 'errorCaptured hook');
  3169. }
  3170. }
  3171. }
  3172. }
  3173. }
  3174. globalHandleError(err, vm, info);
  3175. } finally {
  3176. popTarget();
  3177. }
  3178. }
  3179. function invokeWithErrorHandling (
  3180. handler,
  3181. context,
  3182. args,
  3183. vm,
  3184. info
  3185. ) {
  3186. var res;
  3187. try {
  3188. res = args ? handler.apply(context, args) : handler.call(context);
  3189. if (res && !res._isVue && isPromise(res) && !res._handled) {
  3190. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  3191. // issue #9511
  3192. // avoid catch triggering multiple times when nested calls
  3193. res._handled = true;
  3194. }
  3195. } catch (e) {
  3196. handleError(e, vm, info);
  3197. }
  3198. return res
  3199. }
  3200. function globalHandleError (err, vm, info) {
  3201. if (config.errorHandler) {
  3202. try {
  3203. return config.errorHandler.call(null, err, vm, info)
  3204. } catch (e) {
  3205. // if the user intentionally throws the original error in the handler,
  3206. // do not log it twice
  3207. if (e !== err) {
  3208. logError(e, null, 'config.errorHandler');
  3209. }
  3210. }
  3211. }
  3212. logError(err, vm, info);
  3213. }
  3214. function logError (err, vm, info) {
  3215. if (true) {
  3216. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  3217. }
  3218. /* istanbul ignore else */
  3219. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  3220. console.error(err);
  3221. } else {
  3222. throw err
  3223. }
  3224. }
  3225. /* */
  3226. var callbacks = [];
  3227. var pending = false;
  3228. function flushCallbacks () {
  3229. pending = false;
  3230. var copies = callbacks.slice(0);
  3231. callbacks.length = 0;
  3232. for (var i = 0; i < copies.length; i++) {
  3233. copies[i]();
  3234. }
  3235. }
  3236. // Here we have async deferring wrappers using microtasks.
  3237. // In 2.5 we used (macro) tasks (in combination with microtasks).
  3238. // However, it has subtle problems when state is changed right before repaint
  3239. // (e.g. #6813, out-in transitions).
  3240. // Also, using (macro) tasks in event handler would cause some weird behaviors
  3241. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  3242. // So we now use microtasks everywhere, again.
  3243. // A major drawback of this tradeoff is that there are some scenarios
  3244. // where microtasks have too high a priority and fire in between supposedly
  3245. // sequential events (e.g. #4521, #6690, which have workarounds)
  3246. // or even between bubbling of the same event (#6566).
  3247. var timerFunc;
  3248. // The nextTick behavior leverages the microtask queue, which can be accessed
  3249. // via either native Promise.then or MutationObserver.
  3250. // MutationObserver has wider support, however it is seriously bugged in
  3251. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  3252. // completely stops working after triggering a few times... so, if native
  3253. // Promise is available, we will use it:
  3254. /* istanbul ignore next, $flow-disable-line */
  3255. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3256. var p = Promise.resolve();
  3257. timerFunc = function () {
  3258. p.then(flushCallbacks);
  3259. // In problematic UIWebViews, Promise.then doesn't completely break, but
  3260. // it can get stuck in a weird state where callbacks are pushed into the
  3261. // microtask queue but the queue isn't being flushed, until the browser
  3262. // needs to do some other work, e.g. handle a timer. Therefore we can
  3263. // "force" the microtask queue to be flushed by adding an empty timer.
  3264. if (isIOS) { setTimeout(noop); }
  3265. };
  3266. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  3267. isNative(MutationObserver) ||
  3268. // PhantomJS and iOS 7.x
  3269. MutationObserver.toString() === '[object MutationObserverConstructor]'
  3270. )) {
  3271. // Use MutationObserver where native Promise is not available,
  3272. // e.g. PhantomJS, iOS7, Android 4.4
  3273. // (#6466 MutationObserver is unreliable in IE11)
  3274. var counter = 1;
  3275. var observer = new MutationObserver(flushCallbacks);
  3276. var textNode = document.createTextNode(String(counter));
  3277. observer.observe(textNode, {
  3278. characterData: true
  3279. });
  3280. timerFunc = function () {
  3281. counter = (counter + 1) % 2;
  3282. textNode.data = String(counter);
  3283. };
  3284. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3285. // Fallback to setImmediate.
  3286. // Technically it leverages the (macro) task queue,
  3287. // but it is still a better choice than setTimeout.
  3288. timerFunc = function () {
  3289. setImmediate(flushCallbacks);
  3290. };
  3291. } else {
  3292. // Fallback to setTimeout.
  3293. timerFunc = function () {
  3294. setTimeout(flushCallbacks, 0);
  3295. };
  3296. }
  3297. function nextTick (cb, ctx) {
  3298. var _resolve;
  3299. callbacks.push(function () {
  3300. if (cb) {
  3301. try {
  3302. cb.call(ctx);
  3303. } catch (e) {
  3304. handleError(e, ctx, 'nextTick');
  3305. }
  3306. } else if (_resolve) {
  3307. _resolve(ctx);
  3308. }
  3309. });
  3310. if (!pending) {
  3311. pending = true;
  3312. timerFunc();
  3313. }
  3314. // $flow-disable-line
  3315. if (!cb && typeof Promise !== 'undefined') {
  3316. return new Promise(function (resolve) {
  3317. _resolve = resolve;
  3318. })
  3319. }
  3320. }
  3321. /* */
  3322. /* not type checking this file because flow doesn't play well with Proxy */
  3323. var initProxy;
  3324. if (true) {
  3325. var allowedGlobals = makeMap(
  3326. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  3327. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  3328. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  3329. 'require' // for Webpack/Browserify
  3330. );
  3331. var warnNonPresent = function (target, key) {
  3332. warn(
  3333. "Property or method \"" + key + "\" is not defined on the instance but " +
  3334. 'referenced during render. Make sure that this property is reactive, ' +
  3335. 'either in the data option, or for class-based components, by ' +
  3336. 'initializing the property. ' +
  3337. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  3338. target
  3339. );
  3340. };
  3341. var warnReservedPrefix = function (target, key) {
  3342. warn(
  3343. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  3344. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  3345. 'prevent conflicts with Vue internals. ' +
  3346. 'See: https://vuejs.org/v2/api/#data',
  3347. target
  3348. );
  3349. };
  3350. var hasProxy =
  3351. typeof Proxy !== 'undefined' && isNative(Proxy);
  3352. if (hasProxy) {
  3353. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  3354. config.keyCodes = new Proxy(config.keyCodes, {
  3355. set: function set (target, key, value) {
  3356. if (isBuiltInModifier(key)) {
  3357. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  3358. return false
  3359. } else {
  3360. target[key] = value;
  3361. return true
  3362. }
  3363. }
  3364. });
  3365. }
  3366. var hasHandler = {
  3367. has: function has (target, key) {
  3368. var has = key in target;
  3369. var isAllowed = allowedGlobals(key) ||
  3370. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  3371. if (!has && !isAllowed) {
  3372. if (key in target.$data) { warnReservedPrefix(target, key); }
  3373. else { warnNonPresent(target, key); }
  3374. }
  3375. return has || !isAllowed
  3376. }
  3377. };
  3378. var getHandler = {
  3379. get: function get (target, key) {
  3380. if (typeof key === 'string' && !(key in target)) {
  3381. if (key in target.$data) { warnReservedPrefix(target, key); }
  3382. else { warnNonPresent(target, key); }
  3383. }
  3384. return target[key]
  3385. }
  3386. };
  3387. initProxy = function initProxy (vm) {
  3388. if (hasProxy) {
  3389. // determine which proxy handler to use
  3390. var options = vm.$options;
  3391. var handlers = options.render && options.render._withStripped
  3392. ? getHandler
  3393. : hasHandler;
  3394. vm._renderProxy = new Proxy(vm, handlers);
  3395. } else {
  3396. vm._renderProxy = vm;
  3397. }
  3398. };
  3399. }
  3400. /* */
  3401. var seenObjects = new _Set();
  3402. /**
  3403. * Recursively traverse an object to evoke all converted
  3404. * getters, so that every nested property inside the object
  3405. * is collected as a "deep" dependency.
  3406. */
  3407. function traverse (val) {
  3408. _traverse(val, seenObjects);
  3409. seenObjects.clear();
  3410. }
  3411. function _traverse (val, seen) {
  3412. var i, keys;
  3413. var isA = Array.isArray(val);
  3414. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  3415. return
  3416. }
  3417. if (val.__ob__) {
  3418. var depId = val.__ob__.dep.id;
  3419. if (seen.has(depId)) {
  3420. return
  3421. }
  3422. seen.add(depId);
  3423. }
  3424. if (isA) {
  3425. i = val.length;
  3426. while (i--) { _traverse(val[i], seen); }
  3427. } else {
  3428. keys = Object.keys(val);
  3429. i = keys.length;
  3430. while (i--) { _traverse(val[keys[i]], seen); }
  3431. }
  3432. }
  3433. var mark;
  3434. var measure;
  3435. if (true) {
  3436. var perf = inBrowser && window.performance;
  3437. /* istanbul ignore if */
  3438. if (
  3439. perf &&
  3440. perf.mark &&
  3441. perf.measure &&
  3442. perf.clearMarks &&
  3443. perf.clearMeasures
  3444. ) {
  3445. mark = function (tag) { return perf.mark(tag); };
  3446. measure = function (name, startTag, endTag) {
  3447. perf.measure(name, startTag, endTag);
  3448. perf.clearMarks(startTag);
  3449. perf.clearMarks(endTag);
  3450. // perf.clearMeasures(name)
  3451. };
  3452. }
  3453. }
  3454. /* */
  3455. var normalizeEvent = cached(function (name) {
  3456. var passive = name.charAt(0) === '&';
  3457. name = passive ? name.slice(1) : name;
  3458. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  3459. name = once$$1 ? name.slice(1) : name;
  3460. var capture = name.charAt(0) === '!';
  3461. name = capture ? name.slice(1) : name;
  3462. return {
  3463. name: name,
  3464. once: once$$1,
  3465. capture: capture,
  3466. passive: passive
  3467. }
  3468. });
  3469. function createFnInvoker (fns, vm) {
  3470. function invoker () {
  3471. var arguments$1 = arguments;
  3472. var fns = invoker.fns;
  3473. if (Array.isArray(fns)) {
  3474. var cloned = fns.slice();
  3475. for (var i = 0; i < cloned.length; i++) {
  3476. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  3477. }
  3478. } else {
  3479. // return handler return value for single handlers
  3480. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  3481. }
  3482. }
  3483. invoker.fns = fns;
  3484. return invoker
  3485. }
  3486. function updateListeners (
  3487. on,
  3488. oldOn,
  3489. add,
  3490. remove$$1,
  3491. createOnceHandler,
  3492. vm
  3493. ) {
  3494. var name, def$$1, cur, old, event;
  3495. for (name in on) {
  3496. def$$1 = cur = on[name];
  3497. old = oldOn[name];
  3498. event = normalizeEvent(name);
  3499. if (isUndef(cur)) {
  3500. true && warn(
  3501. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  3502. vm
  3503. );
  3504. } else if (isUndef(old)) {
  3505. if (isUndef(cur.fns)) {
  3506. cur = on[name] = createFnInvoker(cur, vm);
  3507. }
  3508. if (isTrue(event.once)) {
  3509. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  3510. }
  3511. add(event.name, cur, event.capture, event.passive, event.params);
  3512. } else if (cur !== old) {
  3513. old.fns = cur;
  3514. on[name] = old;
  3515. }
  3516. }
  3517. for (name in oldOn) {
  3518. if (isUndef(on[name])) {
  3519. event = normalizeEvent(name);
  3520. remove$$1(event.name, oldOn[name], event.capture);
  3521. }
  3522. }
  3523. }
  3524. /* */
  3525. /* */
  3526. // fixed by xxxxxx (mp properties)
  3527. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  3528. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  3529. if (isUndef(propOptions)) {
  3530. return res
  3531. }
  3532. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  3533. var attrs = data.attrs;
  3534. var props = data.props;
  3535. if (isDef(attrs) || isDef(props)) {
  3536. for (var key in propOptions) {
  3537. var altKey = hyphenate(key);
  3538. var result = checkProp(res, props, key, altKey, true) ||
  3539. checkProp(res, attrs, key, altKey, false);
  3540. // externalClass
  3541. if (
  3542. result &&
  3543. res[key] &&
  3544. externalClasses.indexOf(altKey) !== -1 &&
  3545. context[camelize(res[key])]
  3546. ) {
  3547. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  3548. res[key] = context[camelize(res[key])];
  3549. }
  3550. }
  3551. }
  3552. return res
  3553. }
  3554. function extractPropsFromVNodeData (
  3555. data,
  3556. Ctor,
  3557. tag,
  3558. context// fixed by xxxxxx
  3559. ) {
  3560. // we are only extracting raw values here.
  3561. // validation and default values are handled in the child
  3562. // component itself.
  3563. var propOptions = Ctor.options.props;
  3564. if (isUndef(propOptions)) {
  3565. // fixed by xxxxxx
  3566. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  3567. }
  3568. var res = {};
  3569. var attrs = data.attrs;
  3570. var props = data.props;
  3571. if (isDef(attrs) || isDef(props)) {
  3572. for (var key in propOptions) {
  3573. var altKey = hyphenate(key);
  3574. if (true) {
  3575. var keyInLowerCase = key.toLowerCase();
  3576. if (
  3577. key !== keyInLowerCase &&
  3578. attrs && hasOwn(attrs, keyInLowerCase)
  3579. ) {
  3580. tip(
  3581. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  3582. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  3583. " \"" + key + "\". " +
  3584. "Note that HTML attributes are case-insensitive and camelCased " +
  3585. "props need to use their kebab-case equivalents when using in-DOM " +
  3586. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  3587. );
  3588. }
  3589. }
  3590. checkProp(res, props, key, altKey, true) ||
  3591. checkProp(res, attrs, key, altKey, false);
  3592. }
  3593. }
  3594. // fixed by xxxxxx
  3595. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  3596. }
  3597. function checkProp (
  3598. res,
  3599. hash,
  3600. key,
  3601. altKey,
  3602. preserve
  3603. ) {
  3604. if (isDef(hash)) {
  3605. if (hasOwn(hash, key)) {
  3606. res[key] = hash[key];
  3607. if (!preserve) {
  3608. delete hash[key];
  3609. }
  3610. return true
  3611. } else if (hasOwn(hash, altKey)) {
  3612. res[key] = hash[altKey];
  3613. if (!preserve) {
  3614. delete hash[altKey];
  3615. }
  3616. return true
  3617. }
  3618. }
  3619. return false
  3620. }
  3621. /* */
  3622. // The template compiler attempts to minimize the need for normalization by
  3623. // statically analyzing the template at compile time.
  3624. //
  3625. // For plain HTML markup, normalization can be completely skipped because the
  3626. // generated render function is guaranteed to return Array<VNode>. There are
  3627. // two cases where extra normalization is needed:
  3628. // 1. When the children contains components - because a functional component
  3629. // may return an Array instead of a single root. In this case, just a simple
  3630. // normalization is needed - if any child is an Array, we flatten the whole
  3631. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  3632. // because functional components already normalize their own children.
  3633. function simpleNormalizeChildren (children) {
  3634. for (var i = 0; i < children.length; i++) {
  3635. if (Array.isArray(children[i])) {
  3636. return Array.prototype.concat.apply([], children)
  3637. }
  3638. }
  3639. return children
  3640. }
  3641. // 2. When the children contains constructs that always generated nested Arrays,
  3642. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  3643. // with hand-written render functions / JSX. In such cases a full normalization
  3644. // is needed to cater to all possible types of children values.
  3645. function normalizeChildren (children) {
  3646. return isPrimitive(children)
  3647. ? [createTextVNode(children)]
  3648. : Array.isArray(children)
  3649. ? normalizeArrayChildren(children)
  3650. : undefined
  3651. }
  3652. function isTextNode (node) {
  3653. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  3654. }
  3655. function normalizeArrayChildren (children, nestedIndex) {
  3656. var res = [];
  3657. var i, c, lastIndex, last;
  3658. for (i = 0; i < children.length; i++) {
  3659. c = children[i];
  3660. if (isUndef(c) || typeof c === 'boolean') { continue }
  3661. lastIndex = res.length - 1;
  3662. last = res[lastIndex];
  3663. // nested
  3664. if (Array.isArray(c)) {
  3665. if (c.length > 0) {
  3666. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  3667. // merge adjacent text nodes
  3668. if (isTextNode(c[0]) && isTextNode(last)) {
  3669. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  3670. c.shift();
  3671. }
  3672. res.push.apply(res, c);
  3673. }
  3674. } else if (isPrimitive(c)) {
  3675. if (isTextNode(last)) {
  3676. // merge adjacent text nodes
  3677. // this is necessary for SSR hydration because text nodes are
  3678. // essentially merged when rendered to HTML strings
  3679. res[lastIndex] = createTextVNode(last.text + c);
  3680. } else if (c !== '') {
  3681. // convert primitive to vnode
  3682. res.push(createTextVNode(c));
  3683. }
  3684. } else {
  3685. if (isTextNode(c) && isTextNode(last)) {
  3686. // merge adjacent text nodes
  3687. res[lastIndex] = createTextVNode(last.text + c.text);
  3688. } else {
  3689. // default key for nested array children (likely generated by v-for)
  3690. if (isTrue(children._isVList) &&
  3691. isDef(c.tag) &&
  3692. isUndef(c.key) &&
  3693. isDef(nestedIndex)) {
  3694. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  3695. }
  3696. res.push(c);
  3697. }
  3698. }
  3699. }
  3700. return res
  3701. }
  3702. /* */
  3703. function initProvide (vm) {
  3704. var provide = vm.$options.provide;
  3705. if (provide) {
  3706. vm._provided = typeof provide === 'function'
  3707. ? provide.call(vm)
  3708. : provide;
  3709. }
  3710. }
  3711. function initInjections (vm) {
  3712. var result = resolveInject(vm.$options.inject, vm);
  3713. if (result) {
  3714. toggleObserving(false);
  3715. Object.keys(result).forEach(function (key) {
  3716. /* istanbul ignore else */
  3717. if (true) {
  3718. defineReactive$$1(vm, key, result[key], function () {
  3719. warn(
  3720. "Avoid mutating an injected value directly since the changes will be " +
  3721. "overwritten whenever the provided component re-renders. " +
  3722. "injection being mutated: \"" + key + "\"",
  3723. vm
  3724. );
  3725. });
  3726. } else {}
  3727. });
  3728. toggleObserving(true);
  3729. }
  3730. }
  3731. function resolveInject (inject, vm) {
  3732. if (inject) {
  3733. // inject is :any because flow is not smart enough to figure out cached
  3734. var result = Object.create(null);
  3735. var keys = hasSymbol
  3736. ? Reflect.ownKeys(inject)
  3737. : Object.keys(inject);
  3738. for (var i = 0; i < keys.length; i++) {
  3739. var key = keys[i];
  3740. // #6574 in case the inject object is observed...
  3741. if (key === '__ob__') { continue }
  3742. var provideKey = inject[key].from;
  3743. var source = vm;
  3744. while (source) {
  3745. if (source._provided && hasOwn(source._provided, provideKey)) {
  3746. result[key] = source._provided[provideKey];
  3747. break
  3748. }
  3749. source = source.$parent;
  3750. }
  3751. if (!source) {
  3752. if ('default' in inject[key]) {
  3753. var provideDefault = inject[key].default;
  3754. result[key] = typeof provideDefault === 'function'
  3755. ? provideDefault.call(vm)
  3756. : provideDefault;
  3757. } else if (true) {
  3758. warn(("Injection \"" + key + "\" not found"), vm);
  3759. }
  3760. }
  3761. }
  3762. return result
  3763. }
  3764. }
  3765. /* */
  3766. /**
  3767. * Runtime helper for resolving raw children VNodes into a slot object.
  3768. */
  3769. function resolveSlots (
  3770. children,
  3771. context
  3772. ) {
  3773. if (!children || !children.length) {
  3774. return {}
  3775. }
  3776. var slots = {};
  3777. for (var i = 0, l = children.length; i < l; i++) {
  3778. var child = children[i];
  3779. var data = child.data;
  3780. // remove slot attribute if the node is resolved as a Vue slot node
  3781. if (data && data.attrs && data.attrs.slot) {
  3782. delete data.attrs.slot;
  3783. }
  3784. // named slots should only be respected if the vnode was rendered in the
  3785. // same context.
  3786. if ((child.context === context || child.fnContext === context) &&
  3787. data && data.slot != null
  3788. ) {
  3789. var name = data.slot;
  3790. var slot = (slots[name] || (slots[name] = []));
  3791. if (child.tag === 'template') {
  3792. slot.push.apply(slot, child.children || []);
  3793. } else {
  3794. slot.push(child);
  3795. }
  3796. } else {
  3797. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  3798. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  3799. (slots['page'] || (slots['page'] = [])).push(child);
  3800. }else{
  3801. (slots.default || (slots.default = [])).push(child);
  3802. }
  3803. }
  3804. }
  3805. // ignore slots that contains only whitespace
  3806. for (var name$1 in slots) {
  3807. if (slots[name$1].every(isWhitespace)) {
  3808. delete slots[name$1];
  3809. }
  3810. }
  3811. return slots
  3812. }
  3813. function isWhitespace (node) {
  3814. return (node.isComment && !node.asyncFactory) || node.text === ' '
  3815. }
  3816. /* */
  3817. function normalizeScopedSlots (
  3818. slots,
  3819. normalSlots,
  3820. prevSlots
  3821. ) {
  3822. var res;
  3823. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  3824. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  3825. var key = slots && slots.$key;
  3826. if (!slots) {
  3827. res = {};
  3828. } else if (slots._normalized) {
  3829. // fast path 1: child component re-render only, parent did not change
  3830. return slots._normalized
  3831. } else if (
  3832. isStable &&
  3833. prevSlots &&
  3834. prevSlots !== emptyObject &&
  3835. key === prevSlots.$key &&
  3836. !hasNormalSlots &&
  3837. !prevSlots.$hasNormal
  3838. ) {
  3839. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  3840. // only need to normalize once
  3841. return prevSlots
  3842. } else {
  3843. res = {};
  3844. for (var key$1 in slots) {
  3845. if (slots[key$1] && key$1[0] !== '$') {
  3846. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  3847. }
  3848. }
  3849. }
  3850. // expose normal slots on scopedSlots
  3851. for (var key$2 in normalSlots) {
  3852. if (!(key$2 in res)) {
  3853. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  3854. }
  3855. }
  3856. // avoriaz seems to mock a non-extensible $scopedSlots object
  3857. // and when that is passed down this would cause an error
  3858. if (slots && Object.isExtensible(slots)) {
  3859. (slots)._normalized = res;
  3860. }
  3861. def(res, '$stable', isStable);
  3862. def(res, '$key', key);
  3863. def(res, '$hasNormal', hasNormalSlots);
  3864. return res
  3865. }
  3866. function normalizeScopedSlot(normalSlots, key, fn) {
  3867. var normalized = function () {
  3868. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  3869. res = res && typeof res === 'object' && !Array.isArray(res)
  3870. ? [res] // single vnode
  3871. : normalizeChildren(res);
  3872. return res && (
  3873. res.length === 0 ||
  3874. (res.length === 1 && res[0].isComment) // #9658
  3875. ) ? undefined
  3876. : res
  3877. };
  3878. // this is a slot using the new v-slot syntax without scope. although it is
  3879. // compiled as a scoped slot, render fn users would expect it to be present
  3880. // on this.$slots because the usage is semantically a normal slot.
  3881. if (fn.proxy) {
  3882. Object.defineProperty(normalSlots, key, {
  3883. get: normalized,
  3884. enumerable: true,
  3885. configurable: true
  3886. });
  3887. }
  3888. return normalized
  3889. }
  3890. function proxyNormalSlot(slots, key) {
  3891. return function () { return slots[key]; }
  3892. }
  3893. /* */
  3894. /**
  3895. * Runtime helper for rendering v-for lists.
  3896. */
  3897. function renderList (
  3898. val,
  3899. render
  3900. ) {
  3901. var ret, i, l, keys, key;
  3902. if (Array.isArray(val) || typeof val === 'string') {
  3903. ret = new Array(val.length);
  3904. for (i = 0, l = val.length; i < l; i++) {
  3905. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  3906. }
  3907. } else if (typeof val === 'number') {
  3908. ret = new Array(val);
  3909. for (i = 0; i < val; i++) {
  3910. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  3911. }
  3912. } else if (isObject(val)) {
  3913. if (hasSymbol && val[Symbol.iterator]) {
  3914. ret = [];
  3915. var iterator = val[Symbol.iterator]();
  3916. var result = iterator.next();
  3917. while (!result.done) {
  3918. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  3919. result = iterator.next();
  3920. }
  3921. } else {
  3922. keys = Object.keys(val);
  3923. ret = new Array(keys.length);
  3924. for (i = 0, l = keys.length; i < l; i++) {
  3925. key = keys[i];
  3926. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  3927. }
  3928. }
  3929. }
  3930. if (!isDef(ret)) {
  3931. ret = [];
  3932. }
  3933. (ret)._isVList = true;
  3934. return ret
  3935. }
  3936. /* */
  3937. /**
  3938. * Runtime helper for rendering <slot>
  3939. */
  3940. function renderSlot (
  3941. name,
  3942. fallback,
  3943. props,
  3944. bindObject
  3945. ) {
  3946. var scopedSlotFn = this.$scopedSlots[name];
  3947. var nodes;
  3948. if (scopedSlotFn) { // scoped slot
  3949. props = props || {};
  3950. if (bindObject) {
  3951. if ( true && !isObject(bindObject)) {
  3952. warn(
  3953. 'slot v-bind without argument expects an Object',
  3954. this
  3955. );
  3956. }
  3957. props = extend(extend({}, bindObject), props);
  3958. }
  3959. // fixed by xxxxxx app-plus scopedSlot
  3960. nodes = scopedSlotFn(props, this, props._i) || fallback;
  3961. } else {
  3962. nodes = this.$slots[name] || fallback;
  3963. }
  3964. var target = props && props.slot;
  3965. if (target) {
  3966. return this.$createElement('template', { slot: target }, nodes)
  3967. } else {
  3968. return nodes
  3969. }
  3970. }
  3971. /* */
  3972. /**
  3973. * Runtime helper for resolving filters
  3974. */
  3975. function resolveFilter (id) {
  3976. return resolveAsset(this.$options, 'filters', id, true) || identity
  3977. }
  3978. /* */
  3979. function isKeyNotMatch (expect, actual) {
  3980. if (Array.isArray(expect)) {
  3981. return expect.indexOf(actual) === -1
  3982. } else {
  3983. return expect !== actual
  3984. }
  3985. }
  3986. /**
  3987. * Runtime helper for checking keyCodes from config.
  3988. * exposed as Vue.prototype._k
  3989. * passing in eventKeyName as last argument separately for backwards compat
  3990. */
  3991. function checkKeyCodes (
  3992. eventKeyCode,
  3993. key,
  3994. builtInKeyCode,
  3995. eventKeyName,
  3996. builtInKeyName
  3997. ) {
  3998. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  3999. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  4000. return isKeyNotMatch(builtInKeyName, eventKeyName)
  4001. } else if (mappedKeyCode) {
  4002. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  4003. } else if (eventKeyName) {
  4004. return hyphenate(eventKeyName) !== key
  4005. }
  4006. }
  4007. /* */
  4008. /**
  4009. * Runtime helper for merging v-bind="object" into a VNode's data.
  4010. */
  4011. function bindObjectProps (
  4012. data,
  4013. tag,
  4014. value,
  4015. asProp,
  4016. isSync
  4017. ) {
  4018. if (value) {
  4019. if (!isObject(value)) {
  4020. true && warn(
  4021. 'v-bind without argument expects an Object or Array value',
  4022. this
  4023. );
  4024. } else {
  4025. if (Array.isArray(value)) {
  4026. value = toObject(value);
  4027. }
  4028. var hash;
  4029. var loop = function ( key ) {
  4030. if (
  4031. key === 'class' ||
  4032. key === 'style' ||
  4033. isReservedAttribute(key)
  4034. ) {
  4035. hash = data;
  4036. } else {
  4037. var type = data.attrs && data.attrs.type;
  4038. hash = asProp || config.mustUseProp(tag, type, key)
  4039. ? data.domProps || (data.domProps = {})
  4040. : data.attrs || (data.attrs = {});
  4041. }
  4042. var camelizedKey = camelize(key);
  4043. var hyphenatedKey = hyphenate(key);
  4044. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  4045. hash[key] = value[key];
  4046. if (isSync) {
  4047. var on = data.on || (data.on = {});
  4048. on[("update:" + key)] = function ($event) {
  4049. value[key] = $event;
  4050. };
  4051. }
  4052. }
  4053. };
  4054. for (var key in value) loop( key );
  4055. }
  4056. }
  4057. return data
  4058. }
  4059. /* */
  4060. /**
  4061. * Runtime helper for rendering static trees.
  4062. */
  4063. function renderStatic (
  4064. index,
  4065. isInFor
  4066. ) {
  4067. var cached = this._staticTrees || (this._staticTrees = []);
  4068. var tree = cached[index];
  4069. // if has already-rendered static tree and not inside v-for,
  4070. // we can reuse the same tree.
  4071. if (tree && !isInFor) {
  4072. return tree
  4073. }
  4074. // otherwise, render a fresh tree.
  4075. tree = cached[index] = this.$options.staticRenderFns[index].call(
  4076. this._renderProxy,
  4077. null,
  4078. this // for render fns generated for functional component templates
  4079. );
  4080. markStatic(tree, ("__static__" + index), false);
  4081. return tree
  4082. }
  4083. /**
  4084. * Runtime helper for v-once.
  4085. * Effectively it means marking the node as static with a unique key.
  4086. */
  4087. function markOnce (
  4088. tree,
  4089. index,
  4090. key
  4091. ) {
  4092. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  4093. return tree
  4094. }
  4095. function markStatic (
  4096. tree,
  4097. key,
  4098. isOnce
  4099. ) {
  4100. if (Array.isArray(tree)) {
  4101. for (var i = 0; i < tree.length; i++) {
  4102. if (tree[i] && typeof tree[i] !== 'string') {
  4103. markStaticNode(tree[i], (key + "_" + i), isOnce);
  4104. }
  4105. }
  4106. } else {
  4107. markStaticNode(tree, key, isOnce);
  4108. }
  4109. }
  4110. function markStaticNode (node, key, isOnce) {
  4111. node.isStatic = true;
  4112. node.key = key;
  4113. node.isOnce = isOnce;
  4114. }
  4115. /* */
  4116. function bindObjectListeners (data, value) {
  4117. if (value) {
  4118. if (!isPlainObject(value)) {
  4119. true && warn(
  4120. 'v-on without argument expects an Object value',
  4121. this
  4122. );
  4123. } else {
  4124. var on = data.on = data.on ? extend({}, data.on) : {};
  4125. for (var key in value) {
  4126. var existing = on[key];
  4127. var ours = value[key];
  4128. on[key] = existing ? [].concat(existing, ours) : ours;
  4129. }
  4130. }
  4131. }
  4132. return data
  4133. }
  4134. /* */
  4135. function resolveScopedSlots (
  4136. fns, // see flow/vnode
  4137. res,
  4138. // the following are added in 2.6
  4139. hasDynamicKeys,
  4140. contentHashKey
  4141. ) {
  4142. res = res || { $stable: !hasDynamicKeys };
  4143. for (var i = 0; i < fns.length; i++) {
  4144. var slot = fns[i];
  4145. if (Array.isArray(slot)) {
  4146. resolveScopedSlots(slot, res, hasDynamicKeys);
  4147. } else if (slot) {
  4148. // marker for reverse proxying v-slot without scope on this.$slots
  4149. if (slot.proxy) {
  4150. slot.fn.proxy = true;
  4151. }
  4152. res[slot.key] = slot.fn;
  4153. }
  4154. }
  4155. if (contentHashKey) {
  4156. (res).$key = contentHashKey;
  4157. }
  4158. return res
  4159. }
  4160. /* */
  4161. function bindDynamicKeys (baseObj, values) {
  4162. for (var i = 0; i < values.length; i += 2) {
  4163. var key = values[i];
  4164. if (typeof key === 'string' && key) {
  4165. baseObj[values[i]] = values[i + 1];
  4166. } else if ( true && key !== '' && key !== null) {
  4167. // null is a special value for explicitly removing a binding
  4168. warn(
  4169. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  4170. this
  4171. );
  4172. }
  4173. }
  4174. return baseObj
  4175. }
  4176. // helper to dynamically append modifier runtime markers to event names.
  4177. // ensure only append when value is already string, otherwise it will be cast
  4178. // to string and cause the type check to miss.
  4179. function prependModifier (value, symbol) {
  4180. return typeof value === 'string' ? symbol + value : value
  4181. }
  4182. /* */
  4183. function installRenderHelpers (target) {
  4184. target._o = markOnce;
  4185. target._n = toNumber;
  4186. target._s = toString;
  4187. target._l = renderList;
  4188. target._t = renderSlot;
  4189. target._q = looseEqual;
  4190. target._i = looseIndexOf;
  4191. target._m = renderStatic;
  4192. target._f = resolveFilter;
  4193. target._k = checkKeyCodes;
  4194. target._b = bindObjectProps;
  4195. target._v = createTextVNode;
  4196. target._e = createEmptyVNode;
  4197. target._u = resolveScopedSlots;
  4198. target._g = bindObjectListeners;
  4199. target._d = bindDynamicKeys;
  4200. target._p = prependModifier;
  4201. }
  4202. /* */
  4203. function FunctionalRenderContext (
  4204. data,
  4205. props,
  4206. children,
  4207. parent,
  4208. Ctor
  4209. ) {
  4210. var this$1 = this;
  4211. var options = Ctor.options;
  4212. // ensure the createElement function in functional components
  4213. // gets a unique context - this is necessary for correct named slot check
  4214. var contextVm;
  4215. if (hasOwn(parent, '_uid')) {
  4216. contextVm = Object.create(parent);
  4217. // $flow-disable-line
  4218. contextVm._original = parent;
  4219. } else {
  4220. // the context vm passed in is a functional context as well.
  4221. // in this case we want to make sure we are able to get a hold to the
  4222. // real context instance.
  4223. contextVm = parent;
  4224. // $flow-disable-line
  4225. parent = parent._original;
  4226. }
  4227. var isCompiled = isTrue(options._compiled);
  4228. var needNormalization = !isCompiled;
  4229. this.data = data;
  4230. this.props = props;
  4231. this.children = children;
  4232. this.parent = parent;
  4233. this.listeners = data.on || emptyObject;
  4234. this.injections = resolveInject(options.inject, parent);
  4235. this.slots = function () {
  4236. if (!this$1.$slots) {
  4237. normalizeScopedSlots(
  4238. data.scopedSlots,
  4239. this$1.$slots = resolveSlots(children, parent)
  4240. );
  4241. }
  4242. return this$1.$slots
  4243. };
  4244. Object.defineProperty(this, 'scopedSlots', ({
  4245. enumerable: true,
  4246. get: function get () {
  4247. return normalizeScopedSlots(data.scopedSlots, this.slots())
  4248. }
  4249. }));
  4250. // support for compiled functional template
  4251. if (isCompiled) {
  4252. // exposing $options for renderStatic()
  4253. this.$options = options;
  4254. // pre-resolve slots for renderSlot()
  4255. this.$slots = this.slots();
  4256. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  4257. }
  4258. if (options._scopeId) {
  4259. this._c = function (a, b, c, d) {
  4260. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  4261. if (vnode && !Array.isArray(vnode)) {
  4262. vnode.fnScopeId = options._scopeId;
  4263. vnode.fnContext = parent;
  4264. }
  4265. return vnode
  4266. };
  4267. } else {
  4268. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  4269. }
  4270. }
  4271. installRenderHelpers(FunctionalRenderContext.prototype);
  4272. function createFunctionalComponent (
  4273. Ctor,
  4274. propsData,
  4275. data,
  4276. contextVm,
  4277. children
  4278. ) {
  4279. var options = Ctor.options;
  4280. var props = {};
  4281. var propOptions = options.props;
  4282. if (isDef(propOptions)) {
  4283. for (var key in propOptions) {
  4284. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4285. }
  4286. } else {
  4287. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  4288. if (isDef(data.props)) { mergeProps(props, data.props); }
  4289. }
  4290. var renderContext = new FunctionalRenderContext(
  4291. data,
  4292. props,
  4293. children,
  4294. contextVm,
  4295. Ctor
  4296. );
  4297. var vnode = options.render.call(null, renderContext._c, renderContext);
  4298. if (vnode instanceof VNode) {
  4299. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  4300. } else if (Array.isArray(vnode)) {
  4301. var vnodes = normalizeChildren(vnode) || [];
  4302. var res = new Array(vnodes.length);
  4303. for (var i = 0; i < vnodes.length; i++) {
  4304. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4305. }
  4306. return res
  4307. }
  4308. }
  4309. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  4310. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4311. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4312. // that should not be matched to match.
  4313. var clone = cloneVNode(vnode);
  4314. clone.fnContext = contextVm;
  4315. clone.fnOptions = options;
  4316. if (true) {
  4317. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  4318. }
  4319. if (data.slot) {
  4320. (clone.data || (clone.data = {})).slot = data.slot;
  4321. }
  4322. return clone
  4323. }
  4324. function mergeProps (to, from) {
  4325. for (var key in from) {
  4326. to[camelize(key)] = from[key];
  4327. }
  4328. }
  4329. /* */
  4330. /* */
  4331. /* */
  4332. /* */
  4333. // inline hooks to be invoked on component VNodes during patch
  4334. var componentVNodeHooks = {
  4335. init: function init (vnode, hydrating) {
  4336. if (
  4337. vnode.componentInstance &&
  4338. !vnode.componentInstance._isDestroyed &&
  4339. vnode.data.keepAlive
  4340. ) {
  4341. // kept-alive components, treat as a patch
  4342. var mountedNode = vnode; // work around flow
  4343. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4344. } else {
  4345. var child = vnode.componentInstance = createComponentInstanceForVnode(
  4346. vnode,
  4347. activeInstance
  4348. );
  4349. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4350. }
  4351. },
  4352. prepatch: function prepatch (oldVnode, vnode) {
  4353. var options = vnode.componentOptions;
  4354. var child = vnode.componentInstance = oldVnode.componentInstance;
  4355. updateChildComponent(
  4356. child,
  4357. options.propsData, // updated props
  4358. options.listeners, // updated listeners
  4359. vnode, // new parent vnode
  4360. options.children // new children
  4361. );
  4362. },
  4363. insert: function insert (vnode) {
  4364. var context = vnode.context;
  4365. var componentInstance = vnode.componentInstance;
  4366. if (!componentInstance._isMounted) {
  4367. callHook(componentInstance, 'onServiceCreated');
  4368. callHook(componentInstance, 'onServiceAttached');
  4369. componentInstance._isMounted = true;
  4370. callHook(componentInstance, 'mounted');
  4371. }
  4372. if (vnode.data.keepAlive) {
  4373. if (context._isMounted) {
  4374. // vue-router#1212
  4375. // During updates, a kept-alive component's child components may
  4376. // change, so directly walking the tree here may call activated hooks
  4377. // on incorrect children. Instead we push them into a queue which will
  4378. // be processed after the whole patch process ended.
  4379. queueActivatedComponent(componentInstance);
  4380. } else {
  4381. activateChildComponent(componentInstance, true /* direct */);
  4382. }
  4383. }
  4384. },
  4385. destroy: function destroy (vnode) {
  4386. var componentInstance = vnode.componentInstance;
  4387. if (!componentInstance._isDestroyed) {
  4388. if (!vnode.data.keepAlive) {
  4389. componentInstance.$destroy();
  4390. } else {
  4391. deactivateChildComponent(componentInstance, true /* direct */);
  4392. }
  4393. }
  4394. }
  4395. };
  4396. var hooksToMerge = Object.keys(componentVNodeHooks);
  4397. function createComponent (
  4398. Ctor,
  4399. data,
  4400. context,
  4401. children,
  4402. tag
  4403. ) {
  4404. if (isUndef(Ctor)) {
  4405. return
  4406. }
  4407. var baseCtor = context.$options._base;
  4408. // plain options object: turn it into a constructor
  4409. if (isObject(Ctor)) {
  4410. Ctor = baseCtor.extend(Ctor);
  4411. }
  4412. // if at this stage it's not a constructor or an async component factory,
  4413. // reject.
  4414. if (typeof Ctor !== 'function') {
  4415. if (true) {
  4416. warn(("Invalid Component definition: " + (String(Ctor))), context);
  4417. }
  4418. return
  4419. }
  4420. // async component
  4421. var asyncFactory;
  4422. if (isUndef(Ctor.cid)) {
  4423. asyncFactory = Ctor;
  4424. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  4425. if (Ctor === undefined) {
  4426. // return a placeholder node for async component, which is rendered
  4427. // as a comment node but preserves all the raw information for the node.
  4428. // the information will be used for async server-rendering and hydration.
  4429. return createAsyncPlaceholder(
  4430. asyncFactory,
  4431. data,
  4432. context,
  4433. children,
  4434. tag
  4435. )
  4436. }
  4437. }
  4438. data = data || {};
  4439. // resolve constructor options in case global mixins are applied after
  4440. // component constructor creation
  4441. resolveConstructorOptions(Ctor);
  4442. // transform component v-model data into props & events
  4443. if (isDef(data.model)) {
  4444. transformModel(Ctor.options, data);
  4445. }
  4446. // extract props
  4447. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  4448. // functional component
  4449. if (isTrue(Ctor.options.functional)) {
  4450. return createFunctionalComponent(Ctor, propsData, data, context, children)
  4451. }
  4452. // extract listeners, since these needs to be treated as
  4453. // child component listeners instead of DOM listeners
  4454. var listeners = data.on;
  4455. // replace with listeners with .native modifier
  4456. // so it gets processed during parent component patch.
  4457. data.on = data.nativeOn;
  4458. if (isTrue(Ctor.options.abstract)) {
  4459. // abstract components do not keep anything
  4460. // other than props & listeners & slot
  4461. // work around flow
  4462. var slot = data.slot;
  4463. data = {};
  4464. if (slot) {
  4465. data.slot = slot;
  4466. }
  4467. }
  4468. // install component management hooks onto the placeholder node
  4469. installComponentHooks(data);
  4470. // return a placeholder vnode
  4471. var name = Ctor.options.name || tag;
  4472. var vnode = new VNode(
  4473. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  4474. data, undefined, undefined, undefined, context,
  4475. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  4476. asyncFactory
  4477. );
  4478. return vnode
  4479. }
  4480. function createComponentInstanceForVnode (
  4481. vnode, // we know it's MountedComponentVNode but flow doesn't
  4482. parent // activeInstance in lifecycle state
  4483. ) {
  4484. var options = {
  4485. _isComponent: true,
  4486. _parentVnode: vnode,
  4487. parent: parent
  4488. };
  4489. // check inline-template render functions
  4490. var inlineTemplate = vnode.data.inlineTemplate;
  4491. if (isDef(inlineTemplate)) {
  4492. options.render = inlineTemplate.render;
  4493. options.staticRenderFns = inlineTemplate.staticRenderFns;
  4494. }
  4495. return new vnode.componentOptions.Ctor(options)
  4496. }
  4497. function installComponentHooks (data) {
  4498. var hooks = data.hook || (data.hook = {});
  4499. for (var i = 0; i < hooksToMerge.length; i++) {
  4500. var key = hooksToMerge[i];
  4501. var existing = hooks[key];
  4502. var toMerge = componentVNodeHooks[key];
  4503. if (existing !== toMerge && !(existing && existing._merged)) {
  4504. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  4505. }
  4506. }
  4507. }
  4508. function mergeHook$1 (f1, f2) {
  4509. var merged = function (a, b) {
  4510. // flow complains about extra args which is why we use any
  4511. f1(a, b);
  4512. f2(a, b);
  4513. };
  4514. merged._merged = true;
  4515. return merged
  4516. }
  4517. // transform component v-model info (value and callback) into
  4518. // prop and event handler respectively.
  4519. function transformModel (options, data) {
  4520. var prop = (options.model && options.model.prop) || 'value';
  4521. var event = (options.model && options.model.event) || 'input'
  4522. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  4523. var on = data.on || (data.on = {});
  4524. var existing = on[event];
  4525. var callback = data.model.callback;
  4526. if (isDef(existing)) {
  4527. if (
  4528. Array.isArray(existing)
  4529. ? existing.indexOf(callback) === -1
  4530. : existing !== callback
  4531. ) {
  4532. on[event] = [callback].concat(existing);
  4533. }
  4534. } else {
  4535. on[event] = callback;
  4536. }
  4537. }
  4538. /* */
  4539. var SIMPLE_NORMALIZE = 1;
  4540. var ALWAYS_NORMALIZE = 2;
  4541. // wrapper function for providing a more flexible interface
  4542. // without getting yelled at by flow
  4543. function createElement (
  4544. context,
  4545. tag,
  4546. data,
  4547. children,
  4548. normalizationType,
  4549. alwaysNormalize
  4550. ) {
  4551. if (Array.isArray(data) || isPrimitive(data)) {
  4552. normalizationType = children;
  4553. children = data;
  4554. data = undefined;
  4555. }
  4556. if (isTrue(alwaysNormalize)) {
  4557. normalizationType = ALWAYS_NORMALIZE;
  4558. }
  4559. return _createElement(context, tag, data, children, normalizationType)
  4560. }
  4561. function _createElement (
  4562. context,
  4563. tag,
  4564. data,
  4565. children,
  4566. normalizationType
  4567. ) {
  4568. if (isDef(data) && isDef((data).__ob__)) {
  4569. true && warn(
  4570. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  4571. 'Always create fresh vnode data objects in each render!',
  4572. context
  4573. );
  4574. return createEmptyVNode()
  4575. }
  4576. // object syntax in v-bind
  4577. if (isDef(data) && isDef(data.is)) {
  4578. tag = data.is;
  4579. }
  4580. if (!tag) {
  4581. // in case of component :is set to falsy value
  4582. return createEmptyVNode()
  4583. }
  4584. // warn against non-primitive key
  4585. if ( true &&
  4586. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  4587. ) {
  4588. {
  4589. warn(
  4590. 'Avoid using non-primitive value as key, ' +
  4591. 'use string/number value instead.',
  4592. context
  4593. );
  4594. }
  4595. }
  4596. // support single function children as default scoped slot
  4597. if (Array.isArray(children) &&
  4598. typeof children[0] === 'function'
  4599. ) {
  4600. data = data || {};
  4601. data.scopedSlots = { default: children[0] };
  4602. children.length = 0;
  4603. }
  4604. if (normalizationType === ALWAYS_NORMALIZE) {
  4605. children = normalizeChildren(children);
  4606. } else if (normalizationType === SIMPLE_NORMALIZE) {
  4607. children = simpleNormalizeChildren(children);
  4608. }
  4609. var vnode, ns;
  4610. if (typeof tag === 'string') {
  4611. var Ctor;
  4612. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  4613. if (config.isReservedTag(tag)) {
  4614. // platform built-in elements
  4615. if ( true && isDef(data) && isDef(data.nativeOn)) {
  4616. warn(
  4617. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  4618. context
  4619. );
  4620. }
  4621. vnode = new VNode(
  4622. config.parsePlatformTagName(tag), data, children,
  4623. undefined, undefined, context
  4624. );
  4625. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  4626. // component
  4627. vnode = createComponent(Ctor, data, context, children, tag);
  4628. } else {
  4629. // unknown or unlisted namespaced elements
  4630. // check at runtime because it may get assigned a namespace when its
  4631. // parent normalizes children
  4632. vnode = new VNode(
  4633. tag, data, children,
  4634. undefined, undefined, context
  4635. );
  4636. }
  4637. } else {
  4638. // direct component options / constructor
  4639. vnode = createComponent(tag, data, context, children);
  4640. }
  4641. if (Array.isArray(vnode)) {
  4642. return vnode
  4643. } else if (isDef(vnode)) {
  4644. if (isDef(ns)) { applyNS(vnode, ns); }
  4645. if (isDef(data)) { registerDeepBindings(data); }
  4646. return vnode
  4647. } else {
  4648. return createEmptyVNode()
  4649. }
  4650. }
  4651. function applyNS (vnode, ns, force) {
  4652. vnode.ns = ns;
  4653. if (vnode.tag === 'foreignObject') {
  4654. // use default namespace inside foreignObject
  4655. ns = undefined;
  4656. force = true;
  4657. }
  4658. if (isDef(vnode.children)) {
  4659. for (var i = 0, l = vnode.children.length; i < l; i++) {
  4660. var child = vnode.children[i];
  4661. if (isDef(child.tag) && (
  4662. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  4663. applyNS(child, ns, force);
  4664. }
  4665. }
  4666. }
  4667. }
  4668. // ref #5318
  4669. // necessary to ensure parent re-render when deep bindings like :style and
  4670. // :class are used on slot nodes
  4671. function registerDeepBindings (data) {
  4672. if (isObject(data.style)) {
  4673. traverse(data.style);
  4674. }
  4675. if (isObject(data.class)) {
  4676. traverse(data.class);
  4677. }
  4678. }
  4679. /* */
  4680. function initRender (vm) {
  4681. vm._vnode = null; // the root of the child tree
  4682. vm._staticTrees = null; // v-once cached trees
  4683. var options = vm.$options;
  4684. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4685. var renderContext = parentVnode && parentVnode.context;
  4686. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4687. vm.$scopedSlots = emptyObject;
  4688. // bind the createElement fn to this instance
  4689. // so that we get proper render context inside it.
  4690. // args order: tag, data, children, normalizationType, alwaysNormalize
  4691. // internal version is used by render functions compiled from templates
  4692. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4693. // normalization is always applied for the public version, used in
  4694. // user-written render functions.
  4695. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4696. // $attrs & $listeners are exposed for easier HOC creation.
  4697. // they need to be reactive so that HOCs using them are always updated
  4698. var parentData = parentVnode && parentVnode.data;
  4699. /* istanbul ignore else */
  4700. if (true) {
  4701. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4702. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4703. }, true);
  4704. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4705. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4706. }, true);
  4707. } else {}
  4708. }
  4709. var currentRenderingInstance = null;
  4710. function renderMixin (Vue) {
  4711. // install runtime convenience helpers
  4712. installRenderHelpers(Vue.prototype);
  4713. Vue.prototype.$nextTick = function (fn) {
  4714. return nextTick(fn, this)
  4715. };
  4716. Vue.prototype._render = function () {
  4717. var vm = this;
  4718. var ref = vm.$options;
  4719. var render = ref.render;
  4720. var _parentVnode = ref._parentVnode;
  4721. if (_parentVnode) {
  4722. vm.$scopedSlots = normalizeScopedSlots(
  4723. _parentVnode.data.scopedSlots,
  4724. vm.$slots,
  4725. vm.$scopedSlots
  4726. );
  4727. }
  4728. // set parent vnode. this allows render functions to have access
  4729. // to the data on the placeholder node.
  4730. vm.$vnode = _parentVnode;
  4731. // render self
  4732. var vnode;
  4733. try {
  4734. // There's no need to maintain a stack because all render fns are called
  4735. // separately from one another. Nested component's render fns are called
  4736. // when parent component is patched.
  4737. currentRenderingInstance = vm;
  4738. vnode = render.call(vm._renderProxy, vm.$createElement);
  4739. } catch (e) {
  4740. handleError(e, vm, "render");
  4741. // return error render result,
  4742. // or previous vnode to prevent render error causing blank component
  4743. /* istanbul ignore else */
  4744. if ( true && vm.$options.renderError) {
  4745. try {
  4746. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4747. } catch (e) {
  4748. handleError(e, vm, "renderError");
  4749. vnode = vm._vnode;
  4750. }
  4751. } else {
  4752. vnode = vm._vnode;
  4753. }
  4754. } finally {
  4755. currentRenderingInstance = null;
  4756. }
  4757. // if the returned array contains only a single node, allow it
  4758. if (Array.isArray(vnode) && vnode.length === 1) {
  4759. vnode = vnode[0];
  4760. }
  4761. // return empty vnode in case the render function errored out
  4762. if (!(vnode instanceof VNode)) {
  4763. if ( true && Array.isArray(vnode)) {
  4764. warn(
  4765. 'Multiple root nodes returned from render function. Render function ' +
  4766. 'should return a single root node.',
  4767. vm
  4768. );
  4769. }
  4770. vnode = createEmptyVNode();
  4771. }
  4772. // set parent
  4773. vnode.parent = _parentVnode;
  4774. return vnode
  4775. };
  4776. }
  4777. /* */
  4778. function ensureCtor (comp, base) {
  4779. if (
  4780. comp.__esModule ||
  4781. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  4782. ) {
  4783. comp = comp.default;
  4784. }
  4785. return isObject(comp)
  4786. ? base.extend(comp)
  4787. : comp
  4788. }
  4789. function createAsyncPlaceholder (
  4790. factory,
  4791. data,
  4792. context,
  4793. children,
  4794. tag
  4795. ) {
  4796. var node = createEmptyVNode();
  4797. node.asyncFactory = factory;
  4798. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  4799. return node
  4800. }
  4801. function resolveAsyncComponent (
  4802. factory,
  4803. baseCtor
  4804. ) {
  4805. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  4806. return factory.errorComp
  4807. }
  4808. if (isDef(factory.resolved)) {
  4809. return factory.resolved
  4810. }
  4811. var owner = currentRenderingInstance;
  4812. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  4813. // already pending
  4814. factory.owners.push(owner);
  4815. }
  4816. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  4817. return factory.loadingComp
  4818. }
  4819. if (owner && !isDef(factory.owners)) {
  4820. var owners = factory.owners = [owner];
  4821. var sync = true;
  4822. var timerLoading = null;
  4823. var timerTimeout = null
  4824. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  4825. var forceRender = function (renderCompleted) {
  4826. for (var i = 0, l = owners.length; i < l; i++) {
  4827. (owners[i]).$forceUpdate();
  4828. }
  4829. if (renderCompleted) {
  4830. owners.length = 0;
  4831. if (timerLoading !== null) {
  4832. clearTimeout(timerLoading);
  4833. timerLoading = null;
  4834. }
  4835. if (timerTimeout !== null) {
  4836. clearTimeout(timerTimeout);
  4837. timerTimeout = null;
  4838. }
  4839. }
  4840. };
  4841. var resolve = once(function (res) {
  4842. // cache resolved
  4843. factory.resolved = ensureCtor(res, baseCtor);
  4844. // invoke callbacks only if this is not a synchronous resolve
  4845. // (async resolves are shimmed as synchronous during SSR)
  4846. if (!sync) {
  4847. forceRender(true);
  4848. } else {
  4849. owners.length = 0;
  4850. }
  4851. });
  4852. var reject = once(function (reason) {
  4853. true && warn(
  4854. "Failed to resolve async component: " + (String(factory)) +
  4855. (reason ? ("\nReason: " + reason) : '')
  4856. );
  4857. if (isDef(factory.errorComp)) {
  4858. factory.error = true;
  4859. forceRender(true);
  4860. }
  4861. });
  4862. var res = factory(resolve, reject);
  4863. if (isObject(res)) {
  4864. if (isPromise(res)) {
  4865. // () => Promise
  4866. if (isUndef(factory.resolved)) {
  4867. res.then(resolve, reject);
  4868. }
  4869. } else if (isPromise(res.component)) {
  4870. res.component.then(resolve, reject);
  4871. if (isDef(res.error)) {
  4872. factory.errorComp = ensureCtor(res.error, baseCtor);
  4873. }
  4874. if (isDef(res.loading)) {
  4875. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  4876. if (res.delay === 0) {
  4877. factory.loading = true;
  4878. } else {
  4879. timerLoading = setTimeout(function () {
  4880. timerLoading = null;
  4881. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  4882. factory.loading = true;
  4883. forceRender(false);
  4884. }
  4885. }, res.delay || 200);
  4886. }
  4887. }
  4888. if (isDef(res.timeout)) {
  4889. timerTimeout = setTimeout(function () {
  4890. timerTimeout = null;
  4891. if (isUndef(factory.resolved)) {
  4892. reject(
  4893. true
  4894. ? ("timeout (" + (res.timeout) + "ms)")
  4895. : undefined
  4896. );
  4897. }
  4898. }, res.timeout);
  4899. }
  4900. }
  4901. }
  4902. sync = false;
  4903. // return in case resolved synchronously
  4904. return factory.loading
  4905. ? factory.loadingComp
  4906. : factory.resolved
  4907. }
  4908. }
  4909. /* */
  4910. function isAsyncPlaceholder (node) {
  4911. return node.isComment && node.asyncFactory
  4912. }
  4913. /* */
  4914. function getFirstComponentChild (children) {
  4915. if (Array.isArray(children)) {
  4916. for (var i = 0; i < children.length; i++) {
  4917. var c = children[i];
  4918. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  4919. return c
  4920. }
  4921. }
  4922. }
  4923. }
  4924. /* */
  4925. /* */
  4926. function initEvents (vm) {
  4927. vm._events = Object.create(null);
  4928. vm._hasHookEvent = false;
  4929. // init parent attached events
  4930. var listeners = vm.$options._parentListeners;
  4931. if (listeners) {
  4932. updateComponentListeners(vm, listeners);
  4933. }
  4934. }
  4935. var target;
  4936. function add (event, fn) {
  4937. target.$on(event, fn);
  4938. }
  4939. function remove$1 (event, fn) {
  4940. target.$off(event, fn);
  4941. }
  4942. function createOnceHandler (event, fn) {
  4943. var _target = target;
  4944. return function onceHandler () {
  4945. var res = fn.apply(null, arguments);
  4946. if (res !== null) {
  4947. _target.$off(event, onceHandler);
  4948. }
  4949. }
  4950. }
  4951. function updateComponentListeners (
  4952. vm,
  4953. listeners,
  4954. oldListeners
  4955. ) {
  4956. target = vm;
  4957. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  4958. target = undefined;
  4959. }
  4960. function eventsMixin (Vue) {
  4961. var hookRE = /^hook:/;
  4962. Vue.prototype.$on = function (event, fn) {
  4963. var vm = this;
  4964. if (Array.isArray(event)) {
  4965. for (var i = 0, l = event.length; i < l; i++) {
  4966. vm.$on(event[i], fn);
  4967. }
  4968. } else {
  4969. (vm._events[event] || (vm._events[event] = [])).push(fn);
  4970. // optimize hook:event cost by using a boolean flag marked at registration
  4971. // instead of a hash lookup
  4972. if (hookRE.test(event)) {
  4973. vm._hasHookEvent = true;
  4974. }
  4975. }
  4976. return vm
  4977. };
  4978. Vue.prototype.$once = function (event, fn) {
  4979. var vm = this;
  4980. function on () {
  4981. vm.$off(event, on);
  4982. fn.apply(vm, arguments);
  4983. }
  4984. on.fn = fn;
  4985. vm.$on(event, on);
  4986. return vm
  4987. };
  4988. Vue.prototype.$off = function (event, fn) {
  4989. var vm = this;
  4990. // all
  4991. if (!arguments.length) {
  4992. vm._events = Object.create(null);
  4993. return vm
  4994. }
  4995. // array of events
  4996. if (Array.isArray(event)) {
  4997. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  4998. vm.$off(event[i$1], fn);
  4999. }
  5000. return vm
  5001. }
  5002. // specific event
  5003. var cbs = vm._events[event];
  5004. if (!cbs) {
  5005. return vm
  5006. }
  5007. if (!fn) {
  5008. vm._events[event] = null;
  5009. return vm
  5010. }
  5011. // specific handler
  5012. var cb;
  5013. var i = cbs.length;
  5014. while (i--) {
  5015. cb = cbs[i];
  5016. if (cb === fn || cb.fn === fn) {
  5017. cbs.splice(i, 1);
  5018. break
  5019. }
  5020. }
  5021. return vm
  5022. };
  5023. Vue.prototype.$emit = function (event) {
  5024. var vm = this;
  5025. if (true) {
  5026. var lowerCaseEvent = event.toLowerCase();
  5027. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  5028. tip(
  5029. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  5030. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  5031. "Note that HTML attributes are case-insensitive and you cannot use " +
  5032. "v-on to listen to camelCase events when using in-DOM templates. " +
  5033. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  5034. );
  5035. }
  5036. }
  5037. var cbs = vm._events[event];
  5038. if (cbs) {
  5039. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  5040. var args = toArray(arguments, 1);
  5041. var info = "event handler for \"" + event + "\"";
  5042. for (var i = 0, l = cbs.length; i < l; i++) {
  5043. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  5044. }
  5045. }
  5046. return vm
  5047. };
  5048. }
  5049. /* */
  5050. var activeInstance = null;
  5051. var isUpdatingChildComponent = false;
  5052. function setActiveInstance(vm) {
  5053. var prevActiveInstance = activeInstance;
  5054. activeInstance = vm;
  5055. return function () {
  5056. activeInstance = prevActiveInstance;
  5057. }
  5058. }
  5059. function initLifecycle (vm) {
  5060. var options = vm.$options;
  5061. // locate first non-abstract parent
  5062. var parent = options.parent;
  5063. if (parent && !options.abstract) {
  5064. while (parent.$options.abstract && parent.$parent) {
  5065. parent = parent.$parent;
  5066. }
  5067. parent.$children.push(vm);
  5068. }
  5069. vm.$parent = parent;
  5070. vm.$root = parent ? parent.$root : vm;
  5071. vm.$children = [];
  5072. vm.$refs = {};
  5073. vm._watcher = null;
  5074. vm._inactive = null;
  5075. vm._directInactive = false;
  5076. vm._isMounted = false;
  5077. vm._isDestroyed = false;
  5078. vm._isBeingDestroyed = false;
  5079. }
  5080. function lifecycleMixin (Vue) {
  5081. Vue.prototype._update = function (vnode, hydrating) {
  5082. var vm = this;
  5083. var prevEl = vm.$el;
  5084. var prevVnode = vm._vnode;
  5085. var restoreActiveInstance = setActiveInstance(vm);
  5086. vm._vnode = vnode;
  5087. // Vue.prototype.__patch__ is injected in entry points
  5088. // based on the rendering backend used.
  5089. if (!prevVnode) {
  5090. // initial render
  5091. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  5092. } else {
  5093. // updates
  5094. vm.$el = vm.__patch__(prevVnode, vnode);
  5095. }
  5096. restoreActiveInstance();
  5097. // update __vue__ reference
  5098. if (prevEl) {
  5099. prevEl.__vue__ = null;
  5100. }
  5101. if (vm.$el) {
  5102. vm.$el.__vue__ = vm;
  5103. }
  5104. // if parent is an HOC, update its $el as well
  5105. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  5106. vm.$parent.$el = vm.$el;
  5107. }
  5108. // updated hook is called by the scheduler to ensure that children are
  5109. // updated in a parent's updated hook.
  5110. };
  5111. Vue.prototype.$forceUpdate = function () {
  5112. var vm = this;
  5113. if (vm._watcher) {
  5114. vm._watcher.update();
  5115. }
  5116. };
  5117. Vue.prototype.$destroy = function () {
  5118. var vm = this;
  5119. if (vm._isBeingDestroyed) {
  5120. return
  5121. }
  5122. callHook(vm, 'beforeDestroy');
  5123. vm._isBeingDestroyed = true;
  5124. // remove self from parent
  5125. var parent = vm.$parent;
  5126. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  5127. remove(parent.$children, vm);
  5128. }
  5129. // teardown watchers
  5130. if (vm._watcher) {
  5131. vm._watcher.teardown();
  5132. }
  5133. var i = vm._watchers.length;
  5134. while (i--) {
  5135. vm._watchers[i].teardown();
  5136. }
  5137. // remove reference from data ob
  5138. // frozen object may not have observer.
  5139. if (vm._data.__ob__) {
  5140. vm._data.__ob__.vmCount--;
  5141. }
  5142. // call the last hook...
  5143. vm._isDestroyed = true;
  5144. // invoke destroy hooks on current rendered tree
  5145. vm.__patch__(vm._vnode, null);
  5146. // fire destroyed hook
  5147. callHook(vm, 'destroyed');
  5148. // turn off all instance listeners.
  5149. vm.$off();
  5150. // remove __vue__ reference
  5151. if (vm.$el) {
  5152. vm.$el.__vue__ = null;
  5153. }
  5154. // release circular reference (#6759)
  5155. if (vm.$vnode) {
  5156. vm.$vnode.parent = null;
  5157. }
  5158. };
  5159. }
  5160. function updateChildComponent (
  5161. vm,
  5162. propsData,
  5163. listeners,
  5164. parentVnode,
  5165. renderChildren
  5166. ) {
  5167. if (true) {
  5168. isUpdatingChildComponent = true;
  5169. }
  5170. // determine whether component has slot children
  5171. // we need to do this before overwriting $options._renderChildren.
  5172. // check if there are dynamic scopedSlots (hand-written or compiled but with
  5173. // dynamic slot names). Static scoped slots compiled from template has the
  5174. // "$stable" marker.
  5175. var newScopedSlots = parentVnode.data.scopedSlots;
  5176. var oldScopedSlots = vm.$scopedSlots;
  5177. var hasDynamicScopedSlot = !!(
  5178. (newScopedSlots && !newScopedSlots.$stable) ||
  5179. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  5180. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  5181. );
  5182. // Any static slot children from the parent may have changed during parent's
  5183. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  5184. // update is necessary to ensure correctness.
  5185. var needsForceUpdate = !!(
  5186. renderChildren || // has new static slots
  5187. vm.$options._renderChildren || // has old static slots
  5188. hasDynamicScopedSlot
  5189. );
  5190. vm.$options._parentVnode = parentVnode;
  5191. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  5192. if (vm._vnode) { // update child tree's parent
  5193. vm._vnode.parent = parentVnode;
  5194. }
  5195. vm.$options._renderChildren = renderChildren;
  5196. // update $attrs and $listeners hash
  5197. // these are also reactive so they may trigger child update if the child
  5198. // used them during render
  5199. vm.$attrs = parentVnode.data.attrs || emptyObject;
  5200. vm.$listeners = listeners || emptyObject;
  5201. // update props
  5202. if (propsData && vm.$options.props) {
  5203. toggleObserving(false);
  5204. var props = vm._props;
  5205. var propKeys = vm.$options._propKeys || [];
  5206. for (var i = 0; i < propKeys.length; i++) {
  5207. var key = propKeys[i];
  5208. var propOptions = vm.$options.props; // wtf flow?
  5209. props[key] = validateProp(key, propOptions, propsData, vm);
  5210. }
  5211. toggleObserving(true);
  5212. // keep a copy of raw propsData
  5213. vm.$options.propsData = propsData;
  5214. }
  5215. // fixed by xxxxxx update properties(mp runtime)
  5216. vm._$updateProperties && vm._$updateProperties(vm);
  5217. // update listeners
  5218. listeners = listeners || emptyObject;
  5219. var oldListeners = vm.$options._parentListeners;
  5220. vm.$options._parentListeners = listeners;
  5221. updateComponentListeners(vm, listeners, oldListeners);
  5222. // resolve slots + force update if has children
  5223. if (needsForceUpdate) {
  5224. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  5225. vm.$forceUpdate();
  5226. }
  5227. if (true) {
  5228. isUpdatingChildComponent = false;
  5229. }
  5230. }
  5231. function isInInactiveTree (vm) {
  5232. while (vm && (vm = vm.$parent)) {
  5233. if (vm._inactive) { return true }
  5234. }
  5235. return false
  5236. }
  5237. function activateChildComponent (vm, direct) {
  5238. if (direct) {
  5239. vm._directInactive = false;
  5240. if (isInInactiveTree(vm)) {
  5241. return
  5242. }
  5243. } else if (vm._directInactive) {
  5244. return
  5245. }
  5246. if (vm._inactive || vm._inactive === null) {
  5247. vm._inactive = false;
  5248. for (var i = 0; i < vm.$children.length; i++) {
  5249. activateChildComponent(vm.$children[i]);
  5250. }
  5251. callHook(vm, 'activated');
  5252. }
  5253. }
  5254. function deactivateChildComponent (vm, direct) {
  5255. if (direct) {
  5256. vm._directInactive = true;
  5257. if (isInInactiveTree(vm)) {
  5258. return
  5259. }
  5260. }
  5261. if (!vm._inactive) {
  5262. vm._inactive = true;
  5263. for (var i = 0; i < vm.$children.length; i++) {
  5264. deactivateChildComponent(vm.$children[i]);
  5265. }
  5266. callHook(vm, 'deactivated');
  5267. }
  5268. }
  5269. function callHook (vm, hook) {
  5270. // #7573 disable dep collection when invoking lifecycle hooks
  5271. pushTarget();
  5272. var handlers = vm.$options[hook];
  5273. var info = hook + " hook";
  5274. if (handlers) {
  5275. for (var i = 0, j = handlers.length; i < j; i++) {
  5276. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  5277. }
  5278. }
  5279. if (vm._hasHookEvent) {
  5280. vm.$emit('hook:' + hook);
  5281. }
  5282. popTarget();
  5283. }
  5284. /* */
  5285. var MAX_UPDATE_COUNT = 100;
  5286. var queue = [];
  5287. var activatedChildren = [];
  5288. var has = {};
  5289. var circular = {};
  5290. var waiting = false;
  5291. var flushing = false;
  5292. var index = 0;
  5293. /**
  5294. * Reset the scheduler's state.
  5295. */
  5296. function resetSchedulerState () {
  5297. index = queue.length = activatedChildren.length = 0;
  5298. has = {};
  5299. if (true) {
  5300. circular = {};
  5301. }
  5302. waiting = flushing = false;
  5303. }
  5304. // Async edge case #6566 requires saving the timestamp when event listeners are
  5305. // attached. However, calling performance.now() has a perf overhead especially
  5306. // if the page has thousands of event listeners. Instead, we take a timestamp
  5307. // every time the scheduler flushes and use that for all event listeners
  5308. // attached during that flush.
  5309. var currentFlushTimestamp = 0;
  5310. // Async edge case fix requires storing an event listener's attach timestamp.
  5311. var getNow = Date.now;
  5312. // Determine what event timestamp the browser is using. Annoyingly, the
  5313. // timestamp can either be hi-res (relative to page load) or low-res
  5314. // (relative to UNIX epoch), so in order to compare time we have to use the
  5315. // same timestamp type when saving the flush timestamp.
  5316. // All IE versions use low-res event timestamps, and have problematic clock
  5317. // implementations (#9632)
  5318. if (inBrowser && !isIE) {
  5319. var performance = window.performance;
  5320. if (
  5321. performance &&
  5322. typeof performance.now === 'function' &&
  5323. getNow() > document.createEvent('Event').timeStamp
  5324. ) {
  5325. // if the event timestamp, although evaluated AFTER the Date.now(), is
  5326. // smaller than it, it means the event is using a hi-res timestamp,
  5327. // and we need to use the hi-res version for event listener timestamps as
  5328. // well.
  5329. getNow = function () { return performance.now(); };
  5330. }
  5331. }
  5332. /**
  5333. * Flush both queues and run the watchers.
  5334. */
  5335. function flushSchedulerQueue () {
  5336. currentFlushTimestamp = getNow();
  5337. flushing = true;
  5338. var watcher, id;
  5339. // Sort queue before flush.
  5340. // This ensures that:
  5341. // 1. Components are updated from parent to child. (because parent is always
  5342. // created before the child)
  5343. // 2. A component's user watchers are run before its render watcher (because
  5344. // user watchers are created before the render watcher)
  5345. // 3. If a component is destroyed during a parent component's watcher run,
  5346. // its watchers can be skipped.
  5347. queue.sort(function (a, b) { return a.id - b.id; });
  5348. // do not cache length because more watchers might be pushed
  5349. // as we run existing watchers
  5350. for (index = 0; index < queue.length; index++) {
  5351. watcher = queue[index];
  5352. if (watcher.before) {
  5353. watcher.before();
  5354. }
  5355. id = watcher.id;
  5356. has[id] = null;
  5357. watcher.run();
  5358. // in dev build, check and stop circular updates.
  5359. if ( true && has[id] != null) {
  5360. circular[id] = (circular[id] || 0) + 1;
  5361. if (circular[id] > MAX_UPDATE_COUNT) {
  5362. warn(
  5363. 'You may have an infinite update loop ' + (
  5364. watcher.user
  5365. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  5366. : "in a component render function."
  5367. ),
  5368. watcher.vm
  5369. );
  5370. break
  5371. }
  5372. }
  5373. }
  5374. // keep copies of post queues before resetting state
  5375. var activatedQueue = activatedChildren.slice();
  5376. var updatedQueue = queue.slice();
  5377. resetSchedulerState();
  5378. // call component updated and activated hooks
  5379. callActivatedHooks(activatedQueue);
  5380. callUpdatedHooks(updatedQueue);
  5381. // devtool hook
  5382. /* istanbul ignore if */
  5383. if (devtools && config.devtools) {
  5384. devtools.emit('flush');
  5385. }
  5386. }
  5387. function callUpdatedHooks (queue) {
  5388. var i = queue.length;
  5389. while (i--) {
  5390. var watcher = queue[i];
  5391. var vm = watcher.vm;
  5392. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  5393. callHook(vm, 'updated');
  5394. }
  5395. }
  5396. }
  5397. /**
  5398. * Queue a kept-alive component that was activated during patch.
  5399. * The queue will be processed after the entire tree has been patched.
  5400. */
  5401. function queueActivatedComponent (vm) {
  5402. // setting _inactive to false here so that a render function can
  5403. // rely on checking whether it's in an inactive tree (e.g. router-view)
  5404. vm._inactive = false;
  5405. activatedChildren.push(vm);
  5406. }
  5407. function callActivatedHooks (queue) {
  5408. for (var i = 0; i < queue.length; i++) {
  5409. queue[i]._inactive = true;
  5410. activateChildComponent(queue[i], true /* true */);
  5411. }
  5412. }
  5413. /**
  5414. * Push a watcher into the watcher queue.
  5415. * Jobs with duplicate IDs will be skipped unless it's
  5416. * pushed when the queue is being flushed.
  5417. */
  5418. function queueWatcher (watcher) {
  5419. var id = watcher.id;
  5420. if (has[id] == null) {
  5421. has[id] = true;
  5422. if (!flushing) {
  5423. queue.push(watcher);
  5424. } else {
  5425. // if already flushing, splice the watcher based on its id
  5426. // if already past its id, it will be run next immediately.
  5427. var i = queue.length - 1;
  5428. while (i > index && queue[i].id > watcher.id) {
  5429. i--;
  5430. }
  5431. queue.splice(i + 1, 0, watcher);
  5432. }
  5433. // queue the flush
  5434. if (!waiting) {
  5435. waiting = true;
  5436. if ( true && !config.async) {
  5437. flushSchedulerQueue();
  5438. return
  5439. }
  5440. nextTick(flushSchedulerQueue);
  5441. }
  5442. }
  5443. }
  5444. /* */
  5445. var uid$2 = 0;
  5446. /**
  5447. * A watcher parses an expression, collects dependencies,
  5448. * and fires callback when the expression value changes.
  5449. * This is used for both the $watch() api and directives.
  5450. */
  5451. var Watcher = function Watcher (
  5452. vm,
  5453. expOrFn,
  5454. cb,
  5455. options,
  5456. isRenderWatcher
  5457. ) {
  5458. this.vm = vm;
  5459. if (isRenderWatcher) {
  5460. vm._watcher = this;
  5461. }
  5462. vm._watchers.push(this);
  5463. // options
  5464. if (options) {
  5465. this.deep = !!options.deep;
  5466. this.user = !!options.user;
  5467. this.lazy = !!options.lazy;
  5468. this.sync = !!options.sync;
  5469. this.before = options.before;
  5470. } else {
  5471. this.deep = this.user = this.lazy = this.sync = false;
  5472. }
  5473. this.cb = cb;
  5474. this.id = ++uid$2; // uid for batching
  5475. this.active = true;
  5476. this.dirty = this.lazy; // for lazy watchers
  5477. this.deps = [];
  5478. this.newDeps = [];
  5479. this.depIds = new _Set();
  5480. this.newDepIds = new _Set();
  5481. this.expression = true
  5482. ? expOrFn.toString()
  5483. : undefined;
  5484. // parse expression for getter
  5485. if (typeof expOrFn === 'function') {
  5486. this.getter = expOrFn;
  5487. } else {
  5488. this.getter = parsePath(expOrFn);
  5489. if (!this.getter) {
  5490. this.getter = noop;
  5491. true && warn(
  5492. "Failed watching path: \"" + expOrFn + "\" " +
  5493. 'Watcher only accepts simple dot-delimited paths. ' +
  5494. 'For full control, use a function instead.',
  5495. vm
  5496. );
  5497. }
  5498. }
  5499. this.value = this.lazy
  5500. ? undefined
  5501. : this.get();
  5502. };
  5503. /**
  5504. * Evaluate the getter, and re-collect dependencies.
  5505. */
  5506. Watcher.prototype.get = function get () {
  5507. pushTarget(this);
  5508. var value;
  5509. var vm = this.vm;
  5510. try {
  5511. value = this.getter.call(vm, vm);
  5512. } catch (e) {
  5513. if (this.user) {
  5514. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  5515. } else {
  5516. throw e
  5517. }
  5518. } finally {
  5519. // "touch" every property so they are all tracked as
  5520. // dependencies for deep watching
  5521. if (this.deep) {
  5522. traverse(value);
  5523. }
  5524. popTarget();
  5525. this.cleanupDeps();
  5526. }
  5527. return value
  5528. };
  5529. /**
  5530. * Add a dependency to this directive.
  5531. */
  5532. Watcher.prototype.addDep = function addDep (dep) {
  5533. var id = dep.id;
  5534. if (!this.newDepIds.has(id)) {
  5535. this.newDepIds.add(id);
  5536. this.newDeps.push(dep);
  5537. if (!this.depIds.has(id)) {
  5538. dep.addSub(this);
  5539. }
  5540. }
  5541. };
  5542. /**
  5543. * Clean up for dependency collection.
  5544. */
  5545. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  5546. var i = this.deps.length;
  5547. while (i--) {
  5548. var dep = this.deps[i];
  5549. if (!this.newDepIds.has(dep.id)) {
  5550. dep.removeSub(this);
  5551. }
  5552. }
  5553. var tmp = this.depIds;
  5554. this.depIds = this.newDepIds;
  5555. this.newDepIds = tmp;
  5556. this.newDepIds.clear();
  5557. tmp = this.deps;
  5558. this.deps = this.newDeps;
  5559. this.newDeps = tmp;
  5560. this.newDeps.length = 0;
  5561. };
  5562. /**
  5563. * Subscriber interface.
  5564. * Will be called when a dependency changes.
  5565. */
  5566. Watcher.prototype.update = function update () {
  5567. /* istanbul ignore else */
  5568. if (this.lazy) {
  5569. this.dirty = true;
  5570. } else if (this.sync) {
  5571. this.run();
  5572. } else {
  5573. queueWatcher(this);
  5574. }
  5575. };
  5576. /**
  5577. * Scheduler job interface.
  5578. * Will be called by the scheduler.
  5579. */
  5580. Watcher.prototype.run = function run () {
  5581. if (this.active) {
  5582. var value = this.get();
  5583. if (
  5584. value !== this.value ||
  5585. // Deep watchers and watchers on Object/Arrays should fire even
  5586. // when the value is the same, because the value may
  5587. // have mutated.
  5588. isObject(value) ||
  5589. this.deep
  5590. ) {
  5591. // set new value
  5592. var oldValue = this.value;
  5593. this.value = value;
  5594. if (this.user) {
  5595. try {
  5596. this.cb.call(this.vm, value, oldValue);
  5597. } catch (e) {
  5598. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  5599. }
  5600. } else {
  5601. this.cb.call(this.vm, value, oldValue);
  5602. }
  5603. }
  5604. }
  5605. };
  5606. /**
  5607. * Evaluate the value of the watcher.
  5608. * This only gets called for lazy watchers.
  5609. */
  5610. Watcher.prototype.evaluate = function evaluate () {
  5611. this.value = this.get();
  5612. this.dirty = false;
  5613. };
  5614. /**
  5615. * Depend on all deps collected by this watcher.
  5616. */
  5617. Watcher.prototype.depend = function depend () {
  5618. var i = this.deps.length;
  5619. while (i--) {
  5620. this.deps[i].depend();
  5621. }
  5622. };
  5623. /**
  5624. * Remove self from all dependencies' subscriber list.
  5625. */
  5626. Watcher.prototype.teardown = function teardown () {
  5627. if (this.active) {
  5628. // remove self from vm's watcher list
  5629. // this is a somewhat expensive operation so we skip it
  5630. // if the vm is being destroyed.
  5631. if (!this.vm._isBeingDestroyed) {
  5632. remove(this.vm._watchers, this);
  5633. }
  5634. var i = this.deps.length;
  5635. while (i--) {
  5636. this.deps[i].removeSub(this);
  5637. }
  5638. this.active = false;
  5639. }
  5640. };
  5641. /* */
  5642. var sharedPropertyDefinition = {
  5643. enumerable: true,
  5644. configurable: true,
  5645. get: noop,
  5646. set: noop
  5647. };
  5648. function proxy (target, sourceKey, key) {
  5649. sharedPropertyDefinition.get = function proxyGetter () {
  5650. return this[sourceKey][key]
  5651. };
  5652. sharedPropertyDefinition.set = function proxySetter (val) {
  5653. this[sourceKey][key] = val;
  5654. };
  5655. Object.defineProperty(target, key, sharedPropertyDefinition);
  5656. }
  5657. function initState (vm) {
  5658. vm._watchers = [];
  5659. var opts = vm.$options;
  5660. if (opts.props) { initProps(vm, opts.props); }
  5661. if (opts.methods) { initMethods(vm, opts.methods); }
  5662. if (opts.data) {
  5663. initData(vm);
  5664. } else {
  5665. observe(vm._data = {}, true /* asRootData */);
  5666. }
  5667. if (opts.computed) { initComputed(vm, opts.computed); }
  5668. if (opts.watch && opts.watch !== nativeWatch) {
  5669. initWatch(vm, opts.watch);
  5670. }
  5671. }
  5672. function initProps (vm, propsOptions) {
  5673. var propsData = vm.$options.propsData || {};
  5674. var props = vm._props = {};
  5675. // cache prop keys so that future props updates can iterate using Array
  5676. // instead of dynamic object key enumeration.
  5677. var keys = vm.$options._propKeys = [];
  5678. var isRoot = !vm.$parent;
  5679. // root instance props should be converted
  5680. if (!isRoot) {
  5681. toggleObserving(false);
  5682. }
  5683. var loop = function ( key ) {
  5684. keys.push(key);
  5685. var value = validateProp(key, propsOptions, propsData, vm);
  5686. /* istanbul ignore else */
  5687. if (true) {
  5688. var hyphenatedKey = hyphenate(key);
  5689. if (isReservedAttribute(hyphenatedKey) ||
  5690. config.isReservedAttr(hyphenatedKey)) {
  5691. warn(
  5692. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  5693. vm
  5694. );
  5695. }
  5696. defineReactive$$1(props, key, value, function () {
  5697. if (!isRoot && !isUpdatingChildComponent) {
  5698. {
  5699. if(vm.mpHost === 'mp-baidu'){//百度 observer 在 setData callback 之后触发,直接忽略该 warn
  5700. return
  5701. }
  5702. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  5703. if(
  5704. key === 'value' &&
  5705. Array.isArray(vm.$options.behaviors) &&
  5706. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  5707. ){
  5708. return
  5709. }
  5710. if(vm._getFormData){
  5711. return
  5712. }
  5713. var $parent = vm.$parent;
  5714. while($parent){
  5715. if($parent.__next_tick_pending){
  5716. return
  5717. }
  5718. $parent = $parent.$parent;
  5719. }
  5720. }
  5721. warn(
  5722. "Avoid mutating a prop directly since the value will be " +
  5723. "overwritten whenever the parent component re-renders. " +
  5724. "Instead, use a data or computed property based on the prop's " +
  5725. "value. Prop being mutated: \"" + key + "\"",
  5726. vm
  5727. );
  5728. }
  5729. });
  5730. } else {}
  5731. // static props are already proxied on the component's prototype
  5732. // during Vue.extend(). We only need to proxy props defined at
  5733. // instantiation here.
  5734. if (!(key in vm)) {
  5735. proxy(vm, "_props", key);
  5736. }
  5737. };
  5738. for (var key in propsOptions) loop( key );
  5739. toggleObserving(true);
  5740. }
  5741. function initData (vm) {
  5742. var data = vm.$options.data;
  5743. data = vm._data = typeof data === 'function'
  5744. ? getData(data, vm)
  5745. : data || {};
  5746. if (!isPlainObject(data)) {
  5747. data = {};
  5748. true && warn(
  5749. 'data functions should return an object:\n' +
  5750. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  5751. vm
  5752. );
  5753. }
  5754. // proxy data on instance
  5755. var keys = Object.keys(data);
  5756. var props = vm.$options.props;
  5757. var methods = vm.$options.methods;
  5758. var i = keys.length;
  5759. while (i--) {
  5760. var key = keys[i];
  5761. if (true) {
  5762. if (methods && hasOwn(methods, key)) {
  5763. warn(
  5764. ("Method \"" + key + "\" has already been defined as a data property."),
  5765. vm
  5766. );
  5767. }
  5768. }
  5769. if (props && hasOwn(props, key)) {
  5770. true && warn(
  5771. "The data property \"" + key + "\" is already declared as a prop. " +
  5772. "Use prop default value instead.",
  5773. vm
  5774. );
  5775. } else if (!isReserved(key)) {
  5776. proxy(vm, "_data", key);
  5777. }
  5778. }
  5779. // observe data
  5780. observe(data, true /* asRootData */);
  5781. }
  5782. function getData (data, vm) {
  5783. // #7573 disable dep collection when invoking data getters
  5784. pushTarget();
  5785. try {
  5786. return data.call(vm, vm)
  5787. } catch (e) {
  5788. handleError(e, vm, "data()");
  5789. return {}
  5790. } finally {
  5791. popTarget();
  5792. }
  5793. }
  5794. var computedWatcherOptions = { lazy: true };
  5795. function initComputed (vm, computed) {
  5796. // $flow-disable-line
  5797. var watchers = vm._computedWatchers = Object.create(null);
  5798. // computed properties are just getters during SSR
  5799. var isSSR = isServerRendering();
  5800. for (var key in computed) {
  5801. var userDef = computed[key];
  5802. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  5803. if ( true && getter == null) {
  5804. warn(
  5805. ("Getter is missing for computed property \"" + key + "\"."),
  5806. vm
  5807. );
  5808. }
  5809. if (!isSSR) {
  5810. // create internal watcher for the computed property.
  5811. watchers[key] = new Watcher(
  5812. vm,
  5813. getter || noop,
  5814. noop,
  5815. computedWatcherOptions
  5816. );
  5817. }
  5818. // component-defined computed properties are already defined on the
  5819. // component prototype. We only need to define computed properties defined
  5820. // at instantiation here.
  5821. if (!(key in vm)) {
  5822. defineComputed(vm, key, userDef);
  5823. } else if (true) {
  5824. if (key in vm.$data) {
  5825. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  5826. } else if (vm.$options.props && key in vm.$options.props) {
  5827. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  5828. }
  5829. }
  5830. }
  5831. }
  5832. function defineComputed (
  5833. target,
  5834. key,
  5835. userDef
  5836. ) {
  5837. var shouldCache = !isServerRendering();
  5838. if (typeof userDef === 'function') {
  5839. sharedPropertyDefinition.get = shouldCache
  5840. ? createComputedGetter(key)
  5841. : createGetterInvoker(userDef);
  5842. sharedPropertyDefinition.set = noop;
  5843. } else {
  5844. sharedPropertyDefinition.get = userDef.get
  5845. ? shouldCache && userDef.cache !== false
  5846. ? createComputedGetter(key)
  5847. : createGetterInvoker(userDef.get)
  5848. : noop;
  5849. sharedPropertyDefinition.set = userDef.set || noop;
  5850. }
  5851. if ( true &&
  5852. sharedPropertyDefinition.set === noop) {
  5853. sharedPropertyDefinition.set = function () {
  5854. warn(
  5855. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  5856. this
  5857. );
  5858. };
  5859. }
  5860. Object.defineProperty(target, key, sharedPropertyDefinition);
  5861. }
  5862. function createComputedGetter (key) {
  5863. return function computedGetter () {
  5864. var watcher = this._computedWatchers && this._computedWatchers[key];
  5865. if (watcher) {
  5866. if (watcher.dirty) {
  5867. watcher.evaluate();
  5868. }
  5869. if (Dep.SharedObject.target) {// fixed by xxxxxx
  5870. watcher.depend();
  5871. }
  5872. return watcher.value
  5873. }
  5874. }
  5875. }
  5876. function createGetterInvoker(fn) {
  5877. return function computedGetter () {
  5878. return fn.call(this, this)
  5879. }
  5880. }
  5881. function initMethods (vm, methods) {
  5882. var props = vm.$options.props;
  5883. for (var key in methods) {
  5884. if (true) {
  5885. if (typeof methods[key] !== 'function') {
  5886. warn(
  5887. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  5888. "Did you reference the function correctly?",
  5889. vm
  5890. );
  5891. }
  5892. if (props && hasOwn(props, key)) {
  5893. warn(
  5894. ("Method \"" + key + "\" has already been defined as a prop."),
  5895. vm
  5896. );
  5897. }
  5898. if ((key in vm) && isReserved(key)) {
  5899. warn(
  5900. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  5901. "Avoid defining component methods that start with _ or $."
  5902. );
  5903. }
  5904. }
  5905. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  5906. }
  5907. }
  5908. function initWatch (vm, watch) {
  5909. for (var key in watch) {
  5910. var handler = watch[key];
  5911. if (Array.isArray(handler)) {
  5912. for (var i = 0; i < handler.length; i++) {
  5913. createWatcher(vm, key, handler[i]);
  5914. }
  5915. } else {
  5916. createWatcher(vm, key, handler);
  5917. }
  5918. }
  5919. }
  5920. function createWatcher (
  5921. vm,
  5922. expOrFn,
  5923. handler,
  5924. options
  5925. ) {
  5926. if (isPlainObject(handler)) {
  5927. options = handler;
  5928. handler = handler.handler;
  5929. }
  5930. if (typeof handler === 'string') {
  5931. handler = vm[handler];
  5932. }
  5933. return vm.$watch(expOrFn, handler, options)
  5934. }
  5935. function stateMixin (Vue) {
  5936. // flow somehow has problems with directly declared definition object
  5937. // when using Object.defineProperty, so we have to procedurally build up
  5938. // the object here.
  5939. var dataDef = {};
  5940. dataDef.get = function () { return this._data };
  5941. var propsDef = {};
  5942. propsDef.get = function () { return this._props };
  5943. if (true) {
  5944. dataDef.set = function () {
  5945. warn(
  5946. 'Avoid replacing instance root $data. ' +
  5947. 'Use nested data properties instead.',
  5948. this
  5949. );
  5950. };
  5951. propsDef.set = function () {
  5952. warn("$props is readonly.", this);
  5953. };
  5954. }
  5955. Object.defineProperty(Vue.prototype, '$data', dataDef);
  5956. Object.defineProperty(Vue.prototype, '$props', propsDef);
  5957. Vue.prototype.$set = set;
  5958. Vue.prototype.$delete = del;
  5959. Vue.prototype.$watch = function (
  5960. expOrFn,
  5961. cb,
  5962. options
  5963. ) {
  5964. var vm = this;
  5965. if (isPlainObject(cb)) {
  5966. return createWatcher(vm, expOrFn, cb, options)
  5967. }
  5968. options = options || {};
  5969. options.user = true;
  5970. var watcher = new Watcher(vm, expOrFn, cb, options);
  5971. if (options.immediate) {
  5972. try {
  5973. cb.call(vm, watcher.value);
  5974. } catch (error) {
  5975. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  5976. }
  5977. }
  5978. return function unwatchFn () {
  5979. watcher.teardown();
  5980. }
  5981. };
  5982. }
  5983. /* */
  5984. var uid$3 = 0;
  5985. function initMixin (Vue) {
  5986. Vue.prototype._init = function (options) {
  5987. var vm = this;
  5988. // a uid
  5989. vm._uid = uid$3++;
  5990. var startTag, endTag;
  5991. /* istanbul ignore if */
  5992. if ( true && config.performance && mark) {
  5993. startTag = "vue-perf-start:" + (vm._uid);
  5994. endTag = "vue-perf-end:" + (vm._uid);
  5995. mark(startTag);
  5996. }
  5997. // a flag to avoid this being observed
  5998. vm._isVue = true;
  5999. // merge options
  6000. if (options && options._isComponent) {
  6001. // optimize internal component instantiation
  6002. // since dynamic options merging is pretty slow, and none of the
  6003. // internal component options needs special treatment.
  6004. initInternalComponent(vm, options);
  6005. } else {
  6006. vm.$options = mergeOptions(
  6007. resolveConstructorOptions(vm.constructor),
  6008. options || {},
  6009. vm
  6010. );
  6011. }
  6012. /* istanbul ignore else */
  6013. if (true) {
  6014. initProxy(vm);
  6015. } else {}
  6016. // expose real self
  6017. vm._self = vm;
  6018. initLifecycle(vm);
  6019. initEvents(vm);
  6020. initRender(vm);
  6021. callHook(vm, 'beforeCreate');
  6022. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  6023. initState(vm);
  6024. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  6025. !vm._$fallback && callHook(vm, 'created');
  6026. /* istanbul ignore if */
  6027. if ( true && config.performance && mark) {
  6028. vm._name = formatComponentName(vm, false);
  6029. mark(endTag);
  6030. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  6031. }
  6032. if (vm.$options.el) {
  6033. vm.$mount(vm.$options.el);
  6034. }
  6035. };
  6036. }
  6037. function initInternalComponent (vm, options) {
  6038. var opts = vm.$options = Object.create(vm.constructor.options);
  6039. // doing this because it's faster than dynamic enumeration.
  6040. var parentVnode = options._parentVnode;
  6041. opts.parent = options.parent;
  6042. opts._parentVnode = parentVnode;
  6043. var vnodeComponentOptions = parentVnode.componentOptions;
  6044. opts.propsData = vnodeComponentOptions.propsData;
  6045. opts._parentListeners = vnodeComponentOptions.listeners;
  6046. opts._renderChildren = vnodeComponentOptions.children;
  6047. opts._componentTag = vnodeComponentOptions.tag;
  6048. if (options.render) {
  6049. opts.render = options.render;
  6050. opts.staticRenderFns = options.staticRenderFns;
  6051. }
  6052. }
  6053. function resolveConstructorOptions (Ctor) {
  6054. var options = Ctor.options;
  6055. if (Ctor.super) {
  6056. var superOptions = resolveConstructorOptions(Ctor.super);
  6057. var cachedSuperOptions = Ctor.superOptions;
  6058. if (superOptions !== cachedSuperOptions) {
  6059. // super option changed,
  6060. // need to resolve new options.
  6061. Ctor.superOptions = superOptions;
  6062. // check if there are any late-modified/attached options (#4976)
  6063. var modifiedOptions = resolveModifiedOptions(Ctor);
  6064. // update base extend options
  6065. if (modifiedOptions) {
  6066. extend(Ctor.extendOptions, modifiedOptions);
  6067. }
  6068. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  6069. if (options.name) {
  6070. options.components[options.name] = Ctor;
  6071. }
  6072. }
  6073. }
  6074. return options
  6075. }
  6076. function resolveModifiedOptions (Ctor) {
  6077. var modified;
  6078. var latest = Ctor.options;
  6079. var sealed = Ctor.sealedOptions;
  6080. for (var key in latest) {
  6081. if (latest[key] !== sealed[key]) {
  6082. if (!modified) { modified = {}; }
  6083. modified[key] = latest[key];
  6084. }
  6085. }
  6086. return modified
  6087. }
  6088. function Vue (options) {
  6089. if ( true &&
  6090. !(this instanceof Vue)
  6091. ) {
  6092. warn('Vue is a constructor and should be called with the `new` keyword');
  6093. }
  6094. this._init(options);
  6095. }
  6096. initMixin(Vue);
  6097. stateMixin(Vue);
  6098. eventsMixin(Vue);
  6099. lifecycleMixin(Vue);
  6100. renderMixin(Vue);
  6101. /* */
  6102. function initUse (Vue) {
  6103. Vue.use = function (plugin) {
  6104. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  6105. if (installedPlugins.indexOf(plugin) > -1) {
  6106. return this
  6107. }
  6108. // additional parameters
  6109. var args = toArray(arguments, 1);
  6110. args.unshift(this);
  6111. if (typeof plugin.install === 'function') {
  6112. plugin.install.apply(plugin, args);
  6113. } else if (typeof plugin === 'function') {
  6114. plugin.apply(null, args);
  6115. }
  6116. installedPlugins.push(plugin);
  6117. return this
  6118. };
  6119. }
  6120. /* */
  6121. function initMixin$1 (Vue) {
  6122. Vue.mixin = function (mixin) {
  6123. this.options = mergeOptions(this.options, mixin);
  6124. return this
  6125. };
  6126. }
  6127. /* */
  6128. function initExtend (Vue) {
  6129. /**
  6130. * Each instance constructor, including Vue, has a unique
  6131. * cid. This enables us to create wrapped "child
  6132. * constructors" for prototypal inheritance and cache them.
  6133. */
  6134. Vue.cid = 0;
  6135. var cid = 1;
  6136. /**
  6137. * Class inheritance
  6138. */
  6139. Vue.extend = function (extendOptions) {
  6140. extendOptions = extendOptions || {};
  6141. var Super = this;
  6142. var SuperId = Super.cid;
  6143. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  6144. if (cachedCtors[SuperId]) {
  6145. return cachedCtors[SuperId]
  6146. }
  6147. var name = extendOptions.name || Super.options.name;
  6148. if ( true && name) {
  6149. validateComponentName(name);
  6150. }
  6151. var Sub = function VueComponent (options) {
  6152. this._init(options);
  6153. };
  6154. Sub.prototype = Object.create(Super.prototype);
  6155. Sub.prototype.constructor = Sub;
  6156. Sub.cid = cid++;
  6157. Sub.options = mergeOptions(
  6158. Super.options,
  6159. extendOptions
  6160. );
  6161. Sub['super'] = Super;
  6162. // For props and computed properties, we define the proxy getters on
  6163. // the Vue instances at extension time, on the extended prototype. This
  6164. // avoids Object.defineProperty calls for each instance created.
  6165. if (Sub.options.props) {
  6166. initProps$1(Sub);
  6167. }
  6168. if (Sub.options.computed) {
  6169. initComputed$1(Sub);
  6170. }
  6171. // allow further extension/mixin/plugin usage
  6172. Sub.extend = Super.extend;
  6173. Sub.mixin = Super.mixin;
  6174. Sub.use = Super.use;
  6175. // create asset registers, so extended classes
  6176. // can have their private assets too.
  6177. ASSET_TYPES.forEach(function (type) {
  6178. Sub[type] = Super[type];
  6179. });
  6180. // enable recursive self-lookup
  6181. if (name) {
  6182. Sub.options.components[name] = Sub;
  6183. }
  6184. // keep a reference to the super options at extension time.
  6185. // later at instantiation we can check if Super's options have
  6186. // been updated.
  6187. Sub.superOptions = Super.options;
  6188. Sub.extendOptions = extendOptions;
  6189. Sub.sealedOptions = extend({}, Sub.options);
  6190. // cache constructor
  6191. cachedCtors[SuperId] = Sub;
  6192. return Sub
  6193. };
  6194. }
  6195. function initProps$1 (Comp) {
  6196. var props = Comp.options.props;
  6197. for (var key in props) {
  6198. proxy(Comp.prototype, "_props", key);
  6199. }
  6200. }
  6201. function initComputed$1 (Comp) {
  6202. var computed = Comp.options.computed;
  6203. for (var key in computed) {
  6204. defineComputed(Comp.prototype, key, computed[key]);
  6205. }
  6206. }
  6207. /* */
  6208. function initAssetRegisters (Vue) {
  6209. /**
  6210. * Create asset registration methods.
  6211. */
  6212. ASSET_TYPES.forEach(function (type) {
  6213. Vue[type] = function (
  6214. id,
  6215. definition
  6216. ) {
  6217. if (!definition) {
  6218. return this.options[type + 's'][id]
  6219. } else {
  6220. /* istanbul ignore if */
  6221. if ( true && type === 'component') {
  6222. validateComponentName(id);
  6223. }
  6224. if (type === 'component' && isPlainObject(definition)) {
  6225. definition.name = definition.name || id;
  6226. definition = this.options._base.extend(definition);
  6227. }
  6228. if (type === 'directive' && typeof definition === 'function') {
  6229. definition = { bind: definition, update: definition };
  6230. }
  6231. this.options[type + 's'][id] = definition;
  6232. return definition
  6233. }
  6234. };
  6235. });
  6236. }
  6237. /* */
  6238. function getComponentName (opts) {
  6239. return opts && (opts.Ctor.options.name || opts.tag)
  6240. }
  6241. function matches (pattern, name) {
  6242. if (Array.isArray(pattern)) {
  6243. return pattern.indexOf(name) > -1
  6244. } else if (typeof pattern === 'string') {
  6245. return pattern.split(',').indexOf(name) > -1
  6246. } else if (isRegExp(pattern)) {
  6247. return pattern.test(name)
  6248. }
  6249. /* istanbul ignore next */
  6250. return false
  6251. }
  6252. function pruneCache (keepAliveInstance, filter) {
  6253. var cache = keepAliveInstance.cache;
  6254. var keys = keepAliveInstance.keys;
  6255. var _vnode = keepAliveInstance._vnode;
  6256. for (var key in cache) {
  6257. var cachedNode = cache[key];
  6258. if (cachedNode) {
  6259. var name = getComponentName(cachedNode.componentOptions);
  6260. if (name && !filter(name)) {
  6261. pruneCacheEntry(cache, key, keys, _vnode);
  6262. }
  6263. }
  6264. }
  6265. }
  6266. function pruneCacheEntry (
  6267. cache,
  6268. key,
  6269. keys,
  6270. current
  6271. ) {
  6272. var cached$$1 = cache[key];
  6273. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  6274. cached$$1.componentInstance.$destroy();
  6275. }
  6276. cache[key] = null;
  6277. remove(keys, key);
  6278. }
  6279. var patternTypes = [String, RegExp, Array];
  6280. var KeepAlive = {
  6281. name: 'keep-alive',
  6282. abstract: true,
  6283. props: {
  6284. include: patternTypes,
  6285. exclude: patternTypes,
  6286. max: [String, Number]
  6287. },
  6288. created: function created () {
  6289. this.cache = Object.create(null);
  6290. this.keys = [];
  6291. },
  6292. destroyed: function destroyed () {
  6293. for (var key in this.cache) {
  6294. pruneCacheEntry(this.cache, key, this.keys);
  6295. }
  6296. },
  6297. mounted: function mounted () {
  6298. var this$1 = this;
  6299. this.$watch('include', function (val) {
  6300. pruneCache(this$1, function (name) { return matches(val, name); });
  6301. });
  6302. this.$watch('exclude', function (val) {
  6303. pruneCache(this$1, function (name) { return !matches(val, name); });
  6304. });
  6305. },
  6306. render: function render () {
  6307. var slot = this.$slots.default;
  6308. var vnode = getFirstComponentChild(slot);
  6309. var componentOptions = vnode && vnode.componentOptions;
  6310. if (componentOptions) {
  6311. // check pattern
  6312. var name = getComponentName(componentOptions);
  6313. var ref = this;
  6314. var include = ref.include;
  6315. var exclude = ref.exclude;
  6316. if (
  6317. // not included
  6318. (include && (!name || !matches(include, name))) ||
  6319. // excluded
  6320. (exclude && name && matches(exclude, name))
  6321. ) {
  6322. return vnode
  6323. }
  6324. var ref$1 = this;
  6325. var cache = ref$1.cache;
  6326. var keys = ref$1.keys;
  6327. var key = vnode.key == null
  6328. // same constructor may get registered as different local components
  6329. // so cid alone is not enough (#3269)
  6330. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  6331. : vnode.key;
  6332. if (cache[key]) {
  6333. vnode.componentInstance = cache[key].componentInstance;
  6334. // make current key freshest
  6335. remove(keys, key);
  6336. keys.push(key);
  6337. } else {
  6338. cache[key] = vnode;
  6339. keys.push(key);
  6340. // prune oldest entry
  6341. if (this.max && keys.length > parseInt(this.max)) {
  6342. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  6343. }
  6344. }
  6345. vnode.data.keepAlive = true;
  6346. }
  6347. return vnode || (slot && slot[0])
  6348. }
  6349. };
  6350. var builtInComponents = {
  6351. KeepAlive: KeepAlive
  6352. };
  6353. /* */
  6354. function initGlobalAPI (Vue) {
  6355. // config
  6356. var configDef = {};
  6357. configDef.get = function () { return config; };
  6358. if (true) {
  6359. configDef.set = function () {
  6360. warn(
  6361. 'Do not replace the Vue.config object, set individual fields instead.'
  6362. );
  6363. };
  6364. }
  6365. Object.defineProperty(Vue, 'config', configDef);
  6366. // exposed util methods.
  6367. // NOTE: these are not considered part of the public API - avoid relying on
  6368. // them unless you are aware of the risk.
  6369. Vue.util = {
  6370. warn: warn,
  6371. extend: extend,
  6372. mergeOptions: mergeOptions,
  6373. defineReactive: defineReactive$$1
  6374. };
  6375. Vue.set = set;
  6376. Vue.delete = del;
  6377. Vue.nextTick = nextTick;
  6378. // 2.6 explicit observable API
  6379. Vue.observable = function (obj) {
  6380. observe(obj);
  6381. return obj
  6382. };
  6383. Vue.options = Object.create(null);
  6384. ASSET_TYPES.forEach(function (type) {
  6385. Vue.options[type + 's'] = Object.create(null);
  6386. });
  6387. // this is used to identify the "base" constructor to extend all plain-object
  6388. // components with in Weex's multi-instance scenarios.
  6389. Vue.options._base = Vue;
  6390. extend(Vue.options.components, builtInComponents);
  6391. initUse(Vue);
  6392. initMixin$1(Vue);
  6393. initExtend(Vue);
  6394. initAssetRegisters(Vue);
  6395. }
  6396. initGlobalAPI(Vue);
  6397. Object.defineProperty(Vue.prototype, '$isServer', {
  6398. get: isServerRendering
  6399. });
  6400. Object.defineProperty(Vue.prototype, '$ssrContext', {
  6401. get: function get () {
  6402. /* istanbul ignore next */
  6403. return this.$vnode && this.$vnode.ssrContext
  6404. }
  6405. });
  6406. // expose FunctionalRenderContext for ssr runtime helper installation
  6407. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  6408. value: FunctionalRenderContext
  6409. });
  6410. Vue.version = '2.6.11';
  6411. /**
  6412. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  6413. */
  6414. var ARRAYTYPE = '[object Array]';
  6415. var OBJECTTYPE = '[object Object]';
  6416. // const FUNCTIONTYPE = '[object Function]'
  6417. function diff(current, pre) {
  6418. var result = {};
  6419. syncKeys(current, pre);
  6420. _diff(current, pre, '', result);
  6421. return result
  6422. }
  6423. function syncKeys(current, pre) {
  6424. if (current === pre) { return }
  6425. var rootCurrentType = type(current);
  6426. var rootPreType = type(pre);
  6427. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  6428. if(Object.keys(current).length >= Object.keys(pre).length){
  6429. for (var key in pre) {
  6430. var currentValue = current[key];
  6431. if (currentValue === undefined) {
  6432. current[key] = null;
  6433. } else {
  6434. syncKeys(currentValue, pre[key]);
  6435. }
  6436. }
  6437. }
  6438. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  6439. if (current.length >= pre.length) {
  6440. pre.forEach(function (item, index) {
  6441. syncKeys(current[index], item);
  6442. });
  6443. }
  6444. }
  6445. }
  6446. function _diff(current, pre, path, result) {
  6447. if (current === pre) { return }
  6448. var rootCurrentType = type(current);
  6449. var rootPreType = type(pre);
  6450. if (rootCurrentType == OBJECTTYPE) {
  6451. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  6452. setResult(result, path, current);
  6453. } else {
  6454. var loop = function ( key ) {
  6455. var currentValue = current[key];
  6456. var preValue = pre[key];
  6457. var currentType = type(currentValue);
  6458. var preType = type(preValue);
  6459. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  6460. if (currentValue != pre[key]) {
  6461. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6462. }
  6463. } else if (currentType == ARRAYTYPE) {
  6464. if (preType != ARRAYTYPE) {
  6465. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6466. } else {
  6467. if (currentValue.length < preValue.length) {
  6468. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6469. } else {
  6470. currentValue.forEach(function (item, index) {
  6471. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  6472. });
  6473. }
  6474. }
  6475. } else if (currentType == OBJECTTYPE) {
  6476. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  6477. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6478. } else {
  6479. for (var subKey in currentValue) {
  6480. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  6481. }
  6482. }
  6483. }
  6484. };
  6485. for (var key in current) loop( key );
  6486. }
  6487. } else if (rootCurrentType == ARRAYTYPE) {
  6488. if (rootPreType != ARRAYTYPE) {
  6489. setResult(result, path, current);
  6490. } else {
  6491. if (current.length < pre.length) {
  6492. setResult(result, path, current);
  6493. } else {
  6494. current.forEach(function (item, index) {
  6495. _diff(item, pre[index], path + '[' + index + ']', result);
  6496. });
  6497. }
  6498. }
  6499. } else {
  6500. setResult(result, path, current);
  6501. }
  6502. }
  6503. function setResult(result, k, v) {
  6504. // if (type(v) != FUNCTIONTYPE) {
  6505. result[k] = v;
  6506. // }
  6507. }
  6508. function type(obj) {
  6509. return Object.prototype.toString.call(obj)
  6510. }
  6511. /* */
  6512. function flushCallbacks$1(vm) {
  6513. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  6514. if (Object({"VUE_APP_NAME":"sqxp-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6515. var mpInstance = vm.$scope;
  6516. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6517. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  6518. }
  6519. var copies = vm.__next_tick_callbacks.slice(0);
  6520. vm.__next_tick_callbacks.length = 0;
  6521. for (var i = 0; i < copies.length; i++) {
  6522. copies[i]();
  6523. }
  6524. }
  6525. }
  6526. function hasRenderWatcher(vm) {
  6527. return queue.find(function (watcher) { return vm._watcher === watcher; })
  6528. }
  6529. function nextTick$1(vm, cb) {
  6530. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  6531. //2.nextTick 之前存在 render watcher
  6532. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  6533. if(Object({"VUE_APP_NAME":"sqxp-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  6534. var mpInstance = vm.$scope;
  6535. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6536. ']:nextVueTick');
  6537. }
  6538. return nextTick(cb, vm)
  6539. }else{
  6540. if(Object({"VUE_APP_NAME":"sqxp-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  6541. var mpInstance$1 = vm.$scope;
  6542. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  6543. ']:nextMPTick');
  6544. }
  6545. }
  6546. var _resolve;
  6547. if (!vm.__next_tick_callbacks) {
  6548. vm.__next_tick_callbacks = [];
  6549. }
  6550. vm.__next_tick_callbacks.push(function () {
  6551. if (cb) {
  6552. try {
  6553. cb.call(vm);
  6554. } catch (e) {
  6555. handleError(e, vm, 'nextTick');
  6556. }
  6557. } else if (_resolve) {
  6558. _resolve(vm);
  6559. }
  6560. });
  6561. // $flow-disable-line
  6562. if (!cb && typeof Promise !== 'undefined') {
  6563. return new Promise(function (resolve) {
  6564. _resolve = resolve;
  6565. })
  6566. }
  6567. }
  6568. /* */
  6569. function cloneWithData(vm) {
  6570. // 确保当前 vm 所有数据被同步
  6571. var ret = Object.create(null);
  6572. var dataKeys = [].concat(
  6573. Object.keys(vm._data || {}),
  6574. Object.keys(vm._computedWatchers || {}));
  6575. dataKeys.reduce(function(ret, key) {
  6576. ret[key] = vm[key];
  6577. return ret
  6578. }, ret);
  6579. // vue-composition-api
  6580. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  6581. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  6582. if (rawBindings) {
  6583. Object.keys(rawBindings).forEach(function (key) {
  6584. ret[key] = vm[key];
  6585. });
  6586. }
  6587. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  6588. Object.assign(ret, vm.$mp.data || {});
  6589. if (
  6590. Array.isArray(vm.$options.behaviors) &&
  6591. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  6592. ) { //form-field
  6593. ret['name'] = vm.name;
  6594. ret['value'] = vm.value;
  6595. }
  6596. return JSON.parse(JSON.stringify(ret))
  6597. }
  6598. var patch = function(oldVnode, vnode) {
  6599. var this$1 = this;
  6600. if (vnode === null) { //destroy
  6601. return
  6602. }
  6603. if (this.mpType === 'page' || this.mpType === 'component') {
  6604. var mpInstance = this.$scope;
  6605. var data = Object.create(null);
  6606. try {
  6607. data = cloneWithData(this);
  6608. } catch (err) {
  6609. console.error(err);
  6610. }
  6611. data.__webviewId__ = mpInstance.data.__webviewId__;
  6612. var mpData = Object.create(null);
  6613. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  6614. mpData[key] = mpInstance.data[key];
  6615. });
  6616. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  6617. if (Object.keys(diffData).length) {
  6618. if (Object({"VUE_APP_NAME":"sqxp-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6619. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  6620. ']差量更新',
  6621. JSON.stringify(diffData));
  6622. }
  6623. this.__next_tick_pending = true;
  6624. mpInstance.setData(diffData, function () {
  6625. this$1.__next_tick_pending = false;
  6626. flushCallbacks$1(this$1);
  6627. });
  6628. } else {
  6629. flushCallbacks$1(this);
  6630. }
  6631. }
  6632. };
  6633. /* */
  6634. function createEmptyRender() {
  6635. }
  6636. function mountComponent$1(
  6637. vm,
  6638. el,
  6639. hydrating
  6640. ) {
  6641. if (!vm.mpType) {//main.js 中的 new Vue
  6642. return vm
  6643. }
  6644. if (vm.mpType === 'app') {
  6645. vm.$options.render = createEmptyRender;
  6646. }
  6647. if (!vm.$options.render) {
  6648. vm.$options.render = createEmptyRender;
  6649. if (true) {
  6650. /* istanbul ignore if */
  6651. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  6652. vm.$options.el || el) {
  6653. warn(
  6654. 'You are using the runtime-only build of Vue where the template ' +
  6655. 'compiler is not available. Either pre-compile the templates into ' +
  6656. 'render functions, or use the compiler-included build.',
  6657. vm
  6658. );
  6659. } else {
  6660. warn(
  6661. 'Failed to mount component: template or render function not defined.',
  6662. vm
  6663. );
  6664. }
  6665. }
  6666. }
  6667. !vm._$fallback && callHook(vm, 'beforeMount');
  6668. var updateComponent = function () {
  6669. vm._update(vm._render(), hydrating);
  6670. };
  6671. // we set this to vm._watcher inside the watcher's constructor
  6672. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  6673. // component's mounted hook), which relies on vm._watcher being already defined
  6674. new Watcher(vm, updateComponent, noop, {
  6675. before: function before() {
  6676. if (vm._isMounted && !vm._isDestroyed) {
  6677. callHook(vm, 'beforeUpdate');
  6678. }
  6679. }
  6680. }, true /* isRenderWatcher */);
  6681. hydrating = false;
  6682. return vm
  6683. }
  6684. /* */
  6685. function renderClass (
  6686. staticClass,
  6687. dynamicClass
  6688. ) {
  6689. if (isDef(staticClass) || isDef(dynamicClass)) {
  6690. return concat(staticClass, stringifyClass(dynamicClass))
  6691. }
  6692. /* istanbul ignore next */
  6693. return ''
  6694. }
  6695. function concat (a, b) {
  6696. return a ? b ? (a + ' ' + b) : a : (b || '')
  6697. }
  6698. function stringifyClass (value) {
  6699. if (Array.isArray(value)) {
  6700. return stringifyArray(value)
  6701. }
  6702. if (isObject(value)) {
  6703. return stringifyObject(value)
  6704. }
  6705. if (typeof value === 'string') {
  6706. return value
  6707. }
  6708. /* istanbul ignore next */
  6709. return ''
  6710. }
  6711. function stringifyArray (value) {
  6712. var res = '';
  6713. var stringified;
  6714. for (var i = 0, l = value.length; i < l; i++) {
  6715. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  6716. if (res) { res += ' '; }
  6717. res += stringified;
  6718. }
  6719. }
  6720. return res
  6721. }
  6722. function stringifyObject (value) {
  6723. var res = '';
  6724. for (var key in value) {
  6725. if (value[key]) {
  6726. if (res) { res += ' '; }
  6727. res += key;
  6728. }
  6729. }
  6730. return res
  6731. }
  6732. /* */
  6733. var parseStyleText = cached(function (cssText) {
  6734. var res = {};
  6735. var listDelimiter = /;(?![^(]*\))/g;
  6736. var propertyDelimiter = /:(.+)/;
  6737. cssText.split(listDelimiter).forEach(function (item) {
  6738. if (item) {
  6739. var tmp = item.split(propertyDelimiter);
  6740. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6741. }
  6742. });
  6743. return res
  6744. });
  6745. // normalize possible array / string values into Object
  6746. function normalizeStyleBinding (bindingStyle) {
  6747. if (Array.isArray(bindingStyle)) {
  6748. return toObject(bindingStyle)
  6749. }
  6750. if (typeof bindingStyle === 'string') {
  6751. return parseStyleText(bindingStyle)
  6752. }
  6753. return bindingStyle
  6754. }
  6755. /* */
  6756. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  6757. function getTarget(obj, path) {
  6758. var parts = path.split('.');
  6759. var key = parts[0];
  6760. if (key.indexOf('__$n') === 0) { //number index
  6761. key = parseInt(key.replace('__$n', ''));
  6762. }
  6763. if (parts.length === 1) {
  6764. return obj[key]
  6765. }
  6766. return getTarget(obj[key], parts.slice(1).join('.'))
  6767. }
  6768. function internalMixin(Vue) {
  6769. Vue.config.errorHandler = function(err, vm, info) {
  6770. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  6771. console.error(err);
  6772. /* eslint-disable no-undef */
  6773. var app = getApp();
  6774. if (app && app.onError) {
  6775. app.onError(err);
  6776. }
  6777. };
  6778. var oldEmit = Vue.prototype.$emit;
  6779. Vue.prototype.$emit = function(event) {
  6780. if (this.$scope && event) {
  6781. this.$scope['triggerEvent'](event, {
  6782. __args__: toArray(arguments, 1)
  6783. });
  6784. }
  6785. return oldEmit.apply(this, arguments)
  6786. };
  6787. Vue.prototype.$nextTick = function(fn) {
  6788. return nextTick$1(this, fn)
  6789. };
  6790. MP_METHODS.forEach(function (method) {
  6791. Vue.prototype[method] = function(args) {
  6792. if (this.$scope && this.$scope[method]) {
  6793. return this.$scope[method](args)
  6794. }
  6795. // mp-alipay
  6796. if (typeof my === 'undefined') {
  6797. return
  6798. }
  6799. if (method === 'createSelectorQuery') {
  6800. /* eslint-disable no-undef */
  6801. return my.createSelectorQuery(args)
  6802. } else if (method === 'createIntersectionObserver') {
  6803. /* eslint-disable no-undef */
  6804. return my.createIntersectionObserver(args)
  6805. }
  6806. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  6807. };
  6808. });
  6809. Vue.prototype.__init_provide = initProvide;
  6810. Vue.prototype.__init_injections = initInjections;
  6811. Vue.prototype.__call_hook = function(hook, args) {
  6812. var vm = this;
  6813. // #7573 disable dep collection when invoking lifecycle hooks
  6814. pushTarget();
  6815. var handlers = vm.$options[hook];
  6816. var info = hook + " hook";
  6817. var ret;
  6818. if (handlers) {
  6819. for (var i = 0, j = handlers.length; i < j; i++) {
  6820. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  6821. }
  6822. }
  6823. if (vm._hasHookEvent) {
  6824. vm.$emit('hook:' + hook, args);
  6825. }
  6826. popTarget();
  6827. return ret
  6828. };
  6829. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  6830. if (Array.isArray(modifiers)) {
  6831. if (modifiers.indexOf('trim') !== -1) {
  6832. value = value.trim();
  6833. }
  6834. if (modifiers.indexOf('number') !== -1) {
  6835. value = this._n(value);
  6836. }
  6837. }
  6838. if (!target) {
  6839. target = this;
  6840. }
  6841. target[key] = value;
  6842. };
  6843. Vue.prototype.__set_sync = function(target, key, value) {
  6844. if (!target) {
  6845. target = this;
  6846. }
  6847. target[key] = value;
  6848. };
  6849. Vue.prototype.__get_orig = function(item) {
  6850. if (isPlainObject(item)) {
  6851. return item['$orig'] || item
  6852. }
  6853. return item
  6854. };
  6855. Vue.prototype.__get_value = function(dataPath, target) {
  6856. return getTarget(target || this, dataPath)
  6857. };
  6858. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  6859. return renderClass(staticClass, dynamicClass)
  6860. };
  6861. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  6862. if (!dynamicStyle && !staticStyle) {
  6863. return ''
  6864. }
  6865. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  6866. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  6867. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  6868. };
  6869. Vue.prototype.__map = function(val, iteratee) {
  6870. //TODO 暂不考虑 string
  6871. var ret, i, l, keys, key;
  6872. if (Array.isArray(val)) {
  6873. ret = new Array(val.length);
  6874. for (i = 0, l = val.length; i < l; i++) {
  6875. ret[i] = iteratee(val[i], i);
  6876. }
  6877. return ret
  6878. } else if (isObject(val)) {
  6879. keys = Object.keys(val);
  6880. ret = Object.create(null);
  6881. for (i = 0, l = keys.length; i < l; i++) {
  6882. key = keys[i];
  6883. ret[key] = iteratee(val[key], key, i);
  6884. }
  6885. return ret
  6886. } else if (typeof val === 'number') {
  6887. ret = new Array(val);
  6888. for (i = 0, l = val; i < l; i++) {
  6889. // 第一个参数暂时仍和小程序一致
  6890. ret[i] = iteratee(i, i);
  6891. }
  6892. return ret
  6893. }
  6894. return []
  6895. };
  6896. }
  6897. /* */
  6898. var LIFECYCLE_HOOKS$1 = [
  6899. //App
  6900. 'onLaunch',
  6901. 'onShow',
  6902. 'onHide',
  6903. 'onUniNViewMessage',
  6904. 'onPageNotFound',
  6905. 'onThemeChange',
  6906. 'onError',
  6907. 'onUnhandledRejection',
  6908. //Page
  6909. 'onInit',
  6910. 'onLoad',
  6911. // 'onShow',
  6912. 'onReady',
  6913. // 'onHide',
  6914. 'onUnload',
  6915. 'onPullDownRefresh',
  6916. 'onReachBottom',
  6917. 'onTabItemTap',
  6918. 'onAddToFavorites',
  6919. 'onShareTimeline',
  6920. 'onShareAppMessage',
  6921. 'onResize',
  6922. 'onPageScroll',
  6923. 'onNavigationBarButtonTap',
  6924. 'onBackPress',
  6925. 'onNavigationBarSearchInputChanged',
  6926. 'onNavigationBarSearchInputConfirmed',
  6927. 'onNavigationBarSearchInputClicked',
  6928. //Component
  6929. // 'onReady', // 兼容旧版本,应该移除该事件
  6930. 'onPageShow',
  6931. 'onPageHide',
  6932. 'onPageResize'
  6933. ];
  6934. function lifecycleMixin$1(Vue) {
  6935. //fixed vue-class-component
  6936. var oldExtend = Vue.extend;
  6937. Vue.extend = function(extendOptions) {
  6938. extendOptions = extendOptions || {};
  6939. var methods = extendOptions.methods;
  6940. if (methods) {
  6941. Object.keys(methods).forEach(function (methodName) {
  6942. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  6943. extendOptions[methodName] = methods[methodName];
  6944. delete methods[methodName];
  6945. }
  6946. });
  6947. }
  6948. return oldExtend.call(this, extendOptions)
  6949. };
  6950. var strategies = Vue.config.optionMergeStrategies;
  6951. var mergeHook = strategies.created;
  6952. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  6953. strategies[hook] = mergeHook;
  6954. });
  6955. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  6956. }
  6957. /* */
  6958. // install platform patch function
  6959. Vue.prototype.__patch__ = patch;
  6960. // public mount method
  6961. Vue.prototype.$mount = function(
  6962. el ,
  6963. hydrating
  6964. ) {
  6965. return mountComponent$1(this, el, hydrating)
  6966. };
  6967. lifecycleMixin$1(Vue);
  6968. internalMixin(Vue);
  6969. /* */
  6970. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  6971. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  6972. /***/ }),
  6973. /* 3 */
  6974. /*!***********************************!*\
  6975. !*** (webpack)/buildin/global.js ***!
  6976. \***********************************/
  6977. /*! no static exports found */
  6978. /***/ (function(module, exports) {
  6979. var g;
  6980. // This works in non-strict mode
  6981. g = (function() {
  6982. return this;
  6983. })();
  6984. try {
  6985. // This works if eval is allowed (see CSP)
  6986. g = g || new Function("return this")();
  6987. } catch (e) {
  6988. // This works if the window reference is available
  6989. if (typeof window === "object") g = window;
  6990. }
  6991. // g can still be undefined, but nothing to do about it...
  6992. // We return undefined, instead of nothing here, so it's
  6993. // easier to handle this case. if(!global) { ...}
  6994. module.exports = g;
  6995. /***/ }),
  6996. /* 4 */
  6997. /*!****************************************!*\
  6998. !*** F:/uniapp/sqxp-uniapp/pages.json ***!
  6999. \****************************************/
  7000. /*! no static exports found */
  7001. /***/ (function(module, exports) {
  7002. /***/ }),
  7003. /* 5 */,
  7004. /* 6 */,
  7005. /* 7 */,
  7006. /* 8 */
  7007. /*!**********************************************************!*\
  7008. !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
  7009. \**********************************************************/
  7010. /*! no static exports found */
  7011. /***/ (function(module, exports, __webpack_require__) {
  7012. module.exports = __webpack_require__(/*! regenerator-runtime */ 9);
  7013. /***/ }),
  7014. /* 9 */
  7015. /*!************************************************************!*\
  7016. !*** ./node_modules/regenerator-runtime/runtime-module.js ***!
  7017. \************************************************************/
  7018. /*! no static exports found */
  7019. /***/ (function(module, exports, __webpack_require__) {
  7020. /**
  7021. * Copyright (c) 2014-present, Facebook, Inc.
  7022. *
  7023. * This source code is licensed under the MIT license found in the
  7024. * LICENSE file in the root directory of this source tree.
  7025. */
  7026. // This method of obtaining a reference to the global object needs to be
  7027. // kept identical to the way it is obtained in runtime.js
  7028. var g = (function() {
  7029. return this || (typeof self === "object" && self);
  7030. })() || Function("return this")();
  7031. // Use `getOwnPropertyNames` because not all browsers support calling
  7032. // `hasOwnProperty` on the global `self` object in a worker. See #183.
  7033. var hadRuntime = g.regeneratorRuntime &&
  7034. Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  7035. // Save the old regeneratorRuntime in case it needs to be restored later.
  7036. var oldRuntime = hadRuntime && g.regeneratorRuntime;
  7037. // Force reevalutation of runtime.js.
  7038. g.regeneratorRuntime = undefined;
  7039. module.exports = __webpack_require__(/*! ./runtime */ 10);
  7040. if (hadRuntime) {
  7041. // Restore the original runtime.
  7042. g.regeneratorRuntime = oldRuntime;
  7043. } else {
  7044. // Remove the global property added by runtime.js.
  7045. try {
  7046. delete g.regeneratorRuntime;
  7047. } catch(e) {
  7048. g.regeneratorRuntime = undefined;
  7049. }
  7050. }
  7051. /***/ }),
  7052. /* 10 */
  7053. /*!*****************************************************!*\
  7054. !*** ./node_modules/regenerator-runtime/runtime.js ***!
  7055. \*****************************************************/
  7056. /*! no static exports found */
  7057. /***/ (function(module, exports) {
  7058. /**
  7059. * Copyright (c) 2014-present, Facebook, Inc.
  7060. *
  7061. * This source code is licensed under the MIT license found in the
  7062. * LICENSE file in the root directory of this source tree.
  7063. */
  7064. !(function(global) {
  7065. "use strict";
  7066. var Op = Object.prototype;
  7067. var hasOwn = Op.hasOwnProperty;
  7068. var undefined; // More compressible than void 0.
  7069. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  7070. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  7071. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  7072. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  7073. var inModule = typeof module === "object";
  7074. var runtime = global.regeneratorRuntime;
  7075. if (runtime) {
  7076. if (inModule) {
  7077. // If regeneratorRuntime is defined globally and we're in a module,
  7078. // make the exports object identical to regeneratorRuntime.
  7079. module.exports = runtime;
  7080. }
  7081. // Don't bother evaluating the rest of this file if the runtime was
  7082. // already defined globally.
  7083. return;
  7084. }
  7085. // Define the runtime globally (as expected by generated code) as either
  7086. // module.exports (if we're in a module) or a new, empty object.
  7087. runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  7088. function wrap(innerFn, outerFn, self, tryLocsList) {
  7089. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  7090. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  7091. var generator = Object.create(protoGenerator.prototype);
  7092. var context = new Context(tryLocsList || []);
  7093. // The ._invoke method unifies the implementations of the .next,
  7094. // .throw, and .return methods.
  7095. generator._invoke = makeInvokeMethod(innerFn, self, context);
  7096. return generator;
  7097. }
  7098. runtime.wrap = wrap;
  7099. // Try/catch helper to minimize deoptimizations. Returns a completion
  7100. // record like context.tryEntries[i].completion. This interface could
  7101. // have been (and was previously) designed to take a closure to be
  7102. // invoked without arguments, but in all the cases we care about we
  7103. // already have an existing method we want to call, so there's no need
  7104. // to create a new function object. We can even get away with assuming
  7105. // the method takes exactly one argument, since that happens to be true
  7106. // in every case, so we don't have to touch the arguments object. The
  7107. // only additional allocation required is the completion record, which
  7108. // has a stable shape and so hopefully should be cheap to allocate.
  7109. function tryCatch(fn, obj, arg) {
  7110. try {
  7111. return { type: "normal", arg: fn.call(obj, arg) };
  7112. } catch (err) {
  7113. return { type: "throw", arg: err };
  7114. }
  7115. }
  7116. var GenStateSuspendedStart = "suspendedStart";
  7117. var GenStateSuspendedYield = "suspendedYield";
  7118. var GenStateExecuting = "executing";
  7119. var GenStateCompleted = "completed";
  7120. // Returning this object from the innerFn has the same effect as
  7121. // breaking out of the dispatch switch statement.
  7122. var ContinueSentinel = {};
  7123. // Dummy constructor functions that we use as the .constructor and
  7124. // .constructor.prototype properties for functions that return Generator
  7125. // objects. For full spec compliance, you may wish to configure your
  7126. // minifier not to mangle the names of these two functions.
  7127. function Generator() {}
  7128. function GeneratorFunction() {}
  7129. function GeneratorFunctionPrototype() {}
  7130. // This is a polyfill for %IteratorPrototype% for environments that
  7131. // don't natively support it.
  7132. var IteratorPrototype = {};
  7133. IteratorPrototype[iteratorSymbol] = function () {
  7134. return this;
  7135. };
  7136. var getProto = Object.getPrototypeOf;
  7137. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  7138. if (NativeIteratorPrototype &&
  7139. NativeIteratorPrototype !== Op &&
  7140. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  7141. // This environment has a native %IteratorPrototype%; use it instead
  7142. // of the polyfill.
  7143. IteratorPrototype = NativeIteratorPrototype;
  7144. }
  7145. var Gp = GeneratorFunctionPrototype.prototype =
  7146. Generator.prototype = Object.create(IteratorPrototype);
  7147. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  7148. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  7149. GeneratorFunctionPrototype[toStringTagSymbol] =
  7150. GeneratorFunction.displayName = "GeneratorFunction";
  7151. // Helper for defining the .next, .throw, and .return methods of the
  7152. // Iterator interface in terms of a single ._invoke method.
  7153. function defineIteratorMethods(prototype) {
  7154. ["next", "throw", "return"].forEach(function(method) {
  7155. prototype[method] = function(arg) {
  7156. return this._invoke(method, arg);
  7157. };
  7158. });
  7159. }
  7160. runtime.isGeneratorFunction = function(genFun) {
  7161. var ctor = typeof genFun === "function" && genFun.constructor;
  7162. return ctor
  7163. ? ctor === GeneratorFunction ||
  7164. // For the native GeneratorFunction constructor, the best we can
  7165. // do is to check its .name property.
  7166. (ctor.displayName || ctor.name) === "GeneratorFunction"
  7167. : false;
  7168. };
  7169. runtime.mark = function(genFun) {
  7170. if (Object.setPrototypeOf) {
  7171. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  7172. } else {
  7173. genFun.__proto__ = GeneratorFunctionPrototype;
  7174. if (!(toStringTagSymbol in genFun)) {
  7175. genFun[toStringTagSymbol] = "GeneratorFunction";
  7176. }
  7177. }
  7178. genFun.prototype = Object.create(Gp);
  7179. return genFun;
  7180. };
  7181. // Within the body of any async function, `await x` is transformed to
  7182. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  7183. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  7184. // meant to be awaited.
  7185. runtime.awrap = function(arg) {
  7186. return { __await: arg };
  7187. };
  7188. function AsyncIterator(generator) {
  7189. function invoke(method, arg, resolve, reject) {
  7190. var record = tryCatch(generator[method], generator, arg);
  7191. if (record.type === "throw") {
  7192. reject(record.arg);
  7193. } else {
  7194. var result = record.arg;
  7195. var value = result.value;
  7196. if (value &&
  7197. typeof value === "object" &&
  7198. hasOwn.call(value, "__await")) {
  7199. return Promise.resolve(value.__await).then(function(value) {
  7200. invoke("next", value, resolve, reject);
  7201. }, function(err) {
  7202. invoke("throw", err, resolve, reject);
  7203. });
  7204. }
  7205. return Promise.resolve(value).then(function(unwrapped) {
  7206. // When a yielded Promise is resolved, its final value becomes
  7207. // the .value of the Promise<{value,done}> result for the
  7208. // current iteration.
  7209. result.value = unwrapped;
  7210. resolve(result);
  7211. }, function(error) {
  7212. // If a rejected Promise was yielded, throw the rejection back
  7213. // into the async generator function so it can be handled there.
  7214. return invoke("throw", error, resolve, reject);
  7215. });
  7216. }
  7217. }
  7218. var previousPromise;
  7219. function enqueue(method, arg) {
  7220. function callInvokeWithMethodAndArg() {
  7221. return new Promise(function(resolve, reject) {
  7222. invoke(method, arg, resolve, reject);
  7223. });
  7224. }
  7225. return previousPromise =
  7226. // If enqueue has been called before, then we want to wait until
  7227. // all previous Promises have been resolved before calling invoke,
  7228. // so that results are always delivered in the correct order. If
  7229. // enqueue has not been called before, then it is important to
  7230. // call invoke immediately, without waiting on a callback to fire,
  7231. // so that the async generator function has the opportunity to do
  7232. // any necessary setup in a predictable way. This predictability
  7233. // is why the Promise constructor synchronously invokes its
  7234. // executor callback, and why async functions synchronously
  7235. // execute code before the first await. Since we implement simple
  7236. // async functions in terms of async generators, it is especially
  7237. // important to get this right, even though it requires care.
  7238. previousPromise ? previousPromise.then(
  7239. callInvokeWithMethodAndArg,
  7240. // Avoid propagating failures to Promises returned by later
  7241. // invocations of the iterator.
  7242. callInvokeWithMethodAndArg
  7243. ) : callInvokeWithMethodAndArg();
  7244. }
  7245. // Define the unified helper method that is used to implement .next,
  7246. // .throw, and .return (see defineIteratorMethods).
  7247. this._invoke = enqueue;
  7248. }
  7249. defineIteratorMethods(AsyncIterator.prototype);
  7250. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  7251. return this;
  7252. };
  7253. runtime.AsyncIterator = AsyncIterator;
  7254. // Note that simple async functions are implemented on top of
  7255. // AsyncIterator objects; they just return a Promise for the value of
  7256. // the final result produced by the iterator.
  7257. runtime.async = function(innerFn, outerFn, self, tryLocsList) {
  7258. var iter = new AsyncIterator(
  7259. wrap(innerFn, outerFn, self, tryLocsList)
  7260. );
  7261. return runtime.isGeneratorFunction(outerFn)
  7262. ? iter // If outerFn is a generator, return the full iterator.
  7263. : iter.next().then(function(result) {
  7264. return result.done ? result.value : iter.next();
  7265. });
  7266. };
  7267. function makeInvokeMethod(innerFn, self, context) {
  7268. var state = GenStateSuspendedStart;
  7269. return function invoke(method, arg) {
  7270. if (state === GenStateExecuting) {
  7271. throw new Error("Generator is already running");
  7272. }
  7273. if (state === GenStateCompleted) {
  7274. if (method === "throw") {
  7275. throw arg;
  7276. }
  7277. // Be forgiving, per 25.3.3.3.3 of the spec:
  7278. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  7279. return doneResult();
  7280. }
  7281. context.method = method;
  7282. context.arg = arg;
  7283. while (true) {
  7284. var delegate = context.delegate;
  7285. if (delegate) {
  7286. var delegateResult = maybeInvokeDelegate(delegate, context);
  7287. if (delegateResult) {
  7288. if (delegateResult === ContinueSentinel) continue;
  7289. return delegateResult;
  7290. }
  7291. }
  7292. if (context.method === "next") {
  7293. // Setting context._sent for legacy support of Babel's
  7294. // function.sent implementation.
  7295. context.sent = context._sent = context.arg;
  7296. } else if (context.method === "throw") {
  7297. if (state === GenStateSuspendedStart) {
  7298. state = GenStateCompleted;
  7299. throw context.arg;
  7300. }
  7301. context.dispatchException(context.arg);
  7302. } else if (context.method === "return") {
  7303. context.abrupt("return", context.arg);
  7304. }
  7305. state = GenStateExecuting;
  7306. var record = tryCatch(innerFn, self, context);
  7307. if (record.type === "normal") {
  7308. // If an exception is thrown from innerFn, we leave state ===
  7309. // GenStateExecuting and loop back for another invocation.
  7310. state = context.done
  7311. ? GenStateCompleted
  7312. : GenStateSuspendedYield;
  7313. if (record.arg === ContinueSentinel) {
  7314. continue;
  7315. }
  7316. return {
  7317. value: record.arg,
  7318. done: context.done
  7319. };
  7320. } else if (record.type === "throw") {
  7321. state = GenStateCompleted;
  7322. // Dispatch the exception by looping back around to the
  7323. // context.dispatchException(context.arg) call above.
  7324. context.method = "throw";
  7325. context.arg = record.arg;
  7326. }
  7327. }
  7328. };
  7329. }
  7330. // Call delegate.iterator[context.method](context.arg) and handle the
  7331. // result, either by returning a { value, done } result from the
  7332. // delegate iterator, or by modifying context.method and context.arg,
  7333. // setting context.delegate to null, and returning the ContinueSentinel.
  7334. function maybeInvokeDelegate(delegate, context) {
  7335. var method = delegate.iterator[context.method];
  7336. if (method === undefined) {
  7337. // A .throw or .return when the delegate iterator has no .throw
  7338. // method always terminates the yield* loop.
  7339. context.delegate = null;
  7340. if (context.method === "throw") {
  7341. if (delegate.iterator.return) {
  7342. // If the delegate iterator has a return method, give it a
  7343. // chance to clean up.
  7344. context.method = "return";
  7345. context.arg = undefined;
  7346. maybeInvokeDelegate(delegate, context);
  7347. if (context.method === "throw") {
  7348. // If maybeInvokeDelegate(context) changed context.method from
  7349. // "return" to "throw", let that override the TypeError below.
  7350. return ContinueSentinel;
  7351. }
  7352. }
  7353. context.method = "throw";
  7354. context.arg = new TypeError(
  7355. "The iterator does not provide a 'throw' method");
  7356. }
  7357. return ContinueSentinel;
  7358. }
  7359. var record = tryCatch(method, delegate.iterator, context.arg);
  7360. if (record.type === "throw") {
  7361. context.method = "throw";
  7362. context.arg = record.arg;
  7363. context.delegate = null;
  7364. return ContinueSentinel;
  7365. }
  7366. var info = record.arg;
  7367. if (! info) {
  7368. context.method = "throw";
  7369. context.arg = new TypeError("iterator result is not an object");
  7370. context.delegate = null;
  7371. return ContinueSentinel;
  7372. }
  7373. if (info.done) {
  7374. // Assign the result of the finished delegate to the temporary
  7375. // variable specified by delegate.resultName (see delegateYield).
  7376. context[delegate.resultName] = info.value;
  7377. // Resume execution at the desired location (see delegateYield).
  7378. context.next = delegate.nextLoc;
  7379. // If context.method was "throw" but the delegate handled the
  7380. // exception, let the outer generator proceed normally. If
  7381. // context.method was "next", forget context.arg since it has been
  7382. // "consumed" by the delegate iterator. If context.method was
  7383. // "return", allow the original .return call to continue in the
  7384. // outer generator.
  7385. if (context.method !== "return") {
  7386. context.method = "next";
  7387. context.arg = undefined;
  7388. }
  7389. } else {
  7390. // Re-yield the result returned by the delegate method.
  7391. return info;
  7392. }
  7393. // The delegate iterator is finished, so forget it and continue with
  7394. // the outer generator.
  7395. context.delegate = null;
  7396. return ContinueSentinel;
  7397. }
  7398. // Define Generator.prototype.{next,throw,return} in terms of the
  7399. // unified ._invoke helper method.
  7400. defineIteratorMethods(Gp);
  7401. Gp[toStringTagSymbol] = "Generator";
  7402. // A Generator should always return itself as the iterator object when the
  7403. // @@iterator function is called on it. Some browsers' implementations of the
  7404. // iterator prototype chain incorrectly implement this, causing the Generator
  7405. // object to not be returned from this call. This ensures that doesn't happen.
  7406. // See https://github.com/facebook/regenerator/issues/274 for more details.
  7407. Gp[iteratorSymbol] = function() {
  7408. return this;
  7409. };
  7410. Gp.toString = function() {
  7411. return "[object Generator]";
  7412. };
  7413. function pushTryEntry(locs) {
  7414. var entry = { tryLoc: locs[0] };
  7415. if (1 in locs) {
  7416. entry.catchLoc = locs[1];
  7417. }
  7418. if (2 in locs) {
  7419. entry.finallyLoc = locs[2];
  7420. entry.afterLoc = locs[3];
  7421. }
  7422. this.tryEntries.push(entry);
  7423. }
  7424. function resetTryEntry(entry) {
  7425. var record = entry.completion || {};
  7426. record.type = "normal";
  7427. delete record.arg;
  7428. entry.completion = record;
  7429. }
  7430. function Context(tryLocsList) {
  7431. // The root entry object (effectively a try statement without a catch
  7432. // or a finally block) gives us a place to store values thrown from
  7433. // locations where there is no enclosing try statement.
  7434. this.tryEntries = [{ tryLoc: "root" }];
  7435. tryLocsList.forEach(pushTryEntry, this);
  7436. this.reset(true);
  7437. }
  7438. runtime.keys = function(object) {
  7439. var keys = [];
  7440. for (var key in object) {
  7441. keys.push(key);
  7442. }
  7443. keys.reverse();
  7444. // Rather than returning an object with a next method, we keep
  7445. // things simple and return the next function itself.
  7446. return function next() {
  7447. while (keys.length) {
  7448. var key = keys.pop();
  7449. if (key in object) {
  7450. next.value = key;
  7451. next.done = false;
  7452. return next;
  7453. }
  7454. }
  7455. // To avoid creating an additional object, we just hang the .value
  7456. // and .done properties off the next function object itself. This
  7457. // also ensures that the minifier will not anonymize the function.
  7458. next.done = true;
  7459. return next;
  7460. };
  7461. };
  7462. function values(iterable) {
  7463. if (iterable) {
  7464. var iteratorMethod = iterable[iteratorSymbol];
  7465. if (iteratorMethod) {
  7466. return iteratorMethod.call(iterable);
  7467. }
  7468. if (typeof iterable.next === "function") {
  7469. return iterable;
  7470. }
  7471. if (!isNaN(iterable.length)) {
  7472. var i = -1, next = function next() {
  7473. while (++i < iterable.length) {
  7474. if (hasOwn.call(iterable, i)) {
  7475. next.value = iterable[i];
  7476. next.done = false;
  7477. return next;
  7478. }
  7479. }
  7480. next.value = undefined;
  7481. next.done = true;
  7482. return next;
  7483. };
  7484. return next.next = next;
  7485. }
  7486. }
  7487. // Return an iterator with no values.
  7488. return { next: doneResult };
  7489. }
  7490. runtime.values = values;
  7491. function doneResult() {
  7492. return { value: undefined, done: true };
  7493. }
  7494. Context.prototype = {
  7495. constructor: Context,
  7496. reset: function(skipTempReset) {
  7497. this.prev = 0;
  7498. this.next = 0;
  7499. // Resetting context._sent for legacy support of Babel's
  7500. // function.sent implementation.
  7501. this.sent = this._sent = undefined;
  7502. this.done = false;
  7503. this.delegate = null;
  7504. this.method = "next";
  7505. this.arg = undefined;
  7506. this.tryEntries.forEach(resetTryEntry);
  7507. if (!skipTempReset) {
  7508. for (var name in this) {
  7509. // Not sure about the optimal order of these conditions:
  7510. if (name.charAt(0) === "t" &&
  7511. hasOwn.call(this, name) &&
  7512. !isNaN(+name.slice(1))) {
  7513. this[name] = undefined;
  7514. }
  7515. }
  7516. }
  7517. },
  7518. stop: function() {
  7519. this.done = true;
  7520. var rootEntry = this.tryEntries[0];
  7521. var rootRecord = rootEntry.completion;
  7522. if (rootRecord.type === "throw") {
  7523. throw rootRecord.arg;
  7524. }
  7525. return this.rval;
  7526. },
  7527. dispatchException: function(exception) {
  7528. if (this.done) {
  7529. throw exception;
  7530. }
  7531. var context = this;
  7532. function handle(loc, caught) {
  7533. record.type = "throw";
  7534. record.arg = exception;
  7535. context.next = loc;
  7536. if (caught) {
  7537. // If the dispatched exception was caught by a catch block,
  7538. // then let that catch block handle the exception normally.
  7539. context.method = "next";
  7540. context.arg = undefined;
  7541. }
  7542. return !! caught;
  7543. }
  7544. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7545. var entry = this.tryEntries[i];
  7546. var record = entry.completion;
  7547. if (entry.tryLoc === "root") {
  7548. // Exception thrown outside of any try block that could handle
  7549. // it, so set the completion value of the entire function to
  7550. // throw the exception.
  7551. return handle("end");
  7552. }
  7553. if (entry.tryLoc <= this.prev) {
  7554. var hasCatch = hasOwn.call(entry, "catchLoc");
  7555. var hasFinally = hasOwn.call(entry, "finallyLoc");
  7556. if (hasCatch && hasFinally) {
  7557. if (this.prev < entry.catchLoc) {
  7558. return handle(entry.catchLoc, true);
  7559. } else if (this.prev < entry.finallyLoc) {
  7560. return handle(entry.finallyLoc);
  7561. }
  7562. } else if (hasCatch) {
  7563. if (this.prev < entry.catchLoc) {
  7564. return handle(entry.catchLoc, true);
  7565. }
  7566. } else if (hasFinally) {
  7567. if (this.prev < entry.finallyLoc) {
  7568. return handle(entry.finallyLoc);
  7569. }
  7570. } else {
  7571. throw new Error("try statement without catch or finally");
  7572. }
  7573. }
  7574. }
  7575. },
  7576. abrupt: function(type, arg) {
  7577. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7578. var entry = this.tryEntries[i];
  7579. if (entry.tryLoc <= this.prev &&
  7580. hasOwn.call(entry, "finallyLoc") &&
  7581. this.prev < entry.finallyLoc) {
  7582. var finallyEntry = entry;
  7583. break;
  7584. }
  7585. }
  7586. if (finallyEntry &&
  7587. (type === "break" ||
  7588. type === "continue") &&
  7589. finallyEntry.tryLoc <= arg &&
  7590. arg <= finallyEntry.finallyLoc) {
  7591. // Ignore the finally entry if control is not jumping to a
  7592. // location outside the try/catch block.
  7593. finallyEntry = null;
  7594. }
  7595. var record = finallyEntry ? finallyEntry.completion : {};
  7596. record.type = type;
  7597. record.arg = arg;
  7598. if (finallyEntry) {
  7599. this.method = "next";
  7600. this.next = finallyEntry.finallyLoc;
  7601. return ContinueSentinel;
  7602. }
  7603. return this.complete(record);
  7604. },
  7605. complete: function(record, afterLoc) {
  7606. if (record.type === "throw") {
  7607. throw record.arg;
  7608. }
  7609. if (record.type === "break" ||
  7610. record.type === "continue") {
  7611. this.next = record.arg;
  7612. } else if (record.type === "return") {
  7613. this.rval = this.arg = record.arg;
  7614. this.method = "return";
  7615. this.next = "end";
  7616. } else if (record.type === "normal" && afterLoc) {
  7617. this.next = afterLoc;
  7618. }
  7619. return ContinueSentinel;
  7620. },
  7621. finish: function(finallyLoc) {
  7622. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7623. var entry = this.tryEntries[i];
  7624. if (entry.finallyLoc === finallyLoc) {
  7625. this.complete(entry.completion, entry.afterLoc);
  7626. resetTryEntry(entry);
  7627. return ContinueSentinel;
  7628. }
  7629. }
  7630. },
  7631. "catch": function(tryLoc) {
  7632. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7633. var entry = this.tryEntries[i];
  7634. if (entry.tryLoc === tryLoc) {
  7635. var record = entry.completion;
  7636. if (record.type === "throw") {
  7637. var thrown = record.arg;
  7638. resetTryEntry(entry);
  7639. }
  7640. return thrown;
  7641. }
  7642. }
  7643. // The context.catch method must only be called with a location
  7644. // argument that corresponds to a known catch block.
  7645. throw new Error("illegal catch attempt");
  7646. },
  7647. delegateYield: function(iterable, resultName, nextLoc) {
  7648. this.delegate = {
  7649. iterator: values(iterable),
  7650. resultName: resultName,
  7651. nextLoc: nextLoc
  7652. };
  7653. if (this.method === "next") {
  7654. // Deliberately forget the last sent value so that we don't
  7655. // accidentally pass it on to the delegate.
  7656. this.arg = undefined;
  7657. }
  7658. return ContinueSentinel;
  7659. }
  7660. };
  7661. })(
  7662. // In sloppy mode, unbound `this` refers to the global object, fallback to
  7663. // Function constructor if we're in global strict mode. That is sadly a form
  7664. // of indirect eval which violates Content Security Policy.
  7665. (function() {
  7666. return this || (typeof self === "object" && self);
  7667. })() || Function("return this")()
  7668. );
  7669. /***/ }),
  7670. /* 11 */
  7671. /*!*******************************************!*\
  7672. !*** F:/uniapp/sqxp-uniapp/utils/auth.js ***!
  7673. \*******************************************/
  7674. /*! no static exports found */
  7675. /***/ (function(module, exports, __webpack_require__) {
  7676. "use strict";
  7677. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.getToken = getToken;exports.setToken = setToken;exports.refreshToken = refreshToken;exports.removeToken = removeToken;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 8));
  7678. var _login = __webpack_require__(/*! @/api/login.js */ 12);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}
  7679. var TokenKey = 'Admin-Token';
  7680. //获取token
  7681. function getToken() {return _getToken.apply(this, arguments);}
  7682. //设置token
  7683. function _getToken() {_getToken = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee() {var tokenObj, res;return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:tokenObj = uni.getStorageSync(TokenKey);if (!(new Date().getTime() - tokenObj.date < 1000 * 60 * 28)) {_context.next = 5;break;}return _context.abrupt("return", tokenObj.token);case 5:_context.next = 7;return (0, _login.login)();case 7:res = _context.sent;setToken(res.data.token);return _context.abrupt("return", res.data.token);case 10:case "end":return _context.stop();}}}, _callee);}));return _getToken.apply(this, arguments);}function setToken(token) {
  7684. var tokenObj = {
  7685. token: token,
  7686. date: new Date().getTime() };
  7687. return uni.setStorageSync(TokenKey, tokenObj);
  7688. }
  7689. //刷新token时间
  7690. function refreshToken(token) {
  7691. var tokenObj = uni.getStorageSync(TokenKey);
  7692. if (!tokenObj) return;
  7693. tokenObj.date = new Date().getTime();
  7694. return uni.setStorageSync(TokenKey, tokenObj);
  7695. }
  7696. //移除token
  7697. function removeToken() {
  7698. return uni.removeStorageSync(TokenKey);
  7699. }
  7700. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7701. /***/ }),
  7702. /* 12 */
  7703. /*!******************************************!*\
  7704. !*** F:/uniapp/sqxp-uniapp/api/login.js ***!
  7705. \******************************************/
  7706. /*! no static exports found */
  7707. /***/ (function(module, exports, __webpack_require__) {
  7708. "use strict";
  7709. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.login = login;exports.getInfo = getInfo;exports.logout = logout;exports.bindUserCard = bindUserCard;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 8));var _request = _interopRequireDefault(__webpack_require__(/*! @/utils/request */ 13));
  7710. var _baseurl = __webpack_require__(/*! @/api/baseurl */ 15);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}
  7711. //微信小程序登录code
  7712. function unilogin() {
  7713. return new Promise(function (reslove, err) {
  7714. uni.login({
  7715. provider: 'weixin',
  7716. success: function success(res) {
  7717. reslove(res);
  7718. } });
  7719. });
  7720. }
  7721. //微信小程序获取用户信息
  7722. function unigetUserInfo() {
  7723. return new Promise(function (reslove, err) {
  7724. uni.getSetting({
  7725. success: function success(res) {
  7726. if (res.authSetting['scope.userInfo']) {
  7727. // 已经授权,可以直接调用 getUserInfo 获取头像昵称
  7728. uni.getUserInfo({
  7729. provider: 'weixin',
  7730. success: function success(res) {
  7731. reslove(res);
  7732. } });
  7733. } else {
  7734. //未授权
  7735. reslove({
  7736. code: 400,
  7737. msg: '用户未授权' });
  7738. }
  7739. } });
  7740. });
  7741. }
  7742. // 登录方法
  7743. function login() {return _login.apply(this, arguments);}
  7744. // 获取用户详细信息
  7745. function _login() {_login = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee() {var res;return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:_context.next = 2;return unilogin();case 2:res = _context.sent;return _context.abrupt("return", (0, _request.default)({ url: _baseurl.baseUrl + '/login/jscode', method: 'post', params: { jscode: res.code }, header: { isLogin: true } }));case 4:case "end":return _context.stop();}}}, _callee);}));return _login.apply(this, arguments);}function getInfo() {return _getInfo.apply(this, arguments);}
  7746. // 退出方法
  7747. function _getInfo() {_getInfo = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee2() {var res, userInfo;return _regenerator.default.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:_context2.next = 2;return unigetUserInfo();case 2:res = _context2.sent;if (!(res.code !== 400)) {_context2.next = 15;break;}_context2.next = 6;return (0, _request.default)({ url: _baseurl.baseUrl + '/getInfo', method: 'get' });case 6:userInfo = _context2.sent;if (!(userInfo.data.student.nickName != res.userInfo.nickName || userInfo.data.student.headImage != res.userInfo.avatarUrl)) {_context2.next = 12;break;}userInfo.data.student.nickName = res.userInfo.nickName;userInfo.data.student.headImage = res.userInfo.avatarUrl;_context2.next = 12;return (0, _request.default)({ url: _baseurl.baseUrl + '/student/user/info', method: 'post', data: { nickName: res.userInfo.nickName, headImage: res.userInfo.avatarUrl } });case 12:return _context2.abrupt("return", userInfo);case 15: //用户拒绝授权
  7748. console.log(wxuserinfo);case 16:return _context2.abrupt("return", (0, _request.default)({ url: _baseurl.baseUrl + '/getInfo', method: 'get' }));case 17:case "end":return _context2.stop();}}}, _callee2);}));return _getInfo.apply(this, arguments);}function logout() {return (0, _request.default)({
  7749. url: '/logout',
  7750. method: 'post' });
  7751. }
  7752. // 绑定用户身份证信息
  7753. function bindUserCard(data) {
  7754. return (0, _request.default)({
  7755. url: _baseurl.baseUrl + '/gzpt/userInfo/bind',
  7756. method: 'put',
  7757. data: data });
  7758. }
  7759. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7760. /***/ }),
  7761. /* 13 */
  7762. /*!**********************************************!*\
  7763. !*** F:/uniapp/sqxp-uniapp/utils/request.js ***!
  7764. \**********************************************/
  7765. /*! no static exports found */
  7766. /***/ (function(module, exports, __webpack_require__) {
  7767. "use strict";
  7768. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 8));var _auth = __webpack_require__(/*! @/utils/auth */ 11);
  7769. var _login = __webpack_require__(/*! @/api/login.js */ 12);
  7770. var _errorCode = _interopRequireDefault(__webpack_require__(/*! @/utils/errorCode */ 14));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}
  7771. /**
  7772. * http请求封装
  7773. */
  7774. var myAxios = function myAxios(req) {
  7775. var query = '';
  7776. req.params && Object.keys(req.params).map(function (key, index) {
  7777. if (index) {
  7778. query += '&' + key + '=' + encodeURIComponent(req.params[key]);
  7779. } else {
  7780. query += '?' + key + '=' + encodeURIComponent(req.params[key]);
  7781. }
  7782. });
  7783. var reqData = {
  7784. url: req.baseURL ? req.baseURL : '' + req.url + query,
  7785. method: req.method,
  7786. data: _objectSpread({},
  7787. req.data),
  7788. header: _objectSpread({},
  7789. req.header),
  7790. timeout: req.timeout || 10000 };
  7791. // 请求拦截器
  7792. function reqMiddleware(_x) {return _reqMiddleware.apply(this, arguments);}
  7793. // 响应拦截器
  7794. function _reqMiddleware() {_reqMiddleware = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee3(config) {var token;return _regenerator.default.wrap(function _callee3$(_context3) {while (1) {switch (_context3.prev = _context3.next) {case 0:if (!config.header.isLogin) {_context3.next = 2;break;}return _context3.abrupt("return", config);case 2:_context3.next = 4;return (0, _auth.getToken)();case 4:token = _context3.sent;config.header['Authorization'] = 'Bearer ' + token; // 让每个请求携带自定义token 请根据实际情况自行修改
  7795. return _context3.abrupt("return", config);case 7:case "end":return _context3.stop();}}}, _callee3);}));return _reqMiddleware.apply(this, arguments);}function resMiddleware(_x2) {return _resMiddleware.apply(this, arguments);}
  7796. // 2. 函数内部返回Promise 对象
  7797. function _resMiddleware() {_resMiddleware = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee4(res) {var code, msg;return _regenerator.default.wrap(function _callee4$(_context4) {while (1) {switch (_context4.prev = _context4.next) {case 0:code = res.data.code || 200; // 获取错误信息
  7798. msg = _errorCode.default[code] || res.data.msg || _errorCode.default['default']; //重置Authorization时间
  7799. if (code !== 401) (0, _auth.refreshToken)();if (code === 401) {console.log('拦截器信息:' + msg);} else if (code === 500) {console.log('拦截器信息:' + msg);} else if (code === 502) {console.log('拦截器信息:' + msg);} else if (code !== 200) {console.log('拦截器信息:' + msg);}return _context4.abrupt("return", res.data);case 5:case "end":return _context4.stop();}}}, _callee4);}));return _resMiddleware.apply(this, arguments);}return new Promise( /*#__PURE__*/function () {var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee2(resolve, reject) {return _regenerator.default.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:_context2.next = 2;return reqMiddleware(reqData);case 2:reqData = _context2.sent; // 3.wx.request() 小程序发送请求
  7800. wx.request(_objectSpread(_objectSpread({},
  7801. reqData), {}, {
  7802. // 请求成功之后调用的函数
  7803. success: function () {var _success = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee(result) {return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:_context.next = 2;return (
  7804. resMiddleware(result));case 2:result = _context.sent;
  7805. resolve(result);case 4:case "end":return _context.stop();}}}, _callee);}));function success(_x5) {return _success.apply(this, arguments);}return success;}(),
  7806. // 请求失败之后调用的函数
  7807. fail: function fail(error) {
  7808. reject(error);
  7809. },
  7810. complete: function complete() {
  7811. } }));case 4:case "end":return _context2.stop();}}}, _callee2);}));return function (_x3, _x4) {return _ref.apply(this, arguments);};}());
  7812. };var _default =
  7813. myAxios;exports.default = _default;
  7814. /***/ }),
  7815. /* 14 */
  7816. /*!************************************************!*\
  7817. !*** F:/uniapp/sqxp-uniapp/utils/errorCode.js ***!
  7818. \************************************************/
  7819. /*! no static exports found */
  7820. /***/ (function(module, exports, __webpack_require__) {
  7821. "use strict";
  7822. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _default = {
  7823. '401': '认证失败,无法访问系统资源',
  7824. '403': '当前操作没有权限',
  7825. '404': '访问资源不存在',
  7826. '500': '系统内部错误',
  7827. 'default': '系统未知错误,请反馈给管理员' };exports.default = _default;
  7828. /***/ }),
  7829. /* 15 */
  7830. /*!********************************************!*\
  7831. !*** F:/uniapp/sqxp-uniapp/api/baseurl.js ***!
  7832. \********************************************/
  7833. /*! no static exports found */
  7834. /***/ (function(module, exports, __webpack_require__) {
  7835. "use strict";
  7836. Object.defineProperty(exports, "__esModule", { value: true });exports.baseUrl = void 0;
  7837. var baseUrl = 'http://192.168.8.213:8080/zzjs-admin';
  7838. // export const baseUrl = 'https://zzjs.zzxcx.net/prod-api';
  7839. exports.baseUrl = baseUrl;
  7840. /***/ }),
  7841. /* 16 */,
  7842. /* 17 */,
  7843. /* 18 */
  7844. /*!**********************************************************************************************************!*\
  7845. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  7846. \**********************************************************************************************************/
  7847. /*! exports provided: default */
  7848. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7849. "use strict";
  7850. __webpack_require__.r(__webpack_exports__);
  7851. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  7852. /* globals __VUE_SSR_CONTEXT__ */
  7853. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  7854. // This module is a runtime utility for cleaner component module output and will
  7855. // be included in the final webpack user bundle.
  7856. function normalizeComponent (
  7857. scriptExports,
  7858. render,
  7859. staticRenderFns,
  7860. functionalTemplate,
  7861. injectStyles,
  7862. scopeId,
  7863. moduleIdentifier, /* server only */
  7864. shadowMode, /* vue-cli only */
  7865. components, // fixed by xxxxxx auto components
  7866. renderjs // fixed by xxxxxx renderjs
  7867. ) {
  7868. // Vue.extend constructor export interop
  7869. var options = typeof scriptExports === 'function'
  7870. ? scriptExports.options
  7871. : scriptExports
  7872. // fixed by xxxxxx auto components
  7873. if (components) {
  7874. if (!options.components) {
  7875. options.components = {}
  7876. }
  7877. var hasOwn = Object.prototype.hasOwnProperty
  7878. for (var name in components) {
  7879. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  7880. options.components[name] = components[name]
  7881. }
  7882. }
  7883. }
  7884. // fixed by xxxxxx renderjs
  7885. if (renderjs) {
  7886. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  7887. this[renderjs.__module] = this
  7888. });
  7889. (options.mixins || (options.mixins = [])).push(renderjs)
  7890. }
  7891. // render functions
  7892. if (render) {
  7893. options.render = render
  7894. options.staticRenderFns = staticRenderFns
  7895. options._compiled = true
  7896. }
  7897. // functional template
  7898. if (functionalTemplate) {
  7899. options.functional = true
  7900. }
  7901. // scopedId
  7902. if (scopeId) {
  7903. options._scopeId = 'data-v-' + scopeId
  7904. }
  7905. var hook
  7906. if (moduleIdentifier) { // server build
  7907. hook = function (context) {
  7908. // 2.3 injection
  7909. context =
  7910. context || // cached call
  7911. (this.$vnode && this.$vnode.ssrContext) || // stateful
  7912. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  7913. // 2.2 with runInNewContext: true
  7914. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  7915. context = __VUE_SSR_CONTEXT__
  7916. }
  7917. // inject component styles
  7918. if (injectStyles) {
  7919. injectStyles.call(this, context)
  7920. }
  7921. // register component module identifier for async chunk inferrence
  7922. if (context && context._registeredComponents) {
  7923. context._registeredComponents.add(moduleIdentifier)
  7924. }
  7925. }
  7926. // used by ssr in case component is cached and beforeCreate
  7927. // never gets called
  7928. options._ssrRegister = hook
  7929. } else if (injectStyles) {
  7930. hook = shadowMode
  7931. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  7932. : injectStyles
  7933. }
  7934. if (hook) {
  7935. if (options.functional) {
  7936. // for template-only hot-reload because in that case the render fn doesn't
  7937. // go through the normalizer
  7938. options._injectStyles = hook
  7939. // register for functioal component in vue file
  7940. var originalRender = options.render
  7941. options.render = function renderWithStyleInjection (h, context) {
  7942. hook.call(context)
  7943. return originalRender(h, context)
  7944. }
  7945. } else {
  7946. // inject component registration as beforeCreate hook
  7947. var existing = options.beforeCreate
  7948. options.beforeCreate = existing
  7949. ? [].concat(existing, hook)
  7950. : [hook]
  7951. }
  7952. }
  7953. return {
  7954. exports: scriptExports,
  7955. options: options
  7956. }
  7957. }
  7958. /***/ }),
  7959. /* 19 */
  7960. /*!**************************************************************!*\
  7961. !*** F:/uniapp/sqxp-uniapp/wxcomponents/vant/toast/toast.js ***!
  7962. \**************************************************************/
  7963. /*! no static exports found */
  7964. /***/ (function(module, exports, __webpack_require__) {
  7965. "use strict";
  7966. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _validator = __webpack_require__(/*! ../common/validator */ 20);
  7967. var defaultOptions = {
  7968. type: 'text',
  7969. mask: false,
  7970. message: '',
  7971. show: true,
  7972. zIndex: 1000,
  7973. duration: 2000,
  7974. position: 'middle',
  7975. forbidClick: false,
  7976. loadingType: 'circular',
  7977. selector: '#van-toast' };
  7978. var queue = [];
  7979. var currentOptions = Object.assign({}, defaultOptions);
  7980. function parseOptions(message) {
  7981. return (0, _validator.isObj)(message) ? message : { message: message };
  7982. }
  7983. function getContext() {
  7984. var pages = getCurrentPages();
  7985. return pages[pages.length - 1];
  7986. }
  7987. function Toast(toastOptions) {
  7988. var options = Object.assign(
  7989. Object.assign({}, currentOptions),
  7990. parseOptions(toastOptions));
  7991. var context = options.context || getContext();
  7992. var toast = context.selectComponent(options.selector);
  7993. if (!toast) {
  7994. console.warn('未找到 van-toast 节点,请确认 selector 及 context 是否正确');
  7995. return;
  7996. }
  7997. delete options.context;
  7998. delete options.selector;
  7999. toast.clear = function () {
  8000. toast.setData({ show: false });
  8001. if (options.onClose) {
  8002. options.onClose();
  8003. }
  8004. };
  8005. queue.push(toast);
  8006. toast.setData(options);
  8007. clearTimeout(toast.timer);
  8008. if (options.duration != null && options.duration > 0) {
  8009. toast.timer = setTimeout(function () {
  8010. toast.clear();
  8011. queue = queue.filter(function (item) {return item !== toast;});
  8012. }, options.duration);
  8013. }
  8014. return toast;
  8015. }
  8016. var createMethod = function createMethod(type) {return function (options) {return (
  8017. Toast(Object.assign({ type: type }, parseOptions(options))));};};
  8018. Toast.loading = createMethod('loading');
  8019. Toast.success = createMethod('success');
  8020. Toast.fail = createMethod('fail');
  8021. Toast.clear = function () {
  8022. queue.forEach(function (toast) {
  8023. toast.clear();
  8024. });
  8025. queue = [];
  8026. };
  8027. Toast.setDefaultOptions = function (options) {
  8028. Object.assign(currentOptions, options);
  8029. };
  8030. Toast.resetDefaultOptions = function () {
  8031. currentOptions = Object.assign({}, defaultOptions);
  8032. };var _default =
  8033. Toast;exports.default = _default;
  8034. /***/ }),
  8035. /* 20 */
  8036. /*!*******************************************************************!*\
  8037. !*** F:/uniapp/sqxp-uniapp/wxcomponents/vant/common/validator.js ***!
  8038. \*******************************************************************/
  8039. /*! no static exports found */
  8040. /***/ (function(module, exports, __webpack_require__) {
  8041. "use strict";
  8042. Object.defineProperty(exports, "__esModule", { value: true });exports.isFunction = isFunction;exports.isPlainObject = isPlainObject;exports.isPromise = isPromise;exports.isDef = isDef;exports.isObj = isObj;exports.isNumber = isNumber;exports.isBoolean = isBoolean;exports.isImageUrl = isImageUrl;exports.isVideoUrl = isVideoUrl;function isFunction(val) {
  8043. return typeof val === 'function';
  8044. }
  8045. function isPlainObject(val) {
  8046. return val !== null && typeof val === 'object' && !Array.isArray(val);
  8047. }
  8048. function isPromise(val) {
  8049. return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch);
  8050. }
  8051. function isDef(value) {
  8052. return value !== undefined && value !== null;
  8053. }
  8054. function isObj(x) {
  8055. var type = typeof x;
  8056. return x !== null && (type === 'object' || type === 'function');
  8057. }
  8058. function isNumber(value) {
  8059. return /^\d+(\.\d+)?$/.test(value);
  8060. }
  8061. function isBoolean(value) {
  8062. return typeof value === 'boolean';
  8063. }
  8064. var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
  8065. var VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i;
  8066. function isImageUrl(url) {
  8067. return IMAGE_REGEXP.test(url);
  8068. }
  8069. function isVideoUrl(url) {
  8070. return VIDEO_REGEXP.test(url);
  8071. }
  8072. /***/ }),
  8073. /* 21 */,
  8074. /* 22 */,
  8075. /* 23 */,
  8076. /* 24 */,
  8077. /* 25 */,
  8078. /* 26 */,
  8079. /* 27 */,
  8080. /* 28 */,
  8081. /* 29 */,
  8082. /* 30 */,
  8083. /* 31 */,
  8084. /* 32 */,
  8085. /* 33 */,
  8086. /* 34 */,
  8087. /* 35 */,
  8088. /* 36 */,
  8089. /* 37 */,
  8090. /* 38 */,
  8091. /* 39 */,
  8092. /* 40 */,
  8093. /* 41 */,
  8094. /* 42 */,
  8095. /* 43 */
  8096. /*!********************************************!*\
  8097. !*** F:/uniapp/sqxp-uniapp/api/applist.js ***!
  8098. \********************************************/
  8099. /*! no static exports found */
  8100. /***/ (function(module, exports, __webpack_require__) {
  8101. "use strict";
  8102. Object.defineProperty(exports, "__esModule", { value: true });exports.getTypeAppList = getTypeAppList;exports.collectionList = collectionList;exports.getBrowseRecordInfoList = getBrowseRecordInfoList;exports.typeList = typeList;exports.addFavorites = addFavorites;exports.delFavorites = delFavorites;exports.BrowseRecordAdd = BrowseRecordAdd;exports.BrowseRecordDel = BrowseRecordDel;var _request = _interopRequireDefault(__webpack_require__(/*! @/utils/request */ 13));
  8103. var _baseurl = __webpack_require__(/*! @/api/baseurl */ 15);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  8104. // 按品类查询商家列表
  8105. function getTypeAppList(id, params) {
  8106. return (0, _request.default)({
  8107. url: _baseurl.baseUrl + "/student/applet/customer/getCustomerListByProductId/".concat(id),
  8108. method: 'get',
  8109. params: params });
  8110. }
  8111. // 查询用户收藏列表
  8112. function collectionList(params) {
  8113. return (0, _request.default)({
  8114. url: _baseurl.baseUrl + '/student/applet/collection/collectionList',
  8115. method: 'get',
  8116. params: params });
  8117. }
  8118. // 查询用户浏览记录
  8119. function getBrowseRecordInfoList(params) {
  8120. return (0, _request.default)({
  8121. url: _baseurl.baseUrl + '/student/applet/record/info/getBrowseRecordInfoList',
  8122. method: 'get',
  8123. params: params });
  8124. }
  8125. // 查询品类列表
  8126. function typeList(params) {
  8127. return (0, _request.default)({
  8128. url: _baseurl.baseUrl + '/student/applet/product/info/list',
  8129. method: 'get',
  8130. params: params });
  8131. }
  8132. // 收藏商家
  8133. function addFavorites(id) {
  8134. return (0, _request.default)({
  8135. url: _baseurl.baseUrl + "/student/applet/collection/collectionBusiness/".concat(id),
  8136. method: 'put' });
  8137. }
  8138. // 删除收藏
  8139. function delFavorites(ids) {
  8140. return (0, _request.default)({
  8141. url: _baseurl.baseUrl + "/student/applet/collection/cancelCollection/".concat(ids),
  8142. method: 'delete' });
  8143. }
  8144. // 新增记录
  8145. function BrowseRecordAdd(id) {
  8146. return (0, _request.default)({
  8147. url: _baseurl.baseUrl + "/student/applet/record/info/insertBrowseRecord/".concat(id),
  8148. method: 'put' });
  8149. }
  8150. // 删除记录
  8151. function BrowseRecordDel(ids) {
  8152. return (0, _request.default)({
  8153. url: _baseurl.baseUrl + "/student/applet/record/info/".concat(ids),
  8154. method: 'delete' });
  8155. }
  8156. /***/ }),
  8157. /* 44 */,
  8158. /* 45 */,
  8159. /* 46 */,
  8160. /* 47 */,
  8161. /* 48 */,
  8162. /* 49 */,
  8163. /* 50 */,
  8164. /* 51 */,
  8165. /* 52 */,
  8166. /* 53 */,
  8167. /* 54 */,
  8168. /* 55 */,
  8169. /* 56 */,
  8170. /* 57 */,
  8171. /* 58 */,
  8172. /* 59 */,
  8173. /* 60 */
  8174. /*!*******************************************!*\
  8175. !*** F:/uniapp/sqxp-uniapp/api/answer.js ***!
  8176. \*******************************************/
  8177. /*! no static exports found */
  8178. /***/ (function(module, exports, __webpack_require__) {
  8179. "use strict";
  8180. Object.defineProperty(exports, "__esModule", { value: true });exports.questionList = questionList;exports.questionListRandom = questionListRandom;exports.questionErrorList = questionErrorList;exports.questionErrorAdd = questionErrorAdd;exports.questionErrorDel = questionErrorDel;var _request = _interopRequireDefault(__webpack_require__(/*! @/utils/request */ 13));
  8181. var _baseurl = __webpack_require__(/*! @/api/baseurl */ 15);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  8182. // 获取题库列表
  8183. function questionList(params) {
  8184. return (0, _request.default)({
  8185. url: _baseurl.baseUrl + '/student/question/info/getQuestionInfoList',
  8186. method: 'get',
  8187. params: params });
  8188. }
  8189. // 获取随机题库列表
  8190. function questionListRandom(params) {
  8191. return (0, _request.default)({
  8192. url: _baseurl.baseUrl + '/student/question/info/getRandQuestionInfoList',
  8193. method: 'get',
  8194. params: params });
  8195. }
  8196. // 获取错题收藏列表
  8197. function questionErrorList(params) {
  8198. return (0, _request.default)({
  8199. url: _baseurl.baseUrl + '/student/question/error/getQuestionErrorList',
  8200. method: 'get',
  8201. params: params });
  8202. }
  8203. // 新增错题
  8204. function questionErrorAdd(id) {
  8205. return (0, _request.default)({
  8206. url: _baseurl.baseUrl + '/student/question/error',
  8207. method: 'post',
  8208. data: {
  8209. questionId: id } });
  8210. }
  8211. // 删除错题
  8212. function questionErrorDel(ids) {
  8213. return (0, _request.default)({
  8214. url: _baseurl.baseUrl + "/student/question/error/".concat(ids),
  8215. method: 'delete' });
  8216. }
  8217. /***/ }),
  8218. /* 61 */,
  8219. /* 62 */,
  8220. /* 63 */,
  8221. /* 64 */,
  8222. /* 65 */,
  8223. /* 66 */,
  8224. /* 67 */,
  8225. /* 68 */,
  8226. /* 69 */,
  8227. /* 70 */,
  8228. /* 71 */,
  8229. /* 72 */,
  8230. /* 73 */,
  8231. /* 74 */,
  8232. /* 75 */,
  8233. /* 76 */,
  8234. /* 77 */,
  8235. /* 78 */,
  8236. /* 79 */,
  8237. /* 80 */,
  8238. /* 81 */,
  8239. /* 82 */,
  8240. /* 83 */,
  8241. /* 84 */,
  8242. /* 85 */
  8243. /*!****************************************************************!*\
  8244. !*** F:/uniapp/sqxp-uniapp/wxcomponents/vant/dialog/dialog.js ***!
  8245. \****************************************************************/
  8246. /*! no static exports found */
  8247. /***/ (function(module, exports, __webpack_require__) {
  8248. "use strict";
  8249. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var queue = [];
  8250. var defaultOptions = {
  8251. show: false,
  8252. title: '',
  8253. width: null,
  8254. theme: 'default',
  8255. message: '',
  8256. zIndex: 100,
  8257. overlay: true,
  8258. selector: '#van-dialog',
  8259. className: '',
  8260. asyncClose: false,
  8261. beforeClose: null,
  8262. transition: 'scale',
  8263. customStyle: '',
  8264. messageAlign: '',
  8265. overlayStyle: '',
  8266. confirmButtonText: '确认',
  8267. cancelButtonText: '取消',
  8268. showConfirmButton: true,
  8269. showCancelButton: false,
  8270. closeOnClickOverlay: false,
  8271. confirmButtonOpenType: '' };
  8272. var currentOptions = Object.assign({}, defaultOptions);
  8273. function getContext() {
  8274. var pages = getCurrentPages();
  8275. return pages[pages.length - 1];
  8276. }
  8277. var Dialog = function Dialog(options) {
  8278. options = Object.assign(Object.assign({}, currentOptions), options);
  8279. return new Promise(function (resolve, reject) {
  8280. var context = options.context || getContext();
  8281. var dialog = context.selectComponent(options.selector);
  8282. delete options.context;
  8283. delete options.selector;
  8284. if (dialog) {
  8285. dialog.setData(
  8286. Object.assign(
  8287. {
  8288. callback: function callback(action, instance) {
  8289. action === 'confirm' ? resolve(instance) : reject(instance);
  8290. } },
  8291. options));
  8292. wx.nextTick(function () {
  8293. dialog.setData({ show: true });
  8294. });
  8295. queue.push(dialog);
  8296. } else {
  8297. console.warn(
  8298. '未找到 van-dialog 节点,请确认 selector 及 context 是否正确');
  8299. }
  8300. });
  8301. };
  8302. Dialog.alert = function (options) {return Dialog(options);};
  8303. Dialog.confirm = function (options) {return (
  8304. Dialog(Object.assign({ showCancelButton: true }, options)));};
  8305. Dialog.close = function () {
  8306. queue.forEach(function (dialog) {
  8307. dialog.close();
  8308. });
  8309. queue = [];
  8310. };
  8311. Dialog.stopLoading = function () {
  8312. queue.forEach(function (dialog) {
  8313. dialog.stopLoading();
  8314. });
  8315. };
  8316. Dialog.currentOptions = currentOptions;
  8317. Dialog.defaultOptions = defaultOptions;
  8318. Dialog.setDefaultOptions = function (options) {
  8319. currentOptions = Object.assign(Object.assign({}, currentOptions), options);
  8320. Dialog.currentOptions = currentOptions;
  8321. };
  8322. Dialog.resetDefaultOptions = function () {
  8323. currentOptions = Object.assign({}, defaultOptions);
  8324. Dialog.currentOptions = currentOptions;
  8325. };
  8326. Dialog.resetDefaultOptions();var _default =
  8327. Dialog;exports.default = _default;
  8328. /***/ }),
  8329. /* 86 */,
  8330. /* 87 */,
  8331. /* 88 */,
  8332. /* 89 */,
  8333. /* 90 */,
  8334. /* 91 */,
  8335. /* 92 */,
  8336. /* 93 */
  8337. /*!********************************************!*\
  8338. !*** F:/uniapp/sqxp-uniapp/utils/utils.js ***!
  8339. \********************************************/
  8340. /*! no static exports found */
  8341. /***/ (function(module, exports, __webpack_require__) {
  8342. "use strict";
  8343. Object.defineProperty(exports, "__esModule", { value: true });exports.debounce = debounce;
  8344. //防抖函数
  8345. function debounce(func, fnThis, wait) {
  8346. var timer;
  8347. return function () {
  8348. clearTimeout(timer);
  8349. timer = setTimeout(func.bind(fnThis), wait);
  8350. };
  8351. }
  8352. /***/ }),
  8353. /* 94 */,
  8354. /* 95 */,
  8355. /* 96 */,
  8356. /* 97 */,
  8357. /* 98 */,
  8358. /* 99 */,
  8359. /* 100 */,
  8360. /* 101 */,
  8361. /* 102 */,
  8362. /* 103 */,
  8363. /* 104 */,
  8364. /* 105 */,
  8365. /* 106 */,
  8366. /* 107 */,
  8367. /* 108 */
  8368. /*!***********************************************************!*\
  8369. !*** F:/uniapp/sqxp-uniapp/node_modules/crypto-js/md5.js ***!
  8370. \***********************************************************/
  8371. /*! no static exports found */
  8372. /***/ (function(module, exports, __webpack_require__) {
  8373. ;(function (root, factory) {
  8374. if (true) {
  8375. // CommonJS
  8376. module.exports = exports = factory(__webpack_require__(/*! ./core */ 109));
  8377. } else
  8378. {}
  8379. })(this, function (CryptoJS) {
  8380. (function (Math) {
  8381. // Shortcuts
  8382. var C = CryptoJS;
  8383. var C_lib = C.lib;
  8384. var WordArray = C_lib.WordArray;
  8385. var Hasher = C_lib.Hasher;
  8386. var C_algo = C.algo;
  8387. // Constants table
  8388. var T = [];
  8389. // Compute constants
  8390. (function () {
  8391. for (var i = 0; i < 64; i++) {
  8392. T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0;
  8393. }
  8394. })();
  8395. /**
  8396. * MD5 hash algorithm.
  8397. */
  8398. var MD5 = C_algo.MD5 = Hasher.extend({
  8399. _doReset: function _doReset() {
  8400. this._hash = new WordArray.init([
  8401. 0x67452301, 0xefcdab89,
  8402. 0x98badcfe, 0x10325476]);
  8403. },
  8404. _doProcessBlock: function _doProcessBlock(M, offset) {
  8405. // Swap endian
  8406. for (var i = 0; i < 16; i++) {
  8407. // Shortcuts
  8408. var offset_i = offset + i;
  8409. var M_offset_i = M[offset_i];
  8410. M[offset_i] =
  8411. (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff |
  8412. (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00;
  8413. }
  8414. // Shortcuts
  8415. var H = this._hash.words;
  8416. var M_offset_0 = M[offset + 0];
  8417. var M_offset_1 = M[offset + 1];
  8418. var M_offset_2 = M[offset + 2];
  8419. var M_offset_3 = M[offset + 3];
  8420. var M_offset_4 = M[offset + 4];
  8421. var M_offset_5 = M[offset + 5];
  8422. var M_offset_6 = M[offset + 6];
  8423. var M_offset_7 = M[offset + 7];
  8424. var M_offset_8 = M[offset + 8];
  8425. var M_offset_9 = M[offset + 9];
  8426. var M_offset_10 = M[offset + 10];
  8427. var M_offset_11 = M[offset + 11];
  8428. var M_offset_12 = M[offset + 12];
  8429. var M_offset_13 = M[offset + 13];
  8430. var M_offset_14 = M[offset + 14];
  8431. var M_offset_15 = M[offset + 15];
  8432. // Working varialbes
  8433. var a = H[0];
  8434. var b = H[1];
  8435. var c = H[2];
  8436. var d = H[3];
  8437. // Computation
  8438. a = FF(a, b, c, d, M_offset_0, 7, T[0]);
  8439. d = FF(d, a, b, c, M_offset_1, 12, T[1]);
  8440. c = FF(c, d, a, b, M_offset_2, 17, T[2]);
  8441. b = FF(b, c, d, a, M_offset_3, 22, T[3]);
  8442. a = FF(a, b, c, d, M_offset_4, 7, T[4]);
  8443. d = FF(d, a, b, c, M_offset_5, 12, T[5]);
  8444. c = FF(c, d, a, b, M_offset_6, 17, T[6]);
  8445. b = FF(b, c, d, a, M_offset_7, 22, T[7]);
  8446. a = FF(a, b, c, d, M_offset_8, 7, T[8]);
  8447. d = FF(d, a, b, c, M_offset_9, 12, T[9]);
  8448. c = FF(c, d, a, b, M_offset_10, 17, T[10]);
  8449. b = FF(b, c, d, a, M_offset_11, 22, T[11]);
  8450. a = FF(a, b, c, d, M_offset_12, 7, T[12]);
  8451. d = FF(d, a, b, c, M_offset_13, 12, T[13]);
  8452. c = FF(c, d, a, b, M_offset_14, 17, T[14]);
  8453. b = FF(b, c, d, a, M_offset_15, 22, T[15]);
  8454. a = GG(a, b, c, d, M_offset_1, 5, T[16]);
  8455. d = GG(d, a, b, c, M_offset_6, 9, T[17]);
  8456. c = GG(c, d, a, b, M_offset_11, 14, T[18]);
  8457. b = GG(b, c, d, a, M_offset_0, 20, T[19]);
  8458. a = GG(a, b, c, d, M_offset_5, 5, T[20]);
  8459. d = GG(d, a, b, c, M_offset_10, 9, T[21]);
  8460. c = GG(c, d, a, b, M_offset_15, 14, T[22]);
  8461. b = GG(b, c, d, a, M_offset_4, 20, T[23]);
  8462. a = GG(a, b, c, d, M_offset_9, 5, T[24]);
  8463. d = GG(d, a, b, c, M_offset_14, 9, T[25]);
  8464. c = GG(c, d, a, b, M_offset_3, 14, T[26]);
  8465. b = GG(b, c, d, a, M_offset_8, 20, T[27]);
  8466. a = GG(a, b, c, d, M_offset_13, 5, T[28]);
  8467. d = GG(d, a, b, c, M_offset_2, 9, T[29]);
  8468. c = GG(c, d, a, b, M_offset_7, 14, T[30]);
  8469. b = GG(b, c, d, a, M_offset_12, 20, T[31]);
  8470. a = HH(a, b, c, d, M_offset_5, 4, T[32]);
  8471. d = HH(d, a, b, c, M_offset_8, 11, T[33]);
  8472. c = HH(c, d, a, b, M_offset_11, 16, T[34]);
  8473. b = HH(b, c, d, a, M_offset_14, 23, T[35]);
  8474. a = HH(a, b, c, d, M_offset_1, 4, T[36]);
  8475. d = HH(d, a, b, c, M_offset_4, 11, T[37]);
  8476. c = HH(c, d, a, b, M_offset_7, 16, T[38]);
  8477. b = HH(b, c, d, a, M_offset_10, 23, T[39]);
  8478. a = HH(a, b, c, d, M_offset_13, 4, T[40]);
  8479. d = HH(d, a, b, c, M_offset_0, 11, T[41]);
  8480. c = HH(c, d, a, b, M_offset_3, 16, T[42]);
  8481. b = HH(b, c, d, a, M_offset_6, 23, T[43]);
  8482. a = HH(a, b, c, d, M_offset_9, 4, T[44]);
  8483. d = HH(d, a, b, c, M_offset_12, 11, T[45]);
  8484. c = HH(c, d, a, b, M_offset_15, 16, T[46]);
  8485. b = HH(b, c, d, a, M_offset_2, 23, T[47]);
  8486. a = II(a, b, c, d, M_offset_0, 6, T[48]);
  8487. d = II(d, a, b, c, M_offset_7, 10, T[49]);
  8488. c = II(c, d, a, b, M_offset_14, 15, T[50]);
  8489. b = II(b, c, d, a, M_offset_5, 21, T[51]);
  8490. a = II(a, b, c, d, M_offset_12, 6, T[52]);
  8491. d = II(d, a, b, c, M_offset_3, 10, T[53]);
  8492. c = II(c, d, a, b, M_offset_10, 15, T[54]);
  8493. b = II(b, c, d, a, M_offset_1, 21, T[55]);
  8494. a = II(a, b, c, d, M_offset_8, 6, T[56]);
  8495. d = II(d, a, b, c, M_offset_15, 10, T[57]);
  8496. c = II(c, d, a, b, M_offset_6, 15, T[58]);
  8497. b = II(b, c, d, a, M_offset_13, 21, T[59]);
  8498. a = II(a, b, c, d, M_offset_4, 6, T[60]);
  8499. d = II(d, a, b, c, M_offset_11, 10, T[61]);
  8500. c = II(c, d, a, b, M_offset_2, 15, T[62]);
  8501. b = II(b, c, d, a, M_offset_9, 21, T[63]);
  8502. // Intermediate hash value
  8503. H[0] = H[0] + a | 0;
  8504. H[1] = H[1] + b | 0;
  8505. H[2] = H[2] + c | 0;
  8506. H[3] = H[3] + d | 0;
  8507. },
  8508. _doFinalize: function _doFinalize() {
  8509. // Shortcuts
  8510. var data = this._data;
  8511. var dataWords = data.words;
  8512. var nBitsTotal = this._nDataBytes * 8;
  8513. var nBitsLeft = data.sigBytes * 8;
  8514. // Add padding
  8515. dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
  8516. var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
  8517. var nBitsTotalL = nBitsTotal;
  8518. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] =
  8519. (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff |
  8520. (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00;
  8521. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] =
  8522. (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff |
  8523. (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00;
  8524. data.sigBytes = (dataWords.length + 1) * 4;
  8525. // Hash final blocks
  8526. this._process();
  8527. // Shortcuts
  8528. var hash = this._hash;
  8529. var H = hash.words;
  8530. // Swap endian
  8531. for (var i = 0; i < 4; i++) {
  8532. // Shortcut
  8533. var H_i = H[i];
  8534. H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff |
  8535. (H_i << 24 | H_i >>> 8) & 0xff00ff00;
  8536. }
  8537. // Return final computed hash
  8538. return hash;
  8539. },
  8540. clone: function clone() {
  8541. var clone = Hasher.clone.call(this);
  8542. clone._hash = this._hash.clone();
  8543. return clone;
  8544. } });
  8545. function FF(a, b, c, d, x, s, t) {
  8546. var n = a + (b & c | ~b & d) + x + t;
  8547. return (n << s | n >>> 32 - s) + b;
  8548. }
  8549. function GG(a, b, c, d, x, s, t) {
  8550. var n = a + (b & d | c & ~d) + x + t;
  8551. return (n << s | n >>> 32 - s) + b;
  8552. }
  8553. function HH(a, b, c, d, x, s, t) {
  8554. var n = a + (b ^ c ^ d) + x + t;
  8555. return (n << s | n >>> 32 - s) + b;
  8556. }
  8557. function II(a, b, c, d, x, s, t) {
  8558. var n = a + (c ^ (b | ~d)) + x + t;
  8559. return (n << s | n >>> 32 - s) + b;
  8560. }
  8561. /**
  8562. * Shortcut function to the hasher's object interface.
  8563. *
  8564. * @param {WordArray|string} message The message to hash.
  8565. *
  8566. * @return {WordArray} The hash.
  8567. *
  8568. * @static
  8569. *
  8570. * @example
  8571. *
  8572. * var hash = CryptoJS.MD5('message');
  8573. * var hash = CryptoJS.MD5(wordArray);
  8574. */
  8575. C.MD5 = Hasher._createHelper(MD5);
  8576. /**
  8577. * Shortcut function to the HMAC's object interface.
  8578. *
  8579. * @param {WordArray|string} message The message to hash.
  8580. * @param {WordArray|string} key The secret key.
  8581. *
  8582. * @return {WordArray} The HMAC.
  8583. *
  8584. * @static
  8585. *
  8586. * @example
  8587. *
  8588. * var hmac = CryptoJS.HmacMD5(message, key);
  8589. */
  8590. C.HmacMD5 = Hasher._createHmacHelper(MD5);
  8591. })(Math);
  8592. return CryptoJS.MD5;
  8593. });
  8594. /***/ }),
  8595. /* 109 */
  8596. /*!************************************************************!*\
  8597. !*** F:/uniapp/sqxp-uniapp/node_modules/crypto-js/core.js ***!
  8598. \************************************************************/
  8599. /*! no static exports found */
  8600. /***/ (function(module, exports, __webpack_require__) {
  8601. /* WEBPACK VAR INJECTION */(function(global) {;(function (root, factory) {
  8602. if (true) {
  8603. // CommonJS
  8604. module.exports = exports = factory();
  8605. } else
  8606. {}
  8607. })(this, function () {
  8608. /*globals window, global, require*/
  8609. /**
  8610. * CryptoJS core components.
  8611. */
  8612. var CryptoJS = CryptoJS || function (Math, undefined) {
  8613. var crypto;
  8614. // Native crypto from window (Browser)
  8615. if (typeof window !== 'undefined' && window.crypto) {
  8616. crypto = window.crypto;
  8617. }
  8618. // Native (experimental IE 11) crypto from window (Browser)
  8619. if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
  8620. crypto = window.msCrypto;
  8621. }
  8622. // Native crypto from global (NodeJS)
  8623. if (!crypto && typeof global !== 'undefined' && global.crypto) {
  8624. crypto = global.crypto;
  8625. }
  8626. // Native crypto import via require (NodeJS)
  8627. if (!crypto && "function" === 'function') {
  8628. try {
  8629. crypto = __webpack_require__(/*! crypto */ 110);
  8630. } catch (err) {}
  8631. }
  8632. /*
  8633. * Cryptographically secure pseudorandom number generator
  8634. *
  8635. * As Math.random() is cryptographically not safe to use
  8636. */
  8637. var cryptoSecureRandomInt = function cryptoSecureRandomInt() {
  8638. if (crypto) {
  8639. // Use getRandomValues method (Browser)
  8640. if (typeof crypto.getRandomValues === 'function') {
  8641. try {
  8642. return crypto.getRandomValues(new Uint32Array(1))[0];
  8643. } catch (err) {}
  8644. }
  8645. // Use randomBytes method (NodeJS)
  8646. if (typeof crypto.randomBytes === 'function') {
  8647. try {
  8648. return crypto.randomBytes(4).readInt32LE();
  8649. } catch (err) {}
  8650. }
  8651. }
  8652. throw new Error('Native crypto module could not be used to get secure random number.');
  8653. };
  8654. /*
  8655. * Local polyfill of Object.create
  8656. */
  8657. var create = Object.create || function () {
  8658. function F() {}
  8659. return function (obj) {
  8660. var subtype;
  8661. F.prototype = obj;
  8662. subtype = new F();
  8663. F.prototype = null;
  8664. return subtype;
  8665. };
  8666. }();
  8667. /**
  8668. * CryptoJS namespace.
  8669. */
  8670. var C = {};
  8671. /**
  8672. * Library namespace.
  8673. */
  8674. var C_lib = C.lib = {};
  8675. /**
  8676. * Base object for prototypal inheritance.
  8677. */
  8678. var Base = C_lib.Base = function () {
  8679. return {
  8680. /**
  8681. * Creates a new object that inherits from this object.
  8682. *
  8683. * @param {Object} overrides Properties to copy into the new object.
  8684. *
  8685. * @return {Object} The new object.
  8686. *
  8687. * @static
  8688. *
  8689. * @example
  8690. *
  8691. * var MyType = CryptoJS.lib.Base.extend({
  8692. * field: 'value',
  8693. *
  8694. * method: function () {
  8695. * }
  8696. * });
  8697. */
  8698. extend: function extend(overrides) {
  8699. // Spawn
  8700. var subtype = create(this);
  8701. // Augment
  8702. if (overrides) {
  8703. subtype.mixIn(overrides);
  8704. }
  8705. // Create default initializer
  8706. if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
  8707. subtype.init = function () {
  8708. subtype.$super.init.apply(this, arguments);
  8709. };
  8710. }
  8711. // Initializer's prototype is the subtype object
  8712. subtype.init.prototype = subtype;
  8713. // Reference supertype
  8714. subtype.$super = this;
  8715. return subtype;
  8716. },
  8717. /**
  8718. * Extends this object and runs the init method.
  8719. * Arguments to create() will be passed to init().
  8720. *
  8721. * @return {Object} The new object.
  8722. *
  8723. * @static
  8724. *
  8725. * @example
  8726. *
  8727. * var instance = MyType.create();
  8728. */
  8729. create: function create() {
  8730. var instance = this.extend();
  8731. instance.init.apply(instance, arguments);
  8732. return instance;
  8733. },
  8734. /**
  8735. * Initializes a newly created object.
  8736. * Override this method to add some logic when your objects are created.
  8737. *
  8738. * @example
  8739. *
  8740. * var MyType = CryptoJS.lib.Base.extend({
  8741. * init: function () {
  8742. * // ...
  8743. * }
  8744. * });
  8745. */
  8746. init: function init() {
  8747. },
  8748. /**
  8749. * Copies properties into this object.
  8750. *
  8751. * @param {Object} properties The properties to mix in.
  8752. *
  8753. * @example
  8754. *
  8755. * MyType.mixIn({
  8756. * field: 'value'
  8757. * });
  8758. */
  8759. mixIn: function mixIn(properties) {
  8760. for (var propertyName in properties) {
  8761. if (properties.hasOwnProperty(propertyName)) {
  8762. this[propertyName] = properties[propertyName];
  8763. }
  8764. }
  8765. // IE won't copy toString using the loop above
  8766. if (properties.hasOwnProperty('toString')) {
  8767. this.toString = properties.toString;
  8768. }
  8769. },
  8770. /**
  8771. * Creates a copy of this object.
  8772. *
  8773. * @return {Object} The clone.
  8774. *
  8775. * @example
  8776. *
  8777. * var clone = instance.clone();
  8778. */
  8779. clone: function clone() {
  8780. return this.init.prototype.extend(this);
  8781. } };
  8782. }();
  8783. /**
  8784. * An array of 32-bit words.
  8785. *
  8786. * @property {Array} words The array of 32-bit words.
  8787. * @property {number} sigBytes The number of significant bytes in this word array.
  8788. */
  8789. var WordArray = C_lib.WordArray = Base.extend({
  8790. /**
  8791. * Initializes a newly created word array.
  8792. *
  8793. * @param {Array} words (Optional) An array of 32-bit words.
  8794. * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  8795. *
  8796. * @example
  8797. *
  8798. * var wordArray = CryptoJS.lib.WordArray.create();
  8799. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
  8800. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
  8801. */
  8802. init: function init(words, sigBytes) {
  8803. words = this.words = words || [];
  8804. if (sigBytes != undefined) {
  8805. this.sigBytes = sigBytes;
  8806. } else {
  8807. this.sigBytes = words.length * 4;
  8808. }
  8809. },
  8810. /**
  8811. * Converts this word array to a string.
  8812. *
  8813. * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
  8814. *
  8815. * @return {string} The stringified word array.
  8816. *
  8817. * @example
  8818. *
  8819. * var string = wordArray + '';
  8820. * var string = wordArray.toString();
  8821. * var string = wordArray.toString(CryptoJS.enc.Utf8);
  8822. */
  8823. toString: function toString(encoder) {
  8824. return (encoder || Hex).stringify(this);
  8825. },
  8826. /**
  8827. * Concatenates a word array to this word array.
  8828. *
  8829. * @param {WordArray} wordArray The word array to append.
  8830. *
  8831. * @return {WordArray} This word array.
  8832. *
  8833. * @example
  8834. *
  8835. * wordArray1.concat(wordArray2);
  8836. */
  8837. concat: function concat(wordArray) {
  8838. // Shortcuts
  8839. var thisWords = this.words;
  8840. var thatWords = wordArray.words;
  8841. var thisSigBytes = this.sigBytes;
  8842. var thatSigBytes = wordArray.sigBytes;
  8843. // Clamp excess bits
  8844. this.clamp();
  8845. // Concat
  8846. if (thisSigBytes % 4) {
  8847. // Copy one byte at a time
  8848. for (var i = 0; i < thatSigBytes; i++) {
  8849. var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  8850. thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8;
  8851. }
  8852. } else {
  8853. // Copy one word at a time
  8854. for (var i = 0; i < thatSigBytes; i += 4) {
  8855. thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2];
  8856. }
  8857. }
  8858. this.sigBytes += thatSigBytes;
  8859. // Chainable
  8860. return this;
  8861. },
  8862. /**
  8863. * Removes insignificant bits.
  8864. *
  8865. * @example
  8866. *
  8867. * wordArray.clamp();
  8868. */
  8869. clamp: function clamp() {
  8870. // Shortcuts
  8871. var words = this.words;
  8872. var sigBytes = this.sigBytes;
  8873. // Clamp
  8874. words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8;
  8875. words.length = Math.ceil(sigBytes / 4);
  8876. },
  8877. /**
  8878. * Creates a copy of this word array.
  8879. *
  8880. * @return {WordArray} The clone.
  8881. *
  8882. * @example
  8883. *
  8884. * var clone = wordArray.clone();
  8885. */
  8886. clone: function clone() {
  8887. var clone = Base.clone.call(this);
  8888. clone.words = this.words.slice(0);
  8889. return clone;
  8890. },
  8891. /**
  8892. * Creates a word array filled with random bytes.
  8893. *
  8894. * @param {number} nBytes The number of random bytes to generate.
  8895. *
  8896. * @return {WordArray} The random word array.
  8897. *
  8898. * @static
  8899. *
  8900. * @example
  8901. *
  8902. * var wordArray = CryptoJS.lib.WordArray.random(16);
  8903. */
  8904. random: function random(nBytes) {
  8905. var words = [];
  8906. for (var i = 0; i < nBytes; i += 4) {
  8907. words.push(cryptoSecureRandomInt());
  8908. }
  8909. return new WordArray.init(words, nBytes);
  8910. } });
  8911. /**
  8912. * Encoder namespace.
  8913. */
  8914. var C_enc = C.enc = {};
  8915. /**
  8916. * Hex encoding strategy.
  8917. */
  8918. var Hex = C_enc.Hex = {
  8919. /**
  8920. * Converts a word array to a hex string.
  8921. *
  8922. * @param {WordArray} wordArray The word array.
  8923. *
  8924. * @return {string} The hex string.
  8925. *
  8926. * @static
  8927. *
  8928. * @example
  8929. *
  8930. * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
  8931. */
  8932. stringify: function stringify(wordArray) {
  8933. // Shortcuts
  8934. var words = wordArray.words;
  8935. var sigBytes = wordArray.sigBytes;
  8936. // Convert
  8937. var hexChars = [];
  8938. for (var i = 0; i < sigBytes; i++) {
  8939. var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  8940. hexChars.push((bite >>> 4).toString(16));
  8941. hexChars.push((bite & 0x0f).toString(16));
  8942. }
  8943. return hexChars.join('');
  8944. },
  8945. /**
  8946. * Converts a hex string to a word array.
  8947. *
  8948. * @param {string} hexStr The hex string.
  8949. *
  8950. * @return {WordArray} The word array.
  8951. *
  8952. * @static
  8953. *
  8954. * @example
  8955. *
  8956. * var wordArray = CryptoJS.enc.Hex.parse(hexString);
  8957. */
  8958. parse: function parse(hexStr) {
  8959. // Shortcut
  8960. var hexStrLength = hexStr.length;
  8961. // Convert
  8962. var words = [];
  8963. for (var i = 0; i < hexStrLength; i += 2) {
  8964. words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4;
  8965. }
  8966. return new WordArray.init(words, hexStrLength / 2);
  8967. } };
  8968. /**
  8969. * Latin1 encoding strategy.
  8970. */
  8971. var Latin1 = C_enc.Latin1 = {
  8972. /**
  8973. * Converts a word array to a Latin1 string.
  8974. *
  8975. * @param {WordArray} wordArray The word array.
  8976. *
  8977. * @return {string} The Latin1 string.
  8978. *
  8979. * @static
  8980. *
  8981. * @example
  8982. *
  8983. * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
  8984. */
  8985. stringify: function stringify(wordArray) {
  8986. // Shortcuts
  8987. var words = wordArray.words;
  8988. var sigBytes = wordArray.sigBytes;
  8989. // Convert
  8990. var latin1Chars = [];
  8991. for (var i = 0; i < sigBytes; i++) {
  8992. var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  8993. latin1Chars.push(String.fromCharCode(bite));
  8994. }
  8995. return latin1Chars.join('');
  8996. },
  8997. /**
  8998. * Converts a Latin1 string to a word array.
  8999. *
  9000. * @param {string} latin1Str The Latin1 string.
  9001. *
  9002. * @return {WordArray} The word array.
  9003. *
  9004. * @static
  9005. *
  9006. * @example
  9007. *
  9008. * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
  9009. */
  9010. parse: function parse(latin1Str) {
  9011. // Shortcut
  9012. var latin1StrLength = latin1Str.length;
  9013. // Convert
  9014. var words = [];
  9015. for (var i = 0; i < latin1StrLength; i++) {
  9016. words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8;
  9017. }
  9018. return new WordArray.init(words, latin1StrLength);
  9019. } };
  9020. /**
  9021. * UTF-8 encoding strategy.
  9022. */
  9023. var Utf8 = C_enc.Utf8 = {
  9024. /**
  9025. * Converts a word array to a UTF-8 string.
  9026. *
  9027. * @param {WordArray} wordArray The word array.
  9028. *
  9029. * @return {string} The UTF-8 string.
  9030. *
  9031. * @static
  9032. *
  9033. * @example
  9034. *
  9035. * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
  9036. */
  9037. stringify: function stringify(wordArray) {
  9038. try {
  9039. return decodeURIComponent(escape(Latin1.stringify(wordArray)));
  9040. } catch (e) {
  9041. throw new Error('Malformed UTF-8 data');
  9042. }
  9043. },
  9044. /**
  9045. * Converts a UTF-8 string to a word array.
  9046. *
  9047. * @param {string} utf8Str The UTF-8 string.
  9048. *
  9049. * @return {WordArray} The word array.
  9050. *
  9051. * @static
  9052. *
  9053. * @example
  9054. *
  9055. * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
  9056. */
  9057. parse: function parse(utf8Str) {
  9058. return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
  9059. } };
  9060. /**
  9061. * Abstract buffered block algorithm template.
  9062. *
  9063. * The property blockSize must be implemented in a concrete subtype.
  9064. *
  9065. * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
  9066. */
  9067. var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
  9068. /**
  9069. * Resets this block algorithm's data buffer to its initial state.
  9070. *
  9071. * @example
  9072. *
  9073. * bufferedBlockAlgorithm.reset();
  9074. */
  9075. reset: function reset() {
  9076. // Initial values
  9077. this._data = new WordArray.init();
  9078. this._nDataBytes = 0;
  9079. },
  9080. /**
  9081. * Adds new data to this block algorithm's buffer.
  9082. *
  9083. * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
  9084. *
  9085. * @example
  9086. *
  9087. * bufferedBlockAlgorithm._append('data');
  9088. * bufferedBlockAlgorithm._append(wordArray);
  9089. */
  9090. _append: function _append(data) {
  9091. // Convert string to WordArray, else assume WordArray already
  9092. if (typeof data == 'string') {
  9093. data = Utf8.parse(data);
  9094. }
  9095. // Append
  9096. this._data.concat(data);
  9097. this._nDataBytes += data.sigBytes;
  9098. },
  9099. /**
  9100. * Processes available data blocks.
  9101. *
  9102. * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
  9103. *
  9104. * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
  9105. *
  9106. * @return {WordArray} The processed data.
  9107. *
  9108. * @example
  9109. *
  9110. * var processedData = bufferedBlockAlgorithm._process();
  9111. * var processedData = bufferedBlockAlgorithm._process(!!'flush');
  9112. */
  9113. _process: function _process(doFlush) {
  9114. var processedWords;
  9115. // Shortcuts
  9116. var data = this._data;
  9117. var dataWords = data.words;
  9118. var dataSigBytes = data.sigBytes;
  9119. var blockSize = this.blockSize;
  9120. var blockSizeBytes = blockSize * 4;
  9121. // Count blocks ready
  9122. var nBlocksReady = dataSigBytes / blockSizeBytes;
  9123. if (doFlush) {
  9124. // Round up to include partial blocks
  9125. nBlocksReady = Math.ceil(nBlocksReady);
  9126. } else {
  9127. // Round down to include only full blocks,
  9128. // less the number of blocks that must remain in the buffer
  9129. nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
  9130. }
  9131. // Count words ready
  9132. var nWordsReady = nBlocksReady * blockSize;
  9133. // Count bytes ready
  9134. var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
  9135. // Process blocks
  9136. if (nWordsReady) {
  9137. for (var offset = 0; offset < nWordsReady; offset += blockSize) {
  9138. // Perform concrete-algorithm logic
  9139. this._doProcessBlock(dataWords, offset);
  9140. }
  9141. // Remove processed words
  9142. processedWords = dataWords.splice(0, nWordsReady);
  9143. data.sigBytes -= nBytesReady;
  9144. }
  9145. // Return processed words
  9146. return new WordArray.init(processedWords, nBytesReady);
  9147. },
  9148. /**
  9149. * Creates a copy of this object.
  9150. *
  9151. * @return {Object} The clone.
  9152. *
  9153. * @example
  9154. *
  9155. * var clone = bufferedBlockAlgorithm.clone();
  9156. */
  9157. clone: function clone() {
  9158. var clone = Base.clone.call(this);
  9159. clone._data = this._data.clone();
  9160. return clone;
  9161. },
  9162. _minBufferSize: 0 });
  9163. /**
  9164. * Abstract hasher template.
  9165. *
  9166. * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
  9167. */
  9168. var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
  9169. /**
  9170. * Configuration options.
  9171. */
  9172. cfg: Base.extend(),
  9173. /**
  9174. * Initializes a newly created hasher.
  9175. *
  9176. * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
  9177. *
  9178. * @example
  9179. *
  9180. * var hasher = CryptoJS.algo.SHA256.create();
  9181. */
  9182. init: function init(cfg) {
  9183. // Apply config defaults
  9184. this.cfg = this.cfg.extend(cfg);
  9185. // Set initial values
  9186. this.reset();
  9187. },
  9188. /**
  9189. * Resets this hasher to its initial state.
  9190. *
  9191. * @example
  9192. *
  9193. * hasher.reset();
  9194. */
  9195. reset: function reset() {
  9196. // Reset data buffer
  9197. BufferedBlockAlgorithm.reset.call(this);
  9198. // Perform concrete-hasher logic
  9199. this._doReset();
  9200. },
  9201. /**
  9202. * Updates this hasher with a message.
  9203. *
  9204. * @param {WordArray|string} messageUpdate The message to append.
  9205. *
  9206. * @return {Hasher} This hasher.
  9207. *
  9208. * @example
  9209. *
  9210. * hasher.update('message');
  9211. * hasher.update(wordArray);
  9212. */
  9213. update: function update(messageUpdate) {
  9214. // Append
  9215. this._append(messageUpdate);
  9216. // Update the hash
  9217. this._process();
  9218. // Chainable
  9219. return this;
  9220. },
  9221. /**
  9222. * Finalizes the hash computation.
  9223. * Note that the finalize operation is effectively a destructive, read-once operation.
  9224. *
  9225. * @param {WordArray|string} messageUpdate (Optional) A final message update.
  9226. *
  9227. * @return {WordArray} The hash.
  9228. *
  9229. * @example
  9230. *
  9231. * var hash = hasher.finalize();
  9232. * var hash = hasher.finalize('message');
  9233. * var hash = hasher.finalize(wordArray);
  9234. */
  9235. finalize: function finalize(messageUpdate) {
  9236. // Final message update
  9237. if (messageUpdate) {
  9238. this._append(messageUpdate);
  9239. }
  9240. // Perform concrete-hasher logic
  9241. var hash = this._doFinalize();
  9242. return hash;
  9243. },
  9244. blockSize: 512 / 32,
  9245. /**
  9246. * Creates a shortcut function to a hasher's object interface.
  9247. *
  9248. * @param {Hasher} hasher The hasher to create a helper for.
  9249. *
  9250. * @return {Function} The shortcut function.
  9251. *
  9252. * @static
  9253. *
  9254. * @example
  9255. *
  9256. * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
  9257. */
  9258. _createHelper: function _createHelper(hasher) {
  9259. return function (message, cfg) {
  9260. return new hasher.init(cfg).finalize(message);
  9261. };
  9262. },
  9263. /**
  9264. * Creates a shortcut function to the HMAC's object interface.
  9265. *
  9266. * @param {Hasher} hasher The hasher to use in this HMAC helper.
  9267. *
  9268. * @return {Function} The shortcut function.
  9269. *
  9270. * @static
  9271. *
  9272. * @example
  9273. *
  9274. * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
  9275. */
  9276. _createHmacHelper: function _createHmacHelper(hasher) {
  9277. return function (message, key) {
  9278. return new C_algo.HMAC.init(hasher, key).finalize(message);
  9279. };
  9280. } });
  9281. /**
  9282. * Algorithm namespace.
  9283. */
  9284. var C_algo = C.algo = {};
  9285. return C;
  9286. }(Math);
  9287. return CryptoJS;
  9288. });
  9289. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../HBuilderX/plugins/uniapp-cli/node_modules/webpack/buildin/global.js */ 3)))
  9290. /***/ }),
  9291. /* 110 */
  9292. /*!*************************************************!*\
  9293. !*** ./node_modules/crypto-browserify/index.js ***!
  9294. \*************************************************/
  9295. /*! no static exports found */
  9296. /***/ (function(module, exports, __webpack_require__) {
  9297. "use strict";
  9298. exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(/*! randombytes */ 111)
  9299. exports.createHash = exports.Hash = __webpack_require__(/*! create-hash */ 119)
  9300. exports.createHmac = exports.Hmac = __webpack_require__(/*! create-hmac */ 154)
  9301. var algos = __webpack_require__(/*! browserify-sign/algos */ 157)
  9302. var algoKeys = Object.keys(algos)
  9303. var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)
  9304. exports.getHashes = function () {
  9305. return hashes
  9306. }
  9307. var p = __webpack_require__(/*! pbkdf2 */ 159)
  9308. exports.pbkdf2 = p.pbkdf2
  9309. exports.pbkdf2Sync = p.pbkdf2Sync
  9310. var aes = __webpack_require__(/*! browserify-cipher */ 165)
  9311. exports.Cipher = aes.Cipher
  9312. exports.createCipher = aes.createCipher
  9313. exports.Cipheriv = aes.Cipheriv
  9314. exports.createCipheriv = aes.createCipheriv
  9315. exports.Decipher = aes.Decipher
  9316. exports.createDecipher = aes.createDecipher
  9317. exports.Decipheriv = aes.Decipheriv
  9318. exports.createDecipheriv = aes.createDecipheriv
  9319. exports.getCiphers = aes.getCiphers
  9320. exports.listCiphers = aes.listCiphers
  9321. var dh = __webpack_require__(/*! diffie-hellman */ 194)
  9322. exports.DiffieHellmanGroup = dh.DiffieHellmanGroup
  9323. exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup
  9324. exports.getDiffieHellman = dh.getDiffieHellman
  9325. exports.createDiffieHellman = dh.createDiffieHellman
  9326. exports.DiffieHellman = dh.DiffieHellman
  9327. var sign = __webpack_require__(/*! browserify-sign */ 204)
  9328. exports.createSign = sign.createSign
  9329. exports.Sign = sign.Sign
  9330. exports.createVerify = sign.createVerify
  9331. exports.Verify = sign.Verify
  9332. exports.createECDH = __webpack_require__(/*! create-ecdh */ 259)
  9333. var publicEncrypt = __webpack_require__(/*! public-encrypt */ 260)
  9334. exports.publicEncrypt = publicEncrypt.publicEncrypt
  9335. exports.privateEncrypt = publicEncrypt.privateEncrypt
  9336. exports.publicDecrypt = publicEncrypt.publicDecrypt
  9337. exports.privateDecrypt = publicEncrypt.privateDecrypt
  9338. // the least I can do is make error messages for the rest of the node.js/crypto api.
  9339. // ;[
  9340. // 'createCredentials'
  9341. // ].forEach(function (name) {
  9342. // exports[name] = function () {
  9343. // throw new Error([
  9344. // 'sorry, ' + name + ' is not implemented yet',
  9345. // 'we accept pull requests',
  9346. // 'https://github.com/crypto-browserify/crypto-browserify'
  9347. // ].join('\n'))
  9348. // }
  9349. // })
  9350. var rf = __webpack_require__(/*! randomfill */ 266)
  9351. exports.randomFill = rf.randomFill
  9352. exports.randomFillSync = rf.randomFillSync
  9353. exports.createCredentials = function () {
  9354. throw new Error([
  9355. 'sorry, createCredentials is not implemented yet',
  9356. 'we accept pull requests',
  9357. 'https://github.com/crypto-browserify/crypto-browserify'
  9358. ].join('\n'))
  9359. }
  9360. exports.constants = {
  9361. 'DH_CHECK_P_NOT_SAFE_PRIME': 2,
  9362. 'DH_CHECK_P_NOT_PRIME': 1,
  9363. 'DH_UNABLE_TO_CHECK_GENERATOR': 4,
  9364. 'DH_NOT_SUITABLE_GENERATOR': 8,
  9365. 'NPN_ENABLED': 1,
  9366. 'ALPN_ENABLED': 1,
  9367. 'RSA_PKCS1_PADDING': 1,
  9368. 'RSA_SSLV23_PADDING': 2,
  9369. 'RSA_NO_PADDING': 3,
  9370. 'RSA_PKCS1_OAEP_PADDING': 4,
  9371. 'RSA_X931_PADDING': 5,
  9372. 'RSA_PKCS1_PSS_PADDING': 6,
  9373. 'POINT_CONVERSION_COMPRESSED': 2,
  9374. 'POINT_CONVERSION_UNCOMPRESSED': 4,
  9375. 'POINT_CONVERSION_HYBRID': 6
  9376. }
  9377. /***/ }),
  9378. /* 111 */
  9379. /*!*********************************************!*\
  9380. !*** ./node_modules/randombytes/browser.js ***!
  9381. \*********************************************/
  9382. /*! no static exports found */
  9383. /***/ (function(module, exports, __webpack_require__) {
  9384. "use strict";
  9385. /* WEBPACK VAR INJECTION */(function(global, process) {
  9386. // limit of Crypto.getRandomValues()
  9387. // https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
  9388. var MAX_BYTES = 65536
  9389. // Node supports requesting up to this number of bytes
  9390. // https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
  9391. var MAX_UINT32 = 4294967295
  9392. function oldBrowser () {
  9393. throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
  9394. }
  9395. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  9396. var crypto = global.crypto || global.msCrypto
  9397. if (crypto && crypto.getRandomValues) {
  9398. module.exports = randomBytes
  9399. } else {
  9400. module.exports = oldBrowser
  9401. }
  9402. function randomBytes (size, cb) {
  9403. // phantomjs needs to throw
  9404. if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')
  9405. var bytes = Buffer.allocUnsafe(size)
  9406. if (size > 0) { // getRandomValues fails on IE if size == 0
  9407. if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues
  9408. // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
  9409. for (var generated = 0; generated < size; generated += MAX_BYTES) {
  9410. // buffer.slice automatically checks if the end is past the end of
  9411. // the buffer so we don't have to here
  9412. crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))
  9413. }
  9414. } else {
  9415. crypto.getRandomValues(bytes)
  9416. }
  9417. }
  9418. if (typeof cb === 'function') {
  9419. return process.nextTick(function () {
  9420. cb(null, bytes)
  9421. })
  9422. }
  9423. return bytes
  9424. }
  9425. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 112)))
  9426. /***/ }),
  9427. /* 112 */
  9428. /*!********************************************************!*\
  9429. !*** ./node_modules/node-libs-browser/mock/process.js ***!
  9430. \********************************************************/
  9431. /*! no static exports found */
  9432. /***/ (function(module, exports, __webpack_require__) {
  9433. exports.nextTick = function nextTick(fn) {
  9434. var args = Array.prototype.slice.call(arguments);
  9435. args.shift();
  9436. setTimeout(function () {
  9437. fn.apply(null, args);
  9438. }, 0);
  9439. };
  9440. exports.platform = exports.arch =
  9441. exports.execPath = exports.title = 'browser';
  9442. exports.pid = 1;
  9443. exports.browser = true;
  9444. exports.env = {};
  9445. exports.argv = [];
  9446. exports.binding = function (name) {
  9447. throw new Error('No such module. (Possibly not yet loaded)')
  9448. };
  9449. (function () {
  9450. var cwd = '/';
  9451. var path;
  9452. exports.cwd = function () { return cwd };
  9453. exports.chdir = function (dir) {
  9454. if (!path) path = __webpack_require__(/*! path */ 113);
  9455. cwd = path.resolve(dir, cwd);
  9456. };
  9457. })();
  9458. exports.exit = exports.kill =
  9459. exports.umask = exports.dlopen =
  9460. exports.uptime = exports.memoryUsage =
  9461. exports.uvCounters = function() {};
  9462. exports.features = {};
  9463. /***/ }),
  9464. /* 113 */
  9465. /*!***********************************************!*\
  9466. !*** ./node_modules/path-browserify/index.js ***!
  9467. \***********************************************/
  9468. /*! no static exports found */
  9469. /***/ (function(module, exports, __webpack_require__) {
  9470. /* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
  9471. // backported and transplited with Babel, with backwards-compat fixes
  9472. // Copyright Joyent, Inc. and other Node contributors.
  9473. //
  9474. // Permission is hereby granted, free of charge, to any person obtaining a
  9475. // copy of this software and associated documentation files (the
  9476. // "Software"), to deal in the Software without restriction, including
  9477. // without limitation the rights to use, copy, modify, merge, publish,
  9478. // distribute, sublicense, and/or sell copies of the Software, and to permit
  9479. // persons to whom the Software is furnished to do so, subject to the
  9480. // following conditions:
  9481. //
  9482. // The above copyright notice and this permission notice shall be included
  9483. // in all copies or substantial portions of the Software.
  9484. //
  9485. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  9486. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  9487. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  9488. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  9489. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  9490. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  9491. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  9492. // resolves . and .. elements in a path array with directory names there
  9493. // must be no slashes, empty elements, or device names (c:\) in the array
  9494. // (so also no leading and trailing slashes - it does not distinguish
  9495. // relative and absolute paths)
  9496. function normalizeArray(parts, allowAboveRoot) {
  9497. // if the path tries to go above the root, `up` ends up > 0
  9498. var up = 0;
  9499. for (var i = parts.length - 1; i >= 0; i--) {
  9500. var last = parts[i];
  9501. if (last === '.') {
  9502. parts.splice(i, 1);
  9503. } else if (last === '..') {
  9504. parts.splice(i, 1);
  9505. up++;
  9506. } else if (up) {
  9507. parts.splice(i, 1);
  9508. up--;
  9509. }
  9510. }
  9511. // if the path is allowed to go above the root, restore leading ..s
  9512. if (allowAboveRoot) {
  9513. for (; up--; up) {
  9514. parts.unshift('..');
  9515. }
  9516. }
  9517. return parts;
  9518. }
  9519. // path.resolve([from ...], to)
  9520. // posix version
  9521. exports.resolve = function() {
  9522. var resolvedPath = '',
  9523. resolvedAbsolute = false;
  9524. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  9525. var path = (i >= 0) ? arguments[i] : process.cwd();
  9526. // Skip empty and invalid entries
  9527. if (typeof path !== 'string') {
  9528. throw new TypeError('Arguments to path.resolve must be strings');
  9529. } else if (!path) {
  9530. continue;
  9531. }
  9532. resolvedPath = path + '/' + resolvedPath;
  9533. resolvedAbsolute = path.charAt(0) === '/';
  9534. }
  9535. // At this point the path should be resolved to a full absolute path, but
  9536. // handle relative paths to be safe (might happen when process.cwd() fails)
  9537. // Normalize the path
  9538. resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
  9539. return !!p;
  9540. }), !resolvedAbsolute).join('/');
  9541. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  9542. };
  9543. // path.normalize(path)
  9544. // posix version
  9545. exports.normalize = function(path) {
  9546. var isAbsolute = exports.isAbsolute(path),
  9547. trailingSlash = substr(path, -1) === '/';
  9548. // Normalize the path
  9549. path = normalizeArray(filter(path.split('/'), function(p) {
  9550. return !!p;
  9551. }), !isAbsolute).join('/');
  9552. if (!path && !isAbsolute) {
  9553. path = '.';
  9554. }
  9555. if (path && trailingSlash) {
  9556. path += '/';
  9557. }
  9558. return (isAbsolute ? '/' : '') + path;
  9559. };
  9560. // posix version
  9561. exports.isAbsolute = function(path) {
  9562. return path.charAt(0) === '/';
  9563. };
  9564. // posix version
  9565. exports.join = function() {
  9566. var paths = Array.prototype.slice.call(arguments, 0);
  9567. return exports.normalize(filter(paths, function(p, index) {
  9568. if (typeof p !== 'string') {
  9569. throw new TypeError('Arguments to path.join must be strings');
  9570. }
  9571. return p;
  9572. }).join('/'));
  9573. };
  9574. // path.relative(from, to)
  9575. // posix version
  9576. exports.relative = function(from, to) {
  9577. from = exports.resolve(from).substr(1);
  9578. to = exports.resolve(to).substr(1);
  9579. function trim(arr) {
  9580. var start = 0;
  9581. for (; start < arr.length; start++) {
  9582. if (arr[start] !== '') break;
  9583. }
  9584. var end = arr.length - 1;
  9585. for (; end >= 0; end--) {
  9586. if (arr[end] !== '') break;
  9587. }
  9588. if (start > end) return [];
  9589. return arr.slice(start, end - start + 1);
  9590. }
  9591. var fromParts = trim(from.split('/'));
  9592. var toParts = trim(to.split('/'));
  9593. var length = Math.min(fromParts.length, toParts.length);
  9594. var samePartsLength = length;
  9595. for (var i = 0; i < length; i++) {
  9596. if (fromParts[i] !== toParts[i]) {
  9597. samePartsLength = i;
  9598. break;
  9599. }
  9600. }
  9601. var outputParts = [];
  9602. for (var i = samePartsLength; i < fromParts.length; i++) {
  9603. outputParts.push('..');
  9604. }
  9605. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  9606. return outputParts.join('/');
  9607. };
  9608. exports.sep = '/';
  9609. exports.delimiter = ':';
  9610. exports.dirname = function (path) {
  9611. if (typeof path !== 'string') path = path + '';
  9612. if (path.length === 0) return '.';
  9613. var code = path.charCodeAt(0);
  9614. var hasRoot = code === 47 /*/*/;
  9615. var end = -1;
  9616. var matchedSlash = true;
  9617. for (var i = path.length - 1; i >= 1; --i) {
  9618. code = path.charCodeAt(i);
  9619. if (code === 47 /*/*/) {
  9620. if (!matchedSlash) {
  9621. end = i;
  9622. break;
  9623. }
  9624. } else {
  9625. // We saw the first non-path separator
  9626. matchedSlash = false;
  9627. }
  9628. }
  9629. if (end === -1) return hasRoot ? '/' : '.';
  9630. if (hasRoot && end === 1) {
  9631. // return '//';
  9632. // Backwards-compat fix:
  9633. return '/';
  9634. }
  9635. return path.slice(0, end);
  9636. };
  9637. function basename(path) {
  9638. if (typeof path !== 'string') path = path + '';
  9639. var start = 0;
  9640. var end = -1;
  9641. var matchedSlash = true;
  9642. var i;
  9643. for (i = path.length - 1; i >= 0; --i) {
  9644. if (path.charCodeAt(i) === 47 /*/*/) {
  9645. // If we reached a path separator that was not part of a set of path
  9646. // separators at the end of the string, stop now
  9647. if (!matchedSlash) {
  9648. start = i + 1;
  9649. break;
  9650. }
  9651. } else if (end === -1) {
  9652. // We saw the first non-path separator, mark this as the end of our
  9653. // path component
  9654. matchedSlash = false;
  9655. end = i + 1;
  9656. }
  9657. }
  9658. if (end === -1) return '';
  9659. return path.slice(start, end);
  9660. }
  9661. // Uses a mixed approach for backwards-compatibility, as ext behavior changed
  9662. // in new Node.js versions, so only basename() above is backported here
  9663. exports.basename = function (path, ext) {
  9664. var f = basename(path);
  9665. if (ext && f.substr(-1 * ext.length) === ext) {
  9666. f = f.substr(0, f.length - ext.length);
  9667. }
  9668. return f;
  9669. };
  9670. exports.extname = function (path) {
  9671. if (typeof path !== 'string') path = path + '';
  9672. var startDot = -1;
  9673. var startPart = 0;
  9674. var end = -1;
  9675. var matchedSlash = true;
  9676. // Track the state of characters (if any) we see before our first dot and
  9677. // after any path separator we find
  9678. var preDotState = 0;
  9679. for (var i = path.length - 1; i >= 0; --i) {
  9680. var code = path.charCodeAt(i);
  9681. if (code === 47 /*/*/) {
  9682. // If we reached a path separator that was not part of a set of path
  9683. // separators at the end of the string, stop now
  9684. if (!matchedSlash) {
  9685. startPart = i + 1;
  9686. break;
  9687. }
  9688. continue;
  9689. }
  9690. if (end === -1) {
  9691. // We saw the first non-path separator, mark this as the end of our
  9692. // extension
  9693. matchedSlash = false;
  9694. end = i + 1;
  9695. }
  9696. if (code === 46 /*.*/) {
  9697. // If this is our first dot, mark it as the start of our extension
  9698. if (startDot === -1)
  9699. startDot = i;
  9700. else if (preDotState !== 1)
  9701. preDotState = 1;
  9702. } else if (startDot !== -1) {
  9703. // We saw a non-dot and non-path separator before our dot, so we should
  9704. // have a good chance at having a non-empty extension
  9705. preDotState = -1;
  9706. }
  9707. }
  9708. if (startDot === -1 || end === -1 ||
  9709. // We saw a non-dot character immediately before the dot
  9710. preDotState === 0 ||
  9711. // The (right-most) trimmed path component is exactly '..'
  9712. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  9713. return '';
  9714. }
  9715. return path.slice(startDot, end);
  9716. };
  9717. function filter (xs, f) {
  9718. if (xs.filter) return xs.filter(f);
  9719. var res = [];
  9720. for (var i = 0; i < xs.length; i++) {
  9721. if (f(xs[i], i, xs)) res.push(xs[i]);
  9722. }
  9723. return res;
  9724. }
  9725. // String.prototype.substr - negative index don't work in IE8
  9726. var substr = 'ab'.substr(-1) === 'b'
  9727. ? function (str, start, len) { return str.substr(start, len) }
  9728. : function (str, start, len) {
  9729. if (start < 0) start = str.length + start;
  9730. return str.substr(start, len);
  9731. }
  9732. ;
  9733. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 112)))
  9734. /***/ }),
  9735. /* 114 */
  9736. /*!*******************************************!*\
  9737. !*** ./node_modules/safe-buffer/index.js ***!
  9738. \*******************************************/
  9739. /*! no static exports found */
  9740. /***/ (function(module, exports, __webpack_require__) {
  9741. /* eslint-disable node/no-deprecated-api */
  9742. var buffer = __webpack_require__(/*! buffer */ 115)
  9743. var Buffer = buffer.Buffer
  9744. // alternative to using Object.keys for old browsers
  9745. function copyProps (src, dst) {
  9746. for (var key in src) {
  9747. dst[key] = src[key]
  9748. }
  9749. }
  9750. if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
  9751. module.exports = buffer
  9752. } else {
  9753. // Copy properties from require('buffer')
  9754. copyProps(buffer, exports)
  9755. exports.Buffer = SafeBuffer
  9756. }
  9757. function SafeBuffer (arg, encodingOrOffset, length) {
  9758. return Buffer(arg, encodingOrOffset, length)
  9759. }
  9760. // Copy static methods from Buffer
  9761. copyProps(Buffer, SafeBuffer)
  9762. SafeBuffer.from = function (arg, encodingOrOffset, length) {
  9763. if (typeof arg === 'number') {
  9764. throw new TypeError('Argument must not be a number')
  9765. }
  9766. return Buffer(arg, encodingOrOffset, length)
  9767. }
  9768. SafeBuffer.alloc = function (size, fill, encoding) {
  9769. if (typeof size !== 'number') {
  9770. throw new TypeError('Argument must be a number')
  9771. }
  9772. var buf = Buffer(size)
  9773. if (fill !== undefined) {
  9774. if (typeof encoding === 'string') {
  9775. buf.fill(fill, encoding)
  9776. } else {
  9777. buf.fill(fill)
  9778. }
  9779. } else {
  9780. buf.fill(0)
  9781. }
  9782. return buf
  9783. }
  9784. SafeBuffer.allocUnsafe = function (size) {
  9785. if (typeof size !== 'number') {
  9786. throw new TypeError('Argument must be a number')
  9787. }
  9788. return Buffer(size)
  9789. }
  9790. SafeBuffer.allocUnsafeSlow = function (size) {
  9791. if (typeof size !== 'number') {
  9792. throw new TypeError('Argument must be a number')
  9793. }
  9794. return buffer.SlowBuffer(size)
  9795. }
  9796. /***/ }),
  9797. /* 115 */
  9798. /*!**************************************!*\
  9799. !*** ./node_modules/buffer/index.js ***!
  9800. \**************************************/
  9801. /*! no static exports found */
  9802. /***/ (function(module, exports, __webpack_require__) {
  9803. "use strict";
  9804. /* WEBPACK VAR INJECTION */(function(global) {/*!
  9805. * The buffer module from node.js, for the browser.
  9806. *
  9807. * @author Feross Aboukhadijeh <http://feross.org>
  9808. * @license MIT
  9809. */
  9810. /* eslint-disable no-proto */
  9811. var base64 = __webpack_require__(/*! base64-js */ 116)
  9812. var ieee754 = __webpack_require__(/*! ieee754 */ 117)
  9813. var isArray = __webpack_require__(/*! isarray */ 118)
  9814. exports.Buffer = Buffer
  9815. exports.SlowBuffer = SlowBuffer
  9816. exports.INSPECT_MAX_BYTES = 50
  9817. /**
  9818. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  9819. * === true Use Uint8Array implementation (fastest)
  9820. * === false Use Object implementation (most compatible, even IE6)
  9821. *
  9822. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  9823. * Opera 11.6+, iOS 4.2+.
  9824. *
  9825. * Due to various browser bugs, sometimes the Object implementation will be used even
  9826. * when the browser supports typed arrays.
  9827. *
  9828. * Note:
  9829. *
  9830. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  9831. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  9832. *
  9833. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  9834. *
  9835. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  9836. * incorrect length in some situations.
  9837. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  9838. * get the Object implementation, which is slower but behaves correctly.
  9839. */
  9840. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  9841. ? global.TYPED_ARRAY_SUPPORT
  9842. : typedArraySupport()
  9843. /*
  9844. * Export kMaxLength after typed array support is determined.
  9845. */
  9846. exports.kMaxLength = kMaxLength()
  9847. function typedArraySupport () {
  9848. try {
  9849. var arr = new Uint8Array(1)
  9850. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  9851. return arr.foo() === 42 && // typed array instances can be augmented
  9852. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  9853. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  9854. } catch (e) {
  9855. return false
  9856. }
  9857. }
  9858. function kMaxLength () {
  9859. return Buffer.TYPED_ARRAY_SUPPORT
  9860. ? 0x7fffffff
  9861. : 0x3fffffff
  9862. }
  9863. function createBuffer (that, length) {
  9864. if (kMaxLength() < length) {
  9865. throw new RangeError('Invalid typed array length')
  9866. }
  9867. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9868. // Return an augmented `Uint8Array` instance, for best performance
  9869. that = new Uint8Array(length)
  9870. that.__proto__ = Buffer.prototype
  9871. } else {
  9872. // Fallback: Return an object instance of the Buffer class
  9873. if (that === null) {
  9874. that = new Buffer(length)
  9875. }
  9876. that.length = length
  9877. }
  9878. return that
  9879. }
  9880. /**
  9881. * The Buffer constructor returns instances of `Uint8Array` that have their
  9882. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  9883. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  9884. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  9885. * returns a single octet.
  9886. *
  9887. * The `Uint8Array` prototype remains unmodified.
  9888. */
  9889. function Buffer (arg, encodingOrOffset, length) {
  9890. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  9891. return new Buffer(arg, encodingOrOffset, length)
  9892. }
  9893. // Common case.
  9894. if (typeof arg === 'number') {
  9895. if (typeof encodingOrOffset === 'string') {
  9896. throw new Error(
  9897. 'If encoding is specified then the first argument must be a string'
  9898. )
  9899. }
  9900. return allocUnsafe(this, arg)
  9901. }
  9902. return from(this, arg, encodingOrOffset, length)
  9903. }
  9904. Buffer.poolSize = 8192 // not used by this implementation
  9905. // TODO: Legacy, not needed anymore. Remove in next major version.
  9906. Buffer._augment = function (arr) {
  9907. arr.__proto__ = Buffer.prototype
  9908. return arr
  9909. }
  9910. function from (that, value, encodingOrOffset, length) {
  9911. if (typeof value === 'number') {
  9912. throw new TypeError('"value" argument must not be a number')
  9913. }
  9914. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  9915. return fromArrayBuffer(that, value, encodingOrOffset, length)
  9916. }
  9917. if (typeof value === 'string') {
  9918. return fromString(that, value, encodingOrOffset)
  9919. }
  9920. return fromObject(that, value)
  9921. }
  9922. /**
  9923. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  9924. * if value is a number.
  9925. * Buffer.from(str[, encoding])
  9926. * Buffer.from(array)
  9927. * Buffer.from(buffer)
  9928. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  9929. **/
  9930. Buffer.from = function (value, encodingOrOffset, length) {
  9931. return from(null, value, encodingOrOffset, length)
  9932. }
  9933. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9934. Buffer.prototype.__proto__ = Uint8Array.prototype
  9935. Buffer.__proto__ = Uint8Array
  9936. if (typeof Symbol !== 'undefined' && Symbol.species &&
  9937. Buffer[Symbol.species] === Buffer) {
  9938. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  9939. Object.defineProperty(Buffer, Symbol.species, {
  9940. value: null,
  9941. configurable: true
  9942. })
  9943. }
  9944. }
  9945. function assertSize (size) {
  9946. if (typeof size !== 'number') {
  9947. throw new TypeError('"size" argument must be a number')
  9948. } else if (size < 0) {
  9949. throw new RangeError('"size" argument must not be negative')
  9950. }
  9951. }
  9952. function alloc (that, size, fill, encoding) {
  9953. assertSize(size)
  9954. if (size <= 0) {
  9955. return createBuffer(that, size)
  9956. }
  9957. if (fill !== undefined) {
  9958. // Only pay attention to encoding if it's a string. This
  9959. // prevents accidentally sending in a number that would
  9960. // be interpretted as a start offset.
  9961. return typeof encoding === 'string'
  9962. ? createBuffer(that, size).fill(fill, encoding)
  9963. : createBuffer(that, size).fill(fill)
  9964. }
  9965. return createBuffer(that, size)
  9966. }
  9967. /**
  9968. * Creates a new filled Buffer instance.
  9969. * alloc(size[, fill[, encoding]])
  9970. **/
  9971. Buffer.alloc = function (size, fill, encoding) {
  9972. return alloc(null, size, fill, encoding)
  9973. }
  9974. function allocUnsafe (that, size) {
  9975. assertSize(size)
  9976. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  9977. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  9978. for (var i = 0; i < size; ++i) {
  9979. that[i] = 0
  9980. }
  9981. }
  9982. return that
  9983. }
  9984. /**
  9985. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  9986. * */
  9987. Buffer.allocUnsafe = function (size) {
  9988. return allocUnsafe(null, size)
  9989. }
  9990. /**
  9991. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  9992. */
  9993. Buffer.allocUnsafeSlow = function (size) {
  9994. return allocUnsafe(null, size)
  9995. }
  9996. function fromString (that, string, encoding) {
  9997. if (typeof encoding !== 'string' || encoding === '') {
  9998. encoding = 'utf8'
  9999. }
  10000. if (!Buffer.isEncoding(encoding)) {
  10001. throw new TypeError('"encoding" must be a valid string encoding')
  10002. }
  10003. var length = byteLength(string, encoding) | 0
  10004. that = createBuffer(that, length)
  10005. var actual = that.write(string, encoding)
  10006. if (actual !== length) {
  10007. // Writing a hex string, for example, that contains invalid characters will
  10008. // cause everything after the first invalid character to be ignored. (e.g.
  10009. // 'abxxcd' will be treated as 'ab')
  10010. that = that.slice(0, actual)
  10011. }
  10012. return that
  10013. }
  10014. function fromArrayLike (that, array) {
  10015. var length = array.length < 0 ? 0 : checked(array.length) | 0
  10016. that = createBuffer(that, length)
  10017. for (var i = 0; i < length; i += 1) {
  10018. that[i] = array[i] & 255
  10019. }
  10020. return that
  10021. }
  10022. function fromArrayBuffer (that, array, byteOffset, length) {
  10023. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  10024. if (byteOffset < 0 || array.byteLength < byteOffset) {
  10025. throw new RangeError('\'offset\' is out of bounds')
  10026. }
  10027. if (array.byteLength < byteOffset + (length || 0)) {
  10028. throw new RangeError('\'length\' is out of bounds')
  10029. }
  10030. if (byteOffset === undefined && length === undefined) {
  10031. array = new Uint8Array(array)
  10032. } else if (length === undefined) {
  10033. array = new Uint8Array(array, byteOffset)
  10034. } else {
  10035. array = new Uint8Array(array, byteOffset, length)
  10036. }
  10037. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10038. // Return an augmented `Uint8Array` instance, for best performance
  10039. that = array
  10040. that.__proto__ = Buffer.prototype
  10041. } else {
  10042. // Fallback: Return an object instance of the Buffer class
  10043. that = fromArrayLike(that, array)
  10044. }
  10045. return that
  10046. }
  10047. function fromObject (that, obj) {
  10048. if (Buffer.isBuffer(obj)) {
  10049. var len = checked(obj.length) | 0
  10050. that = createBuffer(that, len)
  10051. if (that.length === 0) {
  10052. return that
  10053. }
  10054. obj.copy(that, 0, 0, len)
  10055. return that
  10056. }
  10057. if (obj) {
  10058. if ((typeof ArrayBuffer !== 'undefined' &&
  10059. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  10060. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  10061. return createBuffer(that, 0)
  10062. }
  10063. return fromArrayLike(that, obj)
  10064. }
  10065. if (obj.type === 'Buffer' && isArray(obj.data)) {
  10066. return fromArrayLike(that, obj.data)
  10067. }
  10068. }
  10069. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  10070. }
  10071. function checked (length) {
  10072. // Note: cannot use `length < kMaxLength()` here because that fails when
  10073. // length is NaN (which is otherwise coerced to zero.)
  10074. if (length >= kMaxLength()) {
  10075. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  10076. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  10077. }
  10078. return length | 0
  10079. }
  10080. function SlowBuffer (length) {
  10081. if (+length != length) { // eslint-disable-line eqeqeq
  10082. length = 0
  10083. }
  10084. return Buffer.alloc(+length)
  10085. }
  10086. Buffer.isBuffer = function isBuffer (b) {
  10087. return !!(b != null && b._isBuffer)
  10088. }
  10089. Buffer.compare = function compare (a, b) {
  10090. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  10091. throw new TypeError('Arguments must be Buffers')
  10092. }
  10093. if (a === b) return 0
  10094. var x = a.length
  10095. var y = b.length
  10096. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  10097. if (a[i] !== b[i]) {
  10098. x = a[i]
  10099. y = b[i]
  10100. break
  10101. }
  10102. }
  10103. if (x < y) return -1
  10104. if (y < x) return 1
  10105. return 0
  10106. }
  10107. Buffer.isEncoding = function isEncoding (encoding) {
  10108. switch (String(encoding).toLowerCase()) {
  10109. case 'hex':
  10110. case 'utf8':
  10111. case 'utf-8':
  10112. case 'ascii':
  10113. case 'latin1':
  10114. case 'binary':
  10115. case 'base64':
  10116. case 'ucs2':
  10117. case 'ucs-2':
  10118. case 'utf16le':
  10119. case 'utf-16le':
  10120. return true
  10121. default:
  10122. return false
  10123. }
  10124. }
  10125. Buffer.concat = function concat (list, length) {
  10126. if (!isArray(list)) {
  10127. throw new TypeError('"list" argument must be an Array of Buffers')
  10128. }
  10129. if (list.length === 0) {
  10130. return Buffer.alloc(0)
  10131. }
  10132. var i
  10133. if (length === undefined) {
  10134. length = 0
  10135. for (i = 0; i < list.length; ++i) {
  10136. length += list[i].length
  10137. }
  10138. }
  10139. var buffer = Buffer.allocUnsafe(length)
  10140. var pos = 0
  10141. for (i = 0; i < list.length; ++i) {
  10142. var buf = list[i]
  10143. if (!Buffer.isBuffer(buf)) {
  10144. throw new TypeError('"list" argument must be an Array of Buffers')
  10145. }
  10146. buf.copy(buffer, pos)
  10147. pos += buf.length
  10148. }
  10149. return buffer
  10150. }
  10151. function byteLength (string, encoding) {
  10152. if (Buffer.isBuffer(string)) {
  10153. return string.length
  10154. }
  10155. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  10156. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  10157. return string.byteLength
  10158. }
  10159. if (typeof string !== 'string') {
  10160. string = '' + string
  10161. }
  10162. var len = string.length
  10163. if (len === 0) return 0
  10164. // Use a for loop to avoid recursion
  10165. var loweredCase = false
  10166. for (;;) {
  10167. switch (encoding) {
  10168. case 'ascii':
  10169. case 'latin1':
  10170. case 'binary':
  10171. return len
  10172. case 'utf8':
  10173. case 'utf-8':
  10174. case undefined:
  10175. return utf8ToBytes(string).length
  10176. case 'ucs2':
  10177. case 'ucs-2':
  10178. case 'utf16le':
  10179. case 'utf-16le':
  10180. return len * 2
  10181. case 'hex':
  10182. return len >>> 1
  10183. case 'base64':
  10184. return base64ToBytes(string).length
  10185. default:
  10186. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  10187. encoding = ('' + encoding).toLowerCase()
  10188. loweredCase = true
  10189. }
  10190. }
  10191. }
  10192. Buffer.byteLength = byteLength
  10193. function slowToString (encoding, start, end) {
  10194. var loweredCase = false
  10195. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  10196. // property of a typed array.
  10197. // This behaves neither like String nor Uint8Array in that we set start/end
  10198. // to their upper/lower bounds if the value passed is out of range.
  10199. // undefined is handled specially as per ECMA-262 6th Edition,
  10200. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  10201. if (start === undefined || start < 0) {
  10202. start = 0
  10203. }
  10204. // Return early if start > this.length. Done here to prevent potential uint32
  10205. // coercion fail below.
  10206. if (start > this.length) {
  10207. return ''
  10208. }
  10209. if (end === undefined || end > this.length) {
  10210. end = this.length
  10211. }
  10212. if (end <= 0) {
  10213. return ''
  10214. }
  10215. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  10216. end >>>= 0
  10217. start >>>= 0
  10218. if (end <= start) {
  10219. return ''
  10220. }
  10221. if (!encoding) encoding = 'utf8'
  10222. while (true) {
  10223. switch (encoding) {
  10224. case 'hex':
  10225. return hexSlice(this, start, end)
  10226. case 'utf8':
  10227. case 'utf-8':
  10228. return utf8Slice(this, start, end)
  10229. case 'ascii':
  10230. return asciiSlice(this, start, end)
  10231. case 'latin1':
  10232. case 'binary':
  10233. return latin1Slice(this, start, end)
  10234. case 'base64':
  10235. return base64Slice(this, start, end)
  10236. case 'ucs2':
  10237. case 'ucs-2':
  10238. case 'utf16le':
  10239. case 'utf-16le':
  10240. return utf16leSlice(this, start, end)
  10241. default:
  10242. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  10243. encoding = (encoding + '').toLowerCase()
  10244. loweredCase = true
  10245. }
  10246. }
  10247. }
  10248. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  10249. // Buffer instances.
  10250. Buffer.prototype._isBuffer = true
  10251. function swap (b, n, m) {
  10252. var i = b[n]
  10253. b[n] = b[m]
  10254. b[m] = i
  10255. }
  10256. Buffer.prototype.swap16 = function swap16 () {
  10257. var len = this.length
  10258. if (len % 2 !== 0) {
  10259. throw new RangeError('Buffer size must be a multiple of 16-bits')
  10260. }
  10261. for (var i = 0; i < len; i += 2) {
  10262. swap(this, i, i + 1)
  10263. }
  10264. return this
  10265. }
  10266. Buffer.prototype.swap32 = function swap32 () {
  10267. var len = this.length
  10268. if (len % 4 !== 0) {
  10269. throw new RangeError('Buffer size must be a multiple of 32-bits')
  10270. }
  10271. for (var i = 0; i < len; i += 4) {
  10272. swap(this, i, i + 3)
  10273. swap(this, i + 1, i + 2)
  10274. }
  10275. return this
  10276. }
  10277. Buffer.prototype.swap64 = function swap64 () {
  10278. var len = this.length
  10279. if (len % 8 !== 0) {
  10280. throw new RangeError('Buffer size must be a multiple of 64-bits')
  10281. }
  10282. for (var i = 0; i < len; i += 8) {
  10283. swap(this, i, i + 7)
  10284. swap(this, i + 1, i + 6)
  10285. swap(this, i + 2, i + 5)
  10286. swap(this, i + 3, i + 4)
  10287. }
  10288. return this
  10289. }
  10290. Buffer.prototype.toString = function toString () {
  10291. var length = this.length | 0
  10292. if (length === 0) return ''
  10293. if (arguments.length === 0) return utf8Slice(this, 0, length)
  10294. return slowToString.apply(this, arguments)
  10295. }
  10296. Buffer.prototype.equals = function equals (b) {
  10297. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  10298. if (this === b) return true
  10299. return Buffer.compare(this, b) === 0
  10300. }
  10301. Buffer.prototype.inspect = function inspect () {
  10302. var str = ''
  10303. var max = exports.INSPECT_MAX_BYTES
  10304. if (this.length > 0) {
  10305. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  10306. if (this.length > max) str += ' ... '
  10307. }
  10308. return '<Buffer ' + str + '>'
  10309. }
  10310. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  10311. if (!Buffer.isBuffer(target)) {
  10312. throw new TypeError('Argument must be a Buffer')
  10313. }
  10314. if (start === undefined) {
  10315. start = 0
  10316. }
  10317. if (end === undefined) {
  10318. end = target ? target.length : 0
  10319. }
  10320. if (thisStart === undefined) {
  10321. thisStart = 0
  10322. }
  10323. if (thisEnd === undefined) {
  10324. thisEnd = this.length
  10325. }
  10326. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  10327. throw new RangeError('out of range index')
  10328. }
  10329. if (thisStart >= thisEnd && start >= end) {
  10330. return 0
  10331. }
  10332. if (thisStart >= thisEnd) {
  10333. return -1
  10334. }
  10335. if (start >= end) {
  10336. return 1
  10337. }
  10338. start >>>= 0
  10339. end >>>= 0
  10340. thisStart >>>= 0
  10341. thisEnd >>>= 0
  10342. if (this === target) return 0
  10343. var x = thisEnd - thisStart
  10344. var y = end - start
  10345. var len = Math.min(x, y)
  10346. var thisCopy = this.slice(thisStart, thisEnd)
  10347. var targetCopy = target.slice(start, end)
  10348. for (var i = 0; i < len; ++i) {
  10349. if (thisCopy[i] !== targetCopy[i]) {
  10350. x = thisCopy[i]
  10351. y = targetCopy[i]
  10352. break
  10353. }
  10354. }
  10355. if (x < y) return -1
  10356. if (y < x) return 1
  10357. return 0
  10358. }
  10359. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  10360. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  10361. //
  10362. // Arguments:
  10363. // - buffer - a Buffer to search
  10364. // - val - a string, Buffer, or number
  10365. // - byteOffset - an index into `buffer`; will be clamped to an int32
  10366. // - encoding - an optional encoding, relevant is val is a string
  10367. // - dir - true for indexOf, false for lastIndexOf
  10368. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  10369. // Empty buffer means no match
  10370. if (buffer.length === 0) return -1
  10371. // Normalize byteOffset
  10372. if (typeof byteOffset === 'string') {
  10373. encoding = byteOffset
  10374. byteOffset = 0
  10375. } else if (byteOffset > 0x7fffffff) {
  10376. byteOffset = 0x7fffffff
  10377. } else if (byteOffset < -0x80000000) {
  10378. byteOffset = -0x80000000
  10379. }
  10380. byteOffset = +byteOffset // Coerce to Number.
  10381. if (isNaN(byteOffset)) {
  10382. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  10383. byteOffset = dir ? 0 : (buffer.length - 1)
  10384. }
  10385. // Normalize byteOffset: negative offsets start from the end of the buffer
  10386. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  10387. if (byteOffset >= buffer.length) {
  10388. if (dir) return -1
  10389. else byteOffset = buffer.length - 1
  10390. } else if (byteOffset < 0) {
  10391. if (dir) byteOffset = 0
  10392. else return -1
  10393. }
  10394. // Normalize val
  10395. if (typeof val === 'string') {
  10396. val = Buffer.from(val, encoding)
  10397. }
  10398. // Finally, search either indexOf (if dir is true) or lastIndexOf
  10399. if (Buffer.isBuffer(val)) {
  10400. // Special case: looking for empty string/buffer always fails
  10401. if (val.length === 0) {
  10402. return -1
  10403. }
  10404. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  10405. } else if (typeof val === 'number') {
  10406. val = val & 0xFF // Search for a byte value [0-255]
  10407. if (Buffer.TYPED_ARRAY_SUPPORT &&
  10408. typeof Uint8Array.prototype.indexOf === 'function') {
  10409. if (dir) {
  10410. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  10411. } else {
  10412. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  10413. }
  10414. }
  10415. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  10416. }
  10417. throw new TypeError('val must be string, number or Buffer')
  10418. }
  10419. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  10420. var indexSize = 1
  10421. var arrLength = arr.length
  10422. var valLength = val.length
  10423. if (encoding !== undefined) {
  10424. encoding = String(encoding).toLowerCase()
  10425. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  10426. encoding === 'utf16le' || encoding === 'utf-16le') {
  10427. if (arr.length < 2 || val.length < 2) {
  10428. return -1
  10429. }
  10430. indexSize = 2
  10431. arrLength /= 2
  10432. valLength /= 2
  10433. byteOffset /= 2
  10434. }
  10435. }
  10436. function read (buf, i) {
  10437. if (indexSize === 1) {
  10438. return buf[i]
  10439. } else {
  10440. return buf.readUInt16BE(i * indexSize)
  10441. }
  10442. }
  10443. var i
  10444. if (dir) {
  10445. var foundIndex = -1
  10446. for (i = byteOffset; i < arrLength; i++) {
  10447. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  10448. if (foundIndex === -1) foundIndex = i
  10449. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  10450. } else {
  10451. if (foundIndex !== -1) i -= i - foundIndex
  10452. foundIndex = -1
  10453. }
  10454. }
  10455. } else {
  10456. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  10457. for (i = byteOffset; i >= 0; i--) {
  10458. var found = true
  10459. for (var j = 0; j < valLength; j++) {
  10460. if (read(arr, i + j) !== read(val, j)) {
  10461. found = false
  10462. break
  10463. }
  10464. }
  10465. if (found) return i
  10466. }
  10467. }
  10468. return -1
  10469. }
  10470. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  10471. return this.indexOf(val, byteOffset, encoding) !== -1
  10472. }
  10473. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  10474. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  10475. }
  10476. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  10477. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  10478. }
  10479. function hexWrite (buf, string, offset, length) {
  10480. offset = Number(offset) || 0
  10481. var remaining = buf.length - offset
  10482. if (!length) {
  10483. length = remaining
  10484. } else {
  10485. length = Number(length)
  10486. if (length > remaining) {
  10487. length = remaining
  10488. }
  10489. }
  10490. // must be an even number of digits
  10491. var strLen = string.length
  10492. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  10493. if (length > strLen / 2) {
  10494. length = strLen / 2
  10495. }
  10496. for (var i = 0; i < length; ++i) {
  10497. var parsed = parseInt(string.substr(i * 2, 2), 16)
  10498. if (isNaN(parsed)) return i
  10499. buf[offset + i] = parsed
  10500. }
  10501. return i
  10502. }
  10503. function utf8Write (buf, string, offset, length) {
  10504. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  10505. }
  10506. function asciiWrite (buf, string, offset, length) {
  10507. return blitBuffer(asciiToBytes(string), buf, offset, length)
  10508. }
  10509. function latin1Write (buf, string, offset, length) {
  10510. return asciiWrite(buf, string, offset, length)
  10511. }
  10512. function base64Write (buf, string, offset, length) {
  10513. return blitBuffer(base64ToBytes(string), buf, offset, length)
  10514. }
  10515. function ucs2Write (buf, string, offset, length) {
  10516. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  10517. }
  10518. Buffer.prototype.write = function write (string, offset, length, encoding) {
  10519. // Buffer#write(string)
  10520. if (offset === undefined) {
  10521. encoding = 'utf8'
  10522. length = this.length
  10523. offset = 0
  10524. // Buffer#write(string, encoding)
  10525. } else if (length === undefined && typeof offset === 'string') {
  10526. encoding = offset
  10527. length = this.length
  10528. offset = 0
  10529. // Buffer#write(string, offset[, length][, encoding])
  10530. } else if (isFinite(offset)) {
  10531. offset = offset | 0
  10532. if (isFinite(length)) {
  10533. length = length | 0
  10534. if (encoding === undefined) encoding = 'utf8'
  10535. } else {
  10536. encoding = length
  10537. length = undefined
  10538. }
  10539. // legacy write(string, encoding, offset, length) - remove in v0.13
  10540. } else {
  10541. throw new Error(
  10542. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  10543. )
  10544. }
  10545. var remaining = this.length - offset
  10546. if (length === undefined || length > remaining) length = remaining
  10547. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  10548. throw new RangeError('Attempt to write outside buffer bounds')
  10549. }
  10550. if (!encoding) encoding = 'utf8'
  10551. var loweredCase = false
  10552. for (;;) {
  10553. switch (encoding) {
  10554. case 'hex':
  10555. return hexWrite(this, string, offset, length)
  10556. case 'utf8':
  10557. case 'utf-8':
  10558. return utf8Write(this, string, offset, length)
  10559. case 'ascii':
  10560. return asciiWrite(this, string, offset, length)
  10561. case 'latin1':
  10562. case 'binary':
  10563. return latin1Write(this, string, offset, length)
  10564. case 'base64':
  10565. // Warning: maxLength not taken into account in base64Write
  10566. return base64Write(this, string, offset, length)
  10567. case 'ucs2':
  10568. case 'ucs-2':
  10569. case 'utf16le':
  10570. case 'utf-16le':
  10571. return ucs2Write(this, string, offset, length)
  10572. default:
  10573. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  10574. encoding = ('' + encoding).toLowerCase()
  10575. loweredCase = true
  10576. }
  10577. }
  10578. }
  10579. Buffer.prototype.toJSON = function toJSON () {
  10580. return {
  10581. type: 'Buffer',
  10582. data: Array.prototype.slice.call(this._arr || this, 0)
  10583. }
  10584. }
  10585. function base64Slice (buf, start, end) {
  10586. if (start === 0 && end === buf.length) {
  10587. return base64.fromByteArray(buf)
  10588. } else {
  10589. return base64.fromByteArray(buf.slice(start, end))
  10590. }
  10591. }
  10592. function utf8Slice (buf, start, end) {
  10593. end = Math.min(buf.length, end)
  10594. var res = []
  10595. var i = start
  10596. while (i < end) {
  10597. var firstByte = buf[i]
  10598. var codePoint = null
  10599. var bytesPerSequence = (firstByte > 0xEF) ? 4
  10600. : (firstByte > 0xDF) ? 3
  10601. : (firstByte > 0xBF) ? 2
  10602. : 1
  10603. if (i + bytesPerSequence <= end) {
  10604. var secondByte, thirdByte, fourthByte, tempCodePoint
  10605. switch (bytesPerSequence) {
  10606. case 1:
  10607. if (firstByte < 0x80) {
  10608. codePoint = firstByte
  10609. }
  10610. break
  10611. case 2:
  10612. secondByte = buf[i + 1]
  10613. if ((secondByte & 0xC0) === 0x80) {
  10614. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  10615. if (tempCodePoint > 0x7F) {
  10616. codePoint = tempCodePoint
  10617. }
  10618. }
  10619. break
  10620. case 3:
  10621. secondByte = buf[i + 1]
  10622. thirdByte = buf[i + 2]
  10623. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  10624. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  10625. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  10626. codePoint = tempCodePoint
  10627. }
  10628. }
  10629. break
  10630. case 4:
  10631. secondByte = buf[i + 1]
  10632. thirdByte = buf[i + 2]
  10633. fourthByte = buf[i + 3]
  10634. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  10635. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  10636. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  10637. codePoint = tempCodePoint
  10638. }
  10639. }
  10640. }
  10641. }
  10642. if (codePoint === null) {
  10643. // we did not generate a valid codePoint so insert a
  10644. // replacement char (U+FFFD) and advance only 1 byte
  10645. codePoint = 0xFFFD
  10646. bytesPerSequence = 1
  10647. } else if (codePoint > 0xFFFF) {
  10648. // encode to utf16 (surrogate pair dance)
  10649. codePoint -= 0x10000
  10650. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  10651. codePoint = 0xDC00 | codePoint & 0x3FF
  10652. }
  10653. res.push(codePoint)
  10654. i += bytesPerSequence
  10655. }
  10656. return decodeCodePointsArray(res)
  10657. }
  10658. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  10659. // the lowest limit is Chrome, with 0x10000 args.
  10660. // We go 1 magnitude less, for safety
  10661. var MAX_ARGUMENTS_LENGTH = 0x1000
  10662. function decodeCodePointsArray (codePoints) {
  10663. var len = codePoints.length
  10664. if (len <= MAX_ARGUMENTS_LENGTH) {
  10665. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  10666. }
  10667. // Decode in chunks to avoid "call stack size exceeded".
  10668. var res = ''
  10669. var i = 0
  10670. while (i < len) {
  10671. res += String.fromCharCode.apply(
  10672. String,
  10673. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  10674. )
  10675. }
  10676. return res
  10677. }
  10678. function asciiSlice (buf, start, end) {
  10679. var ret = ''
  10680. end = Math.min(buf.length, end)
  10681. for (var i = start; i < end; ++i) {
  10682. ret += String.fromCharCode(buf[i] & 0x7F)
  10683. }
  10684. return ret
  10685. }
  10686. function latin1Slice (buf, start, end) {
  10687. var ret = ''
  10688. end = Math.min(buf.length, end)
  10689. for (var i = start; i < end; ++i) {
  10690. ret += String.fromCharCode(buf[i])
  10691. }
  10692. return ret
  10693. }
  10694. function hexSlice (buf, start, end) {
  10695. var len = buf.length
  10696. if (!start || start < 0) start = 0
  10697. if (!end || end < 0 || end > len) end = len
  10698. var out = ''
  10699. for (var i = start; i < end; ++i) {
  10700. out += toHex(buf[i])
  10701. }
  10702. return out
  10703. }
  10704. function utf16leSlice (buf, start, end) {
  10705. var bytes = buf.slice(start, end)
  10706. var res = ''
  10707. for (var i = 0; i < bytes.length; i += 2) {
  10708. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  10709. }
  10710. return res
  10711. }
  10712. Buffer.prototype.slice = function slice (start, end) {
  10713. var len = this.length
  10714. start = ~~start
  10715. end = end === undefined ? len : ~~end
  10716. if (start < 0) {
  10717. start += len
  10718. if (start < 0) start = 0
  10719. } else if (start > len) {
  10720. start = len
  10721. }
  10722. if (end < 0) {
  10723. end += len
  10724. if (end < 0) end = 0
  10725. } else if (end > len) {
  10726. end = len
  10727. }
  10728. if (end < start) end = start
  10729. var newBuf
  10730. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10731. newBuf = this.subarray(start, end)
  10732. newBuf.__proto__ = Buffer.prototype
  10733. } else {
  10734. var sliceLen = end - start
  10735. newBuf = new Buffer(sliceLen, undefined)
  10736. for (var i = 0; i < sliceLen; ++i) {
  10737. newBuf[i] = this[i + start]
  10738. }
  10739. }
  10740. return newBuf
  10741. }
  10742. /*
  10743. * Need to make sure that buffer isn't trying to write out of bounds.
  10744. */
  10745. function checkOffset (offset, ext, length) {
  10746. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  10747. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  10748. }
  10749. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  10750. offset = offset | 0
  10751. byteLength = byteLength | 0
  10752. if (!noAssert) checkOffset(offset, byteLength, this.length)
  10753. var val = this[offset]
  10754. var mul = 1
  10755. var i = 0
  10756. while (++i < byteLength && (mul *= 0x100)) {
  10757. val += this[offset + i] * mul
  10758. }
  10759. return val
  10760. }
  10761. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  10762. offset = offset | 0
  10763. byteLength = byteLength | 0
  10764. if (!noAssert) {
  10765. checkOffset(offset, byteLength, this.length)
  10766. }
  10767. var val = this[offset + --byteLength]
  10768. var mul = 1
  10769. while (byteLength > 0 && (mul *= 0x100)) {
  10770. val += this[offset + --byteLength] * mul
  10771. }
  10772. return val
  10773. }
  10774. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  10775. if (!noAssert) checkOffset(offset, 1, this.length)
  10776. return this[offset]
  10777. }
  10778. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  10779. if (!noAssert) checkOffset(offset, 2, this.length)
  10780. return this[offset] | (this[offset + 1] << 8)
  10781. }
  10782. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  10783. if (!noAssert) checkOffset(offset, 2, this.length)
  10784. return (this[offset] << 8) | this[offset + 1]
  10785. }
  10786. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  10787. if (!noAssert) checkOffset(offset, 4, this.length)
  10788. return ((this[offset]) |
  10789. (this[offset + 1] << 8) |
  10790. (this[offset + 2] << 16)) +
  10791. (this[offset + 3] * 0x1000000)
  10792. }
  10793. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  10794. if (!noAssert) checkOffset(offset, 4, this.length)
  10795. return (this[offset] * 0x1000000) +
  10796. ((this[offset + 1] << 16) |
  10797. (this[offset + 2] << 8) |
  10798. this[offset + 3])
  10799. }
  10800. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  10801. offset = offset | 0
  10802. byteLength = byteLength | 0
  10803. if (!noAssert) checkOffset(offset, byteLength, this.length)
  10804. var val = this[offset]
  10805. var mul = 1
  10806. var i = 0
  10807. while (++i < byteLength && (mul *= 0x100)) {
  10808. val += this[offset + i] * mul
  10809. }
  10810. mul *= 0x80
  10811. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  10812. return val
  10813. }
  10814. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  10815. offset = offset | 0
  10816. byteLength = byteLength | 0
  10817. if (!noAssert) checkOffset(offset, byteLength, this.length)
  10818. var i = byteLength
  10819. var mul = 1
  10820. var val = this[offset + --i]
  10821. while (i > 0 && (mul *= 0x100)) {
  10822. val += this[offset + --i] * mul
  10823. }
  10824. mul *= 0x80
  10825. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  10826. return val
  10827. }
  10828. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  10829. if (!noAssert) checkOffset(offset, 1, this.length)
  10830. if (!(this[offset] & 0x80)) return (this[offset])
  10831. return ((0xff - this[offset] + 1) * -1)
  10832. }
  10833. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  10834. if (!noAssert) checkOffset(offset, 2, this.length)
  10835. var val = this[offset] | (this[offset + 1] << 8)
  10836. return (val & 0x8000) ? val | 0xFFFF0000 : val
  10837. }
  10838. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  10839. if (!noAssert) checkOffset(offset, 2, this.length)
  10840. var val = this[offset + 1] | (this[offset] << 8)
  10841. return (val & 0x8000) ? val | 0xFFFF0000 : val
  10842. }
  10843. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  10844. if (!noAssert) checkOffset(offset, 4, this.length)
  10845. return (this[offset]) |
  10846. (this[offset + 1] << 8) |
  10847. (this[offset + 2] << 16) |
  10848. (this[offset + 3] << 24)
  10849. }
  10850. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  10851. if (!noAssert) checkOffset(offset, 4, this.length)
  10852. return (this[offset] << 24) |
  10853. (this[offset + 1] << 16) |
  10854. (this[offset + 2] << 8) |
  10855. (this[offset + 3])
  10856. }
  10857. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  10858. if (!noAssert) checkOffset(offset, 4, this.length)
  10859. return ieee754.read(this, offset, true, 23, 4)
  10860. }
  10861. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  10862. if (!noAssert) checkOffset(offset, 4, this.length)
  10863. return ieee754.read(this, offset, false, 23, 4)
  10864. }
  10865. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  10866. if (!noAssert) checkOffset(offset, 8, this.length)
  10867. return ieee754.read(this, offset, true, 52, 8)
  10868. }
  10869. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  10870. if (!noAssert) checkOffset(offset, 8, this.length)
  10871. return ieee754.read(this, offset, false, 52, 8)
  10872. }
  10873. function checkInt (buf, value, offset, ext, max, min) {
  10874. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  10875. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  10876. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  10877. }
  10878. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  10879. value = +value
  10880. offset = offset | 0
  10881. byteLength = byteLength | 0
  10882. if (!noAssert) {
  10883. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  10884. checkInt(this, value, offset, byteLength, maxBytes, 0)
  10885. }
  10886. var mul = 1
  10887. var i = 0
  10888. this[offset] = value & 0xFF
  10889. while (++i < byteLength && (mul *= 0x100)) {
  10890. this[offset + i] = (value / mul) & 0xFF
  10891. }
  10892. return offset + byteLength
  10893. }
  10894. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  10895. value = +value
  10896. offset = offset | 0
  10897. byteLength = byteLength | 0
  10898. if (!noAssert) {
  10899. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  10900. checkInt(this, value, offset, byteLength, maxBytes, 0)
  10901. }
  10902. var i = byteLength - 1
  10903. var mul = 1
  10904. this[offset + i] = value & 0xFF
  10905. while (--i >= 0 && (mul *= 0x100)) {
  10906. this[offset + i] = (value / mul) & 0xFF
  10907. }
  10908. return offset + byteLength
  10909. }
  10910. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  10911. value = +value
  10912. offset = offset | 0
  10913. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  10914. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  10915. this[offset] = (value & 0xff)
  10916. return offset + 1
  10917. }
  10918. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  10919. if (value < 0) value = 0xffff + value + 1
  10920. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  10921. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  10922. (littleEndian ? i : 1 - i) * 8
  10923. }
  10924. }
  10925. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  10926. value = +value
  10927. offset = offset | 0
  10928. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  10929. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10930. this[offset] = (value & 0xff)
  10931. this[offset + 1] = (value >>> 8)
  10932. } else {
  10933. objectWriteUInt16(this, value, offset, true)
  10934. }
  10935. return offset + 2
  10936. }
  10937. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  10938. value = +value
  10939. offset = offset | 0
  10940. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  10941. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10942. this[offset] = (value >>> 8)
  10943. this[offset + 1] = (value & 0xff)
  10944. } else {
  10945. objectWriteUInt16(this, value, offset, false)
  10946. }
  10947. return offset + 2
  10948. }
  10949. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  10950. if (value < 0) value = 0xffffffff + value + 1
  10951. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  10952. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  10953. }
  10954. }
  10955. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  10956. value = +value
  10957. offset = offset | 0
  10958. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  10959. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10960. this[offset + 3] = (value >>> 24)
  10961. this[offset + 2] = (value >>> 16)
  10962. this[offset + 1] = (value >>> 8)
  10963. this[offset] = (value & 0xff)
  10964. } else {
  10965. objectWriteUInt32(this, value, offset, true)
  10966. }
  10967. return offset + 4
  10968. }
  10969. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  10970. value = +value
  10971. offset = offset | 0
  10972. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  10973. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10974. this[offset] = (value >>> 24)
  10975. this[offset + 1] = (value >>> 16)
  10976. this[offset + 2] = (value >>> 8)
  10977. this[offset + 3] = (value & 0xff)
  10978. } else {
  10979. objectWriteUInt32(this, value, offset, false)
  10980. }
  10981. return offset + 4
  10982. }
  10983. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  10984. value = +value
  10985. offset = offset | 0
  10986. if (!noAssert) {
  10987. var limit = Math.pow(2, 8 * byteLength - 1)
  10988. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  10989. }
  10990. var i = 0
  10991. var mul = 1
  10992. var sub = 0
  10993. this[offset] = value & 0xFF
  10994. while (++i < byteLength && (mul *= 0x100)) {
  10995. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  10996. sub = 1
  10997. }
  10998. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  10999. }
  11000. return offset + byteLength
  11001. }
  11002. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  11003. value = +value
  11004. offset = offset | 0
  11005. if (!noAssert) {
  11006. var limit = Math.pow(2, 8 * byteLength - 1)
  11007. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  11008. }
  11009. var i = byteLength - 1
  11010. var mul = 1
  11011. var sub = 0
  11012. this[offset + i] = value & 0xFF
  11013. while (--i >= 0 && (mul *= 0x100)) {
  11014. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  11015. sub = 1
  11016. }
  11017. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  11018. }
  11019. return offset + byteLength
  11020. }
  11021. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  11022. value = +value
  11023. offset = offset | 0
  11024. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  11025. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  11026. if (value < 0) value = 0xff + value + 1
  11027. this[offset] = (value & 0xff)
  11028. return offset + 1
  11029. }
  11030. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  11031. value = +value
  11032. offset = offset | 0
  11033. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  11034. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11035. this[offset] = (value & 0xff)
  11036. this[offset + 1] = (value >>> 8)
  11037. } else {
  11038. objectWriteUInt16(this, value, offset, true)
  11039. }
  11040. return offset + 2
  11041. }
  11042. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  11043. value = +value
  11044. offset = offset | 0
  11045. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  11046. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11047. this[offset] = (value >>> 8)
  11048. this[offset + 1] = (value & 0xff)
  11049. } else {
  11050. objectWriteUInt16(this, value, offset, false)
  11051. }
  11052. return offset + 2
  11053. }
  11054. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  11055. value = +value
  11056. offset = offset | 0
  11057. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  11058. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11059. this[offset] = (value & 0xff)
  11060. this[offset + 1] = (value >>> 8)
  11061. this[offset + 2] = (value >>> 16)
  11062. this[offset + 3] = (value >>> 24)
  11063. } else {
  11064. objectWriteUInt32(this, value, offset, true)
  11065. }
  11066. return offset + 4
  11067. }
  11068. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  11069. value = +value
  11070. offset = offset | 0
  11071. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  11072. if (value < 0) value = 0xffffffff + value + 1
  11073. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11074. this[offset] = (value >>> 24)
  11075. this[offset + 1] = (value >>> 16)
  11076. this[offset + 2] = (value >>> 8)
  11077. this[offset + 3] = (value & 0xff)
  11078. } else {
  11079. objectWriteUInt32(this, value, offset, false)
  11080. }
  11081. return offset + 4
  11082. }
  11083. function checkIEEE754 (buf, value, offset, ext, max, min) {
  11084. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  11085. if (offset < 0) throw new RangeError('Index out of range')
  11086. }
  11087. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  11088. if (!noAssert) {
  11089. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  11090. }
  11091. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  11092. return offset + 4
  11093. }
  11094. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  11095. return writeFloat(this, value, offset, true, noAssert)
  11096. }
  11097. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  11098. return writeFloat(this, value, offset, false, noAssert)
  11099. }
  11100. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  11101. if (!noAssert) {
  11102. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  11103. }
  11104. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  11105. return offset + 8
  11106. }
  11107. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  11108. return writeDouble(this, value, offset, true, noAssert)
  11109. }
  11110. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  11111. return writeDouble(this, value, offset, false, noAssert)
  11112. }
  11113. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  11114. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  11115. if (!start) start = 0
  11116. if (!end && end !== 0) end = this.length
  11117. if (targetStart >= target.length) targetStart = target.length
  11118. if (!targetStart) targetStart = 0
  11119. if (end > 0 && end < start) end = start
  11120. // Copy 0 bytes; we're done
  11121. if (end === start) return 0
  11122. if (target.length === 0 || this.length === 0) return 0
  11123. // Fatal error conditions
  11124. if (targetStart < 0) {
  11125. throw new RangeError('targetStart out of bounds')
  11126. }
  11127. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  11128. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  11129. // Are we oob?
  11130. if (end > this.length) end = this.length
  11131. if (target.length - targetStart < end - start) {
  11132. end = target.length - targetStart + start
  11133. }
  11134. var len = end - start
  11135. var i
  11136. if (this === target && start < targetStart && targetStart < end) {
  11137. // descending copy from end
  11138. for (i = len - 1; i >= 0; --i) {
  11139. target[i + targetStart] = this[i + start]
  11140. }
  11141. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  11142. // ascending copy from start
  11143. for (i = 0; i < len; ++i) {
  11144. target[i + targetStart] = this[i + start]
  11145. }
  11146. } else {
  11147. Uint8Array.prototype.set.call(
  11148. target,
  11149. this.subarray(start, start + len),
  11150. targetStart
  11151. )
  11152. }
  11153. return len
  11154. }
  11155. // Usage:
  11156. // buffer.fill(number[, offset[, end]])
  11157. // buffer.fill(buffer[, offset[, end]])
  11158. // buffer.fill(string[, offset[, end]][, encoding])
  11159. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  11160. // Handle string cases:
  11161. if (typeof val === 'string') {
  11162. if (typeof start === 'string') {
  11163. encoding = start
  11164. start = 0
  11165. end = this.length
  11166. } else if (typeof end === 'string') {
  11167. encoding = end
  11168. end = this.length
  11169. }
  11170. if (val.length === 1) {
  11171. var code = val.charCodeAt(0)
  11172. if (code < 256) {
  11173. val = code
  11174. }
  11175. }
  11176. if (encoding !== undefined && typeof encoding !== 'string') {
  11177. throw new TypeError('encoding must be a string')
  11178. }
  11179. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  11180. throw new TypeError('Unknown encoding: ' + encoding)
  11181. }
  11182. } else if (typeof val === 'number') {
  11183. val = val & 255
  11184. }
  11185. // Invalid ranges are not set to a default, so can range check early.
  11186. if (start < 0 || this.length < start || this.length < end) {
  11187. throw new RangeError('Out of range index')
  11188. }
  11189. if (end <= start) {
  11190. return this
  11191. }
  11192. start = start >>> 0
  11193. end = end === undefined ? this.length : end >>> 0
  11194. if (!val) val = 0
  11195. var i
  11196. if (typeof val === 'number') {
  11197. for (i = start; i < end; ++i) {
  11198. this[i] = val
  11199. }
  11200. } else {
  11201. var bytes = Buffer.isBuffer(val)
  11202. ? val
  11203. : utf8ToBytes(new Buffer(val, encoding).toString())
  11204. var len = bytes.length
  11205. for (i = 0; i < end - start; ++i) {
  11206. this[i + start] = bytes[i % len]
  11207. }
  11208. }
  11209. return this
  11210. }
  11211. // HELPER FUNCTIONS
  11212. // ================
  11213. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  11214. function base64clean (str) {
  11215. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  11216. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  11217. // Node converts strings with length < 2 to ''
  11218. if (str.length < 2) return ''
  11219. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  11220. while (str.length % 4 !== 0) {
  11221. str = str + '='
  11222. }
  11223. return str
  11224. }
  11225. function stringtrim (str) {
  11226. if (str.trim) return str.trim()
  11227. return str.replace(/^\s+|\s+$/g, '')
  11228. }
  11229. function toHex (n) {
  11230. if (n < 16) return '0' + n.toString(16)
  11231. return n.toString(16)
  11232. }
  11233. function utf8ToBytes (string, units) {
  11234. units = units || Infinity
  11235. var codePoint
  11236. var length = string.length
  11237. var leadSurrogate = null
  11238. var bytes = []
  11239. for (var i = 0; i < length; ++i) {
  11240. codePoint = string.charCodeAt(i)
  11241. // is surrogate component
  11242. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  11243. // last char was a lead
  11244. if (!leadSurrogate) {
  11245. // no lead yet
  11246. if (codePoint > 0xDBFF) {
  11247. // unexpected trail
  11248. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11249. continue
  11250. } else if (i + 1 === length) {
  11251. // unpaired lead
  11252. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11253. continue
  11254. }
  11255. // valid lead
  11256. leadSurrogate = codePoint
  11257. continue
  11258. }
  11259. // 2 leads in a row
  11260. if (codePoint < 0xDC00) {
  11261. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11262. leadSurrogate = codePoint
  11263. continue
  11264. }
  11265. // valid surrogate pair
  11266. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  11267. } else if (leadSurrogate) {
  11268. // valid bmp char, but last char was a lead
  11269. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11270. }
  11271. leadSurrogate = null
  11272. // encode utf8
  11273. if (codePoint < 0x80) {
  11274. if ((units -= 1) < 0) break
  11275. bytes.push(codePoint)
  11276. } else if (codePoint < 0x800) {
  11277. if ((units -= 2) < 0) break
  11278. bytes.push(
  11279. codePoint >> 0x6 | 0xC0,
  11280. codePoint & 0x3F | 0x80
  11281. )
  11282. } else if (codePoint < 0x10000) {
  11283. if ((units -= 3) < 0) break
  11284. bytes.push(
  11285. codePoint >> 0xC | 0xE0,
  11286. codePoint >> 0x6 & 0x3F | 0x80,
  11287. codePoint & 0x3F | 0x80
  11288. )
  11289. } else if (codePoint < 0x110000) {
  11290. if ((units -= 4) < 0) break
  11291. bytes.push(
  11292. codePoint >> 0x12 | 0xF0,
  11293. codePoint >> 0xC & 0x3F | 0x80,
  11294. codePoint >> 0x6 & 0x3F | 0x80,
  11295. codePoint & 0x3F | 0x80
  11296. )
  11297. } else {
  11298. throw new Error('Invalid code point')
  11299. }
  11300. }
  11301. return bytes
  11302. }
  11303. function asciiToBytes (str) {
  11304. var byteArray = []
  11305. for (var i = 0; i < str.length; ++i) {
  11306. // Node's code seems to be doing this and not & 0x7F..
  11307. byteArray.push(str.charCodeAt(i) & 0xFF)
  11308. }
  11309. return byteArray
  11310. }
  11311. function utf16leToBytes (str, units) {
  11312. var c, hi, lo
  11313. var byteArray = []
  11314. for (var i = 0; i < str.length; ++i) {
  11315. if ((units -= 2) < 0) break
  11316. c = str.charCodeAt(i)
  11317. hi = c >> 8
  11318. lo = c % 256
  11319. byteArray.push(lo)
  11320. byteArray.push(hi)
  11321. }
  11322. return byteArray
  11323. }
  11324. function base64ToBytes (str) {
  11325. return base64.toByteArray(base64clean(str))
  11326. }
  11327. function blitBuffer (src, dst, offset, length) {
  11328. for (var i = 0; i < length; ++i) {
  11329. if ((i + offset >= dst.length) || (i >= src.length)) break
  11330. dst[i + offset] = src[i]
  11331. }
  11332. return i
  11333. }
  11334. function isnan (val) {
  11335. return val !== val // eslint-disable-line no-self-compare
  11336. }
  11337. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3)))
  11338. /***/ }),
  11339. /* 116 */
  11340. /*!*****************************************!*\
  11341. !*** ./node_modules/base64-js/index.js ***!
  11342. \*****************************************/
  11343. /*! no static exports found */
  11344. /***/ (function(module, exports, __webpack_require__) {
  11345. "use strict";
  11346. exports.byteLength = byteLength
  11347. exports.toByteArray = toByteArray
  11348. exports.fromByteArray = fromByteArray
  11349. var lookup = []
  11350. var revLookup = []
  11351. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  11352. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  11353. for (var i = 0, len = code.length; i < len; ++i) {
  11354. lookup[i] = code[i]
  11355. revLookup[code.charCodeAt(i)] = i
  11356. }
  11357. // Support decoding URL-safe base64 strings, as Node.js does.
  11358. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  11359. revLookup['-'.charCodeAt(0)] = 62
  11360. revLookup['_'.charCodeAt(0)] = 63
  11361. function getLens (b64) {
  11362. var len = b64.length
  11363. if (len % 4 > 0) {
  11364. throw new Error('Invalid string. Length must be a multiple of 4')
  11365. }
  11366. // Trim off extra bytes after placeholder bytes are found
  11367. // See: https://github.com/beatgammit/base64-js/issues/42
  11368. var validLen = b64.indexOf('=')
  11369. if (validLen === -1) validLen = len
  11370. var placeHoldersLen = validLen === len
  11371. ? 0
  11372. : 4 - (validLen % 4)
  11373. return [validLen, placeHoldersLen]
  11374. }
  11375. // base64 is 4/3 + up to two characters of the original data
  11376. function byteLength (b64) {
  11377. var lens = getLens(b64)
  11378. var validLen = lens[0]
  11379. var placeHoldersLen = lens[1]
  11380. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  11381. }
  11382. function _byteLength (b64, validLen, placeHoldersLen) {
  11383. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  11384. }
  11385. function toByteArray (b64) {
  11386. var tmp
  11387. var lens = getLens(b64)
  11388. var validLen = lens[0]
  11389. var placeHoldersLen = lens[1]
  11390. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  11391. var curByte = 0
  11392. // if there are placeholders, only get up to the last complete 4 chars
  11393. var len = placeHoldersLen > 0
  11394. ? validLen - 4
  11395. : validLen
  11396. var i
  11397. for (i = 0; i < len; i += 4) {
  11398. tmp =
  11399. (revLookup[b64.charCodeAt(i)] << 18) |
  11400. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  11401. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  11402. revLookup[b64.charCodeAt(i + 3)]
  11403. arr[curByte++] = (tmp >> 16) & 0xFF
  11404. arr[curByte++] = (tmp >> 8) & 0xFF
  11405. arr[curByte++] = tmp & 0xFF
  11406. }
  11407. if (placeHoldersLen === 2) {
  11408. tmp =
  11409. (revLookup[b64.charCodeAt(i)] << 2) |
  11410. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  11411. arr[curByte++] = tmp & 0xFF
  11412. }
  11413. if (placeHoldersLen === 1) {
  11414. tmp =
  11415. (revLookup[b64.charCodeAt(i)] << 10) |
  11416. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  11417. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  11418. arr[curByte++] = (tmp >> 8) & 0xFF
  11419. arr[curByte++] = tmp & 0xFF
  11420. }
  11421. return arr
  11422. }
  11423. function tripletToBase64 (num) {
  11424. return lookup[num >> 18 & 0x3F] +
  11425. lookup[num >> 12 & 0x3F] +
  11426. lookup[num >> 6 & 0x3F] +
  11427. lookup[num & 0x3F]
  11428. }
  11429. function encodeChunk (uint8, start, end) {
  11430. var tmp
  11431. var output = []
  11432. for (var i = start; i < end; i += 3) {
  11433. tmp =
  11434. ((uint8[i] << 16) & 0xFF0000) +
  11435. ((uint8[i + 1] << 8) & 0xFF00) +
  11436. (uint8[i + 2] & 0xFF)
  11437. output.push(tripletToBase64(tmp))
  11438. }
  11439. return output.join('')
  11440. }
  11441. function fromByteArray (uint8) {
  11442. var tmp
  11443. var len = uint8.length
  11444. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  11445. var parts = []
  11446. var maxChunkLength = 16383 // must be multiple of 3
  11447. // go through the array every three bytes, we'll deal with trailing stuff later
  11448. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  11449. parts.push(encodeChunk(
  11450. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  11451. ))
  11452. }
  11453. // pad the end with zeros, but make sure to not forget the extra bytes
  11454. if (extraBytes === 1) {
  11455. tmp = uint8[len - 1]
  11456. parts.push(
  11457. lookup[tmp >> 2] +
  11458. lookup[(tmp << 4) & 0x3F] +
  11459. '=='
  11460. )
  11461. } else if (extraBytes === 2) {
  11462. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  11463. parts.push(
  11464. lookup[tmp >> 10] +
  11465. lookup[(tmp >> 4) & 0x3F] +
  11466. lookup[(tmp << 2) & 0x3F] +
  11467. '='
  11468. )
  11469. }
  11470. return parts.join('')
  11471. }
  11472. /***/ }),
  11473. /* 117 */
  11474. /*!***************************************!*\
  11475. !*** ./node_modules/ieee754/index.js ***!
  11476. \***************************************/
  11477. /*! no static exports found */
  11478. /***/ (function(module, exports) {
  11479. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  11480. var e, m
  11481. var eLen = (nBytes * 8) - mLen - 1
  11482. var eMax = (1 << eLen) - 1
  11483. var eBias = eMax >> 1
  11484. var nBits = -7
  11485. var i = isLE ? (nBytes - 1) : 0
  11486. var d = isLE ? -1 : 1
  11487. var s = buffer[offset + i]
  11488. i += d
  11489. e = s & ((1 << (-nBits)) - 1)
  11490. s >>= (-nBits)
  11491. nBits += eLen
  11492. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11493. m = e & ((1 << (-nBits)) - 1)
  11494. e >>= (-nBits)
  11495. nBits += mLen
  11496. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11497. if (e === 0) {
  11498. e = 1 - eBias
  11499. } else if (e === eMax) {
  11500. return m ? NaN : ((s ? -1 : 1) * Infinity)
  11501. } else {
  11502. m = m + Math.pow(2, mLen)
  11503. e = e - eBias
  11504. }
  11505. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  11506. }
  11507. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  11508. var e, m, c
  11509. var eLen = (nBytes * 8) - mLen - 1
  11510. var eMax = (1 << eLen) - 1
  11511. var eBias = eMax >> 1
  11512. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  11513. var i = isLE ? 0 : (nBytes - 1)
  11514. var d = isLE ? 1 : -1
  11515. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  11516. value = Math.abs(value)
  11517. if (isNaN(value) || value === Infinity) {
  11518. m = isNaN(value) ? 1 : 0
  11519. e = eMax
  11520. } else {
  11521. e = Math.floor(Math.log(value) / Math.LN2)
  11522. if (value * (c = Math.pow(2, -e)) < 1) {
  11523. e--
  11524. c *= 2
  11525. }
  11526. if (e + eBias >= 1) {
  11527. value += rt / c
  11528. } else {
  11529. value += rt * Math.pow(2, 1 - eBias)
  11530. }
  11531. if (value * c >= 2) {
  11532. e++
  11533. c /= 2
  11534. }
  11535. if (e + eBias >= eMax) {
  11536. m = 0
  11537. e = eMax
  11538. } else if (e + eBias >= 1) {
  11539. m = ((value * c) - 1) * Math.pow(2, mLen)
  11540. e = e + eBias
  11541. } else {
  11542. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  11543. e = 0
  11544. }
  11545. }
  11546. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  11547. e = (e << mLen) | m
  11548. eLen += mLen
  11549. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  11550. buffer[offset + i - d] |= s * 128
  11551. }
  11552. /***/ }),
  11553. /* 118 */
  11554. /*!***************************************!*\
  11555. !*** ./node_modules/isarray/index.js ***!
  11556. \***************************************/
  11557. /*! no static exports found */
  11558. /***/ (function(module, exports) {
  11559. var toString = {}.toString;
  11560. module.exports = Array.isArray || function (arr) {
  11561. return toString.call(arr) == '[object Array]';
  11562. };
  11563. /***/ }),
  11564. /* 119 */
  11565. /*!*********************************************!*\
  11566. !*** ./node_modules/create-hash/browser.js ***!
  11567. \*********************************************/
  11568. /*! no static exports found */
  11569. /***/ (function(module, exports, __webpack_require__) {
  11570. "use strict";
  11571. var inherits = __webpack_require__(/*! inherits */ 120)
  11572. var MD5 = __webpack_require__(/*! md5.js */ 121)
  11573. var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 139)
  11574. var sha = __webpack_require__(/*! sha.js */ 140)
  11575. var Base = __webpack_require__(/*! cipher-base */ 148)
  11576. function Hash (hash) {
  11577. Base.call(this, 'digest')
  11578. this._hash = hash
  11579. }
  11580. inherits(Hash, Base)
  11581. Hash.prototype._update = function (data) {
  11582. this._hash.update(data)
  11583. }
  11584. Hash.prototype._final = function () {
  11585. return this._hash.digest()
  11586. }
  11587. module.exports = function createHash (alg) {
  11588. alg = alg.toLowerCase()
  11589. if (alg === 'md5') return new MD5()
  11590. if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()
  11591. return new Hash(sha(alg))
  11592. }
  11593. /***/ }),
  11594. /* 120 */
  11595. /*!***************************************************!*\
  11596. !*** ./node_modules/inherits/inherits_browser.js ***!
  11597. \***************************************************/
  11598. /*! no static exports found */
  11599. /***/ (function(module, exports) {
  11600. if (typeof Object.create === 'function') {
  11601. // implementation from standard node.js 'util' module
  11602. module.exports = function inherits(ctor, superCtor) {
  11603. if (superCtor) {
  11604. ctor.super_ = superCtor
  11605. ctor.prototype = Object.create(superCtor.prototype, {
  11606. constructor: {
  11607. value: ctor,
  11608. enumerable: false,
  11609. writable: true,
  11610. configurable: true
  11611. }
  11612. })
  11613. }
  11614. };
  11615. } else {
  11616. // old school shim for old browsers
  11617. module.exports = function inherits(ctor, superCtor) {
  11618. if (superCtor) {
  11619. ctor.super_ = superCtor
  11620. var TempCtor = function () {}
  11621. TempCtor.prototype = superCtor.prototype
  11622. ctor.prototype = new TempCtor()
  11623. ctor.prototype.constructor = ctor
  11624. }
  11625. }
  11626. }
  11627. /***/ }),
  11628. /* 121 */
  11629. /*!**************************************!*\
  11630. !*** ./node_modules/md5.js/index.js ***!
  11631. \**************************************/
  11632. /*! no static exports found */
  11633. /***/ (function(module, exports, __webpack_require__) {
  11634. "use strict";
  11635. var inherits = __webpack_require__(/*! inherits */ 120)
  11636. var HashBase = __webpack_require__(/*! hash-base */ 122)
  11637. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  11638. var ARRAY16 = new Array(16)
  11639. function MD5 () {
  11640. HashBase.call(this, 64)
  11641. // state
  11642. this._a = 0x67452301
  11643. this._b = 0xefcdab89
  11644. this._c = 0x98badcfe
  11645. this._d = 0x10325476
  11646. }
  11647. inherits(MD5, HashBase)
  11648. MD5.prototype._update = function () {
  11649. var M = ARRAY16
  11650. for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4)
  11651. var a = this._a
  11652. var b = this._b
  11653. var c = this._c
  11654. var d = this._d
  11655. a = fnF(a, b, c, d, M[0], 0xd76aa478, 7)
  11656. d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12)
  11657. c = fnF(c, d, a, b, M[2], 0x242070db, 17)
  11658. b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22)
  11659. a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7)
  11660. d = fnF(d, a, b, c, M[5], 0x4787c62a, 12)
  11661. c = fnF(c, d, a, b, M[6], 0xa8304613, 17)
  11662. b = fnF(b, c, d, a, M[7], 0xfd469501, 22)
  11663. a = fnF(a, b, c, d, M[8], 0x698098d8, 7)
  11664. d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12)
  11665. c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17)
  11666. b = fnF(b, c, d, a, M[11], 0x895cd7be, 22)
  11667. a = fnF(a, b, c, d, M[12], 0x6b901122, 7)
  11668. d = fnF(d, a, b, c, M[13], 0xfd987193, 12)
  11669. c = fnF(c, d, a, b, M[14], 0xa679438e, 17)
  11670. b = fnF(b, c, d, a, M[15], 0x49b40821, 22)
  11671. a = fnG(a, b, c, d, M[1], 0xf61e2562, 5)
  11672. d = fnG(d, a, b, c, M[6], 0xc040b340, 9)
  11673. c = fnG(c, d, a, b, M[11], 0x265e5a51, 14)
  11674. b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20)
  11675. a = fnG(a, b, c, d, M[5], 0xd62f105d, 5)
  11676. d = fnG(d, a, b, c, M[10], 0x02441453, 9)
  11677. c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14)
  11678. b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20)
  11679. a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5)
  11680. d = fnG(d, a, b, c, M[14], 0xc33707d6, 9)
  11681. c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14)
  11682. b = fnG(b, c, d, a, M[8], 0x455a14ed, 20)
  11683. a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5)
  11684. d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9)
  11685. c = fnG(c, d, a, b, M[7], 0x676f02d9, 14)
  11686. b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20)
  11687. a = fnH(a, b, c, d, M[5], 0xfffa3942, 4)
  11688. d = fnH(d, a, b, c, M[8], 0x8771f681, 11)
  11689. c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16)
  11690. b = fnH(b, c, d, a, M[14], 0xfde5380c, 23)
  11691. a = fnH(a, b, c, d, M[1], 0xa4beea44, 4)
  11692. d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11)
  11693. c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16)
  11694. b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23)
  11695. a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4)
  11696. d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11)
  11697. c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16)
  11698. b = fnH(b, c, d, a, M[6], 0x04881d05, 23)
  11699. a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4)
  11700. d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11)
  11701. c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16)
  11702. b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23)
  11703. a = fnI(a, b, c, d, M[0], 0xf4292244, 6)
  11704. d = fnI(d, a, b, c, M[7], 0x432aff97, 10)
  11705. c = fnI(c, d, a, b, M[14], 0xab9423a7, 15)
  11706. b = fnI(b, c, d, a, M[5], 0xfc93a039, 21)
  11707. a = fnI(a, b, c, d, M[12], 0x655b59c3, 6)
  11708. d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10)
  11709. c = fnI(c, d, a, b, M[10], 0xffeff47d, 15)
  11710. b = fnI(b, c, d, a, M[1], 0x85845dd1, 21)
  11711. a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6)
  11712. d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10)
  11713. c = fnI(c, d, a, b, M[6], 0xa3014314, 15)
  11714. b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21)
  11715. a = fnI(a, b, c, d, M[4], 0xf7537e82, 6)
  11716. d = fnI(d, a, b, c, M[11], 0xbd3af235, 10)
  11717. c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15)
  11718. b = fnI(b, c, d, a, M[9], 0xeb86d391, 21)
  11719. this._a = (this._a + a) | 0
  11720. this._b = (this._b + b) | 0
  11721. this._c = (this._c + c) | 0
  11722. this._d = (this._d + d) | 0
  11723. }
  11724. MD5.prototype._digest = function () {
  11725. // create padding and handle blocks
  11726. this._block[this._blockOffset++] = 0x80
  11727. if (this._blockOffset > 56) {
  11728. this._block.fill(0, this._blockOffset, 64)
  11729. this._update()
  11730. this._blockOffset = 0
  11731. }
  11732. this._block.fill(0, this._blockOffset, 56)
  11733. this._block.writeUInt32LE(this._length[0], 56)
  11734. this._block.writeUInt32LE(this._length[1], 60)
  11735. this._update()
  11736. // produce result
  11737. var buffer = Buffer.allocUnsafe(16)
  11738. buffer.writeInt32LE(this._a, 0)
  11739. buffer.writeInt32LE(this._b, 4)
  11740. buffer.writeInt32LE(this._c, 8)
  11741. buffer.writeInt32LE(this._d, 12)
  11742. return buffer
  11743. }
  11744. function rotl (x, n) {
  11745. return (x << n) | (x >>> (32 - n))
  11746. }
  11747. function fnF (a, b, c, d, m, k, s) {
  11748. return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0
  11749. }
  11750. function fnG (a, b, c, d, m, k, s) {
  11751. return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0
  11752. }
  11753. function fnH (a, b, c, d, m, k, s) {
  11754. return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0
  11755. }
  11756. function fnI (a, b, c, d, m, k, s) {
  11757. return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0
  11758. }
  11759. module.exports = MD5
  11760. /***/ }),
  11761. /* 122 */
  11762. /*!*****************************************!*\
  11763. !*** ./node_modules/hash-base/index.js ***!
  11764. \*****************************************/
  11765. /*! no static exports found */
  11766. /***/ (function(module, exports, __webpack_require__) {
  11767. "use strict";
  11768. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  11769. var Transform = __webpack_require__(/*! readable-stream */ 123).Transform
  11770. var inherits = __webpack_require__(/*! inherits */ 120)
  11771. function throwIfNotStringOrBuffer (val, prefix) {
  11772. if (!Buffer.isBuffer(val) && typeof val !== 'string') {
  11773. throw new TypeError(prefix + ' must be a string or a buffer')
  11774. }
  11775. }
  11776. function HashBase (blockSize) {
  11777. Transform.call(this)
  11778. this._block = Buffer.allocUnsafe(blockSize)
  11779. this._blockSize = blockSize
  11780. this._blockOffset = 0
  11781. this._length = [0, 0, 0, 0]
  11782. this._finalized = false
  11783. }
  11784. inherits(HashBase, Transform)
  11785. HashBase.prototype._transform = function (chunk, encoding, callback) {
  11786. var error = null
  11787. try {
  11788. this.update(chunk, encoding)
  11789. } catch (err) {
  11790. error = err
  11791. }
  11792. callback(error)
  11793. }
  11794. HashBase.prototype._flush = function (callback) {
  11795. var error = null
  11796. try {
  11797. this.push(this.digest())
  11798. } catch (err) {
  11799. error = err
  11800. }
  11801. callback(error)
  11802. }
  11803. HashBase.prototype.update = function (data, encoding) {
  11804. throwIfNotStringOrBuffer(data, 'Data')
  11805. if (this._finalized) throw new Error('Digest already called')
  11806. if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
  11807. // consume data
  11808. var block = this._block
  11809. var offset = 0
  11810. while (this._blockOffset + data.length - offset >= this._blockSize) {
  11811. for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]
  11812. this._update()
  11813. this._blockOffset = 0
  11814. }
  11815. while (offset < data.length) block[this._blockOffset++] = data[offset++]
  11816. // update length
  11817. for (var j = 0, carry = data.length * 8; carry > 0; ++j) {
  11818. this._length[j] += carry
  11819. carry = (this._length[j] / 0x0100000000) | 0
  11820. if (carry > 0) this._length[j] -= 0x0100000000 * carry
  11821. }
  11822. return this
  11823. }
  11824. HashBase.prototype._update = function () {
  11825. throw new Error('_update is not implemented')
  11826. }
  11827. HashBase.prototype.digest = function (encoding) {
  11828. if (this._finalized) throw new Error('Digest already called')
  11829. this._finalized = true
  11830. var digest = this._digest()
  11831. if (encoding !== undefined) digest = digest.toString(encoding)
  11832. // reset state
  11833. this._block.fill(0)
  11834. this._blockOffset = 0
  11835. for (var i = 0; i < 4; ++i) this._length[i] = 0
  11836. return digest
  11837. }
  11838. HashBase.prototype._digest = function () {
  11839. throw new Error('_digest is not implemented')
  11840. }
  11841. module.exports = HashBase
  11842. /***/ }),
  11843. /* 123 */
  11844. /*!**********************************************************!*\
  11845. !*** ./node_modules/readable-stream/readable-browser.js ***!
  11846. \**********************************************************/
  11847. /*! no static exports found */
  11848. /***/ (function(module, exports, __webpack_require__) {
  11849. exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ 124);
  11850. exports.Stream = exports;
  11851. exports.Readable = exports;
  11852. exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ 134);
  11853. exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ 133);
  11854. exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ 137);
  11855. exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ 138);
  11856. /***/ }),
  11857. /* 124 */
  11858. /*!**************************************************************!*\
  11859. !*** ./node_modules/readable-stream/lib/_stream_readable.js ***!
  11860. \**************************************************************/
  11861. /*! no static exports found */
  11862. /***/ (function(module, exports, __webpack_require__) {
  11863. "use strict";
  11864. /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
  11865. //
  11866. // Permission is hereby granted, free of charge, to any person obtaining a
  11867. // copy of this software and associated documentation files (the
  11868. // "Software"), to deal in the Software without restriction, including
  11869. // without limitation the rights to use, copy, modify, merge, publish,
  11870. // distribute, sublicense, and/or sell copies of the Software, and to permit
  11871. // persons to whom the Software is furnished to do so, subject to the
  11872. // following conditions:
  11873. //
  11874. // The above copyright notice and this permission notice shall be included
  11875. // in all copies or substantial portions of the Software.
  11876. //
  11877. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  11878. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11879. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  11880. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  11881. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  11882. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  11883. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  11884. /*<replacement>*/
  11885. var pna = __webpack_require__(/*! process-nextick-args */ 125);
  11886. /*</replacement>*/
  11887. module.exports = Readable;
  11888. /*<replacement>*/
  11889. var isArray = __webpack_require__(/*! isarray */ 118);
  11890. /*</replacement>*/
  11891. /*<replacement>*/
  11892. var Duplex;
  11893. /*</replacement>*/
  11894. Readable.ReadableState = ReadableState;
  11895. /*<replacement>*/
  11896. var EE = __webpack_require__(/*! events */ 126).EventEmitter;
  11897. var EElistenerCount = function (emitter, type) {
  11898. return emitter.listeners(type).length;
  11899. };
  11900. /*</replacement>*/
  11901. /*<replacement>*/
  11902. var Stream = __webpack_require__(/*! ./internal/streams/stream */ 127);
  11903. /*</replacement>*/
  11904. /*<replacement>*/
  11905. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer;
  11906. var OurUint8Array = global.Uint8Array || function () {};
  11907. function _uint8ArrayToBuffer(chunk) {
  11908. return Buffer.from(chunk);
  11909. }
  11910. function _isUint8Array(obj) {
  11911. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  11912. }
  11913. /*</replacement>*/
  11914. /*<replacement>*/
  11915. var util = Object.create(__webpack_require__(/*! core-util-is */ 128));
  11916. util.inherits = __webpack_require__(/*! inherits */ 120);
  11917. /*</replacement>*/
  11918. /*<replacement>*/
  11919. var debugUtil = __webpack_require__(/*! util */ 129);
  11920. var debug = void 0;
  11921. if (debugUtil && debugUtil.debuglog) {
  11922. debug = debugUtil.debuglog('stream');
  11923. } else {
  11924. debug = function () {};
  11925. }
  11926. /*</replacement>*/
  11927. var BufferList = __webpack_require__(/*! ./internal/streams/BufferList */ 130);
  11928. var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ 132);
  11929. var StringDecoder;
  11930. util.inherits(Readable, Stream);
  11931. var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
  11932. function prependListener(emitter, event, fn) {
  11933. // Sadly this is not cacheable as some libraries bundle their own
  11934. // event emitter implementation with them.
  11935. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
  11936. // This is a hack to make sure that our error handler is attached before any
  11937. // userland ones. NEVER DO THIS. This is here only because this code needs
  11938. // to continue to work with older versions of Node.js that do not include
  11939. // the prependListener() method. The goal is to eventually remove this hack.
  11940. 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]];
  11941. }
  11942. function ReadableState(options, stream) {
  11943. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 133);
  11944. options = options || {};
  11945. // Duplex streams are both readable and writable, but share
  11946. // the same options object.
  11947. // However, some cases require setting options to different
  11948. // values for the readable and the writable sides of the duplex stream.
  11949. // These options can be provided separately as readableXXX and writableXXX.
  11950. var isDuplex = stream instanceof Duplex;
  11951. // object stream flag. Used to make read(n) ignore n and to
  11952. // make all the buffer merging and length checks go away
  11953. this.objectMode = !!options.objectMode;
  11954. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  11955. // the point at which it stops calling _read() to fill the buffer
  11956. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  11957. var hwm = options.highWaterMark;
  11958. var readableHwm = options.readableHighWaterMark;
  11959. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  11960. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
  11961. // cast to ints.
  11962. this.highWaterMark = Math.floor(this.highWaterMark);
  11963. // A linked list is used to store data chunks instead of an array because the
  11964. // linked list can remove elements from the beginning faster than
  11965. // array.shift()
  11966. this.buffer = new BufferList();
  11967. this.length = 0;
  11968. this.pipes = null;
  11969. this.pipesCount = 0;
  11970. this.flowing = null;
  11971. this.ended = false;
  11972. this.endEmitted = false;
  11973. this.reading = false;
  11974. // a flag to be able to tell if the event 'readable'/'data' is emitted
  11975. // immediately, or on a later tick. We set this to true at first, because
  11976. // any actions that shouldn't happen until "later" should generally also
  11977. // not happen before the first read call.
  11978. this.sync = true;
  11979. // whenever we return null, then we set a flag to say
  11980. // that we're awaiting a 'readable' event emission.
  11981. this.needReadable = false;
  11982. this.emittedReadable = false;
  11983. this.readableListening = false;
  11984. this.resumeScheduled = false;
  11985. // has it been destroyed
  11986. this.destroyed = false;
  11987. // Crypto is kind of old and crusty. Historically, its default string
  11988. // encoding is 'binary' so we have to make this configurable.
  11989. // Everything else in the universe uses 'utf8', though.
  11990. this.defaultEncoding = options.defaultEncoding || 'utf8';
  11991. // the number of writers that are awaiting a drain event in .pipe()s
  11992. this.awaitDrain = 0;
  11993. // if true, a maybeReadMore has been scheduled
  11994. this.readingMore = false;
  11995. this.decoder = null;
  11996. this.encoding = null;
  11997. if (options.encoding) {
  11998. if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ 136).StringDecoder;
  11999. this.decoder = new StringDecoder(options.encoding);
  12000. this.encoding = options.encoding;
  12001. }
  12002. }
  12003. function Readable(options) {
  12004. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 133);
  12005. if (!(this instanceof Readable)) return new Readable(options);
  12006. this._readableState = new ReadableState(options, this);
  12007. // legacy
  12008. this.readable = true;
  12009. if (options) {
  12010. if (typeof options.read === 'function') this._read = options.read;
  12011. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  12012. }
  12013. Stream.call(this);
  12014. }
  12015. Object.defineProperty(Readable.prototype, 'destroyed', {
  12016. get: function () {
  12017. if (this._readableState === undefined) {
  12018. return false;
  12019. }
  12020. return this._readableState.destroyed;
  12021. },
  12022. set: function (value) {
  12023. // we ignore the value if the stream
  12024. // has not been initialized yet
  12025. if (!this._readableState) {
  12026. return;
  12027. }
  12028. // backward compatibility, the user is explicitly
  12029. // managing destroyed
  12030. this._readableState.destroyed = value;
  12031. }
  12032. });
  12033. Readable.prototype.destroy = destroyImpl.destroy;
  12034. Readable.prototype._undestroy = destroyImpl.undestroy;
  12035. Readable.prototype._destroy = function (err, cb) {
  12036. this.push(null);
  12037. cb(err);
  12038. };
  12039. // Manually shove something into the read() buffer.
  12040. // This returns true if the highWaterMark has not been hit yet,
  12041. // similar to how Writable.write() returns true if you should
  12042. // write() some more.
  12043. Readable.prototype.push = function (chunk, encoding) {
  12044. var state = this._readableState;
  12045. var skipChunkCheck;
  12046. if (!state.objectMode) {
  12047. if (typeof chunk === 'string') {
  12048. encoding = encoding || state.defaultEncoding;
  12049. if (encoding !== state.encoding) {
  12050. chunk = Buffer.from(chunk, encoding);
  12051. encoding = '';
  12052. }
  12053. skipChunkCheck = true;
  12054. }
  12055. } else {
  12056. skipChunkCheck = true;
  12057. }
  12058. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  12059. };
  12060. // Unshift should *always* be something directly out of read()
  12061. Readable.prototype.unshift = function (chunk) {
  12062. return readableAddChunk(this, chunk, null, true, false);
  12063. };
  12064. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  12065. var state = stream._readableState;
  12066. if (chunk === null) {
  12067. state.reading = false;
  12068. onEofChunk(stream, state);
  12069. } else {
  12070. var er;
  12071. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  12072. if (er) {
  12073. stream.emit('error', er);
  12074. } else if (state.objectMode || chunk && chunk.length > 0) {
  12075. if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
  12076. chunk = _uint8ArrayToBuffer(chunk);
  12077. }
  12078. if (addToFront) {
  12079. if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
  12080. } else if (state.ended) {
  12081. stream.emit('error', new Error('stream.push() after EOF'));
  12082. } else {
  12083. state.reading = false;
  12084. if (state.decoder && !encoding) {
  12085. chunk = state.decoder.write(chunk);
  12086. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
  12087. } else {
  12088. addChunk(stream, state, chunk, false);
  12089. }
  12090. }
  12091. } else if (!addToFront) {
  12092. state.reading = false;
  12093. }
  12094. }
  12095. return needMoreData(state);
  12096. }
  12097. function addChunk(stream, state, chunk, addToFront) {
  12098. if (state.flowing && state.length === 0 && !state.sync) {
  12099. stream.emit('data', chunk);
  12100. stream.read(0);
  12101. } else {
  12102. // update the buffer info.
  12103. state.length += state.objectMode ? 1 : chunk.length;
  12104. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  12105. if (state.needReadable) emitReadable(stream);
  12106. }
  12107. maybeReadMore(stream, state);
  12108. }
  12109. function chunkInvalid(state, chunk) {
  12110. var er;
  12111. if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  12112. er = new TypeError('Invalid non-string/buffer chunk');
  12113. }
  12114. return er;
  12115. }
  12116. // if it's past the high water mark, we can push in some more.
  12117. // Also, if we have no data yet, we can stand some
  12118. // more bytes. This is to work around cases where hwm=0,
  12119. // such as the repl. Also, if the push() triggered a
  12120. // readable event, and the user called read(largeNumber) such that
  12121. // needReadable was set, then we ought to push more, so that another
  12122. // 'readable' event will be triggered.
  12123. function needMoreData(state) {
  12124. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  12125. }
  12126. Readable.prototype.isPaused = function () {
  12127. return this._readableState.flowing === false;
  12128. };
  12129. // backwards compatibility.
  12130. Readable.prototype.setEncoding = function (enc) {
  12131. if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ 136).StringDecoder;
  12132. this._readableState.decoder = new StringDecoder(enc);
  12133. this._readableState.encoding = enc;
  12134. return this;
  12135. };
  12136. // Don't raise the hwm > 8MB
  12137. var MAX_HWM = 0x800000;
  12138. function computeNewHighWaterMark(n) {
  12139. if (n >= MAX_HWM) {
  12140. n = MAX_HWM;
  12141. } else {
  12142. // Get the next highest power of 2 to prevent increasing hwm excessively in
  12143. // tiny amounts
  12144. n--;
  12145. n |= n >>> 1;
  12146. n |= n >>> 2;
  12147. n |= n >>> 4;
  12148. n |= n >>> 8;
  12149. n |= n >>> 16;
  12150. n++;
  12151. }
  12152. return n;
  12153. }
  12154. // This function is designed to be inlinable, so please take care when making
  12155. // changes to the function body.
  12156. function howMuchToRead(n, state) {
  12157. if (n <= 0 || state.length === 0 && state.ended) return 0;
  12158. if (state.objectMode) return 1;
  12159. if (n !== n) {
  12160. // Only flow one buffer at a time
  12161. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  12162. }
  12163. // If we're asking for more than the current hwm, then raise the hwm.
  12164. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  12165. if (n <= state.length) return n;
  12166. // Don't have enough
  12167. if (!state.ended) {
  12168. state.needReadable = true;
  12169. return 0;
  12170. }
  12171. return state.length;
  12172. }
  12173. // you can override either this method, or the async _read(n) below.
  12174. Readable.prototype.read = function (n) {
  12175. debug('read', n);
  12176. n = parseInt(n, 10);
  12177. var state = this._readableState;
  12178. var nOrig = n;
  12179. if (n !== 0) state.emittedReadable = false;
  12180. // if we're doing read(0) to trigger a readable event, but we
  12181. // already have a bunch of data in the buffer, then just trigger
  12182. // the 'readable' event and move on.
  12183. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  12184. debug('read: emitReadable', state.length, state.ended);
  12185. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  12186. return null;
  12187. }
  12188. n = howMuchToRead(n, state);
  12189. // if we've ended, and we're now clear, then finish it up.
  12190. if (n === 0 && state.ended) {
  12191. if (state.length === 0) endReadable(this);
  12192. return null;
  12193. }
  12194. // All the actual chunk generation logic needs to be
  12195. // *below* the call to _read. The reason is that in certain
  12196. // synthetic stream cases, such as passthrough streams, _read
  12197. // may be a completely synchronous operation which may change
  12198. // the state of the read buffer, providing enough data when
  12199. // before there was *not* enough.
  12200. //
  12201. // So, the steps are:
  12202. // 1. Figure out what the state of things will be after we do
  12203. // a read from the buffer.
  12204. //
  12205. // 2. If that resulting state will trigger a _read, then call _read.
  12206. // Note that this may be asynchronous, or synchronous. Yes, it is
  12207. // deeply ugly to write APIs this way, but that still doesn't mean
  12208. // that the Readable class should behave improperly, as streams are
  12209. // designed to be sync/async agnostic.
  12210. // Take note if the _read call is sync or async (ie, if the read call
  12211. // has returned yet), so that we know whether or not it's safe to emit
  12212. // 'readable' etc.
  12213. //
  12214. // 3. Actually pull the requested chunks out of the buffer and return.
  12215. // if we need a readable event, then we need to do some reading.
  12216. var doRead = state.needReadable;
  12217. debug('need readable', doRead);
  12218. // if we currently have less than the highWaterMark, then also read some
  12219. if (state.length === 0 || state.length - n < state.highWaterMark) {
  12220. doRead = true;
  12221. debug('length less than watermark', doRead);
  12222. }
  12223. // however, if we've ended, then there's no point, and if we're already
  12224. // reading, then it's unnecessary.
  12225. if (state.ended || state.reading) {
  12226. doRead = false;
  12227. debug('reading or ended', doRead);
  12228. } else if (doRead) {
  12229. debug('do read');
  12230. state.reading = true;
  12231. state.sync = true;
  12232. // if the length is currently zero, then we *need* a readable event.
  12233. if (state.length === 0) state.needReadable = true;
  12234. // call internal read method
  12235. this._read(state.highWaterMark);
  12236. state.sync = false;
  12237. // If _read pushed data synchronously, then `reading` will be false,
  12238. // and we need to re-evaluate how much data we can return to the user.
  12239. if (!state.reading) n = howMuchToRead(nOrig, state);
  12240. }
  12241. var ret;
  12242. if (n > 0) ret = fromList(n, state);else ret = null;
  12243. if (ret === null) {
  12244. state.needReadable = true;
  12245. n = 0;
  12246. } else {
  12247. state.length -= n;
  12248. }
  12249. if (state.length === 0) {
  12250. // If we have nothing in the buffer, then we want to know
  12251. // as soon as we *do* get something into the buffer.
  12252. if (!state.ended) state.needReadable = true;
  12253. // If we tried to read() past the EOF, then emit end on the next tick.
  12254. if (nOrig !== n && state.ended) endReadable(this);
  12255. }
  12256. if (ret !== null) this.emit('data', ret);
  12257. return ret;
  12258. };
  12259. function onEofChunk(stream, state) {
  12260. if (state.ended) return;
  12261. if (state.decoder) {
  12262. var chunk = state.decoder.end();
  12263. if (chunk && chunk.length) {
  12264. state.buffer.push(chunk);
  12265. state.length += state.objectMode ? 1 : chunk.length;
  12266. }
  12267. }
  12268. state.ended = true;
  12269. // emit 'readable' now to make sure it gets picked up.
  12270. emitReadable(stream);
  12271. }
  12272. // Don't emit readable right away in sync mode, because this can trigger
  12273. // another read() call => stack overflow. This way, it might trigger
  12274. // a nextTick recursion warning, but that's not so bad.
  12275. function emitReadable(stream) {
  12276. var state = stream._readableState;
  12277. state.needReadable = false;
  12278. if (!state.emittedReadable) {
  12279. debug('emitReadable', state.flowing);
  12280. state.emittedReadable = true;
  12281. if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
  12282. }
  12283. }
  12284. function emitReadable_(stream) {
  12285. debug('emit readable');
  12286. stream.emit('readable');
  12287. flow(stream);
  12288. }
  12289. // at this point, the user has presumably seen the 'readable' event,
  12290. // and called read() to consume some data. that may have triggered
  12291. // in turn another _read(n) call, in which case reading = true if
  12292. // it's in progress.
  12293. // However, if we're not ended, or reading, and the length < hwm,
  12294. // then go ahead and try to read some more preemptively.
  12295. function maybeReadMore(stream, state) {
  12296. if (!state.readingMore) {
  12297. state.readingMore = true;
  12298. pna.nextTick(maybeReadMore_, stream, state);
  12299. }
  12300. }
  12301. function maybeReadMore_(stream, state) {
  12302. var len = state.length;
  12303. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  12304. debug('maybeReadMore read 0');
  12305. stream.read(0);
  12306. if (len === state.length)
  12307. // didn't get any data, stop spinning.
  12308. break;else len = state.length;
  12309. }
  12310. state.readingMore = false;
  12311. }
  12312. // abstract method. to be overridden in specific implementation classes.
  12313. // call cb(er, data) where data is <= n in length.
  12314. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  12315. // arbitrary, and perhaps not very meaningful.
  12316. Readable.prototype._read = function (n) {
  12317. this.emit('error', new Error('_read() is not implemented'));
  12318. };
  12319. Readable.prototype.pipe = function (dest, pipeOpts) {
  12320. var src = this;
  12321. var state = this._readableState;
  12322. switch (state.pipesCount) {
  12323. case 0:
  12324. state.pipes = dest;
  12325. break;
  12326. case 1:
  12327. state.pipes = [state.pipes, dest];
  12328. break;
  12329. default:
  12330. state.pipes.push(dest);
  12331. break;
  12332. }
  12333. state.pipesCount += 1;
  12334. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  12335. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  12336. var endFn = doEnd ? onend : unpipe;
  12337. if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
  12338. dest.on('unpipe', onunpipe);
  12339. function onunpipe(readable, unpipeInfo) {
  12340. debug('onunpipe');
  12341. if (readable === src) {
  12342. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  12343. unpipeInfo.hasUnpiped = true;
  12344. cleanup();
  12345. }
  12346. }
  12347. }
  12348. function onend() {
  12349. debug('onend');
  12350. dest.end();
  12351. }
  12352. // when the dest drains, it reduces the awaitDrain counter
  12353. // on the source. This would be more elegant with a .once()
  12354. // handler in flow(), but adding and removing repeatedly is
  12355. // too slow.
  12356. var ondrain = pipeOnDrain(src);
  12357. dest.on('drain', ondrain);
  12358. var cleanedUp = false;
  12359. function cleanup() {
  12360. debug('cleanup');
  12361. // cleanup event handlers once the pipe is broken
  12362. dest.removeListener('close', onclose);
  12363. dest.removeListener('finish', onfinish);
  12364. dest.removeListener('drain', ondrain);
  12365. dest.removeListener('error', onerror);
  12366. dest.removeListener('unpipe', onunpipe);
  12367. src.removeListener('end', onend);
  12368. src.removeListener('end', unpipe);
  12369. src.removeListener('data', ondata);
  12370. cleanedUp = true;
  12371. // if the reader is waiting for a drain event from this
  12372. // specific writer, then it would cause it to never start
  12373. // flowing again.
  12374. // So, if this is awaiting a drain, then we just call it now.
  12375. // If we don't know, then assume that we are waiting for one.
  12376. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  12377. }
  12378. // If the user pushes more data while we're writing to dest then we'll end up
  12379. // in ondata again. However, we only want to increase awaitDrain once because
  12380. // dest will only emit one 'drain' event for the multiple writes.
  12381. // => Introduce a guard on increasing awaitDrain.
  12382. var increasedAwaitDrain = false;
  12383. src.on('data', ondata);
  12384. function ondata(chunk) {
  12385. debug('ondata');
  12386. increasedAwaitDrain = false;
  12387. var ret = dest.write(chunk);
  12388. if (false === ret && !increasedAwaitDrain) {
  12389. // If the user unpiped during `dest.write()`, it is possible
  12390. // to get stuck in a permanently paused state if that write
  12391. // also returned false.
  12392. // => Check whether `dest` is still a piping destination.
  12393. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  12394. debug('false write response, pause', src._readableState.awaitDrain);
  12395. src._readableState.awaitDrain++;
  12396. increasedAwaitDrain = true;
  12397. }
  12398. src.pause();
  12399. }
  12400. }
  12401. // if the dest has an error, then stop piping into it.
  12402. // however, don't suppress the throwing behavior for this.
  12403. function onerror(er) {
  12404. debug('onerror', er);
  12405. unpipe();
  12406. dest.removeListener('error', onerror);
  12407. if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  12408. }
  12409. // Make sure our error handler is attached before userland ones.
  12410. prependListener(dest, 'error', onerror);
  12411. // Both close and finish should trigger unpipe, but only once.
  12412. function onclose() {
  12413. dest.removeListener('finish', onfinish);
  12414. unpipe();
  12415. }
  12416. dest.once('close', onclose);
  12417. function onfinish() {
  12418. debug('onfinish');
  12419. dest.removeListener('close', onclose);
  12420. unpipe();
  12421. }
  12422. dest.once('finish', onfinish);
  12423. function unpipe() {
  12424. debug('unpipe');
  12425. src.unpipe(dest);
  12426. }
  12427. // tell the dest that it's being piped to
  12428. dest.emit('pipe', src);
  12429. // start the flow if it hasn't been started already.
  12430. if (!state.flowing) {
  12431. debug('pipe resume');
  12432. src.resume();
  12433. }
  12434. return dest;
  12435. };
  12436. function pipeOnDrain(src) {
  12437. return function () {
  12438. var state = src._readableState;
  12439. debug('pipeOnDrain', state.awaitDrain);
  12440. if (state.awaitDrain) state.awaitDrain--;
  12441. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  12442. state.flowing = true;
  12443. flow(src);
  12444. }
  12445. };
  12446. }
  12447. Readable.prototype.unpipe = function (dest) {
  12448. var state = this._readableState;
  12449. var unpipeInfo = { hasUnpiped: false };
  12450. // if we're not piping anywhere, then do nothing.
  12451. if (state.pipesCount === 0) return this;
  12452. // just one destination. most common case.
  12453. if (state.pipesCount === 1) {
  12454. // passed in one, but it's not the right one.
  12455. if (dest && dest !== state.pipes) return this;
  12456. if (!dest) dest = state.pipes;
  12457. // got a match.
  12458. state.pipes = null;
  12459. state.pipesCount = 0;
  12460. state.flowing = false;
  12461. if (dest) dest.emit('unpipe', this, unpipeInfo);
  12462. return this;
  12463. }
  12464. // slow case. multiple pipe destinations.
  12465. if (!dest) {
  12466. // remove all.
  12467. var dests = state.pipes;
  12468. var len = state.pipesCount;
  12469. state.pipes = null;
  12470. state.pipesCount = 0;
  12471. state.flowing = false;
  12472. for (var i = 0; i < len; i++) {
  12473. dests[i].emit('unpipe', this, unpipeInfo);
  12474. }return this;
  12475. }
  12476. // try to find the right one.
  12477. var index = indexOf(state.pipes, dest);
  12478. if (index === -1) return this;
  12479. state.pipes.splice(index, 1);
  12480. state.pipesCount -= 1;
  12481. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  12482. dest.emit('unpipe', this, unpipeInfo);
  12483. return this;
  12484. };
  12485. // set up data events if they are asked for
  12486. // Ensure readable listeners eventually get something
  12487. Readable.prototype.on = function (ev, fn) {
  12488. var res = Stream.prototype.on.call(this, ev, fn);
  12489. if (ev === 'data') {
  12490. // Start flowing on next tick if stream isn't explicitly paused
  12491. if (this._readableState.flowing !== false) this.resume();
  12492. } else if (ev === 'readable') {
  12493. var state = this._readableState;
  12494. if (!state.endEmitted && !state.readableListening) {
  12495. state.readableListening = state.needReadable = true;
  12496. state.emittedReadable = false;
  12497. if (!state.reading) {
  12498. pna.nextTick(nReadingNextTick, this);
  12499. } else if (state.length) {
  12500. emitReadable(this);
  12501. }
  12502. }
  12503. }
  12504. return res;
  12505. };
  12506. Readable.prototype.addListener = Readable.prototype.on;
  12507. function nReadingNextTick(self) {
  12508. debug('readable nexttick read 0');
  12509. self.read(0);
  12510. }
  12511. // pause() and resume() are remnants of the legacy readable stream API
  12512. // If the user uses them, then switch into old mode.
  12513. Readable.prototype.resume = function () {
  12514. var state = this._readableState;
  12515. if (!state.flowing) {
  12516. debug('resume');
  12517. state.flowing = true;
  12518. resume(this, state);
  12519. }
  12520. return this;
  12521. };
  12522. function resume(stream, state) {
  12523. if (!state.resumeScheduled) {
  12524. state.resumeScheduled = true;
  12525. pna.nextTick(resume_, stream, state);
  12526. }
  12527. }
  12528. function resume_(stream, state) {
  12529. if (!state.reading) {
  12530. debug('resume read 0');
  12531. stream.read(0);
  12532. }
  12533. state.resumeScheduled = false;
  12534. state.awaitDrain = 0;
  12535. stream.emit('resume');
  12536. flow(stream);
  12537. if (state.flowing && !state.reading) stream.read(0);
  12538. }
  12539. Readable.prototype.pause = function () {
  12540. debug('call pause flowing=%j', this._readableState.flowing);
  12541. if (false !== this._readableState.flowing) {
  12542. debug('pause');
  12543. this._readableState.flowing = false;
  12544. this.emit('pause');
  12545. }
  12546. return this;
  12547. };
  12548. function flow(stream) {
  12549. var state = stream._readableState;
  12550. debug('flow', state.flowing);
  12551. while (state.flowing && stream.read() !== null) {}
  12552. }
  12553. // wrap an old-style stream as the async data source.
  12554. // This is *not* part of the readable stream interface.
  12555. // It is an ugly unfortunate mess of history.
  12556. Readable.prototype.wrap = function (stream) {
  12557. var _this = this;
  12558. var state = this._readableState;
  12559. var paused = false;
  12560. stream.on('end', function () {
  12561. debug('wrapped end');
  12562. if (state.decoder && !state.ended) {
  12563. var chunk = state.decoder.end();
  12564. if (chunk && chunk.length) _this.push(chunk);
  12565. }
  12566. _this.push(null);
  12567. });
  12568. stream.on('data', function (chunk) {
  12569. debug('wrapped data');
  12570. if (state.decoder) chunk = state.decoder.write(chunk);
  12571. // don't skip over falsy values in objectMode
  12572. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  12573. var ret = _this.push(chunk);
  12574. if (!ret) {
  12575. paused = true;
  12576. stream.pause();
  12577. }
  12578. });
  12579. // proxy all the other methods.
  12580. // important when wrapping filters and duplexes.
  12581. for (var i in stream) {
  12582. if (this[i] === undefined && typeof stream[i] === 'function') {
  12583. this[i] = function (method) {
  12584. return function () {
  12585. return stream[method].apply(stream, arguments);
  12586. };
  12587. }(i);
  12588. }
  12589. }
  12590. // proxy certain important events.
  12591. for (var n = 0; n < kProxyEvents.length; n++) {
  12592. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  12593. }
  12594. // when we try to consume some more bytes, simply unpause the
  12595. // underlying stream.
  12596. this._read = function (n) {
  12597. debug('wrapped _read', n);
  12598. if (paused) {
  12599. paused = false;
  12600. stream.resume();
  12601. }
  12602. };
  12603. return this;
  12604. };
  12605. Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
  12606. // making it explicit this property is not enumerable
  12607. // because otherwise some prototype manipulation in
  12608. // userland will fail
  12609. enumerable: false,
  12610. get: function () {
  12611. return this._readableState.highWaterMark;
  12612. }
  12613. });
  12614. // exposed for testing purposes only.
  12615. Readable._fromList = fromList;
  12616. // Pluck off n bytes from an array of buffers.
  12617. // Length is the combined lengths of all the buffers in the list.
  12618. // This function is designed to be inlinable, so please take care when making
  12619. // changes to the function body.
  12620. function fromList(n, state) {
  12621. // nothing buffered
  12622. if (state.length === 0) return null;
  12623. var ret;
  12624. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  12625. // read it all, truncate the list
  12626. 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);
  12627. state.buffer.clear();
  12628. } else {
  12629. // read part of list
  12630. ret = fromListPartial(n, state.buffer, state.decoder);
  12631. }
  12632. return ret;
  12633. }
  12634. // Extracts only enough buffered data to satisfy the amount requested.
  12635. // This function is designed to be inlinable, so please take care when making
  12636. // changes to the function body.
  12637. function fromListPartial(n, list, hasStrings) {
  12638. var ret;
  12639. if (n < list.head.data.length) {
  12640. // slice is the same for buffers and strings
  12641. ret = list.head.data.slice(0, n);
  12642. list.head.data = list.head.data.slice(n);
  12643. } else if (n === list.head.data.length) {
  12644. // first chunk is a perfect match
  12645. ret = list.shift();
  12646. } else {
  12647. // result spans more than one buffer
  12648. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  12649. }
  12650. return ret;
  12651. }
  12652. // Copies a specified amount of characters from the list of buffered data
  12653. // chunks.
  12654. // This function is designed to be inlinable, so please take care when making
  12655. // changes to the function body.
  12656. function copyFromBufferString(n, list) {
  12657. var p = list.head;
  12658. var c = 1;
  12659. var ret = p.data;
  12660. n -= ret.length;
  12661. while (p = p.next) {
  12662. var str = p.data;
  12663. var nb = n > str.length ? str.length : n;
  12664. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  12665. n -= nb;
  12666. if (n === 0) {
  12667. if (nb === str.length) {
  12668. ++c;
  12669. if (p.next) list.head = p.next;else list.head = list.tail = null;
  12670. } else {
  12671. list.head = p;
  12672. p.data = str.slice(nb);
  12673. }
  12674. break;
  12675. }
  12676. ++c;
  12677. }
  12678. list.length -= c;
  12679. return ret;
  12680. }
  12681. // Copies a specified amount of bytes from the list of buffered data chunks.
  12682. // This function is designed to be inlinable, so please take care when making
  12683. // changes to the function body.
  12684. function copyFromBuffer(n, list) {
  12685. var ret = Buffer.allocUnsafe(n);
  12686. var p = list.head;
  12687. var c = 1;
  12688. p.data.copy(ret);
  12689. n -= p.data.length;
  12690. while (p = p.next) {
  12691. var buf = p.data;
  12692. var nb = n > buf.length ? buf.length : n;
  12693. buf.copy(ret, ret.length - n, 0, nb);
  12694. n -= nb;
  12695. if (n === 0) {
  12696. if (nb === buf.length) {
  12697. ++c;
  12698. if (p.next) list.head = p.next;else list.head = list.tail = null;
  12699. } else {
  12700. list.head = p;
  12701. p.data = buf.slice(nb);
  12702. }
  12703. break;
  12704. }
  12705. ++c;
  12706. }
  12707. list.length -= c;
  12708. return ret;
  12709. }
  12710. function endReadable(stream) {
  12711. var state = stream._readableState;
  12712. // If we get here before consuming all the bytes, then that is a
  12713. // bug in node. Should never happen.
  12714. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  12715. if (!state.endEmitted) {
  12716. state.ended = true;
  12717. pna.nextTick(endReadableNT, state, stream);
  12718. }
  12719. }
  12720. function endReadableNT(state, stream) {
  12721. // Check that we didn't get one last unshift.
  12722. if (!state.endEmitted && state.length === 0) {
  12723. state.endEmitted = true;
  12724. stream.readable = false;
  12725. stream.emit('end');
  12726. }
  12727. }
  12728. function indexOf(xs, x) {
  12729. for (var i = 0, l = xs.length; i < l; i++) {
  12730. if (xs[i] === x) return i;
  12731. }
  12732. return -1;
  12733. }
  12734. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 112)))
  12735. /***/ }),
  12736. /* 125 */
  12737. /*!****************************************************!*\
  12738. !*** ./node_modules/process-nextick-args/index.js ***!
  12739. \****************************************************/
  12740. /*! no static exports found */
  12741. /***/ (function(module, exports, __webpack_require__) {
  12742. "use strict";
  12743. /* WEBPACK VAR INJECTION */(function(process) {
  12744. if (typeof process === 'undefined' ||
  12745. !process.version ||
  12746. process.version.indexOf('v0.') === 0 ||
  12747. process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  12748. module.exports = { nextTick: nextTick };
  12749. } else {
  12750. module.exports = process
  12751. }
  12752. function nextTick(fn, arg1, arg2, arg3) {
  12753. if (typeof fn !== 'function') {
  12754. throw new TypeError('"callback" argument must be a function');
  12755. }
  12756. var len = arguments.length;
  12757. var args, i;
  12758. switch (len) {
  12759. case 0:
  12760. case 1:
  12761. return process.nextTick(fn);
  12762. case 2:
  12763. return process.nextTick(function afterTickOne() {
  12764. fn.call(null, arg1);
  12765. });
  12766. case 3:
  12767. return process.nextTick(function afterTickTwo() {
  12768. fn.call(null, arg1, arg2);
  12769. });
  12770. case 4:
  12771. return process.nextTick(function afterTickThree() {
  12772. fn.call(null, arg1, arg2, arg3);
  12773. });
  12774. default:
  12775. args = new Array(len - 1);
  12776. i = 0;
  12777. while (i < args.length) {
  12778. args[i++] = arguments[i];
  12779. }
  12780. return process.nextTick(function afterTick() {
  12781. fn.apply(null, args);
  12782. });
  12783. }
  12784. }
  12785. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 112)))
  12786. /***/ }),
  12787. /* 126 */
  12788. /*!***************************************!*\
  12789. !*** ./node_modules/events/events.js ***!
  12790. \***************************************/
  12791. /*! no static exports found */
  12792. /***/ (function(module, exports, __webpack_require__) {
  12793. "use strict";
  12794. // Copyright Joyent, Inc. and other Node contributors.
  12795. //
  12796. // Permission is hereby granted, free of charge, to any person obtaining a
  12797. // copy of this software and associated documentation files (the
  12798. // "Software"), to deal in the Software without restriction, including
  12799. // without limitation the rights to use, copy, modify, merge, publish,
  12800. // distribute, sublicense, and/or sell copies of the Software, and to permit
  12801. // persons to whom the Software is furnished to do so, subject to the
  12802. // following conditions:
  12803. //
  12804. // The above copyright notice and this permission notice shall be included
  12805. // in all copies or substantial portions of the Software.
  12806. //
  12807. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  12808. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  12809. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  12810. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  12811. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  12812. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  12813. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  12814. var R = typeof Reflect === 'object' ? Reflect : null
  12815. var ReflectApply = R && typeof R.apply === 'function'
  12816. ? R.apply
  12817. : function ReflectApply(target, receiver, args) {
  12818. return Function.prototype.apply.call(target, receiver, args);
  12819. }
  12820. var ReflectOwnKeys
  12821. if (R && typeof R.ownKeys === 'function') {
  12822. ReflectOwnKeys = R.ownKeys
  12823. } else if (Object.getOwnPropertySymbols) {
  12824. ReflectOwnKeys = function ReflectOwnKeys(target) {
  12825. return Object.getOwnPropertyNames(target)
  12826. .concat(Object.getOwnPropertySymbols(target));
  12827. };
  12828. } else {
  12829. ReflectOwnKeys = function ReflectOwnKeys(target) {
  12830. return Object.getOwnPropertyNames(target);
  12831. };
  12832. }
  12833. function ProcessEmitWarning(warning) {
  12834. if (console && console.warn) console.warn(warning);
  12835. }
  12836. var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
  12837. return value !== value;
  12838. }
  12839. function EventEmitter() {
  12840. EventEmitter.init.call(this);
  12841. }
  12842. module.exports = EventEmitter;
  12843. // Backwards-compat with node 0.10.x
  12844. EventEmitter.EventEmitter = EventEmitter;
  12845. EventEmitter.prototype._events = undefined;
  12846. EventEmitter.prototype._eventsCount = 0;
  12847. EventEmitter.prototype._maxListeners = undefined;
  12848. // By default EventEmitters will print a warning if more than 10 listeners are
  12849. // added to it. This is a useful default which helps finding memory leaks.
  12850. var defaultMaxListeners = 10;
  12851. function checkListener(listener) {
  12852. if (typeof listener !== 'function') {
  12853. throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
  12854. }
  12855. }
  12856. Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
  12857. enumerable: true,
  12858. get: function() {
  12859. return defaultMaxListeners;
  12860. },
  12861. set: function(arg) {
  12862. if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
  12863. throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
  12864. }
  12865. defaultMaxListeners = arg;
  12866. }
  12867. });
  12868. EventEmitter.init = function() {
  12869. if (this._events === undefined ||
  12870. this._events === Object.getPrototypeOf(this)._events) {
  12871. this._events = Object.create(null);
  12872. this._eventsCount = 0;
  12873. }
  12874. this._maxListeners = this._maxListeners || undefined;
  12875. };
  12876. // Obviously not all Emitters should be limited to 10. This function allows
  12877. // that to be increased. Set to zero for unlimited.
  12878. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  12879. if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
  12880. throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
  12881. }
  12882. this._maxListeners = n;
  12883. return this;
  12884. };
  12885. function _getMaxListeners(that) {
  12886. if (that._maxListeners === undefined)
  12887. return EventEmitter.defaultMaxListeners;
  12888. return that._maxListeners;
  12889. }
  12890. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  12891. return _getMaxListeners(this);
  12892. };
  12893. EventEmitter.prototype.emit = function emit(type) {
  12894. var args = [];
  12895. for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
  12896. var doError = (type === 'error');
  12897. var events = this._events;
  12898. if (events !== undefined)
  12899. doError = (doError && events.error === undefined);
  12900. else if (!doError)
  12901. return false;
  12902. // If there is no 'error' event listener then throw.
  12903. if (doError) {
  12904. var er;
  12905. if (args.length > 0)
  12906. er = args[0];
  12907. if (er instanceof Error) {
  12908. // Note: The comments on the `throw` lines are intentional, they show
  12909. // up in Node's output if this results in an unhandled exception.
  12910. throw er; // Unhandled 'error' event
  12911. }
  12912. // At least give some kind of context to the user
  12913. var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
  12914. err.context = er;
  12915. throw err; // Unhandled 'error' event
  12916. }
  12917. var handler = events[type];
  12918. if (handler === undefined)
  12919. return false;
  12920. if (typeof handler === 'function') {
  12921. ReflectApply(handler, this, args);
  12922. } else {
  12923. var len = handler.length;
  12924. var listeners = arrayClone(handler, len);
  12925. for (var i = 0; i < len; ++i)
  12926. ReflectApply(listeners[i], this, args);
  12927. }
  12928. return true;
  12929. };
  12930. function _addListener(target, type, listener, prepend) {
  12931. var m;
  12932. var events;
  12933. var existing;
  12934. checkListener(listener);
  12935. events = target._events;
  12936. if (events === undefined) {
  12937. events = target._events = Object.create(null);
  12938. target._eventsCount = 0;
  12939. } else {
  12940. // To avoid recursion in the case that type === "newListener"! Before
  12941. // adding it to the listeners, first emit "newListener".
  12942. if (events.newListener !== undefined) {
  12943. target.emit('newListener', type,
  12944. listener.listener ? listener.listener : listener);
  12945. // Re-assign `events` because a newListener handler could have caused the
  12946. // this._events to be assigned to a new object
  12947. events = target._events;
  12948. }
  12949. existing = events[type];
  12950. }
  12951. if (existing === undefined) {
  12952. // Optimize the case of one listener. Don't need the extra array object.
  12953. existing = events[type] = listener;
  12954. ++target._eventsCount;
  12955. } else {
  12956. if (typeof existing === 'function') {
  12957. // Adding the second element, need to change to array.
  12958. existing = events[type] =
  12959. prepend ? [listener, existing] : [existing, listener];
  12960. // If we've already got an array, just append.
  12961. } else if (prepend) {
  12962. existing.unshift(listener);
  12963. } else {
  12964. existing.push(listener);
  12965. }
  12966. // Check for listener leak
  12967. m = _getMaxListeners(target);
  12968. if (m > 0 && existing.length > m && !existing.warned) {
  12969. existing.warned = true;
  12970. // No error code for this since it is a Warning
  12971. // eslint-disable-next-line no-restricted-syntax
  12972. var w = new Error('Possible EventEmitter memory leak detected. ' +
  12973. existing.length + ' ' + String(type) + ' listeners ' +
  12974. 'added. Use emitter.setMaxListeners() to ' +
  12975. 'increase limit');
  12976. w.name = 'MaxListenersExceededWarning';
  12977. w.emitter = target;
  12978. w.type = type;
  12979. w.count = existing.length;
  12980. ProcessEmitWarning(w);
  12981. }
  12982. }
  12983. return target;
  12984. }
  12985. EventEmitter.prototype.addListener = function addListener(type, listener) {
  12986. return _addListener(this, type, listener, false);
  12987. };
  12988. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  12989. EventEmitter.prototype.prependListener =
  12990. function prependListener(type, listener) {
  12991. return _addListener(this, type, listener, true);
  12992. };
  12993. function onceWrapper() {
  12994. if (!this.fired) {
  12995. this.target.removeListener(this.type, this.wrapFn);
  12996. this.fired = true;
  12997. if (arguments.length === 0)
  12998. return this.listener.call(this.target);
  12999. return this.listener.apply(this.target, arguments);
  13000. }
  13001. }
  13002. function _onceWrap(target, type, listener) {
  13003. var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
  13004. var wrapped = onceWrapper.bind(state);
  13005. wrapped.listener = listener;
  13006. state.wrapFn = wrapped;
  13007. return wrapped;
  13008. }
  13009. EventEmitter.prototype.once = function once(type, listener) {
  13010. checkListener(listener);
  13011. this.on(type, _onceWrap(this, type, listener));
  13012. return this;
  13013. };
  13014. EventEmitter.prototype.prependOnceListener =
  13015. function prependOnceListener(type, listener) {
  13016. checkListener(listener);
  13017. this.prependListener(type, _onceWrap(this, type, listener));
  13018. return this;
  13019. };
  13020. // Emits a 'removeListener' event if and only if the listener was removed.
  13021. EventEmitter.prototype.removeListener =
  13022. function removeListener(type, listener) {
  13023. var list, events, position, i, originalListener;
  13024. checkListener(listener);
  13025. events = this._events;
  13026. if (events === undefined)
  13027. return this;
  13028. list = events[type];
  13029. if (list === undefined)
  13030. return this;
  13031. if (list === listener || list.listener === listener) {
  13032. if (--this._eventsCount === 0)
  13033. this._events = Object.create(null);
  13034. else {
  13035. delete events[type];
  13036. if (events.removeListener)
  13037. this.emit('removeListener', type, list.listener || listener);
  13038. }
  13039. } else if (typeof list !== 'function') {
  13040. position = -1;
  13041. for (i = list.length - 1; i >= 0; i--) {
  13042. if (list[i] === listener || list[i].listener === listener) {
  13043. originalListener = list[i].listener;
  13044. position = i;
  13045. break;
  13046. }
  13047. }
  13048. if (position < 0)
  13049. return this;
  13050. if (position === 0)
  13051. list.shift();
  13052. else {
  13053. spliceOne(list, position);
  13054. }
  13055. if (list.length === 1)
  13056. events[type] = list[0];
  13057. if (events.removeListener !== undefined)
  13058. this.emit('removeListener', type, originalListener || listener);
  13059. }
  13060. return this;
  13061. };
  13062. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  13063. EventEmitter.prototype.removeAllListeners =
  13064. function removeAllListeners(type) {
  13065. var listeners, events, i;
  13066. events = this._events;
  13067. if (events === undefined)
  13068. return this;
  13069. // not listening for removeListener, no need to emit
  13070. if (events.removeListener === undefined) {
  13071. if (arguments.length === 0) {
  13072. this._events = Object.create(null);
  13073. this._eventsCount = 0;
  13074. } else if (events[type] !== undefined) {
  13075. if (--this._eventsCount === 0)
  13076. this._events = Object.create(null);
  13077. else
  13078. delete events[type];
  13079. }
  13080. return this;
  13081. }
  13082. // emit removeListener for all listeners on all events
  13083. if (arguments.length === 0) {
  13084. var keys = Object.keys(events);
  13085. var key;
  13086. for (i = 0; i < keys.length; ++i) {
  13087. key = keys[i];
  13088. if (key === 'removeListener') continue;
  13089. this.removeAllListeners(key);
  13090. }
  13091. this.removeAllListeners('removeListener');
  13092. this._events = Object.create(null);
  13093. this._eventsCount = 0;
  13094. return this;
  13095. }
  13096. listeners = events[type];
  13097. if (typeof listeners === 'function') {
  13098. this.removeListener(type, listeners);
  13099. } else if (listeners !== undefined) {
  13100. // LIFO order
  13101. for (i = listeners.length - 1; i >= 0; i--) {
  13102. this.removeListener(type, listeners[i]);
  13103. }
  13104. }
  13105. return this;
  13106. };
  13107. function _listeners(target, type, unwrap) {
  13108. var events = target._events;
  13109. if (events === undefined)
  13110. return [];
  13111. var evlistener = events[type];
  13112. if (evlistener === undefined)
  13113. return [];
  13114. if (typeof evlistener === 'function')
  13115. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  13116. return unwrap ?
  13117. unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  13118. }
  13119. EventEmitter.prototype.listeners = function listeners(type) {
  13120. return _listeners(this, type, true);
  13121. };
  13122. EventEmitter.prototype.rawListeners = function rawListeners(type) {
  13123. return _listeners(this, type, false);
  13124. };
  13125. EventEmitter.listenerCount = function(emitter, type) {
  13126. if (typeof emitter.listenerCount === 'function') {
  13127. return emitter.listenerCount(type);
  13128. } else {
  13129. return listenerCount.call(emitter, type);
  13130. }
  13131. };
  13132. EventEmitter.prototype.listenerCount = listenerCount;
  13133. function listenerCount(type) {
  13134. var events = this._events;
  13135. if (events !== undefined) {
  13136. var evlistener = events[type];
  13137. if (typeof evlistener === 'function') {
  13138. return 1;
  13139. } else if (evlistener !== undefined) {
  13140. return evlistener.length;
  13141. }
  13142. }
  13143. return 0;
  13144. }
  13145. EventEmitter.prototype.eventNames = function eventNames() {
  13146. return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
  13147. };
  13148. function arrayClone(arr, n) {
  13149. var copy = new Array(n);
  13150. for (var i = 0; i < n; ++i)
  13151. copy[i] = arr[i];
  13152. return copy;
  13153. }
  13154. function spliceOne(list, index) {
  13155. for (; index + 1 < list.length; index++)
  13156. list[index] = list[index + 1];
  13157. list.pop();
  13158. }
  13159. function unwrapListeners(arr) {
  13160. var ret = new Array(arr.length);
  13161. for (var i = 0; i < ret.length; ++i) {
  13162. ret[i] = arr[i].listener || arr[i];
  13163. }
  13164. return ret;
  13165. }
  13166. /***/ }),
  13167. /* 127 */
  13168. /*!*****************************************************************************!*\
  13169. !*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***!
  13170. \*****************************************************************************/
  13171. /*! no static exports found */
  13172. /***/ (function(module, exports, __webpack_require__) {
  13173. module.exports = __webpack_require__(/*! events */ 126).EventEmitter;
  13174. /***/ }),
  13175. /* 128 */
  13176. /*!***********************************************!*\
  13177. !*** ./node_modules/core-util-is/lib/util.js ***!
  13178. \***********************************************/
  13179. /*! no static exports found */
  13180. /***/ (function(module, exports, __webpack_require__) {
  13181. /* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
  13182. //
  13183. // Permission is hereby granted, free of charge, to any person obtaining a
  13184. // copy of this software and associated documentation files (the
  13185. // "Software"), to deal in the Software without restriction, including
  13186. // without limitation the rights to use, copy, modify, merge, publish,
  13187. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13188. // persons to whom the Software is furnished to do so, subject to the
  13189. // following conditions:
  13190. //
  13191. // The above copyright notice and this permission notice shall be included
  13192. // in all copies or substantial portions of the Software.
  13193. //
  13194. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13195. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13196. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13197. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13198. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13199. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13200. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13201. // NOTE: These type checking functions intentionally don't use `instanceof`
  13202. // because it is fragile and can be easily faked with `Object.create()`.
  13203. function isArray(arg) {
  13204. if (Array.isArray) {
  13205. return Array.isArray(arg);
  13206. }
  13207. return objectToString(arg) === '[object Array]';
  13208. }
  13209. exports.isArray = isArray;
  13210. function isBoolean(arg) {
  13211. return typeof arg === 'boolean';
  13212. }
  13213. exports.isBoolean = isBoolean;
  13214. function isNull(arg) {
  13215. return arg === null;
  13216. }
  13217. exports.isNull = isNull;
  13218. function isNullOrUndefined(arg) {
  13219. return arg == null;
  13220. }
  13221. exports.isNullOrUndefined = isNullOrUndefined;
  13222. function isNumber(arg) {
  13223. return typeof arg === 'number';
  13224. }
  13225. exports.isNumber = isNumber;
  13226. function isString(arg) {
  13227. return typeof arg === 'string';
  13228. }
  13229. exports.isString = isString;
  13230. function isSymbol(arg) {
  13231. return typeof arg === 'symbol';
  13232. }
  13233. exports.isSymbol = isSymbol;
  13234. function isUndefined(arg) {
  13235. return arg === void 0;
  13236. }
  13237. exports.isUndefined = isUndefined;
  13238. function isRegExp(re) {
  13239. return objectToString(re) === '[object RegExp]';
  13240. }
  13241. exports.isRegExp = isRegExp;
  13242. function isObject(arg) {
  13243. return typeof arg === 'object' && arg !== null;
  13244. }
  13245. exports.isObject = isObject;
  13246. function isDate(d) {
  13247. return objectToString(d) === '[object Date]';
  13248. }
  13249. exports.isDate = isDate;
  13250. function isError(e) {
  13251. return (objectToString(e) === '[object Error]' || e instanceof Error);
  13252. }
  13253. exports.isError = isError;
  13254. function isFunction(arg) {
  13255. return typeof arg === 'function';
  13256. }
  13257. exports.isFunction = isFunction;
  13258. function isPrimitive(arg) {
  13259. return arg === null ||
  13260. typeof arg === 'boolean' ||
  13261. typeof arg === 'number' ||
  13262. typeof arg === 'string' ||
  13263. typeof arg === 'symbol' || // ES6 symbol
  13264. typeof arg === 'undefined';
  13265. }
  13266. exports.isPrimitive = isPrimitive;
  13267. exports.isBuffer = Buffer.isBuffer;
  13268. function objectToString(o) {
  13269. return Object.prototype.toString.call(o);
  13270. }
  13271. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 115).Buffer))
  13272. /***/ }),
  13273. /* 129 */
  13274. /*!**********************!*\
  13275. !*** util (ignored) ***!
  13276. \**********************/
  13277. /*! no static exports found */
  13278. /***/ (function(module, exports) {
  13279. /* (ignored) */
  13280. /***/ }),
  13281. /* 130 */
  13282. /*!*************************************************************************!*\
  13283. !*** ./node_modules/readable-stream/lib/internal/streams/BufferList.js ***!
  13284. \*************************************************************************/
  13285. /*! no static exports found */
  13286. /***/ (function(module, exports, __webpack_require__) {
  13287. "use strict";
  13288. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  13289. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer;
  13290. var util = __webpack_require__(/*! util */ 131);
  13291. function copyBuffer(src, target, offset) {
  13292. src.copy(target, offset);
  13293. }
  13294. module.exports = function () {
  13295. function BufferList() {
  13296. _classCallCheck(this, BufferList);
  13297. this.head = null;
  13298. this.tail = null;
  13299. this.length = 0;
  13300. }
  13301. BufferList.prototype.push = function push(v) {
  13302. var entry = { data: v, next: null };
  13303. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  13304. this.tail = entry;
  13305. ++this.length;
  13306. };
  13307. BufferList.prototype.unshift = function unshift(v) {
  13308. var entry = { data: v, next: this.head };
  13309. if (this.length === 0) this.tail = entry;
  13310. this.head = entry;
  13311. ++this.length;
  13312. };
  13313. BufferList.prototype.shift = function shift() {
  13314. if (this.length === 0) return;
  13315. var ret = this.head.data;
  13316. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  13317. --this.length;
  13318. return ret;
  13319. };
  13320. BufferList.prototype.clear = function clear() {
  13321. this.head = this.tail = null;
  13322. this.length = 0;
  13323. };
  13324. BufferList.prototype.join = function join(s) {
  13325. if (this.length === 0) return '';
  13326. var p = this.head;
  13327. var ret = '' + p.data;
  13328. while (p = p.next) {
  13329. ret += s + p.data;
  13330. }return ret;
  13331. };
  13332. BufferList.prototype.concat = function concat(n) {
  13333. if (this.length === 0) return Buffer.alloc(0);
  13334. if (this.length === 1) return this.head.data;
  13335. var ret = Buffer.allocUnsafe(n >>> 0);
  13336. var p = this.head;
  13337. var i = 0;
  13338. while (p) {
  13339. copyBuffer(p.data, ret, i);
  13340. i += p.data.length;
  13341. p = p.next;
  13342. }
  13343. return ret;
  13344. };
  13345. return BufferList;
  13346. }();
  13347. if (util && util.inspect && util.inspect.custom) {
  13348. module.exports.prototype[util.inspect.custom] = function () {
  13349. var obj = util.inspect({ length: this.length });
  13350. return this.constructor.name + ' ' + obj;
  13351. };
  13352. }
  13353. /***/ }),
  13354. /* 131 */
  13355. /*!**********************!*\
  13356. !*** util (ignored) ***!
  13357. \**********************/
  13358. /*! no static exports found */
  13359. /***/ (function(module, exports) {
  13360. /* (ignored) */
  13361. /***/ }),
  13362. /* 132 */
  13363. /*!**********************************************************************!*\
  13364. !*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***!
  13365. \**********************************************************************/
  13366. /*! no static exports found */
  13367. /***/ (function(module, exports, __webpack_require__) {
  13368. "use strict";
  13369. /*<replacement>*/
  13370. var pna = __webpack_require__(/*! process-nextick-args */ 125);
  13371. /*</replacement>*/
  13372. // undocumented cb() API, needed for core, not for public API
  13373. function destroy(err, cb) {
  13374. var _this = this;
  13375. var readableDestroyed = this._readableState && this._readableState.destroyed;
  13376. var writableDestroyed = this._writableState && this._writableState.destroyed;
  13377. if (readableDestroyed || writableDestroyed) {
  13378. if (cb) {
  13379. cb(err);
  13380. } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
  13381. pna.nextTick(emitErrorNT, this, err);
  13382. }
  13383. return this;
  13384. }
  13385. // we set destroyed to true before firing error callbacks in order
  13386. // to make it re-entrance safe in case destroy() is called within callbacks
  13387. if (this._readableState) {
  13388. this._readableState.destroyed = true;
  13389. }
  13390. // if this is a duplex stream mark the writable part as destroyed as well
  13391. if (this._writableState) {
  13392. this._writableState.destroyed = true;
  13393. }
  13394. this._destroy(err || null, function (err) {
  13395. if (!cb && err) {
  13396. pna.nextTick(emitErrorNT, _this, err);
  13397. if (_this._writableState) {
  13398. _this._writableState.errorEmitted = true;
  13399. }
  13400. } else if (cb) {
  13401. cb(err);
  13402. }
  13403. });
  13404. return this;
  13405. }
  13406. function undestroy() {
  13407. if (this._readableState) {
  13408. this._readableState.destroyed = false;
  13409. this._readableState.reading = false;
  13410. this._readableState.ended = false;
  13411. this._readableState.endEmitted = false;
  13412. }
  13413. if (this._writableState) {
  13414. this._writableState.destroyed = false;
  13415. this._writableState.ended = false;
  13416. this._writableState.ending = false;
  13417. this._writableState.finished = false;
  13418. this._writableState.errorEmitted = false;
  13419. }
  13420. }
  13421. function emitErrorNT(self, err) {
  13422. self.emit('error', err);
  13423. }
  13424. module.exports = {
  13425. destroy: destroy,
  13426. undestroy: undestroy
  13427. };
  13428. /***/ }),
  13429. /* 133 */
  13430. /*!************************************************************!*\
  13431. !*** ./node_modules/readable-stream/lib/_stream_duplex.js ***!
  13432. \************************************************************/
  13433. /*! no static exports found */
  13434. /***/ (function(module, exports, __webpack_require__) {
  13435. "use strict";
  13436. // Copyright Joyent, Inc. and other Node contributors.
  13437. //
  13438. // Permission is hereby granted, free of charge, to any person obtaining a
  13439. // copy of this software and associated documentation files (the
  13440. // "Software"), to deal in the Software without restriction, including
  13441. // without limitation the rights to use, copy, modify, merge, publish,
  13442. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13443. // persons to whom the Software is furnished to do so, subject to the
  13444. // following conditions:
  13445. //
  13446. // The above copyright notice and this permission notice shall be included
  13447. // in all copies or substantial portions of the Software.
  13448. //
  13449. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13450. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13451. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13452. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13453. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13454. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13455. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13456. // a duplex stream is just a stream that is both readable and writable.
  13457. // Since JS doesn't have multiple prototypal inheritance, this class
  13458. // prototypally inherits from Readable, and then parasitically from
  13459. // Writable.
  13460. /*<replacement>*/
  13461. var pna = __webpack_require__(/*! process-nextick-args */ 125);
  13462. /*</replacement>*/
  13463. /*<replacement>*/
  13464. var objectKeys = Object.keys || function (obj) {
  13465. var keys = [];
  13466. for (var key in obj) {
  13467. keys.push(key);
  13468. }return keys;
  13469. };
  13470. /*</replacement>*/
  13471. module.exports = Duplex;
  13472. /*<replacement>*/
  13473. var util = Object.create(__webpack_require__(/*! core-util-is */ 128));
  13474. util.inherits = __webpack_require__(/*! inherits */ 120);
  13475. /*</replacement>*/
  13476. var Readable = __webpack_require__(/*! ./_stream_readable */ 124);
  13477. var Writable = __webpack_require__(/*! ./_stream_writable */ 134);
  13478. util.inherits(Duplex, Readable);
  13479. {
  13480. // avoid scope creep, the keys array can then be collected
  13481. var keys = objectKeys(Writable.prototype);
  13482. for (var v = 0; v < keys.length; v++) {
  13483. var method = keys[v];
  13484. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  13485. }
  13486. }
  13487. function Duplex(options) {
  13488. if (!(this instanceof Duplex)) return new Duplex(options);
  13489. Readable.call(this, options);
  13490. Writable.call(this, options);
  13491. if (options && options.readable === false) this.readable = false;
  13492. if (options && options.writable === false) this.writable = false;
  13493. this.allowHalfOpen = true;
  13494. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  13495. this.once('end', onend);
  13496. }
  13497. Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
  13498. // making it explicit this property is not enumerable
  13499. // because otherwise some prototype manipulation in
  13500. // userland will fail
  13501. enumerable: false,
  13502. get: function () {
  13503. return this._writableState.highWaterMark;
  13504. }
  13505. });
  13506. // the no-half-open enforcer
  13507. function onend() {
  13508. // if we allow half-open state, or if the writable side ended,
  13509. // then we're ok.
  13510. if (this.allowHalfOpen || this._writableState.ended) return;
  13511. // no more data can be written.
  13512. // But allow more writes to happen in this tick.
  13513. pna.nextTick(onEndNT, this);
  13514. }
  13515. function onEndNT(self) {
  13516. self.end();
  13517. }
  13518. Object.defineProperty(Duplex.prototype, 'destroyed', {
  13519. get: function () {
  13520. if (this._readableState === undefined || this._writableState === undefined) {
  13521. return false;
  13522. }
  13523. return this._readableState.destroyed && this._writableState.destroyed;
  13524. },
  13525. set: function (value) {
  13526. // we ignore the value if the stream
  13527. // has not been initialized yet
  13528. if (this._readableState === undefined || this._writableState === undefined) {
  13529. return;
  13530. }
  13531. // backward compatibility, the user is explicitly
  13532. // managing destroyed
  13533. this._readableState.destroyed = value;
  13534. this._writableState.destroyed = value;
  13535. }
  13536. });
  13537. Duplex.prototype._destroy = function (err, cb) {
  13538. this.push(null);
  13539. this.end();
  13540. pna.nextTick(cb, err);
  13541. };
  13542. /***/ }),
  13543. /* 134 */
  13544. /*!**************************************************************!*\
  13545. !*** ./node_modules/readable-stream/lib/_stream_writable.js ***!
  13546. \**************************************************************/
  13547. /*! no static exports found */
  13548. /***/ (function(module, exports, __webpack_require__) {
  13549. "use strict";
  13550. /* WEBPACK VAR INJECTION */(function(process, global) {// Copyright Joyent, Inc. and other Node contributors.
  13551. //
  13552. // Permission is hereby granted, free of charge, to any person obtaining a
  13553. // copy of this software and associated documentation files (the
  13554. // "Software"), to deal in the Software without restriction, including
  13555. // without limitation the rights to use, copy, modify, merge, publish,
  13556. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13557. // persons to whom the Software is furnished to do so, subject to the
  13558. // following conditions:
  13559. //
  13560. // The above copyright notice and this permission notice shall be included
  13561. // in all copies or substantial portions of the Software.
  13562. //
  13563. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13564. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13565. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13566. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13567. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13568. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13569. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13570. // A bit simpler than readable streams.
  13571. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  13572. // the drain event emission and buffering.
  13573. /*<replacement>*/
  13574. var pna = __webpack_require__(/*! process-nextick-args */ 125);
  13575. /*</replacement>*/
  13576. module.exports = Writable;
  13577. /* <replacement> */
  13578. function WriteReq(chunk, encoding, cb) {
  13579. this.chunk = chunk;
  13580. this.encoding = encoding;
  13581. this.callback = cb;
  13582. this.next = null;
  13583. }
  13584. // It seems a linked list but it is not
  13585. // there will be only 2 of these for each stream
  13586. function CorkedRequest(state) {
  13587. var _this = this;
  13588. this.next = null;
  13589. this.entry = null;
  13590. this.finish = function () {
  13591. onCorkedFinish(_this, state);
  13592. };
  13593. }
  13594. /* </replacement> */
  13595. /*<replacement>*/
  13596. var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
  13597. /*</replacement>*/
  13598. /*<replacement>*/
  13599. var Duplex;
  13600. /*</replacement>*/
  13601. Writable.WritableState = WritableState;
  13602. /*<replacement>*/
  13603. var util = Object.create(__webpack_require__(/*! core-util-is */ 128));
  13604. util.inherits = __webpack_require__(/*! inherits */ 120);
  13605. /*</replacement>*/
  13606. /*<replacement>*/
  13607. var internalUtil = {
  13608. deprecate: __webpack_require__(/*! util-deprecate */ 135)
  13609. };
  13610. /*</replacement>*/
  13611. /*<replacement>*/
  13612. var Stream = __webpack_require__(/*! ./internal/streams/stream */ 127);
  13613. /*</replacement>*/
  13614. /*<replacement>*/
  13615. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer;
  13616. var OurUint8Array = global.Uint8Array || function () {};
  13617. function _uint8ArrayToBuffer(chunk) {
  13618. return Buffer.from(chunk);
  13619. }
  13620. function _isUint8Array(obj) {
  13621. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  13622. }
  13623. /*</replacement>*/
  13624. var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ 132);
  13625. util.inherits(Writable, Stream);
  13626. function nop() {}
  13627. function WritableState(options, stream) {
  13628. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 133);
  13629. options = options || {};
  13630. // Duplex streams are both readable and writable, but share
  13631. // the same options object.
  13632. // However, some cases require setting options to different
  13633. // values for the readable and the writable sides of the duplex stream.
  13634. // These options can be provided separately as readableXXX and writableXXX.
  13635. var isDuplex = stream instanceof Duplex;
  13636. // object stream flag to indicate whether or not this stream
  13637. // contains buffers or objects.
  13638. this.objectMode = !!options.objectMode;
  13639. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  13640. // the point at which write() starts returning false
  13641. // Note: 0 is a valid value, means that we always return false if
  13642. // the entire buffer is not flushed immediately on write()
  13643. var hwm = options.highWaterMark;
  13644. var writableHwm = options.writableHighWaterMark;
  13645. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  13646. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
  13647. // cast to ints.
  13648. this.highWaterMark = Math.floor(this.highWaterMark);
  13649. // if _final has been called
  13650. this.finalCalled = false;
  13651. // drain event flag.
  13652. this.needDrain = false;
  13653. // at the start of calling end()
  13654. this.ending = false;
  13655. // when end() has been called, and returned
  13656. this.ended = false;
  13657. // when 'finish' is emitted
  13658. this.finished = false;
  13659. // has it been destroyed
  13660. this.destroyed = false;
  13661. // should we decode strings into buffers before passing to _write?
  13662. // this is here so that some node-core streams can optimize string
  13663. // handling at a lower level.
  13664. var noDecode = options.decodeStrings === false;
  13665. this.decodeStrings = !noDecode;
  13666. // Crypto is kind of old and crusty. Historically, its default string
  13667. // encoding is 'binary' so we have to make this configurable.
  13668. // Everything else in the universe uses 'utf8', though.
  13669. this.defaultEncoding = options.defaultEncoding || 'utf8';
  13670. // not an actual buffer we keep track of, but a measurement
  13671. // of how much we're waiting to get pushed to some underlying
  13672. // socket or file.
  13673. this.length = 0;
  13674. // a flag to see when we're in the middle of a write.
  13675. this.writing = false;
  13676. // when true all writes will be buffered until .uncork() call
  13677. this.corked = 0;
  13678. // a flag to be able to tell if the onwrite cb is called immediately,
  13679. // or on a later tick. We set this to true at first, because any
  13680. // actions that shouldn't happen until "later" should generally also
  13681. // not happen before the first write call.
  13682. this.sync = true;
  13683. // a flag to know if we're processing previously buffered items, which
  13684. // may call the _write() callback in the same tick, so that we don't
  13685. // end up in an overlapped onwrite situation.
  13686. this.bufferProcessing = false;
  13687. // the callback that's passed to _write(chunk,cb)
  13688. this.onwrite = function (er) {
  13689. onwrite(stream, er);
  13690. };
  13691. // the callback that the user supplies to write(chunk,encoding,cb)
  13692. this.writecb = null;
  13693. // the amount that is being written when _write is called.
  13694. this.writelen = 0;
  13695. this.bufferedRequest = null;
  13696. this.lastBufferedRequest = null;
  13697. // number of pending user-supplied write callbacks
  13698. // this must be 0 before 'finish' can be emitted
  13699. this.pendingcb = 0;
  13700. // emit prefinish if the only thing we're waiting for is _write cbs
  13701. // This is relevant for synchronous Transform streams
  13702. this.prefinished = false;
  13703. // True if the error was already emitted and should not be thrown again
  13704. this.errorEmitted = false;
  13705. // count buffered requests
  13706. this.bufferedRequestCount = 0;
  13707. // allocate the first CorkedRequest, there is always
  13708. // one allocated and free to use, and we maintain at most two
  13709. this.corkedRequestsFree = new CorkedRequest(this);
  13710. }
  13711. WritableState.prototype.getBuffer = function getBuffer() {
  13712. var current = this.bufferedRequest;
  13713. var out = [];
  13714. while (current) {
  13715. out.push(current);
  13716. current = current.next;
  13717. }
  13718. return out;
  13719. };
  13720. (function () {
  13721. try {
  13722. Object.defineProperty(WritableState.prototype, 'buffer', {
  13723. get: internalUtil.deprecate(function () {
  13724. return this.getBuffer();
  13725. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
  13726. });
  13727. } catch (_) {}
  13728. })();
  13729. // Test _writableState for inheritance to account for Duplex streams,
  13730. // whose prototype chain only points to Readable.
  13731. var realHasInstance;
  13732. if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
  13733. realHasInstance = Function.prototype[Symbol.hasInstance];
  13734. Object.defineProperty(Writable, Symbol.hasInstance, {
  13735. value: function (object) {
  13736. if (realHasInstance.call(this, object)) return true;
  13737. if (this !== Writable) return false;
  13738. return object && object._writableState instanceof WritableState;
  13739. }
  13740. });
  13741. } else {
  13742. realHasInstance = function (object) {
  13743. return object instanceof this;
  13744. };
  13745. }
  13746. function Writable(options) {
  13747. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 133);
  13748. // Writable ctor is applied to Duplexes, too.
  13749. // `realHasInstance` is necessary because using plain `instanceof`
  13750. // would return false, as no `_writableState` property is attached.
  13751. // Trying to use the custom `instanceof` for Writable here will also break the
  13752. // Node.js LazyTransform implementation, which has a non-trivial getter for
  13753. // `_writableState` that would lead to infinite recursion.
  13754. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
  13755. return new Writable(options);
  13756. }
  13757. this._writableState = new WritableState(options, this);
  13758. // legacy.
  13759. this.writable = true;
  13760. if (options) {
  13761. if (typeof options.write === 'function') this._write = options.write;
  13762. if (typeof options.writev === 'function') this._writev = options.writev;
  13763. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  13764. if (typeof options.final === 'function') this._final = options.final;
  13765. }
  13766. Stream.call(this);
  13767. }
  13768. // Otherwise people can pipe Writable streams, which is just wrong.
  13769. Writable.prototype.pipe = function () {
  13770. this.emit('error', new Error('Cannot pipe, not readable'));
  13771. };
  13772. function writeAfterEnd(stream, cb) {
  13773. var er = new Error('write after end');
  13774. // TODO: defer error events consistently everywhere, not just the cb
  13775. stream.emit('error', er);
  13776. pna.nextTick(cb, er);
  13777. }
  13778. // Checks that a user-supplied chunk is valid, especially for the particular
  13779. // mode the stream is in. Currently this means that `null` is never accepted
  13780. // and undefined/non-string values are only allowed in object mode.
  13781. function validChunk(stream, state, chunk, cb) {
  13782. var valid = true;
  13783. var er = false;
  13784. if (chunk === null) {
  13785. er = new TypeError('May not write null values to stream');
  13786. } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  13787. er = new TypeError('Invalid non-string/buffer chunk');
  13788. }
  13789. if (er) {
  13790. stream.emit('error', er);
  13791. pna.nextTick(cb, er);
  13792. valid = false;
  13793. }
  13794. return valid;
  13795. }
  13796. Writable.prototype.write = function (chunk, encoding, cb) {
  13797. var state = this._writableState;
  13798. var ret = false;
  13799. var isBuf = !state.objectMode && _isUint8Array(chunk);
  13800. if (isBuf && !Buffer.isBuffer(chunk)) {
  13801. chunk = _uint8ArrayToBuffer(chunk);
  13802. }
  13803. if (typeof encoding === 'function') {
  13804. cb = encoding;
  13805. encoding = null;
  13806. }
  13807. if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  13808. if (typeof cb !== 'function') cb = nop;
  13809. if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
  13810. state.pendingcb++;
  13811. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  13812. }
  13813. return ret;
  13814. };
  13815. Writable.prototype.cork = function () {
  13816. var state = this._writableState;
  13817. state.corked++;
  13818. };
  13819. Writable.prototype.uncork = function () {
  13820. var state = this._writableState;
  13821. if (state.corked) {
  13822. state.corked--;
  13823. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  13824. }
  13825. };
  13826. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  13827. // node::ParseEncoding() requires lower case.
  13828. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  13829. 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);
  13830. this._writableState.defaultEncoding = encoding;
  13831. return this;
  13832. };
  13833. function decodeChunk(state, chunk, encoding) {
  13834. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  13835. chunk = Buffer.from(chunk, encoding);
  13836. }
  13837. return chunk;
  13838. }
  13839. Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
  13840. // making it explicit this property is not enumerable
  13841. // because otherwise some prototype manipulation in
  13842. // userland will fail
  13843. enumerable: false,
  13844. get: function () {
  13845. return this._writableState.highWaterMark;
  13846. }
  13847. });
  13848. // if we're already writing something, then just put this
  13849. // in the queue, and wait our turn. Otherwise, call _write
  13850. // If we return false, then we need a drain event, so set that flag.
  13851. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  13852. if (!isBuf) {
  13853. var newChunk = decodeChunk(state, chunk, encoding);
  13854. if (chunk !== newChunk) {
  13855. isBuf = true;
  13856. encoding = 'buffer';
  13857. chunk = newChunk;
  13858. }
  13859. }
  13860. var len = state.objectMode ? 1 : chunk.length;
  13861. state.length += len;
  13862. var ret = state.length < state.highWaterMark;
  13863. // we must ensure that previous needDrain will not be reset to false.
  13864. if (!ret) state.needDrain = true;
  13865. if (state.writing || state.corked) {
  13866. var last = state.lastBufferedRequest;
  13867. state.lastBufferedRequest = {
  13868. chunk: chunk,
  13869. encoding: encoding,
  13870. isBuf: isBuf,
  13871. callback: cb,
  13872. next: null
  13873. };
  13874. if (last) {
  13875. last.next = state.lastBufferedRequest;
  13876. } else {
  13877. state.bufferedRequest = state.lastBufferedRequest;
  13878. }
  13879. state.bufferedRequestCount += 1;
  13880. } else {
  13881. doWrite(stream, state, false, len, chunk, encoding, cb);
  13882. }
  13883. return ret;
  13884. }
  13885. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  13886. state.writelen = len;
  13887. state.writecb = cb;
  13888. state.writing = true;
  13889. state.sync = true;
  13890. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  13891. state.sync = false;
  13892. }
  13893. function onwriteError(stream, state, sync, er, cb) {
  13894. --state.pendingcb;
  13895. if (sync) {
  13896. // defer the callback if we are being called synchronously
  13897. // to avoid piling up things on the stack
  13898. pna.nextTick(cb, er);
  13899. // this can emit finish, and it will always happen
  13900. // after error
  13901. pna.nextTick(finishMaybe, stream, state);
  13902. stream._writableState.errorEmitted = true;
  13903. stream.emit('error', er);
  13904. } else {
  13905. // the caller expect this to happen before if
  13906. // it is async
  13907. cb(er);
  13908. stream._writableState.errorEmitted = true;
  13909. stream.emit('error', er);
  13910. // this can emit finish, but finish must
  13911. // always follow error
  13912. finishMaybe(stream, state);
  13913. }
  13914. }
  13915. function onwriteStateUpdate(state) {
  13916. state.writing = false;
  13917. state.writecb = null;
  13918. state.length -= state.writelen;
  13919. state.writelen = 0;
  13920. }
  13921. function onwrite(stream, er) {
  13922. var state = stream._writableState;
  13923. var sync = state.sync;
  13924. var cb = state.writecb;
  13925. onwriteStateUpdate(state);
  13926. if (er) onwriteError(stream, state, sync, er, cb);else {
  13927. // Check if we're actually ready to finish, but don't emit yet
  13928. var finished = needFinish(state);
  13929. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  13930. clearBuffer(stream, state);
  13931. }
  13932. if (sync) {
  13933. /*<replacement>*/
  13934. asyncWrite(afterWrite, stream, state, finished, cb);
  13935. /*</replacement>*/
  13936. } else {
  13937. afterWrite(stream, state, finished, cb);
  13938. }
  13939. }
  13940. }
  13941. function afterWrite(stream, state, finished, cb) {
  13942. if (!finished) onwriteDrain(stream, state);
  13943. state.pendingcb--;
  13944. cb();
  13945. finishMaybe(stream, state);
  13946. }
  13947. // Must force callback to be called on nextTick, so that we don't
  13948. // emit 'drain' before the write() consumer gets the 'false' return
  13949. // value, and has a chance to attach a 'drain' listener.
  13950. function onwriteDrain(stream, state) {
  13951. if (state.length === 0 && state.needDrain) {
  13952. state.needDrain = false;
  13953. stream.emit('drain');
  13954. }
  13955. }
  13956. // if there's something in the buffer waiting, then process it
  13957. function clearBuffer(stream, state) {
  13958. state.bufferProcessing = true;
  13959. var entry = state.bufferedRequest;
  13960. if (stream._writev && entry && entry.next) {
  13961. // Fast case, write everything using _writev()
  13962. var l = state.bufferedRequestCount;
  13963. var buffer = new Array(l);
  13964. var holder = state.corkedRequestsFree;
  13965. holder.entry = entry;
  13966. var count = 0;
  13967. var allBuffers = true;
  13968. while (entry) {
  13969. buffer[count] = entry;
  13970. if (!entry.isBuf) allBuffers = false;
  13971. entry = entry.next;
  13972. count += 1;
  13973. }
  13974. buffer.allBuffers = allBuffers;
  13975. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  13976. // doWrite is almost always async, defer these to save a bit of time
  13977. // as the hot path ends with doWrite
  13978. state.pendingcb++;
  13979. state.lastBufferedRequest = null;
  13980. if (holder.next) {
  13981. state.corkedRequestsFree = holder.next;
  13982. holder.next = null;
  13983. } else {
  13984. state.corkedRequestsFree = new CorkedRequest(state);
  13985. }
  13986. state.bufferedRequestCount = 0;
  13987. } else {
  13988. // Slow case, write chunks one-by-one
  13989. while (entry) {
  13990. var chunk = entry.chunk;
  13991. var encoding = entry.encoding;
  13992. var cb = entry.callback;
  13993. var len = state.objectMode ? 1 : chunk.length;
  13994. doWrite(stream, state, false, len, chunk, encoding, cb);
  13995. entry = entry.next;
  13996. state.bufferedRequestCount--;
  13997. // if we didn't call the onwrite immediately, then
  13998. // it means that we need to wait until it does.
  13999. // also, that means that the chunk and cb are currently
  14000. // being processed, so move the buffer counter past them.
  14001. if (state.writing) {
  14002. break;
  14003. }
  14004. }
  14005. if (entry === null) state.lastBufferedRequest = null;
  14006. }
  14007. state.bufferedRequest = entry;
  14008. state.bufferProcessing = false;
  14009. }
  14010. Writable.prototype._write = function (chunk, encoding, cb) {
  14011. cb(new Error('_write() is not implemented'));
  14012. };
  14013. Writable.prototype._writev = null;
  14014. Writable.prototype.end = function (chunk, encoding, cb) {
  14015. var state = this._writableState;
  14016. if (typeof chunk === 'function') {
  14017. cb = chunk;
  14018. chunk = null;
  14019. encoding = null;
  14020. } else if (typeof encoding === 'function') {
  14021. cb = encoding;
  14022. encoding = null;
  14023. }
  14024. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  14025. // .end() fully uncorks
  14026. if (state.corked) {
  14027. state.corked = 1;
  14028. this.uncork();
  14029. }
  14030. // ignore unnecessary end() calls.
  14031. if (!state.ending && !state.finished) endWritable(this, state, cb);
  14032. };
  14033. function needFinish(state) {
  14034. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  14035. }
  14036. function callFinal(stream, state) {
  14037. stream._final(function (err) {
  14038. state.pendingcb--;
  14039. if (err) {
  14040. stream.emit('error', err);
  14041. }
  14042. state.prefinished = true;
  14043. stream.emit('prefinish');
  14044. finishMaybe(stream, state);
  14045. });
  14046. }
  14047. function prefinish(stream, state) {
  14048. if (!state.prefinished && !state.finalCalled) {
  14049. if (typeof stream._final === 'function') {
  14050. state.pendingcb++;
  14051. state.finalCalled = true;
  14052. pna.nextTick(callFinal, stream, state);
  14053. } else {
  14054. state.prefinished = true;
  14055. stream.emit('prefinish');
  14056. }
  14057. }
  14058. }
  14059. function finishMaybe(stream, state) {
  14060. var need = needFinish(state);
  14061. if (need) {
  14062. prefinish(stream, state);
  14063. if (state.pendingcb === 0) {
  14064. state.finished = true;
  14065. stream.emit('finish');
  14066. }
  14067. }
  14068. return need;
  14069. }
  14070. function endWritable(stream, state, cb) {
  14071. state.ending = true;
  14072. finishMaybe(stream, state);
  14073. if (cb) {
  14074. if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
  14075. }
  14076. state.ended = true;
  14077. stream.writable = false;
  14078. }
  14079. function onCorkedFinish(corkReq, state, err) {
  14080. var entry = corkReq.entry;
  14081. corkReq.entry = null;
  14082. while (entry) {
  14083. var cb = entry.callback;
  14084. state.pendingcb--;
  14085. cb(err);
  14086. entry = entry.next;
  14087. }
  14088. if (state.corkedRequestsFree) {
  14089. state.corkedRequestsFree.next = corkReq;
  14090. } else {
  14091. state.corkedRequestsFree = corkReq;
  14092. }
  14093. }
  14094. Object.defineProperty(Writable.prototype, 'destroyed', {
  14095. get: function () {
  14096. if (this._writableState === undefined) {
  14097. return false;
  14098. }
  14099. return this._writableState.destroyed;
  14100. },
  14101. set: function (value) {
  14102. // we ignore the value if the stream
  14103. // has not been initialized yet
  14104. if (!this._writableState) {
  14105. return;
  14106. }
  14107. // backward compatibility, the user is explicitly
  14108. // managing destroyed
  14109. this._writableState.destroyed = value;
  14110. }
  14111. });
  14112. Writable.prototype.destroy = destroyImpl.destroy;
  14113. Writable.prototype._undestroy = destroyImpl.undestroy;
  14114. Writable.prototype._destroy = function (err, cb) {
  14115. this.end();
  14116. cb(err);
  14117. };
  14118. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 112), __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3)))
  14119. /***/ }),
  14120. /* 135 */
  14121. /*!************************************************!*\
  14122. !*** ./node_modules/util-deprecate/browser.js ***!
  14123. \************************************************/
  14124. /*! no static exports found */
  14125. /***/ (function(module, exports, __webpack_require__) {
  14126. /* WEBPACK VAR INJECTION */(function(global) {
  14127. /**
  14128. * Module exports.
  14129. */
  14130. module.exports = deprecate;
  14131. /**
  14132. * Mark that a method should not be used.
  14133. * Returns a modified function which warns once by default.
  14134. *
  14135. * If `localStorage.noDeprecation = true` is set, then it is a no-op.
  14136. *
  14137. * If `localStorage.throwDeprecation = true` is set, then deprecated functions
  14138. * will throw an Error when invoked.
  14139. *
  14140. * If `localStorage.traceDeprecation = true` is set, then deprecated functions
  14141. * will invoke `console.trace()` instead of `console.error()`.
  14142. *
  14143. * @param {Function} fn - the function to deprecate
  14144. * @param {String} msg - the string to print to the console when `fn` is invoked
  14145. * @returns {Function} a new "deprecated" version of `fn`
  14146. * @api public
  14147. */
  14148. function deprecate (fn, msg) {
  14149. if (config('noDeprecation')) {
  14150. return fn;
  14151. }
  14152. var warned = false;
  14153. function deprecated() {
  14154. if (!warned) {
  14155. if (config('throwDeprecation')) {
  14156. throw new Error(msg);
  14157. } else if (config('traceDeprecation')) {
  14158. console.trace(msg);
  14159. } else {
  14160. console.warn(msg);
  14161. }
  14162. warned = true;
  14163. }
  14164. return fn.apply(this, arguments);
  14165. }
  14166. return deprecated;
  14167. }
  14168. /**
  14169. * Checks `localStorage` for boolean values for the given `name`.
  14170. *
  14171. * @param {String} name
  14172. * @returns {Boolean}
  14173. * @api private
  14174. */
  14175. function config (name) {
  14176. // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  14177. try {
  14178. if (!global.localStorage) return false;
  14179. } catch (_) {
  14180. return false;
  14181. }
  14182. var val = global.localStorage[name];
  14183. if (null == val) return false;
  14184. return String(val).toLowerCase() === 'true';
  14185. }
  14186. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3)))
  14187. /***/ }),
  14188. /* 136 */
  14189. /*!***********************************************************!*\
  14190. !*** ./node_modules/string_decoder/lib/string_decoder.js ***!
  14191. \***********************************************************/
  14192. /*! no static exports found */
  14193. /***/ (function(module, exports, __webpack_require__) {
  14194. "use strict";
  14195. // Copyright Joyent, Inc. and other Node contributors.
  14196. //
  14197. // Permission is hereby granted, free of charge, to any person obtaining a
  14198. // copy of this software and associated documentation files (the
  14199. // "Software"), to deal in the Software without restriction, including
  14200. // without limitation the rights to use, copy, modify, merge, publish,
  14201. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14202. // persons to whom the Software is furnished to do so, subject to the
  14203. // following conditions:
  14204. //
  14205. // The above copyright notice and this permission notice shall be included
  14206. // in all copies or substantial portions of the Software.
  14207. //
  14208. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14209. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14210. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14211. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14212. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14213. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14214. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14215. /*<replacement>*/
  14216. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer;
  14217. /*</replacement>*/
  14218. var isEncoding = Buffer.isEncoding || function (encoding) {
  14219. encoding = '' + encoding;
  14220. switch (encoding && encoding.toLowerCase()) {
  14221. 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':
  14222. return true;
  14223. default:
  14224. return false;
  14225. }
  14226. };
  14227. function _normalizeEncoding(enc) {
  14228. if (!enc) return 'utf8';
  14229. var retried;
  14230. while (true) {
  14231. switch (enc) {
  14232. case 'utf8':
  14233. case 'utf-8':
  14234. return 'utf8';
  14235. case 'ucs2':
  14236. case 'ucs-2':
  14237. case 'utf16le':
  14238. case 'utf-16le':
  14239. return 'utf16le';
  14240. case 'latin1':
  14241. case 'binary':
  14242. return 'latin1';
  14243. case 'base64':
  14244. case 'ascii':
  14245. case 'hex':
  14246. return enc;
  14247. default:
  14248. if (retried) return; // undefined
  14249. enc = ('' + enc).toLowerCase();
  14250. retried = true;
  14251. }
  14252. }
  14253. };
  14254. // Do not cache `Buffer.isEncoding` when checking encoding names as some
  14255. // modules monkey-patch it to support additional encodings
  14256. function normalizeEncoding(enc) {
  14257. var nenc = _normalizeEncoding(enc);
  14258. if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
  14259. return nenc || enc;
  14260. }
  14261. // StringDecoder provides an interface for efficiently splitting a series of
  14262. // buffers into a series of JS strings without breaking apart multi-byte
  14263. // characters.
  14264. exports.StringDecoder = StringDecoder;
  14265. function StringDecoder(encoding) {
  14266. this.encoding = normalizeEncoding(encoding);
  14267. var nb;
  14268. switch (this.encoding) {
  14269. case 'utf16le':
  14270. this.text = utf16Text;
  14271. this.end = utf16End;
  14272. nb = 4;
  14273. break;
  14274. case 'utf8':
  14275. this.fillLast = utf8FillLast;
  14276. nb = 4;
  14277. break;
  14278. case 'base64':
  14279. this.text = base64Text;
  14280. this.end = base64End;
  14281. nb = 3;
  14282. break;
  14283. default:
  14284. this.write = simpleWrite;
  14285. this.end = simpleEnd;
  14286. return;
  14287. }
  14288. this.lastNeed = 0;
  14289. this.lastTotal = 0;
  14290. this.lastChar = Buffer.allocUnsafe(nb);
  14291. }
  14292. StringDecoder.prototype.write = function (buf) {
  14293. if (buf.length === 0) return '';
  14294. var r;
  14295. var i;
  14296. if (this.lastNeed) {
  14297. r = this.fillLast(buf);
  14298. if (r === undefined) return '';
  14299. i = this.lastNeed;
  14300. this.lastNeed = 0;
  14301. } else {
  14302. i = 0;
  14303. }
  14304. if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  14305. return r || '';
  14306. };
  14307. StringDecoder.prototype.end = utf8End;
  14308. // Returns only complete characters in a Buffer
  14309. StringDecoder.prototype.text = utf8Text;
  14310. // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
  14311. StringDecoder.prototype.fillLast = function (buf) {
  14312. if (this.lastNeed <= buf.length) {
  14313. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
  14314. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  14315. }
  14316. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  14317. this.lastNeed -= buf.length;
  14318. };
  14319. // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
  14320. // continuation byte. If an invalid byte is detected, -2 is returned.
  14321. function utf8CheckByte(byte) {
  14322. if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
  14323. return byte >> 6 === 0x02 ? -1 : -2;
  14324. }
  14325. // Checks at most 3 bytes at the end of a Buffer in order to detect an
  14326. // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
  14327. // needed to complete the UTF-8 character (if applicable) are returned.
  14328. function utf8CheckIncomplete(self, buf, i) {
  14329. var j = buf.length - 1;
  14330. if (j < i) return 0;
  14331. var nb = utf8CheckByte(buf[j]);
  14332. if (nb >= 0) {
  14333. if (nb > 0) self.lastNeed = nb - 1;
  14334. return nb;
  14335. }
  14336. if (--j < i || nb === -2) return 0;
  14337. nb = utf8CheckByte(buf[j]);
  14338. if (nb >= 0) {
  14339. if (nb > 0) self.lastNeed = nb - 2;
  14340. return nb;
  14341. }
  14342. if (--j < i || nb === -2) return 0;
  14343. nb = utf8CheckByte(buf[j]);
  14344. if (nb >= 0) {
  14345. if (nb > 0) {
  14346. if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
  14347. }
  14348. return nb;
  14349. }
  14350. return 0;
  14351. }
  14352. // Validates as many continuation bytes for a multi-byte UTF-8 character as
  14353. // needed or are available. If we see a non-continuation byte where we expect
  14354. // one, we "replace" the validated continuation bytes we've seen so far with
  14355. // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
  14356. // behavior. The continuation byte check is included three times in the case
  14357. // where all of the continuation bytes for a character exist in the same buffer.
  14358. // It is also done this way as a slight performance increase instead of using a
  14359. // loop.
  14360. function utf8CheckExtraBytes(self, buf, p) {
  14361. if ((buf[0] & 0xC0) !== 0x80) {
  14362. self.lastNeed = 0;
  14363. return '\ufffd';
  14364. }
  14365. if (self.lastNeed > 1 && buf.length > 1) {
  14366. if ((buf[1] & 0xC0) !== 0x80) {
  14367. self.lastNeed = 1;
  14368. return '\ufffd';
  14369. }
  14370. if (self.lastNeed > 2 && buf.length > 2) {
  14371. if ((buf[2] & 0xC0) !== 0x80) {
  14372. self.lastNeed = 2;
  14373. return '\ufffd';
  14374. }
  14375. }
  14376. }
  14377. }
  14378. // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
  14379. function utf8FillLast(buf) {
  14380. var p = this.lastTotal - this.lastNeed;
  14381. var r = utf8CheckExtraBytes(this, buf, p);
  14382. if (r !== undefined) return r;
  14383. if (this.lastNeed <= buf.length) {
  14384. buf.copy(this.lastChar, p, 0, this.lastNeed);
  14385. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  14386. }
  14387. buf.copy(this.lastChar, p, 0, buf.length);
  14388. this.lastNeed -= buf.length;
  14389. }
  14390. // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
  14391. // partial character, the character's bytes are buffered until the required
  14392. // number of bytes are available.
  14393. function utf8Text(buf, i) {
  14394. var total = utf8CheckIncomplete(this, buf, i);
  14395. if (!this.lastNeed) return buf.toString('utf8', i);
  14396. this.lastTotal = total;
  14397. var end = buf.length - (total - this.lastNeed);
  14398. buf.copy(this.lastChar, 0, end);
  14399. return buf.toString('utf8', i, end);
  14400. }
  14401. // For UTF-8, a replacement character is added when ending on a partial
  14402. // character.
  14403. function utf8End(buf) {
  14404. var r = buf && buf.length ? this.write(buf) : '';
  14405. if (this.lastNeed) return r + '\ufffd';
  14406. return r;
  14407. }
  14408. // UTF-16LE typically needs two bytes per character, but even if we have an even
  14409. // number of bytes available, we need to check if we end on a leading/high
  14410. // surrogate. In that case, we need to wait for the next two bytes in order to
  14411. // decode the last character properly.
  14412. function utf16Text(buf, i) {
  14413. if ((buf.length - i) % 2 === 0) {
  14414. var r = buf.toString('utf16le', i);
  14415. if (r) {
  14416. var c = r.charCodeAt(r.length - 1);
  14417. if (c >= 0xD800 && c <= 0xDBFF) {
  14418. this.lastNeed = 2;
  14419. this.lastTotal = 4;
  14420. this.lastChar[0] = buf[buf.length - 2];
  14421. this.lastChar[1] = buf[buf.length - 1];
  14422. return r.slice(0, -1);
  14423. }
  14424. }
  14425. return r;
  14426. }
  14427. this.lastNeed = 1;
  14428. this.lastTotal = 2;
  14429. this.lastChar[0] = buf[buf.length - 1];
  14430. return buf.toString('utf16le', i, buf.length - 1);
  14431. }
  14432. // For UTF-16LE we do not explicitly append special replacement characters if we
  14433. // end on a partial character, we simply let v8 handle that.
  14434. function utf16End(buf) {
  14435. var r = buf && buf.length ? this.write(buf) : '';
  14436. if (this.lastNeed) {
  14437. var end = this.lastTotal - this.lastNeed;
  14438. return r + this.lastChar.toString('utf16le', 0, end);
  14439. }
  14440. return r;
  14441. }
  14442. function base64Text(buf, i) {
  14443. var n = (buf.length - i) % 3;
  14444. if (n === 0) return buf.toString('base64', i);
  14445. this.lastNeed = 3 - n;
  14446. this.lastTotal = 3;
  14447. if (n === 1) {
  14448. this.lastChar[0] = buf[buf.length - 1];
  14449. } else {
  14450. this.lastChar[0] = buf[buf.length - 2];
  14451. this.lastChar[1] = buf[buf.length - 1];
  14452. }
  14453. return buf.toString('base64', i, buf.length - n);
  14454. }
  14455. function base64End(buf) {
  14456. var r = buf && buf.length ? this.write(buf) : '';
  14457. if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
  14458. return r;
  14459. }
  14460. // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
  14461. function simpleWrite(buf) {
  14462. return buf.toString(this.encoding);
  14463. }
  14464. function simpleEnd(buf) {
  14465. return buf && buf.length ? this.write(buf) : '';
  14466. }
  14467. /***/ }),
  14468. /* 137 */
  14469. /*!***************************************************************!*\
  14470. !*** ./node_modules/readable-stream/lib/_stream_transform.js ***!
  14471. \***************************************************************/
  14472. /*! no static exports found */
  14473. /***/ (function(module, exports, __webpack_require__) {
  14474. "use strict";
  14475. // Copyright Joyent, Inc. and other Node contributors.
  14476. //
  14477. // Permission is hereby granted, free of charge, to any person obtaining a
  14478. // copy of this software and associated documentation files (the
  14479. // "Software"), to deal in the Software without restriction, including
  14480. // without limitation the rights to use, copy, modify, merge, publish,
  14481. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14482. // persons to whom the Software is furnished to do so, subject to the
  14483. // following conditions:
  14484. //
  14485. // The above copyright notice and this permission notice shall be included
  14486. // in all copies or substantial portions of the Software.
  14487. //
  14488. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14489. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14490. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14491. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14492. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14493. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14494. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14495. // a transform stream is a readable/writable stream where you do
  14496. // something with the data. Sometimes it's called a "filter",
  14497. // but that's not a great name for it, since that implies a thing where
  14498. // some bits pass through, and others are simply ignored. (That would
  14499. // be a valid example of a transform, of course.)
  14500. //
  14501. // While the output is causally related to the input, it's not a
  14502. // necessarily symmetric or synchronous transformation. For example,
  14503. // a zlib stream might take multiple plain-text writes(), and then
  14504. // emit a single compressed chunk some time in the future.
  14505. //
  14506. // Here's how this works:
  14507. //
  14508. // The Transform stream has all the aspects of the readable and writable
  14509. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  14510. // internally, and returns false if there's a lot of pending writes
  14511. // buffered up. When you call read(), that calls _read(n) until
  14512. // there's enough pending readable data buffered up.
  14513. //
  14514. // In a transform stream, the written data is placed in a buffer. When
  14515. // _read(n) is called, it transforms the queued up data, calling the
  14516. // buffered _write cb's as it consumes chunks. If consuming a single
  14517. // written chunk would result in multiple output chunks, then the first
  14518. // outputted bit calls the readcb, and subsequent chunks just go into
  14519. // the read buffer, and will cause it to emit 'readable' if necessary.
  14520. //
  14521. // This way, back-pressure is actually determined by the reading side,
  14522. // since _read has to be called to start processing a new chunk. However,
  14523. // a pathological inflate type of transform can cause excessive buffering
  14524. // here. For example, imagine a stream where every byte of input is
  14525. // interpreted as an integer from 0-255, and then results in that many
  14526. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  14527. // 1kb of data being output. In this case, you could write a very small
  14528. // amount of input, and end up with a very large amount of output. In
  14529. // such a pathological inflating mechanism, there'd be no way to tell
  14530. // the system to stop doing the transform. A single 4MB write could
  14531. // cause the system to run out of memory.
  14532. //
  14533. // However, even in such a pathological case, only a single written chunk
  14534. // would be consumed, and then the rest would wait (un-transformed) until
  14535. // the results of the previous transformed chunk were consumed.
  14536. module.exports = Transform;
  14537. var Duplex = __webpack_require__(/*! ./_stream_duplex */ 133);
  14538. /*<replacement>*/
  14539. var util = Object.create(__webpack_require__(/*! core-util-is */ 128));
  14540. util.inherits = __webpack_require__(/*! inherits */ 120);
  14541. /*</replacement>*/
  14542. util.inherits(Transform, Duplex);
  14543. function afterTransform(er, data) {
  14544. var ts = this._transformState;
  14545. ts.transforming = false;
  14546. var cb = ts.writecb;
  14547. if (!cb) {
  14548. return this.emit('error', new Error('write callback called multiple times'));
  14549. }
  14550. ts.writechunk = null;
  14551. ts.writecb = null;
  14552. if (data != null) // single equals check for both `null` and `undefined`
  14553. this.push(data);
  14554. cb(er);
  14555. var rs = this._readableState;
  14556. rs.reading = false;
  14557. if (rs.needReadable || rs.length < rs.highWaterMark) {
  14558. this._read(rs.highWaterMark);
  14559. }
  14560. }
  14561. function Transform(options) {
  14562. if (!(this instanceof Transform)) return new Transform(options);
  14563. Duplex.call(this, options);
  14564. this._transformState = {
  14565. afterTransform: afterTransform.bind(this),
  14566. needTransform: false,
  14567. transforming: false,
  14568. writecb: null,
  14569. writechunk: null,
  14570. writeencoding: null
  14571. };
  14572. // start out asking for a readable event once data is transformed.
  14573. this._readableState.needReadable = true;
  14574. // we have implemented the _read method, and done the other things
  14575. // that Readable wants before the first _read call, so unset the
  14576. // sync guard flag.
  14577. this._readableState.sync = false;
  14578. if (options) {
  14579. if (typeof options.transform === 'function') this._transform = options.transform;
  14580. if (typeof options.flush === 'function') this._flush = options.flush;
  14581. }
  14582. // When the writable side finishes, then flush out anything remaining.
  14583. this.on('prefinish', prefinish);
  14584. }
  14585. function prefinish() {
  14586. var _this = this;
  14587. if (typeof this._flush === 'function') {
  14588. this._flush(function (er, data) {
  14589. done(_this, er, data);
  14590. });
  14591. } else {
  14592. done(this, null, null);
  14593. }
  14594. }
  14595. Transform.prototype.push = function (chunk, encoding) {
  14596. this._transformState.needTransform = false;
  14597. return Duplex.prototype.push.call(this, chunk, encoding);
  14598. };
  14599. // This is the part where you do stuff!
  14600. // override this function in implementation classes.
  14601. // 'chunk' is an input chunk.
  14602. //
  14603. // Call `push(newChunk)` to pass along transformed output
  14604. // to the readable side. You may call 'push' zero or more times.
  14605. //
  14606. // Call `cb(err)` when you are done with this chunk. If you pass
  14607. // an error, then that'll put the hurt on the whole operation. If you
  14608. // never call cb(), then you'll never get another chunk.
  14609. Transform.prototype._transform = function (chunk, encoding, cb) {
  14610. throw new Error('_transform() is not implemented');
  14611. };
  14612. Transform.prototype._write = function (chunk, encoding, cb) {
  14613. var ts = this._transformState;
  14614. ts.writecb = cb;
  14615. ts.writechunk = chunk;
  14616. ts.writeencoding = encoding;
  14617. if (!ts.transforming) {
  14618. var rs = this._readableState;
  14619. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  14620. }
  14621. };
  14622. // Doesn't matter what the args are here.
  14623. // _transform does all the work.
  14624. // That we got here means that the readable side wants more data.
  14625. Transform.prototype._read = function (n) {
  14626. var ts = this._transformState;
  14627. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  14628. ts.transforming = true;
  14629. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  14630. } else {
  14631. // mark that we need a transform, so that any data that comes in
  14632. // will get processed, now that we've asked for it.
  14633. ts.needTransform = true;
  14634. }
  14635. };
  14636. Transform.prototype._destroy = function (err, cb) {
  14637. var _this2 = this;
  14638. Duplex.prototype._destroy.call(this, err, function (err2) {
  14639. cb(err2);
  14640. _this2.emit('close');
  14641. });
  14642. };
  14643. function done(stream, er, data) {
  14644. if (er) return stream.emit('error', er);
  14645. if (data != null) // single equals check for both `null` and `undefined`
  14646. stream.push(data);
  14647. // if there's nothing in the write buffer, then that means
  14648. // that nothing more will ever be provided
  14649. if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
  14650. if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
  14651. return stream.push(null);
  14652. }
  14653. /***/ }),
  14654. /* 138 */
  14655. /*!*****************************************************************!*\
  14656. !*** ./node_modules/readable-stream/lib/_stream_passthrough.js ***!
  14657. \*****************************************************************/
  14658. /*! no static exports found */
  14659. /***/ (function(module, exports, __webpack_require__) {
  14660. "use strict";
  14661. // Copyright Joyent, Inc. and other Node contributors.
  14662. //
  14663. // Permission is hereby granted, free of charge, to any person obtaining a
  14664. // copy of this software and associated documentation files (the
  14665. // "Software"), to deal in the Software without restriction, including
  14666. // without limitation the rights to use, copy, modify, merge, publish,
  14667. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14668. // persons to whom the Software is furnished to do so, subject to the
  14669. // following conditions:
  14670. //
  14671. // The above copyright notice and this permission notice shall be included
  14672. // in all copies or substantial portions of the Software.
  14673. //
  14674. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14675. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14676. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14677. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14678. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14679. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14680. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14681. // a passthrough stream.
  14682. // basically just the most minimal sort of Transform stream.
  14683. // Every written chunk gets output as-is.
  14684. module.exports = PassThrough;
  14685. var Transform = __webpack_require__(/*! ./_stream_transform */ 137);
  14686. /*<replacement>*/
  14687. var util = Object.create(__webpack_require__(/*! core-util-is */ 128));
  14688. util.inherits = __webpack_require__(/*! inherits */ 120);
  14689. /*</replacement>*/
  14690. util.inherits(PassThrough, Transform);
  14691. function PassThrough(options) {
  14692. if (!(this instanceof PassThrough)) return new PassThrough(options);
  14693. Transform.call(this, options);
  14694. }
  14695. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  14696. cb(null, chunk);
  14697. };
  14698. /***/ }),
  14699. /* 139 */
  14700. /*!*****************************************!*\
  14701. !*** ./node_modules/ripemd160/index.js ***!
  14702. \*****************************************/
  14703. /*! no static exports found */
  14704. /***/ (function(module, exports, __webpack_require__) {
  14705. "use strict";
  14706. var Buffer = __webpack_require__(/*! buffer */ 115).Buffer
  14707. var inherits = __webpack_require__(/*! inherits */ 120)
  14708. var HashBase = __webpack_require__(/*! hash-base */ 122)
  14709. var ARRAY16 = new Array(16)
  14710. var zl = [
  14711. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  14712. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  14713. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  14714. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  14715. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  14716. ]
  14717. var zr = [
  14718. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  14719. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  14720. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  14721. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  14722. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  14723. ]
  14724. var sl = [
  14725. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  14726. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  14727. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  14728. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  14729. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  14730. ]
  14731. var sr = [
  14732. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  14733. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  14734. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  14735. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  14736. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  14737. ]
  14738. var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]
  14739. var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]
  14740. function RIPEMD160 () {
  14741. HashBase.call(this, 64)
  14742. // state
  14743. this._a = 0x67452301
  14744. this._b = 0xefcdab89
  14745. this._c = 0x98badcfe
  14746. this._d = 0x10325476
  14747. this._e = 0xc3d2e1f0
  14748. }
  14749. inherits(RIPEMD160, HashBase)
  14750. RIPEMD160.prototype._update = function () {
  14751. var words = ARRAY16
  14752. for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4)
  14753. var al = this._a | 0
  14754. var bl = this._b | 0
  14755. var cl = this._c | 0
  14756. var dl = this._d | 0
  14757. var el = this._e | 0
  14758. var ar = this._a | 0
  14759. var br = this._b | 0
  14760. var cr = this._c | 0
  14761. var dr = this._d | 0
  14762. var er = this._e | 0
  14763. // computation
  14764. for (var i = 0; i < 80; i += 1) {
  14765. var tl
  14766. var tr
  14767. if (i < 16) {
  14768. tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i])
  14769. tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])
  14770. } else if (i < 32) {
  14771. tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i])
  14772. tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])
  14773. } else if (i < 48) {
  14774. tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i])
  14775. tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])
  14776. } else if (i < 64) {
  14777. tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i])
  14778. tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])
  14779. } else { // if (i<80) {
  14780. tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i])
  14781. tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])
  14782. }
  14783. al = el
  14784. el = dl
  14785. dl = rotl(cl, 10)
  14786. cl = bl
  14787. bl = tl
  14788. ar = er
  14789. er = dr
  14790. dr = rotl(cr, 10)
  14791. cr = br
  14792. br = tr
  14793. }
  14794. // update state
  14795. var t = (this._b + cl + dr) | 0
  14796. this._b = (this._c + dl + er) | 0
  14797. this._c = (this._d + el + ar) | 0
  14798. this._d = (this._e + al + br) | 0
  14799. this._e = (this._a + bl + cr) | 0
  14800. this._a = t
  14801. }
  14802. RIPEMD160.prototype._digest = function () {
  14803. // create padding and handle blocks
  14804. this._block[this._blockOffset++] = 0x80
  14805. if (this._blockOffset > 56) {
  14806. this._block.fill(0, this._blockOffset, 64)
  14807. this._update()
  14808. this._blockOffset = 0
  14809. }
  14810. this._block.fill(0, this._blockOffset, 56)
  14811. this._block.writeUInt32LE(this._length[0], 56)
  14812. this._block.writeUInt32LE(this._length[1], 60)
  14813. this._update()
  14814. // produce result
  14815. var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20)
  14816. buffer.writeInt32LE(this._a, 0)
  14817. buffer.writeInt32LE(this._b, 4)
  14818. buffer.writeInt32LE(this._c, 8)
  14819. buffer.writeInt32LE(this._d, 12)
  14820. buffer.writeInt32LE(this._e, 16)
  14821. return buffer
  14822. }
  14823. function rotl (x, n) {
  14824. return (x << n) | (x >>> (32 - n))
  14825. }
  14826. function fn1 (a, b, c, d, e, m, k, s) {
  14827. return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0
  14828. }
  14829. function fn2 (a, b, c, d, e, m, k, s) {
  14830. return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0
  14831. }
  14832. function fn3 (a, b, c, d, e, m, k, s) {
  14833. return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0
  14834. }
  14835. function fn4 (a, b, c, d, e, m, k, s) {
  14836. return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0
  14837. }
  14838. function fn5 (a, b, c, d, e, m, k, s) {
  14839. return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0
  14840. }
  14841. module.exports = RIPEMD160
  14842. /***/ }),
  14843. /* 140 */
  14844. /*!**************************************!*\
  14845. !*** ./node_modules/sha.js/index.js ***!
  14846. \**************************************/
  14847. /*! no static exports found */
  14848. /***/ (function(module, exports, __webpack_require__) {
  14849. var exports = module.exports = function SHA (algorithm) {
  14850. algorithm = algorithm.toLowerCase()
  14851. var Algorithm = exports[algorithm]
  14852. if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
  14853. return new Algorithm()
  14854. }
  14855. exports.sha = __webpack_require__(/*! ./sha */ 141)
  14856. exports.sha1 = __webpack_require__(/*! ./sha1 */ 143)
  14857. exports.sha224 = __webpack_require__(/*! ./sha224 */ 144)
  14858. exports.sha256 = __webpack_require__(/*! ./sha256 */ 145)
  14859. exports.sha384 = __webpack_require__(/*! ./sha384 */ 146)
  14860. exports.sha512 = __webpack_require__(/*! ./sha512 */ 147)
  14861. /***/ }),
  14862. /* 141 */
  14863. /*!************************************!*\
  14864. !*** ./node_modules/sha.js/sha.js ***!
  14865. \************************************/
  14866. /*! no static exports found */
  14867. /***/ (function(module, exports, __webpack_require__) {
  14868. /*
  14869. * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
  14870. * in FIPS PUB 180-1
  14871. * This source code is derived from sha1.js of the same repository.
  14872. * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
  14873. * operation was added.
  14874. */
  14875. var inherits = __webpack_require__(/*! inherits */ 120)
  14876. var Hash = __webpack_require__(/*! ./hash */ 142)
  14877. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  14878. var K = [
  14879. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  14880. ]
  14881. var W = new Array(80)
  14882. function Sha () {
  14883. this.init()
  14884. this._w = W
  14885. Hash.call(this, 64, 56)
  14886. }
  14887. inherits(Sha, Hash)
  14888. Sha.prototype.init = function () {
  14889. this._a = 0x67452301
  14890. this._b = 0xefcdab89
  14891. this._c = 0x98badcfe
  14892. this._d = 0x10325476
  14893. this._e = 0xc3d2e1f0
  14894. return this
  14895. }
  14896. function rotl5 (num) {
  14897. return (num << 5) | (num >>> 27)
  14898. }
  14899. function rotl30 (num) {
  14900. return (num << 30) | (num >>> 2)
  14901. }
  14902. function ft (s, b, c, d) {
  14903. if (s === 0) return (b & c) | ((~b) & d)
  14904. if (s === 2) return (b & c) | (b & d) | (c & d)
  14905. return b ^ c ^ d
  14906. }
  14907. Sha.prototype._update = function (M) {
  14908. var W = this._w
  14909. var a = this._a | 0
  14910. var b = this._b | 0
  14911. var c = this._c | 0
  14912. var d = this._d | 0
  14913. var e = this._e | 0
  14914. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  14915. for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
  14916. for (var j = 0; j < 80; ++j) {
  14917. var s = ~~(j / 20)
  14918. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  14919. e = d
  14920. d = c
  14921. c = rotl30(b)
  14922. b = a
  14923. a = t
  14924. }
  14925. this._a = (a + this._a) | 0
  14926. this._b = (b + this._b) | 0
  14927. this._c = (c + this._c) | 0
  14928. this._d = (d + this._d) | 0
  14929. this._e = (e + this._e) | 0
  14930. }
  14931. Sha.prototype._hash = function () {
  14932. var H = Buffer.allocUnsafe(20)
  14933. H.writeInt32BE(this._a | 0, 0)
  14934. H.writeInt32BE(this._b | 0, 4)
  14935. H.writeInt32BE(this._c | 0, 8)
  14936. H.writeInt32BE(this._d | 0, 12)
  14937. H.writeInt32BE(this._e | 0, 16)
  14938. return H
  14939. }
  14940. module.exports = Sha
  14941. /***/ }),
  14942. /* 142 */
  14943. /*!*************************************!*\
  14944. !*** ./node_modules/sha.js/hash.js ***!
  14945. \*************************************/
  14946. /*! no static exports found */
  14947. /***/ (function(module, exports, __webpack_require__) {
  14948. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  14949. // prototype class for hash functions
  14950. function Hash (blockSize, finalSize) {
  14951. this._block = Buffer.alloc(blockSize)
  14952. this._finalSize = finalSize
  14953. this._blockSize = blockSize
  14954. this._len = 0
  14955. }
  14956. Hash.prototype.update = function (data, enc) {
  14957. if (typeof data === 'string') {
  14958. enc = enc || 'utf8'
  14959. data = Buffer.from(data, enc)
  14960. }
  14961. var block = this._block
  14962. var blockSize = this._blockSize
  14963. var length = data.length
  14964. var accum = this._len
  14965. for (var offset = 0; offset < length;) {
  14966. var assigned = accum % blockSize
  14967. var remainder = Math.min(length - offset, blockSize - assigned)
  14968. for (var i = 0; i < remainder; i++) {
  14969. block[assigned + i] = data[offset + i]
  14970. }
  14971. accum += remainder
  14972. offset += remainder
  14973. if ((accum % blockSize) === 0) {
  14974. this._update(block)
  14975. }
  14976. }
  14977. this._len += length
  14978. return this
  14979. }
  14980. Hash.prototype.digest = function (enc) {
  14981. var rem = this._len % this._blockSize
  14982. this._block[rem] = 0x80
  14983. // zero (rem + 1) trailing bits, where (rem + 1) is the smallest
  14984. // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize
  14985. this._block.fill(0, rem + 1)
  14986. if (rem >= this._finalSize) {
  14987. this._update(this._block)
  14988. this._block.fill(0)
  14989. }
  14990. var bits = this._len * 8
  14991. // uint32
  14992. if (bits <= 0xffffffff) {
  14993. this._block.writeUInt32BE(bits, this._blockSize - 4)
  14994. // uint64
  14995. } else {
  14996. var lowBits = (bits & 0xffffffff) >>> 0
  14997. var highBits = (bits - lowBits) / 0x100000000
  14998. this._block.writeUInt32BE(highBits, this._blockSize - 8)
  14999. this._block.writeUInt32BE(lowBits, this._blockSize - 4)
  15000. }
  15001. this._update(this._block)
  15002. var hash = this._hash()
  15003. return enc ? hash.toString(enc) : hash
  15004. }
  15005. Hash.prototype._update = function () {
  15006. throw new Error('_update must be implemented by subclass')
  15007. }
  15008. module.exports = Hash
  15009. /***/ }),
  15010. /* 143 */
  15011. /*!*************************************!*\
  15012. !*** ./node_modules/sha.js/sha1.js ***!
  15013. \*************************************/
  15014. /*! no static exports found */
  15015. /***/ (function(module, exports, __webpack_require__) {
  15016. /*
  15017. * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
  15018. * in FIPS PUB 180-1
  15019. * Version 2.1a Copyright Paul Johnston 2000 - 2002.
  15020. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  15021. * Distributed under the BSD License
  15022. * See http://pajhome.org.uk/crypt/md5 for details.
  15023. */
  15024. var inherits = __webpack_require__(/*! inherits */ 120)
  15025. var Hash = __webpack_require__(/*! ./hash */ 142)
  15026. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  15027. var K = [
  15028. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  15029. ]
  15030. var W = new Array(80)
  15031. function Sha1 () {
  15032. this.init()
  15033. this._w = W
  15034. Hash.call(this, 64, 56)
  15035. }
  15036. inherits(Sha1, Hash)
  15037. Sha1.prototype.init = function () {
  15038. this._a = 0x67452301
  15039. this._b = 0xefcdab89
  15040. this._c = 0x98badcfe
  15041. this._d = 0x10325476
  15042. this._e = 0xc3d2e1f0
  15043. return this
  15044. }
  15045. function rotl1 (num) {
  15046. return (num << 1) | (num >>> 31)
  15047. }
  15048. function rotl5 (num) {
  15049. return (num << 5) | (num >>> 27)
  15050. }
  15051. function rotl30 (num) {
  15052. return (num << 30) | (num >>> 2)
  15053. }
  15054. function ft (s, b, c, d) {
  15055. if (s === 0) return (b & c) | ((~b) & d)
  15056. if (s === 2) return (b & c) | (b & d) | (c & d)
  15057. return b ^ c ^ d
  15058. }
  15059. Sha1.prototype._update = function (M) {
  15060. var W = this._w
  15061. var a = this._a | 0
  15062. var b = this._b | 0
  15063. var c = this._c | 0
  15064. var d = this._d | 0
  15065. var e = this._e | 0
  15066. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  15067. for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
  15068. for (var j = 0; j < 80; ++j) {
  15069. var s = ~~(j / 20)
  15070. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  15071. e = d
  15072. d = c
  15073. c = rotl30(b)
  15074. b = a
  15075. a = t
  15076. }
  15077. this._a = (a + this._a) | 0
  15078. this._b = (b + this._b) | 0
  15079. this._c = (c + this._c) | 0
  15080. this._d = (d + this._d) | 0
  15081. this._e = (e + this._e) | 0
  15082. }
  15083. Sha1.prototype._hash = function () {
  15084. var H = Buffer.allocUnsafe(20)
  15085. H.writeInt32BE(this._a | 0, 0)
  15086. H.writeInt32BE(this._b | 0, 4)
  15087. H.writeInt32BE(this._c | 0, 8)
  15088. H.writeInt32BE(this._d | 0, 12)
  15089. H.writeInt32BE(this._e | 0, 16)
  15090. return H
  15091. }
  15092. module.exports = Sha1
  15093. /***/ }),
  15094. /* 144 */
  15095. /*!***************************************!*\
  15096. !*** ./node_modules/sha.js/sha224.js ***!
  15097. \***************************************/
  15098. /*! no static exports found */
  15099. /***/ (function(module, exports, __webpack_require__) {
  15100. /**
  15101. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  15102. * in FIPS 180-2
  15103. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  15104. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  15105. *
  15106. */
  15107. var inherits = __webpack_require__(/*! inherits */ 120)
  15108. var Sha256 = __webpack_require__(/*! ./sha256 */ 145)
  15109. var Hash = __webpack_require__(/*! ./hash */ 142)
  15110. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  15111. var W = new Array(64)
  15112. function Sha224 () {
  15113. this.init()
  15114. this._w = W // new Array(64)
  15115. Hash.call(this, 64, 56)
  15116. }
  15117. inherits(Sha224, Sha256)
  15118. Sha224.prototype.init = function () {
  15119. this._a = 0xc1059ed8
  15120. this._b = 0x367cd507
  15121. this._c = 0x3070dd17
  15122. this._d = 0xf70e5939
  15123. this._e = 0xffc00b31
  15124. this._f = 0x68581511
  15125. this._g = 0x64f98fa7
  15126. this._h = 0xbefa4fa4
  15127. return this
  15128. }
  15129. Sha224.prototype._hash = function () {
  15130. var H = Buffer.allocUnsafe(28)
  15131. H.writeInt32BE(this._a, 0)
  15132. H.writeInt32BE(this._b, 4)
  15133. H.writeInt32BE(this._c, 8)
  15134. H.writeInt32BE(this._d, 12)
  15135. H.writeInt32BE(this._e, 16)
  15136. H.writeInt32BE(this._f, 20)
  15137. H.writeInt32BE(this._g, 24)
  15138. return H
  15139. }
  15140. module.exports = Sha224
  15141. /***/ }),
  15142. /* 145 */
  15143. /*!***************************************!*\
  15144. !*** ./node_modules/sha.js/sha256.js ***!
  15145. \***************************************/
  15146. /*! no static exports found */
  15147. /***/ (function(module, exports, __webpack_require__) {
  15148. /**
  15149. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  15150. * in FIPS 180-2
  15151. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  15152. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  15153. *
  15154. */
  15155. var inherits = __webpack_require__(/*! inherits */ 120)
  15156. var Hash = __webpack_require__(/*! ./hash */ 142)
  15157. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  15158. var K = [
  15159. 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
  15160. 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
  15161. 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
  15162. 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
  15163. 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
  15164. 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
  15165. 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
  15166. 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
  15167. 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
  15168. 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
  15169. 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
  15170. 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
  15171. 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
  15172. 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
  15173. 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
  15174. 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
  15175. ]
  15176. var W = new Array(64)
  15177. function Sha256 () {
  15178. this.init()
  15179. this._w = W // new Array(64)
  15180. Hash.call(this, 64, 56)
  15181. }
  15182. inherits(Sha256, Hash)
  15183. Sha256.prototype.init = function () {
  15184. this._a = 0x6a09e667
  15185. this._b = 0xbb67ae85
  15186. this._c = 0x3c6ef372
  15187. this._d = 0xa54ff53a
  15188. this._e = 0x510e527f
  15189. this._f = 0x9b05688c
  15190. this._g = 0x1f83d9ab
  15191. this._h = 0x5be0cd19
  15192. return this
  15193. }
  15194. function ch (x, y, z) {
  15195. return z ^ (x & (y ^ z))
  15196. }
  15197. function maj (x, y, z) {
  15198. return (x & y) | (z & (x | y))
  15199. }
  15200. function sigma0 (x) {
  15201. return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
  15202. }
  15203. function sigma1 (x) {
  15204. return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
  15205. }
  15206. function gamma0 (x) {
  15207. return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
  15208. }
  15209. function gamma1 (x) {
  15210. return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
  15211. }
  15212. Sha256.prototype._update = function (M) {
  15213. var W = this._w
  15214. var a = this._a | 0
  15215. var b = this._b | 0
  15216. var c = this._c | 0
  15217. var d = this._d | 0
  15218. var e = this._e | 0
  15219. var f = this._f | 0
  15220. var g = this._g | 0
  15221. var h = this._h | 0
  15222. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  15223. for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
  15224. for (var j = 0; j < 64; ++j) {
  15225. var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
  15226. var T2 = (sigma0(a) + maj(a, b, c)) | 0
  15227. h = g
  15228. g = f
  15229. f = e
  15230. e = (d + T1) | 0
  15231. d = c
  15232. c = b
  15233. b = a
  15234. a = (T1 + T2) | 0
  15235. }
  15236. this._a = (a + this._a) | 0
  15237. this._b = (b + this._b) | 0
  15238. this._c = (c + this._c) | 0
  15239. this._d = (d + this._d) | 0
  15240. this._e = (e + this._e) | 0
  15241. this._f = (f + this._f) | 0
  15242. this._g = (g + this._g) | 0
  15243. this._h = (h + this._h) | 0
  15244. }
  15245. Sha256.prototype._hash = function () {
  15246. var H = Buffer.allocUnsafe(32)
  15247. H.writeInt32BE(this._a, 0)
  15248. H.writeInt32BE(this._b, 4)
  15249. H.writeInt32BE(this._c, 8)
  15250. H.writeInt32BE(this._d, 12)
  15251. H.writeInt32BE(this._e, 16)
  15252. H.writeInt32BE(this._f, 20)
  15253. H.writeInt32BE(this._g, 24)
  15254. H.writeInt32BE(this._h, 28)
  15255. return H
  15256. }
  15257. module.exports = Sha256
  15258. /***/ }),
  15259. /* 146 */
  15260. /*!***************************************!*\
  15261. !*** ./node_modules/sha.js/sha384.js ***!
  15262. \***************************************/
  15263. /*! no static exports found */
  15264. /***/ (function(module, exports, __webpack_require__) {
  15265. var inherits = __webpack_require__(/*! inherits */ 120)
  15266. var SHA512 = __webpack_require__(/*! ./sha512 */ 147)
  15267. var Hash = __webpack_require__(/*! ./hash */ 142)
  15268. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  15269. var W = new Array(160)
  15270. function Sha384 () {
  15271. this.init()
  15272. this._w = W
  15273. Hash.call(this, 128, 112)
  15274. }
  15275. inherits(Sha384, SHA512)
  15276. Sha384.prototype.init = function () {
  15277. this._ah = 0xcbbb9d5d
  15278. this._bh = 0x629a292a
  15279. this._ch = 0x9159015a
  15280. this._dh = 0x152fecd8
  15281. this._eh = 0x67332667
  15282. this._fh = 0x8eb44a87
  15283. this._gh = 0xdb0c2e0d
  15284. this._hh = 0x47b5481d
  15285. this._al = 0xc1059ed8
  15286. this._bl = 0x367cd507
  15287. this._cl = 0x3070dd17
  15288. this._dl = 0xf70e5939
  15289. this._el = 0xffc00b31
  15290. this._fl = 0x68581511
  15291. this._gl = 0x64f98fa7
  15292. this._hl = 0xbefa4fa4
  15293. return this
  15294. }
  15295. Sha384.prototype._hash = function () {
  15296. var H = Buffer.allocUnsafe(48)
  15297. function writeInt64BE (h, l, offset) {
  15298. H.writeInt32BE(h, offset)
  15299. H.writeInt32BE(l, offset + 4)
  15300. }
  15301. writeInt64BE(this._ah, this._al, 0)
  15302. writeInt64BE(this._bh, this._bl, 8)
  15303. writeInt64BE(this._ch, this._cl, 16)
  15304. writeInt64BE(this._dh, this._dl, 24)
  15305. writeInt64BE(this._eh, this._el, 32)
  15306. writeInt64BE(this._fh, this._fl, 40)
  15307. return H
  15308. }
  15309. module.exports = Sha384
  15310. /***/ }),
  15311. /* 147 */
  15312. /*!***************************************!*\
  15313. !*** ./node_modules/sha.js/sha512.js ***!
  15314. \***************************************/
  15315. /*! no static exports found */
  15316. /***/ (function(module, exports, __webpack_require__) {
  15317. var inherits = __webpack_require__(/*! inherits */ 120)
  15318. var Hash = __webpack_require__(/*! ./hash */ 142)
  15319. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  15320. var K = [
  15321. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  15322. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  15323. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  15324. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  15325. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  15326. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  15327. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  15328. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  15329. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  15330. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  15331. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  15332. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  15333. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  15334. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  15335. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  15336. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  15337. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  15338. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  15339. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  15340. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  15341. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  15342. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  15343. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  15344. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  15345. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  15346. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  15347. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  15348. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  15349. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  15350. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  15351. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  15352. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  15353. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  15354. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  15355. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  15356. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  15357. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  15358. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  15359. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  15360. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  15361. ]
  15362. var W = new Array(160)
  15363. function Sha512 () {
  15364. this.init()
  15365. this._w = W
  15366. Hash.call(this, 128, 112)
  15367. }
  15368. inherits(Sha512, Hash)
  15369. Sha512.prototype.init = function () {
  15370. this._ah = 0x6a09e667
  15371. this._bh = 0xbb67ae85
  15372. this._ch = 0x3c6ef372
  15373. this._dh = 0xa54ff53a
  15374. this._eh = 0x510e527f
  15375. this._fh = 0x9b05688c
  15376. this._gh = 0x1f83d9ab
  15377. this._hh = 0x5be0cd19
  15378. this._al = 0xf3bcc908
  15379. this._bl = 0x84caa73b
  15380. this._cl = 0xfe94f82b
  15381. this._dl = 0x5f1d36f1
  15382. this._el = 0xade682d1
  15383. this._fl = 0x2b3e6c1f
  15384. this._gl = 0xfb41bd6b
  15385. this._hl = 0x137e2179
  15386. return this
  15387. }
  15388. function Ch (x, y, z) {
  15389. return z ^ (x & (y ^ z))
  15390. }
  15391. function maj (x, y, z) {
  15392. return (x & y) | (z & (x | y))
  15393. }
  15394. function sigma0 (x, xl) {
  15395. return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
  15396. }
  15397. function sigma1 (x, xl) {
  15398. return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
  15399. }
  15400. function Gamma0 (x, xl) {
  15401. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
  15402. }
  15403. function Gamma0l (x, xl) {
  15404. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
  15405. }
  15406. function Gamma1 (x, xl) {
  15407. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
  15408. }
  15409. function Gamma1l (x, xl) {
  15410. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
  15411. }
  15412. function getCarry (a, b) {
  15413. return (a >>> 0) < (b >>> 0) ? 1 : 0
  15414. }
  15415. Sha512.prototype._update = function (M) {
  15416. var W = this._w
  15417. var ah = this._ah | 0
  15418. var bh = this._bh | 0
  15419. var ch = this._ch | 0
  15420. var dh = this._dh | 0
  15421. var eh = this._eh | 0
  15422. var fh = this._fh | 0
  15423. var gh = this._gh | 0
  15424. var hh = this._hh | 0
  15425. var al = this._al | 0
  15426. var bl = this._bl | 0
  15427. var cl = this._cl | 0
  15428. var dl = this._dl | 0
  15429. var el = this._el | 0
  15430. var fl = this._fl | 0
  15431. var gl = this._gl | 0
  15432. var hl = this._hl | 0
  15433. for (var i = 0; i < 32; i += 2) {
  15434. W[i] = M.readInt32BE(i * 4)
  15435. W[i + 1] = M.readInt32BE(i * 4 + 4)
  15436. }
  15437. for (; i < 160; i += 2) {
  15438. var xh = W[i - 15 * 2]
  15439. var xl = W[i - 15 * 2 + 1]
  15440. var gamma0 = Gamma0(xh, xl)
  15441. var gamma0l = Gamma0l(xl, xh)
  15442. xh = W[i - 2 * 2]
  15443. xl = W[i - 2 * 2 + 1]
  15444. var gamma1 = Gamma1(xh, xl)
  15445. var gamma1l = Gamma1l(xl, xh)
  15446. // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
  15447. var Wi7h = W[i - 7 * 2]
  15448. var Wi7l = W[i - 7 * 2 + 1]
  15449. var Wi16h = W[i - 16 * 2]
  15450. var Wi16l = W[i - 16 * 2 + 1]
  15451. var Wil = (gamma0l + Wi7l) | 0
  15452. var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
  15453. Wil = (Wil + gamma1l) | 0
  15454. Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
  15455. Wil = (Wil + Wi16l) | 0
  15456. Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
  15457. W[i] = Wih
  15458. W[i + 1] = Wil
  15459. }
  15460. for (var j = 0; j < 160; j += 2) {
  15461. Wih = W[j]
  15462. Wil = W[j + 1]
  15463. var majh = maj(ah, bh, ch)
  15464. var majl = maj(al, bl, cl)
  15465. var sigma0h = sigma0(ah, al)
  15466. var sigma0l = sigma0(al, ah)
  15467. var sigma1h = sigma1(eh, el)
  15468. var sigma1l = sigma1(el, eh)
  15469. // t1 = h + sigma1 + ch + K[j] + W[j]
  15470. var Kih = K[j]
  15471. var Kil = K[j + 1]
  15472. var chh = Ch(eh, fh, gh)
  15473. var chl = Ch(el, fl, gl)
  15474. var t1l = (hl + sigma1l) | 0
  15475. var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
  15476. t1l = (t1l + chl) | 0
  15477. t1h = (t1h + chh + getCarry(t1l, chl)) | 0
  15478. t1l = (t1l + Kil) | 0
  15479. t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
  15480. t1l = (t1l + Wil) | 0
  15481. t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
  15482. // t2 = sigma0 + maj
  15483. var t2l = (sigma0l + majl) | 0
  15484. var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
  15485. hh = gh
  15486. hl = gl
  15487. gh = fh
  15488. gl = fl
  15489. fh = eh
  15490. fl = el
  15491. el = (dl + t1l) | 0
  15492. eh = (dh + t1h + getCarry(el, dl)) | 0
  15493. dh = ch
  15494. dl = cl
  15495. ch = bh
  15496. cl = bl
  15497. bh = ah
  15498. bl = al
  15499. al = (t1l + t2l) | 0
  15500. ah = (t1h + t2h + getCarry(al, t1l)) | 0
  15501. }
  15502. this._al = (this._al + al) | 0
  15503. this._bl = (this._bl + bl) | 0
  15504. this._cl = (this._cl + cl) | 0
  15505. this._dl = (this._dl + dl) | 0
  15506. this._el = (this._el + el) | 0
  15507. this._fl = (this._fl + fl) | 0
  15508. this._gl = (this._gl + gl) | 0
  15509. this._hl = (this._hl + hl) | 0
  15510. this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
  15511. this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
  15512. this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
  15513. this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
  15514. this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
  15515. this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
  15516. this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
  15517. this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
  15518. }
  15519. Sha512.prototype._hash = function () {
  15520. var H = Buffer.allocUnsafe(64)
  15521. function writeInt64BE (h, l, offset) {
  15522. H.writeInt32BE(h, offset)
  15523. H.writeInt32BE(l, offset + 4)
  15524. }
  15525. writeInt64BE(this._ah, this._al, 0)
  15526. writeInt64BE(this._bh, this._bl, 8)
  15527. writeInt64BE(this._ch, this._cl, 16)
  15528. writeInt64BE(this._dh, this._dl, 24)
  15529. writeInt64BE(this._eh, this._el, 32)
  15530. writeInt64BE(this._fh, this._fl, 40)
  15531. writeInt64BE(this._gh, this._gl, 48)
  15532. writeInt64BE(this._hh, this._hl, 56)
  15533. return H
  15534. }
  15535. module.exports = Sha512
  15536. /***/ }),
  15537. /* 148 */
  15538. /*!*******************************************!*\
  15539. !*** ./node_modules/cipher-base/index.js ***!
  15540. \*******************************************/
  15541. /*! no static exports found */
  15542. /***/ (function(module, exports, __webpack_require__) {
  15543. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  15544. var Transform = __webpack_require__(/*! stream */ 149).Transform
  15545. var StringDecoder = __webpack_require__(/*! string_decoder */ 136).StringDecoder
  15546. var inherits = __webpack_require__(/*! inherits */ 120)
  15547. function CipherBase (hashMode) {
  15548. Transform.call(this)
  15549. this.hashMode = typeof hashMode === 'string'
  15550. if (this.hashMode) {
  15551. this[hashMode] = this._finalOrDigest
  15552. } else {
  15553. this.final = this._finalOrDigest
  15554. }
  15555. if (this._final) {
  15556. this.__final = this._final
  15557. this._final = null
  15558. }
  15559. this._decoder = null
  15560. this._encoding = null
  15561. }
  15562. inherits(CipherBase, Transform)
  15563. CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
  15564. if (typeof data === 'string') {
  15565. data = Buffer.from(data, inputEnc)
  15566. }
  15567. var outData = this._update(data)
  15568. if (this.hashMode) return this
  15569. if (outputEnc) {
  15570. outData = this._toString(outData, outputEnc)
  15571. }
  15572. return outData
  15573. }
  15574. CipherBase.prototype.setAutoPadding = function () {}
  15575. CipherBase.prototype.getAuthTag = function () {
  15576. throw new Error('trying to get auth tag in unsupported state')
  15577. }
  15578. CipherBase.prototype.setAuthTag = function () {
  15579. throw new Error('trying to set auth tag in unsupported state')
  15580. }
  15581. CipherBase.prototype.setAAD = function () {
  15582. throw new Error('trying to set aad in unsupported state')
  15583. }
  15584. CipherBase.prototype._transform = function (data, _, next) {
  15585. var err
  15586. try {
  15587. if (this.hashMode) {
  15588. this._update(data)
  15589. } else {
  15590. this.push(this._update(data))
  15591. }
  15592. } catch (e) {
  15593. err = e
  15594. } finally {
  15595. next(err)
  15596. }
  15597. }
  15598. CipherBase.prototype._flush = function (done) {
  15599. var err
  15600. try {
  15601. this.push(this.__final())
  15602. } catch (e) {
  15603. err = e
  15604. }
  15605. done(err)
  15606. }
  15607. CipherBase.prototype._finalOrDigest = function (outputEnc) {
  15608. var outData = this.__final() || Buffer.alloc(0)
  15609. if (outputEnc) {
  15610. outData = this._toString(outData, outputEnc, true)
  15611. }
  15612. return outData
  15613. }
  15614. CipherBase.prototype._toString = function (value, enc, fin) {
  15615. if (!this._decoder) {
  15616. this._decoder = new StringDecoder(enc)
  15617. this._encoding = enc
  15618. }
  15619. if (this._encoding !== enc) throw new Error('can\'t switch encodings')
  15620. var out = this._decoder.write(value)
  15621. if (fin) {
  15622. out += this._decoder.end()
  15623. }
  15624. return out
  15625. }
  15626. module.exports = CipherBase
  15627. /***/ }),
  15628. /* 149 */
  15629. /*!*************************************************!*\
  15630. !*** ./node_modules/stream-browserify/index.js ***!
  15631. \*************************************************/
  15632. /*! no static exports found */
  15633. /***/ (function(module, exports, __webpack_require__) {
  15634. // Copyright Joyent, Inc. and other Node contributors.
  15635. //
  15636. // Permission is hereby granted, free of charge, to any person obtaining a
  15637. // copy of this software and associated documentation files (the
  15638. // "Software"), to deal in the Software without restriction, including
  15639. // without limitation the rights to use, copy, modify, merge, publish,
  15640. // distribute, sublicense, and/or sell copies of the Software, and to permit
  15641. // persons to whom the Software is furnished to do so, subject to the
  15642. // following conditions:
  15643. //
  15644. // The above copyright notice and this permission notice shall be included
  15645. // in all copies or substantial portions of the Software.
  15646. //
  15647. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15648. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15649. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  15650. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  15651. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15652. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  15653. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  15654. module.exports = Stream;
  15655. var EE = __webpack_require__(/*! events */ 126).EventEmitter;
  15656. var inherits = __webpack_require__(/*! inherits */ 120);
  15657. inherits(Stream, EE);
  15658. Stream.Readable = __webpack_require__(/*! readable-stream/readable.js */ 123);
  15659. Stream.Writable = __webpack_require__(/*! readable-stream/writable.js */ 150);
  15660. Stream.Duplex = __webpack_require__(/*! readable-stream/duplex.js */ 151);
  15661. Stream.Transform = __webpack_require__(/*! readable-stream/transform.js */ 152);
  15662. Stream.PassThrough = __webpack_require__(/*! readable-stream/passthrough.js */ 153);
  15663. // Backwards-compat with node 0.4.x
  15664. Stream.Stream = Stream;
  15665. // old-style streams. Note that the pipe method (the only relevant
  15666. // part of this class) is overridden in the Readable class.
  15667. function Stream() {
  15668. EE.call(this);
  15669. }
  15670. Stream.prototype.pipe = function(dest, options) {
  15671. var source = this;
  15672. function ondata(chunk) {
  15673. if (dest.writable) {
  15674. if (false === dest.write(chunk) && source.pause) {
  15675. source.pause();
  15676. }
  15677. }
  15678. }
  15679. source.on('data', ondata);
  15680. function ondrain() {
  15681. if (source.readable && source.resume) {
  15682. source.resume();
  15683. }
  15684. }
  15685. dest.on('drain', ondrain);
  15686. // If the 'end' option is not supplied, dest.end() will be called when
  15687. // source gets the 'end' or 'close' events. Only dest.end() once.
  15688. if (!dest._isStdio && (!options || options.end !== false)) {
  15689. source.on('end', onend);
  15690. source.on('close', onclose);
  15691. }
  15692. var didOnEnd = false;
  15693. function onend() {
  15694. if (didOnEnd) return;
  15695. didOnEnd = true;
  15696. dest.end();
  15697. }
  15698. function onclose() {
  15699. if (didOnEnd) return;
  15700. didOnEnd = true;
  15701. if (typeof dest.destroy === 'function') dest.destroy();
  15702. }
  15703. // don't leave dangling pipes when there are errors.
  15704. function onerror(er) {
  15705. cleanup();
  15706. if (EE.listenerCount(this, 'error') === 0) {
  15707. throw er; // Unhandled stream error in pipe.
  15708. }
  15709. }
  15710. source.on('error', onerror);
  15711. dest.on('error', onerror);
  15712. // remove all the event listeners that were added.
  15713. function cleanup() {
  15714. source.removeListener('data', ondata);
  15715. dest.removeListener('drain', ondrain);
  15716. source.removeListener('end', onend);
  15717. source.removeListener('close', onclose);
  15718. source.removeListener('error', onerror);
  15719. dest.removeListener('error', onerror);
  15720. source.removeListener('end', cleanup);
  15721. source.removeListener('close', cleanup);
  15722. dest.removeListener('close', cleanup);
  15723. }
  15724. source.on('end', cleanup);
  15725. source.on('close', cleanup);
  15726. dest.on('close', cleanup);
  15727. dest.emit('pipe', source);
  15728. // Allow for unix-like usage: A.pipe(B).pipe(C)
  15729. return dest;
  15730. };
  15731. /***/ }),
  15732. /* 150 */
  15733. /*!**********************************************************!*\
  15734. !*** ./node_modules/readable-stream/writable-browser.js ***!
  15735. \**********************************************************/
  15736. /*! no static exports found */
  15737. /***/ (function(module, exports, __webpack_require__) {
  15738. module.exports = __webpack_require__(/*! ./lib/_stream_writable.js */ 134);
  15739. /***/ }),
  15740. /* 151 */
  15741. /*!********************************************************!*\
  15742. !*** ./node_modules/readable-stream/duplex-browser.js ***!
  15743. \********************************************************/
  15744. /*! no static exports found */
  15745. /***/ (function(module, exports, __webpack_require__) {
  15746. module.exports = __webpack_require__(/*! ./lib/_stream_duplex.js */ 133);
  15747. /***/ }),
  15748. /* 152 */
  15749. /*!***************************************************!*\
  15750. !*** ./node_modules/readable-stream/transform.js ***!
  15751. \***************************************************/
  15752. /*! no static exports found */
  15753. /***/ (function(module, exports, __webpack_require__) {
  15754. module.exports = __webpack_require__(/*! ./readable */ 123).Transform
  15755. /***/ }),
  15756. /* 153 */
  15757. /*!*****************************************************!*\
  15758. !*** ./node_modules/readable-stream/passthrough.js ***!
  15759. \*****************************************************/
  15760. /*! no static exports found */
  15761. /***/ (function(module, exports, __webpack_require__) {
  15762. module.exports = __webpack_require__(/*! ./readable */ 123).PassThrough
  15763. /***/ }),
  15764. /* 154 */
  15765. /*!*********************************************!*\
  15766. !*** ./node_modules/create-hmac/browser.js ***!
  15767. \*********************************************/
  15768. /*! no static exports found */
  15769. /***/ (function(module, exports, __webpack_require__) {
  15770. "use strict";
  15771. var inherits = __webpack_require__(/*! inherits */ 120)
  15772. var Legacy = __webpack_require__(/*! ./legacy */ 155)
  15773. var Base = __webpack_require__(/*! cipher-base */ 148)
  15774. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  15775. var md5 = __webpack_require__(/*! create-hash/md5 */ 156)
  15776. var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 139)
  15777. var sha = __webpack_require__(/*! sha.js */ 140)
  15778. var ZEROS = Buffer.alloc(128)
  15779. function Hmac (alg, key) {
  15780. Base.call(this, 'digest')
  15781. if (typeof key === 'string') {
  15782. key = Buffer.from(key)
  15783. }
  15784. var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
  15785. this._alg = alg
  15786. this._key = key
  15787. if (key.length > blocksize) {
  15788. var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
  15789. key = hash.update(key).digest()
  15790. } else if (key.length < blocksize) {
  15791. key = Buffer.concat([key, ZEROS], blocksize)
  15792. }
  15793. var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
  15794. var opad = this._opad = Buffer.allocUnsafe(blocksize)
  15795. for (var i = 0; i < blocksize; i++) {
  15796. ipad[i] = key[i] ^ 0x36
  15797. opad[i] = key[i] ^ 0x5C
  15798. }
  15799. this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
  15800. this._hash.update(ipad)
  15801. }
  15802. inherits(Hmac, Base)
  15803. Hmac.prototype._update = function (data) {
  15804. this._hash.update(data)
  15805. }
  15806. Hmac.prototype._final = function () {
  15807. var h = this._hash.digest()
  15808. var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)
  15809. return hash.update(this._opad).update(h).digest()
  15810. }
  15811. module.exports = function createHmac (alg, key) {
  15812. alg = alg.toLowerCase()
  15813. if (alg === 'rmd160' || alg === 'ripemd160') {
  15814. return new Hmac('rmd160', key)
  15815. }
  15816. if (alg === 'md5') {
  15817. return new Legacy(md5, key)
  15818. }
  15819. return new Hmac(alg, key)
  15820. }
  15821. /***/ }),
  15822. /* 155 */
  15823. /*!********************************************!*\
  15824. !*** ./node_modules/create-hmac/legacy.js ***!
  15825. \********************************************/
  15826. /*! no static exports found */
  15827. /***/ (function(module, exports, __webpack_require__) {
  15828. "use strict";
  15829. var inherits = __webpack_require__(/*! inherits */ 120)
  15830. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  15831. var Base = __webpack_require__(/*! cipher-base */ 148)
  15832. var ZEROS = Buffer.alloc(128)
  15833. var blocksize = 64
  15834. function Hmac (alg, key) {
  15835. Base.call(this, 'digest')
  15836. if (typeof key === 'string') {
  15837. key = Buffer.from(key)
  15838. }
  15839. this._alg = alg
  15840. this._key = key
  15841. if (key.length > blocksize) {
  15842. key = alg(key)
  15843. } else if (key.length < blocksize) {
  15844. key = Buffer.concat([key, ZEROS], blocksize)
  15845. }
  15846. var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
  15847. var opad = this._opad = Buffer.allocUnsafe(blocksize)
  15848. for (var i = 0; i < blocksize; i++) {
  15849. ipad[i] = key[i] ^ 0x36
  15850. opad[i] = key[i] ^ 0x5C
  15851. }
  15852. this._hash = [ipad]
  15853. }
  15854. inherits(Hmac, Base)
  15855. Hmac.prototype._update = function (data) {
  15856. this._hash.push(data)
  15857. }
  15858. Hmac.prototype._final = function () {
  15859. var h = this._alg(Buffer.concat(this._hash))
  15860. return this._alg(Buffer.concat([this._opad, h]))
  15861. }
  15862. module.exports = Hmac
  15863. /***/ }),
  15864. /* 156 */
  15865. /*!*****************************************!*\
  15866. !*** ./node_modules/create-hash/md5.js ***!
  15867. \*****************************************/
  15868. /*! no static exports found */
  15869. /***/ (function(module, exports, __webpack_require__) {
  15870. var MD5 = __webpack_require__(/*! md5.js */ 121)
  15871. module.exports = function (buffer) {
  15872. return new MD5().update(buffer).digest()
  15873. }
  15874. /***/ }),
  15875. /* 157 */
  15876. /*!***********************************************!*\
  15877. !*** ./node_modules/browserify-sign/algos.js ***!
  15878. \***********************************************/
  15879. /*! no static exports found */
  15880. /***/ (function(module, exports, __webpack_require__) {
  15881. module.exports = __webpack_require__(/*! ./browser/algorithms.json */ 158)
  15882. /***/ }),
  15883. /* 158 */
  15884. /*!**************************************************************!*\
  15885. !*** ./node_modules/browserify-sign/browser/algorithms.json ***!
  15886. \**************************************************************/
  15887. /*! exports provided: sha224WithRSAEncryption, RSA-SHA224, sha256WithRSAEncryption, RSA-SHA256, sha384WithRSAEncryption, RSA-SHA384, sha512WithRSAEncryption, RSA-SHA512, RSA-SHA1, ecdsa-with-SHA1, sha256, sha224, sha384, sha512, DSA-SHA, DSA-SHA1, DSA, DSA-WITH-SHA224, DSA-SHA224, DSA-WITH-SHA256, DSA-SHA256, DSA-WITH-SHA384, DSA-SHA384, DSA-WITH-SHA512, DSA-SHA512, DSA-RIPEMD160, ripemd160WithRSA, RSA-RIPEMD160, md5WithRSAEncryption, RSA-MD5, default */
  15888. /***/ (function(module) {
  15889. module.exports = JSON.parse("{\"sha224WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha224\",\"id\":\"302d300d06096086480165030402040500041c\"},\"RSA-SHA224\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha224\",\"id\":\"302d300d06096086480165030402040500041c\"},\"sha256WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha256\",\"id\":\"3031300d060960864801650304020105000420\"},\"RSA-SHA256\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha256\",\"id\":\"3031300d060960864801650304020105000420\"},\"sha384WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha384\",\"id\":\"3041300d060960864801650304020205000430\"},\"RSA-SHA384\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha384\",\"id\":\"3041300d060960864801650304020205000430\"},\"sha512WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha512\",\"id\":\"3051300d060960864801650304020305000440\"},\"RSA-SHA512\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha512\",\"id\":\"3051300d060960864801650304020305000440\"},\"RSA-SHA1\":{\"sign\":\"rsa\",\"hash\":\"sha1\",\"id\":\"3021300906052b0e03021a05000414\"},\"ecdsa-with-SHA1\":{\"sign\":\"ecdsa\",\"hash\":\"sha1\",\"id\":\"\"},\"sha256\":{\"sign\":\"ecdsa\",\"hash\":\"sha256\",\"id\":\"\"},\"sha224\":{\"sign\":\"ecdsa\",\"hash\":\"sha224\",\"id\":\"\"},\"sha384\":{\"sign\":\"ecdsa\",\"hash\":\"sha384\",\"id\":\"\"},\"sha512\":{\"sign\":\"ecdsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-SHA\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA-SHA1\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA-WITH-SHA224\":{\"sign\":\"dsa\",\"hash\":\"sha224\",\"id\":\"\"},\"DSA-SHA224\":{\"sign\":\"dsa\",\"hash\":\"sha224\",\"id\":\"\"},\"DSA-WITH-SHA256\":{\"sign\":\"dsa\",\"hash\":\"sha256\",\"id\":\"\"},\"DSA-SHA256\":{\"sign\":\"dsa\",\"hash\":\"sha256\",\"id\":\"\"},\"DSA-WITH-SHA384\":{\"sign\":\"dsa\",\"hash\":\"sha384\",\"id\":\"\"},\"DSA-SHA384\":{\"sign\":\"dsa\",\"hash\":\"sha384\",\"id\":\"\"},\"DSA-WITH-SHA512\":{\"sign\":\"dsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-SHA512\":{\"sign\":\"dsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-RIPEMD160\":{\"sign\":\"dsa\",\"hash\":\"rmd160\",\"id\":\"\"},\"ripemd160WithRSA\":{\"sign\":\"rsa\",\"hash\":\"rmd160\",\"id\":\"3021300906052b2403020105000414\"},\"RSA-RIPEMD160\":{\"sign\":\"rsa\",\"hash\":\"rmd160\",\"id\":\"3021300906052b2403020105000414\"},\"md5WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"md5\",\"id\":\"3020300c06082a864886f70d020505000410\"},\"RSA-MD5\":{\"sign\":\"rsa\",\"hash\":\"md5\",\"id\":\"3020300c06082a864886f70d020505000410\"}}");
  15890. /***/ }),
  15891. /* 159 */
  15892. /*!****************************************!*\
  15893. !*** ./node_modules/pbkdf2/browser.js ***!
  15894. \****************************************/
  15895. /*! no static exports found */
  15896. /***/ (function(module, exports, __webpack_require__) {
  15897. exports.pbkdf2 = __webpack_require__(/*! ./lib/async */ 160)
  15898. exports.pbkdf2Sync = __webpack_require__(/*! ./lib/sync */ 163)
  15899. /***/ }),
  15900. /* 160 */
  15901. /*!******************************************!*\
  15902. !*** ./node_modules/pbkdf2/lib/async.js ***!
  15903. \******************************************/
  15904. /*! no static exports found */
  15905. /***/ (function(module, exports, __webpack_require__) {
  15906. /* WEBPACK VAR INJECTION */(function(global, process) {var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  15907. var checkParameters = __webpack_require__(/*! ./precondition */ 161)
  15908. var defaultEncoding = __webpack_require__(/*! ./default-encoding */ 162)
  15909. var sync = __webpack_require__(/*! ./sync */ 163)
  15910. var toBuffer = __webpack_require__(/*! ./to-buffer */ 164)
  15911. var ZERO_BUF
  15912. var subtle = global.crypto && global.crypto.subtle
  15913. var toBrowser = {
  15914. sha: 'SHA-1',
  15915. 'sha-1': 'SHA-1',
  15916. sha1: 'SHA-1',
  15917. sha256: 'SHA-256',
  15918. 'sha-256': 'SHA-256',
  15919. sha384: 'SHA-384',
  15920. 'sha-384': 'SHA-384',
  15921. 'sha-512': 'SHA-512',
  15922. sha512: 'SHA-512'
  15923. }
  15924. var checks = []
  15925. function checkNative (algo) {
  15926. if (global.process && !global.process.browser) {
  15927. return Promise.resolve(false)
  15928. }
  15929. if (!subtle || !subtle.importKey || !subtle.deriveBits) {
  15930. return Promise.resolve(false)
  15931. }
  15932. if (checks[algo] !== undefined) {
  15933. return checks[algo]
  15934. }
  15935. ZERO_BUF = ZERO_BUF || Buffer.alloc(8)
  15936. var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)
  15937. .then(function () {
  15938. return true
  15939. }).catch(function () {
  15940. return false
  15941. })
  15942. checks[algo] = prom
  15943. return prom
  15944. }
  15945. function browserPbkdf2 (password, salt, iterations, length, algo) {
  15946. return subtle.importKey(
  15947. 'raw', password, { name: 'PBKDF2' }, false, ['deriveBits']
  15948. ).then(function (key) {
  15949. return subtle.deriveBits({
  15950. name: 'PBKDF2',
  15951. salt: salt,
  15952. iterations: iterations,
  15953. hash: {
  15954. name: algo
  15955. }
  15956. }, key, length << 3)
  15957. }).then(function (res) {
  15958. return Buffer.from(res)
  15959. })
  15960. }
  15961. function resolvePromise (promise, callback) {
  15962. promise.then(function (out) {
  15963. process.nextTick(function () {
  15964. callback(null, out)
  15965. })
  15966. }, function (e) {
  15967. process.nextTick(function () {
  15968. callback(e)
  15969. })
  15970. })
  15971. }
  15972. module.exports = function (password, salt, iterations, keylen, digest, callback) {
  15973. if (typeof digest === 'function') {
  15974. callback = digest
  15975. digest = undefined
  15976. }
  15977. digest = digest || 'sha1'
  15978. var algo = toBrowser[digest.toLowerCase()]
  15979. if (!algo || typeof global.Promise !== 'function') {
  15980. return process.nextTick(function () {
  15981. var out
  15982. try {
  15983. out = sync(password, salt, iterations, keylen, digest)
  15984. } catch (e) {
  15985. return callback(e)
  15986. }
  15987. callback(null, out)
  15988. })
  15989. }
  15990. checkParameters(iterations, keylen)
  15991. password = toBuffer(password, defaultEncoding, 'Password')
  15992. salt = toBuffer(salt, defaultEncoding, 'Salt')
  15993. if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
  15994. resolvePromise(checkNative(algo).then(function (resp) {
  15995. if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)
  15996. return sync(password, salt, iterations, keylen, digest)
  15997. }), callback)
  15998. }
  15999. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 112)))
  16000. /***/ }),
  16001. /* 161 */
  16002. /*!*************************************************!*\
  16003. !*** ./node_modules/pbkdf2/lib/precondition.js ***!
  16004. \*************************************************/
  16005. /*! no static exports found */
  16006. /***/ (function(module, exports) {
  16007. var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
  16008. module.exports = function (iterations, keylen) {
  16009. if (typeof iterations !== 'number') {
  16010. throw new TypeError('Iterations not a number')
  16011. }
  16012. if (iterations < 0) {
  16013. throw new TypeError('Bad iterations')
  16014. }
  16015. if (typeof keylen !== 'number') {
  16016. throw new TypeError('Key length not a number')
  16017. }
  16018. if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */
  16019. throw new TypeError('Bad key length')
  16020. }
  16021. }
  16022. /***/ }),
  16023. /* 162 */
  16024. /*!*****************************************************!*\
  16025. !*** ./node_modules/pbkdf2/lib/default-encoding.js ***!
  16026. \*****************************************************/
  16027. /*! no static exports found */
  16028. /***/ (function(module, exports, __webpack_require__) {
  16029. /* WEBPACK VAR INJECTION */(function(process) {var defaultEncoding
  16030. /* istanbul ignore next */
  16031. if (process.browser) {
  16032. defaultEncoding = 'utf-8'
  16033. } else if (process.version) {
  16034. var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
  16035. defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
  16036. } else {
  16037. defaultEncoding = 'utf-8'
  16038. }
  16039. module.exports = defaultEncoding
  16040. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 112)))
  16041. /***/ }),
  16042. /* 163 */
  16043. /*!*************************************************!*\
  16044. !*** ./node_modules/pbkdf2/lib/sync-browser.js ***!
  16045. \*************************************************/
  16046. /*! no static exports found */
  16047. /***/ (function(module, exports, __webpack_require__) {
  16048. var md5 = __webpack_require__(/*! create-hash/md5 */ 156)
  16049. var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 139)
  16050. var sha = __webpack_require__(/*! sha.js */ 140)
  16051. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  16052. var checkParameters = __webpack_require__(/*! ./precondition */ 161)
  16053. var defaultEncoding = __webpack_require__(/*! ./default-encoding */ 162)
  16054. var toBuffer = __webpack_require__(/*! ./to-buffer */ 164)
  16055. var ZEROS = Buffer.alloc(128)
  16056. var sizes = {
  16057. md5: 16,
  16058. sha1: 20,
  16059. sha224: 28,
  16060. sha256: 32,
  16061. sha384: 48,
  16062. sha512: 64,
  16063. rmd160: 20,
  16064. ripemd160: 20
  16065. }
  16066. function Hmac (alg, key, saltLen) {
  16067. var hash = getDigest(alg)
  16068. var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
  16069. if (key.length > blocksize) {
  16070. key = hash(key)
  16071. } else if (key.length < blocksize) {
  16072. key = Buffer.concat([key, ZEROS], blocksize)
  16073. }
  16074. var ipad = Buffer.allocUnsafe(blocksize + sizes[alg])
  16075. var opad = Buffer.allocUnsafe(blocksize + sizes[alg])
  16076. for (var i = 0; i < blocksize; i++) {
  16077. ipad[i] = key[i] ^ 0x36
  16078. opad[i] = key[i] ^ 0x5C
  16079. }
  16080. var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4)
  16081. ipad.copy(ipad1, 0, 0, blocksize)
  16082. this.ipad1 = ipad1
  16083. this.ipad2 = ipad
  16084. this.opad = opad
  16085. this.alg = alg
  16086. this.blocksize = blocksize
  16087. this.hash = hash
  16088. this.size = sizes[alg]
  16089. }
  16090. Hmac.prototype.run = function (data, ipad) {
  16091. data.copy(ipad, this.blocksize)
  16092. var h = this.hash(ipad)
  16093. h.copy(this.opad, this.blocksize)
  16094. return this.hash(this.opad)
  16095. }
  16096. function getDigest (alg) {
  16097. function shaFunc (data) {
  16098. return sha(alg).update(data).digest()
  16099. }
  16100. function rmd160Func (data) {
  16101. return new RIPEMD160().update(data).digest()
  16102. }
  16103. if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func
  16104. if (alg === 'md5') return md5
  16105. return shaFunc
  16106. }
  16107. function pbkdf2 (password, salt, iterations, keylen, digest) {
  16108. checkParameters(iterations, keylen)
  16109. password = toBuffer(password, defaultEncoding, 'Password')
  16110. salt = toBuffer(salt, defaultEncoding, 'Salt')
  16111. digest = digest || 'sha1'
  16112. var hmac = new Hmac(digest, password, salt.length)
  16113. var DK = Buffer.allocUnsafe(keylen)
  16114. var block1 = Buffer.allocUnsafe(salt.length + 4)
  16115. salt.copy(block1, 0, 0, salt.length)
  16116. var destPos = 0
  16117. var hLen = sizes[digest]
  16118. var l = Math.ceil(keylen / hLen)
  16119. for (var i = 1; i <= l; i++) {
  16120. block1.writeUInt32BE(i, salt.length)
  16121. var T = hmac.run(block1, hmac.ipad1)
  16122. var U = T
  16123. for (var j = 1; j < iterations; j++) {
  16124. U = hmac.run(U, hmac.ipad2)
  16125. for (var k = 0; k < hLen; k++) T[k] ^= U[k]
  16126. }
  16127. T.copy(DK, destPos)
  16128. destPos += hLen
  16129. }
  16130. return DK
  16131. }
  16132. module.exports = pbkdf2
  16133. /***/ }),
  16134. /* 164 */
  16135. /*!**********************************************!*\
  16136. !*** ./node_modules/pbkdf2/lib/to-buffer.js ***!
  16137. \**********************************************/
  16138. /*! no static exports found */
  16139. /***/ (function(module, exports, __webpack_require__) {
  16140. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  16141. module.exports = function (thing, encoding, name) {
  16142. if (Buffer.isBuffer(thing)) {
  16143. return thing
  16144. } else if (typeof thing === 'string') {
  16145. return Buffer.from(thing, encoding)
  16146. } else if (ArrayBuffer.isView(thing)) {
  16147. return Buffer.from(thing.buffer)
  16148. } else {
  16149. throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView')
  16150. }
  16151. }
  16152. /***/ }),
  16153. /* 165 */
  16154. /*!***************************************************!*\
  16155. !*** ./node_modules/browserify-cipher/browser.js ***!
  16156. \***************************************************/
  16157. /*! no static exports found */
  16158. /***/ (function(module, exports, __webpack_require__) {
  16159. var DES = __webpack_require__(/*! browserify-des */ 166)
  16160. var aes = __webpack_require__(/*! browserify-aes/browser */ 174)
  16161. var aesModes = __webpack_require__(/*! browserify-aes/modes */ 176)
  16162. var desModes = __webpack_require__(/*! browserify-des/modes */ 193)
  16163. var ebtk = __webpack_require__(/*! evp_bytestokey */ 191)
  16164. function createCipher (suite, password) {
  16165. suite = suite.toLowerCase()
  16166. var keyLen, ivLen
  16167. if (aesModes[suite]) {
  16168. keyLen = aesModes[suite].key
  16169. ivLen = aesModes[suite].iv
  16170. } else if (desModes[suite]) {
  16171. keyLen = desModes[suite].key * 8
  16172. ivLen = desModes[suite].iv
  16173. } else {
  16174. throw new TypeError('invalid suite type')
  16175. }
  16176. var keys = ebtk(password, false, keyLen, ivLen)
  16177. return createCipheriv(suite, keys.key, keys.iv)
  16178. }
  16179. function createDecipher (suite, password) {
  16180. suite = suite.toLowerCase()
  16181. var keyLen, ivLen
  16182. if (aesModes[suite]) {
  16183. keyLen = aesModes[suite].key
  16184. ivLen = aesModes[suite].iv
  16185. } else if (desModes[suite]) {
  16186. keyLen = desModes[suite].key * 8
  16187. ivLen = desModes[suite].iv
  16188. } else {
  16189. throw new TypeError('invalid suite type')
  16190. }
  16191. var keys = ebtk(password, false, keyLen, ivLen)
  16192. return createDecipheriv(suite, keys.key, keys.iv)
  16193. }
  16194. function createCipheriv (suite, key, iv) {
  16195. suite = suite.toLowerCase()
  16196. if (aesModes[suite]) return aes.createCipheriv(suite, key, iv)
  16197. if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite })
  16198. throw new TypeError('invalid suite type')
  16199. }
  16200. function createDecipheriv (suite, key, iv) {
  16201. suite = suite.toLowerCase()
  16202. if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv)
  16203. if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true })
  16204. throw new TypeError('invalid suite type')
  16205. }
  16206. function getCiphers () {
  16207. return Object.keys(desModes).concat(aes.getCiphers())
  16208. }
  16209. exports.createCipher = exports.Cipher = createCipher
  16210. exports.createCipheriv = exports.Cipheriv = createCipheriv
  16211. exports.createDecipher = exports.Decipher = createDecipher
  16212. exports.createDecipheriv = exports.Decipheriv = createDecipheriv
  16213. exports.listCiphers = exports.getCiphers = getCiphers
  16214. /***/ }),
  16215. /* 166 */
  16216. /*!**********************************************!*\
  16217. !*** ./node_modules/browserify-des/index.js ***!
  16218. \**********************************************/
  16219. /*! no static exports found */
  16220. /***/ (function(module, exports, __webpack_require__) {
  16221. var CipherBase = __webpack_require__(/*! cipher-base */ 148)
  16222. var des = __webpack_require__(/*! des.js */ 167)
  16223. var inherits = __webpack_require__(/*! inherits */ 120)
  16224. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  16225. var modes = {
  16226. 'des-ede3-cbc': des.CBC.instantiate(des.EDE),
  16227. 'des-ede3': des.EDE,
  16228. 'des-ede-cbc': des.CBC.instantiate(des.EDE),
  16229. 'des-ede': des.EDE,
  16230. 'des-cbc': des.CBC.instantiate(des.DES),
  16231. 'des-ecb': des.DES
  16232. }
  16233. modes.des = modes['des-cbc']
  16234. modes.des3 = modes['des-ede3-cbc']
  16235. module.exports = DES
  16236. inherits(DES, CipherBase)
  16237. function DES (opts) {
  16238. CipherBase.call(this)
  16239. var modeName = opts.mode.toLowerCase()
  16240. var mode = modes[modeName]
  16241. var type
  16242. if (opts.decrypt) {
  16243. type = 'decrypt'
  16244. } else {
  16245. type = 'encrypt'
  16246. }
  16247. var key = opts.key
  16248. if (!Buffer.isBuffer(key)) {
  16249. key = Buffer.from(key)
  16250. }
  16251. if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {
  16252. key = Buffer.concat([key, key.slice(0, 8)])
  16253. }
  16254. var iv = opts.iv
  16255. if (!Buffer.isBuffer(iv)) {
  16256. iv = Buffer.from(iv)
  16257. }
  16258. this._des = mode.create({
  16259. key: key,
  16260. iv: iv,
  16261. type: type
  16262. })
  16263. }
  16264. DES.prototype._update = function (data) {
  16265. return Buffer.from(this._des.update(data))
  16266. }
  16267. DES.prototype._final = function () {
  16268. return Buffer.from(this._des.final())
  16269. }
  16270. /***/ }),
  16271. /* 167 */
  16272. /*!****************************************!*\
  16273. !*** ./node_modules/des.js/lib/des.js ***!
  16274. \****************************************/
  16275. /*! no static exports found */
  16276. /***/ (function(module, exports, __webpack_require__) {
  16277. "use strict";
  16278. exports.utils = __webpack_require__(/*! ./des/utils */ 168);
  16279. exports.Cipher = __webpack_require__(/*! ./des/cipher */ 169);
  16280. exports.DES = __webpack_require__(/*! ./des/des */ 171);
  16281. exports.CBC = __webpack_require__(/*! ./des/cbc */ 172);
  16282. exports.EDE = __webpack_require__(/*! ./des/ede */ 173);
  16283. /***/ }),
  16284. /* 168 */
  16285. /*!**********************************************!*\
  16286. !*** ./node_modules/des.js/lib/des/utils.js ***!
  16287. \**********************************************/
  16288. /*! no static exports found */
  16289. /***/ (function(module, exports, __webpack_require__) {
  16290. "use strict";
  16291. exports.readUInt32BE = function readUInt32BE(bytes, off) {
  16292. var res = (bytes[0 + off] << 24) |
  16293. (bytes[1 + off] << 16) |
  16294. (bytes[2 + off] << 8) |
  16295. bytes[3 + off];
  16296. return res >>> 0;
  16297. };
  16298. exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {
  16299. bytes[0 + off] = value >>> 24;
  16300. bytes[1 + off] = (value >>> 16) & 0xff;
  16301. bytes[2 + off] = (value >>> 8) & 0xff;
  16302. bytes[3 + off] = value & 0xff;
  16303. };
  16304. exports.ip = function ip(inL, inR, out, off) {
  16305. var outL = 0;
  16306. var outR = 0;
  16307. for (var i = 6; i >= 0; i -= 2) {
  16308. for (var j = 0; j <= 24; j += 8) {
  16309. outL <<= 1;
  16310. outL |= (inR >>> (j + i)) & 1;
  16311. }
  16312. for (var j = 0; j <= 24; j += 8) {
  16313. outL <<= 1;
  16314. outL |= (inL >>> (j + i)) & 1;
  16315. }
  16316. }
  16317. for (var i = 6; i >= 0; i -= 2) {
  16318. for (var j = 1; j <= 25; j += 8) {
  16319. outR <<= 1;
  16320. outR |= (inR >>> (j + i)) & 1;
  16321. }
  16322. for (var j = 1; j <= 25; j += 8) {
  16323. outR <<= 1;
  16324. outR |= (inL >>> (j + i)) & 1;
  16325. }
  16326. }
  16327. out[off + 0] = outL >>> 0;
  16328. out[off + 1] = outR >>> 0;
  16329. };
  16330. exports.rip = function rip(inL, inR, out, off) {
  16331. var outL = 0;
  16332. var outR = 0;
  16333. for (var i = 0; i < 4; i++) {
  16334. for (var j = 24; j >= 0; j -= 8) {
  16335. outL <<= 1;
  16336. outL |= (inR >>> (j + i)) & 1;
  16337. outL <<= 1;
  16338. outL |= (inL >>> (j + i)) & 1;
  16339. }
  16340. }
  16341. for (var i = 4; i < 8; i++) {
  16342. for (var j = 24; j >= 0; j -= 8) {
  16343. outR <<= 1;
  16344. outR |= (inR >>> (j + i)) & 1;
  16345. outR <<= 1;
  16346. outR |= (inL >>> (j + i)) & 1;
  16347. }
  16348. }
  16349. out[off + 0] = outL >>> 0;
  16350. out[off + 1] = outR >>> 0;
  16351. };
  16352. exports.pc1 = function pc1(inL, inR, out, off) {
  16353. var outL = 0;
  16354. var outR = 0;
  16355. // 7, 15, 23, 31, 39, 47, 55, 63
  16356. // 6, 14, 22, 30, 39, 47, 55, 63
  16357. // 5, 13, 21, 29, 39, 47, 55, 63
  16358. // 4, 12, 20, 28
  16359. for (var i = 7; i >= 5; i--) {
  16360. for (var j = 0; j <= 24; j += 8) {
  16361. outL <<= 1;
  16362. outL |= (inR >> (j + i)) & 1;
  16363. }
  16364. for (var j = 0; j <= 24; j += 8) {
  16365. outL <<= 1;
  16366. outL |= (inL >> (j + i)) & 1;
  16367. }
  16368. }
  16369. for (var j = 0; j <= 24; j += 8) {
  16370. outL <<= 1;
  16371. outL |= (inR >> (j + i)) & 1;
  16372. }
  16373. // 1, 9, 17, 25, 33, 41, 49, 57
  16374. // 2, 10, 18, 26, 34, 42, 50, 58
  16375. // 3, 11, 19, 27, 35, 43, 51, 59
  16376. // 36, 44, 52, 60
  16377. for (var i = 1; i <= 3; i++) {
  16378. for (var j = 0; j <= 24; j += 8) {
  16379. outR <<= 1;
  16380. outR |= (inR >> (j + i)) & 1;
  16381. }
  16382. for (var j = 0; j <= 24; j += 8) {
  16383. outR <<= 1;
  16384. outR |= (inL >> (j + i)) & 1;
  16385. }
  16386. }
  16387. for (var j = 0; j <= 24; j += 8) {
  16388. outR <<= 1;
  16389. outR |= (inL >> (j + i)) & 1;
  16390. }
  16391. out[off + 0] = outL >>> 0;
  16392. out[off + 1] = outR >>> 0;
  16393. };
  16394. exports.r28shl = function r28shl(num, shift) {
  16395. return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));
  16396. };
  16397. var pc2table = [
  16398. // inL => outL
  16399. 14, 11, 17, 4, 27, 23, 25, 0,
  16400. 13, 22, 7, 18, 5, 9, 16, 24,
  16401. 2, 20, 12, 21, 1, 8, 15, 26,
  16402. // inR => outR
  16403. 15, 4, 25, 19, 9, 1, 26, 16,
  16404. 5, 11, 23, 8, 12, 7, 17, 0,
  16405. 22, 3, 10, 14, 6, 20, 27, 24
  16406. ];
  16407. exports.pc2 = function pc2(inL, inR, out, off) {
  16408. var outL = 0;
  16409. var outR = 0;
  16410. var len = pc2table.length >>> 1;
  16411. for (var i = 0; i < len; i++) {
  16412. outL <<= 1;
  16413. outL |= (inL >>> pc2table[i]) & 0x1;
  16414. }
  16415. for (var i = len; i < pc2table.length; i++) {
  16416. outR <<= 1;
  16417. outR |= (inR >>> pc2table[i]) & 0x1;
  16418. }
  16419. out[off + 0] = outL >>> 0;
  16420. out[off + 1] = outR >>> 0;
  16421. };
  16422. exports.expand = function expand(r, out, off) {
  16423. var outL = 0;
  16424. var outR = 0;
  16425. outL = ((r & 1) << 5) | (r >>> 27);
  16426. for (var i = 23; i >= 15; i -= 4) {
  16427. outL <<= 6;
  16428. outL |= (r >>> i) & 0x3f;
  16429. }
  16430. for (var i = 11; i >= 3; i -= 4) {
  16431. outR |= (r >>> i) & 0x3f;
  16432. outR <<= 6;
  16433. }
  16434. outR |= ((r & 0x1f) << 1) | (r >>> 31);
  16435. out[off + 0] = outL >>> 0;
  16436. out[off + 1] = outR >>> 0;
  16437. };
  16438. var sTable = [
  16439. 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
  16440. 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
  16441. 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
  16442. 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,
  16443. 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
  16444. 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
  16445. 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
  16446. 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,
  16447. 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
  16448. 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
  16449. 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
  16450. 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,
  16451. 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
  16452. 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
  16453. 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
  16454. 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,
  16455. 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
  16456. 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
  16457. 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
  16458. 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,
  16459. 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
  16460. 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
  16461. 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
  16462. 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,
  16463. 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
  16464. 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
  16465. 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
  16466. 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,
  16467. 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
  16468. 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
  16469. 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
  16470. 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
  16471. ];
  16472. exports.substitute = function substitute(inL, inR) {
  16473. var out = 0;
  16474. for (var i = 0; i < 4; i++) {
  16475. var b = (inL >>> (18 - i * 6)) & 0x3f;
  16476. var sb = sTable[i * 0x40 + b];
  16477. out <<= 4;
  16478. out |= sb;
  16479. }
  16480. for (var i = 0; i < 4; i++) {
  16481. var b = (inR >>> (18 - i * 6)) & 0x3f;
  16482. var sb = sTable[4 * 0x40 + i * 0x40 + b];
  16483. out <<= 4;
  16484. out |= sb;
  16485. }
  16486. return out >>> 0;
  16487. };
  16488. var permuteTable = [
  16489. 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,
  16490. 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7
  16491. ];
  16492. exports.permute = function permute(num) {
  16493. var out = 0;
  16494. for (var i = 0; i < permuteTable.length; i++) {
  16495. out <<= 1;
  16496. out |= (num >>> permuteTable[i]) & 0x1;
  16497. }
  16498. return out >>> 0;
  16499. };
  16500. exports.padSplit = function padSplit(num, size, group) {
  16501. var str = num.toString(2);
  16502. while (str.length < size)
  16503. str = '0' + str;
  16504. var out = [];
  16505. for (var i = 0; i < size; i += group)
  16506. out.push(str.slice(i, i + group));
  16507. return out.join(' ');
  16508. };
  16509. /***/ }),
  16510. /* 169 */
  16511. /*!***********************************************!*\
  16512. !*** ./node_modules/des.js/lib/des/cipher.js ***!
  16513. \***********************************************/
  16514. /*! no static exports found */
  16515. /***/ (function(module, exports, __webpack_require__) {
  16516. "use strict";
  16517. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  16518. function Cipher(options) {
  16519. this.options = options;
  16520. this.type = this.options.type;
  16521. this.blockSize = 8;
  16522. this._init();
  16523. this.buffer = new Array(this.blockSize);
  16524. this.bufferOff = 0;
  16525. }
  16526. module.exports = Cipher;
  16527. Cipher.prototype._init = function _init() {
  16528. // Might be overrided
  16529. };
  16530. Cipher.prototype.update = function update(data) {
  16531. if (data.length === 0)
  16532. return [];
  16533. if (this.type === 'decrypt')
  16534. return this._updateDecrypt(data);
  16535. else
  16536. return this._updateEncrypt(data);
  16537. };
  16538. Cipher.prototype._buffer = function _buffer(data, off) {
  16539. // Append data to buffer
  16540. var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);
  16541. for (var i = 0; i < min; i++)
  16542. this.buffer[this.bufferOff + i] = data[off + i];
  16543. this.bufferOff += min;
  16544. // Shift next
  16545. return min;
  16546. };
  16547. Cipher.prototype._flushBuffer = function _flushBuffer(out, off) {
  16548. this._update(this.buffer, 0, out, off);
  16549. this.bufferOff = 0;
  16550. return this.blockSize;
  16551. };
  16552. Cipher.prototype._updateEncrypt = function _updateEncrypt(data) {
  16553. var inputOff = 0;
  16554. var outputOff = 0;
  16555. var count = ((this.bufferOff + data.length) / this.blockSize) | 0;
  16556. var out = new Array(count * this.blockSize);
  16557. if (this.bufferOff !== 0) {
  16558. inputOff += this._buffer(data, inputOff);
  16559. if (this.bufferOff === this.buffer.length)
  16560. outputOff += this._flushBuffer(out, outputOff);
  16561. }
  16562. // Write blocks
  16563. var max = data.length - ((data.length - inputOff) % this.blockSize);
  16564. for (; inputOff < max; inputOff += this.blockSize) {
  16565. this._update(data, inputOff, out, outputOff);
  16566. outputOff += this.blockSize;
  16567. }
  16568. // Queue rest
  16569. for (; inputOff < data.length; inputOff++, this.bufferOff++)
  16570. this.buffer[this.bufferOff] = data[inputOff];
  16571. return out;
  16572. };
  16573. Cipher.prototype._updateDecrypt = function _updateDecrypt(data) {
  16574. var inputOff = 0;
  16575. var outputOff = 0;
  16576. var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;
  16577. var out = new Array(count * this.blockSize);
  16578. // TODO(indutny): optimize it, this is far from optimal
  16579. for (; count > 0; count--) {
  16580. inputOff += this._buffer(data, inputOff);
  16581. outputOff += this._flushBuffer(out, outputOff);
  16582. }
  16583. // Buffer rest of the input
  16584. inputOff += this._buffer(data, inputOff);
  16585. return out;
  16586. };
  16587. Cipher.prototype.final = function final(buffer) {
  16588. var first;
  16589. if (buffer)
  16590. first = this.update(buffer);
  16591. var last;
  16592. if (this.type === 'encrypt')
  16593. last = this._finalEncrypt();
  16594. else
  16595. last = this._finalDecrypt();
  16596. if (first)
  16597. return first.concat(last);
  16598. else
  16599. return last;
  16600. };
  16601. Cipher.prototype._pad = function _pad(buffer, off) {
  16602. if (off === 0)
  16603. return false;
  16604. while (off < buffer.length)
  16605. buffer[off++] = 0;
  16606. return true;
  16607. };
  16608. Cipher.prototype._finalEncrypt = function _finalEncrypt() {
  16609. if (!this._pad(this.buffer, this.bufferOff))
  16610. return [];
  16611. var out = new Array(this.blockSize);
  16612. this._update(this.buffer, 0, out, 0);
  16613. return out;
  16614. };
  16615. Cipher.prototype._unpad = function _unpad(buffer) {
  16616. return buffer;
  16617. };
  16618. Cipher.prototype._finalDecrypt = function _finalDecrypt() {
  16619. assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');
  16620. var out = new Array(this.blockSize);
  16621. this._flushBuffer(out, 0);
  16622. return this._unpad(out);
  16623. };
  16624. /***/ }),
  16625. /* 170 */
  16626. /*!***************************************************!*\
  16627. !*** ./node_modules/minimalistic-assert/index.js ***!
  16628. \***************************************************/
  16629. /*! no static exports found */
  16630. /***/ (function(module, exports) {
  16631. module.exports = assert;
  16632. function assert(val, msg) {
  16633. if (!val)
  16634. throw new Error(msg || 'Assertion failed');
  16635. }
  16636. assert.equal = function assertEqual(l, r, msg) {
  16637. if (l != r)
  16638. throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
  16639. };
  16640. /***/ }),
  16641. /* 171 */
  16642. /*!********************************************!*\
  16643. !*** ./node_modules/des.js/lib/des/des.js ***!
  16644. \********************************************/
  16645. /*! no static exports found */
  16646. /***/ (function(module, exports, __webpack_require__) {
  16647. "use strict";
  16648. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  16649. var inherits = __webpack_require__(/*! inherits */ 120);
  16650. var utils = __webpack_require__(/*! ./utils */ 168);
  16651. var Cipher = __webpack_require__(/*! ./cipher */ 169);
  16652. function DESState() {
  16653. this.tmp = new Array(2);
  16654. this.keys = null;
  16655. }
  16656. function DES(options) {
  16657. Cipher.call(this, options);
  16658. var state = new DESState();
  16659. this._desState = state;
  16660. this.deriveKeys(state, options.key);
  16661. }
  16662. inherits(DES, Cipher);
  16663. module.exports = DES;
  16664. DES.create = function create(options) {
  16665. return new DES(options);
  16666. };
  16667. var shiftTable = [
  16668. 1, 1, 2, 2, 2, 2, 2, 2,
  16669. 1, 2, 2, 2, 2, 2, 2, 1
  16670. ];
  16671. DES.prototype.deriveKeys = function deriveKeys(state, key) {
  16672. state.keys = new Array(16 * 2);
  16673. assert.equal(key.length, this.blockSize, 'Invalid key length');
  16674. var kL = utils.readUInt32BE(key, 0);
  16675. var kR = utils.readUInt32BE(key, 4);
  16676. utils.pc1(kL, kR, state.tmp, 0);
  16677. kL = state.tmp[0];
  16678. kR = state.tmp[1];
  16679. for (var i = 0; i < state.keys.length; i += 2) {
  16680. var shift = shiftTable[i >>> 1];
  16681. kL = utils.r28shl(kL, shift);
  16682. kR = utils.r28shl(kR, shift);
  16683. utils.pc2(kL, kR, state.keys, i);
  16684. }
  16685. };
  16686. DES.prototype._update = function _update(inp, inOff, out, outOff) {
  16687. var state = this._desState;
  16688. var l = utils.readUInt32BE(inp, inOff);
  16689. var r = utils.readUInt32BE(inp, inOff + 4);
  16690. // Initial Permutation
  16691. utils.ip(l, r, state.tmp, 0);
  16692. l = state.tmp[0];
  16693. r = state.tmp[1];
  16694. if (this.type === 'encrypt')
  16695. this._encrypt(state, l, r, state.tmp, 0);
  16696. else
  16697. this._decrypt(state, l, r, state.tmp, 0);
  16698. l = state.tmp[0];
  16699. r = state.tmp[1];
  16700. utils.writeUInt32BE(out, l, outOff);
  16701. utils.writeUInt32BE(out, r, outOff + 4);
  16702. };
  16703. DES.prototype._pad = function _pad(buffer, off) {
  16704. var value = buffer.length - off;
  16705. for (var i = off; i < buffer.length; i++)
  16706. buffer[i] = value;
  16707. return true;
  16708. };
  16709. DES.prototype._unpad = function _unpad(buffer) {
  16710. var pad = buffer[buffer.length - 1];
  16711. for (var i = buffer.length - pad; i < buffer.length; i++)
  16712. assert.equal(buffer[i], pad);
  16713. return buffer.slice(0, buffer.length - pad);
  16714. };
  16715. DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {
  16716. var l = lStart;
  16717. var r = rStart;
  16718. // Apply f() x16 times
  16719. for (var i = 0; i < state.keys.length; i += 2) {
  16720. var keyL = state.keys[i];
  16721. var keyR = state.keys[i + 1];
  16722. // f(r, k)
  16723. utils.expand(r, state.tmp, 0);
  16724. keyL ^= state.tmp[0];
  16725. keyR ^= state.tmp[1];
  16726. var s = utils.substitute(keyL, keyR);
  16727. var f = utils.permute(s);
  16728. var t = r;
  16729. r = (l ^ f) >>> 0;
  16730. l = t;
  16731. }
  16732. // Reverse Initial Permutation
  16733. utils.rip(r, l, out, off);
  16734. };
  16735. DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {
  16736. var l = rStart;
  16737. var r = lStart;
  16738. // Apply f() x16 times
  16739. for (var i = state.keys.length - 2; i >= 0; i -= 2) {
  16740. var keyL = state.keys[i];
  16741. var keyR = state.keys[i + 1];
  16742. // f(r, k)
  16743. utils.expand(l, state.tmp, 0);
  16744. keyL ^= state.tmp[0];
  16745. keyR ^= state.tmp[1];
  16746. var s = utils.substitute(keyL, keyR);
  16747. var f = utils.permute(s);
  16748. var t = l;
  16749. l = (r ^ f) >>> 0;
  16750. r = t;
  16751. }
  16752. // Reverse Initial Permutation
  16753. utils.rip(l, r, out, off);
  16754. };
  16755. /***/ }),
  16756. /* 172 */
  16757. /*!********************************************!*\
  16758. !*** ./node_modules/des.js/lib/des/cbc.js ***!
  16759. \********************************************/
  16760. /*! no static exports found */
  16761. /***/ (function(module, exports, __webpack_require__) {
  16762. "use strict";
  16763. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  16764. var inherits = __webpack_require__(/*! inherits */ 120);
  16765. var proto = {};
  16766. function CBCState(iv) {
  16767. assert.equal(iv.length, 8, 'Invalid IV length');
  16768. this.iv = new Array(8);
  16769. for (var i = 0; i < this.iv.length; i++)
  16770. this.iv[i] = iv[i];
  16771. }
  16772. function instantiate(Base) {
  16773. function CBC(options) {
  16774. Base.call(this, options);
  16775. this._cbcInit();
  16776. }
  16777. inherits(CBC, Base);
  16778. var keys = Object.keys(proto);
  16779. for (var i = 0; i < keys.length; i++) {
  16780. var key = keys[i];
  16781. CBC.prototype[key] = proto[key];
  16782. }
  16783. CBC.create = function create(options) {
  16784. return new CBC(options);
  16785. };
  16786. return CBC;
  16787. }
  16788. exports.instantiate = instantiate;
  16789. proto._cbcInit = function _cbcInit() {
  16790. var state = new CBCState(this.options.iv);
  16791. this._cbcState = state;
  16792. };
  16793. proto._update = function _update(inp, inOff, out, outOff) {
  16794. var state = this._cbcState;
  16795. var superProto = this.constructor.super_.prototype;
  16796. var iv = state.iv;
  16797. if (this.type === 'encrypt') {
  16798. for (var i = 0; i < this.blockSize; i++)
  16799. iv[i] ^= inp[inOff + i];
  16800. superProto._update.call(this, iv, 0, out, outOff);
  16801. for (var i = 0; i < this.blockSize; i++)
  16802. iv[i] = out[outOff + i];
  16803. } else {
  16804. superProto._update.call(this, inp, inOff, out, outOff);
  16805. for (var i = 0; i < this.blockSize; i++)
  16806. out[outOff + i] ^= iv[i];
  16807. for (var i = 0; i < this.blockSize; i++)
  16808. iv[i] = inp[inOff + i];
  16809. }
  16810. };
  16811. /***/ }),
  16812. /* 173 */
  16813. /*!********************************************!*\
  16814. !*** ./node_modules/des.js/lib/des/ede.js ***!
  16815. \********************************************/
  16816. /*! no static exports found */
  16817. /***/ (function(module, exports, __webpack_require__) {
  16818. "use strict";
  16819. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  16820. var inherits = __webpack_require__(/*! inherits */ 120);
  16821. var Cipher = __webpack_require__(/*! ./cipher */ 169);
  16822. var DES = __webpack_require__(/*! ./des */ 171);
  16823. function EDEState(type, key) {
  16824. assert.equal(key.length, 24, 'Invalid key length');
  16825. var k1 = key.slice(0, 8);
  16826. var k2 = key.slice(8, 16);
  16827. var k3 = key.slice(16, 24);
  16828. if (type === 'encrypt') {
  16829. this.ciphers = [
  16830. DES.create({ type: 'encrypt', key: k1 }),
  16831. DES.create({ type: 'decrypt', key: k2 }),
  16832. DES.create({ type: 'encrypt', key: k3 })
  16833. ];
  16834. } else {
  16835. this.ciphers = [
  16836. DES.create({ type: 'decrypt', key: k3 }),
  16837. DES.create({ type: 'encrypt', key: k2 }),
  16838. DES.create({ type: 'decrypt', key: k1 })
  16839. ];
  16840. }
  16841. }
  16842. function EDE(options) {
  16843. Cipher.call(this, options);
  16844. var state = new EDEState(this.type, this.options.key);
  16845. this._edeState = state;
  16846. }
  16847. inherits(EDE, Cipher);
  16848. module.exports = EDE;
  16849. EDE.create = function create(options) {
  16850. return new EDE(options);
  16851. };
  16852. EDE.prototype._update = function _update(inp, inOff, out, outOff) {
  16853. var state = this._edeState;
  16854. state.ciphers[0]._update(inp, inOff, out, outOff);
  16855. state.ciphers[1]._update(out, outOff, out, outOff);
  16856. state.ciphers[2]._update(out, outOff, out, outOff);
  16857. };
  16858. EDE.prototype._pad = DES.prototype._pad;
  16859. EDE.prototype._unpad = DES.prototype._unpad;
  16860. /***/ }),
  16861. /* 174 */
  16862. /*!************************************************!*\
  16863. !*** ./node_modules/browserify-aes/browser.js ***!
  16864. \************************************************/
  16865. /*! no static exports found */
  16866. /***/ (function(module, exports, __webpack_require__) {
  16867. var ciphers = __webpack_require__(/*! ./encrypter */ 175)
  16868. var deciphers = __webpack_require__(/*! ./decrypter */ 192)
  16869. var modes = __webpack_require__(/*! ./modes/list.json */ 186)
  16870. function getCiphers () {
  16871. return Object.keys(modes)
  16872. }
  16873. exports.createCipher = exports.Cipher = ciphers.createCipher
  16874. exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv
  16875. exports.createDecipher = exports.Decipher = deciphers.createDecipher
  16876. exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv
  16877. exports.listCiphers = exports.getCiphers = getCiphers
  16878. /***/ }),
  16879. /* 175 */
  16880. /*!**************************************************!*\
  16881. !*** ./node_modules/browserify-aes/encrypter.js ***!
  16882. \**************************************************/
  16883. /*! no static exports found */
  16884. /***/ (function(module, exports, __webpack_require__) {
  16885. var MODES = __webpack_require__(/*! ./modes */ 176)
  16886. var AuthCipher = __webpack_require__(/*! ./authCipher */ 187)
  16887. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  16888. var StreamCipher = __webpack_require__(/*! ./streamCipher */ 190)
  16889. var Transform = __webpack_require__(/*! cipher-base */ 148)
  16890. var aes = __webpack_require__(/*! ./aes */ 188)
  16891. var ebtk = __webpack_require__(/*! evp_bytestokey */ 191)
  16892. var inherits = __webpack_require__(/*! inherits */ 120)
  16893. function Cipher (mode, key, iv) {
  16894. Transform.call(this)
  16895. this._cache = new Splitter()
  16896. this._cipher = new aes.AES(key)
  16897. this._prev = Buffer.from(iv)
  16898. this._mode = mode
  16899. this._autopadding = true
  16900. }
  16901. inherits(Cipher, Transform)
  16902. Cipher.prototype._update = function (data) {
  16903. this._cache.add(data)
  16904. var chunk
  16905. var thing
  16906. var out = []
  16907. while ((chunk = this._cache.get())) {
  16908. thing = this._mode.encrypt(this, chunk)
  16909. out.push(thing)
  16910. }
  16911. return Buffer.concat(out)
  16912. }
  16913. var PADDING = Buffer.alloc(16, 0x10)
  16914. Cipher.prototype._final = function () {
  16915. var chunk = this._cache.flush()
  16916. if (this._autopadding) {
  16917. chunk = this._mode.encrypt(this, chunk)
  16918. this._cipher.scrub()
  16919. return chunk
  16920. }
  16921. if (!chunk.equals(PADDING)) {
  16922. this._cipher.scrub()
  16923. throw new Error('data not multiple of block length')
  16924. }
  16925. }
  16926. Cipher.prototype.setAutoPadding = function (setTo) {
  16927. this._autopadding = !!setTo
  16928. return this
  16929. }
  16930. function Splitter () {
  16931. this.cache = Buffer.allocUnsafe(0)
  16932. }
  16933. Splitter.prototype.add = function (data) {
  16934. this.cache = Buffer.concat([this.cache, data])
  16935. }
  16936. Splitter.prototype.get = function () {
  16937. if (this.cache.length > 15) {
  16938. var out = this.cache.slice(0, 16)
  16939. this.cache = this.cache.slice(16)
  16940. return out
  16941. }
  16942. return null
  16943. }
  16944. Splitter.prototype.flush = function () {
  16945. var len = 16 - this.cache.length
  16946. var padBuff = Buffer.allocUnsafe(len)
  16947. var i = -1
  16948. while (++i < len) {
  16949. padBuff.writeUInt8(len, i)
  16950. }
  16951. return Buffer.concat([this.cache, padBuff])
  16952. }
  16953. function createCipheriv (suite, password, iv) {
  16954. var config = MODES[suite.toLowerCase()]
  16955. if (!config) throw new TypeError('invalid suite type')
  16956. if (typeof password === 'string') password = Buffer.from(password)
  16957. if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
  16958. if (typeof iv === 'string') iv = Buffer.from(iv)
  16959. if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
  16960. if (config.type === 'stream') {
  16961. return new StreamCipher(config.module, password, iv)
  16962. } else if (config.type === 'auth') {
  16963. return new AuthCipher(config.module, password, iv)
  16964. }
  16965. return new Cipher(config.module, password, iv)
  16966. }
  16967. function createCipher (suite, password) {
  16968. var config = MODES[suite.toLowerCase()]
  16969. if (!config) throw new TypeError('invalid suite type')
  16970. var keys = ebtk(password, false, config.key, config.iv)
  16971. return createCipheriv(suite, keys.key, keys.iv)
  16972. }
  16973. exports.createCipheriv = createCipheriv
  16974. exports.createCipher = createCipher
  16975. /***/ }),
  16976. /* 176 */
  16977. /*!****************************************************!*\
  16978. !*** ./node_modules/browserify-aes/modes/index.js ***!
  16979. \****************************************************/
  16980. /*! no static exports found */
  16981. /***/ (function(module, exports, __webpack_require__) {
  16982. var modeModules = {
  16983. ECB: __webpack_require__(/*! ./ecb */ 177),
  16984. CBC: __webpack_require__(/*! ./cbc */ 178),
  16985. CFB: __webpack_require__(/*! ./cfb */ 180),
  16986. CFB8: __webpack_require__(/*! ./cfb8 */ 181),
  16987. CFB1: __webpack_require__(/*! ./cfb1 */ 182),
  16988. OFB: __webpack_require__(/*! ./ofb */ 183),
  16989. CTR: __webpack_require__(/*! ./ctr */ 184),
  16990. GCM: __webpack_require__(/*! ./ctr */ 184)
  16991. }
  16992. var modes = __webpack_require__(/*! ./list.json */ 186)
  16993. for (var key in modes) {
  16994. modes[key].module = modeModules[modes[key].mode]
  16995. }
  16996. module.exports = modes
  16997. /***/ }),
  16998. /* 177 */
  16999. /*!**************************************************!*\
  17000. !*** ./node_modules/browserify-aes/modes/ecb.js ***!
  17001. \**************************************************/
  17002. /*! no static exports found */
  17003. /***/ (function(module, exports) {
  17004. exports.encrypt = function (self, block) {
  17005. return self._cipher.encryptBlock(block)
  17006. }
  17007. exports.decrypt = function (self, block) {
  17008. return self._cipher.decryptBlock(block)
  17009. }
  17010. /***/ }),
  17011. /* 178 */
  17012. /*!**************************************************!*\
  17013. !*** ./node_modules/browserify-aes/modes/cbc.js ***!
  17014. \**************************************************/
  17015. /*! no static exports found */
  17016. /***/ (function(module, exports, __webpack_require__) {
  17017. var xor = __webpack_require__(/*! buffer-xor */ 179)
  17018. exports.encrypt = function (self, block) {
  17019. var data = xor(block, self._prev)
  17020. self._prev = self._cipher.encryptBlock(data)
  17021. return self._prev
  17022. }
  17023. exports.decrypt = function (self, block) {
  17024. var pad = self._prev
  17025. self._prev = block
  17026. var out = self._cipher.decryptBlock(block)
  17027. return xor(out, pad)
  17028. }
  17029. /***/ }),
  17030. /* 179 */
  17031. /*!******************************************!*\
  17032. !*** ./node_modules/buffer-xor/index.js ***!
  17033. \******************************************/
  17034. /*! no static exports found */
  17035. /***/ (function(module, exports, __webpack_require__) {
  17036. /* WEBPACK VAR INJECTION */(function(Buffer) {module.exports = function xor (a, b) {
  17037. var length = Math.min(a.length, b.length)
  17038. var buffer = new Buffer(length)
  17039. for (var i = 0; i < length; ++i) {
  17040. buffer[i] = a[i] ^ b[i]
  17041. }
  17042. return buffer
  17043. }
  17044. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 115).Buffer))
  17045. /***/ }),
  17046. /* 180 */
  17047. /*!**************************************************!*\
  17048. !*** ./node_modules/browserify-aes/modes/cfb.js ***!
  17049. \**************************************************/
  17050. /*! no static exports found */
  17051. /***/ (function(module, exports, __webpack_require__) {
  17052. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  17053. var xor = __webpack_require__(/*! buffer-xor */ 179)
  17054. function encryptStart (self, data, decrypt) {
  17055. var len = data.length
  17056. var out = xor(data, self._cache)
  17057. self._cache = self._cache.slice(len)
  17058. self._prev = Buffer.concat([self._prev, decrypt ? data : out])
  17059. return out
  17060. }
  17061. exports.encrypt = function (self, data, decrypt) {
  17062. var out = Buffer.allocUnsafe(0)
  17063. var len
  17064. while (data.length) {
  17065. if (self._cache.length === 0) {
  17066. self._cache = self._cipher.encryptBlock(self._prev)
  17067. self._prev = Buffer.allocUnsafe(0)
  17068. }
  17069. if (self._cache.length <= data.length) {
  17070. len = self._cache.length
  17071. out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])
  17072. data = data.slice(len)
  17073. } else {
  17074. out = Buffer.concat([out, encryptStart(self, data, decrypt)])
  17075. break
  17076. }
  17077. }
  17078. return out
  17079. }
  17080. /***/ }),
  17081. /* 181 */
  17082. /*!***************************************************!*\
  17083. !*** ./node_modules/browserify-aes/modes/cfb8.js ***!
  17084. \***************************************************/
  17085. /*! no static exports found */
  17086. /***/ (function(module, exports, __webpack_require__) {
  17087. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  17088. function encryptByte (self, byteParam, decrypt) {
  17089. var pad = self._cipher.encryptBlock(self._prev)
  17090. var out = pad[0] ^ byteParam
  17091. self._prev = Buffer.concat([
  17092. self._prev.slice(1),
  17093. Buffer.from([decrypt ? byteParam : out])
  17094. ])
  17095. return out
  17096. }
  17097. exports.encrypt = function (self, chunk, decrypt) {
  17098. var len = chunk.length
  17099. var out = Buffer.allocUnsafe(len)
  17100. var i = -1
  17101. while (++i < len) {
  17102. out[i] = encryptByte(self, chunk[i], decrypt)
  17103. }
  17104. return out
  17105. }
  17106. /***/ }),
  17107. /* 182 */
  17108. /*!***************************************************!*\
  17109. !*** ./node_modules/browserify-aes/modes/cfb1.js ***!
  17110. \***************************************************/
  17111. /*! no static exports found */
  17112. /***/ (function(module, exports, __webpack_require__) {
  17113. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  17114. function encryptByte (self, byteParam, decrypt) {
  17115. var pad
  17116. var i = -1
  17117. var len = 8
  17118. var out = 0
  17119. var bit, value
  17120. while (++i < len) {
  17121. pad = self._cipher.encryptBlock(self._prev)
  17122. bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0
  17123. value = pad[0] ^ bit
  17124. out += ((value & 0x80) >> (i % 8))
  17125. self._prev = shiftIn(self._prev, decrypt ? bit : value)
  17126. }
  17127. return out
  17128. }
  17129. function shiftIn (buffer, value) {
  17130. var len = buffer.length
  17131. var i = -1
  17132. var out = Buffer.allocUnsafe(buffer.length)
  17133. buffer = Buffer.concat([buffer, Buffer.from([value])])
  17134. while (++i < len) {
  17135. out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)
  17136. }
  17137. return out
  17138. }
  17139. exports.encrypt = function (self, chunk, decrypt) {
  17140. var len = chunk.length
  17141. var out = Buffer.allocUnsafe(len)
  17142. var i = -1
  17143. while (++i < len) {
  17144. out[i] = encryptByte(self, chunk[i], decrypt)
  17145. }
  17146. return out
  17147. }
  17148. /***/ }),
  17149. /* 183 */
  17150. /*!**************************************************!*\
  17151. !*** ./node_modules/browserify-aes/modes/ofb.js ***!
  17152. \**************************************************/
  17153. /*! no static exports found */
  17154. /***/ (function(module, exports, __webpack_require__) {
  17155. /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(/*! buffer-xor */ 179)
  17156. function getBlock (self) {
  17157. self._prev = self._cipher.encryptBlock(self._prev)
  17158. return self._prev
  17159. }
  17160. exports.encrypt = function (self, chunk) {
  17161. while (self._cache.length < chunk.length) {
  17162. self._cache = Buffer.concat([self._cache, getBlock(self)])
  17163. }
  17164. var pad = self._cache.slice(0, chunk.length)
  17165. self._cache = self._cache.slice(chunk.length)
  17166. return xor(chunk, pad)
  17167. }
  17168. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 115).Buffer))
  17169. /***/ }),
  17170. /* 184 */
  17171. /*!**************************************************!*\
  17172. !*** ./node_modules/browserify-aes/modes/ctr.js ***!
  17173. \**************************************************/
  17174. /*! no static exports found */
  17175. /***/ (function(module, exports, __webpack_require__) {
  17176. var xor = __webpack_require__(/*! buffer-xor */ 179)
  17177. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  17178. var incr32 = __webpack_require__(/*! ../incr32 */ 185)
  17179. function getBlock (self) {
  17180. var out = self._cipher.encryptBlockRaw(self._prev)
  17181. incr32(self._prev)
  17182. return out
  17183. }
  17184. var blockSize = 16
  17185. exports.encrypt = function (self, chunk) {
  17186. var chunkNum = Math.ceil(chunk.length / blockSize)
  17187. var start = self._cache.length
  17188. self._cache = Buffer.concat([
  17189. self._cache,
  17190. Buffer.allocUnsafe(chunkNum * blockSize)
  17191. ])
  17192. for (var i = 0; i < chunkNum; i++) {
  17193. var out = getBlock(self)
  17194. var offset = start + i * blockSize
  17195. self._cache.writeUInt32BE(out[0], offset + 0)
  17196. self._cache.writeUInt32BE(out[1], offset + 4)
  17197. self._cache.writeUInt32BE(out[2], offset + 8)
  17198. self._cache.writeUInt32BE(out[3], offset + 12)
  17199. }
  17200. var pad = self._cache.slice(0, chunk.length)
  17201. self._cache = self._cache.slice(chunk.length)
  17202. return xor(chunk, pad)
  17203. }
  17204. /***/ }),
  17205. /* 185 */
  17206. /*!***********************************************!*\
  17207. !*** ./node_modules/browserify-aes/incr32.js ***!
  17208. \***********************************************/
  17209. /*! no static exports found */
  17210. /***/ (function(module, exports) {
  17211. function incr32 (iv) {
  17212. var len = iv.length
  17213. var item
  17214. while (len--) {
  17215. item = iv.readUInt8(len)
  17216. if (item === 255) {
  17217. iv.writeUInt8(0, len)
  17218. } else {
  17219. item++
  17220. iv.writeUInt8(item, len)
  17221. break
  17222. }
  17223. }
  17224. }
  17225. module.exports = incr32
  17226. /***/ }),
  17227. /* 186 */
  17228. /*!*****************************************************!*\
  17229. !*** ./node_modules/browserify-aes/modes/list.json ***!
  17230. \*****************************************************/
  17231. /*! exports provided: aes-128-ecb, aes-192-ecb, aes-256-ecb, aes-128-cbc, aes-192-cbc, aes-256-cbc, aes128, aes192, aes256, aes-128-cfb, aes-192-cfb, aes-256-cfb, aes-128-cfb8, aes-192-cfb8, aes-256-cfb8, aes-128-cfb1, aes-192-cfb1, aes-256-cfb1, aes-128-ofb, aes-192-ofb, aes-256-ofb, aes-128-ctr, aes-192-ctr, aes-256-ctr, aes-128-gcm, aes-192-gcm, aes-256-gcm, default */
  17232. /***/ (function(module) {
  17233. module.exports = JSON.parse("{\"aes-128-ecb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-192-ecb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-256-ecb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-128-cbc\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-192-cbc\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-256-cbc\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes128\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes192\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes256\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-128-cfb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-192-cfb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-256-cfb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-128-cfb8\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-192-cfb8\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-256-cfb8\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-128-cfb1\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-192-cfb1\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-256-cfb1\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-128-ofb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-192-ofb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-256-ofb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-128-ctr\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-192-ctr\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-256-ctr\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-128-gcm\":{\"cipher\":\"AES\",\"key\":128,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"},\"aes-192-gcm\":{\"cipher\":\"AES\",\"key\":192,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"},\"aes-256-gcm\":{\"cipher\":\"AES\",\"key\":256,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"}}");
  17234. /***/ }),
  17235. /* 187 */
  17236. /*!***************************************************!*\
  17237. !*** ./node_modules/browserify-aes/authCipher.js ***!
  17238. \***************************************************/
  17239. /*! no static exports found */
  17240. /***/ (function(module, exports, __webpack_require__) {
  17241. var aes = __webpack_require__(/*! ./aes */ 188)
  17242. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  17243. var Transform = __webpack_require__(/*! cipher-base */ 148)
  17244. var inherits = __webpack_require__(/*! inherits */ 120)
  17245. var GHASH = __webpack_require__(/*! ./ghash */ 189)
  17246. var xor = __webpack_require__(/*! buffer-xor */ 179)
  17247. var incr32 = __webpack_require__(/*! ./incr32 */ 185)
  17248. function xorTest (a, b) {
  17249. var out = 0
  17250. if (a.length !== b.length) out++
  17251. var len = Math.min(a.length, b.length)
  17252. for (var i = 0; i < len; ++i) {
  17253. out += (a[i] ^ b[i])
  17254. }
  17255. return out
  17256. }
  17257. function calcIv (self, iv, ck) {
  17258. if (iv.length === 12) {
  17259. self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])
  17260. return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])
  17261. }
  17262. var ghash = new GHASH(ck)
  17263. var len = iv.length
  17264. var toPad = len % 16
  17265. ghash.update(iv)
  17266. if (toPad) {
  17267. toPad = 16 - toPad
  17268. ghash.update(Buffer.alloc(toPad, 0))
  17269. }
  17270. ghash.update(Buffer.alloc(8, 0))
  17271. var ivBits = len * 8
  17272. var tail = Buffer.alloc(8)
  17273. tail.writeUIntBE(ivBits, 0, 8)
  17274. ghash.update(tail)
  17275. self._finID = ghash.state
  17276. var out = Buffer.from(self._finID)
  17277. incr32(out)
  17278. return out
  17279. }
  17280. function StreamCipher (mode, key, iv, decrypt) {
  17281. Transform.call(this)
  17282. var h = Buffer.alloc(4, 0)
  17283. this._cipher = new aes.AES(key)
  17284. var ck = this._cipher.encryptBlock(h)
  17285. this._ghash = new GHASH(ck)
  17286. iv = calcIv(this, iv, ck)
  17287. this._prev = Buffer.from(iv)
  17288. this._cache = Buffer.allocUnsafe(0)
  17289. this._secCache = Buffer.allocUnsafe(0)
  17290. this._decrypt = decrypt
  17291. this._alen = 0
  17292. this._len = 0
  17293. this._mode = mode
  17294. this._authTag = null
  17295. this._called = false
  17296. }
  17297. inherits(StreamCipher, Transform)
  17298. StreamCipher.prototype._update = function (chunk) {
  17299. if (!this._called && this._alen) {
  17300. var rump = 16 - (this._alen % 16)
  17301. if (rump < 16) {
  17302. rump = Buffer.alloc(rump, 0)
  17303. this._ghash.update(rump)
  17304. }
  17305. }
  17306. this._called = true
  17307. var out = this._mode.encrypt(this, chunk)
  17308. if (this._decrypt) {
  17309. this._ghash.update(chunk)
  17310. } else {
  17311. this._ghash.update(out)
  17312. }
  17313. this._len += chunk.length
  17314. return out
  17315. }
  17316. StreamCipher.prototype._final = function () {
  17317. if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data')
  17318. var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))
  17319. if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data')
  17320. this._authTag = tag
  17321. this._cipher.scrub()
  17322. }
  17323. StreamCipher.prototype.getAuthTag = function getAuthTag () {
  17324. if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state')
  17325. return this._authTag
  17326. }
  17327. StreamCipher.prototype.setAuthTag = function setAuthTag (tag) {
  17328. if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state')
  17329. this._authTag = tag
  17330. }
  17331. StreamCipher.prototype.setAAD = function setAAD (buf) {
  17332. if (this._called) throw new Error('Attempting to set AAD in unsupported state')
  17333. this._ghash.update(buf)
  17334. this._alen += buf.length
  17335. }
  17336. module.exports = StreamCipher
  17337. /***/ }),
  17338. /* 188 */
  17339. /*!********************************************!*\
  17340. !*** ./node_modules/browserify-aes/aes.js ***!
  17341. \********************************************/
  17342. /*! no static exports found */
  17343. /***/ (function(module, exports, __webpack_require__) {
  17344. // based on the aes implimentation in triple sec
  17345. // https://github.com/keybase/triplesec
  17346. // which is in turn based on the one from crypto-js
  17347. // https://code.google.com/p/crypto-js/
  17348. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  17349. function asUInt32Array (buf) {
  17350. if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
  17351. var len = (buf.length / 4) | 0
  17352. var out = new Array(len)
  17353. for (var i = 0; i < len; i++) {
  17354. out[i] = buf.readUInt32BE(i * 4)
  17355. }
  17356. return out
  17357. }
  17358. function scrubVec (v) {
  17359. for (var i = 0; i < v.length; v++) {
  17360. v[i] = 0
  17361. }
  17362. }
  17363. function cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) {
  17364. var SUB_MIX0 = SUB_MIX[0]
  17365. var SUB_MIX1 = SUB_MIX[1]
  17366. var SUB_MIX2 = SUB_MIX[2]
  17367. var SUB_MIX3 = SUB_MIX[3]
  17368. var s0 = M[0] ^ keySchedule[0]
  17369. var s1 = M[1] ^ keySchedule[1]
  17370. var s2 = M[2] ^ keySchedule[2]
  17371. var s3 = M[3] ^ keySchedule[3]
  17372. var t0, t1, t2, t3
  17373. var ksRow = 4
  17374. for (var round = 1; round < nRounds; round++) {
  17375. t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++]
  17376. t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++]
  17377. t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++]
  17378. t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++]
  17379. s0 = t0
  17380. s1 = t1
  17381. s2 = t2
  17382. s3 = t3
  17383. }
  17384. t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]
  17385. t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]
  17386. t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]
  17387. t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]
  17388. t0 = t0 >>> 0
  17389. t1 = t1 >>> 0
  17390. t2 = t2 >>> 0
  17391. t3 = t3 >>> 0
  17392. return [t0, t1, t2, t3]
  17393. }
  17394. // AES constants
  17395. var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]
  17396. var G = (function () {
  17397. // Compute double table
  17398. var d = new Array(256)
  17399. for (var j = 0; j < 256; j++) {
  17400. if (j < 128) {
  17401. d[j] = j << 1
  17402. } else {
  17403. d[j] = (j << 1) ^ 0x11b
  17404. }
  17405. }
  17406. var SBOX = []
  17407. var INV_SBOX = []
  17408. var SUB_MIX = [[], [], [], []]
  17409. var INV_SUB_MIX = [[], [], [], []]
  17410. // Walk GF(2^8)
  17411. var x = 0
  17412. var xi = 0
  17413. for (var i = 0; i < 256; ++i) {
  17414. // Compute sbox
  17415. var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)
  17416. sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63
  17417. SBOX[x] = sx
  17418. INV_SBOX[sx] = x
  17419. // Compute multiplication
  17420. var x2 = d[x]
  17421. var x4 = d[x2]
  17422. var x8 = d[x4]
  17423. // Compute sub bytes, mix columns tables
  17424. var t = (d[sx] * 0x101) ^ (sx * 0x1010100)
  17425. SUB_MIX[0][x] = (t << 24) | (t >>> 8)
  17426. SUB_MIX[1][x] = (t << 16) | (t >>> 16)
  17427. SUB_MIX[2][x] = (t << 8) | (t >>> 24)
  17428. SUB_MIX[3][x] = t
  17429. // Compute inv sub bytes, inv mix columns tables
  17430. t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)
  17431. INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)
  17432. INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)
  17433. INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)
  17434. INV_SUB_MIX[3][sx] = t
  17435. if (x === 0) {
  17436. x = xi = 1
  17437. } else {
  17438. x = x2 ^ d[d[d[x8 ^ x2]]]
  17439. xi ^= d[d[xi]]
  17440. }
  17441. }
  17442. return {
  17443. SBOX: SBOX,
  17444. INV_SBOX: INV_SBOX,
  17445. SUB_MIX: SUB_MIX,
  17446. INV_SUB_MIX: INV_SUB_MIX
  17447. }
  17448. })()
  17449. function AES (key) {
  17450. this._key = asUInt32Array(key)
  17451. this._reset()
  17452. }
  17453. AES.blockSize = 4 * 4
  17454. AES.keySize = 256 / 8
  17455. AES.prototype.blockSize = AES.blockSize
  17456. AES.prototype.keySize = AES.keySize
  17457. AES.prototype._reset = function () {
  17458. var keyWords = this._key
  17459. var keySize = keyWords.length
  17460. var nRounds = keySize + 6
  17461. var ksRows = (nRounds + 1) * 4
  17462. var keySchedule = []
  17463. for (var k = 0; k < keySize; k++) {
  17464. keySchedule[k] = keyWords[k]
  17465. }
  17466. for (k = keySize; k < ksRows; k++) {
  17467. var t = keySchedule[k - 1]
  17468. if (k % keySize === 0) {
  17469. t = (t << 8) | (t >>> 24)
  17470. t =
  17471. (G.SBOX[t >>> 24] << 24) |
  17472. (G.SBOX[(t >>> 16) & 0xff] << 16) |
  17473. (G.SBOX[(t >>> 8) & 0xff] << 8) |
  17474. (G.SBOX[t & 0xff])
  17475. t ^= RCON[(k / keySize) | 0] << 24
  17476. } else if (keySize > 6 && k % keySize === 4) {
  17477. t =
  17478. (G.SBOX[t >>> 24] << 24) |
  17479. (G.SBOX[(t >>> 16) & 0xff] << 16) |
  17480. (G.SBOX[(t >>> 8) & 0xff] << 8) |
  17481. (G.SBOX[t & 0xff])
  17482. }
  17483. keySchedule[k] = keySchedule[k - keySize] ^ t
  17484. }
  17485. var invKeySchedule = []
  17486. for (var ik = 0; ik < ksRows; ik++) {
  17487. var ksR = ksRows - ik
  17488. var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)]
  17489. if (ik < 4 || ksR <= 4) {
  17490. invKeySchedule[ik] = tt
  17491. } else {
  17492. invKeySchedule[ik] =
  17493. G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^
  17494. G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^
  17495. G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^
  17496. G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]]
  17497. }
  17498. }
  17499. this._nRounds = nRounds
  17500. this._keySchedule = keySchedule
  17501. this._invKeySchedule = invKeySchedule
  17502. }
  17503. AES.prototype.encryptBlockRaw = function (M) {
  17504. M = asUInt32Array(M)
  17505. return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)
  17506. }
  17507. AES.prototype.encryptBlock = function (M) {
  17508. var out = this.encryptBlockRaw(M)
  17509. var buf = Buffer.allocUnsafe(16)
  17510. buf.writeUInt32BE(out[0], 0)
  17511. buf.writeUInt32BE(out[1], 4)
  17512. buf.writeUInt32BE(out[2], 8)
  17513. buf.writeUInt32BE(out[3], 12)
  17514. return buf
  17515. }
  17516. AES.prototype.decryptBlock = function (M) {
  17517. M = asUInt32Array(M)
  17518. // swap
  17519. var m1 = M[1]
  17520. M[1] = M[3]
  17521. M[3] = m1
  17522. var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds)
  17523. var buf = Buffer.allocUnsafe(16)
  17524. buf.writeUInt32BE(out[0], 0)
  17525. buf.writeUInt32BE(out[3], 4)
  17526. buf.writeUInt32BE(out[2], 8)
  17527. buf.writeUInt32BE(out[1], 12)
  17528. return buf
  17529. }
  17530. AES.prototype.scrub = function () {
  17531. scrubVec(this._keySchedule)
  17532. scrubVec(this._invKeySchedule)
  17533. scrubVec(this._key)
  17534. }
  17535. module.exports.AES = AES
  17536. /***/ }),
  17537. /* 189 */
  17538. /*!**********************************************!*\
  17539. !*** ./node_modules/browserify-aes/ghash.js ***!
  17540. \**********************************************/
  17541. /*! no static exports found */
  17542. /***/ (function(module, exports, __webpack_require__) {
  17543. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  17544. var ZEROES = Buffer.alloc(16, 0)
  17545. function toArray (buf) {
  17546. return [
  17547. buf.readUInt32BE(0),
  17548. buf.readUInt32BE(4),
  17549. buf.readUInt32BE(8),
  17550. buf.readUInt32BE(12)
  17551. ]
  17552. }
  17553. function fromArray (out) {
  17554. var buf = Buffer.allocUnsafe(16)
  17555. buf.writeUInt32BE(out[0] >>> 0, 0)
  17556. buf.writeUInt32BE(out[1] >>> 0, 4)
  17557. buf.writeUInt32BE(out[2] >>> 0, 8)
  17558. buf.writeUInt32BE(out[3] >>> 0, 12)
  17559. return buf
  17560. }
  17561. function GHASH (key) {
  17562. this.h = key
  17563. this.state = Buffer.alloc(16, 0)
  17564. this.cache = Buffer.allocUnsafe(0)
  17565. }
  17566. // from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html
  17567. // by Juho Vähä-Herttua
  17568. GHASH.prototype.ghash = function (block) {
  17569. var i = -1
  17570. while (++i < block.length) {
  17571. this.state[i] ^= block[i]
  17572. }
  17573. this._multiply()
  17574. }
  17575. GHASH.prototype._multiply = function () {
  17576. var Vi = toArray(this.h)
  17577. var Zi = [0, 0, 0, 0]
  17578. var j, xi, lsbVi
  17579. var i = -1
  17580. while (++i < 128) {
  17581. xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0
  17582. if (xi) {
  17583. // Z_i+1 = Z_i ^ V_i
  17584. Zi[0] ^= Vi[0]
  17585. Zi[1] ^= Vi[1]
  17586. Zi[2] ^= Vi[2]
  17587. Zi[3] ^= Vi[3]
  17588. }
  17589. // Store the value of LSB(V_i)
  17590. lsbVi = (Vi[3] & 1) !== 0
  17591. // V_i+1 = V_i >> 1
  17592. for (j = 3; j > 0; j--) {
  17593. Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)
  17594. }
  17595. Vi[0] = Vi[0] >>> 1
  17596. // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R
  17597. if (lsbVi) {
  17598. Vi[0] = Vi[0] ^ (0xe1 << 24)
  17599. }
  17600. }
  17601. this.state = fromArray(Zi)
  17602. }
  17603. GHASH.prototype.update = function (buf) {
  17604. this.cache = Buffer.concat([this.cache, buf])
  17605. var chunk
  17606. while (this.cache.length >= 16) {
  17607. chunk = this.cache.slice(0, 16)
  17608. this.cache = this.cache.slice(16)
  17609. this.ghash(chunk)
  17610. }
  17611. }
  17612. GHASH.prototype.final = function (abl, bl) {
  17613. if (this.cache.length) {
  17614. this.ghash(Buffer.concat([this.cache, ZEROES], 16))
  17615. }
  17616. this.ghash(fromArray([0, abl, 0, bl]))
  17617. return this.state
  17618. }
  17619. module.exports = GHASH
  17620. /***/ }),
  17621. /* 190 */
  17622. /*!*****************************************************!*\
  17623. !*** ./node_modules/browserify-aes/streamCipher.js ***!
  17624. \*****************************************************/
  17625. /*! no static exports found */
  17626. /***/ (function(module, exports, __webpack_require__) {
  17627. var aes = __webpack_require__(/*! ./aes */ 188)
  17628. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  17629. var Transform = __webpack_require__(/*! cipher-base */ 148)
  17630. var inherits = __webpack_require__(/*! inherits */ 120)
  17631. function StreamCipher (mode, key, iv, decrypt) {
  17632. Transform.call(this)
  17633. this._cipher = new aes.AES(key)
  17634. this._prev = Buffer.from(iv)
  17635. this._cache = Buffer.allocUnsafe(0)
  17636. this._secCache = Buffer.allocUnsafe(0)
  17637. this._decrypt = decrypt
  17638. this._mode = mode
  17639. }
  17640. inherits(StreamCipher, Transform)
  17641. StreamCipher.prototype._update = function (chunk) {
  17642. return this._mode.encrypt(this, chunk, this._decrypt)
  17643. }
  17644. StreamCipher.prototype._final = function () {
  17645. this._cipher.scrub()
  17646. }
  17647. module.exports = StreamCipher
  17648. /***/ }),
  17649. /* 191 */
  17650. /*!**********************************************!*\
  17651. !*** ./node_modules/evp_bytestokey/index.js ***!
  17652. \**********************************************/
  17653. /*! no static exports found */
  17654. /***/ (function(module, exports, __webpack_require__) {
  17655. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  17656. var MD5 = __webpack_require__(/*! md5.js */ 121)
  17657. /* eslint-disable camelcase */
  17658. function EVP_BytesToKey (password, salt, keyBits, ivLen) {
  17659. if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')
  17660. if (salt) {
  17661. if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')
  17662. if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')
  17663. }
  17664. var keyLen = keyBits / 8
  17665. var key = Buffer.alloc(keyLen)
  17666. var iv = Buffer.alloc(ivLen || 0)
  17667. var tmp = Buffer.alloc(0)
  17668. while (keyLen > 0 || ivLen > 0) {
  17669. var hash = new MD5()
  17670. hash.update(tmp)
  17671. hash.update(password)
  17672. if (salt) hash.update(salt)
  17673. tmp = hash.digest()
  17674. var used = 0
  17675. if (keyLen > 0) {
  17676. var keyStart = key.length - keyLen
  17677. used = Math.min(keyLen, tmp.length)
  17678. tmp.copy(key, keyStart, 0, used)
  17679. keyLen -= used
  17680. }
  17681. if (used < tmp.length && ivLen > 0) {
  17682. var ivStart = iv.length - ivLen
  17683. var length = Math.min(ivLen, tmp.length - used)
  17684. tmp.copy(iv, ivStart, used, used + length)
  17685. ivLen -= length
  17686. }
  17687. }
  17688. tmp.fill(0)
  17689. return { key: key, iv: iv }
  17690. }
  17691. module.exports = EVP_BytesToKey
  17692. /***/ }),
  17693. /* 192 */
  17694. /*!**************************************************!*\
  17695. !*** ./node_modules/browserify-aes/decrypter.js ***!
  17696. \**************************************************/
  17697. /*! no static exports found */
  17698. /***/ (function(module, exports, __webpack_require__) {
  17699. var AuthCipher = __webpack_require__(/*! ./authCipher */ 187)
  17700. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  17701. var MODES = __webpack_require__(/*! ./modes */ 176)
  17702. var StreamCipher = __webpack_require__(/*! ./streamCipher */ 190)
  17703. var Transform = __webpack_require__(/*! cipher-base */ 148)
  17704. var aes = __webpack_require__(/*! ./aes */ 188)
  17705. var ebtk = __webpack_require__(/*! evp_bytestokey */ 191)
  17706. var inherits = __webpack_require__(/*! inherits */ 120)
  17707. function Decipher (mode, key, iv) {
  17708. Transform.call(this)
  17709. this._cache = new Splitter()
  17710. this._last = void 0
  17711. this._cipher = new aes.AES(key)
  17712. this._prev = Buffer.from(iv)
  17713. this._mode = mode
  17714. this._autopadding = true
  17715. }
  17716. inherits(Decipher, Transform)
  17717. Decipher.prototype._update = function (data) {
  17718. this._cache.add(data)
  17719. var chunk
  17720. var thing
  17721. var out = []
  17722. while ((chunk = this._cache.get(this._autopadding))) {
  17723. thing = this._mode.decrypt(this, chunk)
  17724. out.push(thing)
  17725. }
  17726. return Buffer.concat(out)
  17727. }
  17728. Decipher.prototype._final = function () {
  17729. var chunk = this._cache.flush()
  17730. if (this._autopadding) {
  17731. return unpad(this._mode.decrypt(this, chunk))
  17732. } else if (chunk) {
  17733. throw new Error('data not multiple of block length')
  17734. }
  17735. }
  17736. Decipher.prototype.setAutoPadding = function (setTo) {
  17737. this._autopadding = !!setTo
  17738. return this
  17739. }
  17740. function Splitter () {
  17741. this.cache = Buffer.allocUnsafe(0)
  17742. }
  17743. Splitter.prototype.add = function (data) {
  17744. this.cache = Buffer.concat([this.cache, data])
  17745. }
  17746. Splitter.prototype.get = function (autoPadding) {
  17747. var out
  17748. if (autoPadding) {
  17749. if (this.cache.length > 16) {
  17750. out = this.cache.slice(0, 16)
  17751. this.cache = this.cache.slice(16)
  17752. return out
  17753. }
  17754. } else {
  17755. if (this.cache.length >= 16) {
  17756. out = this.cache.slice(0, 16)
  17757. this.cache = this.cache.slice(16)
  17758. return out
  17759. }
  17760. }
  17761. return null
  17762. }
  17763. Splitter.prototype.flush = function () {
  17764. if (this.cache.length) return this.cache
  17765. }
  17766. function unpad (last) {
  17767. var padded = last[15]
  17768. if (padded < 1 || padded > 16) {
  17769. throw new Error('unable to decrypt data')
  17770. }
  17771. var i = -1
  17772. while (++i < padded) {
  17773. if (last[(i + (16 - padded))] !== padded) {
  17774. throw new Error('unable to decrypt data')
  17775. }
  17776. }
  17777. if (padded === 16) return
  17778. return last.slice(0, 16 - padded)
  17779. }
  17780. function createDecipheriv (suite, password, iv) {
  17781. var config = MODES[suite.toLowerCase()]
  17782. if (!config) throw new TypeError('invalid suite type')
  17783. if (typeof iv === 'string') iv = Buffer.from(iv)
  17784. if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
  17785. if (typeof password === 'string') password = Buffer.from(password)
  17786. if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
  17787. if (config.type === 'stream') {
  17788. return new StreamCipher(config.module, password, iv, true)
  17789. } else if (config.type === 'auth') {
  17790. return new AuthCipher(config.module, password, iv, true)
  17791. }
  17792. return new Decipher(config.module, password, iv)
  17793. }
  17794. function createDecipher (suite, password) {
  17795. var config = MODES[suite.toLowerCase()]
  17796. if (!config) throw new TypeError('invalid suite type')
  17797. var keys = ebtk(password, false, config.key, config.iv)
  17798. return createDecipheriv(suite, keys.key, keys.iv)
  17799. }
  17800. exports.createDecipher = createDecipher
  17801. exports.createDecipheriv = createDecipheriv
  17802. /***/ }),
  17803. /* 193 */
  17804. /*!**********************************************!*\
  17805. !*** ./node_modules/browserify-des/modes.js ***!
  17806. \**********************************************/
  17807. /*! no static exports found */
  17808. /***/ (function(module, exports) {
  17809. exports['des-ecb'] = {
  17810. key: 8,
  17811. iv: 0
  17812. }
  17813. exports['des-cbc'] = exports.des = {
  17814. key: 8,
  17815. iv: 8
  17816. }
  17817. exports['des-ede3-cbc'] = exports.des3 = {
  17818. key: 24,
  17819. iv: 8
  17820. }
  17821. exports['des-ede3'] = {
  17822. key: 24,
  17823. iv: 0
  17824. }
  17825. exports['des-ede-cbc'] = {
  17826. key: 16,
  17827. iv: 8
  17828. }
  17829. exports['des-ede'] = {
  17830. key: 16,
  17831. iv: 0
  17832. }
  17833. /***/ }),
  17834. /* 194 */
  17835. /*!************************************************!*\
  17836. !*** ./node_modules/diffie-hellman/browser.js ***!
  17837. \************************************************/
  17838. /*! no static exports found */
  17839. /***/ (function(module, exports, __webpack_require__) {
  17840. /* WEBPACK VAR INJECTION */(function(Buffer) {var generatePrime = __webpack_require__(/*! ./lib/generatePrime */ 195)
  17841. var primes = __webpack_require__(/*! ./lib/primes.json */ 202)
  17842. var DH = __webpack_require__(/*! ./lib/dh */ 203)
  17843. function getDiffieHellman (mod) {
  17844. var prime = new Buffer(primes[mod].prime, 'hex')
  17845. var gen = new Buffer(primes[mod].gen, 'hex')
  17846. return new DH(prime, gen)
  17847. }
  17848. var ENCODINGS = {
  17849. 'binary': true, 'hex': true, 'base64': true
  17850. }
  17851. function createDiffieHellman (prime, enc, generator, genc) {
  17852. if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
  17853. return createDiffieHellman(prime, 'binary', enc, generator)
  17854. }
  17855. enc = enc || 'binary'
  17856. genc = genc || 'binary'
  17857. generator = generator || new Buffer([2])
  17858. if (!Buffer.isBuffer(generator)) {
  17859. generator = new Buffer(generator, genc)
  17860. }
  17861. if (typeof prime === 'number') {
  17862. return new DH(generatePrime(prime, generator), generator, true)
  17863. }
  17864. if (!Buffer.isBuffer(prime)) {
  17865. prime = new Buffer(prime, enc)
  17866. }
  17867. return new DH(prime, generator, true)
  17868. }
  17869. exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman
  17870. exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman
  17871. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 115).Buffer))
  17872. /***/ }),
  17873. /* 195 */
  17874. /*!**********************************************************!*\
  17875. !*** ./node_modules/diffie-hellman/lib/generatePrime.js ***!
  17876. \**********************************************************/
  17877. /*! no static exports found */
  17878. /***/ (function(module, exports, __webpack_require__) {
  17879. var randomBytes = __webpack_require__(/*! randombytes */ 111);
  17880. module.exports = findPrime;
  17881. findPrime.simpleSieve = simpleSieve;
  17882. findPrime.fermatTest = fermatTest;
  17883. var BN = __webpack_require__(/*! bn.js */ 196);
  17884. var TWENTYFOUR = new BN(24);
  17885. var MillerRabin = __webpack_require__(/*! miller-rabin */ 199);
  17886. var millerRabin = new MillerRabin();
  17887. var ONE = new BN(1);
  17888. var TWO = new BN(2);
  17889. var FIVE = new BN(5);
  17890. var SIXTEEN = new BN(16);
  17891. var EIGHT = new BN(8);
  17892. var TEN = new BN(10);
  17893. var THREE = new BN(3);
  17894. var SEVEN = new BN(7);
  17895. var ELEVEN = new BN(11);
  17896. var FOUR = new BN(4);
  17897. var TWELVE = new BN(12);
  17898. var primes = null;
  17899. function _getPrimes() {
  17900. if (primes !== null)
  17901. return primes;
  17902. var limit = 0x100000;
  17903. var res = [];
  17904. res[0] = 2;
  17905. for (var i = 1, k = 3; k < limit; k += 2) {
  17906. var sqrt = Math.ceil(Math.sqrt(k));
  17907. for (var j = 0; j < i && res[j] <= sqrt; j++)
  17908. if (k % res[j] === 0)
  17909. break;
  17910. if (i !== j && res[j] <= sqrt)
  17911. continue;
  17912. res[i++] = k;
  17913. }
  17914. primes = res;
  17915. return res;
  17916. }
  17917. function simpleSieve(p) {
  17918. var primes = _getPrimes();
  17919. for (var i = 0; i < primes.length; i++)
  17920. if (p.modn(primes[i]) === 0) {
  17921. if (p.cmpn(primes[i]) === 0) {
  17922. return true;
  17923. } else {
  17924. return false;
  17925. }
  17926. }
  17927. return true;
  17928. }
  17929. function fermatTest(p) {
  17930. var red = BN.mont(p);
  17931. return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
  17932. }
  17933. function findPrime(bits, gen) {
  17934. if (bits < 16) {
  17935. // this is what openssl does
  17936. if (gen === 2 || gen === 5) {
  17937. return new BN([0x8c, 0x7b]);
  17938. } else {
  17939. return new BN([0x8c, 0x27]);
  17940. }
  17941. }
  17942. gen = new BN(gen);
  17943. var num, n2;
  17944. while (true) {
  17945. num = new BN(randomBytes(Math.ceil(bits / 8)));
  17946. while (num.bitLength() > bits) {
  17947. num.ishrn(1);
  17948. }
  17949. if (num.isEven()) {
  17950. num.iadd(ONE);
  17951. }
  17952. if (!num.testn(1)) {
  17953. num.iadd(TWO);
  17954. }
  17955. if (!gen.cmp(TWO)) {
  17956. while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {
  17957. num.iadd(FOUR);
  17958. }
  17959. } else if (!gen.cmp(FIVE)) {
  17960. while (num.mod(TEN).cmp(THREE)) {
  17961. num.iadd(FOUR);
  17962. }
  17963. }
  17964. n2 = num.shrn(1);
  17965. if (simpleSieve(n2) && simpleSieve(num) &&
  17966. fermatTest(n2) && fermatTest(num) &&
  17967. millerRabin.test(n2) && millerRabin.test(num)) {
  17968. return num;
  17969. }
  17970. }
  17971. }
  17972. /***/ }),
  17973. /* 196 */
  17974. /*!**************************************!*\
  17975. !*** ./node_modules/bn.js/lib/bn.js ***!
  17976. \**************************************/
  17977. /*! no static exports found */
  17978. /***/ (function(module, exports, __webpack_require__) {
  17979. /* WEBPACK VAR INJECTION */(function(module) {(function (module, exports) {
  17980. 'use strict';
  17981. // Utils
  17982. function assert (val, msg) {
  17983. if (!val) throw new Error(msg || 'Assertion failed');
  17984. }
  17985. // Could use `inherits` module, but don't want to move from single file
  17986. // architecture yet.
  17987. function inherits (ctor, superCtor) {
  17988. ctor.super_ = superCtor;
  17989. var TempCtor = function () {};
  17990. TempCtor.prototype = superCtor.prototype;
  17991. ctor.prototype = new TempCtor();
  17992. ctor.prototype.constructor = ctor;
  17993. }
  17994. // BN
  17995. function BN (number, base, endian) {
  17996. if (BN.isBN(number)) {
  17997. return number;
  17998. }
  17999. this.negative = 0;
  18000. this.words = null;
  18001. this.length = 0;
  18002. // Reduction context
  18003. this.red = null;
  18004. if (number !== null) {
  18005. if (base === 'le' || base === 'be') {
  18006. endian = base;
  18007. base = 10;
  18008. }
  18009. this._init(number || 0, base || 10, endian || 'be');
  18010. }
  18011. }
  18012. if (typeof module === 'object') {
  18013. module.exports = BN;
  18014. } else {
  18015. exports.BN = BN;
  18016. }
  18017. BN.BN = BN;
  18018. BN.wordSize = 26;
  18019. var Buffer;
  18020. try {
  18021. Buffer = __webpack_require__(/*! buffer */ 198).Buffer;
  18022. } catch (e) {
  18023. }
  18024. BN.isBN = function isBN (num) {
  18025. if (num instanceof BN) {
  18026. return true;
  18027. }
  18028. return num !== null && typeof num === 'object' &&
  18029. num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
  18030. };
  18031. BN.max = function max (left, right) {
  18032. if (left.cmp(right) > 0) return left;
  18033. return right;
  18034. };
  18035. BN.min = function min (left, right) {
  18036. if (left.cmp(right) < 0) return left;
  18037. return right;
  18038. };
  18039. BN.prototype._init = function init (number, base, endian) {
  18040. if (typeof number === 'number') {
  18041. return this._initNumber(number, base, endian);
  18042. }
  18043. if (typeof number === 'object') {
  18044. return this._initArray(number, base, endian);
  18045. }
  18046. if (base === 'hex') {
  18047. base = 16;
  18048. }
  18049. assert(base === (base | 0) && base >= 2 && base <= 36);
  18050. number = number.toString().replace(/\s+/g, '');
  18051. var start = 0;
  18052. if (number[0] === '-') {
  18053. start++;
  18054. }
  18055. if (base === 16) {
  18056. this._parseHex(number, start);
  18057. } else {
  18058. this._parseBase(number, base, start);
  18059. }
  18060. if (number[0] === '-') {
  18061. this.negative = 1;
  18062. }
  18063. this._strip();
  18064. if (endian !== 'le') return;
  18065. this._initArray(this.toArray(), base, endian);
  18066. };
  18067. BN.prototype._initNumber = function _initNumber (number, base, endian) {
  18068. if (number < 0) {
  18069. this.negative = 1;
  18070. number = -number;
  18071. }
  18072. if (number < 0x4000000) {
  18073. this.words = [number & 0x3ffffff];
  18074. this.length = 1;
  18075. } else if (number < 0x10000000000000) {
  18076. this.words = [
  18077. number & 0x3ffffff,
  18078. (number / 0x4000000) & 0x3ffffff
  18079. ];
  18080. this.length = 2;
  18081. } else {
  18082. assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
  18083. this.words = [
  18084. number & 0x3ffffff,
  18085. (number / 0x4000000) & 0x3ffffff,
  18086. 1
  18087. ];
  18088. this.length = 3;
  18089. }
  18090. if (endian !== 'le') return;
  18091. // Reverse the bytes
  18092. this._initArray(this.toArray(), base, endian);
  18093. };
  18094. BN.prototype._initArray = function _initArray (number, base, endian) {
  18095. // Perhaps a Uint8Array
  18096. assert(typeof number.length === 'number');
  18097. if (number.length <= 0) {
  18098. this.words = [0];
  18099. this.length = 1;
  18100. return this;
  18101. }
  18102. this.length = Math.ceil(number.length / 3);
  18103. this.words = new Array(this.length);
  18104. for (var i = 0; i < this.length; i++) {
  18105. this.words[i] = 0;
  18106. }
  18107. var j, w;
  18108. var off = 0;
  18109. if (endian === 'be') {
  18110. for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
  18111. w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);
  18112. this.words[j] |= (w << off) & 0x3ffffff;
  18113. this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
  18114. off += 24;
  18115. if (off >= 26) {
  18116. off -= 26;
  18117. j++;
  18118. }
  18119. }
  18120. } else if (endian === 'le') {
  18121. for (i = 0, j = 0; i < number.length; i += 3) {
  18122. w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);
  18123. this.words[j] |= (w << off) & 0x3ffffff;
  18124. this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
  18125. off += 24;
  18126. if (off >= 26) {
  18127. off -= 26;
  18128. j++;
  18129. }
  18130. }
  18131. }
  18132. return this._strip();
  18133. };
  18134. function parseHex (str, start, end) {
  18135. var r = 0;
  18136. var len = Math.min(str.length, end);
  18137. var z = 0;
  18138. for (var i = start; i < len; i++) {
  18139. var c = str.charCodeAt(i) - 48;
  18140. r <<= 4;
  18141. var b;
  18142. // 'a' - 'f'
  18143. if (c >= 49 && c <= 54) {
  18144. b = c - 49 + 0xa;
  18145. // 'A' - 'F'
  18146. } else if (c >= 17 && c <= 22) {
  18147. b = c - 17 + 0xa;
  18148. // '0' - '9'
  18149. } else {
  18150. b = c;
  18151. }
  18152. r |= b;
  18153. z |= b;
  18154. }
  18155. assert(!(z & 0xf0), 'Invalid character in ' + str);
  18156. return r;
  18157. }
  18158. BN.prototype._parseHex = function _parseHex (number, start) {
  18159. // Create possibly bigger array to ensure that it fits the number
  18160. this.length = Math.ceil((number.length - start) / 6);
  18161. this.words = new Array(this.length);
  18162. for (var i = 0; i < this.length; i++) {
  18163. this.words[i] = 0;
  18164. }
  18165. var j, w;
  18166. // Scan 24-bit chunks and add them to the number
  18167. var off = 0;
  18168. for (i = number.length - 6, j = 0; i >= start; i -= 6) {
  18169. w = parseHex(number, i, i + 6);
  18170. this.words[j] |= (w << off) & 0x3ffffff;
  18171. // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb
  18172. this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
  18173. off += 24;
  18174. if (off >= 26) {
  18175. off -= 26;
  18176. j++;
  18177. }
  18178. }
  18179. if (i + 6 !== start) {
  18180. w = parseHex(number, start, i + 6);
  18181. this.words[j] |= (w << off) & 0x3ffffff;
  18182. this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
  18183. }
  18184. this._strip();
  18185. };
  18186. function parseBase (str, start, end, mul) {
  18187. var r = 0;
  18188. var b = 0;
  18189. var len = Math.min(str.length, end);
  18190. for (var i = start; i < len; i++) {
  18191. var c = str.charCodeAt(i) - 48;
  18192. r *= mul;
  18193. // 'a'
  18194. if (c >= 49) {
  18195. b = c - 49 + 0xa;
  18196. // 'A'
  18197. } else if (c >= 17) {
  18198. b = c - 17 + 0xa;
  18199. // '0' - '9'
  18200. } else {
  18201. b = c;
  18202. }
  18203. assert(c >= 0 && b < mul, 'Invalid character');
  18204. r += b;
  18205. }
  18206. return r;
  18207. }
  18208. BN.prototype._parseBase = function _parseBase (number, base, start) {
  18209. // Initialize as zero
  18210. this.words = [0];
  18211. this.length = 1;
  18212. // Find length of limb in base
  18213. for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
  18214. limbLen++;
  18215. }
  18216. limbLen--;
  18217. limbPow = (limbPow / base) | 0;
  18218. var total = number.length - start;
  18219. var mod = total % limbLen;
  18220. var end = Math.min(total, total - mod) + start;
  18221. var word = 0;
  18222. for (var i = start; i < end; i += limbLen) {
  18223. word = parseBase(number, i, i + limbLen, base);
  18224. this.imuln(limbPow);
  18225. if (this.words[0] + word < 0x4000000) {
  18226. this.words[0] += word;
  18227. } else {
  18228. this._iaddn(word);
  18229. }
  18230. }
  18231. if (mod !== 0) {
  18232. var pow = 1;
  18233. word = parseBase(number, i, number.length, base);
  18234. for (i = 0; i < mod; i++) {
  18235. pow *= base;
  18236. }
  18237. this.imuln(pow);
  18238. if (this.words[0] + word < 0x4000000) {
  18239. this.words[0] += word;
  18240. } else {
  18241. this._iaddn(word);
  18242. }
  18243. }
  18244. };
  18245. BN.prototype.copy = function copy (dest) {
  18246. dest.words = new Array(this.length);
  18247. for (var i = 0; i < this.length; i++) {
  18248. dest.words[i] = this.words[i];
  18249. }
  18250. dest.length = this.length;
  18251. dest.negative = this.negative;
  18252. dest.red = this.red;
  18253. };
  18254. function move (dest, src) {
  18255. dest.words = src.words;
  18256. dest.length = src.length;
  18257. dest.negative = src.negative;
  18258. dest.red = src.red;
  18259. }
  18260. BN.prototype._move = function _move (dest) {
  18261. move(dest, this);
  18262. };
  18263. BN.prototype.clone = function clone () {
  18264. var r = new BN(null);
  18265. this.copy(r);
  18266. return r;
  18267. };
  18268. BN.prototype._expand = function _expand (size) {
  18269. while (this.length < size) {
  18270. this.words[this.length++] = 0;
  18271. }
  18272. return this;
  18273. };
  18274. // Remove leading `0` from `this`
  18275. BN.prototype._strip = function strip () {
  18276. while (this.length > 1 && this.words[this.length - 1] === 0) {
  18277. this.length--;
  18278. }
  18279. return this._normSign();
  18280. };
  18281. BN.prototype._normSign = function _normSign () {
  18282. // -0 = 0
  18283. if (this.length === 1 && this.words[0] === 0) {
  18284. this.negative = 0;
  18285. }
  18286. return this;
  18287. };
  18288. // Check Symbol.for because not everywhere where Symbol defined
  18289. // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility
  18290. if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {
  18291. BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;
  18292. } else {
  18293. BN.prototype.inspect = inspect;
  18294. }
  18295. function inspect () {
  18296. return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
  18297. }
  18298. /*
  18299. var zeros = [];
  18300. var groupSizes = [];
  18301. var groupBases = [];
  18302. var s = '';
  18303. var i = -1;
  18304. while (++i < BN.wordSize) {
  18305. zeros[i] = s;
  18306. s += '0';
  18307. }
  18308. groupSizes[0] = 0;
  18309. groupSizes[1] = 0;
  18310. groupBases[0] = 0;
  18311. groupBases[1] = 0;
  18312. var base = 2 - 1;
  18313. while (++base < 36 + 1) {
  18314. var groupSize = 0;
  18315. var groupBase = 1;
  18316. while (groupBase < (1 << BN.wordSize) / base) {
  18317. groupBase *= base;
  18318. groupSize += 1;
  18319. }
  18320. groupSizes[base] = groupSize;
  18321. groupBases[base] = groupBase;
  18322. }
  18323. */
  18324. var zeros = [
  18325. '',
  18326. '0',
  18327. '00',
  18328. '000',
  18329. '0000',
  18330. '00000',
  18331. '000000',
  18332. '0000000',
  18333. '00000000',
  18334. '000000000',
  18335. '0000000000',
  18336. '00000000000',
  18337. '000000000000',
  18338. '0000000000000',
  18339. '00000000000000',
  18340. '000000000000000',
  18341. '0000000000000000',
  18342. '00000000000000000',
  18343. '000000000000000000',
  18344. '0000000000000000000',
  18345. '00000000000000000000',
  18346. '000000000000000000000',
  18347. '0000000000000000000000',
  18348. '00000000000000000000000',
  18349. '000000000000000000000000',
  18350. '0000000000000000000000000'
  18351. ];
  18352. var groupSizes = [
  18353. 0, 0,
  18354. 25, 16, 12, 11, 10, 9, 8,
  18355. 8, 7, 7, 7, 7, 6, 6,
  18356. 6, 6, 6, 6, 6, 5, 5,
  18357. 5, 5, 5, 5, 5, 5, 5,
  18358. 5, 5, 5, 5, 5, 5, 5
  18359. ];
  18360. var groupBases = [
  18361. 0, 0,
  18362. 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,
  18363. 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,
  18364. 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,
  18365. 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,
  18366. 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
  18367. ];
  18368. BN.prototype.toString = function toString (base, padding) {
  18369. base = base || 10;
  18370. padding = padding | 0 || 1;
  18371. var out;
  18372. if (base === 16 || base === 'hex') {
  18373. out = '';
  18374. var off = 0;
  18375. var carry = 0;
  18376. for (var i = 0; i < this.length; i++) {
  18377. var w = this.words[i];
  18378. var word = (((w << off) | carry) & 0xffffff).toString(16);
  18379. carry = (w >>> (24 - off)) & 0xffffff;
  18380. if (carry !== 0 || i !== this.length - 1) {
  18381. out = zeros[6 - word.length] + word + out;
  18382. } else {
  18383. out = word + out;
  18384. }
  18385. off += 2;
  18386. if (off >= 26) {
  18387. off -= 26;
  18388. i--;
  18389. }
  18390. }
  18391. if (carry !== 0) {
  18392. out = carry.toString(16) + out;
  18393. }
  18394. while (out.length % padding !== 0) {
  18395. out = '0' + out;
  18396. }
  18397. if (this.negative !== 0) {
  18398. out = '-' + out;
  18399. }
  18400. return out;
  18401. }
  18402. if (base === (base | 0) && base >= 2 && base <= 36) {
  18403. // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
  18404. var groupSize = groupSizes[base];
  18405. // var groupBase = Math.pow(base, groupSize);
  18406. var groupBase = groupBases[base];
  18407. out = '';
  18408. var c = this.clone();
  18409. c.negative = 0;
  18410. while (!c.isZero()) {
  18411. var r = c.modrn(groupBase).toString(base);
  18412. c = c.idivn(groupBase);
  18413. if (!c.isZero()) {
  18414. out = zeros[groupSize - r.length] + r + out;
  18415. } else {
  18416. out = r + out;
  18417. }
  18418. }
  18419. if (this.isZero()) {
  18420. out = '0' + out;
  18421. }
  18422. while (out.length % padding !== 0) {
  18423. out = '0' + out;
  18424. }
  18425. if (this.negative !== 0) {
  18426. out = '-' + out;
  18427. }
  18428. return out;
  18429. }
  18430. assert(false, 'Base should be between 2 and 36');
  18431. };
  18432. BN.prototype.toNumber = function toNumber () {
  18433. var ret = this.words[0];
  18434. if (this.length === 2) {
  18435. ret += this.words[1] * 0x4000000;
  18436. } else if (this.length === 3 && this.words[2] === 0x01) {
  18437. // NOTE: at this stage it is known that the top bit is set
  18438. ret += 0x10000000000000 + (this.words[1] * 0x4000000);
  18439. } else if (this.length > 2) {
  18440. assert(false, 'Number can only safely store up to 53 bits');
  18441. }
  18442. return (this.negative !== 0) ? -ret : ret;
  18443. };
  18444. BN.prototype.toJSON = function toJSON () {
  18445. return this.toString(16, 2);
  18446. };
  18447. if (Buffer) {
  18448. BN.prototype.toBuffer = function toBuffer (endian, length) {
  18449. return this.toArrayLike(Buffer, endian, length);
  18450. };
  18451. }
  18452. BN.prototype.toArray = function toArray (endian, length) {
  18453. return this.toArrayLike(Array, endian, length);
  18454. };
  18455. var allocate = function allocate (ArrayType, size) {
  18456. if (ArrayType.allocUnsafe) {
  18457. return ArrayType.allocUnsafe(size);
  18458. }
  18459. return new ArrayType(size);
  18460. };
  18461. BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {
  18462. this._strip();
  18463. var byteLength = this.byteLength();
  18464. var reqLength = length || Math.max(1, byteLength);
  18465. assert(byteLength <= reqLength, 'byte array longer than desired length');
  18466. assert(reqLength > 0, 'Requested array length <= 0');
  18467. var res = allocate(ArrayType, reqLength);
  18468. var postfix = endian === 'le' ? 'LE' : 'BE';
  18469. this['_toArrayLike' + postfix](res, byteLength);
  18470. return res;
  18471. };
  18472. BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {
  18473. var position = 0;
  18474. var carry = 0;
  18475. for (var i = 0, shift = 0; i < this.length; i++) {
  18476. var word = (this.words[i] << shift) | carry;
  18477. res[position++] = word & 0xff;
  18478. if (position < res.length) {
  18479. res[position++] = (word >> 8) & 0xff;
  18480. }
  18481. if (position < res.length) {
  18482. res[position++] = (word >> 16) & 0xff;
  18483. }
  18484. if (shift === 6) {
  18485. if (position < res.length) {
  18486. res[position++] = (word >> 24) & 0xff;
  18487. }
  18488. carry = 0;
  18489. shift = 0;
  18490. } else {
  18491. carry = word >>> 24;
  18492. shift += 2;
  18493. }
  18494. }
  18495. if (position < res.length) {
  18496. res[position++] = carry;
  18497. while (position < res.length) {
  18498. res[position++] = 0;
  18499. }
  18500. }
  18501. };
  18502. BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {
  18503. var position = res.length - 1;
  18504. var carry = 0;
  18505. for (var i = 0, shift = 0; i < this.length; i++) {
  18506. var word = (this.words[i] << shift) | carry;
  18507. res[position--] = word & 0xff;
  18508. if (position >= 0) {
  18509. res[position--] = (word >> 8) & 0xff;
  18510. }
  18511. if (position >= 0) {
  18512. res[position--] = (word >> 16) & 0xff;
  18513. }
  18514. if (shift === 6) {
  18515. if (position >= 0) {
  18516. res[position--] = (word >> 24) & 0xff;
  18517. }
  18518. carry = 0;
  18519. shift = 0;
  18520. } else {
  18521. carry = word >>> 24;
  18522. shift += 2;
  18523. }
  18524. }
  18525. if (position >= 0) {
  18526. res[position--] = carry;
  18527. while (position >= 0) {
  18528. res[position--] = 0;
  18529. }
  18530. }
  18531. };
  18532. if (Math.clz32) {
  18533. BN.prototype._countBits = function _countBits (w) {
  18534. return 32 - Math.clz32(w);
  18535. };
  18536. } else {
  18537. BN.prototype._countBits = function _countBits (w) {
  18538. var t = w;
  18539. var r = 0;
  18540. if (t >= 0x1000) {
  18541. r += 13;
  18542. t >>>= 13;
  18543. }
  18544. if (t >= 0x40) {
  18545. r += 7;
  18546. t >>>= 7;
  18547. }
  18548. if (t >= 0x8) {
  18549. r += 4;
  18550. t >>>= 4;
  18551. }
  18552. if (t >= 0x02) {
  18553. r += 2;
  18554. t >>>= 2;
  18555. }
  18556. return r + t;
  18557. };
  18558. }
  18559. BN.prototype._zeroBits = function _zeroBits (w) {
  18560. // Short-cut
  18561. if (w === 0) return 26;
  18562. var t = w;
  18563. var r = 0;
  18564. if ((t & 0x1fff) === 0) {
  18565. r += 13;
  18566. t >>>= 13;
  18567. }
  18568. if ((t & 0x7f) === 0) {
  18569. r += 7;
  18570. t >>>= 7;
  18571. }
  18572. if ((t & 0xf) === 0) {
  18573. r += 4;
  18574. t >>>= 4;
  18575. }
  18576. if ((t & 0x3) === 0) {
  18577. r += 2;
  18578. t >>>= 2;
  18579. }
  18580. if ((t & 0x1) === 0) {
  18581. r++;
  18582. }
  18583. return r;
  18584. };
  18585. // Return number of used bits in a BN
  18586. BN.prototype.bitLength = function bitLength () {
  18587. var w = this.words[this.length - 1];
  18588. var hi = this._countBits(w);
  18589. return (this.length - 1) * 26 + hi;
  18590. };
  18591. function toBitArray (num) {
  18592. var w = new Array(num.bitLength());
  18593. for (var bit = 0; bit < w.length; bit++) {
  18594. var off = (bit / 26) | 0;
  18595. var wbit = bit % 26;
  18596. w[bit] = (num.words[off] >>> wbit) & 0x01;
  18597. }
  18598. return w;
  18599. }
  18600. // Number of trailing zero bits
  18601. BN.prototype.zeroBits = function zeroBits () {
  18602. if (this.isZero()) return 0;
  18603. var r = 0;
  18604. for (var i = 0; i < this.length; i++) {
  18605. var b = this._zeroBits(this.words[i]);
  18606. r += b;
  18607. if (b !== 26) break;
  18608. }
  18609. return r;
  18610. };
  18611. BN.prototype.byteLength = function byteLength () {
  18612. return Math.ceil(this.bitLength() / 8);
  18613. };
  18614. BN.prototype.toTwos = function toTwos (width) {
  18615. if (this.negative !== 0) {
  18616. return this.abs().inotn(width).iaddn(1);
  18617. }
  18618. return this.clone();
  18619. };
  18620. BN.prototype.fromTwos = function fromTwos (width) {
  18621. if (this.testn(width - 1)) {
  18622. return this.notn(width).iaddn(1).ineg();
  18623. }
  18624. return this.clone();
  18625. };
  18626. BN.prototype.isNeg = function isNeg () {
  18627. return this.negative !== 0;
  18628. };
  18629. // Return negative clone of `this`
  18630. BN.prototype.neg = function neg () {
  18631. return this.clone().ineg();
  18632. };
  18633. BN.prototype.ineg = function ineg () {
  18634. if (!this.isZero()) {
  18635. this.negative ^= 1;
  18636. }
  18637. return this;
  18638. };
  18639. // Or `num` with `this` in-place
  18640. BN.prototype.iuor = function iuor (num) {
  18641. while (this.length < num.length) {
  18642. this.words[this.length++] = 0;
  18643. }
  18644. for (var i = 0; i < num.length; i++) {
  18645. this.words[i] = this.words[i] | num.words[i];
  18646. }
  18647. return this._strip();
  18648. };
  18649. BN.prototype.ior = function ior (num) {
  18650. assert((this.negative | num.negative) === 0);
  18651. return this.iuor(num);
  18652. };
  18653. // Or `num` with `this`
  18654. BN.prototype.or = function or (num) {
  18655. if (this.length > num.length) return this.clone().ior(num);
  18656. return num.clone().ior(this);
  18657. };
  18658. BN.prototype.uor = function uor (num) {
  18659. if (this.length > num.length) return this.clone().iuor(num);
  18660. return num.clone().iuor(this);
  18661. };
  18662. // And `num` with `this` in-place
  18663. BN.prototype.iuand = function iuand (num) {
  18664. // b = min-length(num, this)
  18665. var b;
  18666. if (this.length > num.length) {
  18667. b = num;
  18668. } else {
  18669. b = this;
  18670. }
  18671. for (var i = 0; i < b.length; i++) {
  18672. this.words[i] = this.words[i] & num.words[i];
  18673. }
  18674. this.length = b.length;
  18675. return this._strip();
  18676. };
  18677. BN.prototype.iand = function iand (num) {
  18678. assert((this.negative | num.negative) === 0);
  18679. return this.iuand(num);
  18680. };
  18681. // And `num` with `this`
  18682. BN.prototype.and = function and (num) {
  18683. if (this.length > num.length) return this.clone().iand(num);
  18684. return num.clone().iand(this);
  18685. };
  18686. BN.prototype.uand = function uand (num) {
  18687. if (this.length > num.length) return this.clone().iuand(num);
  18688. return num.clone().iuand(this);
  18689. };
  18690. // Xor `num` with `this` in-place
  18691. BN.prototype.iuxor = function iuxor (num) {
  18692. // a.length > b.length
  18693. var a;
  18694. var b;
  18695. if (this.length > num.length) {
  18696. a = this;
  18697. b = num;
  18698. } else {
  18699. a = num;
  18700. b = this;
  18701. }
  18702. for (var i = 0; i < b.length; i++) {
  18703. this.words[i] = a.words[i] ^ b.words[i];
  18704. }
  18705. if (this !== a) {
  18706. for (; i < a.length; i++) {
  18707. this.words[i] = a.words[i];
  18708. }
  18709. }
  18710. this.length = a.length;
  18711. return this._strip();
  18712. };
  18713. BN.prototype.ixor = function ixor (num) {
  18714. assert((this.negative | num.negative) === 0);
  18715. return this.iuxor(num);
  18716. };
  18717. // Xor `num` with `this`
  18718. BN.prototype.xor = function xor (num) {
  18719. if (this.length > num.length) return this.clone().ixor(num);
  18720. return num.clone().ixor(this);
  18721. };
  18722. BN.prototype.uxor = function uxor (num) {
  18723. if (this.length > num.length) return this.clone().iuxor(num);
  18724. return num.clone().iuxor(this);
  18725. };
  18726. // Not ``this`` with ``width`` bitwidth
  18727. BN.prototype.inotn = function inotn (width) {
  18728. assert(typeof width === 'number' && width >= 0);
  18729. var bytesNeeded = Math.ceil(width / 26) | 0;
  18730. var bitsLeft = width % 26;
  18731. // Extend the buffer with leading zeroes
  18732. this._expand(bytesNeeded);
  18733. if (bitsLeft > 0) {
  18734. bytesNeeded--;
  18735. }
  18736. // Handle complete words
  18737. for (var i = 0; i < bytesNeeded; i++) {
  18738. this.words[i] = ~this.words[i] & 0x3ffffff;
  18739. }
  18740. // Handle the residue
  18741. if (bitsLeft > 0) {
  18742. this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
  18743. }
  18744. // And remove leading zeroes
  18745. return this._strip();
  18746. };
  18747. BN.prototype.notn = function notn (width) {
  18748. return this.clone().inotn(width);
  18749. };
  18750. // Set `bit` of `this`
  18751. BN.prototype.setn = function setn (bit, val) {
  18752. assert(typeof bit === 'number' && bit >= 0);
  18753. var off = (bit / 26) | 0;
  18754. var wbit = bit % 26;
  18755. this._expand(off + 1);
  18756. if (val) {
  18757. this.words[off] = this.words[off] | (1 << wbit);
  18758. } else {
  18759. this.words[off] = this.words[off] & ~(1 << wbit);
  18760. }
  18761. return this._strip();
  18762. };
  18763. // Add `num` to `this` in-place
  18764. BN.prototype.iadd = function iadd (num) {
  18765. var r;
  18766. // negative + positive
  18767. if (this.negative !== 0 && num.negative === 0) {
  18768. this.negative = 0;
  18769. r = this.isub(num);
  18770. this.negative ^= 1;
  18771. return this._normSign();
  18772. // positive + negative
  18773. } else if (this.negative === 0 && num.negative !== 0) {
  18774. num.negative = 0;
  18775. r = this.isub(num);
  18776. num.negative = 1;
  18777. return r._normSign();
  18778. }
  18779. // a.length > b.length
  18780. var a, b;
  18781. if (this.length > num.length) {
  18782. a = this;
  18783. b = num;
  18784. } else {
  18785. a = num;
  18786. b = this;
  18787. }
  18788. var carry = 0;
  18789. for (var i = 0; i < b.length; i++) {
  18790. r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
  18791. this.words[i] = r & 0x3ffffff;
  18792. carry = r >>> 26;
  18793. }
  18794. for (; carry !== 0 && i < a.length; i++) {
  18795. r = (a.words[i] | 0) + carry;
  18796. this.words[i] = r & 0x3ffffff;
  18797. carry = r >>> 26;
  18798. }
  18799. this.length = a.length;
  18800. if (carry !== 0) {
  18801. this.words[this.length] = carry;
  18802. this.length++;
  18803. // Copy the rest of the words
  18804. } else if (a !== this) {
  18805. for (; i < a.length; i++) {
  18806. this.words[i] = a.words[i];
  18807. }
  18808. }
  18809. return this;
  18810. };
  18811. // Add `num` to `this`
  18812. BN.prototype.add = function add (num) {
  18813. var res;
  18814. if (num.negative !== 0 && this.negative === 0) {
  18815. num.negative = 0;
  18816. res = this.sub(num);
  18817. num.negative ^= 1;
  18818. return res;
  18819. } else if (num.negative === 0 && this.negative !== 0) {
  18820. this.negative = 0;
  18821. res = num.sub(this);
  18822. this.negative = 1;
  18823. return res;
  18824. }
  18825. if (this.length > num.length) return this.clone().iadd(num);
  18826. return num.clone().iadd(this);
  18827. };
  18828. // Subtract `num` from `this` in-place
  18829. BN.prototype.isub = function isub (num) {
  18830. // this - (-num) = this + num
  18831. if (num.negative !== 0) {
  18832. num.negative = 0;
  18833. var r = this.iadd(num);
  18834. num.negative = 1;
  18835. return r._normSign();
  18836. // -this - num = -(this + num)
  18837. } else if (this.negative !== 0) {
  18838. this.negative = 0;
  18839. this.iadd(num);
  18840. this.negative = 1;
  18841. return this._normSign();
  18842. }
  18843. // At this point both numbers are positive
  18844. var cmp = this.cmp(num);
  18845. // Optimization - zeroify
  18846. if (cmp === 0) {
  18847. this.negative = 0;
  18848. this.length = 1;
  18849. this.words[0] = 0;
  18850. return this;
  18851. }
  18852. // a > b
  18853. var a, b;
  18854. if (cmp > 0) {
  18855. a = this;
  18856. b = num;
  18857. } else {
  18858. a = num;
  18859. b = this;
  18860. }
  18861. var carry = 0;
  18862. for (var i = 0; i < b.length; i++) {
  18863. r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
  18864. carry = r >> 26;
  18865. this.words[i] = r & 0x3ffffff;
  18866. }
  18867. for (; carry !== 0 && i < a.length; i++) {
  18868. r = (a.words[i] | 0) + carry;
  18869. carry = r >> 26;
  18870. this.words[i] = r & 0x3ffffff;
  18871. }
  18872. // Copy rest of the words
  18873. if (carry === 0 && i < a.length && a !== this) {
  18874. for (; i < a.length; i++) {
  18875. this.words[i] = a.words[i];
  18876. }
  18877. }
  18878. this.length = Math.max(this.length, i);
  18879. if (a !== this) {
  18880. this.negative = 1;
  18881. }
  18882. return this._strip();
  18883. };
  18884. // Subtract `num` from `this`
  18885. BN.prototype.sub = function sub (num) {
  18886. return this.clone().isub(num);
  18887. };
  18888. function smallMulTo (self, num, out) {
  18889. out.negative = num.negative ^ self.negative;
  18890. var len = (self.length + num.length) | 0;
  18891. out.length = len;
  18892. len = (len - 1) | 0;
  18893. // Peel one iteration (compiler can't do it, because of code complexity)
  18894. var a = self.words[0] | 0;
  18895. var b = num.words[0] | 0;
  18896. var r = a * b;
  18897. var lo = r & 0x3ffffff;
  18898. var carry = (r / 0x4000000) | 0;
  18899. out.words[0] = lo;
  18900. for (var k = 1; k < len; k++) {
  18901. // Sum all words with the same `i + j = k` and accumulate `ncarry`,
  18902. // note that ncarry could be >= 0x3ffffff
  18903. var ncarry = carry >>> 26;
  18904. var rword = carry & 0x3ffffff;
  18905. var maxJ = Math.min(k, num.length - 1);
  18906. for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
  18907. var i = (k - j) | 0;
  18908. a = self.words[i] | 0;
  18909. b = num.words[j] | 0;
  18910. r = a * b + rword;
  18911. ncarry += (r / 0x4000000) | 0;
  18912. rword = r & 0x3ffffff;
  18913. }
  18914. out.words[k] = rword | 0;
  18915. carry = ncarry | 0;
  18916. }
  18917. if (carry !== 0) {
  18918. out.words[k] = carry | 0;
  18919. } else {
  18920. out.length--;
  18921. }
  18922. return out._strip();
  18923. }
  18924. // TODO(indutny): it may be reasonable to omit it for users who don't need
  18925. // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
  18926. // multiplication (like elliptic secp256k1).
  18927. var comb10MulTo = function comb10MulTo (self, num, out) {
  18928. var a = self.words;
  18929. var b = num.words;
  18930. var o = out.words;
  18931. var c = 0;
  18932. var lo;
  18933. var mid;
  18934. var hi;
  18935. var a0 = a[0] | 0;
  18936. var al0 = a0 & 0x1fff;
  18937. var ah0 = a0 >>> 13;
  18938. var a1 = a[1] | 0;
  18939. var al1 = a1 & 0x1fff;
  18940. var ah1 = a1 >>> 13;
  18941. var a2 = a[2] | 0;
  18942. var al2 = a2 & 0x1fff;
  18943. var ah2 = a2 >>> 13;
  18944. var a3 = a[3] | 0;
  18945. var al3 = a3 & 0x1fff;
  18946. var ah3 = a3 >>> 13;
  18947. var a4 = a[4] | 0;
  18948. var al4 = a4 & 0x1fff;
  18949. var ah4 = a4 >>> 13;
  18950. var a5 = a[5] | 0;
  18951. var al5 = a5 & 0x1fff;
  18952. var ah5 = a5 >>> 13;
  18953. var a6 = a[6] | 0;
  18954. var al6 = a6 & 0x1fff;
  18955. var ah6 = a6 >>> 13;
  18956. var a7 = a[7] | 0;
  18957. var al7 = a7 & 0x1fff;
  18958. var ah7 = a7 >>> 13;
  18959. var a8 = a[8] | 0;
  18960. var al8 = a8 & 0x1fff;
  18961. var ah8 = a8 >>> 13;
  18962. var a9 = a[9] | 0;
  18963. var al9 = a9 & 0x1fff;
  18964. var ah9 = a9 >>> 13;
  18965. var b0 = b[0] | 0;
  18966. var bl0 = b0 & 0x1fff;
  18967. var bh0 = b0 >>> 13;
  18968. var b1 = b[1] | 0;
  18969. var bl1 = b1 & 0x1fff;
  18970. var bh1 = b1 >>> 13;
  18971. var b2 = b[2] | 0;
  18972. var bl2 = b2 & 0x1fff;
  18973. var bh2 = b2 >>> 13;
  18974. var b3 = b[3] | 0;
  18975. var bl3 = b3 & 0x1fff;
  18976. var bh3 = b3 >>> 13;
  18977. var b4 = b[4] | 0;
  18978. var bl4 = b4 & 0x1fff;
  18979. var bh4 = b4 >>> 13;
  18980. var b5 = b[5] | 0;
  18981. var bl5 = b5 & 0x1fff;
  18982. var bh5 = b5 >>> 13;
  18983. var b6 = b[6] | 0;
  18984. var bl6 = b6 & 0x1fff;
  18985. var bh6 = b6 >>> 13;
  18986. var b7 = b[7] | 0;
  18987. var bl7 = b7 & 0x1fff;
  18988. var bh7 = b7 >>> 13;
  18989. var b8 = b[8] | 0;
  18990. var bl8 = b8 & 0x1fff;
  18991. var bh8 = b8 >>> 13;
  18992. var b9 = b[9] | 0;
  18993. var bl9 = b9 & 0x1fff;
  18994. var bh9 = b9 >>> 13;
  18995. out.negative = self.negative ^ num.negative;
  18996. out.length = 19;
  18997. /* k = 0 */
  18998. lo = Math.imul(al0, bl0);
  18999. mid = Math.imul(al0, bh0);
  19000. mid = (mid + Math.imul(ah0, bl0)) | 0;
  19001. hi = Math.imul(ah0, bh0);
  19002. var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19003. c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;
  19004. w0 &= 0x3ffffff;
  19005. /* k = 1 */
  19006. lo = Math.imul(al1, bl0);
  19007. mid = Math.imul(al1, bh0);
  19008. mid = (mid + Math.imul(ah1, bl0)) | 0;
  19009. hi = Math.imul(ah1, bh0);
  19010. lo = (lo + Math.imul(al0, bl1)) | 0;
  19011. mid = (mid + Math.imul(al0, bh1)) | 0;
  19012. mid = (mid + Math.imul(ah0, bl1)) | 0;
  19013. hi = (hi + Math.imul(ah0, bh1)) | 0;
  19014. var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19015. c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;
  19016. w1 &= 0x3ffffff;
  19017. /* k = 2 */
  19018. lo = Math.imul(al2, bl0);
  19019. mid = Math.imul(al2, bh0);
  19020. mid = (mid + Math.imul(ah2, bl0)) | 0;
  19021. hi = Math.imul(ah2, bh0);
  19022. lo = (lo + Math.imul(al1, bl1)) | 0;
  19023. mid = (mid + Math.imul(al1, bh1)) | 0;
  19024. mid = (mid + Math.imul(ah1, bl1)) | 0;
  19025. hi = (hi + Math.imul(ah1, bh1)) | 0;
  19026. lo = (lo + Math.imul(al0, bl2)) | 0;
  19027. mid = (mid + Math.imul(al0, bh2)) | 0;
  19028. mid = (mid + Math.imul(ah0, bl2)) | 0;
  19029. hi = (hi + Math.imul(ah0, bh2)) | 0;
  19030. var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19031. c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;
  19032. w2 &= 0x3ffffff;
  19033. /* k = 3 */
  19034. lo = Math.imul(al3, bl0);
  19035. mid = Math.imul(al3, bh0);
  19036. mid = (mid + Math.imul(ah3, bl0)) | 0;
  19037. hi = Math.imul(ah3, bh0);
  19038. lo = (lo + Math.imul(al2, bl1)) | 0;
  19039. mid = (mid + Math.imul(al2, bh1)) | 0;
  19040. mid = (mid + Math.imul(ah2, bl1)) | 0;
  19041. hi = (hi + Math.imul(ah2, bh1)) | 0;
  19042. lo = (lo + Math.imul(al1, bl2)) | 0;
  19043. mid = (mid + Math.imul(al1, bh2)) | 0;
  19044. mid = (mid + Math.imul(ah1, bl2)) | 0;
  19045. hi = (hi + Math.imul(ah1, bh2)) | 0;
  19046. lo = (lo + Math.imul(al0, bl3)) | 0;
  19047. mid = (mid + Math.imul(al0, bh3)) | 0;
  19048. mid = (mid + Math.imul(ah0, bl3)) | 0;
  19049. hi = (hi + Math.imul(ah0, bh3)) | 0;
  19050. var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19051. c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;
  19052. w3 &= 0x3ffffff;
  19053. /* k = 4 */
  19054. lo = Math.imul(al4, bl0);
  19055. mid = Math.imul(al4, bh0);
  19056. mid = (mid + Math.imul(ah4, bl0)) | 0;
  19057. hi = Math.imul(ah4, bh0);
  19058. lo = (lo + Math.imul(al3, bl1)) | 0;
  19059. mid = (mid + Math.imul(al3, bh1)) | 0;
  19060. mid = (mid + Math.imul(ah3, bl1)) | 0;
  19061. hi = (hi + Math.imul(ah3, bh1)) | 0;
  19062. lo = (lo + Math.imul(al2, bl2)) | 0;
  19063. mid = (mid + Math.imul(al2, bh2)) | 0;
  19064. mid = (mid + Math.imul(ah2, bl2)) | 0;
  19065. hi = (hi + Math.imul(ah2, bh2)) | 0;
  19066. lo = (lo + Math.imul(al1, bl3)) | 0;
  19067. mid = (mid + Math.imul(al1, bh3)) | 0;
  19068. mid = (mid + Math.imul(ah1, bl3)) | 0;
  19069. hi = (hi + Math.imul(ah1, bh3)) | 0;
  19070. lo = (lo + Math.imul(al0, bl4)) | 0;
  19071. mid = (mid + Math.imul(al0, bh4)) | 0;
  19072. mid = (mid + Math.imul(ah0, bl4)) | 0;
  19073. hi = (hi + Math.imul(ah0, bh4)) | 0;
  19074. var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19075. c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;
  19076. w4 &= 0x3ffffff;
  19077. /* k = 5 */
  19078. lo = Math.imul(al5, bl0);
  19079. mid = Math.imul(al5, bh0);
  19080. mid = (mid + Math.imul(ah5, bl0)) | 0;
  19081. hi = Math.imul(ah5, bh0);
  19082. lo = (lo + Math.imul(al4, bl1)) | 0;
  19083. mid = (mid + Math.imul(al4, bh1)) | 0;
  19084. mid = (mid + Math.imul(ah4, bl1)) | 0;
  19085. hi = (hi + Math.imul(ah4, bh1)) | 0;
  19086. lo = (lo + Math.imul(al3, bl2)) | 0;
  19087. mid = (mid + Math.imul(al3, bh2)) | 0;
  19088. mid = (mid + Math.imul(ah3, bl2)) | 0;
  19089. hi = (hi + Math.imul(ah3, bh2)) | 0;
  19090. lo = (lo + Math.imul(al2, bl3)) | 0;
  19091. mid = (mid + Math.imul(al2, bh3)) | 0;
  19092. mid = (mid + Math.imul(ah2, bl3)) | 0;
  19093. hi = (hi + Math.imul(ah2, bh3)) | 0;
  19094. lo = (lo + Math.imul(al1, bl4)) | 0;
  19095. mid = (mid + Math.imul(al1, bh4)) | 0;
  19096. mid = (mid + Math.imul(ah1, bl4)) | 0;
  19097. hi = (hi + Math.imul(ah1, bh4)) | 0;
  19098. lo = (lo + Math.imul(al0, bl5)) | 0;
  19099. mid = (mid + Math.imul(al0, bh5)) | 0;
  19100. mid = (mid + Math.imul(ah0, bl5)) | 0;
  19101. hi = (hi + Math.imul(ah0, bh5)) | 0;
  19102. var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19103. c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;
  19104. w5 &= 0x3ffffff;
  19105. /* k = 6 */
  19106. lo = Math.imul(al6, bl0);
  19107. mid = Math.imul(al6, bh0);
  19108. mid = (mid + Math.imul(ah6, bl0)) | 0;
  19109. hi = Math.imul(ah6, bh0);
  19110. lo = (lo + Math.imul(al5, bl1)) | 0;
  19111. mid = (mid + Math.imul(al5, bh1)) | 0;
  19112. mid = (mid + Math.imul(ah5, bl1)) | 0;
  19113. hi = (hi + Math.imul(ah5, bh1)) | 0;
  19114. lo = (lo + Math.imul(al4, bl2)) | 0;
  19115. mid = (mid + Math.imul(al4, bh2)) | 0;
  19116. mid = (mid + Math.imul(ah4, bl2)) | 0;
  19117. hi = (hi + Math.imul(ah4, bh2)) | 0;
  19118. lo = (lo + Math.imul(al3, bl3)) | 0;
  19119. mid = (mid + Math.imul(al3, bh3)) | 0;
  19120. mid = (mid + Math.imul(ah3, bl3)) | 0;
  19121. hi = (hi + Math.imul(ah3, bh3)) | 0;
  19122. lo = (lo + Math.imul(al2, bl4)) | 0;
  19123. mid = (mid + Math.imul(al2, bh4)) | 0;
  19124. mid = (mid + Math.imul(ah2, bl4)) | 0;
  19125. hi = (hi + Math.imul(ah2, bh4)) | 0;
  19126. lo = (lo + Math.imul(al1, bl5)) | 0;
  19127. mid = (mid + Math.imul(al1, bh5)) | 0;
  19128. mid = (mid + Math.imul(ah1, bl5)) | 0;
  19129. hi = (hi + Math.imul(ah1, bh5)) | 0;
  19130. lo = (lo + Math.imul(al0, bl6)) | 0;
  19131. mid = (mid + Math.imul(al0, bh6)) | 0;
  19132. mid = (mid + Math.imul(ah0, bl6)) | 0;
  19133. hi = (hi + Math.imul(ah0, bh6)) | 0;
  19134. var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19135. c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;
  19136. w6 &= 0x3ffffff;
  19137. /* k = 7 */
  19138. lo = Math.imul(al7, bl0);
  19139. mid = Math.imul(al7, bh0);
  19140. mid = (mid + Math.imul(ah7, bl0)) | 0;
  19141. hi = Math.imul(ah7, bh0);
  19142. lo = (lo + Math.imul(al6, bl1)) | 0;
  19143. mid = (mid + Math.imul(al6, bh1)) | 0;
  19144. mid = (mid + Math.imul(ah6, bl1)) | 0;
  19145. hi = (hi + Math.imul(ah6, bh1)) | 0;
  19146. lo = (lo + Math.imul(al5, bl2)) | 0;
  19147. mid = (mid + Math.imul(al5, bh2)) | 0;
  19148. mid = (mid + Math.imul(ah5, bl2)) | 0;
  19149. hi = (hi + Math.imul(ah5, bh2)) | 0;
  19150. lo = (lo + Math.imul(al4, bl3)) | 0;
  19151. mid = (mid + Math.imul(al4, bh3)) | 0;
  19152. mid = (mid + Math.imul(ah4, bl3)) | 0;
  19153. hi = (hi + Math.imul(ah4, bh3)) | 0;
  19154. lo = (lo + Math.imul(al3, bl4)) | 0;
  19155. mid = (mid + Math.imul(al3, bh4)) | 0;
  19156. mid = (mid + Math.imul(ah3, bl4)) | 0;
  19157. hi = (hi + Math.imul(ah3, bh4)) | 0;
  19158. lo = (lo + Math.imul(al2, bl5)) | 0;
  19159. mid = (mid + Math.imul(al2, bh5)) | 0;
  19160. mid = (mid + Math.imul(ah2, bl5)) | 0;
  19161. hi = (hi + Math.imul(ah2, bh5)) | 0;
  19162. lo = (lo + Math.imul(al1, bl6)) | 0;
  19163. mid = (mid + Math.imul(al1, bh6)) | 0;
  19164. mid = (mid + Math.imul(ah1, bl6)) | 0;
  19165. hi = (hi + Math.imul(ah1, bh6)) | 0;
  19166. lo = (lo + Math.imul(al0, bl7)) | 0;
  19167. mid = (mid + Math.imul(al0, bh7)) | 0;
  19168. mid = (mid + Math.imul(ah0, bl7)) | 0;
  19169. hi = (hi + Math.imul(ah0, bh7)) | 0;
  19170. var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19171. c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;
  19172. w7 &= 0x3ffffff;
  19173. /* k = 8 */
  19174. lo = Math.imul(al8, bl0);
  19175. mid = Math.imul(al8, bh0);
  19176. mid = (mid + Math.imul(ah8, bl0)) | 0;
  19177. hi = Math.imul(ah8, bh0);
  19178. lo = (lo + Math.imul(al7, bl1)) | 0;
  19179. mid = (mid + Math.imul(al7, bh1)) | 0;
  19180. mid = (mid + Math.imul(ah7, bl1)) | 0;
  19181. hi = (hi + Math.imul(ah7, bh1)) | 0;
  19182. lo = (lo + Math.imul(al6, bl2)) | 0;
  19183. mid = (mid + Math.imul(al6, bh2)) | 0;
  19184. mid = (mid + Math.imul(ah6, bl2)) | 0;
  19185. hi = (hi + Math.imul(ah6, bh2)) | 0;
  19186. lo = (lo + Math.imul(al5, bl3)) | 0;
  19187. mid = (mid + Math.imul(al5, bh3)) | 0;
  19188. mid = (mid + Math.imul(ah5, bl3)) | 0;
  19189. hi = (hi + Math.imul(ah5, bh3)) | 0;
  19190. lo = (lo + Math.imul(al4, bl4)) | 0;
  19191. mid = (mid + Math.imul(al4, bh4)) | 0;
  19192. mid = (mid + Math.imul(ah4, bl4)) | 0;
  19193. hi = (hi + Math.imul(ah4, bh4)) | 0;
  19194. lo = (lo + Math.imul(al3, bl5)) | 0;
  19195. mid = (mid + Math.imul(al3, bh5)) | 0;
  19196. mid = (mid + Math.imul(ah3, bl5)) | 0;
  19197. hi = (hi + Math.imul(ah3, bh5)) | 0;
  19198. lo = (lo + Math.imul(al2, bl6)) | 0;
  19199. mid = (mid + Math.imul(al2, bh6)) | 0;
  19200. mid = (mid + Math.imul(ah2, bl6)) | 0;
  19201. hi = (hi + Math.imul(ah2, bh6)) | 0;
  19202. lo = (lo + Math.imul(al1, bl7)) | 0;
  19203. mid = (mid + Math.imul(al1, bh7)) | 0;
  19204. mid = (mid + Math.imul(ah1, bl7)) | 0;
  19205. hi = (hi + Math.imul(ah1, bh7)) | 0;
  19206. lo = (lo + Math.imul(al0, bl8)) | 0;
  19207. mid = (mid + Math.imul(al0, bh8)) | 0;
  19208. mid = (mid + Math.imul(ah0, bl8)) | 0;
  19209. hi = (hi + Math.imul(ah0, bh8)) | 0;
  19210. var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19211. c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;
  19212. w8 &= 0x3ffffff;
  19213. /* k = 9 */
  19214. lo = Math.imul(al9, bl0);
  19215. mid = Math.imul(al9, bh0);
  19216. mid = (mid + Math.imul(ah9, bl0)) | 0;
  19217. hi = Math.imul(ah9, bh0);
  19218. lo = (lo + Math.imul(al8, bl1)) | 0;
  19219. mid = (mid + Math.imul(al8, bh1)) | 0;
  19220. mid = (mid + Math.imul(ah8, bl1)) | 0;
  19221. hi = (hi + Math.imul(ah8, bh1)) | 0;
  19222. lo = (lo + Math.imul(al7, bl2)) | 0;
  19223. mid = (mid + Math.imul(al7, bh2)) | 0;
  19224. mid = (mid + Math.imul(ah7, bl2)) | 0;
  19225. hi = (hi + Math.imul(ah7, bh2)) | 0;
  19226. lo = (lo + Math.imul(al6, bl3)) | 0;
  19227. mid = (mid + Math.imul(al6, bh3)) | 0;
  19228. mid = (mid + Math.imul(ah6, bl3)) | 0;
  19229. hi = (hi + Math.imul(ah6, bh3)) | 0;
  19230. lo = (lo + Math.imul(al5, bl4)) | 0;
  19231. mid = (mid + Math.imul(al5, bh4)) | 0;
  19232. mid = (mid + Math.imul(ah5, bl4)) | 0;
  19233. hi = (hi + Math.imul(ah5, bh4)) | 0;
  19234. lo = (lo + Math.imul(al4, bl5)) | 0;
  19235. mid = (mid + Math.imul(al4, bh5)) | 0;
  19236. mid = (mid + Math.imul(ah4, bl5)) | 0;
  19237. hi = (hi + Math.imul(ah4, bh5)) | 0;
  19238. lo = (lo + Math.imul(al3, bl6)) | 0;
  19239. mid = (mid + Math.imul(al3, bh6)) | 0;
  19240. mid = (mid + Math.imul(ah3, bl6)) | 0;
  19241. hi = (hi + Math.imul(ah3, bh6)) | 0;
  19242. lo = (lo + Math.imul(al2, bl7)) | 0;
  19243. mid = (mid + Math.imul(al2, bh7)) | 0;
  19244. mid = (mid + Math.imul(ah2, bl7)) | 0;
  19245. hi = (hi + Math.imul(ah2, bh7)) | 0;
  19246. lo = (lo + Math.imul(al1, bl8)) | 0;
  19247. mid = (mid + Math.imul(al1, bh8)) | 0;
  19248. mid = (mid + Math.imul(ah1, bl8)) | 0;
  19249. hi = (hi + Math.imul(ah1, bh8)) | 0;
  19250. lo = (lo + Math.imul(al0, bl9)) | 0;
  19251. mid = (mid + Math.imul(al0, bh9)) | 0;
  19252. mid = (mid + Math.imul(ah0, bl9)) | 0;
  19253. hi = (hi + Math.imul(ah0, bh9)) | 0;
  19254. var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19255. c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;
  19256. w9 &= 0x3ffffff;
  19257. /* k = 10 */
  19258. lo = Math.imul(al9, bl1);
  19259. mid = Math.imul(al9, bh1);
  19260. mid = (mid + Math.imul(ah9, bl1)) | 0;
  19261. hi = Math.imul(ah9, bh1);
  19262. lo = (lo + Math.imul(al8, bl2)) | 0;
  19263. mid = (mid + Math.imul(al8, bh2)) | 0;
  19264. mid = (mid + Math.imul(ah8, bl2)) | 0;
  19265. hi = (hi + Math.imul(ah8, bh2)) | 0;
  19266. lo = (lo + Math.imul(al7, bl3)) | 0;
  19267. mid = (mid + Math.imul(al7, bh3)) | 0;
  19268. mid = (mid + Math.imul(ah7, bl3)) | 0;
  19269. hi = (hi + Math.imul(ah7, bh3)) | 0;
  19270. lo = (lo + Math.imul(al6, bl4)) | 0;
  19271. mid = (mid + Math.imul(al6, bh4)) | 0;
  19272. mid = (mid + Math.imul(ah6, bl4)) | 0;
  19273. hi = (hi + Math.imul(ah6, bh4)) | 0;
  19274. lo = (lo + Math.imul(al5, bl5)) | 0;
  19275. mid = (mid + Math.imul(al5, bh5)) | 0;
  19276. mid = (mid + Math.imul(ah5, bl5)) | 0;
  19277. hi = (hi + Math.imul(ah5, bh5)) | 0;
  19278. lo = (lo + Math.imul(al4, bl6)) | 0;
  19279. mid = (mid + Math.imul(al4, bh6)) | 0;
  19280. mid = (mid + Math.imul(ah4, bl6)) | 0;
  19281. hi = (hi + Math.imul(ah4, bh6)) | 0;
  19282. lo = (lo + Math.imul(al3, bl7)) | 0;
  19283. mid = (mid + Math.imul(al3, bh7)) | 0;
  19284. mid = (mid + Math.imul(ah3, bl7)) | 0;
  19285. hi = (hi + Math.imul(ah3, bh7)) | 0;
  19286. lo = (lo + Math.imul(al2, bl8)) | 0;
  19287. mid = (mid + Math.imul(al2, bh8)) | 0;
  19288. mid = (mid + Math.imul(ah2, bl8)) | 0;
  19289. hi = (hi + Math.imul(ah2, bh8)) | 0;
  19290. lo = (lo + Math.imul(al1, bl9)) | 0;
  19291. mid = (mid + Math.imul(al1, bh9)) | 0;
  19292. mid = (mid + Math.imul(ah1, bl9)) | 0;
  19293. hi = (hi + Math.imul(ah1, bh9)) | 0;
  19294. var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19295. c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;
  19296. w10 &= 0x3ffffff;
  19297. /* k = 11 */
  19298. lo = Math.imul(al9, bl2);
  19299. mid = Math.imul(al9, bh2);
  19300. mid = (mid + Math.imul(ah9, bl2)) | 0;
  19301. hi = Math.imul(ah9, bh2);
  19302. lo = (lo + Math.imul(al8, bl3)) | 0;
  19303. mid = (mid + Math.imul(al8, bh3)) | 0;
  19304. mid = (mid + Math.imul(ah8, bl3)) | 0;
  19305. hi = (hi + Math.imul(ah8, bh3)) | 0;
  19306. lo = (lo + Math.imul(al7, bl4)) | 0;
  19307. mid = (mid + Math.imul(al7, bh4)) | 0;
  19308. mid = (mid + Math.imul(ah7, bl4)) | 0;
  19309. hi = (hi + Math.imul(ah7, bh4)) | 0;
  19310. lo = (lo + Math.imul(al6, bl5)) | 0;
  19311. mid = (mid + Math.imul(al6, bh5)) | 0;
  19312. mid = (mid + Math.imul(ah6, bl5)) | 0;
  19313. hi = (hi + Math.imul(ah6, bh5)) | 0;
  19314. lo = (lo + Math.imul(al5, bl6)) | 0;
  19315. mid = (mid + Math.imul(al5, bh6)) | 0;
  19316. mid = (mid + Math.imul(ah5, bl6)) | 0;
  19317. hi = (hi + Math.imul(ah5, bh6)) | 0;
  19318. lo = (lo + Math.imul(al4, bl7)) | 0;
  19319. mid = (mid + Math.imul(al4, bh7)) | 0;
  19320. mid = (mid + Math.imul(ah4, bl7)) | 0;
  19321. hi = (hi + Math.imul(ah4, bh7)) | 0;
  19322. lo = (lo + Math.imul(al3, bl8)) | 0;
  19323. mid = (mid + Math.imul(al3, bh8)) | 0;
  19324. mid = (mid + Math.imul(ah3, bl8)) | 0;
  19325. hi = (hi + Math.imul(ah3, bh8)) | 0;
  19326. lo = (lo + Math.imul(al2, bl9)) | 0;
  19327. mid = (mid + Math.imul(al2, bh9)) | 0;
  19328. mid = (mid + Math.imul(ah2, bl9)) | 0;
  19329. hi = (hi + Math.imul(ah2, bh9)) | 0;
  19330. var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19331. c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;
  19332. w11 &= 0x3ffffff;
  19333. /* k = 12 */
  19334. lo = Math.imul(al9, bl3);
  19335. mid = Math.imul(al9, bh3);
  19336. mid = (mid + Math.imul(ah9, bl3)) | 0;
  19337. hi = Math.imul(ah9, bh3);
  19338. lo = (lo + Math.imul(al8, bl4)) | 0;
  19339. mid = (mid + Math.imul(al8, bh4)) | 0;
  19340. mid = (mid + Math.imul(ah8, bl4)) | 0;
  19341. hi = (hi + Math.imul(ah8, bh4)) | 0;
  19342. lo = (lo + Math.imul(al7, bl5)) | 0;
  19343. mid = (mid + Math.imul(al7, bh5)) | 0;
  19344. mid = (mid + Math.imul(ah7, bl5)) | 0;
  19345. hi = (hi + Math.imul(ah7, bh5)) | 0;
  19346. lo = (lo + Math.imul(al6, bl6)) | 0;
  19347. mid = (mid + Math.imul(al6, bh6)) | 0;
  19348. mid = (mid + Math.imul(ah6, bl6)) | 0;
  19349. hi = (hi + Math.imul(ah6, bh6)) | 0;
  19350. lo = (lo + Math.imul(al5, bl7)) | 0;
  19351. mid = (mid + Math.imul(al5, bh7)) | 0;
  19352. mid = (mid + Math.imul(ah5, bl7)) | 0;
  19353. hi = (hi + Math.imul(ah5, bh7)) | 0;
  19354. lo = (lo + Math.imul(al4, bl8)) | 0;
  19355. mid = (mid + Math.imul(al4, bh8)) | 0;
  19356. mid = (mid + Math.imul(ah4, bl8)) | 0;
  19357. hi = (hi + Math.imul(ah4, bh8)) | 0;
  19358. lo = (lo + Math.imul(al3, bl9)) | 0;
  19359. mid = (mid + Math.imul(al3, bh9)) | 0;
  19360. mid = (mid + Math.imul(ah3, bl9)) | 0;
  19361. hi = (hi + Math.imul(ah3, bh9)) | 0;
  19362. var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19363. c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;
  19364. w12 &= 0x3ffffff;
  19365. /* k = 13 */
  19366. lo = Math.imul(al9, bl4);
  19367. mid = Math.imul(al9, bh4);
  19368. mid = (mid + Math.imul(ah9, bl4)) | 0;
  19369. hi = Math.imul(ah9, bh4);
  19370. lo = (lo + Math.imul(al8, bl5)) | 0;
  19371. mid = (mid + Math.imul(al8, bh5)) | 0;
  19372. mid = (mid + Math.imul(ah8, bl5)) | 0;
  19373. hi = (hi + Math.imul(ah8, bh5)) | 0;
  19374. lo = (lo + Math.imul(al7, bl6)) | 0;
  19375. mid = (mid + Math.imul(al7, bh6)) | 0;
  19376. mid = (mid + Math.imul(ah7, bl6)) | 0;
  19377. hi = (hi + Math.imul(ah7, bh6)) | 0;
  19378. lo = (lo + Math.imul(al6, bl7)) | 0;
  19379. mid = (mid + Math.imul(al6, bh7)) | 0;
  19380. mid = (mid + Math.imul(ah6, bl7)) | 0;
  19381. hi = (hi + Math.imul(ah6, bh7)) | 0;
  19382. lo = (lo + Math.imul(al5, bl8)) | 0;
  19383. mid = (mid + Math.imul(al5, bh8)) | 0;
  19384. mid = (mid + Math.imul(ah5, bl8)) | 0;
  19385. hi = (hi + Math.imul(ah5, bh8)) | 0;
  19386. lo = (lo + Math.imul(al4, bl9)) | 0;
  19387. mid = (mid + Math.imul(al4, bh9)) | 0;
  19388. mid = (mid + Math.imul(ah4, bl9)) | 0;
  19389. hi = (hi + Math.imul(ah4, bh9)) | 0;
  19390. var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19391. c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;
  19392. w13 &= 0x3ffffff;
  19393. /* k = 14 */
  19394. lo = Math.imul(al9, bl5);
  19395. mid = Math.imul(al9, bh5);
  19396. mid = (mid + Math.imul(ah9, bl5)) | 0;
  19397. hi = Math.imul(ah9, bh5);
  19398. lo = (lo + Math.imul(al8, bl6)) | 0;
  19399. mid = (mid + Math.imul(al8, bh6)) | 0;
  19400. mid = (mid + Math.imul(ah8, bl6)) | 0;
  19401. hi = (hi + Math.imul(ah8, bh6)) | 0;
  19402. lo = (lo + Math.imul(al7, bl7)) | 0;
  19403. mid = (mid + Math.imul(al7, bh7)) | 0;
  19404. mid = (mid + Math.imul(ah7, bl7)) | 0;
  19405. hi = (hi + Math.imul(ah7, bh7)) | 0;
  19406. lo = (lo + Math.imul(al6, bl8)) | 0;
  19407. mid = (mid + Math.imul(al6, bh8)) | 0;
  19408. mid = (mid + Math.imul(ah6, bl8)) | 0;
  19409. hi = (hi + Math.imul(ah6, bh8)) | 0;
  19410. lo = (lo + Math.imul(al5, bl9)) | 0;
  19411. mid = (mid + Math.imul(al5, bh9)) | 0;
  19412. mid = (mid + Math.imul(ah5, bl9)) | 0;
  19413. hi = (hi + Math.imul(ah5, bh9)) | 0;
  19414. var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19415. c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;
  19416. w14 &= 0x3ffffff;
  19417. /* k = 15 */
  19418. lo = Math.imul(al9, bl6);
  19419. mid = Math.imul(al9, bh6);
  19420. mid = (mid + Math.imul(ah9, bl6)) | 0;
  19421. hi = Math.imul(ah9, bh6);
  19422. lo = (lo + Math.imul(al8, bl7)) | 0;
  19423. mid = (mid + Math.imul(al8, bh7)) | 0;
  19424. mid = (mid + Math.imul(ah8, bl7)) | 0;
  19425. hi = (hi + Math.imul(ah8, bh7)) | 0;
  19426. lo = (lo + Math.imul(al7, bl8)) | 0;
  19427. mid = (mid + Math.imul(al7, bh8)) | 0;
  19428. mid = (mid + Math.imul(ah7, bl8)) | 0;
  19429. hi = (hi + Math.imul(ah7, bh8)) | 0;
  19430. lo = (lo + Math.imul(al6, bl9)) | 0;
  19431. mid = (mid + Math.imul(al6, bh9)) | 0;
  19432. mid = (mid + Math.imul(ah6, bl9)) | 0;
  19433. hi = (hi + Math.imul(ah6, bh9)) | 0;
  19434. var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19435. c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;
  19436. w15 &= 0x3ffffff;
  19437. /* k = 16 */
  19438. lo = Math.imul(al9, bl7);
  19439. mid = Math.imul(al9, bh7);
  19440. mid = (mid + Math.imul(ah9, bl7)) | 0;
  19441. hi = Math.imul(ah9, bh7);
  19442. lo = (lo + Math.imul(al8, bl8)) | 0;
  19443. mid = (mid + Math.imul(al8, bh8)) | 0;
  19444. mid = (mid + Math.imul(ah8, bl8)) | 0;
  19445. hi = (hi + Math.imul(ah8, bh8)) | 0;
  19446. lo = (lo + Math.imul(al7, bl9)) | 0;
  19447. mid = (mid + Math.imul(al7, bh9)) | 0;
  19448. mid = (mid + Math.imul(ah7, bl9)) | 0;
  19449. hi = (hi + Math.imul(ah7, bh9)) | 0;
  19450. var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19451. c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;
  19452. w16 &= 0x3ffffff;
  19453. /* k = 17 */
  19454. lo = Math.imul(al9, bl8);
  19455. mid = Math.imul(al9, bh8);
  19456. mid = (mid + Math.imul(ah9, bl8)) | 0;
  19457. hi = Math.imul(ah9, bh8);
  19458. lo = (lo + Math.imul(al8, bl9)) | 0;
  19459. mid = (mid + Math.imul(al8, bh9)) | 0;
  19460. mid = (mid + Math.imul(ah8, bl9)) | 0;
  19461. hi = (hi + Math.imul(ah8, bh9)) | 0;
  19462. var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19463. c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;
  19464. w17 &= 0x3ffffff;
  19465. /* k = 18 */
  19466. lo = Math.imul(al9, bl9);
  19467. mid = Math.imul(al9, bh9);
  19468. mid = (mid + Math.imul(ah9, bl9)) | 0;
  19469. hi = Math.imul(ah9, bh9);
  19470. var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19471. c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;
  19472. w18 &= 0x3ffffff;
  19473. o[0] = w0;
  19474. o[1] = w1;
  19475. o[2] = w2;
  19476. o[3] = w3;
  19477. o[4] = w4;
  19478. o[5] = w5;
  19479. o[6] = w6;
  19480. o[7] = w7;
  19481. o[8] = w8;
  19482. o[9] = w9;
  19483. o[10] = w10;
  19484. o[11] = w11;
  19485. o[12] = w12;
  19486. o[13] = w13;
  19487. o[14] = w14;
  19488. o[15] = w15;
  19489. o[16] = w16;
  19490. o[17] = w17;
  19491. o[18] = w18;
  19492. if (c !== 0) {
  19493. o[19] = c;
  19494. out.length++;
  19495. }
  19496. return out;
  19497. };
  19498. // Polyfill comb
  19499. if (!Math.imul) {
  19500. comb10MulTo = smallMulTo;
  19501. }
  19502. function bigMulTo (self, num, out) {
  19503. out.negative = num.negative ^ self.negative;
  19504. out.length = self.length + num.length;
  19505. var carry = 0;
  19506. var hncarry = 0;
  19507. for (var k = 0; k < out.length - 1; k++) {
  19508. // Sum all words with the same `i + j = k` and accumulate `ncarry`,
  19509. // note that ncarry could be >= 0x3ffffff
  19510. var ncarry = hncarry;
  19511. hncarry = 0;
  19512. var rword = carry & 0x3ffffff;
  19513. var maxJ = Math.min(k, num.length - 1);
  19514. for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
  19515. var i = k - j;
  19516. var a = self.words[i] | 0;
  19517. var b = num.words[j] | 0;
  19518. var r = a * b;
  19519. var lo = r & 0x3ffffff;
  19520. ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;
  19521. lo = (lo + rword) | 0;
  19522. rword = lo & 0x3ffffff;
  19523. ncarry = (ncarry + (lo >>> 26)) | 0;
  19524. hncarry += ncarry >>> 26;
  19525. ncarry &= 0x3ffffff;
  19526. }
  19527. out.words[k] = rword;
  19528. carry = ncarry;
  19529. ncarry = hncarry;
  19530. }
  19531. if (carry !== 0) {
  19532. out.words[k] = carry;
  19533. } else {
  19534. out.length--;
  19535. }
  19536. return out._strip();
  19537. }
  19538. function jumboMulTo (self, num, out) {
  19539. // Temporary disable, see https://github.com/indutny/bn.js/issues/211
  19540. // var fftm = new FFTM();
  19541. // return fftm.mulp(self, num, out);
  19542. return bigMulTo(self, num, out);
  19543. }
  19544. BN.prototype.mulTo = function mulTo (num, out) {
  19545. var res;
  19546. var len = this.length + num.length;
  19547. if (this.length === 10 && num.length === 10) {
  19548. res = comb10MulTo(this, num, out);
  19549. } else if (len < 63) {
  19550. res = smallMulTo(this, num, out);
  19551. } else if (len < 1024) {
  19552. res = bigMulTo(this, num, out);
  19553. } else {
  19554. res = jumboMulTo(this, num, out);
  19555. }
  19556. return res;
  19557. };
  19558. // Cooley-Tukey algorithm for FFT
  19559. // slightly revisited to rely on looping instead of recursion
  19560. function FFTM (x, y) {
  19561. this.x = x;
  19562. this.y = y;
  19563. }
  19564. FFTM.prototype.makeRBT = function makeRBT (N) {
  19565. var t = new Array(N);
  19566. var l = BN.prototype._countBits(N) - 1;
  19567. for (var i = 0; i < N; i++) {
  19568. t[i] = this.revBin(i, l, N);
  19569. }
  19570. return t;
  19571. };
  19572. // Returns binary-reversed representation of `x`
  19573. FFTM.prototype.revBin = function revBin (x, l, N) {
  19574. if (x === 0 || x === N - 1) return x;
  19575. var rb = 0;
  19576. for (var i = 0; i < l; i++) {
  19577. rb |= (x & 1) << (l - i - 1);
  19578. x >>= 1;
  19579. }
  19580. return rb;
  19581. };
  19582. // Performs "tweedling" phase, therefore 'emulating'
  19583. // behaviour of the recursive algorithm
  19584. FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {
  19585. for (var i = 0; i < N; i++) {
  19586. rtws[i] = rws[rbt[i]];
  19587. itws[i] = iws[rbt[i]];
  19588. }
  19589. };
  19590. FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {
  19591. this.permute(rbt, rws, iws, rtws, itws, N);
  19592. for (var s = 1; s < N; s <<= 1) {
  19593. var l = s << 1;
  19594. var rtwdf = Math.cos(2 * Math.PI / l);
  19595. var itwdf = Math.sin(2 * Math.PI / l);
  19596. for (var p = 0; p < N; p += l) {
  19597. var rtwdf_ = rtwdf;
  19598. var itwdf_ = itwdf;
  19599. for (var j = 0; j < s; j++) {
  19600. var re = rtws[p + j];
  19601. var ie = itws[p + j];
  19602. var ro = rtws[p + j + s];
  19603. var io = itws[p + j + s];
  19604. var rx = rtwdf_ * ro - itwdf_ * io;
  19605. io = rtwdf_ * io + itwdf_ * ro;
  19606. ro = rx;
  19607. rtws[p + j] = re + ro;
  19608. itws[p + j] = ie + io;
  19609. rtws[p + j + s] = re - ro;
  19610. itws[p + j + s] = ie - io;
  19611. /* jshint maxdepth : false */
  19612. if (j !== l) {
  19613. rx = rtwdf * rtwdf_ - itwdf * itwdf_;
  19614. itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
  19615. rtwdf_ = rx;
  19616. }
  19617. }
  19618. }
  19619. }
  19620. };
  19621. FFTM.prototype.guessLen13b = function guessLen13b (n, m) {
  19622. var N = Math.max(m, n) | 1;
  19623. var odd = N & 1;
  19624. var i = 0;
  19625. for (N = N / 2 | 0; N; N = N >>> 1) {
  19626. i++;
  19627. }
  19628. return 1 << i + 1 + odd;
  19629. };
  19630. FFTM.prototype.conjugate = function conjugate (rws, iws, N) {
  19631. if (N <= 1) return;
  19632. for (var i = 0; i < N / 2; i++) {
  19633. var t = rws[i];
  19634. rws[i] = rws[N - i - 1];
  19635. rws[N - i - 1] = t;
  19636. t = iws[i];
  19637. iws[i] = -iws[N - i - 1];
  19638. iws[N - i - 1] = -t;
  19639. }
  19640. };
  19641. FFTM.prototype.normalize13b = function normalize13b (ws, N) {
  19642. var carry = 0;
  19643. for (var i = 0; i < N / 2; i++) {
  19644. var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +
  19645. Math.round(ws[2 * i] / N) +
  19646. carry;
  19647. ws[i] = w & 0x3ffffff;
  19648. if (w < 0x4000000) {
  19649. carry = 0;
  19650. } else {
  19651. carry = w / 0x4000000 | 0;
  19652. }
  19653. }
  19654. return ws;
  19655. };
  19656. FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {
  19657. var carry = 0;
  19658. for (var i = 0; i < len; i++) {
  19659. carry = carry + (ws[i] | 0);
  19660. rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;
  19661. rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;
  19662. }
  19663. // Pad with zeroes
  19664. for (i = 2 * len; i < N; ++i) {
  19665. rws[i] = 0;
  19666. }
  19667. assert(carry === 0);
  19668. assert((carry & ~0x1fff) === 0);
  19669. };
  19670. FFTM.prototype.stub = function stub (N) {
  19671. var ph = new Array(N);
  19672. for (var i = 0; i < N; i++) {
  19673. ph[i] = 0;
  19674. }
  19675. return ph;
  19676. };
  19677. FFTM.prototype.mulp = function mulp (x, y, out) {
  19678. var N = 2 * this.guessLen13b(x.length, y.length);
  19679. var rbt = this.makeRBT(N);
  19680. var _ = this.stub(N);
  19681. var rws = new Array(N);
  19682. var rwst = new Array(N);
  19683. var iwst = new Array(N);
  19684. var nrws = new Array(N);
  19685. var nrwst = new Array(N);
  19686. var niwst = new Array(N);
  19687. var rmws = out.words;
  19688. rmws.length = N;
  19689. this.convert13b(x.words, x.length, rws, N);
  19690. this.convert13b(y.words, y.length, nrws, N);
  19691. this.transform(rws, _, rwst, iwst, N, rbt);
  19692. this.transform(nrws, _, nrwst, niwst, N, rbt);
  19693. for (var i = 0; i < N; i++) {
  19694. var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
  19695. iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
  19696. rwst[i] = rx;
  19697. }
  19698. this.conjugate(rwst, iwst, N);
  19699. this.transform(rwst, iwst, rmws, _, N, rbt);
  19700. this.conjugate(rmws, _, N);
  19701. this.normalize13b(rmws, N);
  19702. out.negative = x.negative ^ y.negative;
  19703. out.length = x.length + y.length;
  19704. return out._strip();
  19705. };
  19706. // Multiply `this` by `num`
  19707. BN.prototype.mul = function mul (num) {
  19708. var out = new BN(null);
  19709. out.words = new Array(this.length + num.length);
  19710. return this.mulTo(num, out);
  19711. };
  19712. // Multiply employing FFT
  19713. BN.prototype.mulf = function mulf (num) {
  19714. var out = new BN(null);
  19715. out.words = new Array(this.length + num.length);
  19716. return jumboMulTo(this, num, out);
  19717. };
  19718. // In-place Multiplication
  19719. BN.prototype.imul = function imul (num) {
  19720. return this.clone().mulTo(num, this);
  19721. };
  19722. BN.prototype.imuln = function imuln (num) {
  19723. var isNegNum = num < 0;
  19724. if (isNegNum) num = -num;
  19725. assert(typeof num === 'number');
  19726. assert(num < 0x4000000);
  19727. // Carry
  19728. var carry = 0;
  19729. for (var i = 0; i < this.length; i++) {
  19730. var w = (this.words[i] | 0) * num;
  19731. var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
  19732. carry >>= 26;
  19733. carry += (w / 0x4000000) | 0;
  19734. // NOTE: lo is 27bit maximum
  19735. carry += lo >>> 26;
  19736. this.words[i] = lo & 0x3ffffff;
  19737. }
  19738. if (carry !== 0) {
  19739. this.words[i] = carry;
  19740. this.length++;
  19741. }
  19742. return isNegNum ? this.ineg() : this;
  19743. };
  19744. BN.prototype.muln = function muln (num) {
  19745. return this.clone().imuln(num);
  19746. };
  19747. // `this` * `this`
  19748. BN.prototype.sqr = function sqr () {
  19749. return this.mul(this);
  19750. };
  19751. // `this` * `this` in-place
  19752. BN.prototype.isqr = function isqr () {
  19753. return this.imul(this.clone());
  19754. };
  19755. // Math.pow(`this`, `num`)
  19756. BN.prototype.pow = function pow (num) {
  19757. var w = toBitArray(num);
  19758. if (w.length === 0) return new BN(1);
  19759. // Skip leading zeroes
  19760. var res = this;
  19761. for (var i = 0; i < w.length; i++, res = res.sqr()) {
  19762. if (w[i] !== 0) break;
  19763. }
  19764. if (++i < w.length) {
  19765. for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
  19766. if (w[i] === 0) continue;
  19767. res = res.mul(q);
  19768. }
  19769. }
  19770. return res;
  19771. };
  19772. // Shift-left in-place
  19773. BN.prototype.iushln = function iushln (bits) {
  19774. assert(typeof bits === 'number' && bits >= 0);
  19775. var r = bits % 26;
  19776. var s = (bits - r) / 26;
  19777. var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);
  19778. var i;
  19779. if (r !== 0) {
  19780. var carry = 0;
  19781. for (i = 0; i < this.length; i++) {
  19782. var newCarry = this.words[i] & carryMask;
  19783. var c = ((this.words[i] | 0) - newCarry) << r;
  19784. this.words[i] = c | carry;
  19785. carry = newCarry >>> (26 - r);
  19786. }
  19787. if (carry) {
  19788. this.words[i] = carry;
  19789. this.length++;
  19790. }
  19791. }
  19792. if (s !== 0) {
  19793. for (i = this.length - 1; i >= 0; i--) {
  19794. this.words[i + s] = this.words[i];
  19795. }
  19796. for (i = 0; i < s; i++) {
  19797. this.words[i] = 0;
  19798. }
  19799. this.length += s;
  19800. }
  19801. return this._strip();
  19802. };
  19803. BN.prototype.ishln = function ishln (bits) {
  19804. // TODO(indutny): implement me
  19805. assert(this.negative === 0);
  19806. return this.iushln(bits);
  19807. };
  19808. // Shift-right in-place
  19809. // NOTE: `hint` is a lowest bit before trailing zeroes
  19810. // NOTE: if `extended` is present - it will be filled with destroyed bits
  19811. BN.prototype.iushrn = function iushrn (bits, hint, extended) {
  19812. assert(typeof bits === 'number' && bits >= 0);
  19813. var h;
  19814. if (hint) {
  19815. h = (hint - (hint % 26)) / 26;
  19816. } else {
  19817. h = 0;
  19818. }
  19819. var r = bits % 26;
  19820. var s = Math.min((bits - r) / 26, this.length);
  19821. var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
  19822. var maskedWords = extended;
  19823. h -= s;
  19824. h = Math.max(0, h);
  19825. // Extended mode, copy masked part
  19826. if (maskedWords) {
  19827. for (var i = 0; i < s; i++) {
  19828. maskedWords.words[i] = this.words[i];
  19829. }
  19830. maskedWords.length = s;
  19831. }
  19832. if (s === 0) {
  19833. // No-op, we should not move anything at all
  19834. } else if (this.length > s) {
  19835. this.length -= s;
  19836. for (i = 0; i < this.length; i++) {
  19837. this.words[i] = this.words[i + s];
  19838. }
  19839. } else {
  19840. this.words[0] = 0;
  19841. this.length = 1;
  19842. }
  19843. var carry = 0;
  19844. for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
  19845. var word = this.words[i] | 0;
  19846. this.words[i] = (carry << (26 - r)) | (word >>> r);
  19847. carry = word & mask;
  19848. }
  19849. // Push carried bits as a mask
  19850. if (maskedWords && carry !== 0) {
  19851. maskedWords.words[maskedWords.length++] = carry;
  19852. }
  19853. if (this.length === 0) {
  19854. this.words[0] = 0;
  19855. this.length = 1;
  19856. }
  19857. return this._strip();
  19858. };
  19859. BN.prototype.ishrn = function ishrn (bits, hint, extended) {
  19860. // TODO(indutny): implement me
  19861. assert(this.negative === 0);
  19862. return this.iushrn(bits, hint, extended);
  19863. };
  19864. // Shift-left
  19865. BN.prototype.shln = function shln (bits) {
  19866. return this.clone().ishln(bits);
  19867. };
  19868. BN.prototype.ushln = function ushln (bits) {
  19869. return this.clone().iushln(bits);
  19870. };
  19871. // Shift-right
  19872. BN.prototype.shrn = function shrn (bits) {
  19873. return this.clone().ishrn(bits);
  19874. };
  19875. BN.prototype.ushrn = function ushrn (bits) {
  19876. return this.clone().iushrn(bits);
  19877. };
  19878. // Test if n bit is set
  19879. BN.prototype.testn = function testn (bit) {
  19880. assert(typeof bit === 'number' && bit >= 0);
  19881. var r = bit % 26;
  19882. var s = (bit - r) / 26;
  19883. var q = 1 << r;
  19884. // Fast case: bit is much higher than all existing words
  19885. if (this.length <= s) return false;
  19886. // Check bit and return
  19887. var w = this.words[s];
  19888. return !!(w & q);
  19889. };
  19890. // Return only lowers bits of number (in-place)
  19891. BN.prototype.imaskn = function imaskn (bits) {
  19892. assert(typeof bits === 'number' && bits >= 0);
  19893. var r = bits % 26;
  19894. var s = (bits - r) / 26;
  19895. assert(this.negative === 0, 'imaskn works only with positive numbers');
  19896. if (this.length <= s) {
  19897. return this;
  19898. }
  19899. if (r !== 0) {
  19900. s++;
  19901. }
  19902. this.length = Math.min(s, this.length);
  19903. if (r !== 0) {
  19904. var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
  19905. this.words[this.length - 1] &= mask;
  19906. }
  19907. return this._strip();
  19908. };
  19909. // Return only lowers bits of number
  19910. BN.prototype.maskn = function maskn (bits) {
  19911. return this.clone().imaskn(bits);
  19912. };
  19913. // Add plain number `num` to `this`
  19914. BN.prototype.iaddn = function iaddn (num) {
  19915. assert(typeof num === 'number');
  19916. assert(num < 0x4000000);
  19917. if (num < 0) return this.isubn(-num);
  19918. // Possible sign change
  19919. if (this.negative !== 0) {
  19920. if (this.length === 1 && (this.words[0] | 0) <= num) {
  19921. this.words[0] = num - (this.words[0] | 0);
  19922. this.negative = 0;
  19923. return this;
  19924. }
  19925. this.negative = 0;
  19926. this.isubn(num);
  19927. this.negative = 1;
  19928. return this;
  19929. }
  19930. // Add without checks
  19931. return this._iaddn(num);
  19932. };
  19933. BN.prototype._iaddn = function _iaddn (num) {
  19934. this.words[0] += num;
  19935. // Carry
  19936. for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
  19937. this.words[i] -= 0x4000000;
  19938. if (i === this.length - 1) {
  19939. this.words[i + 1] = 1;
  19940. } else {
  19941. this.words[i + 1]++;
  19942. }
  19943. }
  19944. this.length = Math.max(this.length, i + 1);
  19945. return this;
  19946. };
  19947. // Subtract plain number `num` from `this`
  19948. BN.prototype.isubn = function isubn (num) {
  19949. assert(typeof num === 'number');
  19950. assert(num < 0x4000000);
  19951. if (num < 0) return this.iaddn(-num);
  19952. if (this.negative !== 0) {
  19953. this.negative = 0;
  19954. this.iaddn(num);
  19955. this.negative = 1;
  19956. return this;
  19957. }
  19958. this.words[0] -= num;
  19959. if (this.length === 1 && this.words[0] < 0) {
  19960. this.words[0] = -this.words[0];
  19961. this.negative = 1;
  19962. } else {
  19963. // Carry
  19964. for (var i = 0; i < this.length && this.words[i] < 0; i++) {
  19965. this.words[i] += 0x4000000;
  19966. this.words[i + 1] -= 1;
  19967. }
  19968. }
  19969. return this._strip();
  19970. };
  19971. BN.prototype.addn = function addn (num) {
  19972. return this.clone().iaddn(num);
  19973. };
  19974. BN.prototype.subn = function subn (num) {
  19975. return this.clone().isubn(num);
  19976. };
  19977. BN.prototype.iabs = function iabs () {
  19978. this.negative = 0;
  19979. return this;
  19980. };
  19981. BN.prototype.abs = function abs () {
  19982. return this.clone().iabs();
  19983. };
  19984. BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {
  19985. var len = num.length + shift;
  19986. var i;
  19987. this._expand(len);
  19988. var w;
  19989. var carry = 0;
  19990. for (i = 0; i < num.length; i++) {
  19991. w = (this.words[i + shift] | 0) + carry;
  19992. var right = (num.words[i] | 0) * mul;
  19993. w -= right & 0x3ffffff;
  19994. carry = (w >> 26) - ((right / 0x4000000) | 0);
  19995. this.words[i + shift] = w & 0x3ffffff;
  19996. }
  19997. for (; i < this.length - shift; i++) {
  19998. w = (this.words[i + shift] | 0) + carry;
  19999. carry = w >> 26;
  20000. this.words[i + shift] = w & 0x3ffffff;
  20001. }
  20002. if (carry === 0) return this._strip();
  20003. // Subtraction overflow
  20004. assert(carry === -1);
  20005. carry = 0;
  20006. for (i = 0; i < this.length; i++) {
  20007. w = -(this.words[i] | 0) + carry;
  20008. carry = w >> 26;
  20009. this.words[i] = w & 0x3ffffff;
  20010. }
  20011. this.negative = 1;
  20012. return this._strip();
  20013. };
  20014. BN.prototype._wordDiv = function _wordDiv (num, mode) {
  20015. var shift = this.length - num.length;
  20016. var a = this.clone();
  20017. var b = num;
  20018. // Normalize
  20019. var bhi = b.words[b.length - 1] | 0;
  20020. var bhiBits = this._countBits(bhi);
  20021. shift = 26 - bhiBits;
  20022. if (shift !== 0) {
  20023. b = b.ushln(shift);
  20024. a.iushln(shift);
  20025. bhi = b.words[b.length - 1] | 0;
  20026. }
  20027. // Initialize quotient
  20028. var m = a.length - b.length;
  20029. var q;
  20030. if (mode !== 'mod') {
  20031. q = new BN(null);
  20032. q.length = m + 1;
  20033. q.words = new Array(q.length);
  20034. for (var i = 0; i < q.length; i++) {
  20035. q.words[i] = 0;
  20036. }
  20037. }
  20038. var diff = a.clone()._ishlnsubmul(b, 1, m);
  20039. if (diff.negative === 0) {
  20040. a = diff;
  20041. if (q) {
  20042. q.words[m] = 1;
  20043. }
  20044. }
  20045. for (var j = m - 1; j >= 0; j--) {
  20046. var qj = (a.words[b.length + j] | 0) * 0x4000000 +
  20047. (a.words[b.length + j - 1] | 0);
  20048. // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
  20049. // (0x7ffffff)
  20050. qj = Math.min((qj / bhi) | 0, 0x3ffffff);
  20051. a._ishlnsubmul(b, qj, j);
  20052. while (a.negative !== 0) {
  20053. qj--;
  20054. a.negative = 0;
  20055. a._ishlnsubmul(b, 1, j);
  20056. if (!a.isZero()) {
  20057. a.negative ^= 1;
  20058. }
  20059. }
  20060. if (q) {
  20061. q.words[j] = qj;
  20062. }
  20063. }
  20064. if (q) {
  20065. q._strip();
  20066. }
  20067. a._strip();
  20068. // Denormalize
  20069. if (mode !== 'div' && shift !== 0) {
  20070. a.iushrn(shift);
  20071. }
  20072. return {
  20073. div: q || null,
  20074. mod: a
  20075. };
  20076. };
  20077. // NOTE: 1) `mode` can be set to `mod` to request mod only,
  20078. // to `div` to request div only, or be absent to
  20079. // request both div & mod
  20080. // 2) `positive` is true if unsigned mod is requested
  20081. BN.prototype.divmod = function divmod (num, mode, positive) {
  20082. assert(!num.isZero());
  20083. if (this.isZero()) {
  20084. return {
  20085. div: new BN(0),
  20086. mod: new BN(0)
  20087. };
  20088. }
  20089. var div, mod, res;
  20090. if (this.negative !== 0 && num.negative === 0) {
  20091. res = this.neg().divmod(num, mode);
  20092. if (mode !== 'mod') {
  20093. div = res.div.neg();
  20094. }
  20095. if (mode !== 'div') {
  20096. mod = res.mod.neg();
  20097. if (positive && mod.negative !== 0) {
  20098. mod.iadd(num);
  20099. }
  20100. }
  20101. return {
  20102. div: div,
  20103. mod: mod
  20104. };
  20105. }
  20106. if (this.negative === 0 && num.negative !== 0) {
  20107. res = this.divmod(num.neg(), mode);
  20108. if (mode !== 'mod') {
  20109. div = res.div.neg();
  20110. }
  20111. return {
  20112. div: div,
  20113. mod: res.mod
  20114. };
  20115. }
  20116. if ((this.negative & num.negative) !== 0) {
  20117. res = this.neg().divmod(num.neg(), mode);
  20118. if (mode !== 'div') {
  20119. mod = res.mod.neg();
  20120. if (positive && mod.negative !== 0) {
  20121. mod.isub(num);
  20122. }
  20123. }
  20124. return {
  20125. div: res.div,
  20126. mod: mod
  20127. };
  20128. }
  20129. // Both numbers are positive at this point
  20130. // Strip both numbers to approximate shift value
  20131. if (num.length > this.length || this.cmp(num) < 0) {
  20132. return {
  20133. div: new BN(0),
  20134. mod: this
  20135. };
  20136. }
  20137. // Very short reduction
  20138. if (num.length === 1) {
  20139. if (mode === 'div') {
  20140. return {
  20141. div: this.divn(num.words[0]),
  20142. mod: null
  20143. };
  20144. }
  20145. if (mode === 'mod') {
  20146. return {
  20147. div: null,
  20148. mod: new BN(this.modrn(num.words[0]))
  20149. };
  20150. }
  20151. return {
  20152. div: this.divn(num.words[0]),
  20153. mod: new BN(this.modrn(num.words[0]))
  20154. };
  20155. }
  20156. return this._wordDiv(num, mode);
  20157. };
  20158. // Find `this` / `num`
  20159. BN.prototype.div = function div (num) {
  20160. return this.divmod(num, 'div', false).div;
  20161. };
  20162. // Find `this` % `num`
  20163. BN.prototype.mod = function mod (num) {
  20164. return this.divmod(num, 'mod', false).mod;
  20165. };
  20166. BN.prototype.umod = function umod (num) {
  20167. return this.divmod(num, 'mod', true).mod;
  20168. };
  20169. // Find Round(`this` / `num`)
  20170. BN.prototype.divRound = function divRound (num) {
  20171. var dm = this.divmod(num);
  20172. // Fast case - exact division
  20173. if (dm.mod.isZero()) return dm.div;
  20174. var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
  20175. var half = num.ushrn(1);
  20176. var r2 = num.andln(1);
  20177. var cmp = mod.cmp(half);
  20178. // Round down
  20179. if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;
  20180. // Round up
  20181. return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
  20182. };
  20183. BN.prototype.modrn = function modrn (num) {
  20184. var isNegNum = num < 0;
  20185. if (isNegNum) num = -num;
  20186. assert(num <= 0x3ffffff);
  20187. var p = (1 << 26) % num;
  20188. var acc = 0;
  20189. for (var i = this.length - 1; i >= 0; i--) {
  20190. acc = (p * acc + (this.words[i] | 0)) % num;
  20191. }
  20192. return isNegNum ? -acc : acc;
  20193. };
  20194. // WARNING: DEPRECATED
  20195. BN.prototype.modn = function modn (num) {
  20196. return this.modrn(num);
  20197. };
  20198. // In-place division by number
  20199. BN.prototype.idivn = function idivn (num) {
  20200. var isNegNum = num < 0;
  20201. if (isNegNum) num = -num;
  20202. assert(num <= 0x3ffffff);
  20203. var carry = 0;
  20204. for (var i = this.length - 1; i >= 0; i--) {
  20205. var w = (this.words[i] | 0) + carry * 0x4000000;
  20206. this.words[i] = (w / num) | 0;
  20207. carry = w % num;
  20208. }
  20209. this._strip();
  20210. return isNegNum ? this.ineg() : this;
  20211. };
  20212. BN.prototype.divn = function divn (num) {
  20213. return this.clone().idivn(num);
  20214. };
  20215. BN.prototype.egcd = function egcd (p) {
  20216. assert(p.negative === 0);
  20217. assert(!p.isZero());
  20218. var x = this;
  20219. var y = p.clone();
  20220. if (x.negative !== 0) {
  20221. x = x.umod(p);
  20222. } else {
  20223. x = x.clone();
  20224. }
  20225. // A * x + B * y = x
  20226. var A = new BN(1);
  20227. var B = new BN(0);
  20228. // C * x + D * y = y
  20229. var C = new BN(0);
  20230. var D = new BN(1);
  20231. var g = 0;
  20232. while (x.isEven() && y.isEven()) {
  20233. x.iushrn(1);
  20234. y.iushrn(1);
  20235. ++g;
  20236. }
  20237. var yp = y.clone();
  20238. var xp = x.clone();
  20239. while (!x.isZero()) {
  20240. for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
  20241. if (i > 0) {
  20242. x.iushrn(i);
  20243. while (i-- > 0) {
  20244. if (A.isOdd() || B.isOdd()) {
  20245. A.iadd(yp);
  20246. B.isub(xp);
  20247. }
  20248. A.iushrn(1);
  20249. B.iushrn(1);
  20250. }
  20251. }
  20252. for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
  20253. if (j > 0) {
  20254. y.iushrn(j);
  20255. while (j-- > 0) {
  20256. if (C.isOdd() || D.isOdd()) {
  20257. C.iadd(yp);
  20258. D.isub(xp);
  20259. }
  20260. C.iushrn(1);
  20261. D.iushrn(1);
  20262. }
  20263. }
  20264. if (x.cmp(y) >= 0) {
  20265. x.isub(y);
  20266. A.isub(C);
  20267. B.isub(D);
  20268. } else {
  20269. y.isub(x);
  20270. C.isub(A);
  20271. D.isub(B);
  20272. }
  20273. }
  20274. return {
  20275. a: C,
  20276. b: D,
  20277. gcd: y.iushln(g)
  20278. };
  20279. };
  20280. // This is reduced incarnation of the binary EEA
  20281. // above, designated to invert members of the
  20282. // _prime_ fields F(p) at a maximal speed
  20283. BN.prototype._invmp = function _invmp (p) {
  20284. assert(p.negative === 0);
  20285. assert(!p.isZero());
  20286. var a = this;
  20287. var b = p.clone();
  20288. if (a.negative !== 0) {
  20289. a = a.umod(p);
  20290. } else {
  20291. a = a.clone();
  20292. }
  20293. var x1 = new BN(1);
  20294. var x2 = new BN(0);
  20295. var delta = b.clone();
  20296. while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
  20297. for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
  20298. if (i > 0) {
  20299. a.iushrn(i);
  20300. while (i-- > 0) {
  20301. if (x1.isOdd()) {
  20302. x1.iadd(delta);
  20303. }
  20304. x1.iushrn(1);
  20305. }
  20306. }
  20307. for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
  20308. if (j > 0) {
  20309. b.iushrn(j);
  20310. while (j-- > 0) {
  20311. if (x2.isOdd()) {
  20312. x2.iadd(delta);
  20313. }
  20314. x2.iushrn(1);
  20315. }
  20316. }
  20317. if (a.cmp(b) >= 0) {
  20318. a.isub(b);
  20319. x1.isub(x2);
  20320. } else {
  20321. b.isub(a);
  20322. x2.isub(x1);
  20323. }
  20324. }
  20325. var res;
  20326. if (a.cmpn(1) === 0) {
  20327. res = x1;
  20328. } else {
  20329. res = x2;
  20330. }
  20331. if (res.cmpn(0) < 0) {
  20332. res.iadd(p);
  20333. }
  20334. return res;
  20335. };
  20336. BN.prototype.gcd = function gcd (num) {
  20337. if (this.isZero()) return num.abs();
  20338. if (num.isZero()) return this.abs();
  20339. var a = this.clone();
  20340. var b = num.clone();
  20341. a.negative = 0;
  20342. b.negative = 0;
  20343. // Remove common factor of two
  20344. for (var shift = 0; a.isEven() && b.isEven(); shift++) {
  20345. a.iushrn(1);
  20346. b.iushrn(1);
  20347. }
  20348. do {
  20349. while (a.isEven()) {
  20350. a.iushrn(1);
  20351. }
  20352. while (b.isEven()) {
  20353. b.iushrn(1);
  20354. }
  20355. var r = a.cmp(b);
  20356. if (r < 0) {
  20357. // Swap `a` and `b` to make `a` always bigger than `b`
  20358. var t = a;
  20359. a = b;
  20360. b = t;
  20361. } else if (r === 0 || b.cmpn(1) === 0) {
  20362. break;
  20363. }
  20364. a.isub(b);
  20365. } while (true);
  20366. return b.iushln(shift);
  20367. };
  20368. // Invert number in the field F(num)
  20369. BN.prototype.invm = function invm (num) {
  20370. return this.egcd(num).a.umod(num);
  20371. };
  20372. BN.prototype.isEven = function isEven () {
  20373. return (this.words[0] & 1) === 0;
  20374. };
  20375. BN.prototype.isOdd = function isOdd () {
  20376. return (this.words[0] & 1) === 1;
  20377. };
  20378. // And first word and num
  20379. BN.prototype.andln = function andln (num) {
  20380. return this.words[0] & num;
  20381. };
  20382. // Increment at the bit position in-line
  20383. BN.prototype.bincn = function bincn (bit) {
  20384. assert(typeof bit === 'number');
  20385. var r = bit % 26;
  20386. var s = (bit - r) / 26;
  20387. var q = 1 << r;
  20388. // Fast case: bit is much higher than all existing words
  20389. if (this.length <= s) {
  20390. this._expand(s + 1);
  20391. this.words[s] |= q;
  20392. return this;
  20393. }
  20394. // Add bit and propagate, if needed
  20395. var carry = q;
  20396. for (var i = s; carry !== 0 && i < this.length; i++) {
  20397. var w = this.words[i] | 0;
  20398. w += carry;
  20399. carry = w >>> 26;
  20400. w &= 0x3ffffff;
  20401. this.words[i] = w;
  20402. }
  20403. if (carry !== 0) {
  20404. this.words[i] = carry;
  20405. this.length++;
  20406. }
  20407. return this;
  20408. };
  20409. BN.prototype.isZero = function isZero () {
  20410. return this.length === 1 && this.words[0] === 0;
  20411. };
  20412. BN.prototype.cmpn = function cmpn (num) {
  20413. var negative = num < 0;
  20414. if (this.negative !== 0 && !negative) return -1;
  20415. if (this.negative === 0 && negative) return 1;
  20416. this._strip();
  20417. var res;
  20418. if (this.length > 1) {
  20419. res = 1;
  20420. } else {
  20421. if (negative) {
  20422. num = -num;
  20423. }
  20424. assert(num <= 0x3ffffff, 'Number is too big');
  20425. var w = this.words[0] | 0;
  20426. res = w === num ? 0 : w < num ? -1 : 1;
  20427. }
  20428. if (this.negative !== 0) return -res | 0;
  20429. return res;
  20430. };
  20431. // Compare two numbers and return:
  20432. // 1 - if `this` > `num`
  20433. // 0 - if `this` == `num`
  20434. // -1 - if `this` < `num`
  20435. BN.prototype.cmp = function cmp (num) {
  20436. if (this.negative !== 0 && num.negative === 0) return -1;
  20437. if (this.negative === 0 && num.negative !== 0) return 1;
  20438. var res = this.ucmp(num);
  20439. if (this.negative !== 0) return -res | 0;
  20440. return res;
  20441. };
  20442. // Unsigned comparison
  20443. BN.prototype.ucmp = function ucmp (num) {
  20444. // At this point both numbers have the same sign
  20445. if (this.length > num.length) return 1;
  20446. if (this.length < num.length) return -1;
  20447. var res = 0;
  20448. for (var i = this.length - 1; i >= 0; i--) {
  20449. var a = this.words[i] | 0;
  20450. var b = num.words[i] | 0;
  20451. if (a === b) continue;
  20452. if (a < b) {
  20453. res = -1;
  20454. } else if (a > b) {
  20455. res = 1;
  20456. }
  20457. break;
  20458. }
  20459. return res;
  20460. };
  20461. BN.prototype.gtn = function gtn (num) {
  20462. return this.cmpn(num) === 1;
  20463. };
  20464. BN.prototype.gt = function gt (num) {
  20465. return this.cmp(num) === 1;
  20466. };
  20467. BN.prototype.gten = function gten (num) {
  20468. return this.cmpn(num) >= 0;
  20469. };
  20470. BN.prototype.gte = function gte (num) {
  20471. return this.cmp(num) >= 0;
  20472. };
  20473. BN.prototype.ltn = function ltn (num) {
  20474. return this.cmpn(num) === -1;
  20475. };
  20476. BN.prototype.lt = function lt (num) {
  20477. return this.cmp(num) === -1;
  20478. };
  20479. BN.prototype.lten = function lten (num) {
  20480. return this.cmpn(num) <= 0;
  20481. };
  20482. BN.prototype.lte = function lte (num) {
  20483. return this.cmp(num) <= 0;
  20484. };
  20485. BN.prototype.eqn = function eqn (num) {
  20486. return this.cmpn(num) === 0;
  20487. };
  20488. BN.prototype.eq = function eq (num) {
  20489. return this.cmp(num) === 0;
  20490. };
  20491. //
  20492. // A reduce context, could be using montgomery or something better, depending
  20493. // on the `m` itself.
  20494. //
  20495. BN.red = function red (num) {
  20496. return new Red(num);
  20497. };
  20498. BN.prototype.toRed = function toRed (ctx) {
  20499. assert(!this.red, 'Already a number in reduction context');
  20500. assert(this.negative === 0, 'red works only with positives');
  20501. return ctx.convertTo(this)._forceRed(ctx);
  20502. };
  20503. BN.prototype.fromRed = function fromRed () {
  20504. assert(this.red, 'fromRed works only with numbers in reduction context');
  20505. return this.red.convertFrom(this);
  20506. };
  20507. BN.prototype._forceRed = function _forceRed (ctx) {
  20508. this.red = ctx;
  20509. return this;
  20510. };
  20511. BN.prototype.forceRed = function forceRed (ctx) {
  20512. assert(!this.red, 'Already a number in reduction context');
  20513. return this._forceRed(ctx);
  20514. };
  20515. BN.prototype.redAdd = function redAdd (num) {
  20516. assert(this.red, 'redAdd works only with red numbers');
  20517. return this.red.add(this, num);
  20518. };
  20519. BN.prototype.redIAdd = function redIAdd (num) {
  20520. assert(this.red, 'redIAdd works only with red numbers');
  20521. return this.red.iadd(this, num);
  20522. };
  20523. BN.prototype.redSub = function redSub (num) {
  20524. assert(this.red, 'redSub works only with red numbers');
  20525. return this.red.sub(this, num);
  20526. };
  20527. BN.prototype.redISub = function redISub (num) {
  20528. assert(this.red, 'redISub works only with red numbers');
  20529. return this.red.isub(this, num);
  20530. };
  20531. BN.prototype.redShl = function redShl (num) {
  20532. assert(this.red, 'redShl works only with red numbers');
  20533. return this.red.shl(this, num);
  20534. };
  20535. BN.prototype.redMul = function redMul (num) {
  20536. assert(this.red, 'redMul works only with red numbers');
  20537. this.red._verify2(this, num);
  20538. return this.red.mul(this, num);
  20539. };
  20540. BN.prototype.redIMul = function redIMul (num) {
  20541. assert(this.red, 'redMul works only with red numbers');
  20542. this.red._verify2(this, num);
  20543. return this.red.imul(this, num);
  20544. };
  20545. BN.prototype.redSqr = function redSqr () {
  20546. assert(this.red, 'redSqr works only with red numbers');
  20547. this.red._verify1(this);
  20548. return this.red.sqr(this);
  20549. };
  20550. BN.prototype.redISqr = function redISqr () {
  20551. assert(this.red, 'redISqr works only with red numbers');
  20552. this.red._verify1(this);
  20553. return this.red.isqr(this);
  20554. };
  20555. // Square root over p
  20556. BN.prototype.redSqrt = function redSqrt () {
  20557. assert(this.red, 'redSqrt works only with red numbers');
  20558. this.red._verify1(this);
  20559. return this.red.sqrt(this);
  20560. };
  20561. BN.prototype.redInvm = function redInvm () {
  20562. assert(this.red, 'redInvm works only with red numbers');
  20563. this.red._verify1(this);
  20564. return this.red.invm(this);
  20565. };
  20566. // Return negative clone of `this` % `red modulo`
  20567. BN.prototype.redNeg = function redNeg () {
  20568. assert(this.red, 'redNeg works only with red numbers');
  20569. this.red._verify1(this);
  20570. return this.red.neg(this);
  20571. };
  20572. BN.prototype.redPow = function redPow (num) {
  20573. assert(this.red && !num.red, 'redPow(normalNum)');
  20574. this.red._verify1(this);
  20575. return this.red.pow(this, num);
  20576. };
  20577. // Prime numbers with efficient reduction
  20578. var primes = {
  20579. k256: null,
  20580. p224: null,
  20581. p192: null,
  20582. p25519: null
  20583. };
  20584. // Pseudo-Mersenne prime
  20585. function MPrime (name, p) {
  20586. // P = 2 ^ N - K
  20587. this.name = name;
  20588. this.p = new BN(p, 16);
  20589. this.n = this.p.bitLength();
  20590. this.k = new BN(1).iushln(this.n).isub(this.p);
  20591. this.tmp = this._tmp();
  20592. }
  20593. MPrime.prototype._tmp = function _tmp () {
  20594. var tmp = new BN(null);
  20595. tmp.words = new Array(Math.ceil(this.n / 13));
  20596. return tmp;
  20597. };
  20598. MPrime.prototype.ireduce = function ireduce (num) {
  20599. // Assumes that `num` is less than `P^2`
  20600. // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
  20601. var r = num;
  20602. var rlen;
  20603. do {
  20604. this.split(r, this.tmp);
  20605. r = this.imulK(r);
  20606. r = r.iadd(this.tmp);
  20607. rlen = r.bitLength();
  20608. } while (rlen > this.n);
  20609. var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
  20610. if (cmp === 0) {
  20611. r.words[0] = 0;
  20612. r.length = 1;
  20613. } else if (cmp > 0) {
  20614. r.isub(this.p);
  20615. } else {
  20616. if (r.strip !== undefined) {
  20617. // r is a BN v4 instance
  20618. r.strip();
  20619. } else {
  20620. // r is a BN v5 instance
  20621. r._strip();
  20622. }
  20623. }
  20624. return r;
  20625. };
  20626. MPrime.prototype.split = function split (input, out) {
  20627. input.iushrn(this.n, 0, out);
  20628. };
  20629. MPrime.prototype.imulK = function imulK (num) {
  20630. return num.imul(this.k);
  20631. };
  20632. function K256 () {
  20633. MPrime.call(
  20634. this,
  20635. 'k256',
  20636. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
  20637. }
  20638. inherits(K256, MPrime);
  20639. K256.prototype.split = function split (input, output) {
  20640. // 256 = 9 * 26 + 22
  20641. var mask = 0x3fffff;
  20642. var outLen = Math.min(input.length, 9);
  20643. for (var i = 0; i < outLen; i++) {
  20644. output.words[i] = input.words[i];
  20645. }
  20646. output.length = outLen;
  20647. if (input.length <= 9) {
  20648. input.words[0] = 0;
  20649. input.length = 1;
  20650. return;
  20651. }
  20652. // Shift by 9 limbs
  20653. var prev = input.words[9];
  20654. output.words[output.length++] = prev & mask;
  20655. for (i = 10; i < input.length; i++) {
  20656. var next = input.words[i] | 0;
  20657. input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);
  20658. prev = next;
  20659. }
  20660. prev >>>= 22;
  20661. input.words[i - 10] = prev;
  20662. if (prev === 0 && input.length > 10) {
  20663. input.length -= 10;
  20664. } else {
  20665. input.length -= 9;
  20666. }
  20667. };
  20668. K256.prototype.imulK = function imulK (num) {
  20669. // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
  20670. num.words[num.length] = 0;
  20671. num.words[num.length + 1] = 0;
  20672. num.length += 2;
  20673. // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
  20674. var lo = 0;
  20675. for (var i = 0; i < num.length; i++) {
  20676. var w = num.words[i] | 0;
  20677. lo += w * 0x3d1;
  20678. num.words[i] = lo & 0x3ffffff;
  20679. lo = w * 0x40 + ((lo / 0x4000000) | 0);
  20680. }
  20681. // Fast length reduction
  20682. if (num.words[num.length - 1] === 0) {
  20683. num.length--;
  20684. if (num.words[num.length - 1] === 0) {
  20685. num.length--;
  20686. }
  20687. }
  20688. return num;
  20689. };
  20690. function P224 () {
  20691. MPrime.call(
  20692. this,
  20693. 'p224',
  20694. 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
  20695. }
  20696. inherits(P224, MPrime);
  20697. function P192 () {
  20698. MPrime.call(
  20699. this,
  20700. 'p192',
  20701. 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
  20702. }
  20703. inherits(P192, MPrime);
  20704. function P25519 () {
  20705. // 2 ^ 255 - 19
  20706. MPrime.call(
  20707. this,
  20708. '25519',
  20709. '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
  20710. }
  20711. inherits(P25519, MPrime);
  20712. P25519.prototype.imulK = function imulK (num) {
  20713. // K = 0x13
  20714. var carry = 0;
  20715. for (var i = 0; i < num.length; i++) {
  20716. var hi = (num.words[i] | 0) * 0x13 + carry;
  20717. var lo = hi & 0x3ffffff;
  20718. hi >>>= 26;
  20719. num.words[i] = lo;
  20720. carry = hi;
  20721. }
  20722. if (carry !== 0) {
  20723. num.words[num.length++] = carry;
  20724. }
  20725. return num;
  20726. };
  20727. // Exported mostly for testing purposes, use plain name instead
  20728. BN._prime = function prime (name) {
  20729. // Cached version of prime
  20730. if (primes[name]) return primes[name];
  20731. var prime;
  20732. if (name === 'k256') {
  20733. prime = new K256();
  20734. } else if (name === 'p224') {
  20735. prime = new P224();
  20736. } else if (name === 'p192') {
  20737. prime = new P192();
  20738. } else if (name === 'p25519') {
  20739. prime = new P25519();
  20740. } else {
  20741. throw new Error('Unknown prime ' + name);
  20742. }
  20743. primes[name] = prime;
  20744. return prime;
  20745. };
  20746. //
  20747. // Base reduction engine
  20748. //
  20749. function Red (m) {
  20750. if (typeof m === 'string') {
  20751. var prime = BN._prime(m);
  20752. this.m = prime.p;
  20753. this.prime = prime;
  20754. } else {
  20755. assert(m.gtn(1), 'modulus must be greater than 1');
  20756. this.m = m;
  20757. this.prime = null;
  20758. }
  20759. }
  20760. Red.prototype._verify1 = function _verify1 (a) {
  20761. assert(a.negative === 0, 'red works only with positives');
  20762. assert(a.red, 'red works only with red numbers');
  20763. };
  20764. Red.prototype._verify2 = function _verify2 (a, b) {
  20765. assert((a.negative | b.negative) === 0, 'red works only with positives');
  20766. assert(a.red && a.red === b.red,
  20767. 'red works only with red numbers');
  20768. };
  20769. Red.prototype.imod = function imod (a) {
  20770. if (this.prime) return this.prime.ireduce(a)._forceRed(this);
  20771. move(a, a.umod(this.m)._forceRed(this));
  20772. return a;
  20773. };
  20774. Red.prototype.neg = function neg (a) {
  20775. if (a.isZero()) {
  20776. return a.clone();
  20777. }
  20778. return this.m.sub(a)._forceRed(this);
  20779. };
  20780. Red.prototype.add = function add (a, b) {
  20781. this._verify2(a, b);
  20782. var res = a.add(b);
  20783. if (res.cmp(this.m) >= 0) {
  20784. res.isub(this.m);
  20785. }
  20786. return res._forceRed(this);
  20787. };
  20788. Red.prototype.iadd = function iadd (a, b) {
  20789. this._verify2(a, b);
  20790. var res = a.iadd(b);
  20791. if (res.cmp(this.m) >= 0) {
  20792. res.isub(this.m);
  20793. }
  20794. return res;
  20795. };
  20796. Red.prototype.sub = function sub (a, b) {
  20797. this._verify2(a, b);
  20798. var res = a.sub(b);
  20799. if (res.cmpn(0) < 0) {
  20800. res.iadd(this.m);
  20801. }
  20802. return res._forceRed(this);
  20803. };
  20804. Red.prototype.isub = function isub (a, b) {
  20805. this._verify2(a, b);
  20806. var res = a.isub(b);
  20807. if (res.cmpn(0) < 0) {
  20808. res.iadd(this.m);
  20809. }
  20810. return res;
  20811. };
  20812. Red.prototype.shl = function shl (a, num) {
  20813. this._verify1(a);
  20814. return this.imod(a.ushln(num));
  20815. };
  20816. Red.prototype.imul = function imul (a, b) {
  20817. this._verify2(a, b);
  20818. return this.imod(a.imul(b));
  20819. };
  20820. Red.prototype.mul = function mul (a, b) {
  20821. this._verify2(a, b);
  20822. return this.imod(a.mul(b));
  20823. };
  20824. Red.prototype.isqr = function isqr (a) {
  20825. return this.imul(a, a.clone());
  20826. };
  20827. Red.prototype.sqr = function sqr (a) {
  20828. return this.mul(a, a);
  20829. };
  20830. Red.prototype.sqrt = function sqrt (a) {
  20831. if (a.isZero()) return a.clone();
  20832. var mod3 = this.m.andln(3);
  20833. assert(mod3 % 2 === 1);
  20834. // Fast case
  20835. if (mod3 === 3) {
  20836. var pow = this.m.add(new BN(1)).iushrn(2);
  20837. return this.pow(a, pow);
  20838. }
  20839. // Tonelli-Shanks algorithm (Totally unoptimized and slow)
  20840. //
  20841. // Find Q and S, that Q * 2 ^ S = (P - 1)
  20842. var q = this.m.subn(1);
  20843. var s = 0;
  20844. while (!q.isZero() && q.andln(1) === 0) {
  20845. s++;
  20846. q.iushrn(1);
  20847. }
  20848. assert(!q.isZero());
  20849. var one = new BN(1).toRed(this);
  20850. var nOne = one.redNeg();
  20851. // Find quadratic non-residue
  20852. // NOTE: Max is such because of generalized Riemann hypothesis.
  20853. var lpow = this.m.subn(1).iushrn(1);
  20854. var z = this.m.bitLength();
  20855. z = new BN(2 * z * z).toRed(this);
  20856. while (this.pow(z, lpow).cmp(nOne) !== 0) {
  20857. z.redIAdd(nOne);
  20858. }
  20859. var c = this.pow(z, q);
  20860. var r = this.pow(a, q.addn(1).iushrn(1));
  20861. var t = this.pow(a, q);
  20862. var m = s;
  20863. while (t.cmp(one) !== 0) {
  20864. var tmp = t;
  20865. for (var i = 0; tmp.cmp(one) !== 0; i++) {
  20866. tmp = tmp.redSqr();
  20867. }
  20868. assert(i < m);
  20869. var b = this.pow(c, new BN(1).iushln(m - i - 1));
  20870. r = r.redMul(b);
  20871. c = b.redSqr();
  20872. t = t.redMul(c);
  20873. m = i;
  20874. }
  20875. return r;
  20876. };
  20877. Red.prototype.invm = function invm (a) {
  20878. var inv = a._invmp(this.m);
  20879. if (inv.negative !== 0) {
  20880. inv.negative = 0;
  20881. return this.imod(inv).redNeg();
  20882. } else {
  20883. return this.imod(inv);
  20884. }
  20885. };
  20886. Red.prototype.pow = function pow (a, num) {
  20887. if (num.isZero()) return new BN(1).toRed(this);
  20888. if (num.cmpn(1) === 0) return a.clone();
  20889. var windowSize = 4;
  20890. var wnd = new Array(1 << windowSize);
  20891. wnd[0] = new BN(1).toRed(this);
  20892. wnd[1] = a;
  20893. for (var i = 2; i < wnd.length; i++) {
  20894. wnd[i] = this.mul(wnd[i - 1], a);
  20895. }
  20896. var res = wnd[0];
  20897. var current = 0;
  20898. var currentLen = 0;
  20899. var start = num.bitLength() % 26;
  20900. if (start === 0) {
  20901. start = 26;
  20902. }
  20903. for (i = num.length - 1; i >= 0; i--) {
  20904. var word = num.words[i];
  20905. for (var j = start - 1; j >= 0; j--) {
  20906. var bit = (word >> j) & 1;
  20907. if (res !== wnd[0]) {
  20908. res = this.sqr(res);
  20909. }
  20910. if (bit === 0 && current === 0) {
  20911. currentLen = 0;
  20912. continue;
  20913. }
  20914. current <<= 1;
  20915. current |= bit;
  20916. currentLen++;
  20917. if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
  20918. res = this.mul(res, wnd[current]);
  20919. currentLen = 0;
  20920. current = 0;
  20921. }
  20922. start = 26;
  20923. }
  20924. return res;
  20925. };
  20926. Red.prototype.convertTo = function convertTo (num) {
  20927. var r = num.umod(this.m);
  20928. return r === num ? r.clone() : r;
  20929. };
  20930. Red.prototype.convertFrom = function convertFrom (num) {
  20931. var res = num.clone();
  20932. res.red = null;
  20933. return res;
  20934. };
  20935. //
  20936. // Montgomery method engine
  20937. //
  20938. BN.mont = function mont (num) {
  20939. return new Mont(num);
  20940. };
  20941. function Mont (m) {
  20942. Red.call(this, m);
  20943. this.shift = this.m.bitLength();
  20944. if (this.shift % 26 !== 0) {
  20945. this.shift += 26 - (this.shift % 26);
  20946. }
  20947. this.r = new BN(1).iushln(this.shift);
  20948. this.r2 = this.imod(this.r.sqr());
  20949. this.rinv = this.r._invmp(this.m);
  20950. this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
  20951. this.minv = this.minv.umod(this.r);
  20952. this.minv = this.r.sub(this.minv);
  20953. }
  20954. inherits(Mont, Red);
  20955. Mont.prototype.convertTo = function convertTo (num) {
  20956. return this.imod(num.ushln(this.shift));
  20957. };
  20958. Mont.prototype.convertFrom = function convertFrom (num) {
  20959. var r = this.imod(num.mul(this.rinv));
  20960. r.red = null;
  20961. return r;
  20962. };
  20963. Mont.prototype.imul = function imul (a, b) {
  20964. if (a.isZero() || b.isZero()) {
  20965. a.words[0] = 0;
  20966. a.length = 1;
  20967. return a;
  20968. }
  20969. var t = a.imul(b);
  20970. var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
  20971. var u = t.isub(c).iushrn(this.shift);
  20972. var res = u;
  20973. if (u.cmp(this.m) >= 0) {
  20974. res = u.isub(this.m);
  20975. } else if (u.cmpn(0) < 0) {
  20976. res = u.iadd(this.m);
  20977. }
  20978. return res._forceRed(this);
  20979. };
  20980. Mont.prototype.mul = function mul (a, b) {
  20981. if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
  20982. var t = a.mul(b);
  20983. var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
  20984. var u = t.isub(c).iushrn(this.shift);
  20985. var res = u;
  20986. if (u.cmp(this.m) >= 0) {
  20987. res = u.isub(this.m);
  20988. } else if (u.cmpn(0) < 0) {
  20989. res = u.iadd(this.m);
  20990. }
  20991. return res._forceRed(this);
  20992. };
  20993. Mont.prototype.invm = function invm (a) {
  20994. // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
  20995. var res = this.imod(a._invmp(this.m).mul(this.r2));
  20996. return res._forceRed(this);
  20997. };
  20998. })( false || module, this);
  20999. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ 197)(module)))
  21000. /***/ }),
  21001. /* 197 */
  21002. /*!***********************************!*\
  21003. !*** (webpack)/buildin/module.js ***!
  21004. \***********************************/
  21005. /*! no static exports found */
  21006. /***/ (function(module, exports) {
  21007. module.exports = function(module) {
  21008. if (!module.webpackPolyfill) {
  21009. module.deprecate = function() {};
  21010. module.paths = [];
  21011. // module.parent = undefined by default
  21012. if (!module.children) module.children = [];
  21013. Object.defineProperty(module, "loaded", {
  21014. enumerable: true,
  21015. get: function() {
  21016. return module.l;
  21017. }
  21018. });
  21019. Object.defineProperty(module, "id", {
  21020. enumerable: true,
  21021. get: function() {
  21022. return module.i;
  21023. }
  21024. });
  21025. module.webpackPolyfill = 1;
  21026. }
  21027. return module;
  21028. };
  21029. /***/ }),
  21030. /* 198 */
  21031. /*!************************!*\
  21032. !*** buffer (ignored) ***!
  21033. \************************/
  21034. /*! no static exports found */
  21035. /***/ (function(module, exports) {
  21036. /* (ignored) */
  21037. /***/ }),
  21038. /* 199 */
  21039. /*!*********************************************!*\
  21040. !*** ./node_modules/miller-rabin/lib/mr.js ***!
  21041. \*********************************************/
  21042. /*! no static exports found */
  21043. /***/ (function(module, exports, __webpack_require__) {
  21044. var bn = __webpack_require__(/*! bn.js */ 196);
  21045. var brorand = __webpack_require__(/*! brorand */ 200);
  21046. function MillerRabin(rand) {
  21047. this.rand = rand || new brorand.Rand();
  21048. }
  21049. module.exports = MillerRabin;
  21050. MillerRabin.create = function create(rand) {
  21051. return new MillerRabin(rand);
  21052. };
  21053. MillerRabin.prototype._randbelow = function _randbelow(n) {
  21054. var len = n.bitLength();
  21055. var min_bytes = Math.ceil(len / 8);
  21056. // Generage random bytes until a number less than n is found.
  21057. // This ensures that 0..n-1 have an equal probability of being selected.
  21058. do
  21059. var a = new bn(this.rand.generate(min_bytes));
  21060. while (a.cmp(n) >= 0);
  21061. return a;
  21062. };
  21063. MillerRabin.prototype._randrange = function _randrange(start, stop) {
  21064. // Generate a random number greater than or equal to start and less than stop.
  21065. var size = stop.sub(start);
  21066. return start.add(this._randbelow(size));
  21067. };
  21068. MillerRabin.prototype.test = function test(n, k, cb) {
  21069. var len = n.bitLength();
  21070. var red = bn.mont(n);
  21071. var rone = new bn(1).toRed(red);
  21072. if (!k)
  21073. k = Math.max(1, (len / 48) | 0);
  21074. // Find d and s, (n - 1) = (2 ^ s) * d;
  21075. var n1 = n.subn(1);
  21076. for (var s = 0; !n1.testn(s); s++) {}
  21077. var d = n.shrn(s);
  21078. var rn1 = n1.toRed(red);
  21079. var prime = true;
  21080. for (; k > 0; k--) {
  21081. var a = this._randrange(new bn(2), n1);
  21082. if (cb)
  21083. cb(a);
  21084. var x = a.toRed(red).redPow(d);
  21085. if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
  21086. continue;
  21087. for (var i = 1; i < s; i++) {
  21088. x = x.redSqr();
  21089. if (x.cmp(rone) === 0)
  21090. return false;
  21091. if (x.cmp(rn1) === 0)
  21092. break;
  21093. }
  21094. if (i === s)
  21095. return false;
  21096. }
  21097. return prime;
  21098. };
  21099. MillerRabin.prototype.getDivisor = function getDivisor(n, k) {
  21100. var len = n.bitLength();
  21101. var red = bn.mont(n);
  21102. var rone = new bn(1).toRed(red);
  21103. if (!k)
  21104. k = Math.max(1, (len / 48) | 0);
  21105. // Find d and s, (n - 1) = (2 ^ s) * d;
  21106. var n1 = n.subn(1);
  21107. for (var s = 0; !n1.testn(s); s++) {}
  21108. var d = n.shrn(s);
  21109. var rn1 = n1.toRed(red);
  21110. for (; k > 0; k--) {
  21111. var a = this._randrange(new bn(2), n1);
  21112. var g = n.gcd(a);
  21113. if (g.cmpn(1) !== 0)
  21114. return g;
  21115. var x = a.toRed(red).redPow(d);
  21116. if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
  21117. continue;
  21118. for (var i = 1; i < s; i++) {
  21119. x = x.redSqr();
  21120. if (x.cmp(rone) === 0)
  21121. return x.fromRed().subn(1).gcd(n);
  21122. if (x.cmp(rn1) === 0)
  21123. break;
  21124. }
  21125. if (i === s) {
  21126. x = x.redSqr();
  21127. return x.fromRed().subn(1).gcd(n);
  21128. }
  21129. }
  21130. return false;
  21131. };
  21132. /***/ }),
  21133. /* 200 */
  21134. /*!***************************************!*\
  21135. !*** ./node_modules/brorand/index.js ***!
  21136. \***************************************/
  21137. /*! no static exports found */
  21138. /***/ (function(module, exports, __webpack_require__) {
  21139. var r;
  21140. module.exports = function rand(len) {
  21141. if (!r)
  21142. r = new Rand(null);
  21143. return r.generate(len);
  21144. };
  21145. function Rand(rand) {
  21146. this.rand = rand;
  21147. }
  21148. module.exports.Rand = Rand;
  21149. Rand.prototype.generate = function generate(len) {
  21150. return this._rand(len);
  21151. };
  21152. // Emulate crypto API using randy
  21153. Rand.prototype._rand = function _rand(n) {
  21154. if (this.rand.getBytes)
  21155. return this.rand.getBytes(n);
  21156. var res = new Uint8Array(n);
  21157. for (var i = 0; i < res.length; i++)
  21158. res[i] = this.rand.getByte();
  21159. return res;
  21160. };
  21161. if (typeof self === 'object') {
  21162. if (self.crypto && self.crypto.getRandomValues) {
  21163. // Modern browsers
  21164. Rand.prototype._rand = function _rand(n) {
  21165. var arr = new Uint8Array(n);
  21166. self.crypto.getRandomValues(arr);
  21167. return arr;
  21168. };
  21169. } else if (self.msCrypto && self.msCrypto.getRandomValues) {
  21170. // IE
  21171. Rand.prototype._rand = function _rand(n) {
  21172. var arr = new Uint8Array(n);
  21173. self.msCrypto.getRandomValues(arr);
  21174. return arr;
  21175. };
  21176. // Safari's WebWorkers do not have `crypto`
  21177. } else if (typeof window === 'object') {
  21178. // Old junk
  21179. Rand.prototype._rand = function() {
  21180. throw new Error('Not implemented yet');
  21181. };
  21182. }
  21183. } else {
  21184. // Node.js or Web worker with no crypto support
  21185. try {
  21186. var crypto = __webpack_require__(/*! crypto */ 201);
  21187. if (typeof crypto.randomBytes !== 'function')
  21188. throw new Error('Not supported');
  21189. Rand.prototype._rand = function _rand(n) {
  21190. return crypto.randomBytes(n);
  21191. };
  21192. } catch (e) {
  21193. }
  21194. }
  21195. /***/ }),
  21196. /* 201 */
  21197. /*!************************!*\
  21198. !*** crypto (ignored) ***!
  21199. \************************/
  21200. /*! no static exports found */
  21201. /***/ (function(module, exports) {
  21202. /* (ignored) */
  21203. /***/ }),
  21204. /* 202 */
  21205. /*!*****************************************************!*\
  21206. !*** ./node_modules/diffie-hellman/lib/primes.json ***!
  21207. \*****************************************************/
  21208. /*! exports provided: modp1, modp2, modp5, modp14, modp15, modp16, modp17, modp18, default */
  21209. /***/ (function(module) {
  21210. module.exports = JSON.parse("{\"modp1\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"},\"modp2\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"},\"modp5\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"},\"modp14\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"},\"modp15\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"},\"modp16\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"},\"modp17\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"},\"modp18\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"}}");
  21211. /***/ }),
  21212. /* 203 */
  21213. /*!***********************************************!*\
  21214. !*** ./node_modules/diffie-hellman/lib/dh.js ***!
  21215. \***********************************************/
  21216. /*! no static exports found */
  21217. /***/ (function(module, exports, __webpack_require__) {
  21218. /* WEBPACK VAR INJECTION */(function(Buffer) {var BN = __webpack_require__(/*! bn.js */ 196);
  21219. var MillerRabin = __webpack_require__(/*! miller-rabin */ 199);
  21220. var millerRabin = new MillerRabin();
  21221. var TWENTYFOUR = new BN(24);
  21222. var ELEVEN = new BN(11);
  21223. var TEN = new BN(10);
  21224. var THREE = new BN(3);
  21225. var SEVEN = new BN(7);
  21226. var primes = __webpack_require__(/*! ./generatePrime */ 195);
  21227. var randomBytes = __webpack_require__(/*! randombytes */ 111);
  21228. module.exports = DH;
  21229. function setPublicKey(pub, enc) {
  21230. enc = enc || 'utf8';
  21231. if (!Buffer.isBuffer(pub)) {
  21232. pub = new Buffer(pub, enc);
  21233. }
  21234. this._pub = new BN(pub);
  21235. return this;
  21236. }
  21237. function setPrivateKey(priv, enc) {
  21238. enc = enc || 'utf8';
  21239. if (!Buffer.isBuffer(priv)) {
  21240. priv = new Buffer(priv, enc);
  21241. }
  21242. this._priv = new BN(priv);
  21243. return this;
  21244. }
  21245. var primeCache = {};
  21246. function checkPrime(prime, generator) {
  21247. var gen = generator.toString('hex');
  21248. var hex = [gen, prime.toString(16)].join('_');
  21249. if (hex in primeCache) {
  21250. return primeCache[hex];
  21251. }
  21252. var error = 0;
  21253. if (prime.isEven() ||
  21254. !primes.simpleSieve ||
  21255. !primes.fermatTest(prime) ||
  21256. !millerRabin.test(prime)) {
  21257. //not a prime so +1
  21258. error += 1;
  21259. if (gen === '02' || gen === '05') {
  21260. // we'd be able to check the generator
  21261. // it would fail so +8
  21262. error += 8;
  21263. } else {
  21264. //we wouldn't be able to test the generator
  21265. // so +4
  21266. error += 4;
  21267. }
  21268. primeCache[hex] = error;
  21269. return error;
  21270. }
  21271. if (!millerRabin.test(prime.shrn(1))) {
  21272. //not a safe prime
  21273. error += 2;
  21274. }
  21275. var rem;
  21276. switch (gen) {
  21277. case '02':
  21278. if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {
  21279. // unsuidable generator
  21280. error += 8;
  21281. }
  21282. break;
  21283. case '05':
  21284. rem = prime.mod(TEN);
  21285. if (rem.cmp(THREE) && rem.cmp(SEVEN)) {
  21286. // prime mod 10 needs to equal 3 or 7
  21287. error += 8;
  21288. }
  21289. break;
  21290. default:
  21291. error += 4;
  21292. }
  21293. primeCache[hex] = error;
  21294. return error;
  21295. }
  21296. function DH(prime, generator, malleable) {
  21297. this.setGenerator(generator);
  21298. this.__prime = new BN(prime);
  21299. this._prime = BN.mont(this.__prime);
  21300. this._primeLen = prime.length;
  21301. this._pub = undefined;
  21302. this._priv = undefined;
  21303. this._primeCode = undefined;
  21304. if (malleable) {
  21305. this.setPublicKey = setPublicKey;
  21306. this.setPrivateKey = setPrivateKey;
  21307. } else {
  21308. this._primeCode = 8;
  21309. }
  21310. }
  21311. Object.defineProperty(DH.prototype, 'verifyError', {
  21312. enumerable: true,
  21313. get: function () {
  21314. if (typeof this._primeCode !== 'number') {
  21315. this._primeCode = checkPrime(this.__prime, this.__gen);
  21316. }
  21317. return this._primeCode;
  21318. }
  21319. });
  21320. DH.prototype.generateKeys = function () {
  21321. if (!this._priv) {
  21322. this._priv = new BN(randomBytes(this._primeLen));
  21323. }
  21324. this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();
  21325. return this.getPublicKey();
  21326. };
  21327. DH.prototype.computeSecret = function (other) {
  21328. other = new BN(other);
  21329. other = other.toRed(this._prime);
  21330. var secret = other.redPow(this._priv).fromRed();
  21331. var out = new Buffer(secret.toArray());
  21332. var prime = this.getPrime();
  21333. if (out.length < prime.length) {
  21334. var front = new Buffer(prime.length - out.length);
  21335. front.fill(0);
  21336. out = Buffer.concat([front, out]);
  21337. }
  21338. return out;
  21339. };
  21340. DH.prototype.getPublicKey = function getPublicKey(enc) {
  21341. return formatReturnValue(this._pub, enc);
  21342. };
  21343. DH.prototype.getPrivateKey = function getPrivateKey(enc) {
  21344. return formatReturnValue(this._priv, enc);
  21345. };
  21346. DH.prototype.getPrime = function (enc) {
  21347. return formatReturnValue(this.__prime, enc);
  21348. };
  21349. DH.prototype.getGenerator = function (enc) {
  21350. return formatReturnValue(this._gen, enc);
  21351. };
  21352. DH.prototype.setGenerator = function (gen, enc) {
  21353. enc = enc || 'utf8';
  21354. if (!Buffer.isBuffer(gen)) {
  21355. gen = new Buffer(gen, enc);
  21356. }
  21357. this.__gen = gen;
  21358. this._gen = new BN(gen);
  21359. return this;
  21360. };
  21361. function formatReturnValue(bn, enc) {
  21362. var buf = new Buffer(bn.toArray());
  21363. if (!enc) {
  21364. return buf;
  21365. } else {
  21366. return buf.toString(enc);
  21367. }
  21368. }
  21369. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 115).Buffer))
  21370. /***/ }),
  21371. /* 204 */
  21372. /*!*******************************************************!*\
  21373. !*** ./node_modules/browserify-sign/browser/index.js ***!
  21374. \*******************************************************/
  21375. /*! no static exports found */
  21376. /***/ (function(module, exports, __webpack_require__) {
  21377. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  21378. var createHash = __webpack_require__(/*! create-hash */ 119)
  21379. var stream = __webpack_require__(/*! readable-stream */ 123)
  21380. var inherits = __webpack_require__(/*! inherits */ 120)
  21381. var sign = __webpack_require__(/*! ./sign */ 205)
  21382. var verify = __webpack_require__(/*! ./verify */ 258)
  21383. var algorithms = __webpack_require__(/*! ./algorithms.json */ 158)
  21384. Object.keys(algorithms).forEach(function (key) {
  21385. algorithms[key].id = Buffer.from(algorithms[key].id, 'hex')
  21386. algorithms[key.toLowerCase()] = algorithms[key]
  21387. })
  21388. function Sign (algorithm) {
  21389. stream.Writable.call(this)
  21390. var data = algorithms[algorithm]
  21391. if (!data) throw new Error('Unknown message digest')
  21392. this._hashType = data.hash
  21393. this._hash = createHash(data.hash)
  21394. this._tag = data.id
  21395. this._signType = data.sign
  21396. }
  21397. inherits(Sign, stream.Writable)
  21398. Sign.prototype._write = function _write (data, _, done) {
  21399. this._hash.update(data)
  21400. done()
  21401. }
  21402. Sign.prototype.update = function update (data, enc) {
  21403. if (typeof data === 'string') data = Buffer.from(data, enc)
  21404. this._hash.update(data)
  21405. return this
  21406. }
  21407. Sign.prototype.sign = function signMethod (key, enc) {
  21408. this.end()
  21409. var hash = this._hash.digest()
  21410. var sig = sign(hash, key, this._hashType, this._signType, this._tag)
  21411. return enc ? sig.toString(enc) : sig
  21412. }
  21413. function Verify (algorithm) {
  21414. stream.Writable.call(this)
  21415. var data = algorithms[algorithm]
  21416. if (!data) throw new Error('Unknown message digest')
  21417. this._hash = createHash(data.hash)
  21418. this._tag = data.id
  21419. this._signType = data.sign
  21420. }
  21421. inherits(Verify, stream.Writable)
  21422. Verify.prototype._write = function _write (data, _, done) {
  21423. this._hash.update(data)
  21424. done()
  21425. }
  21426. Verify.prototype.update = function update (data, enc) {
  21427. if (typeof data === 'string') data = Buffer.from(data, enc)
  21428. this._hash.update(data)
  21429. return this
  21430. }
  21431. Verify.prototype.verify = function verifyMethod (key, sig, enc) {
  21432. if (typeof sig === 'string') sig = Buffer.from(sig, enc)
  21433. this.end()
  21434. var hash = this._hash.digest()
  21435. return verify(sig, hash, key, this._signType, this._tag)
  21436. }
  21437. function createSign (algorithm) {
  21438. return new Sign(algorithm)
  21439. }
  21440. function createVerify (algorithm) {
  21441. return new Verify(algorithm)
  21442. }
  21443. module.exports = {
  21444. Sign: createSign,
  21445. Verify: createVerify,
  21446. createSign: createSign,
  21447. createVerify: createVerify
  21448. }
  21449. /***/ }),
  21450. /* 205 */
  21451. /*!******************************************************!*\
  21452. !*** ./node_modules/browserify-sign/browser/sign.js ***!
  21453. \******************************************************/
  21454. /*! no static exports found */
  21455. /***/ (function(module, exports, __webpack_require__) {
  21456. // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
  21457. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  21458. var createHmac = __webpack_require__(/*! create-hmac */ 154)
  21459. var crt = __webpack_require__(/*! browserify-rsa */ 206)
  21460. var EC = __webpack_require__(/*! elliptic */ 207).ec
  21461. var BN = __webpack_require__(/*! bn.js */ 196)
  21462. var parseKeys = __webpack_require__(/*! parse-asn1 */ 237)
  21463. var curves = __webpack_require__(/*! ./curves.json */ 257)
  21464. function sign (hash, key, hashType, signType, tag) {
  21465. var priv = parseKeys(key)
  21466. if (priv.curve) {
  21467. // rsa keys can be interpreted as ecdsa ones in openssl
  21468. if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
  21469. return ecSign(hash, priv)
  21470. } else if (priv.type === 'dsa') {
  21471. if (signType !== 'dsa') throw new Error('wrong private key type')
  21472. return dsaSign(hash, priv, hashType)
  21473. } else {
  21474. if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
  21475. }
  21476. hash = Buffer.concat([tag, hash])
  21477. var len = priv.modulus.byteLength()
  21478. var pad = [0, 1]
  21479. while (hash.length + pad.length + 1 < len) pad.push(0xff)
  21480. pad.push(0x00)
  21481. var i = -1
  21482. while (++i < hash.length) pad.push(hash[i])
  21483. var out = crt(pad, priv)
  21484. return out
  21485. }
  21486. function ecSign (hash, priv) {
  21487. var curveId = curves[priv.curve.join('.')]
  21488. if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'))
  21489. var curve = new EC(curveId)
  21490. var key = curve.keyFromPrivate(priv.privateKey)
  21491. var out = key.sign(hash)
  21492. return Buffer.from(out.toDER())
  21493. }
  21494. function dsaSign (hash, priv, algo) {
  21495. var x = priv.params.priv_key
  21496. var p = priv.params.p
  21497. var q = priv.params.q
  21498. var g = priv.params.g
  21499. var r = new BN(0)
  21500. var k
  21501. var H = bits2int(hash, q).mod(q)
  21502. var s = false
  21503. var kv = getKey(x, q, hash, algo)
  21504. while (s === false) {
  21505. k = makeKey(q, kv, algo)
  21506. r = makeR(g, k, p, q)
  21507. s = k.invm(q).imul(H.add(x.mul(r))).mod(q)
  21508. if (s.cmpn(0) === 0) {
  21509. s = false
  21510. r = new BN(0)
  21511. }
  21512. }
  21513. return toDER(r, s)
  21514. }
  21515. function toDER (r, s) {
  21516. r = r.toArray()
  21517. s = s.toArray()
  21518. // Pad values
  21519. if (r[0] & 0x80) r = [0].concat(r)
  21520. if (s[0] & 0x80) s = [0].concat(s)
  21521. var total = r.length + s.length + 4
  21522. var res = [0x30, total, 0x02, r.length]
  21523. res = res.concat(r, [0x02, s.length], s)
  21524. return Buffer.from(res)
  21525. }
  21526. function getKey (x, q, hash, algo) {
  21527. x = Buffer.from(x.toArray())
  21528. if (x.length < q.byteLength()) {
  21529. var zeros = Buffer.alloc(q.byteLength() - x.length)
  21530. x = Buffer.concat([zeros, x])
  21531. }
  21532. var hlen = hash.length
  21533. var hbits = bits2octets(hash, q)
  21534. var v = Buffer.alloc(hlen)
  21535. v.fill(1)
  21536. var k = Buffer.alloc(hlen)
  21537. k = createHmac(algo, k).update(v).update(Buffer.from([0])).update(x).update(hbits).digest()
  21538. v = createHmac(algo, k).update(v).digest()
  21539. k = createHmac(algo, k).update(v).update(Buffer.from([1])).update(x).update(hbits).digest()
  21540. v = createHmac(algo, k).update(v).digest()
  21541. return { k: k, v: v }
  21542. }
  21543. function bits2int (obits, q) {
  21544. var bits = new BN(obits)
  21545. var shift = (obits.length << 3) - q.bitLength()
  21546. if (shift > 0) bits.ishrn(shift)
  21547. return bits
  21548. }
  21549. function bits2octets (bits, q) {
  21550. bits = bits2int(bits, q)
  21551. bits = bits.mod(q)
  21552. var out = Buffer.from(bits.toArray())
  21553. if (out.length < q.byteLength()) {
  21554. var zeros = Buffer.alloc(q.byteLength() - out.length)
  21555. out = Buffer.concat([zeros, out])
  21556. }
  21557. return out
  21558. }
  21559. function makeKey (q, kv, algo) {
  21560. var t
  21561. var k
  21562. do {
  21563. t = Buffer.alloc(0)
  21564. while (t.length * 8 < q.bitLength()) {
  21565. kv.v = createHmac(algo, kv.k).update(kv.v).digest()
  21566. t = Buffer.concat([t, kv.v])
  21567. }
  21568. k = bits2int(t, q)
  21569. kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer.from([0])).digest()
  21570. kv.v = createHmac(algo, kv.k).update(kv.v).digest()
  21571. } while (k.cmp(q) !== -1)
  21572. return k
  21573. }
  21574. function makeR (g, k, p, q) {
  21575. return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q)
  21576. }
  21577. module.exports = sign
  21578. module.exports.getKey = getKey
  21579. module.exports.makeKey = makeKey
  21580. /***/ }),
  21581. /* 206 */
  21582. /*!**********************************************!*\
  21583. !*** ./node_modules/browserify-rsa/index.js ***!
  21584. \**********************************************/
  21585. /*! no static exports found */
  21586. /***/ (function(module, exports, __webpack_require__) {
  21587. /* WEBPACK VAR INJECTION */(function(Buffer) {var bn = __webpack_require__(/*! bn.js */ 196);
  21588. var randomBytes = __webpack_require__(/*! randombytes */ 111);
  21589. module.exports = crt;
  21590. function blind(priv) {
  21591. var r = getr(priv);
  21592. var blinder = r.toRed(bn.mont(priv.modulus))
  21593. .redPow(new bn(priv.publicExponent)).fromRed();
  21594. return {
  21595. blinder: blinder,
  21596. unblinder:r.invm(priv.modulus)
  21597. };
  21598. }
  21599. function crt(msg, priv) {
  21600. var blinds = blind(priv);
  21601. var len = priv.modulus.byteLength();
  21602. var mod = bn.mont(priv.modulus);
  21603. var blinded = new bn(msg).mul(blinds.blinder).umod(priv.modulus);
  21604. var c1 = blinded.toRed(bn.mont(priv.prime1));
  21605. var c2 = blinded.toRed(bn.mont(priv.prime2));
  21606. var qinv = priv.coefficient;
  21607. var p = priv.prime1;
  21608. var q = priv.prime2;
  21609. var m1 = c1.redPow(priv.exponent1);
  21610. var m2 = c2.redPow(priv.exponent2);
  21611. m1 = m1.fromRed();
  21612. m2 = m2.fromRed();
  21613. var h = m1.isub(m2).imul(qinv).umod(p);
  21614. h.imul(q);
  21615. m2.iadd(h);
  21616. return new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(false, len));
  21617. }
  21618. crt.getr = getr;
  21619. function getr(priv) {
  21620. var len = priv.modulus.byteLength();
  21621. var r = new bn(randomBytes(len));
  21622. while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) {
  21623. r = new bn(randomBytes(len));
  21624. }
  21625. return r;
  21626. }
  21627. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 115).Buffer))
  21628. /***/ }),
  21629. /* 207 */
  21630. /*!***********************************************!*\
  21631. !*** ./node_modules/elliptic/lib/elliptic.js ***!
  21632. \***********************************************/
  21633. /*! no static exports found */
  21634. /***/ (function(module, exports, __webpack_require__) {
  21635. "use strict";
  21636. var elliptic = exports;
  21637. elliptic.version = __webpack_require__(/*! ../package.json */ 208).version;
  21638. elliptic.utils = __webpack_require__(/*! ./elliptic/utils */ 209);
  21639. elliptic.rand = __webpack_require__(/*! brorand */ 200);
  21640. elliptic.curve = __webpack_require__(/*! ./elliptic/curve */ 211);
  21641. elliptic.curves = __webpack_require__(/*! ./elliptic/curves */ 216);
  21642. // Protocols
  21643. elliptic.ec = __webpack_require__(/*! ./elliptic/ec */ 230);
  21644. elliptic.eddsa = __webpack_require__(/*! ./elliptic/eddsa */ 234);
  21645. /***/ }),
  21646. /* 208 */
  21647. /*!********************************************!*\
  21648. !*** ./node_modules/elliptic/package.json ***!
  21649. \********************************************/
  21650. /*! exports provided: _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _shasum, _spec, _where, author, bugs, bundleDependencies, dependencies, deprecated, description, devDependencies, files, homepage, keywords, license, main, name, repository, scripts, version, default */
  21651. /***/ (function(module) {
  21652. module.exports = JSON.parse("{\"_from\":\"elliptic@^6.5.2\",\"_id\":\"elliptic@6.5.2\",\"_inBundle\":false,\"_integrity\":\"sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==\",\"_location\":\"/elliptic\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"elliptic@^6.5.2\",\"name\":\"elliptic\",\"escapedName\":\"elliptic\",\"rawSpec\":\"^6.5.2\",\"saveSpec\":null,\"fetchSpec\":\"^6.5.2\"},\"_requiredBy\":[\"/browserify-sign\",\"/create-ecdh\"],\"_resolved\":\"https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz\",\"_shasum\":\"05c5678d7173c049d8ca433552224a495d0e3762\",\"_spec\":\"elliptic@^6.5.2\",\"_where\":\"/Users/fxy/Documents/DCloud/HbuilderX-plugins/alpha/uniapp-cli/node_modules/browserify-sign\",\"author\":{\"name\":\"Fedor Indutny\",\"email\":\"fedor@indutny.com\"},\"bugs\":{\"url\":\"https://github.com/indutny/elliptic/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"bn.js\":\"^4.4.0\",\"brorand\":\"^1.0.1\",\"hash.js\":\"^1.0.0\",\"hmac-drbg\":\"^1.0.0\",\"inherits\":\"^2.0.1\",\"minimalistic-assert\":\"^1.0.0\",\"minimalistic-crypto-utils\":\"^1.0.0\"},\"deprecated\":false,\"description\":\"EC cryptography\",\"devDependencies\":{\"brfs\":\"^1.4.3\",\"coveralls\":\"^3.0.8\",\"grunt\":\"^1.0.4\",\"grunt-browserify\":\"^5.0.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-connect\":\"^1.0.0\",\"grunt-contrib-copy\":\"^1.0.0\",\"grunt-contrib-uglify\":\"^1.0.1\",\"grunt-mocha-istanbul\":\"^3.0.1\",\"grunt-saucelabs\":\"^9.0.1\",\"istanbul\":\"^0.4.2\",\"jscs\":\"^3.0.7\",\"jshint\":\"^2.10.3\",\"mocha\":\"^6.2.2\"},\"files\":[\"lib\"],\"homepage\":\"https://github.com/indutny/elliptic\",\"keywords\":[\"EC\",\"Elliptic\",\"curve\",\"Cryptography\"],\"license\":\"MIT\",\"main\":\"lib/elliptic.js\",\"name\":\"elliptic\",\"repository\":{\"type\":\"git\",\"url\":\"git+ssh://git@github.com/indutny/elliptic.git\"},\"scripts\":{\"jscs\":\"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js\",\"jshint\":\"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js\",\"lint\":\"npm run jscs && npm run jshint\",\"test\":\"npm run lint && npm run unit\",\"unit\":\"istanbul test _mocha --reporter=spec test/index.js\",\"version\":\"grunt dist && git add dist/\"},\"version\":\"6.5.2\"}");
  21653. /***/ }),
  21654. /* 209 */
  21655. /*!*****************************************************!*\
  21656. !*** ./node_modules/elliptic/lib/elliptic/utils.js ***!
  21657. \*****************************************************/
  21658. /*! no static exports found */
  21659. /***/ (function(module, exports, __webpack_require__) {
  21660. "use strict";
  21661. var utils = exports;
  21662. var BN = __webpack_require__(/*! bn.js */ 196);
  21663. var minAssert = __webpack_require__(/*! minimalistic-assert */ 170);
  21664. var minUtils = __webpack_require__(/*! minimalistic-crypto-utils */ 210);
  21665. utils.assert = minAssert;
  21666. utils.toArray = minUtils.toArray;
  21667. utils.zero2 = minUtils.zero2;
  21668. utils.toHex = minUtils.toHex;
  21669. utils.encode = minUtils.encode;
  21670. // Represent num in a w-NAF form
  21671. function getNAF(num, w, bits) {
  21672. var naf = new Array(Math.max(num.bitLength(), bits) + 1);
  21673. naf.fill(0);
  21674. var ws = 1 << (w + 1);
  21675. var k = num.clone();
  21676. for (var i = 0; i < naf.length; i++) {
  21677. var z;
  21678. var mod = k.andln(ws - 1);
  21679. if (k.isOdd()) {
  21680. if (mod > (ws >> 1) - 1)
  21681. z = (ws >> 1) - mod;
  21682. else
  21683. z = mod;
  21684. k.isubn(z);
  21685. } else {
  21686. z = 0;
  21687. }
  21688. naf[i] = z;
  21689. k.iushrn(1);
  21690. }
  21691. return naf;
  21692. }
  21693. utils.getNAF = getNAF;
  21694. // Represent k1, k2 in a Joint Sparse Form
  21695. function getJSF(k1, k2) {
  21696. var jsf = [
  21697. [],
  21698. []
  21699. ];
  21700. k1 = k1.clone();
  21701. k2 = k2.clone();
  21702. var d1 = 0;
  21703. var d2 = 0;
  21704. while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
  21705. // First phase
  21706. var m14 = (k1.andln(3) + d1) & 3;
  21707. var m24 = (k2.andln(3) + d2) & 3;
  21708. if (m14 === 3)
  21709. m14 = -1;
  21710. if (m24 === 3)
  21711. m24 = -1;
  21712. var u1;
  21713. if ((m14 & 1) === 0) {
  21714. u1 = 0;
  21715. } else {
  21716. var m8 = (k1.andln(7) + d1) & 7;
  21717. if ((m8 === 3 || m8 === 5) && m24 === 2)
  21718. u1 = -m14;
  21719. else
  21720. u1 = m14;
  21721. }
  21722. jsf[0].push(u1);
  21723. var u2;
  21724. if ((m24 & 1) === 0) {
  21725. u2 = 0;
  21726. } else {
  21727. var m8 = (k2.andln(7) + d2) & 7;
  21728. if ((m8 === 3 || m8 === 5) && m14 === 2)
  21729. u2 = -m24;
  21730. else
  21731. u2 = m24;
  21732. }
  21733. jsf[1].push(u2);
  21734. // Second phase
  21735. if (2 * d1 === u1 + 1)
  21736. d1 = 1 - d1;
  21737. if (2 * d2 === u2 + 1)
  21738. d2 = 1 - d2;
  21739. k1.iushrn(1);
  21740. k2.iushrn(1);
  21741. }
  21742. return jsf;
  21743. }
  21744. utils.getJSF = getJSF;
  21745. function cachedProperty(obj, name, computer) {
  21746. var key = '_' + name;
  21747. obj.prototype[name] = function cachedProperty() {
  21748. return this[key] !== undefined ? this[key] :
  21749. this[key] = computer.call(this);
  21750. };
  21751. }
  21752. utils.cachedProperty = cachedProperty;
  21753. function parseBytes(bytes) {
  21754. return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :
  21755. bytes;
  21756. }
  21757. utils.parseBytes = parseBytes;
  21758. function intFromLE(bytes) {
  21759. return new BN(bytes, 'hex', 'le');
  21760. }
  21761. utils.intFromLE = intFromLE;
  21762. /***/ }),
  21763. /* 210 */
  21764. /*!*************************************************************!*\
  21765. !*** ./node_modules/minimalistic-crypto-utils/lib/utils.js ***!
  21766. \*************************************************************/
  21767. /*! no static exports found */
  21768. /***/ (function(module, exports, __webpack_require__) {
  21769. "use strict";
  21770. var utils = exports;
  21771. function toArray(msg, enc) {
  21772. if (Array.isArray(msg))
  21773. return msg.slice();
  21774. if (!msg)
  21775. return [];
  21776. var res = [];
  21777. if (typeof msg !== 'string') {
  21778. for (var i = 0; i < msg.length; i++)
  21779. res[i] = msg[i] | 0;
  21780. return res;
  21781. }
  21782. if (enc === 'hex') {
  21783. msg = msg.replace(/[^a-z0-9]+/ig, '');
  21784. if (msg.length % 2 !== 0)
  21785. msg = '0' + msg;
  21786. for (var i = 0; i < msg.length; i += 2)
  21787. res.push(parseInt(msg[i] + msg[i + 1], 16));
  21788. } else {
  21789. for (var i = 0; i < msg.length; i++) {
  21790. var c = msg.charCodeAt(i);
  21791. var hi = c >> 8;
  21792. var lo = c & 0xff;
  21793. if (hi)
  21794. res.push(hi, lo);
  21795. else
  21796. res.push(lo);
  21797. }
  21798. }
  21799. return res;
  21800. }
  21801. utils.toArray = toArray;
  21802. function zero2(word) {
  21803. if (word.length === 1)
  21804. return '0' + word;
  21805. else
  21806. return word;
  21807. }
  21808. utils.zero2 = zero2;
  21809. function toHex(msg) {
  21810. var res = '';
  21811. for (var i = 0; i < msg.length; i++)
  21812. res += zero2(msg[i].toString(16));
  21813. return res;
  21814. }
  21815. utils.toHex = toHex;
  21816. utils.encode = function encode(arr, enc) {
  21817. if (enc === 'hex')
  21818. return toHex(arr);
  21819. else
  21820. return arr;
  21821. };
  21822. /***/ }),
  21823. /* 211 */
  21824. /*!***********************************************************!*\
  21825. !*** ./node_modules/elliptic/lib/elliptic/curve/index.js ***!
  21826. \***********************************************************/
  21827. /*! no static exports found */
  21828. /***/ (function(module, exports, __webpack_require__) {
  21829. "use strict";
  21830. var curve = exports;
  21831. curve.base = __webpack_require__(/*! ./base */ 212);
  21832. curve.short = __webpack_require__(/*! ./short */ 213);
  21833. curve.mont = __webpack_require__(/*! ./mont */ 214);
  21834. curve.edwards = __webpack_require__(/*! ./edwards */ 215);
  21835. /***/ }),
  21836. /* 212 */
  21837. /*!**********************************************************!*\
  21838. !*** ./node_modules/elliptic/lib/elliptic/curve/base.js ***!
  21839. \**********************************************************/
  21840. /*! no static exports found */
  21841. /***/ (function(module, exports, __webpack_require__) {
  21842. "use strict";
  21843. var BN = __webpack_require__(/*! bn.js */ 196);
  21844. var utils = __webpack_require__(/*! ../utils */ 209);
  21845. var getNAF = utils.getNAF;
  21846. var getJSF = utils.getJSF;
  21847. var assert = utils.assert;
  21848. function BaseCurve(type, conf) {
  21849. this.type = type;
  21850. this.p = new BN(conf.p, 16);
  21851. // Use Montgomery, when there is no fast reduction for the prime
  21852. this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);
  21853. // Useful for many curves
  21854. this.zero = new BN(0).toRed(this.red);
  21855. this.one = new BN(1).toRed(this.red);
  21856. this.two = new BN(2).toRed(this.red);
  21857. // Curve configuration, optional
  21858. this.n = conf.n && new BN(conf.n, 16);
  21859. this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);
  21860. // Temporary arrays
  21861. this._wnafT1 = new Array(4);
  21862. this._wnafT2 = new Array(4);
  21863. this._wnafT3 = new Array(4);
  21864. this._wnafT4 = new Array(4);
  21865. this._bitLength = this.n ? this.n.bitLength() : 0;
  21866. // Generalized Greg Maxwell's trick
  21867. var adjustCount = this.n && this.p.div(this.n);
  21868. if (!adjustCount || adjustCount.cmpn(100) > 0) {
  21869. this.redN = null;
  21870. } else {
  21871. this._maxwellTrick = true;
  21872. this.redN = this.n.toRed(this.red);
  21873. }
  21874. }
  21875. module.exports = BaseCurve;
  21876. BaseCurve.prototype.point = function point() {
  21877. throw new Error('Not implemented');
  21878. };
  21879. BaseCurve.prototype.validate = function validate() {
  21880. throw new Error('Not implemented');
  21881. };
  21882. BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
  21883. assert(p.precomputed);
  21884. var doubles = p._getDoubles();
  21885. var naf = getNAF(k, 1, this._bitLength);
  21886. var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);
  21887. I /= 3;
  21888. // Translate into more windowed form
  21889. var repr = [];
  21890. for (var j = 0; j < naf.length; j += doubles.step) {
  21891. var nafW = 0;
  21892. for (var k = j + doubles.step - 1; k >= j; k--)
  21893. nafW = (nafW << 1) + naf[k];
  21894. repr.push(nafW);
  21895. }
  21896. var a = this.jpoint(null, null, null);
  21897. var b = this.jpoint(null, null, null);
  21898. for (var i = I; i > 0; i--) {
  21899. for (var j = 0; j < repr.length; j++) {
  21900. var nafW = repr[j];
  21901. if (nafW === i)
  21902. b = b.mixedAdd(doubles.points[j]);
  21903. else if (nafW === -i)
  21904. b = b.mixedAdd(doubles.points[j].neg());
  21905. }
  21906. a = a.add(b);
  21907. }
  21908. return a.toP();
  21909. };
  21910. BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
  21911. var w = 4;
  21912. // Precompute window
  21913. var nafPoints = p._getNAFPoints(w);
  21914. w = nafPoints.wnd;
  21915. var wnd = nafPoints.points;
  21916. // Get NAF form
  21917. var naf = getNAF(k, w, this._bitLength);
  21918. // Add `this`*(N+1) for every w-NAF index
  21919. var acc = this.jpoint(null, null, null);
  21920. for (var i = naf.length - 1; i >= 0; i--) {
  21921. // Count zeroes
  21922. for (var k = 0; i >= 0 && naf[i] === 0; i--)
  21923. k++;
  21924. if (i >= 0)
  21925. k++;
  21926. acc = acc.dblp(k);
  21927. if (i < 0)
  21928. break;
  21929. var z = naf[i];
  21930. assert(z !== 0);
  21931. if (p.type === 'affine') {
  21932. // J +- P
  21933. if (z > 0)
  21934. acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
  21935. else
  21936. acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
  21937. } else {
  21938. // J +- J
  21939. if (z > 0)
  21940. acc = acc.add(wnd[(z - 1) >> 1]);
  21941. else
  21942. acc = acc.add(wnd[(-z - 1) >> 1].neg());
  21943. }
  21944. }
  21945. return p.type === 'affine' ? acc.toP() : acc;
  21946. };
  21947. BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
  21948. points,
  21949. coeffs,
  21950. len,
  21951. jacobianResult) {
  21952. var wndWidth = this._wnafT1;
  21953. var wnd = this._wnafT2;
  21954. var naf = this._wnafT3;
  21955. // Fill all arrays
  21956. var max = 0;
  21957. for (var i = 0; i < len; i++) {
  21958. var p = points[i];
  21959. var nafPoints = p._getNAFPoints(defW);
  21960. wndWidth[i] = nafPoints.wnd;
  21961. wnd[i] = nafPoints.points;
  21962. }
  21963. // Comb small window NAFs
  21964. for (var i = len - 1; i >= 1; i -= 2) {
  21965. var a = i - 1;
  21966. var b = i;
  21967. if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
  21968. naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);
  21969. naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);
  21970. max = Math.max(naf[a].length, max);
  21971. max = Math.max(naf[b].length, max);
  21972. continue;
  21973. }
  21974. var comb = [
  21975. points[a], /* 1 */
  21976. null, /* 3 */
  21977. null, /* 5 */
  21978. points[b] /* 7 */
  21979. ];
  21980. // Try to avoid Projective points, if possible
  21981. if (points[a].y.cmp(points[b].y) === 0) {
  21982. comb[1] = points[a].add(points[b]);
  21983. comb[2] = points[a].toJ().mixedAdd(points[b].neg());
  21984. } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
  21985. comb[1] = points[a].toJ().mixedAdd(points[b]);
  21986. comb[2] = points[a].add(points[b].neg());
  21987. } else {
  21988. comb[1] = points[a].toJ().mixedAdd(points[b]);
  21989. comb[2] = points[a].toJ().mixedAdd(points[b].neg());
  21990. }
  21991. var index = [
  21992. -3, /* -1 -1 */
  21993. -1, /* -1 0 */
  21994. -5, /* -1 1 */
  21995. -7, /* 0 -1 */
  21996. 0, /* 0 0 */
  21997. 7, /* 0 1 */
  21998. 5, /* 1 -1 */
  21999. 1, /* 1 0 */
  22000. 3 /* 1 1 */
  22001. ];
  22002. var jsf = getJSF(coeffs[a], coeffs[b]);
  22003. max = Math.max(jsf[0].length, max);
  22004. naf[a] = new Array(max);
  22005. naf[b] = new Array(max);
  22006. for (var j = 0; j < max; j++) {
  22007. var ja = jsf[0][j] | 0;
  22008. var jb = jsf[1][j] | 0;
  22009. naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
  22010. naf[b][j] = 0;
  22011. wnd[a] = comb;
  22012. }
  22013. }
  22014. var acc = this.jpoint(null, null, null);
  22015. var tmp = this._wnafT4;
  22016. for (var i = max; i >= 0; i--) {
  22017. var k = 0;
  22018. while (i >= 0) {
  22019. var zero = true;
  22020. for (var j = 0; j < len; j++) {
  22021. tmp[j] = naf[j][i] | 0;
  22022. if (tmp[j] !== 0)
  22023. zero = false;
  22024. }
  22025. if (!zero)
  22026. break;
  22027. k++;
  22028. i--;
  22029. }
  22030. if (i >= 0)
  22031. k++;
  22032. acc = acc.dblp(k);
  22033. if (i < 0)
  22034. break;
  22035. for (var j = 0; j < len; j++) {
  22036. var z = tmp[j];
  22037. var p;
  22038. if (z === 0)
  22039. continue;
  22040. else if (z > 0)
  22041. p = wnd[j][(z - 1) >> 1];
  22042. else if (z < 0)
  22043. p = wnd[j][(-z - 1) >> 1].neg();
  22044. if (p.type === 'affine')
  22045. acc = acc.mixedAdd(p);
  22046. else
  22047. acc = acc.add(p);
  22048. }
  22049. }
  22050. // Zeroify references
  22051. for (var i = 0; i < len; i++)
  22052. wnd[i] = null;
  22053. if (jacobianResult)
  22054. return acc;
  22055. else
  22056. return acc.toP();
  22057. };
  22058. function BasePoint(curve, type) {
  22059. this.curve = curve;
  22060. this.type = type;
  22061. this.precomputed = null;
  22062. }
  22063. BaseCurve.BasePoint = BasePoint;
  22064. BasePoint.prototype.eq = function eq(/*other*/) {
  22065. throw new Error('Not implemented');
  22066. };
  22067. BasePoint.prototype.validate = function validate() {
  22068. return this.curve.validate(this);
  22069. };
  22070. BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
  22071. bytes = utils.toArray(bytes, enc);
  22072. var len = this.p.byteLength();
  22073. // uncompressed, hybrid-odd, hybrid-even
  22074. if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
  22075. bytes.length - 1 === 2 * len) {
  22076. if (bytes[0] === 0x06)
  22077. assert(bytes[bytes.length - 1] % 2 === 0);
  22078. else if (bytes[0] === 0x07)
  22079. assert(bytes[bytes.length - 1] % 2 === 1);
  22080. var res = this.point(bytes.slice(1, 1 + len),
  22081. bytes.slice(1 + len, 1 + 2 * len));
  22082. return res;
  22083. } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&
  22084. bytes.length - 1 === len) {
  22085. return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
  22086. }
  22087. throw new Error('Unknown point format');
  22088. };
  22089. BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
  22090. return this.encode(enc, true);
  22091. };
  22092. BasePoint.prototype._encode = function _encode(compact) {
  22093. var len = this.curve.p.byteLength();
  22094. var x = this.getX().toArray('be', len);
  22095. if (compact)
  22096. return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);
  22097. return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ;
  22098. };
  22099. BasePoint.prototype.encode = function encode(enc, compact) {
  22100. return utils.encode(this._encode(compact), enc);
  22101. };
  22102. BasePoint.prototype.precompute = function precompute(power) {
  22103. if (this.precomputed)
  22104. return this;
  22105. var precomputed = {
  22106. doubles: null,
  22107. naf: null,
  22108. beta: null
  22109. };
  22110. precomputed.naf = this._getNAFPoints(8);
  22111. precomputed.doubles = this._getDoubles(4, power);
  22112. precomputed.beta = this._getBeta();
  22113. this.precomputed = precomputed;
  22114. return this;
  22115. };
  22116. BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
  22117. if (!this.precomputed)
  22118. return false;
  22119. var doubles = this.precomputed.doubles;
  22120. if (!doubles)
  22121. return false;
  22122. return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
  22123. };
  22124. BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
  22125. if (this.precomputed && this.precomputed.doubles)
  22126. return this.precomputed.doubles;
  22127. var doubles = [ this ];
  22128. var acc = this;
  22129. for (var i = 0; i < power; i += step) {
  22130. for (var j = 0; j < step; j++)
  22131. acc = acc.dbl();
  22132. doubles.push(acc);
  22133. }
  22134. return {
  22135. step: step,
  22136. points: doubles
  22137. };
  22138. };
  22139. BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
  22140. if (this.precomputed && this.precomputed.naf)
  22141. return this.precomputed.naf;
  22142. var res = [ this ];
  22143. var max = (1 << wnd) - 1;
  22144. var dbl = max === 1 ? null : this.dbl();
  22145. for (var i = 1; i < max; i++)
  22146. res[i] = res[i - 1].add(dbl);
  22147. return {
  22148. wnd: wnd,
  22149. points: res
  22150. };
  22151. };
  22152. BasePoint.prototype._getBeta = function _getBeta() {
  22153. return null;
  22154. };
  22155. BasePoint.prototype.dblp = function dblp(k) {
  22156. var r = this;
  22157. for (var i = 0; i < k; i++)
  22158. r = r.dbl();
  22159. return r;
  22160. };
  22161. /***/ }),
  22162. /* 213 */
  22163. /*!***********************************************************!*\
  22164. !*** ./node_modules/elliptic/lib/elliptic/curve/short.js ***!
  22165. \***********************************************************/
  22166. /*! no static exports found */
  22167. /***/ (function(module, exports, __webpack_require__) {
  22168. "use strict";
  22169. var utils = __webpack_require__(/*! ../utils */ 209);
  22170. var BN = __webpack_require__(/*! bn.js */ 196);
  22171. var inherits = __webpack_require__(/*! inherits */ 120);
  22172. var Base = __webpack_require__(/*! ./base */ 212);
  22173. var assert = utils.assert;
  22174. function ShortCurve(conf) {
  22175. Base.call(this, 'short', conf);
  22176. this.a = new BN(conf.a, 16).toRed(this.red);
  22177. this.b = new BN(conf.b, 16).toRed(this.red);
  22178. this.tinv = this.two.redInvm();
  22179. this.zeroA = this.a.fromRed().cmpn(0) === 0;
  22180. this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;
  22181. // If the curve is endomorphic, precalculate beta and lambda
  22182. this.endo = this._getEndomorphism(conf);
  22183. this._endoWnafT1 = new Array(4);
  22184. this._endoWnafT2 = new Array(4);
  22185. }
  22186. inherits(ShortCurve, Base);
  22187. module.exports = ShortCurve;
  22188. ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
  22189. // No efficient endomorphism
  22190. if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
  22191. return;
  22192. // Compute beta and lambda, that lambda * P = (beta * Px; Py)
  22193. var beta;
  22194. var lambda;
  22195. if (conf.beta) {
  22196. beta = new BN(conf.beta, 16).toRed(this.red);
  22197. } else {
  22198. var betas = this._getEndoRoots(this.p);
  22199. // Choose the smallest beta
  22200. beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
  22201. beta = beta.toRed(this.red);
  22202. }
  22203. if (conf.lambda) {
  22204. lambda = new BN(conf.lambda, 16);
  22205. } else {
  22206. // Choose the lambda that is matching selected beta
  22207. var lambdas = this._getEndoRoots(this.n);
  22208. if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
  22209. lambda = lambdas[0];
  22210. } else {
  22211. lambda = lambdas[1];
  22212. assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
  22213. }
  22214. }
  22215. // Get basis vectors, used for balanced length-two representation
  22216. var basis;
  22217. if (conf.basis) {
  22218. basis = conf.basis.map(function(vec) {
  22219. return {
  22220. a: new BN(vec.a, 16),
  22221. b: new BN(vec.b, 16)
  22222. };
  22223. });
  22224. } else {
  22225. basis = this._getEndoBasis(lambda);
  22226. }
  22227. return {
  22228. beta: beta,
  22229. lambda: lambda,
  22230. basis: basis
  22231. };
  22232. };
  22233. ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
  22234. // Find roots of for x^2 + x + 1 in F
  22235. // Root = (-1 +- Sqrt(-3)) / 2
  22236. //
  22237. var red = num === this.p ? this.red : BN.mont(num);
  22238. var tinv = new BN(2).toRed(red).redInvm();
  22239. var ntinv = tinv.redNeg();
  22240. var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
  22241. var l1 = ntinv.redAdd(s).fromRed();
  22242. var l2 = ntinv.redSub(s).fromRed();
  22243. return [ l1, l2 ];
  22244. };
  22245. ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
  22246. // aprxSqrt >= sqrt(this.n)
  22247. var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
  22248. // 3.74
  22249. // Run EGCD, until r(L + 1) < aprxSqrt
  22250. var u = lambda;
  22251. var v = this.n.clone();
  22252. var x1 = new BN(1);
  22253. var y1 = new BN(0);
  22254. var x2 = new BN(0);
  22255. var y2 = new BN(1);
  22256. // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
  22257. var a0;
  22258. var b0;
  22259. // First vector
  22260. var a1;
  22261. var b1;
  22262. // Second vector
  22263. var a2;
  22264. var b2;
  22265. var prevR;
  22266. var i = 0;
  22267. var r;
  22268. var x;
  22269. while (u.cmpn(0) !== 0) {
  22270. var q = v.div(u);
  22271. r = v.sub(q.mul(u));
  22272. x = x2.sub(q.mul(x1));
  22273. var y = y2.sub(q.mul(y1));
  22274. if (!a1 && r.cmp(aprxSqrt) < 0) {
  22275. a0 = prevR.neg();
  22276. b0 = x1;
  22277. a1 = r.neg();
  22278. b1 = x;
  22279. } else if (a1 && ++i === 2) {
  22280. break;
  22281. }
  22282. prevR = r;
  22283. v = u;
  22284. u = r;
  22285. x2 = x1;
  22286. x1 = x;
  22287. y2 = y1;
  22288. y1 = y;
  22289. }
  22290. a2 = r.neg();
  22291. b2 = x;
  22292. var len1 = a1.sqr().add(b1.sqr());
  22293. var len2 = a2.sqr().add(b2.sqr());
  22294. if (len2.cmp(len1) >= 0) {
  22295. a2 = a0;
  22296. b2 = b0;
  22297. }
  22298. // Normalize signs
  22299. if (a1.negative) {
  22300. a1 = a1.neg();
  22301. b1 = b1.neg();
  22302. }
  22303. if (a2.negative) {
  22304. a2 = a2.neg();
  22305. b2 = b2.neg();
  22306. }
  22307. return [
  22308. { a: a1, b: b1 },
  22309. { a: a2, b: b2 }
  22310. ];
  22311. };
  22312. ShortCurve.prototype._endoSplit = function _endoSplit(k) {
  22313. var basis = this.endo.basis;
  22314. var v1 = basis[0];
  22315. var v2 = basis[1];
  22316. var c1 = v2.b.mul(k).divRound(this.n);
  22317. var c2 = v1.b.neg().mul(k).divRound(this.n);
  22318. var p1 = c1.mul(v1.a);
  22319. var p2 = c2.mul(v2.a);
  22320. var q1 = c1.mul(v1.b);
  22321. var q2 = c2.mul(v2.b);
  22322. // Calculate answer
  22323. var k1 = k.sub(p1).sub(p2);
  22324. var k2 = q1.add(q2).neg();
  22325. return { k1: k1, k2: k2 };
  22326. };
  22327. ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
  22328. x = new BN(x, 16);
  22329. if (!x.red)
  22330. x = x.toRed(this.red);
  22331. var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
  22332. var y = y2.redSqrt();
  22333. if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
  22334. throw new Error('invalid point');
  22335. // XXX Is there any way to tell if the number is odd without converting it
  22336. // to non-red form?
  22337. var isOdd = y.fromRed().isOdd();
  22338. if (odd && !isOdd || !odd && isOdd)
  22339. y = y.redNeg();
  22340. return this.point(x, y);
  22341. };
  22342. ShortCurve.prototype.validate = function validate(point) {
  22343. if (point.inf)
  22344. return true;
  22345. var x = point.x;
  22346. var y = point.y;
  22347. var ax = this.a.redMul(x);
  22348. var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
  22349. return y.redSqr().redISub(rhs).cmpn(0) === 0;
  22350. };
  22351. ShortCurve.prototype._endoWnafMulAdd =
  22352. function _endoWnafMulAdd(points, coeffs, jacobianResult) {
  22353. var npoints = this._endoWnafT1;
  22354. var ncoeffs = this._endoWnafT2;
  22355. for (var i = 0; i < points.length; i++) {
  22356. var split = this._endoSplit(coeffs[i]);
  22357. var p = points[i];
  22358. var beta = p._getBeta();
  22359. if (split.k1.negative) {
  22360. split.k1.ineg();
  22361. p = p.neg(true);
  22362. }
  22363. if (split.k2.negative) {
  22364. split.k2.ineg();
  22365. beta = beta.neg(true);
  22366. }
  22367. npoints[i * 2] = p;
  22368. npoints[i * 2 + 1] = beta;
  22369. ncoeffs[i * 2] = split.k1;
  22370. ncoeffs[i * 2 + 1] = split.k2;
  22371. }
  22372. var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);
  22373. // Clean-up references to points and coefficients
  22374. for (var j = 0; j < i * 2; j++) {
  22375. npoints[j] = null;
  22376. ncoeffs[j] = null;
  22377. }
  22378. return res;
  22379. };
  22380. function Point(curve, x, y, isRed) {
  22381. Base.BasePoint.call(this, curve, 'affine');
  22382. if (x === null && y === null) {
  22383. this.x = null;
  22384. this.y = null;
  22385. this.inf = true;
  22386. } else {
  22387. this.x = new BN(x, 16);
  22388. this.y = new BN(y, 16);
  22389. // Force redgomery representation when loading from JSON
  22390. if (isRed) {
  22391. this.x.forceRed(this.curve.red);
  22392. this.y.forceRed(this.curve.red);
  22393. }
  22394. if (!this.x.red)
  22395. this.x = this.x.toRed(this.curve.red);
  22396. if (!this.y.red)
  22397. this.y = this.y.toRed(this.curve.red);
  22398. this.inf = false;
  22399. }
  22400. }
  22401. inherits(Point, Base.BasePoint);
  22402. ShortCurve.prototype.point = function point(x, y, isRed) {
  22403. return new Point(this, x, y, isRed);
  22404. };
  22405. ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
  22406. return Point.fromJSON(this, obj, red);
  22407. };
  22408. Point.prototype._getBeta = function _getBeta() {
  22409. if (!this.curve.endo)
  22410. return;
  22411. var pre = this.precomputed;
  22412. if (pre && pre.beta)
  22413. return pre.beta;
  22414. var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
  22415. if (pre) {
  22416. var curve = this.curve;
  22417. var endoMul = function(p) {
  22418. return curve.point(p.x.redMul(curve.endo.beta), p.y);
  22419. };
  22420. pre.beta = beta;
  22421. beta.precomputed = {
  22422. beta: null,
  22423. naf: pre.naf && {
  22424. wnd: pre.naf.wnd,
  22425. points: pre.naf.points.map(endoMul)
  22426. },
  22427. doubles: pre.doubles && {
  22428. step: pre.doubles.step,
  22429. points: pre.doubles.points.map(endoMul)
  22430. }
  22431. };
  22432. }
  22433. return beta;
  22434. };
  22435. Point.prototype.toJSON = function toJSON() {
  22436. if (!this.precomputed)
  22437. return [ this.x, this.y ];
  22438. return [ this.x, this.y, this.precomputed && {
  22439. doubles: this.precomputed.doubles && {
  22440. step: this.precomputed.doubles.step,
  22441. points: this.precomputed.doubles.points.slice(1)
  22442. },
  22443. naf: this.precomputed.naf && {
  22444. wnd: this.precomputed.naf.wnd,
  22445. points: this.precomputed.naf.points.slice(1)
  22446. }
  22447. } ];
  22448. };
  22449. Point.fromJSON = function fromJSON(curve, obj, red) {
  22450. if (typeof obj === 'string')
  22451. obj = JSON.parse(obj);
  22452. var res = curve.point(obj[0], obj[1], red);
  22453. if (!obj[2])
  22454. return res;
  22455. function obj2point(obj) {
  22456. return curve.point(obj[0], obj[1], red);
  22457. }
  22458. var pre = obj[2];
  22459. res.precomputed = {
  22460. beta: null,
  22461. doubles: pre.doubles && {
  22462. step: pre.doubles.step,
  22463. points: [ res ].concat(pre.doubles.points.map(obj2point))
  22464. },
  22465. naf: pre.naf && {
  22466. wnd: pre.naf.wnd,
  22467. points: [ res ].concat(pre.naf.points.map(obj2point))
  22468. }
  22469. };
  22470. return res;
  22471. };
  22472. Point.prototype.inspect = function inspect() {
  22473. if (this.isInfinity())
  22474. return '<EC Point Infinity>';
  22475. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  22476. ' y: ' + this.y.fromRed().toString(16, 2) + '>';
  22477. };
  22478. Point.prototype.isInfinity = function isInfinity() {
  22479. return this.inf;
  22480. };
  22481. Point.prototype.add = function add(p) {
  22482. // O + P = P
  22483. if (this.inf)
  22484. return p;
  22485. // P + O = P
  22486. if (p.inf)
  22487. return this;
  22488. // P + P = 2P
  22489. if (this.eq(p))
  22490. return this.dbl();
  22491. // P + (-P) = O
  22492. if (this.neg().eq(p))
  22493. return this.curve.point(null, null);
  22494. // P + Q = O
  22495. if (this.x.cmp(p.x) === 0)
  22496. return this.curve.point(null, null);
  22497. var c = this.y.redSub(p.y);
  22498. if (c.cmpn(0) !== 0)
  22499. c = c.redMul(this.x.redSub(p.x).redInvm());
  22500. var nx = c.redSqr().redISub(this.x).redISub(p.x);
  22501. var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
  22502. return this.curve.point(nx, ny);
  22503. };
  22504. Point.prototype.dbl = function dbl() {
  22505. if (this.inf)
  22506. return this;
  22507. // 2P = O
  22508. var ys1 = this.y.redAdd(this.y);
  22509. if (ys1.cmpn(0) === 0)
  22510. return this.curve.point(null, null);
  22511. var a = this.curve.a;
  22512. var x2 = this.x.redSqr();
  22513. var dyinv = ys1.redInvm();
  22514. var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
  22515. var nx = c.redSqr().redISub(this.x.redAdd(this.x));
  22516. var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
  22517. return this.curve.point(nx, ny);
  22518. };
  22519. Point.prototype.getX = function getX() {
  22520. return this.x.fromRed();
  22521. };
  22522. Point.prototype.getY = function getY() {
  22523. return this.y.fromRed();
  22524. };
  22525. Point.prototype.mul = function mul(k) {
  22526. k = new BN(k, 16);
  22527. if (this.isInfinity())
  22528. return this;
  22529. else if (this._hasDoubles(k))
  22530. return this.curve._fixedNafMul(this, k);
  22531. else if (this.curve.endo)
  22532. return this.curve._endoWnafMulAdd([ this ], [ k ]);
  22533. else
  22534. return this.curve._wnafMul(this, k);
  22535. };
  22536. Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
  22537. var points = [ this, p2 ];
  22538. var coeffs = [ k1, k2 ];
  22539. if (this.curve.endo)
  22540. return this.curve._endoWnafMulAdd(points, coeffs);
  22541. else
  22542. return this.curve._wnafMulAdd(1, points, coeffs, 2);
  22543. };
  22544. Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
  22545. var points = [ this, p2 ];
  22546. var coeffs = [ k1, k2 ];
  22547. if (this.curve.endo)
  22548. return this.curve._endoWnafMulAdd(points, coeffs, true);
  22549. else
  22550. return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
  22551. };
  22552. Point.prototype.eq = function eq(p) {
  22553. return this === p ||
  22554. this.inf === p.inf &&
  22555. (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
  22556. };
  22557. Point.prototype.neg = function neg(_precompute) {
  22558. if (this.inf)
  22559. return this;
  22560. var res = this.curve.point(this.x, this.y.redNeg());
  22561. if (_precompute && this.precomputed) {
  22562. var pre = this.precomputed;
  22563. var negate = function(p) {
  22564. return p.neg();
  22565. };
  22566. res.precomputed = {
  22567. naf: pre.naf && {
  22568. wnd: pre.naf.wnd,
  22569. points: pre.naf.points.map(negate)
  22570. },
  22571. doubles: pre.doubles && {
  22572. step: pre.doubles.step,
  22573. points: pre.doubles.points.map(negate)
  22574. }
  22575. };
  22576. }
  22577. return res;
  22578. };
  22579. Point.prototype.toJ = function toJ() {
  22580. if (this.inf)
  22581. return this.curve.jpoint(null, null, null);
  22582. var res = this.curve.jpoint(this.x, this.y, this.curve.one);
  22583. return res;
  22584. };
  22585. function JPoint(curve, x, y, z) {
  22586. Base.BasePoint.call(this, curve, 'jacobian');
  22587. if (x === null && y === null && z === null) {
  22588. this.x = this.curve.one;
  22589. this.y = this.curve.one;
  22590. this.z = new BN(0);
  22591. } else {
  22592. this.x = new BN(x, 16);
  22593. this.y = new BN(y, 16);
  22594. this.z = new BN(z, 16);
  22595. }
  22596. if (!this.x.red)
  22597. this.x = this.x.toRed(this.curve.red);
  22598. if (!this.y.red)
  22599. this.y = this.y.toRed(this.curve.red);
  22600. if (!this.z.red)
  22601. this.z = this.z.toRed(this.curve.red);
  22602. this.zOne = this.z === this.curve.one;
  22603. }
  22604. inherits(JPoint, Base.BasePoint);
  22605. ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
  22606. return new JPoint(this, x, y, z);
  22607. };
  22608. JPoint.prototype.toP = function toP() {
  22609. if (this.isInfinity())
  22610. return this.curve.point(null, null);
  22611. var zinv = this.z.redInvm();
  22612. var zinv2 = zinv.redSqr();
  22613. var ax = this.x.redMul(zinv2);
  22614. var ay = this.y.redMul(zinv2).redMul(zinv);
  22615. return this.curve.point(ax, ay);
  22616. };
  22617. JPoint.prototype.neg = function neg() {
  22618. return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
  22619. };
  22620. JPoint.prototype.add = function add(p) {
  22621. // O + P = P
  22622. if (this.isInfinity())
  22623. return p;
  22624. // P + O = P
  22625. if (p.isInfinity())
  22626. return this;
  22627. // 12M + 4S + 7A
  22628. var pz2 = p.z.redSqr();
  22629. var z2 = this.z.redSqr();
  22630. var u1 = this.x.redMul(pz2);
  22631. var u2 = p.x.redMul(z2);
  22632. var s1 = this.y.redMul(pz2.redMul(p.z));
  22633. var s2 = p.y.redMul(z2.redMul(this.z));
  22634. var h = u1.redSub(u2);
  22635. var r = s1.redSub(s2);
  22636. if (h.cmpn(0) === 0) {
  22637. if (r.cmpn(0) !== 0)
  22638. return this.curve.jpoint(null, null, null);
  22639. else
  22640. return this.dbl();
  22641. }
  22642. var h2 = h.redSqr();
  22643. var h3 = h2.redMul(h);
  22644. var v = u1.redMul(h2);
  22645. var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
  22646. var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
  22647. var nz = this.z.redMul(p.z).redMul(h);
  22648. return this.curve.jpoint(nx, ny, nz);
  22649. };
  22650. JPoint.prototype.mixedAdd = function mixedAdd(p) {
  22651. // O + P = P
  22652. if (this.isInfinity())
  22653. return p.toJ();
  22654. // P + O = P
  22655. if (p.isInfinity())
  22656. return this;
  22657. // 8M + 3S + 7A
  22658. var z2 = this.z.redSqr();
  22659. var u1 = this.x;
  22660. var u2 = p.x.redMul(z2);
  22661. var s1 = this.y;
  22662. var s2 = p.y.redMul(z2).redMul(this.z);
  22663. var h = u1.redSub(u2);
  22664. var r = s1.redSub(s2);
  22665. if (h.cmpn(0) === 0) {
  22666. if (r.cmpn(0) !== 0)
  22667. return this.curve.jpoint(null, null, null);
  22668. else
  22669. return this.dbl();
  22670. }
  22671. var h2 = h.redSqr();
  22672. var h3 = h2.redMul(h);
  22673. var v = u1.redMul(h2);
  22674. var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
  22675. var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
  22676. var nz = this.z.redMul(h);
  22677. return this.curve.jpoint(nx, ny, nz);
  22678. };
  22679. JPoint.prototype.dblp = function dblp(pow) {
  22680. if (pow === 0)
  22681. return this;
  22682. if (this.isInfinity())
  22683. return this;
  22684. if (!pow)
  22685. return this.dbl();
  22686. if (this.curve.zeroA || this.curve.threeA) {
  22687. var r = this;
  22688. for (var i = 0; i < pow; i++)
  22689. r = r.dbl();
  22690. return r;
  22691. }
  22692. // 1M + 2S + 1A + N * (4S + 5M + 8A)
  22693. // N = 1 => 6M + 6S + 9A
  22694. var a = this.curve.a;
  22695. var tinv = this.curve.tinv;
  22696. var jx = this.x;
  22697. var jy = this.y;
  22698. var jz = this.z;
  22699. var jz4 = jz.redSqr().redSqr();
  22700. // Reuse results
  22701. var jyd = jy.redAdd(jy);
  22702. for (var i = 0; i < pow; i++) {
  22703. var jx2 = jx.redSqr();
  22704. var jyd2 = jyd.redSqr();
  22705. var jyd4 = jyd2.redSqr();
  22706. var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
  22707. var t1 = jx.redMul(jyd2);
  22708. var nx = c.redSqr().redISub(t1.redAdd(t1));
  22709. var t2 = t1.redISub(nx);
  22710. var dny = c.redMul(t2);
  22711. dny = dny.redIAdd(dny).redISub(jyd4);
  22712. var nz = jyd.redMul(jz);
  22713. if (i + 1 < pow)
  22714. jz4 = jz4.redMul(jyd4);
  22715. jx = nx;
  22716. jz = nz;
  22717. jyd = dny;
  22718. }
  22719. return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
  22720. };
  22721. JPoint.prototype.dbl = function dbl() {
  22722. if (this.isInfinity())
  22723. return this;
  22724. if (this.curve.zeroA)
  22725. return this._zeroDbl();
  22726. else if (this.curve.threeA)
  22727. return this._threeDbl();
  22728. else
  22729. return this._dbl();
  22730. };
  22731. JPoint.prototype._zeroDbl = function _zeroDbl() {
  22732. var nx;
  22733. var ny;
  22734. var nz;
  22735. // Z = 1
  22736. if (this.zOne) {
  22737. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
  22738. // #doubling-mdbl-2007-bl
  22739. // 1M + 5S + 14A
  22740. // XX = X1^2
  22741. var xx = this.x.redSqr();
  22742. // YY = Y1^2
  22743. var yy = this.y.redSqr();
  22744. // YYYY = YY^2
  22745. var yyyy = yy.redSqr();
  22746. // S = 2 * ((X1 + YY)^2 - XX - YYYY)
  22747. var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  22748. s = s.redIAdd(s);
  22749. // M = 3 * XX + a; a = 0
  22750. var m = xx.redAdd(xx).redIAdd(xx);
  22751. // T = M ^ 2 - 2*S
  22752. var t = m.redSqr().redISub(s).redISub(s);
  22753. // 8 * YYYY
  22754. var yyyy8 = yyyy.redIAdd(yyyy);
  22755. yyyy8 = yyyy8.redIAdd(yyyy8);
  22756. yyyy8 = yyyy8.redIAdd(yyyy8);
  22757. // X3 = T
  22758. nx = t;
  22759. // Y3 = M * (S - T) - 8 * YYYY
  22760. ny = m.redMul(s.redISub(t)).redISub(yyyy8);
  22761. // Z3 = 2*Y1
  22762. nz = this.y.redAdd(this.y);
  22763. } else {
  22764. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
  22765. // #doubling-dbl-2009-l
  22766. // 2M + 5S + 13A
  22767. // A = X1^2
  22768. var a = this.x.redSqr();
  22769. // B = Y1^2
  22770. var b = this.y.redSqr();
  22771. // C = B^2
  22772. var c = b.redSqr();
  22773. // D = 2 * ((X1 + B)^2 - A - C)
  22774. var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
  22775. d = d.redIAdd(d);
  22776. // E = 3 * A
  22777. var e = a.redAdd(a).redIAdd(a);
  22778. // F = E^2
  22779. var f = e.redSqr();
  22780. // 8 * C
  22781. var c8 = c.redIAdd(c);
  22782. c8 = c8.redIAdd(c8);
  22783. c8 = c8.redIAdd(c8);
  22784. // X3 = F - 2 * D
  22785. nx = f.redISub(d).redISub(d);
  22786. // Y3 = E * (D - X3) - 8 * C
  22787. ny = e.redMul(d.redISub(nx)).redISub(c8);
  22788. // Z3 = 2 * Y1 * Z1
  22789. nz = this.y.redMul(this.z);
  22790. nz = nz.redIAdd(nz);
  22791. }
  22792. return this.curve.jpoint(nx, ny, nz);
  22793. };
  22794. JPoint.prototype._threeDbl = function _threeDbl() {
  22795. var nx;
  22796. var ny;
  22797. var nz;
  22798. // Z = 1
  22799. if (this.zOne) {
  22800. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
  22801. // #doubling-mdbl-2007-bl
  22802. // 1M + 5S + 15A
  22803. // XX = X1^2
  22804. var xx = this.x.redSqr();
  22805. // YY = Y1^2
  22806. var yy = this.y.redSqr();
  22807. // YYYY = YY^2
  22808. var yyyy = yy.redSqr();
  22809. // S = 2 * ((X1 + YY)^2 - XX - YYYY)
  22810. var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  22811. s = s.redIAdd(s);
  22812. // M = 3 * XX + a
  22813. var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);
  22814. // T = M^2 - 2 * S
  22815. var t = m.redSqr().redISub(s).redISub(s);
  22816. // X3 = T
  22817. nx = t;
  22818. // Y3 = M * (S - T) - 8 * YYYY
  22819. var yyyy8 = yyyy.redIAdd(yyyy);
  22820. yyyy8 = yyyy8.redIAdd(yyyy8);
  22821. yyyy8 = yyyy8.redIAdd(yyyy8);
  22822. ny = m.redMul(s.redISub(t)).redISub(yyyy8);
  22823. // Z3 = 2 * Y1
  22824. nz = this.y.redAdd(this.y);
  22825. } else {
  22826. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
  22827. // 3M + 5S
  22828. // delta = Z1^2
  22829. var delta = this.z.redSqr();
  22830. // gamma = Y1^2
  22831. var gamma = this.y.redSqr();
  22832. // beta = X1 * gamma
  22833. var beta = this.x.redMul(gamma);
  22834. // alpha = 3 * (X1 - delta) * (X1 + delta)
  22835. var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
  22836. alpha = alpha.redAdd(alpha).redIAdd(alpha);
  22837. // X3 = alpha^2 - 8 * beta
  22838. var beta4 = beta.redIAdd(beta);
  22839. beta4 = beta4.redIAdd(beta4);
  22840. var beta8 = beta4.redAdd(beta4);
  22841. nx = alpha.redSqr().redISub(beta8);
  22842. // Z3 = (Y1 + Z1)^2 - gamma - delta
  22843. nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
  22844. // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
  22845. var ggamma8 = gamma.redSqr();
  22846. ggamma8 = ggamma8.redIAdd(ggamma8);
  22847. ggamma8 = ggamma8.redIAdd(ggamma8);
  22848. ggamma8 = ggamma8.redIAdd(ggamma8);
  22849. ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
  22850. }
  22851. return this.curve.jpoint(nx, ny, nz);
  22852. };
  22853. JPoint.prototype._dbl = function _dbl() {
  22854. var a = this.curve.a;
  22855. // 4M + 6S + 10A
  22856. var jx = this.x;
  22857. var jy = this.y;
  22858. var jz = this.z;
  22859. var jz4 = jz.redSqr().redSqr();
  22860. var jx2 = jx.redSqr();
  22861. var jy2 = jy.redSqr();
  22862. var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
  22863. var jxd4 = jx.redAdd(jx);
  22864. jxd4 = jxd4.redIAdd(jxd4);
  22865. var t1 = jxd4.redMul(jy2);
  22866. var nx = c.redSqr().redISub(t1.redAdd(t1));
  22867. var t2 = t1.redISub(nx);
  22868. var jyd8 = jy2.redSqr();
  22869. jyd8 = jyd8.redIAdd(jyd8);
  22870. jyd8 = jyd8.redIAdd(jyd8);
  22871. jyd8 = jyd8.redIAdd(jyd8);
  22872. var ny = c.redMul(t2).redISub(jyd8);
  22873. var nz = jy.redAdd(jy).redMul(jz);
  22874. return this.curve.jpoint(nx, ny, nz);
  22875. };
  22876. JPoint.prototype.trpl = function trpl() {
  22877. if (!this.curve.zeroA)
  22878. return this.dbl().add(this);
  22879. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
  22880. // 5M + 10S + ...
  22881. // XX = X1^2
  22882. var xx = this.x.redSqr();
  22883. // YY = Y1^2
  22884. var yy = this.y.redSqr();
  22885. // ZZ = Z1^2
  22886. var zz = this.z.redSqr();
  22887. // YYYY = YY^2
  22888. var yyyy = yy.redSqr();
  22889. // M = 3 * XX + a * ZZ2; a = 0
  22890. var m = xx.redAdd(xx).redIAdd(xx);
  22891. // MM = M^2
  22892. var mm = m.redSqr();
  22893. // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
  22894. var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  22895. e = e.redIAdd(e);
  22896. e = e.redAdd(e).redIAdd(e);
  22897. e = e.redISub(mm);
  22898. // EE = E^2
  22899. var ee = e.redSqr();
  22900. // T = 16*YYYY
  22901. var t = yyyy.redIAdd(yyyy);
  22902. t = t.redIAdd(t);
  22903. t = t.redIAdd(t);
  22904. t = t.redIAdd(t);
  22905. // U = (M + E)^2 - MM - EE - T
  22906. var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);
  22907. // X3 = 4 * (X1 * EE - 4 * YY * U)
  22908. var yyu4 = yy.redMul(u);
  22909. yyu4 = yyu4.redIAdd(yyu4);
  22910. yyu4 = yyu4.redIAdd(yyu4);
  22911. var nx = this.x.redMul(ee).redISub(yyu4);
  22912. nx = nx.redIAdd(nx);
  22913. nx = nx.redIAdd(nx);
  22914. // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
  22915. var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
  22916. ny = ny.redIAdd(ny);
  22917. ny = ny.redIAdd(ny);
  22918. ny = ny.redIAdd(ny);
  22919. // Z3 = (Z1 + E)^2 - ZZ - EE
  22920. var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
  22921. return this.curve.jpoint(nx, ny, nz);
  22922. };
  22923. JPoint.prototype.mul = function mul(k, kbase) {
  22924. k = new BN(k, kbase);
  22925. return this.curve._wnafMul(this, k);
  22926. };
  22927. JPoint.prototype.eq = function eq(p) {
  22928. if (p.type === 'affine')
  22929. return this.eq(p.toJ());
  22930. if (this === p)
  22931. return true;
  22932. // x1 * z2^2 == x2 * z1^2
  22933. var z2 = this.z.redSqr();
  22934. var pz2 = p.z.redSqr();
  22935. if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
  22936. return false;
  22937. // y1 * z2^3 == y2 * z1^3
  22938. var z3 = z2.redMul(this.z);
  22939. var pz3 = pz2.redMul(p.z);
  22940. return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
  22941. };
  22942. JPoint.prototype.eqXToP = function eqXToP(x) {
  22943. var zs = this.z.redSqr();
  22944. var rx = x.toRed(this.curve.red).redMul(zs);
  22945. if (this.x.cmp(rx) === 0)
  22946. return true;
  22947. var xc = x.clone();
  22948. var t = this.curve.redN.redMul(zs);
  22949. for (;;) {
  22950. xc.iadd(this.curve.n);
  22951. if (xc.cmp(this.curve.p) >= 0)
  22952. return false;
  22953. rx.redIAdd(t);
  22954. if (this.x.cmp(rx) === 0)
  22955. return true;
  22956. }
  22957. };
  22958. JPoint.prototype.inspect = function inspect() {
  22959. if (this.isInfinity())
  22960. return '<EC JPoint Infinity>';
  22961. return '<EC JPoint x: ' + this.x.toString(16, 2) +
  22962. ' y: ' + this.y.toString(16, 2) +
  22963. ' z: ' + this.z.toString(16, 2) + '>';
  22964. };
  22965. JPoint.prototype.isInfinity = function isInfinity() {
  22966. // XXX This code assumes that zero is always zero in red
  22967. return this.z.cmpn(0) === 0;
  22968. };
  22969. /***/ }),
  22970. /* 214 */
  22971. /*!**********************************************************!*\
  22972. !*** ./node_modules/elliptic/lib/elliptic/curve/mont.js ***!
  22973. \**********************************************************/
  22974. /*! no static exports found */
  22975. /***/ (function(module, exports, __webpack_require__) {
  22976. "use strict";
  22977. var BN = __webpack_require__(/*! bn.js */ 196);
  22978. var inherits = __webpack_require__(/*! inherits */ 120);
  22979. var Base = __webpack_require__(/*! ./base */ 212);
  22980. var utils = __webpack_require__(/*! ../utils */ 209);
  22981. function MontCurve(conf) {
  22982. Base.call(this, 'mont', conf);
  22983. this.a = new BN(conf.a, 16).toRed(this.red);
  22984. this.b = new BN(conf.b, 16).toRed(this.red);
  22985. this.i4 = new BN(4).toRed(this.red).redInvm();
  22986. this.two = new BN(2).toRed(this.red);
  22987. this.a24 = this.i4.redMul(this.a.redAdd(this.two));
  22988. }
  22989. inherits(MontCurve, Base);
  22990. module.exports = MontCurve;
  22991. MontCurve.prototype.validate = function validate(point) {
  22992. var x = point.normalize().x;
  22993. var x2 = x.redSqr();
  22994. var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
  22995. var y = rhs.redSqrt();
  22996. return y.redSqr().cmp(rhs) === 0;
  22997. };
  22998. function Point(curve, x, z) {
  22999. Base.BasePoint.call(this, curve, 'projective');
  23000. if (x === null && z === null) {
  23001. this.x = this.curve.one;
  23002. this.z = this.curve.zero;
  23003. } else {
  23004. this.x = new BN(x, 16);
  23005. this.z = new BN(z, 16);
  23006. if (!this.x.red)
  23007. this.x = this.x.toRed(this.curve.red);
  23008. if (!this.z.red)
  23009. this.z = this.z.toRed(this.curve.red);
  23010. }
  23011. }
  23012. inherits(Point, Base.BasePoint);
  23013. MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
  23014. return this.point(utils.toArray(bytes, enc), 1);
  23015. };
  23016. MontCurve.prototype.point = function point(x, z) {
  23017. return new Point(this, x, z);
  23018. };
  23019. MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
  23020. return Point.fromJSON(this, obj);
  23021. };
  23022. Point.prototype.precompute = function precompute() {
  23023. // No-op
  23024. };
  23025. Point.prototype._encode = function _encode() {
  23026. return this.getX().toArray('be', this.curve.p.byteLength());
  23027. };
  23028. Point.fromJSON = function fromJSON(curve, obj) {
  23029. return new Point(curve, obj[0], obj[1] || curve.one);
  23030. };
  23031. Point.prototype.inspect = function inspect() {
  23032. if (this.isInfinity())
  23033. return '<EC Point Infinity>';
  23034. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  23035. ' z: ' + this.z.fromRed().toString(16, 2) + '>';
  23036. };
  23037. Point.prototype.isInfinity = function isInfinity() {
  23038. // XXX This code assumes that zero is always zero in red
  23039. return this.z.cmpn(0) === 0;
  23040. };
  23041. Point.prototype.dbl = function dbl() {
  23042. // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
  23043. // 2M + 2S + 4A
  23044. // A = X1 + Z1
  23045. var a = this.x.redAdd(this.z);
  23046. // AA = A^2
  23047. var aa = a.redSqr();
  23048. // B = X1 - Z1
  23049. var b = this.x.redSub(this.z);
  23050. // BB = B^2
  23051. var bb = b.redSqr();
  23052. // C = AA - BB
  23053. var c = aa.redSub(bb);
  23054. // X3 = AA * BB
  23055. var nx = aa.redMul(bb);
  23056. // Z3 = C * (BB + A24 * C)
  23057. var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
  23058. return this.curve.point(nx, nz);
  23059. };
  23060. Point.prototype.add = function add() {
  23061. throw new Error('Not supported on Montgomery curve');
  23062. };
  23063. Point.prototype.diffAdd = function diffAdd(p, diff) {
  23064. // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
  23065. // 4M + 2S + 6A
  23066. // A = X2 + Z2
  23067. var a = this.x.redAdd(this.z);
  23068. // B = X2 - Z2
  23069. var b = this.x.redSub(this.z);
  23070. // C = X3 + Z3
  23071. var c = p.x.redAdd(p.z);
  23072. // D = X3 - Z3
  23073. var d = p.x.redSub(p.z);
  23074. // DA = D * A
  23075. var da = d.redMul(a);
  23076. // CB = C * B
  23077. var cb = c.redMul(b);
  23078. // X5 = Z1 * (DA + CB)^2
  23079. var nx = diff.z.redMul(da.redAdd(cb).redSqr());
  23080. // Z5 = X1 * (DA - CB)^2
  23081. var nz = diff.x.redMul(da.redISub(cb).redSqr());
  23082. return this.curve.point(nx, nz);
  23083. };
  23084. Point.prototype.mul = function mul(k) {
  23085. var t = k.clone();
  23086. var a = this; // (N / 2) * Q + Q
  23087. var b = this.curve.point(null, null); // (N / 2) * Q
  23088. var c = this; // Q
  23089. for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
  23090. bits.push(t.andln(1));
  23091. for (var i = bits.length - 1; i >= 0; i--) {
  23092. if (bits[i] === 0) {
  23093. // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
  23094. a = a.diffAdd(b, c);
  23095. // N * Q = 2 * ((N / 2) * Q + Q))
  23096. b = b.dbl();
  23097. } else {
  23098. // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
  23099. b = a.diffAdd(b, c);
  23100. // N * Q + Q = 2 * ((N / 2) * Q + Q)
  23101. a = a.dbl();
  23102. }
  23103. }
  23104. return b;
  23105. };
  23106. Point.prototype.mulAdd = function mulAdd() {
  23107. throw new Error('Not supported on Montgomery curve');
  23108. };
  23109. Point.prototype.jumlAdd = function jumlAdd() {
  23110. throw new Error('Not supported on Montgomery curve');
  23111. };
  23112. Point.prototype.eq = function eq(other) {
  23113. return this.getX().cmp(other.getX()) === 0;
  23114. };
  23115. Point.prototype.normalize = function normalize() {
  23116. this.x = this.x.redMul(this.z.redInvm());
  23117. this.z = this.curve.one;
  23118. return this;
  23119. };
  23120. Point.prototype.getX = function getX() {
  23121. // Normalize coordinates
  23122. this.normalize();
  23123. return this.x.fromRed();
  23124. };
  23125. /***/ }),
  23126. /* 215 */
  23127. /*!*************************************************************!*\
  23128. !*** ./node_modules/elliptic/lib/elliptic/curve/edwards.js ***!
  23129. \*************************************************************/
  23130. /*! no static exports found */
  23131. /***/ (function(module, exports, __webpack_require__) {
  23132. "use strict";
  23133. var utils = __webpack_require__(/*! ../utils */ 209);
  23134. var BN = __webpack_require__(/*! bn.js */ 196);
  23135. var inherits = __webpack_require__(/*! inherits */ 120);
  23136. var Base = __webpack_require__(/*! ./base */ 212);
  23137. var assert = utils.assert;
  23138. function EdwardsCurve(conf) {
  23139. // NOTE: Important as we are creating point in Base.call()
  23140. this.twisted = (conf.a | 0) !== 1;
  23141. this.mOneA = this.twisted && (conf.a | 0) === -1;
  23142. this.extended = this.mOneA;
  23143. Base.call(this, 'edwards', conf);
  23144. this.a = new BN(conf.a, 16).umod(this.red.m);
  23145. this.a = this.a.toRed(this.red);
  23146. this.c = new BN(conf.c, 16).toRed(this.red);
  23147. this.c2 = this.c.redSqr();
  23148. this.d = new BN(conf.d, 16).toRed(this.red);
  23149. this.dd = this.d.redAdd(this.d);
  23150. assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
  23151. this.oneC = (conf.c | 0) === 1;
  23152. }
  23153. inherits(EdwardsCurve, Base);
  23154. module.exports = EdwardsCurve;
  23155. EdwardsCurve.prototype._mulA = function _mulA(num) {
  23156. if (this.mOneA)
  23157. return num.redNeg();
  23158. else
  23159. return this.a.redMul(num);
  23160. };
  23161. EdwardsCurve.prototype._mulC = function _mulC(num) {
  23162. if (this.oneC)
  23163. return num;
  23164. else
  23165. return this.c.redMul(num);
  23166. };
  23167. // Just for compatibility with Short curve
  23168. EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
  23169. return this.point(x, y, z, t);
  23170. };
  23171. EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
  23172. x = new BN(x, 16);
  23173. if (!x.red)
  23174. x = x.toRed(this.red);
  23175. var x2 = x.redSqr();
  23176. var rhs = this.c2.redSub(this.a.redMul(x2));
  23177. var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
  23178. var y2 = rhs.redMul(lhs.redInvm());
  23179. var y = y2.redSqrt();
  23180. if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
  23181. throw new Error('invalid point');
  23182. var isOdd = y.fromRed().isOdd();
  23183. if (odd && !isOdd || !odd && isOdd)
  23184. y = y.redNeg();
  23185. return this.point(x, y);
  23186. };
  23187. EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
  23188. y = new BN(y, 16);
  23189. if (!y.red)
  23190. y = y.toRed(this.red);
  23191. // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)
  23192. var y2 = y.redSqr();
  23193. var lhs = y2.redSub(this.c2);
  23194. var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);
  23195. var x2 = lhs.redMul(rhs.redInvm());
  23196. if (x2.cmp(this.zero) === 0) {
  23197. if (odd)
  23198. throw new Error('invalid point');
  23199. else
  23200. return this.point(this.zero, y);
  23201. }
  23202. var x = x2.redSqrt();
  23203. if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
  23204. throw new Error('invalid point');
  23205. if (x.fromRed().isOdd() !== odd)
  23206. x = x.redNeg();
  23207. return this.point(x, y);
  23208. };
  23209. EdwardsCurve.prototype.validate = function validate(point) {
  23210. if (point.isInfinity())
  23211. return true;
  23212. // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
  23213. point.normalize();
  23214. var x2 = point.x.redSqr();
  23215. var y2 = point.y.redSqr();
  23216. var lhs = x2.redMul(this.a).redAdd(y2);
  23217. var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
  23218. return lhs.cmp(rhs) === 0;
  23219. };
  23220. function Point(curve, x, y, z, t) {
  23221. Base.BasePoint.call(this, curve, 'projective');
  23222. if (x === null && y === null && z === null) {
  23223. this.x = this.curve.zero;
  23224. this.y = this.curve.one;
  23225. this.z = this.curve.one;
  23226. this.t = this.curve.zero;
  23227. this.zOne = true;
  23228. } else {
  23229. this.x = new BN(x, 16);
  23230. this.y = new BN(y, 16);
  23231. this.z = z ? new BN(z, 16) : this.curve.one;
  23232. this.t = t && new BN(t, 16);
  23233. if (!this.x.red)
  23234. this.x = this.x.toRed(this.curve.red);
  23235. if (!this.y.red)
  23236. this.y = this.y.toRed(this.curve.red);
  23237. if (!this.z.red)
  23238. this.z = this.z.toRed(this.curve.red);
  23239. if (this.t && !this.t.red)
  23240. this.t = this.t.toRed(this.curve.red);
  23241. this.zOne = this.z === this.curve.one;
  23242. // Use extended coordinates
  23243. if (this.curve.extended && !this.t) {
  23244. this.t = this.x.redMul(this.y);
  23245. if (!this.zOne)
  23246. this.t = this.t.redMul(this.z.redInvm());
  23247. }
  23248. }
  23249. }
  23250. inherits(Point, Base.BasePoint);
  23251. EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
  23252. return Point.fromJSON(this, obj);
  23253. };
  23254. EdwardsCurve.prototype.point = function point(x, y, z, t) {
  23255. return new Point(this, x, y, z, t);
  23256. };
  23257. Point.fromJSON = function fromJSON(curve, obj) {
  23258. return new Point(curve, obj[0], obj[1], obj[2]);
  23259. };
  23260. Point.prototype.inspect = function inspect() {
  23261. if (this.isInfinity())
  23262. return '<EC Point Infinity>';
  23263. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  23264. ' y: ' + this.y.fromRed().toString(16, 2) +
  23265. ' z: ' + this.z.fromRed().toString(16, 2) + '>';
  23266. };
  23267. Point.prototype.isInfinity = function isInfinity() {
  23268. // XXX This code assumes that zero is always zero in red
  23269. return this.x.cmpn(0) === 0 &&
  23270. (this.y.cmp(this.z) === 0 ||
  23271. (this.zOne && this.y.cmp(this.curve.c) === 0));
  23272. };
  23273. Point.prototype._extDbl = function _extDbl() {
  23274. // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
  23275. // #doubling-dbl-2008-hwcd
  23276. // 4M + 4S
  23277. // A = X1^2
  23278. var a = this.x.redSqr();
  23279. // B = Y1^2
  23280. var b = this.y.redSqr();
  23281. // C = 2 * Z1^2
  23282. var c = this.z.redSqr();
  23283. c = c.redIAdd(c);
  23284. // D = a * A
  23285. var d = this.curve._mulA(a);
  23286. // E = (X1 + Y1)^2 - A - B
  23287. var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
  23288. // G = D + B
  23289. var g = d.redAdd(b);
  23290. // F = G - C
  23291. var f = g.redSub(c);
  23292. // H = D - B
  23293. var h = d.redSub(b);
  23294. // X3 = E * F
  23295. var nx = e.redMul(f);
  23296. // Y3 = G * H
  23297. var ny = g.redMul(h);
  23298. // T3 = E * H
  23299. var nt = e.redMul(h);
  23300. // Z3 = F * G
  23301. var nz = f.redMul(g);
  23302. return this.curve.point(nx, ny, nz, nt);
  23303. };
  23304. Point.prototype._projDbl = function _projDbl() {
  23305. // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
  23306. // #doubling-dbl-2008-bbjlp
  23307. // #doubling-dbl-2007-bl
  23308. // and others
  23309. // Generally 3M + 4S or 2M + 4S
  23310. // B = (X1 + Y1)^2
  23311. var b = this.x.redAdd(this.y).redSqr();
  23312. // C = X1^2
  23313. var c = this.x.redSqr();
  23314. // D = Y1^2
  23315. var d = this.y.redSqr();
  23316. var nx;
  23317. var ny;
  23318. var nz;
  23319. if (this.curve.twisted) {
  23320. // E = a * C
  23321. var e = this.curve._mulA(c);
  23322. // F = E + D
  23323. var f = e.redAdd(d);
  23324. if (this.zOne) {
  23325. // X3 = (B - C - D) * (F - 2)
  23326. nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
  23327. // Y3 = F * (E - D)
  23328. ny = f.redMul(e.redSub(d));
  23329. // Z3 = F^2 - 2 * F
  23330. nz = f.redSqr().redSub(f).redSub(f);
  23331. } else {
  23332. // H = Z1^2
  23333. var h = this.z.redSqr();
  23334. // J = F - 2 * H
  23335. var j = f.redSub(h).redISub(h);
  23336. // X3 = (B-C-D)*J
  23337. nx = b.redSub(c).redISub(d).redMul(j);
  23338. // Y3 = F * (E - D)
  23339. ny = f.redMul(e.redSub(d));
  23340. // Z3 = F * J
  23341. nz = f.redMul(j);
  23342. }
  23343. } else {
  23344. // E = C + D
  23345. var e = c.redAdd(d);
  23346. // H = (c * Z1)^2
  23347. var h = this.curve._mulC(this.z).redSqr();
  23348. // J = E - 2 * H
  23349. var j = e.redSub(h).redSub(h);
  23350. // X3 = c * (B - E) * J
  23351. nx = this.curve._mulC(b.redISub(e)).redMul(j);
  23352. // Y3 = c * E * (C - D)
  23353. ny = this.curve._mulC(e).redMul(c.redISub(d));
  23354. // Z3 = E * J
  23355. nz = e.redMul(j);
  23356. }
  23357. return this.curve.point(nx, ny, nz);
  23358. };
  23359. Point.prototype.dbl = function dbl() {
  23360. if (this.isInfinity())
  23361. return this;
  23362. // Double in extended coordinates
  23363. if (this.curve.extended)
  23364. return this._extDbl();
  23365. else
  23366. return this._projDbl();
  23367. };
  23368. Point.prototype._extAdd = function _extAdd(p) {
  23369. // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
  23370. // #addition-add-2008-hwcd-3
  23371. // 8M
  23372. // A = (Y1 - X1) * (Y2 - X2)
  23373. var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
  23374. // B = (Y1 + X1) * (Y2 + X2)
  23375. var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
  23376. // C = T1 * k * T2
  23377. var c = this.t.redMul(this.curve.dd).redMul(p.t);
  23378. // D = Z1 * 2 * Z2
  23379. var d = this.z.redMul(p.z.redAdd(p.z));
  23380. // E = B - A
  23381. var e = b.redSub(a);
  23382. // F = D - C
  23383. var f = d.redSub(c);
  23384. // G = D + C
  23385. var g = d.redAdd(c);
  23386. // H = B + A
  23387. var h = b.redAdd(a);
  23388. // X3 = E * F
  23389. var nx = e.redMul(f);
  23390. // Y3 = G * H
  23391. var ny = g.redMul(h);
  23392. // T3 = E * H
  23393. var nt = e.redMul(h);
  23394. // Z3 = F * G
  23395. var nz = f.redMul(g);
  23396. return this.curve.point(nx, ny, nz, nt);
  23397. };
  23398. Point.prototype._projAdd = function _projAdd(p) {
  23399. // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
  23400. // #addition-add-2008-bbjlp
  23401. // #addition-add-2007-bl
  23402. // 10M + 1S
  23403. // A = Z1 * Z2
  23404. var a = this.z.redMul(p.z);
  23405. // B = A^2
  23406. var b = a.redSqr();
  23407. // C = X1 * X2
  23408. var c = this.x.redMul(p.x);
  23409. // D = Y1 * Y2
  23410. var d = this.y.redMul(p.y);
  23411. // E = d * C * D
  23412. var e = this.curve.d.redMul(c).redMul(d);
  23413. // F = B - E
  23414. var f = b.redSub(e);
  23415. // G = B + E
  23416. var g = b.redAdd(e);
  23417. // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
  23418. var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
  23419. var nx = a.redMul(f).redMul(tmp);
  23420. var ny;
  23421. var nz;
  23422. if (this.curve.twisted) {
  23423. // Y3 = A * G * (D - a * C)
  23424. ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
  23425. // Z3 = F * G
  23426. nz = f.redMul(g);
  23427. } else {
  23428. // Y3 = A * G * (D - C)
  23429. ny = a.redMul(g).redMul(d.redSub(c));
  23430. // Z3 = c * F * G
  23431. nz = this.curve._mulC(f).redMul(g);
  23432. }
  23433. return this.curve.point(nx, ny, nz);
  23434. };
  23435. Point.prototype.add = function add(p) {
  23436. if (this.isInfinity())
  23437. return p;
  23438. if (p.isInfinity())
  23439. return this;
  23440. if (this.curve.extended)
  23441. return this._extAdd(p);
  23442. else
  23443. return this._projAdd(p);
  23444. };
  23445. Point.prototype.mul = function mul(k) {
  23446. if (this._hasDoubles(k))
  23447. return this.curve._fixedNafMul(this, k);
  23448. else
  23449. return this.curve._wnafMul(this, k);
  23450. };
  23451. Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
  23452. return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
  23453. };
  23454. Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
  23455. return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
  23456. };
  23457. Point.prototype.normalize = function normalize() {
  23458. if (this.zOne)
  23459. return this;
  23460. // Normalize coordinates
  23461. var zi = this.z.redInvm();
  23462. this.x = this.x.redMul(zi);
  23463. this.y = this.y.redMul(zi);
  23464. if (this.t)
  23465. this.t = this.t.redMul(zi);
  23466. this.z = this.curve.one;
  23467. this.zOne = true;
  23468. return this;
  23469. };
  23470. Point.prototype.neg = function neg() {
  23471. return this.curve.point(this.x.redNeg(),
  23472. this.y,
  23473. this.z,
  23474. this.t && this.t.redNeg());
  23475. };
  23476. Point.prototype.getX = function getX() {
  23477. this.normalize();
  23478. return this.x.fromRed();
  23479. };
  23480. Point.prototype.getY = function getY() {
  23481. this.normalize();
  23482. return this.y.fromRed();
  23483. };
  23484. Point.prototype.eq = function eq(other) {
  23485. return this === other ||
  23486. this.getX().cmp(other.getX()) === 0 &&
  23487. this.getY().cmp(other.getY()) === 0;
  23488. };
  23489. Point.prototype.eqXToP = function eqXToP(x) {
  23490. var rx = x.toRed(this.curve.red).redMul(this.z);
  23491. if (this.x.cmp(rx) === 0)
  23492. return true;
  23493. var xc = x.clone();
  23494. var t = this.curve.redN.redMul(this.z);
  23495. for (;;) {
  23496. xc.iadd(this.curve.n);
  23497. if (xc.cmp(this.curve.p) >= 0)
  23498. return false;
  23499. rx.redIAdd(t);
  23500. if (this.x.cmp(rx) === 0)
  23501. return true;
  23502. }
  23503. };
  23504. // Compatibility with BaseCurve
  23505. Point.prototype.toP = Point.prototype.normalize;
  23506. Point.prototype.mixedAdd = Point.prototype.add;
  23507. /***/ }),
  23508. /* 216 */
  23509. /*!******************************************************!*\
  23510. !*** ./node_modules/elliptic/lib/elliptic/curves.js ***!
  23511. \******************************************************/
  23512. /*! no static exports found */
  23513. /***/ (function(module, exports, __webpack_require__) {
  23514. "use strict";
  23515. var curves = exports;
  23516. var hash = __webpack_require__(/*! hash.js */ 217);
  23517. var curve = __webpack_require__(/*! ./curve */ 211);
  23518. var utils = __webpack_require__(/*! ./utils */ 209);
  23519. var assert = utils.assert;
  23520. function PresetCurve(options) {
  23521. if (options.type === 'short')
  23522. this.curve = new curve.short(options);
  23523. else if (options.type === 'edwards')
  23524. this.curve = new curve.edwards(options);
  23525. else
  23526. this.curve = new curve.mont(options);
  23527. this.g = this.curve.g;
  23528. this.n = this.curve.n;
  23529. this.hash = options.hash;
  23530. assert(this.g.validate(), 'Invalid curve');
  23531. assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
  23532. }
  23533. curves.PresetCurve = PresetCurve;
  23534. function defineCurve(name, options) {
  23535. Object.defineProperty(curves, name, {
  23536. configurable: true,
  23537. enumerable: true,
  23538. get: function() {
  23539. var curve = new PresetCurve(options);
  23540. Object.defineProperty(curves, name, {
  23541. configurable: true,
  23542. enumerable: true,
  23543. value: curve
  23544. });
  23545. return curve;
  23546. }
  23547. });
  23548. }
  23549. defineCurve('p192', {
  23550. type: 'short',
  23551. prime: 'p192',
  23552. p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
  23553. a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
  23554. b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
  23555. n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
  23556. hash: hash.sha256,
  23557. gRed: false,
  23558. g: [
  23559. '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',
  23560. '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'
  23561. ]
  23562. });
  23563. defineCurve('p224', {
  23564. type: 'short',
  23565. prime: 'p224',
  23566. p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
  23567. a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
  23568. b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
  23569. n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
  23570. hash: hash.sha256,
  23571. gRed: false,
  23572. g: [
  23573. 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',
  23574. 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'
  23575. ]
  23576. });
  23577. defineCurve('p256', {
  23578. type: 'short',
  23579. prime: null,
  23580. p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
  23581. a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
  23582. b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
  23583. n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
  23584. hash: hash.sha256,
  23585. gRed: false,
  23586. g: [
  23587. '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',
  23588. '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'
  23589. ]
  23590. });
  23591. defineCurve('p384', {
  23592. type: 'short',
  23593. prime: null,
  23594. p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23595. 'fffffffe ffffffff 00000000 00000000 ffffffff',
  23596. a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23597. 'fffffffe ffffffff 00000000 00000000 fffffffc',
  23598. b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +
  23599. '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
  23600. n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +
  23601. 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
  23602. hash: hash.sha384,
  23603. gRed: false,
  23604. g: [
  23605. 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +
  23606. '5502f25d bf55296c 3a545e38 72760ab7',
  23607. '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +
  23608. '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'
  23609. ]
  23610. });
  23611. defineCurve('p521', {
  23612. type: 'short',
  23613. prime: null,
  23614. p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23615. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23616. 'ffffffff ffffffff ffffffff ffffffff ffffffff',
  23617. a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23618. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23619. 'ffffffff ffffffff ffffffff ffffffff fffffffc',
  23620. b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +
  23621. '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +
  23622. '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
  23623. n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23624. 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +
  23625. 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
  23626. hash: hash.sha512,
  23627. gRed: false,
  23628. g: [
  23629. '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +
  23630. '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +
  23631. 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',
  23632. '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +
  23633. '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +
  23634. '3fad0761 353c7086 a272c240 88be9476 9fd16650'
  23635. ]
  23636. });
  23637. defineCurve('curve25519', {
  23638. type: 'mont',
  23639. prime: 'p25519',
  23640. p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
  23641. a: '76d06',
  23642. b: '1',
  23643. n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
  23644. hash: hash.sha256,
  23645. gRed: false,
  23646. g: [
  23647. '9'
  23648. ]
  23649. });
  23650. defineCurve('ed25519', {
  23651. type: 'edwards',
  23652. prime: 'p25519',
  23653. p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
  23654. a: '-1',
  23655. c: '1',
  23656. // -121665 * (121666^(-1)) (mod P)
  23657. d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
  23658. n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
  23659. hash: hash.sha256,
  23660. gRed: false,
  23661. g: [
  23662. '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',
  23663. // 4/5
  23664. '6666666666666666666666666666666666666666666666666666666666666658'
  23665. ]
  23666. });
  23667. var pre;
  23668. try {
  23669. pre = __webpack_require__(/*! ./precomputed/secp256k1 */ 229);
  23670. } catch (e) {
  23671. pre = undefined;
  23672. }
  23673. defineCurve('secp256k1', {
  23674. type: 'short',
  23675. prime: 'k256',
  23676. p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
  23677. a: '0',
  23678. b: '7',
  23679. n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
  23680. h: '1',
  23681. hash: hash.sha256,
  23682. // Precomputed endomorphism
  23683. beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
  23684. lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
  23685. basis: [
  23686. {
  23687. a: '3086d221a7d46bcde86c90e49284eb15',
  23688. b: '-e4437ed6010e88286f547fa90abfe4c3'
  23689. },
  23690. {
  23691. a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
  23692. b: '3086d221a7d46bcde86c90e49284eb15'
  23693. }
  23694. ],
  23695. gRed: false,
  23696. g: [
  23697. '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
  23698. '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
  23699. pre
  23700. ]
  23701. });
  23702. /***/ }),
  23703. /* 217 */
  23704. /*!******************************************!*\
  23705. !*** ./node_modules/hash.js/lib/hash.js ***!
  23706. \******************************************/
  23707. /*! no static exports found */
  23708. /***/ (function(module, exports, __webpack_require__) {
  23709. var hash = exports;
  23710. hash.utils = __webpack_require__(/*! ./hash/utils */ 218);
  23711. hash.common = __webpack_require__(/*! ./hash/common */ 219);
  23712. hash.sha = __webpack_require__(/*! ./hash/sha */ 220);
  23713. hash.ripemd = __webpack_require__(/*! ./hash/ripemd */ 227);
  23714. hash.hmac = __webpack_require__(/*! ./hash/hmac */ 228);
  23715. // Proxy hash functions to the main object
  23716. hash.sha1 = hash.sha.sha1;
  23717. hash.sha256 = hash.sha.sha256;
  23718. hash.sha224 = hash.sha.sha224;
  23719. hash.sha384 = hash.sha.sha384;
  23720. hash.sha512 = hash.sha.sha512;
  23721. hash.ripemd160 = hash.ripemd.ripemd160;
  23722. /***/ }),
  23723. /* 218 */
  23724. /*!************************************************!*\
  23725. !*** ./node_modules/hash.js/lib/hash/utils.js ***!
  23726. \************************************************/
  23727. /*! no static exports found */
  23728. /***/ (function(module, exports, __webpack_require__) {
  23729. "use strict";
  23730. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  23731. var inherits = __webpack_require__(/*! inherits */ 120);
  23732. exports.inherits = inherits;
  23733. function isSurrogatePair(msg, i) {
  23734. if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
  23735. return false;
  23736. }
  23737. if (i < 0 || i + 1 >= msg.length) {
  23738. return false;
  23739. }
  23740. return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
  23741. }
  23742. function toArray(msg, enc) {
  23743. if (Array.isArray(msg))
  23744. return msg.slice();
  23745. if (!msg)
  23746. return [];
  23747. var res = [];
  23748. if (typeof msg === 'string') {
  23749. if (!enc) {
  23750. // Inspired by stringToUtf8ByteArray() in closure-library by Google
  23751. // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
  23752. // Apache License 2.0
  23753. // https://github.com/google/closure-library/blob/master/LICENSE
  23754. var p = 0;
  23755. for (var i = 0; i < msg.length; i++) {
  23756. var c = msg.charCodeAt(i);
  23757. if (c < 128) {
  23758. res[p++] = c;
  23759. } else if (c < 2048) {
  23760. res[p++] = (c >> 6) | 192;
  23761. res[p++] = (c & 63) | 128;
  23762. } else if (isSurrogatePair(msg, i)) {
  23763. c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
  23764. res[p++] = (c >> 18) | 240;
  23765. res[p++] = ((c >> 12) & 63) | 128;
  23766. res[p++] = ((c >> 6) & 63) | 128;
  23767. res[p++] = (c & 63) | 128;
  23768. } else {
  23769. res[p++] = (c >> 12) | 224;
  23770. res[p++] = ((c >> 6) & 63) | 128;
  23771. res[p++] = (c & 63) | 128;
  23772. }
  23773. }
  23774. } else if (enc === 'hex') {
  23775. msg = msg.replace(/[^a-z0-9]+/ig, '');
  23776. if (msg.length % 2 !== 0)
  23777. msg = '0' + msg;
  23778. for (i = 0; i < msg.length; i += 2)
  23779. res.push(parseInt(msg[i] + msg[i + 1], 16));
  23780. }
  23781. } else {
  23782. for (i = 0; i < msg.length; i++)
  23783. res[i] = msg[i] | 0;
  23784. }
  23785. return res;
  23786. }
  23787. exports.toArray = toArray;
  23788. function toHex(msg) {
  23789. var res = '';
  23790. for (var i = 0; i < msg.length; i++)
  23791. res += zero2(msg[i].toString(16));
  23792. return res;
  23793. }
  23794. exports.toHex = toHex;
  23795. function htonl(w) {
  23796. var res = (w >>> 24) |
  23797. ((w >>> 8) & 0xff00) |
  23798. ((w << 8) & 0xff0000) |
  23799. ((w & 0xff) << 24);
  23800. return res >>> 0;
  23801. }
  23802. exports.htonl = htonl;
  23803. function toHex32(msg, endian) {
  23804. var res = '';
  23805. for (var i = 0; i < msg.length; i++) {
  23806. var w = msg[i];
  23807. if (endian === 'little')
  23808. w = htonl(w);
  23809. res += zero8(w.toString(16));
  23810. }
  23811. return res;
  23812. }
  23813. exports.toHex32 = toHex32;
  23814. function zero2(word) {
  23815. if (word.length === 1)
  23816. return '0' + word;
  23817. else
  23818. return word;
  23819. }
  23820. exports.zero2 = zero2;
  23821. function zero8(word) {
  23822. if (word.length === 7)
  23823. return '0' + word;
  23824. else if (word.length === 6)
  23825. return '00' + word;
  23826. else if (word.length === 5)
  23827. return '000' + word;
  23828. else if (word.length === 4)
  23829. return '0000' + word;
  23830. else if (word.length === 3)
  23831. return '00000' + word;
  23832. else if (word.length === 2)
  23833. return '000000' + word;
  23834. else if (word.length === 1)
  23835. return '0000000' + word;
  23836. else
  23837. return word;
  23838. }
  23839. exports.zero8 = zero8;
  23840. function join32(msg, start, end, endian) {
  23841. var len = end - start;
  23842. assert(len % 4 === 0);
  23843. var res = new Array(len / 4);
  23844. for (var i = 0, k = start; i < res.length; i++, k += 4) {
  23845. var w;
  23846. if (endian === 'big')
  23847. w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
  23848. else
  23849. w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
  23850. res[i] = w >>> 0;
  23851. }
  23852. return res;
  23853. }
  23854. exports.join32 = join32;
  23855. function split32(msg, endian) {
  23856. var res = new Array(msg.length * 4);
  23857. for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
  23858. var m = msg[i];
  23859. if (endian === 'big') {
  23860. res[k] = m >>> 24;
  23861. res[k + 1] = (m >>> 16) & 0xff;
  23862. res[k + 2] = (m >>> 8) & 0xff;
  23863. res[k + 3] = m & 0xff;
  23864. } else {
  23865. res[k + 3] = m >>> 24;
  23866. res[k + 2] = (m >>> 16) & 0xff;
  23867. res[k + 1] = (m >>> 8) & 0xff;
  23868. res[k] = m & 0xff;
  23869. }
  23870. }
  23871. return res;
  23872. }
  23873. exports.split32 = split32;
  23874. function rotr32(w, b) {
  23875. return (w >>> b) | (w << (32 - b));
  23876. }
  23877. exports.rotr32 = rotr32;
  23878. function rotl32(w, b) {
  23879. return (w << b) | (w >>> (32 - b));
  23880. }
  23881. exports.rotl32 = rotl32;
  23882. function sum32(a, b) {
  23883. return (a + b) >>> 0;
  23884. }
  23885. exports.sum32 = sum32;
  23886. function sum32_3(a, b, c) {
  23887. return (a + b + c) >>> 0;
  23888. }
  23889. exports.sum32_3 = sum32_3;
  23890. function sum32_4(a, b, c, d) {
  23891. return (a + b + c + d) >>> 0;
  23892. }
  23893. exports.sum32_4 = sum32_4;
  23894. function sum32_5(a, b, c, d, e) {
  23895. return (a + b + c + d + e) >>> 0;
  23896. }
  23897. exports.sum32_5 = sum32_5;
  23898. function sum64(buf, pos, ah, al) {
  23899. var bh = buf[pos];
  23900. var bl = buf[pos + 1];
  23901. var lo = (al + bl) >>> 0;
  23902. var hi = (lo < al ? 1 : 0) + ah + bh;
  23903. buf[pos] = hi >>> 0;
  23904. buf[pos + 1] = lo;
  23905. }
  23906. exports.sum64 = sum64;
  23907. function sum64_hi(ah, al, bh, bl) {
  23908. var lo = (al + bl) >>> 0;
  23909. var hi = (lo < al ? 1 : 0) + ah + bh;
  23910. return hi >>> 0;
  23911. }
  23912. exports.sum64_hi = sum64_hi;
  23913. function sum64_lo(ah, al, bh, bl) {
  23914. var lo = al + bl;
  23915. return lo >>> 0;
  23916. }
  23917. exports.sum64_lo = sum64_lo;
  23918. function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
  23919. var carry = 0;
  23920. var lo = al;
  23921. lo = (lo + bl) >>> 0;
  23922. carry += lo < al ? 1 : 0;
  23923. lo = (lo + cl) >>> 0;
  23924. carry += lo < cl ? 1 : 0;
  23925. lo = (lo + dl) >>> 0;
  23926. carry += lo < dl ? 1 : 0;
  23927. var hi = ah + bh + ch + dh + carry;
  23928. return hi >>> 0;
  23929. }
  23930. exports.sum64_4_hi = sum64_4_hi;
  23931. function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
  23932. var lo = al + bl + cl + dl;
  23933. return lo >>> 0;
  23934. }
  23935. exports.sum64_4_lo = sum64_4_lo;
  23936. function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  23937. var carry = 0;
  23938. var lo = al;
  23939. lo = (lo + bl) >>> 0;
  23940. carry += lo < al ? 1 : 0;
  23941. lo = (lo + cl) >>> 0;
  23942. carry += lo < cl ? 1 : 0;
  23943. lo = (lo + dl) >>> 0;
  23944. carry += lo < dl ? 1 : 0;
  23945. lo = (lo + el) >>> 0;
  23946. carry += lo < el ? 1 : 0;
  23947. var hi = ah + bh + ch + dh + eh + carry;
  23948. return hi >>> 0;
  23949. }
  23950. exports.sum64_5_hi = sum64_5_hi;
  23951. function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  23952. var lo = al + bl + cl + dl + el;
  23953. return lo >>> 0;
  23954. }
  23955. exports.sum64_5_lo = sum64_5_lo;
  23956. function rotr64_hi(ah, al, num) {
  23957. var r = (al << (32 - num)) | (ah >>> num);
  23958. return r >>> 0;
  23959. }
  23960. exports.rotr64_hi = rotr64_hi;
  23961. function rotr64_lo(ah, al, num) {
  23962. var r = (ah << (32 - num)) | (al >>> num);
  23963. return r >>> 0;
  23964. }
  23965. exports.rotr64_lo = rotr64_lo;
  23966. function shr64_hi(ah, al, num) {
  23967. return ah >>> num;
  23968. }
  23969. exports.shr64_hi = shr64_hi;
  23970. function shr64_lo(ah, al, num) {
  23971. var r = (ah << (32 - num)) | (al >>> num);
  23972. return r >>> 0;
  23973. }
  23974. exports.shr64_lo = shr64_lo;
  23975. /***/ }),
  23976. /* 219 */
  23977. /*!*************************************************!*\
  23978. !*** ./node_modules/hash.js/lib/hash/common.js ***!
  23979. \*************************************************/
  23980. /*! no static exports found */
  23981. /***/ (function(module, exports, __webpack_require__) {
  23982. "use strict";
  23983. var utils = __webpack_require__(/*! ./utils */ 218);
  23984. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  23985. function BlockHash() {
  23986. this.pending = null;
  23987. this.pendingTotal = 0;
  23988. this.blockSize = this.constructor.blockSize;
  23989. this.outSize = this.constructor.outSize;
  23990. this.hmacStrength = this.constructor.hmacStrength;
  23991. this.padLength = this.constructor.padLength / 8;
  23992. this.endian = 'big';
  23993. this._delta8 = this.blockSize / 8;
  23994. this._delta32 = this.blockSize / 32;
  23995. }
  23996. exports.BlockHash = BlockHash;
  23997. BlockHash.prototype.update = function update(msg, enc) {
  23998. // Convert message to array, pad it, and join into 32bit blocks
  23999. msg = utils.toArray(msg, enc);
  24000. if (!this.pending)
  24001. this.pending = msg;
  24002. else
  24003. this.pending = this.pending.concat(msg);
  24004. this.pendingTotal += msg.length;
  24005. // Enough data, try updating
  24006. if (this.pending.length >= this._delta8) {
  24007. msg = this.pending;
  24008. // Process pending data in blocks
  24009. var r = msg.length % this._delta8;
  24010. this.pending = msg.slice(msg.length - r, msg.length);
  24011. if (this.pending.length === 0)
  24012. this.pending = null;
  24013. msg = utils.join32(msg, 0, msg.length - r, this.endian);
  24014. for (var i = 0; i < msg.length; i += this._delta32)
  24015. this._update(msg, i, i + this._delta32);
  24016. }
  24017. return this;
  24018. };
  24019. BlockHash.prototype.digest = function digest(enc) {
  24020. this.update(this._pad());
  24021. assert(this.pending === null);
  24022. return this._digest(enc);
  24023. };
  24024. BlockHash.prototype._pad = function pad() {
  24025. var len = this.pendingTotal;
  24026. var bytes = this._delta8;
  24027. var k = bytes - ((len + this.padLength) % bytes);
  24028. var res = new Array(k + this.padLength);
  24029. res[0] = 0x80;
  24030. for (var i = 1; i < k; i++)
  24031. res[i] = 0;
  24032. // Append length
  24033. len <<= 3;
  24034. if (this.endian === 'big') {
  24035. for (var t = 8; t < this.padLength; t++)
  24036. res[i++] = 0;
  24037. res[i++] = 0;
  24038. res[i++] = 0;
  24039. res[i++] = 0;
  24040. res[i++] = 0;
  24041. res[i++] = (len >>> 24) & 0xff;
  24042. res[i++] = (len >>> 16) & 0xff;
  24043. res[i++] = (len >>> 8) & 0xff;
  24044. res[i++] = len & 0xff;
  24045. } else {
  24046. res[i++] = len & 0xff;
  24047. res[i++] = (len >>> 8) & 0xff;
  24048. res[i++] = (len >>> 16) & 0xff;
  24049. res[i++] = (len >>> 24) & 0xff;
  24050. res[i++] = 0;
  24051. res[i++] = 0;
  24052. res[i++] = 0;
  24053. res[i++] = 0;
  24054. for (t = 8; t < this.padLength; t++)
  24055. res[i++] = 0;
  24056. }
  24057. return res;
  24058. };
  24059. /***/ }),
  24060. /* 220 */
  24061. /*!**********************************************!*\
  24062. !*** ./node_modules/hash.js/lib/hash/sha.js ***!
  24063. \**********************************************/
  24064. /*! no static exports found */
  24065. /***/ (function(module, exports, __webpack_require__) {
  24066. "use strict";
  24067. exports.sha1 = __webpack_require__(/*! ./sha/1 */ 221);
  24068. exports.sha224 = __webpack_require__(/*! ./sha/224 */ 223);
  24069. exports.sha256 = __webpack_require__(/*! ./sha/256 */ 224);
  24070. exports.sha384 = __webpack_require__(/*! ./sha/384 */ 225);
  24071. exports.sha512 = __webpack_require__(/*! ./sha/512 */ 226);
  24072. /***/ }),
  24073. /* 221 */
  24074. /*!************************************************!*\
  24075. !*** ./node_modules/hash.js/lib/hash/sha/1.js ***!
  24076. \************************************************/
  24077. /*! no static exports found */
  24078. /***/ (function(module, exports, __webpack_require__) {
  24079. "use strict";
  24080. var utils = __webpack_require__(/*! ../utils */ 218);
  24081. var common = __webpack_require__(/*! ../common */ 219);
  24082. var shaCommon = __webpack_require__(/*! ./common */ 222);
  24083. var rotl32 = utils.rotl32;
  24084. var sum32 = utils.sum32;
  24085. var sum32_5 = utils.sum32_5;
  24086. var ft_1 = shaCommon.ft_1;
  24087. var BlockHash = common.BlockHash;
  24088. var sha1_K = [
  24089. 0x5A827999, 0x6ED9EBA1,
  24090. 0x8F1BBCDC, 0xCA62C1D6
  24091. ];
  24092. function SHA1() {
  24093. if (!(this instanceof SHA1))
  24094. return new SHA1();
  24095. BlockHash.call(this);
  24096. this.h = [
  24097. 0x67452301, 0xefcdab89, 0x98badcfe,
  24098. 0x10325476, 0xc3d2e1f0 ];
  24099. this.W = new Array(80);
  24100. }
  24101. utils.inherits(SHA1, BlockHash);
  24102. module.exports = SHA1;
  24103. SHA1.blockSize = 512;
  24104. SHA1.outSize = 160;
  24105. SHA1.hmacStrength = 80;
  24106. SHA1.padLength = 64;
  24107. SHA1.prototype._update = function _update(msg, start) {
  24108. var W = this.W;
  24109. for (var i = 0; i < 16; i++)
  24110. W[i] = msg[start + i];
  24111. for(; i < W.length; i++)
  24112. W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
  24113. var a = this.h[0];
  24114. var b = this.h[1];
  24115. var c = this.h[2];
  24116. var d = this.h[3];
  24117. var e = this.h[4];
  24118. for (i = 0; i < W.length; i++) {
  24119. var s = ~~(i / 20);
  24120. var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
  24121. e = d;
  24122. d = c;
  24123. c = rotl32(b, 30);
  24124. b = a;
  24125. a = t;
  24126. }
  24127. this.h[0] = sum32(this.h[0], a);
  24128. this.h[1] = sum32(this.h[1], b);
  24129. this.h[2] = sum32(this.h[2], c);
  24130. this.h[3] = sum32(this.h[3], d);
  24131. this.h[4] = sum32(this.h[4], e);
  24132. };
  24133. SHA1.prototype._digest = function digest(enc) {
  24134. if (enc === 'hex')
  24135. return utils.toHex32(this.h, 'big');
  24136. else
  24137. return utils.split32(this.h, 'big');
  24138. };
  24139. /***/ }),
  24140. /* 222 */
  24141. /*!*****************************************************!*\
  24142. !*** ./node_modules/hash.js/lib/hash/sha/common.js ***!
  24143. \*****************************************************/
  24144. /*! no static exports found */
  24145. /***/ (function(module, exports, __webpack_require__) {
  24146. "use strict";
  24147. var utils = __webpack_require__(/*! ../utils */ 218);
  24148. var rotr32 = utils.rotr32;
  24149. function ft_1(s, x, y, z) {
  24150. if (s === 0)
  24151. return ch32(x, y, z);
  24152. if (s === 1 || s === 3)
  24153. return p32(x, y, z);
  24154. if (s === 2)
  24155. return maj32(x, y, z);
  24156. }
  24157. exports.ft_1 = ft_1;
  24158. function ch32(x, y, z) {
  24159. return (x & y) ^ ((~x) & z);
  24160. }
  24161. exports.ch32 = ch32;
  24162. function maj32(x, y, z) {
  24163. return (x & y) ^ (x & z) ^ (y & z);
  24164. }
  24165. exports.maj32 = maj32;
  24166. function p32(x, y, z) {
  24167. return x ^ y ^ z;
  24168. }
  24169. exports.p32 = p32;
  24170. function s0_256(x) {
  24171. return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
  24172. }
  24173. exports.s0_256 = s0_256;
  24174. function s1_256(x) {
  24175. return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
  24176. }
  24177. exports.s1_256 = s1_256;
  24178. function g0_256(x) {
  24179. return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
  24180. }
  24181. exports.g0_256 = g0_256;
  24182. function g1_256(x) {
  24183. return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
  24184. }
  24185. exports.g1_256 = g1_256;
  24186. /***/ }),
  24187. /* 223 */
  24188. /*!**************************************************!*\
  24189. !*** ./node_modules/hash.js/lib/hash/sha/224.js ***!
  24190. \**************************************************/
  24191. /*! no static exports found */
  24192. /***/ (function(module, exports, __webpack_require__) {
  24193. "use strict";
  24194. var utils = __webpack_require__(/*! ../utils */ 218);
  24195. var SHA256 = __webpack_require__(/*! ./256 */ 224);
  24196. function SHA224() {
  24197. if (!(this instanceof SHA224))
  24198. return new SHA224();
  24199. SHA256.call(this);
  24200. this.h = [
  24201. 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
  24202. 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
  24203. }
  24204. utils.inherits(SHA224, SHA256);
  24205. module.exports = SHA224;
  24206. SHA224.blockSize = 512;
  24207. SHA224.outSize = 224;
  24208. SHA224.hmacStrength = 192;
  24209. SHA224.padLength = 64;
  24210. SHA224.prototype._digest = function digest(enc) {
  24211. // Just truncate output
  24212. if (enc === 'hex')
  24213. return utils.toHex32(this.h.slice(0, 7), 'big');
  24214. else
  24215. return utils.split32(this.h.slice(0, 7), 'big');
  24216. };
  24217. /***/ }),
  24218. /* 224 */
  24219. /*!**************************************************!*\
  24220. !*** ./node_modules/hash.js/lib/hash/sha/256.js ***!
  24221. \**************************************************/
  24222. /*! no static exports found */
  24223. /***/ (function(module, exports, __webpack_require__) {
  24224. "use strict";
  24225. var utils = __webpack_require__(/*! ../utils */ 218);
  24226. var common = __webpack_require__(/*! ../common */ 219);
  24227. var shaCommon = __webpack_require__(/*! ./common */ 222);
  24228. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  24229. var sum32 = utils.sum32;
  24230. var sum32_4 = utils.sum32_4;
  24231. var sum32_5 = utils.sum32_5;
  24232. var ch32 = shaCommon.ch32;
  24233. var maj32 = shaCommon.maj32;
  24234. var s0_256 = shaCommon.s0_256;
  24235. var s1_256 = shaCommon.s1_256;
  24236. var g0_256 = shaCommon.g0_256;
  24237. var g1_256 = shaCommon.g1_256;
  24238. var BlockHash = common.BlockHash;
  24239. var sha256_K = [
  24240. 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
  24241. 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
  24242. 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
  24243. 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
  24244. 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
  24245. 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
  24246. 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
  24247. 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
  24248. 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
  24249. 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
  24250. 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
  24251. 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
  24252. 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
  24253. 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
  24254. 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
  24255. 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
  24256. ];
  24257. function SHA256() {
  24258. if (!(this instanceof SHA256))
  24259. return new SHA256();
  24260. BlockHash.call(this);
  24261. this.h = [
  24262. 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
  24263. 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
  24264. ];
  24265. this.k = sha256_K;
  24266. this.W = new Array(64);
  24267. }
  24268. utils.inherits(SHA256, BlockHash);
  24269. module.exports = SHA256;
  24270. SHA256.blockSize = 512;
  24271. SHA256.outSize = 256;
  24272. SHA256.hmacStrength = 192;
  24273. SHA256.padLength = 64;
  24274. SHA256.prototype._update = function _update(msg, start) {
  24275. var W = this.W;
  24276. for (var i = 0; i < 16; i++)
  24277. W[i] = msg[start + i];
  24278. for (; i < W.length; i++)
  24279. W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
  24280. var a = this.h[0];
  24281. var b = this.h[1];
  24282. var c = this.h[2];
  24283. var d = this.h[3];
  24284. var e = this.h[4];
  24285. var f = this.h[5];
  24286. var g = this.h[6];
  24287. var h = this.h[7];
  24288. assert(this.k.length === W.length);
  24289. for (i = 0; i < W.length; i++) {
  24290. var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
  24291. var T2 = sum32(s0_256(a), maj32(a, b, c));
  24292. h = g;
  24293. g = f;
  24294. f = e;
  24295. e = sum32(d, T1);
  24296. d = c;
  24297. c = b;
  24298. b = a;
  24299. a = sum32(T1, T2);
  24300. }
  24301. this.h[0] = sum32(this.h[0], a);
  24302. this.h[1] = sum32(this.h[1], b);
  24303. this.h[2] = sum32(this.h[2], c);
  24304. this.h[3] = sum32(this.h[3], d);
  24305. this.h[4] = sum32(this.h[4], e);
  24306. this.h[5] = sum32(this.h[5], f);
  24307. this.h[6] = sum32(this.h[6], g);
  24308. this.h[7] = sum32(this.h[7], h);
  24309. };
  24310. SHA256.prototype._digest = function digest(enc) {
  24311. if (enc === 'hex')
  24312. return utils.toHex32(this.h, 'big');
  24313. else
  24314. return utils.split32(this.h, 'big');
  24315. };
  24316. /***/ }),
  24317. /* 225 */
  24318. /*!**************************************************!*\
  24319. !*** ./node_modules/hash.js/lib/hash/sha/384.js ***!
  24320. \**************************************************/
  24321. /*! no static exports found */
  24322. /***/ (function(module, exports, __webpack_require__) {
  24323. "use strict";
  24324. var utils = __webpack_require__(/*! ../utils */ 218);
  24325. var SHA512 = __webpack_require__(/*! ./512 */ 226);
  24326. function SHA384() {
  24327. if (!(this instanceof SHA384))
  24328. return new SHA384();
  24329. SHA512.call(this);
  24330. this.h = [
  24331. 0xcbbb9d5d, 0xc1059ed8,
  24332. 0x629a292a, 0x367cd507,
  24333. 0x9159015a, 0x3070dd17,
  24334. 0x152fecd8, 0xf70e5939,
  24335. 0x67332667, 0xffc00b31,
  24336. 0x8eb44a87, 0x68581511,
  24337. 0xdb0c2e0d, 0x64f98fa7,
  24338. 0x47b5481d, 0xbefa4fa4 ];
  24339. }
  24340. utils.inherits(SHA384, SHA512);
  24341. module.exports = SHA384;
  24342. SHA384.blockSize = 1024;
  24343. SHA384.outSize = 384;
  24344. SHA384.hmacStrength = 192;
  24345. SHA384.padLength = 128;
  24346. SHA384.prototype._digest = function digest(enc) {
  24347. if (enc === 'hex')
  24348. return utils.toHex32(this.h.slice(0, 12), 'big');
  24349. else
  24350. return utils.split32(this.h.slice(0, 12), 'big');
  24351. };
  24352. /***/ }),
  24353. /* 226 */
  24354. /*!**************************************************!*\
  24355. !*** ./node_modules/hash.js/lib/hash/sha/512.js ***!
  24356. \**************************************************/
  24357. /*! no static exports found */
  24358. /***/ (function(module, exports, __webpack_require__) {
  24359. "use strict";
  24360. var utils = __webpack_require__(/*! ../utils */ 218);
  24361. var common = __webpack_require__(/*! ../common */ 219);
  24362. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  24363. var rotr64_hi = utils.rotr64_hi;
  24364. var rotr64_lo = utils.rotr64_lo;
  24365. var shr64_hi = utils.shr64_hi;
  24366. var shr64_lo = utils.shr64_lo;
  24367. var sum64 = utils.sum64;
  24368. var sum64_hi = utils.sum64_hi;
  24369. var sum64_lo = utils.sum64_lo;
  24370. var sum64_4_hi = utils.sum64_4_hi;
  24371. var sum64_4_lo = utils.sum64_4_lo;
  24372. var sum64_5_hi = utils.sum64_5_hi;
  24373. var sum64_5_lo = utils.sum64_5_lo;
  24374. var BlockHash = common.BlockHash;
  24375. var sha512_K = [
  24376. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  24377. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  24378. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  24379. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  24380. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  24381. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  24382. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  24383. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  24384. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  24385. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  24386. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  24387. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  24388. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  24389. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  24390. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  24391. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  24392. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  24393. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  24394. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  24395. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  24396. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  24397. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  24398. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  24399. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  24400. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  24401. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  24402. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  24403. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  24404. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  24405. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  24406. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  24407. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  24408. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  24409. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  24410. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  24411. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  24412. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  24413. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  24414. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  24415. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  24416. ];
  24417. function SHA512() {
  24418. if (!(this instanceof SHA512))
  24419. return new SHA512();
  24420. BlockHash.call(this);
  24421. this.h = [
  24422. 0x6a09e667, 0xf3bcc908,
  24423. 0xbb67ae85, 0x84caa73b,
  24424. 0x3c6ef372, 0xfe94f82b,
  24425. 0xa54ff53a, 0x5f1d36f1,
  24426. 0x510e527f, 0xade682d1,
  24427. 0x9b05688c, 0x2b3e6c1f,
  24428. 0x1f83d9ab, 0xfb41bd6b,
  24429. 0x5be0cd19, 0x137e2179 ];
  24430. this.k = sha512_K;
  24431. this.W = new Array(160);
  24432. }
  24433. utils.inherits(SHA512, BlockHash);
  24434. module.exports = SHA512;
  24435. SHA512.blockSize = 1024;
  24436. SHA512.outSize = 512;
  24437. SHA512.hmacStrength = 192;
  24438. SHA512.padLength = 128;
  24439. SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
  24440. var W = this.W;
  24441. // 32 x 32bit words
  24442. for (var i = 0; i < 32; i++)
  24443. W[i] = msg[start + i];
  24444. for (; i < W.length; i += 2) {
  24445. var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
  24446. var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
  24447. var c1_hi = W[i - 14]; // i - 7
  24448. var c1_lo = W[i - 13];
  24449. var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
  24450. var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
  24451. var c3_hi = W[i - 32]; // i - 16
  24452. var c3_lo = W[i - 31];
  24453. W[i] = sum64_4_hi(
  24454. c0_hi, c0_lo,
  24455. c1_hi, c1_lo,
  24456. c2_hi, c2_lo,
  24457. c3_hi, c3_lo);
  24458. W[i + 1] = sum64_4_lo(
  24459. c0_hi, c0_lo,
  24460. c1_hi, c1_lo,
  24461. c2_hi, c2_lo,
  24462. c3_hi, c3_lo);
  24463. }
  24464. };
  24465. SHA512.prototype._update = function _update(msg, start) {
  24466. this._prepareBlock(msg, start);
  24467. var W = this.W;
  24468. var ah = this.h[0];
  24469. var al = this.h[1];
  24470. var bh = this.h[2];
  24471. var bl = this.h[3];
  24472. var ch = this.h[4];
  24473. var cl = this.h[5];
  24474. var dh = this.h[6];
  24475. var dl = this.h[7];
  24476. var eh = this.h[8];
  24477. var el = this.h[9];
  24478. var fh = this.h[10];
  24479. var fl = this.h[11];
  24480. var gh = this.h[12];
  24481. var gl = this.h[13];
  24482. var hh = this.h[14];
  24483. var hl = this.h[15];
  24484. assert(this.k.length === W.length);
  24485. for (var i = 0; i < W.length; i += 2) {
  24486. var c0_hi = hh;
  24487. var c0_lo = hl;
  24488. var c1_hi = s1_512_hi(eh, el);
  24489. var c1_lo = s1_512_lo(eh, el);
  24490. var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
  24491. var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
  24492. var c3_hi = this.k[i];
  24493. var c3_lo = this.k[i + 1];
  24494. var c4_hi = W[i];
  24495. var c4_lo = W[i + 1];
  24496. var T1_hi = sum64_5_hi(
  24497. c0_hi, c0_lo,
  24498. c1_hi, c1_lo,
  24499. c2_hi, c2_lo,
  24500. c3_hi, c3_lo,
  24501. c4_hi, c4_lo);
  24502. var T1_lo = sum64_5_lo(
  24503. c0_hi, c0_lo,
  24504. c1_hi, c1_lo,
  24505. c2_hi, c2_lo,
  24506. c3_hi, c3_lo,
  24507. c4_hi, c4_lo);
  24508. c0_hi = s0_512_hi(ah, al);
  24509. c0_lo = s0_512_lo(ah, al);
  24510. c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
  24511. c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
  24512. var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
  24513. var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
  24514. hh = gh;
  24515. hl = gl;
  24516. gh = fh;
  24517. gl = fl;
  24518. fh = eh;
  24519. fl = el;
  24520. eh = sum64_hi(dh, dl, T1_hi, T1_lo);
  24521. el = sum64_lo(dl, dl, T1_hi, T1_lo);
  24522. dh = ch;
  24523. dl = cl;
  24524. ch = bh;
  24525. cl = bl;
  24526. bh = ah;
  24527. bl = al;
  24528. ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
  24529. al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
  24530. }
  24531. sum64(this.h, 0, ah, al);
  24532. sum64(this.h, 2, bh, bl);
  24533. sum64(this.h, 4, ch, cl);
  24534. sum64(this.h, 6, dh, dl);
  24535. sum64(this.h, 8, eh, el);
  24536. sum64(this.h, 10, fh, fl);
  24537. sum64(this.h, 12, gh, gl);
  24538. sum64(this.h, 14, hh, hl);
  24539. };
  24540. SHA512.prototype._digest = function digest(enc) {
  24541. if (enc === 'hex')
  24542. return utils.toHex32(this.h, 'big');
  24543. else
  24544. return utils.split32(this.h, 'big');
  24545. };
  24546. function ch64_hi(xh, xl, yh, yl, zh) {
  24547. var r = (xh & yh) ^ ((~xh) & zh);
  24548. if (r < 0)
  24549. r += 0x100000000;
  24550. return r;
  24551. }
  24552. function ch64_lo(xh, xl, yh, yl, zh, zl) {
  24553. var r = (xl & yl) ^ ((~xl) & zl);
  24554. if (r < 0)
  24555. r += 0x100000000;
  24556. return r;
  24557. }
  24558. function maj64_hi(xh, xl, yh, yl, zh) {
  24559. var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
  24560. if (r < 0)
  24561. r += 0x100000000;
  24562. return r;
  24563. }
  24564. function maj64_lo(xh, xl, yh, yl, zh, zl) {
  24565. var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
  24566. if (r < 0)
  24567. r += 0x100000000;
  24568. return r;
  24569. }
  24570. function s0_512_hi(xh, xl) {
  24571. var c0_hi = rotr64_hi(xh, xl, 28);
  24572. var c1_hi = rotr64_hi(xl, xh, 2); // 34
  24573. var c2_hi = rotr64_hi(xl, xh, 7); // 39
  24574. var r = c0_hi ^ c1_hi ^ c2_hi;
  24575. if (r < 0)
  24576. r += 0x100000000;
  24577. return r;
  24578. }
  24579. function s0_512_lo(xh, xl) {
  24580. var c0_lo = rotr64_lo(xh, xl, 28);
  24581. var c1_lo = rotr64_lo(xl, xh, 2); // 34
  24582. var c2_lo = rotr64_lo(xl, xh, 7); // 39
  24583. var r = c0_lo ^ c1_lo ^ c2_lo;
  24584. if (r < 0)
  24585. r += 0x100000000;
  24586. return r;
  24587. }
  24588. function s1_512_hi(xh, xl) {
  24589. var c0_hi = rotr64_hi(xh, xl, 14);
  24590. var c1_hi = rotr64_hi(xh, xl, 18);
  24591. var c2_hi = rotr64_hi(xl, xh, 9); // 41
  24592. var r = c0_hi ^ c1_hi ^ c2_hi;
  24593. if (r < 0)
  24594. r += 0x100000000;
  24595. return r;
  24596. }
  24597. function s1_512_lo(xh, xl) {
  24598. var c0_lo = rotr64_lo(xh, xl, 14);
  24599. var c1_lo = rotr64_lo(xh, xl, 18);
  24600. var c2_lo = rotr64_lo(xl, xh, 9); // 41
  24601. var r = c0_lo ^ c1_lo ^ c2_lo;
  24602. if (r < 0)
  24603. r += 0x100000000;
  24604. return r;
  24605. }
  24606. function g0_512_hi(xh, xl) {
  24607. var c0_hi = rotr64_hi(xh, xl, 1);
  24608. var c1_hi = rotr64_hi(xh, xl, 8);
  24609. var c2_hi = shr64_hi(xh, xl, 7);
  24610. var r = c0_hi ^ c1_hi ^ c2_hi;
  24611. if (r < 0)
  24612. r += 0x100000000;
  24613. return r;
  24614. }
  24615. function g0_512_lo(xh, xl) {
  24616. var c0_lo = rotr64_lo(xh, xl, 1);
  24617. var c1_lo = rotr64_lo(xh, xl, 8);
  24618. var c2_lo = shr64_lo(xh, xl, 7);
  24619. var r = c0_lo ^ c1_lo ^ c2_lo;
  24620. if (r < 0)
  24621. r += 0x100000000;
  24622. return r;
  24623. }
  24624. function g1_512_hi(xh, xl) {
  24625. var c0_hi = rotr64_hi(xh, xl, 19);
  24626. var c1_hi = rotr64_hi(xl, xh, 29); // 61
  24627. var c2_hi = shr64_hi(xh, xl, 6);
  24628. var r = c0_hi ^ c1_hi ^ c2_hi;
  24629. if (r < 0)
  24630. r += 0x100000000;
  24631. return r;
  24632. }
  24633. function g1_512_lo(xh, xl) {
  24634. var c0_lo = rotr64_lo(xh, xl, 19);
  24635. var c1_lo = rotr64_lo(xl, xh, 29); // 61
  24636. var c2_lo = shr64_lo(xh, xl, 6);
  24637. var r = c0_lo ^ c1_lo ^ c2_lo;
  24638. if (r < 0)
  24639. r += 0x100000000;
  24640. return r;
  24641. }
  24642. /***/ }),
  24643. /* 227 */
  24644. /*!*************************************************!*\
  24645. !*** ./node_modules/hash.js/lib/hash/ripemd.js ***!
  24646. \*************************************************/
  24647. /*! no static exports found */
  24648. /***/ (function(module, exports, __webpack_require__) {
  24649. "use strict";
  24650. var utils = __webpack_require__(/*! ./utils */ 218);
  24651. var common = __webpack_require__(/*! ./common */ 219);
  24652. var rotl32 = utils.rotl32;
  24653. var sum32 = utils.sum32;
  24654. var sum32_3 = utils.sum32_3;
  24655. var sum32_4 = utils.sum32_4;
  24656. var BlockHash = common.BlockHash;
  24657. function RIPEMD160() {
  24658. if (!(this instanceof RIPEMD160))
  24659. return new RIPEMD160();
  24660. BlockHash.call(this);
  24661. this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
  24662. this.endian = 'little';
  24663. }
  24664. utils.inherits(RIPEMD160, BlockHash);
  24665. exports.ripemd160 = RIPEMD160;
  24666. RIPEMD160.blockSize = 512;
  24667. RIPEMD160.outSize = 160;
  24668. RIPEMD160.hmacStrength = 192;
  24669. RIPEMD160.padLength = 64;
  24670. RIPEMD160.prototype._update = function update(msg, start) {
  24671. var A = this.h[0];
  24672. var B = this.h[1];
  24673. var C = this.h[2];
  24674. var D = this.h[3];
  24675. var E = this.h[4];
  24676. var Ah = A;
  24677. var Bh = B;
  24678. var Ch = C;
  24679. var Dh = D;
  24680. var Eh = E;
  24681. for (var j = 0; j < 80; j++) {
  24682. var T = sum32(
  24683. rotl32(
  24684. sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
  24685. s[j]),
  24686. E);
  24687. A = E;
  24688. E = D;
  24689. D = rotl32(C, 10);
  24690. C = B;
  24691. B = T;
  24692. T = sum32(
  24693. rotl32(
  24694. sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
  24695. sh[j]),
  24696. Eh);
  24697. Ah = Eh;
  24698. Eh = Dh;
  24699. Dh = rotl32(Ch, 10);
  24700. Ch = Bh;
  24701. Bh = T;
  24702. }
  24703. T = sum32_3(this.h[1], C, Dh);
  24704. this.h[1] = sum32_3(this.h[2], D, Eh);
  24705. this.h[2] = sum32_3(this.h[3], E, Ah);
  24706. this.h[3] = sum32_3(this.h[4], A, Bh);
  24707. this.h[4] = sum32_3(this.h[0], B, Ch);
  24708. this.h[0] = T;
  24709. };
  24710. RIPEMD160.prototype._digest = function digest(enc) {
  24711. if (enc === 'hex')
  24712. return utils.toHex32(this.h, 'little');
  24713. else
  24714. return utils.split32(this.h, 'little');
  24715. };
  24716. function f(j, x, y, z) {
  24717. if (j <= 15)
  24718. return x ^ y ^ z;
  24719. else if (j <= 31)
  24720. return (x & y) | ((~x) & z);
  24721. else if (j <= 47)
  24722. return (x | (~y)) ^ z;
  24723. else if (j <= 63)
  24724. return (x & z) | (y & (~z));
  24725. else
  24726. return x ^ (y | (~z));
  24727. }
  24728. function K(j) {
  24729. if (j <= 15)
  24730. return 0x00000000;
  24731. else if (j <= 31)
  24732. return 0x5a827999;
  24733. else if (j <= 47)
  24734. return 0x6ed9eba1;
  24735. else if (j <= 63)
  24736. return 0x8f1bbcdc;
  24737. else
  24738. return 0xa953fd4e;
  24739. }
  24740. function Kh(j) {
  24741. if (j <= 15)
  24742. return 0x50a28be6;
  24743. else if (j <= 31)
  24744. return 0x5c4dd124;
  24745. else if (j <= 47)
  24746. return 0x6d703ef3;
  24747. else if (j <= 63)
  24748. return 0x7a6d76e9;
  24749. else
  24750. return 0x00000000;
  24751. }
  24752. var r = [
  24753. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  24754. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  24755. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  24756. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  24757. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  24758. ];
  24759. var rh = [
  24760. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  24761. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  24762. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  24763. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  24764. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  24765. ];
  24766. var s = [
  24767. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  24768. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  24769. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  24770. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  24771. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  24772. ];
  24773. var sh = [
  24774. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  24775. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  24776. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  24777. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  24778. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  24779. ];
  24780. /***/ }),
  24781. /* 228 */
  24782. /*!***********************************************!*\
  24783. !*** ./node_modules/hash.js/lib/hash/hmac.js ***!
  24784. \***********************************************/
  24785. /*! no static exports found */
  24786. /***/ (function(module, exports, __webpack_require__) {
  24787. "use strict";
  24788. var utils = __webpack_require__(/*! ./utils */ 218);
  24789. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  24790. function Hmac(hash, key, enc) {
  24791. if (!(this instanceof Hmac))
  24792. return new Hmac(hash, key, enc);
  24793. this.Hash = hash;
  24794. this.blockSize = hash.blockSize / 8;
  24795. this.outSize = hash.outSize / 8;
  24796. this.inner = null;
  24797. this.outer = null;
  24798. this._init(utils.toArray(key, enc));
  24799. }
  24800. module.exports = Hmac;
  24801. Hmac.prototype._init = function init(key) {
  24802. // Shorten key, if needed
  24803. if (key.length > this.blockSize)
  24804. key = new this.Hash().update(key).digest();
  24805. assert(key.length <= this.blockSize);
  24806. // Add padding to key
  24807. for (var i = key.length; i < this.blockSize; i++)
  24808. key.push(0);
  24809. for (i = 0; i < key.length; i++)
  24810. key[i] ^= 0x36;
  24811. this.inner = new this.Hash().update(key);
  24812. // 0x36 ^ 0x5c = 0x6a
  24813. for (i = 0; i < key.length; i++)
  24814. key[i] ^= 0x6a;
  24815. this.outer = new this.Hash().update(key);
  24816. };
  24817. Hmac.prototype.update = function update(msg, enc) {
  24818. this.inner.update(msg, enc);
  24819. return this;
  24820. };
  24821. Hmac.prototype.digest = function digest(enc) {
  24822. this.outer.update(this.inner.digest());
  24823. return this.outer.digest(enc);
  24824. };
  24825. /***/ }),
  24826. /* 229 */
  24827. /*!*********************************************************************!*\
  24828. !*** ./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js ***!
  24829. \*********************************************************************/
  24830. /*! no static exports found */
  24831. /***/ (function(module, exports) {
  24832. module.exports = {
  24833. doubles: {
  24834. step: 4,
  24835. points: [
  24836. [
  24837. 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',
  24838. 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'
  24839. ],
  24840. [
  24841. '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',
  24842. '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'
  24843. ],
  24844. [
  24845. '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',
  24846. 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'
  24847. ],
  24848. [
  24849. '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',
  24850. '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'
  24851. ],
  24852. [
  24853. '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',
  24854. '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'
  24855. ],
  24856. [
  24857. '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',
  24858. '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'
  24859. ],
  24860. [
  24861. 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',
  24862. '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'
  24863. ],
  24864. [
  24865. '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',
  24866. 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'
  24867. ],
  24868. [
  24869. 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',
  24870. '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'
  24871. ],
  24872. [
  24873. 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',
  24874. 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'
  24875. ],
  24876. [
  24877. 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',
  24878. '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'
  24879. ],
  24880. [
  24881. '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',
  24882. '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'
  24883. ],
  24884. [
  24885. '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',
  24886. '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'
  24887. ],
  24888. [
  24889. '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',
  24890. '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'
  24891. ],
  24892. [
  24893. '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',
  24894. '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'
  24895. ],
  24896. [
  24897. '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',
  24898. '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'
  24899. ],
  24900. [
  24901. '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',
  24902. '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'
  24903. ],
  24904. [
  24905. '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',
  24906. '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'
  24907. ],
  24908. [
  24909. '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',
  24910. 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'
  24911. ],
  24912. [
  24913. 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',
  24914. '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'
  24915. ],
  24916. [
  24917. 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',
  24918. '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'
  24919. ],
  24920. [
  24921. '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',
  24922. '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'
  24923. ],
  24924. [
  24925. '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',
  24926. '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'
  24927. ],
  24928. [
  24929. 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',
  24930. '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'
  24931. ],
  24932. [
  24933. '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',
  24934. 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'
  24935. ],
  24936. [
  24937. 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',
  24938. '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'
  24939. ],
  24940. [
  24941. 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',
  24942. 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'
  24943. ],
  24944. [
  24945. 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',
  24946. '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'
  24947. ],
  24948. [
  24949. 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',
  24950. 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'
  24951. ],
  24952. [
  24953. 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',
  24954. '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'
  24955. ],
  24956. [
  24957. '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',
  24958. 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'
  24959. ],
  24960. [
  24961. '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',
  24962. '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'
  24963. ],
  24964. [
  24965. 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',
  24966. '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'
  24967. ],
  24968. [
  24969. '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',
  24970. 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'
  24971. ],
  24972. [
  24973. 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',
  24974. '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'
  24975. ],
  24976. [
  24977. 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',
  24978. '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'
  24979. ],
  24980. [
  24981. 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',
  24982. 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'
  24983. ],
  24984. [
  24985. '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',
  24986. '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'
  24987. ],
  24988. [
  24989. '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',
  24990. '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'
  24991. ],
  24992. [
  24993. '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',
  24994. 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'
  24995. ],
  24996. [
  24997. '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',
  24998. '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'
  24999. ],
  25000. [
  25001. 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',
  25002. '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'
  25003. ],
  25004. [
  25005. '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',
  25006. '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'
  25007. ],
  25008. [
  25009. '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',
  25010. 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'
  25011. ],
  25012. [
  25013. '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',
  25014. '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'
  25015. ],
  25016. [
  25017. 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',
  25018. '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'
  25019. ],
  25020. [
  25021. '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',
  25022. 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'
  25023. ],
  25024. [
  25025. 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',
  25026. 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'
  25027. ],
  25028. [
  25029. 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',
  25030. '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'
  25031. ],
  25032. [
  25033. '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',
  25034. 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'
  25035. ],
  25036. [
  25037. '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',
  25038. 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'
  25039. ],
  25040. [
  25041. 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',
  25042. '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'
  25043. ],
  25044. [
  25045. 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',
  25046. '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'
  25047. ],
  25048. [
  25049. 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',
  25050. '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'
  25051. ],
  25052. [
  25053. '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',
  25054. 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'
  25055. ],
  25056. [
  25057. '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',
  25058. '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'
  25059. ],
  25060. [
  25061. 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',
  25062. 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'
  25063. ],
  25064. [
  25065. '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',
  25066. 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'
  25067. ],
  25068. [
  25069. '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',
  25070. '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'
  25071. ],
  25072. [
  25073. '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',
  25074. '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'
  25075. ],
  25076. [
  25077. 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',
  25078. 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'
  25079. ],
  25080. [
  25081. '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',
  25082. '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'
  25083. ],
  25084. [
  25085. '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',
  25086. '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'
  25087. ],
  25088. [
  25089. 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',
  25090. '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'
  25091. ],
  25092. [
  25093. 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',
  25094. 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82'
  25095. ]
  25096. ]
  25097. },
  25098. naf: {
  25099. wnd: 7,
  25100. points: [
  25101. [
  25102. 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
  25103. '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'
  25104. ],
  25105. [
  25106. '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',
  25107. 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'
  25108. ],
  25109. [
  25110. '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',
  25111. '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'
  25112. ],
  25113. [
  25114. 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',
  25115. 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'
  25116. ],
  25117. [
  25118. '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',
  25119. 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'
  25120. ],
  25121. [
  25122. 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',
  25123. 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'
  25124. ],
  25125. [
  25126. 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',
  25127. '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'
  25128. ],
  25129. [
  25130. 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',
  25131. '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'
  25132. ],
  25133. [
  25134. '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',
  25135. '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'
  25136. ],
  25137. [
  25138. '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',
  25139. '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'
  25140. ],
  25141. [
  25142. '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',
  25143. '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'
  25144. ],
  25145. [
  25146. '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',
  25147. '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'
  25148. ],
  25149. [
  25150. 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',
  25151. 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'
  25152. ],
  25153. [
  25154. 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',
  25155. '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'
  25156. ],
  25157. [
  25158. '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',
  25159. 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'
  25160. ],
  25161. [
  25162. '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',
  25163. 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'
  25164. ],
  25165. [
  25166. '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',
  25167. '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'
  25168. ],
  25169. [
  25170. '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',
  25171. '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'
  25172. ],
  25173. [
  25174. '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',
  25175. '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'
  25176. ],
  25177. [
  25178. '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',
  25179. 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'
  25180. ],
  25181. [
  25182. 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',
  25183. 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'
  25184. ],
  25185. [
  25186. '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',
  25187. '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'
  25188. ],
  25189. [
  25190. '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',
  25191. '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'
  25192. ],
  25193. [
  25194. 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',
  25195. 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'
  25196. ],
  25197. [
  25198. '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',
  25199. '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'
  25200. ],
  25201. [
  25202. 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',
  25203. 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'
  25204. ],
  25205. [
  25206. 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',
  25207. 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'
  25208. ],
  25209. [
  25210. '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',
  25211. '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'
  25212. ],
  25213. [
  25214. '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',
  25215. '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'
  25216. ],
  25217. [
  25218. '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',
  25219. '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'
  25220. ],
  25221. [
  25222. 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',
  25223. '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'
  25224. ],
  25225. [
  25226. '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',
  25227. '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'
  25228. ],
  25229. [
  25230. 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',
  25231. '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'
  25232. ],
  25233. [
  25234. '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',
  25235. 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'
  25236. ],
  25237. [
  25238. '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',
  25239. 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'
  25240. ],
  25241. [
  25242. 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',
  25243. 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'
  25244. ],
  25245. [
  25246. '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',
  25247. '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'
  25248. ],
  25249. [
  25250. '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',
  25251. 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'
  25252. ],
  25253. [
  25254. 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',
  25255. 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'
  25256. ],
  25257. [
  25258. '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',
  25259. '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'
  25260. ],
  25261. [
  25262. '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',
  25263. 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'
  25264. ],
  25265. [
  25266. '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',
  25267. '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'
  25268. ],
  25269. [
  25270. '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',
  25271. 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'
  25272. ],
  25273. [
  25274. 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',
  25275. '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'
  25276. ],
  25277. [
  25278. '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',
  25279. '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'
  25280. ],
  25281. [
  25282. '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',
  25283. 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'
  25284. ],
  25285. [
  25286. '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',
  25287. 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'
  25288. ],
  25289. [
  25290. 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',
  25291. 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'
  25292. ],
  25293. [
  25294. 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',
  25295. 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'
  25296. ],
  25297. [
  25298. '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',
  25299. '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'
  25300. ],
  25301. [
  25302. '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',
  25303. '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'
  25304. ],
  25305. [
  25306. 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',
  25307. '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'
  25308. ],
  25309. [
  25310. 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',
  25311. 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'
  25312. ],
  25313. [
  25314. '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',
  25315. '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'
  25316. ],
  25317. [
  25318. '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',
  25319. '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'
  25320. ],
  25321. [
  25322. 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',
  25323. '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'
  25324. ],
  25325. [
  25326. '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',
  25327. '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'
  25328. ],
  25329. [
  25330. 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',
  25331. 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'
  25332. ],
  25333. [
  25334. '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',
  25335. 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'
  25336. ],
  25337. [
  25338. '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',
  25339. '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'
  25340. ],
  25341. [
  25342. 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',
  25343. '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'
  25344. ],
  25345. [
  25346. 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',
  25347. '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'
  25348. ],
  25349. [
  25350. '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',
  25351. '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'
  25352. ],
  25353. [
  25354. '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',
  25355. '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'
  25356. ],
  25357. [
  25358. '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',
  25359. 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'
  25360. ],
  25361. [
  25362. '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',
  25363. 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'
  25364. ],
  25365. [
  25366. '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',
  25367. '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'
  25368. ],
  25369. [
  25370. '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',
  25371. '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'
  25372. ],
  25373. [
  25374. '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',
  25375. '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'
  25376. ],
  25377. [
  25378. '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',
  25379. 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'
  25380. ],
  25381. [
  25382. 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',
  25383. 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'
  25384. ],
  25385. [
  25386. '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',
  25387. 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'
  25388. ],
  25389. [
  25390. 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',
  25391. '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'
  25392. ],
  25393. [
  25394. 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',
  25395. '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'
  25396. ],
  25397. [
  25398. 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',
  25399. '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'
  25400. ],
  25401. [
  25402. 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',
  25403. '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'
  25404. ],
  25405. [
  25406. '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',
  25407. 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'
  25408. ],
  25409. [
  25410. '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',
  25411. '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'
  25412. ],
  25413. [
  25414. '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',
  25415. 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'
  25416. ],
  25417. [
  25418. 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',
  25419. 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'
  25420. ],
  25421. [
  25422. 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',
  25423. '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'
  25424. ],
  25425. [
  25426. 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',
  25427. 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'
  25428. ],
  25429. [
  25430. 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',
  25431. '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'
  25432. ],
  25433. [
  25434. '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',
  25435. '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'
  25436. ],
  25437. [
  25438. 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',
  25439. '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'
  25440. ],
  25441. [
  25442. 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',
  25443. '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'
  25444. ],
  25445. [
  25446. '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',
  25447. '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'
  25448. ],
  25449. [
  25450. '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',
  25451. 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'
  25452. ],
  25453. [
  25454. 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',
  25455. '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'
  25456. ],
  25457. [
  25458. 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',
  25459. '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'
  25460. ],
  25461. [
  25462. 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',
  25463. '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'
  25464. ],
  25465. [
  25466. '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',
  25467. '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'
  25468. ],
  25469. [
  25470. 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',
  25471. 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'
  25472. ],
  25473. [
  25474. '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',
  25475. 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'
  25476. ],
  25477. [
  25478. 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',
  25479. 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'
  25480. ],
  25481. [
  25482. 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',
  25483. '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'
  25484. ],
  25485. [
  25486. '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',
  25487. 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'
  25488. ],
  25489. [
  25490. 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',
  25491. '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'
  25492. ],
  25493. [
  25494. 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',
  25495. '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'
  25496. ],
  25497. [
  25498. 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',
  25499. '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'
  25500. ],
  25501. [
  25502. '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',
  25503. 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'
  25504. ],
  25505. [
  25506. '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',
  25507. 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'
  25508. ],
  25509. [
  25510. 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',
  25511. '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'
  25512. ],
  25513. [
  25514. '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',
  25515. 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'
  25516. ],
  25517. [
  25518. '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',
  25519. '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'
  25520. ],
  25521. [
  25522. '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',
  25523. 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'
  25524. ],
  25525. [
  25526. 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',
  25527. 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'
  25528. ],
  25529. [
  25530. '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',
  25531. 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'
  25532. ],
  25533. [
  25534. '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',
  25535. '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'
  25536. ],
  25537. [
  25538. '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',
  25539. 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'
  25540. ],
  25541. [
  25542. '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',
  25543. '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'
  25544. ],
  25545. [
  25546. 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',
  25547. 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'
  25548. ],
  25549. [
  25550. '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',
  25551. '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'
  25552. ],
  25553. [
  25554. 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',
  25555. '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'
  25556. ],
  25557. [
  25558. '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',
  25559. '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'
  25560. ],
  25561. [
  25562. 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',
  25563. 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'
  25564. ],
  25565. [
  25566. 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',
  25567. '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'
  25568. ],
  25569. [
  25570. 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',
  25571. 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'
  25572. ],
  25573. [
  25574. '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',
  25575. 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'
  25576. ],
  25577. [
  25578. '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',
  25579. '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'
  25580. ],
  25581. [
  25582. '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',
  25583. 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'
  25584. ],
  25585. [
  25586. '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',
  25587. '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'
  25588. ],
  25589. [
  25590. '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',
  25591. '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'
  25592. ],
  25593. [
  25594. '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',
  25595. 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'
  25596. ],
  25597. [
  25598. '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',
  25599. '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'
  25600. ],
  25601. [
  25602. '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',
  25603. '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'
  25604. ],
  25605. [
  25606. '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',
  25607. '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9'
  25608. ]
  25609. ]
  25610. }
  25611. };
  25612. /***/ }),
  25613. /* 230 */
  25614. /*!********************************************************!*\
  25615. !*** ./node_modules/elliptic/lib/elliptic/ec/index.js ***!
  25616. \********************************************************/
  25617. /*! no static exports found */
  25618. /***/ (function(module, exports, __webpack_require__) {
  25619. "use strict";
  25620. var BN = __webpack_require__(/*! bn.js */ 196);
  25621. var HmacDRBG = __webpack_require__(/*! hmac-drbg */ 231);
  25622. var utils = __webpack_require__(/*! ../utils */ 209);
  25623. var curves = __webpack_require__(/*! ../curves */ 216);
  25624. var rand = __webpack_require__(/*! brorand */ 200);
  25625. var assert = utils.assert;
  25626. var KeyPair = __webpack_require__(/*! ./key */ 232);
  25627. var Signature = __webpack_require__(/*! ./signature */ 233);
  25628. function EC(options) {
  25629. if (!(this instanceof EC))
  25630. return new EC(options);
  25631. // Shortcut `elliptic.ec(curve-name)`
  25632. if (typeof options === 'string') {
  25633. assert(curves.hasOwnProperty(options), 'Unknown curve ' + options);
  25634. options = curves[options];
  25635. }
  25636. // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
  25637. if (options instanceof curves.PresetCurve)
  25638. options = { curve: options };
  25639. this.curve = options.curve.curve;
  25640. this.n = this.curve.n;
  25641. this.nh = this.n.ushrn(1);
  25642. this.g = this.curve.g;
  25643. // Point on curve
  25644. this.g = options.curve.g;
  25645. this.g.precompute(options.curve.n.bitLength() + 1);
  25646. // Hash for function for DRBG
  25647. this.hash = options.hash || options.curve.hash;
  25648. }
  25649. module.exports = EC;
  25650. EC.prototype.keyPair = function keyPair(options) {
  25651. return new KeyPair(this, options);
  25652. };
  25653. EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
  25654. return KeyPair.fromPrivate(this, priv, enc);
  25655. };
  25656. EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
  25657. return KeyPair.fromPublic(this, pub, enc);
  25658. };
  25659. EC.prototype.genKeyPair = function genKeyPair(options) {
  25660. if (!options)
  25661. options = {};
  25662. // Instantiate Hmac_DRBG
  25663. var drbg = new HmacDRBG({
  25664. hash: this.hash,
  25665. pers: options.pers,
  25666. persEnc: options.persEnc || 'utf8',
  25667. entropy: options.entropy || rand(this.hash.hmacStrength),
  25668. entropyEnc: options.entropy && options.entropyEnc || 'utf8',
  25669. nonce: this.n.toArray()
  25670. });
  25671. var bytes = this.n.byteLength();
  25672. var ns2 = this.n.sub(new BN(2));
  25673. do {
  25674. var priv = new BN(drbg.generate(bytes));
  25675. if (priv.cmp(ns2) > 0)
  25676. continue;
  25677. priv.iaddn(1);
  25678. return this.keyFromPrivate(priv);
  25679. } while (true);
  25680. };
  25681. EC.prototype._truncateToN = function truncateToN(msg, truncOnly) {
  25682. var delta = msg.byteLength() * 8 - this.n.bitLength();
  25683. if (delta > 0)
  25684. msg = msg.ushrn(delta);
  25685. if (!truncOnly && msg.cmp(this.n) >= 0)
  25686. return msg.sub(this.n);
  25687. else
  25688. return msg;
  25689. };
  25690. EC.prototype.sign = function sign(msg, key, enc, options) {
  25691. if (typeof enc === 'object') {
  25692. options = enc;
  25693. enc = null;
  25694. }
  25695. if (!options)
  25696. options = {};
  25697. key = this.keyFromPrivate(key, enc);
  25698. msg = this._truncateToN(new BN(msg, 16));
  25699. // Zero-extend key to provide enough entropy
  25700. var bytes = this.n.byteLength();
  25701. var bkey = key.getPrivate().toArray('be', bytes);
  25702. // Zero-extend nonce to have the same byte size as N
  25703. var nonce = msg.toArray('be', bytes);
  25704. // Instantiate Hmac_DRBG
  25705. var drbg = new HmacDRBG({
  25706. hash: this.hash,
  25707. entropy: bkey,
  25708. nonce: nonce,
  25709. pers: options.pers,
  25710. persEnc: options.persEnc || 'utf8'
  25711. });
  25712. // Number of bytes to generate
  25713. var ns1 = this.n.sub(new BN(1));
  25714. for (var iter = 0; true; iter++) {
  25715. var k = options.k ?
  25716. options.k(iter) :
  25717. new BN(drbg.generate(this.n.byteLength()));
  25718. k = this._truncateToN(k, true);
  25719. if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)
  25720. continue;
  25721. var kp = this.g.mul(k);
  25722. if (kp.isInfinity())
  25723. continue;
  25724. var kpX = kp.getX();
  25725. var r = kpX.umod(this.n);
  25726. if (r.cmpn(0) === 0)
  25727. continue;
  25728. var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
  25729. s = s.umod(this.n);
  25730. if (s.cmpn(0) === 0)
  25731. continue;
  25732. var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |
  25733. (kpX.cmp(r) !== 0 ? 2 : 0);
  25734. // Use complement of `s`, if it is > `n / 2`
  25735. if (options.canonical && s.cmp(this.nh) > 0) {
  25736. s = this.n.sub(s);
  25737. recoveryParam ^= 1;
  25738. }
  25739. return new Signature({ r: r, s: s, recoveryParam: recoveryParam });
  25740. }
  25741. };
  25742. EC.prototype.verify = function verify(msg, signature, key, enc) {
  25743. msg = this._truncateToN(new BN(msg, 16));
  25744. key = this.keyFromPublic(key, enc);
  25745. signature = new Signature(signature, 'hex');
  25746. // Perform primitive values validation
  25747. var r = signature.r;
  25748. var s = signature.s;
  25749. if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)
  25750. return false;
  25751. if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)
  25752. return false;
  25753. // Validate signature
  25754. var sinv = s.invm(this.n);
  25755. var u1 = sinv.mul(msg).umod(this.n);
  25756. var u2 = sinv.mul(r).umod(this.n);
  25757. if (!this.curve._maxwellTrick) {
  25758. var p = this.g.mulAdd(u1, key.getPublic(), u2);
  25759. if (p.isInfinity())
  25760. return false;
  25761. return p.getX().umod(this.n).cmp(r) === 0;
  25762. }
  25763. // NOTE: Greg Maxwell's trick, inspired by:
  25764. // https://git.io/vad3K
  25765. var p = this.g.jmulAdd(u1, key.getPublic(), u2);
  25766. if (p.isInfinity())
  25767. return false;
  25768. // Compare `p.x` of Jacobian point with `r`,
  25769. // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
  25770. // inverse of `p.z^2`
  25771. return p.eqXToP(r);
  25772. };
  25773. EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
  25774. assert((3 & j) === j, 'The recovery param is more than two bits');
  25775. signature = new Signature(signature, enc);
  25776. var n = this.n;
  25777. var e = new BN(msg);
  25778. var r = signature.r;
  25779. var s = signature.s;
  25780. // A set LSB signifies that the y-coordinate is odd
  25781. var isYOdd = j & 1;
  25782. var isSecondKey = j >> 1;
  25783. if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
  25784. throw new Error('Unable to find sencond key candinate');
  25785. // 1.1. Let x = r + jn.
  25786. if (isSecondKey)
  25787. r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
  25788. else
  25789. r = this.curve.pointFromX(r, isYOdd);
  25790. var rInv = signature.r.invm(n);
  25791. var s1 = n.sub(e).mul(rInv).umod(n);
  25792. var s2 = s.mul(rInv).umod(n);
  25793. // 1.6.1 Compute Q = r^-1 (sR - eG)
  25794. // Q = r^-1 (sR + -eG)
  25795. return this.g.mulAdd(s1, r, s2);
  25796. };
  25797. EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
  25798. signature = new Signature(signature, enc);
  25799. if (signature.recoveryParam !== null)
  25800. return signature.recoveryParam;
  25801. for (var i = 0; i < 4; i++) {
  25802. var Qprime;
  25803. try {
  25804. Qprime = this.recoverPubKey(e, signature, i);
  25805. } catch (e) {
  25806. continue;
  25807. }
  25808. if (Qprime.eq(Q))
  25809. return i;
  25810. }
  25811. throw new Error('Unable to find valid recovery factor');
  25812. };
  25813. /***/ }),
  25814. /* 231 */
  25815. /*!*************************************************!*\
  25816. !*** ./node_modules/hmac-drbg/lib/hmac-drbg.js ***!
  25817. \*************************************************/
  25818. /*! no static exports found */
  25819. /***/ (function(module, exports, __webpack_require__) {
  25820. "use strict";
  25821. var hash = __webpack_require__(/*! hash.js */ 217);
  25822. var utils = __webpack_require__(/*! minimalistic-crypto-utils */ 210);
  25823. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  25824. function HmacDRBG(options) {
  25825. if (!(this instanceof HmacDRBG))
  25826. return new HmacDRBG(options);
  25827. this.hash = options.hash;
  25828. this.predResist = !!options.predResist;
  25829. this.outLen = this.hash.outSize;
  25830. this.minEntropy = options.minEntropy || this.hash.hmacStrength;
  25831. this._reseed = null;
  25832. this.reseedInterval = null;
  25833. this.K = null;
  25834. this.V = null;
  25835. var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex');
  25836. var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex');
  25837. var pers = utils.toArray(options.pers, options.persEnc || 'hex');
  25838. assert(entropy.length >= (this.minEntropy / 8),
  25839. 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
  25840. this._init(entropy, nonce, pers);
  25841. }
  25842. module.exports = HmacDRBG;
  25843. HmacDRBG.prototype._init = function init(entropy, nonce, pers) {
  25844. var seed = entropy.concat(nonce).concat(pers);
  25845. this.K = new Array(this.outLen / 8);
  25846. this.V = new Array(this.outLen / 8);
  25847. for (var i = 0; i < this.V.length; i++) {
  25848. this.K[i] = 0x00;
  25849. this.V[i] = 0x01;
  25850. }
  25851. this._update(seed);
  25852. this._reseed = 1;
  25853. this.reseedInterval = 0x1000000000000; // 2^48
  25854. };
  25855. HmacDRBG.prototype._hmac = function hmac() {
  25856. return new hash.hmac(this.hash, this.K);
  25857. };
  25858. HmacDRBG.prototype._update = function update(seed) {
  25859. var kmac = this._hmac()
  25860. .update(this.V)
  25861. .update([ 0x00 ]);
  25862. if (seed)
  25863. kmac = kmac.update(seed);
  25864. this.K = kmac.digest();
  25865. this.V = this._hmac().update(this.V).digest();
  25866. if (!seed)
  25867. return;
  25868. this.K = this._hmac()
  25869. .update(this.V)
  25870. .update([ 0x01 ])
  25871. .update(seed)
  25872. .digest();
  25873. this.V = this._hmac().update(this.V).digest();
  25874. };
  25875. HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {
  25876. // Optional entropy enc
  25877. if (typeof entropyEnc !== 'string') {
  25878. addEnc = add;
  25879. add = entropyEnc;
  25880. entropyEnc = null;
  25881. }
  25882. entropy = utils.toArray(entropy, entropyEnc);
  25883. add = utils.toArray(add, addEnc);
  25884. assert(entropy.length >= (this.minEntropy / 8),
  25885. 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
  25886. this._update(entropy.concat(add || []));
  25887. this._reseed = 1;
  25888. };
  25889. HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {
  25890. if (this._reseed > this.reseedInterval)
  25891. throw new Error('Reseed is required');
  25892. // Optional encoding
  25893. if (typeof enc !== 'string') {
  25894. addEnc = add;
  25895. add = enc;
  25896. enc = null;
  25897. }
  25898. // Optional additional data
  25899. if (add) {
  25900. add = utils.toArray(add, addEnc || 'hex');
  25901. this._update(add);
  25902. }
  25903. var temp = [];
  25904. while (temp.length < len) {
  25905. this.V = this._hmac().update(this.V).digest();
  25906. temp = temp.concat(this.V);
  25907. }
  25908. var res = temp.slice(0, len);
  25909. this._update(add);
  25910. this._reseed++;
  25911. return utils.encode(res, enc);
  25912. };
  25913. /***/ }),
  25914. /* 232 */
  25915. /*!******************************************************!*\
  25916. !*** ./node_modules/elliptic/lib/elliptic/ec/key.js ***!
  25917. \******************************************************/
  25918. /*! no static exports found */
  25919. /***/ (function(module, exports, __webpack_require__) {
  25920. "use strict";
  25921. var BN = __webpack_require__(/*! bn.js */ 196);
  25922. var utils = __webpack_require__(/*! ../utils */ 209);
  25923. var assert = utils.assert;
  25924. function KeyPair(ec, options) {
  25925. this.ec = ec;
  25926. this.priv = null;
  25927. this.pub = null;
  25928. // KeyPair(ec, { priv: ..., pub: ... })
  25929. if (options.priv)
  25930. this._importPrivate(options.priv, options.privEnc);
  25931. if (options.pub)
  25932. this._importPublic(options.pub, options.pubEnc);
  25933. }
  25934. module.exports = KeyPair;
  25935. KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
  25936. if (pub instanceof KeyPair)
  25937. return pub;
  25938. return new KeyPair(ec, {
  25939. pub: pub,
  25940. pubEnc: enc
  25941. });
  25942. };
  25943. KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
  25944. if (priv instanceof KeyPair)
  25945. return priv;
  25946. return new KeyPair(ec, {
  25947. priv: priv,
  25948. privEnc: enc
  25949. });
  25950. };
  25951. KeyPair.prototype.validate = function validate() {
  25952. var pub = this.getPublic();
  25953. if (pub.isInfinity())
  25954. return { result: false, reason: 'Invalid public key' };
  25955. if (!pub.validate())
  25956. return { result: false, reason: 'Public key is not a point' };
  25957. if (!pub.mul(this.ec.curve.n).isInfinity())
  25958. return { result: false, reason: 'Public key * N != O' };
  25959. return { result: true, reason: null };
  25960. };
  25961. KeyPair.prototype.getPublic = function getPublic(compact, enc) {
  25962. // compact is optional argument
  25963. if (typeof compact === 'string') {
  25964. enc = compact;
  25965. compact = null;
  25966. }
  25967. if (!this.pub)
  25968. this.pub = this.ec.g.mul(this.priv);
  25969. if (!enc)
  25970. return this.pub;
  25971. return this.pub.encode(enc, compact);
  25972. };
  25973. KeyPair.prototype.getPrivate = function getPrivate(enc) {
  25974. if (enc === 'hex')
  25975. return this.priv.toString(16, 2);
  25976. else
  25977. return this.priv;
  25978. };
  25979. KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
  25980. this.priv = new BN(key, enc || 16);
  25981. // Ensure that the priv won't be bigger than n, otherwise we may fail
  25982. // in fixed multiplication method
  25983. this.priv = this.priv.umod(this.ec.curve.n);
  25984. };
  25985. KeyPair.prototype._importPublic = function _importPublic(key, enc) {
  25986. if (key.x || key.y) {
  25987. // Montgomery points only have an `x` coordinate.
  25988. // Weierstrass/Edwards points on the other hand have both `x` and
  25989. // `y` coordinates.
  25990. if (this.ec.curve.type === 'mont') {
  25991. assert(key.x, 'Need x coordinate');
  25992. } else if (this.ec.curve.type === 'short' ||
  25993. this.ec.curve.type === 'edwards') {
  25994. assert(key.x && key.y, 'Need both x and y coordinate');
  25995. }
  25996. this.pub = this.ec.curve.point(key.x, key.y);
  25997. return;
  25998. }
  25999. this.pub = this.ec.curve.decodePoint(key, enc);
  26000. };
  26001. // ECDH
  26002. KeyPair.prototype.derive = function derive(pub) {
  26003. return pub.mul(this.priv).getX();
  26004. };
  26005. // ECDSA
  26006. KeyPair.prototype.sign = function sign(msg, enc, options) {
  26007. return this.ec.sign(msg, this, enc, options);
  26008. };
  26009. KeyPair.prototype.verify = function verify(msg, signature) {
  26010. return this.ec.verify(msg, signature, this);
  26011. };
  26012. KeyPair.prototype.inspect = function inspect() {
  26013. return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +
  26014. ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
  26015. };
  26016. /***/ }),
  26017. /* 233 */
  26018. /*!************************************************************!*\
  26019. !*** ./node_modules/elliptic/lib/elliptic/ec/signature.js ***!
  26020. \************************************************************/
  26021. /*! no static exports found */
  26022. /***/ (function(module, exports, __webpack_require__) {
  26023. "use strict";
  26024. var BN = __webpack_require__(/*! bn.js */ 196);
  26025. var utils = __webpack_require__(/*! ../utils */ 209);
  26026. var assert = utils.assert;
  26027. function Signature(options, enc) {
  26028. if (options instanceof Signature)
  26029. return options;
  26030. if (this._importDER(options, enc))
  26031. return;
  26032. assert(options.r && options.s, 'Signature without r or s');
  26033. this.r = new BN(options.r, 16);
  26034. this.s = new BN(options.s, 16);
  26035. if (options.recoveryParam === undefined)
  26036. this.recoveryParam = null;
  26037. else
  26038. this.recoveryParam = options.recoveryParam;
  26039. }
  26040. module.exports = Signature;
  26041. function Position() {
  26042. this.place = 0;
  26043. }
  26044. function getLength(buf, p) {
  26045. var initial = buf[p.place++];
  26046. if (!(initial & 0x80)) {
  26047. return initial;
  26048. }
  26049. var octetLen = initial & 0xf;
  26050. var val = 0;
  26051. for (var i = 0, off = p.place; i < octetLen; i++, off++) {
  26052. val <<= 8;
  26053. val |= buf[off];
  26054. }
  26055. p.place = off;
  26056. return val;
  26057. }
  26058. function rmPadding(buf) {
  26059. var i = 0;
  26060. var len = buf.length - 1;
  26061. while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
  26062. i++;
  26063. }
  26064. if (i === 0) {
  26065. return buf;
  26066. }
  26067. return buf.slice(i);
  26068. }
  26069. Signature.prototype._importDER = function _importDER(data, enc) {
  26070. data = utils.toArray(data, enc);
  26071. var p = new Position();
  26072. if (data[p.place++] !== 0x30) {
  26073. return false;
  26074. }
  26075. var len = getLength(data, p);
  26076. if ((len + p.place) !== data.length) {
  26077. return false;
  26078. }
  26079. if (data[p.place++] !== 0x02) {
  26080. return false;
  26081. }
  26082. var rlen = getLength(data, p);
  26083. var r = data.slice(p.place, rlen + p.place);
  26084. p.place += rlen;
  26085. if (data[p.place++] !== 0x02) {
  26086. return false;
  26087. }
  26088. var slen = getLength(data, p);
  26089. if (data.length !== slen + p.place) {
  26090. return false;
  26091. }
  26092. var s = data.slice(p.place, slen + p.place);
  26093. if (r[0] === 0 && (r[1] & 0x80)) {
  26094. r = r.slice(1);
  26095. }
  26096. if (s[0] === 0 && (s[1] & 0x80)) {
  26097. s = s.slice(1);
  26098. }
  26099. this.r = new BN(r);
  26100. this.s = new BN(s);
  26101. this.recoveryParam = null;
  26102. return true;
  26103. };
  26104. function constructLength(arr, len) {
  26105. if (len < 0x80) {
  26106. arr.push(len);
  26107. return;
  26108. }
  26109. var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
  26110. arr.push(octets | 0x80);
  26111. while (--octets) {
  26112. arr.push((len >>> (octets << 3)) & 0xff);
  26113. }
  26114. arr.push(len);
  26115. }
  26116. Signature.prototype.toDER = function toDER(enc) {
  26117. var r = this.r.toArray();
  26118. var s = this.s.toArray();
  26119. // Pad values
  26120. if (r[0] & 0x80)
  26121. r = [ 0 ].concat(r);
  26122. // Pad values
  26123. if (s[0] & 0x80)
  26124. s = [ 0 ].concat(s);
  26125. r = rmPadding(r);
  26126. s = rmPadding(s);
  26127. while (!s[0] && !(s[1] & 0x80)) {
  26128. s = s.slice(1);
  26129. }
  26130. var arr = [ 0x02 ];
  26131. constructLength(arr, r.length);
  26132. arr = arr.concat(r);
  26133. arr.push(0x02);
  26134. constructLength(arr, s.length);
  26135. var backHalf = arr.concat(s);
  26136. var res = [ 0x30 ];
  26137. constructLength(res, backHalf.length);
  26138. res = res.concat(backHalf);
  26139. return utils.encode(res, enc);
  26140. };
  26141. /***/ }),
  26142. /* 234 */
  26143. /*!***********************************************************!*\
  26144. !*** ./node_modules/elliptic/lib/elliptic/eddsa/index.js ***!
  26145. \***********************************************************/
  26146. /*! no static exports found */
  26147. /***/ (function(module, exports, __webpack_require__) {
  26148. "use strict";
  26149. var hash = __webpack_require__(/*! hash.js */ 217);
  26150. var curves = __webpack_require__(/*! ../curves */ 216);
  26151. var utils = __webpack_require__(/*! ../utils */ 209);
  26152. var assert = utils.assert;
  26153. var parseBytes = utils.parseBytes;
  26154. var KeyPair = __webpack_require__(/*! ./key */ 235);
  26155. var Signature = __webpack_require__(/*! ./signature */ 236);
  26156. function EDDSA(curve) {
  26157. assert(curve === 'ed25519', 'only tested with ed25519 so far');
  26158. if (!(this instanceof EDDSA))
  26159. return new EDDSA(curve);
  26160. var curve = curves[curve].curve;
  26161. this.curve = curve;
  26162. this.g = curve.g;
  26163. this.g.precompute(curve.n.bitLength() + 1);
  26164. this.pointClass = curve.point().constructor;
  26165. this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
  26166. this.hash = hash.sha512;
  26167. }
  26168. module.exports = EDDSA;
  26169. /**
  26170. * @param {Array|String} message - message bytes
  26171. * @param {Array|String|KeyPair} secret - secret bytes or a keypair
  26172. * @returns {Signature} - signature
  26173. */
  26174. EDDSA.prototype.sign = function sign(message, secret) {
  26175. message = parseBytes(message);
  26176. var key = this.keyFromSecret(secret);
  26177. var r = this.hashInt(key.messagePrefix(), message);
  26178. var R = this.g.mul(r);
  26179. var Rencoded = this.encodePoint(R);
  26180. var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
  26181. .mul(key.priv());
  26182. var S = r.add(s_).umod(this.curve.n);
  26183. return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
  26184. };
  26185. /**
  26186. * @param {Array} message - message bytes
  26187. * @param {Array|String|Signature} sig - sig bytes
  26188. * @param {Array|String|Point|KeyPair} pub - public key
  26189. * @returns {Boolean} - true if public key matches sig of message
  26190. */
  26191. EDDSA.prototype.verify = function verify(message, sig, pub) {
  26192. message = parseBytes(message);
  26193. sig = this.makeSignature(sig);
  26194. var key = this.keyFromPublic(pub);
  26195. var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
  26196. var SG = this.g.mul(sig.S());
  26197. var RplusAh = sig.R().add(key.pub().mul(h));
  26198. return RplusAh.eq(SG);
  26199. };
  26200. EDDSA.prototype.hashInt = function hashInt() {
  26201. var hash = this.hash();
  26202. for (var i = 0; i < arguments.length; i++)
  26203. hash.update(arguments[i]);
  26204. return utils.intFromLE(hash.digest()).umod(this.curve.n);
  26205. };
  26206. EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
  26207. return KeyPair.fromPublic(this, pub);
  26208. };
  26209. EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
  26210. return KeyPair.fromSecret(this, secret);
  26211. };
  26212. EDDSA.prototype.makeSignature = function makeSignature(sig) {
  26213. if (sig instanceof Signature)
  26214. return sig;
  26215. return new Signature(this, sig);
  26216. };
  26217. /**
  26218. * * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
  26219. *
  26220. * EDDSA defines methods for encoding and decoding points and integers. These are
  26221. * helper convenience methods, that pass along to utility functions implied
  26222. * parameters.
  26223. *
  26224. */
  26225. EDDSA.prototype.encodePoint = function encodePoint(point) {
  26226. var enc = point.getY().toArray('le', this.encodingLength);
  26227. enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
  26228. return enc;
  26229. };
  26230. EDDSA.prototype.decodePoint = function decodePoint(bytes) {
  26231. bytes = utils.parseBytes(bytes);
  26232. var lastIx = bytes.length - 1;
  26233. var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
  26234. var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
  26235. var y = utils.intFromLE(normed);
  26236. return this.curve.pointFromY(y, xIsOdd);
  26237. };
  26238. EDDSA.prototype.encodeInt = function encodeInt(num) {
  26239. return num.toArray('le', this.encodingLength);
  26240. };
  26241. EDDSA.prototype.decodeInt = function decodeInt(bytes) {
  26242. return utils.intFromLE(bytes);
  26243. };
  26244. EDDSA.prototype.isPoint = function isPoint(val) {
  26245. return val instanceof this.pointClass;
  26246. };
  26247. /***/ }),
  26248. /* 235 */
  26249. /*!*********************************************************!*\
  26250. !*** ./node_modules/elliptic/lib/elliptic/eddsa/key.js ***!
  26251. \*********************************************************/
  26252. /*! no static exports found */
  26253. /***/ (function(module, exports, __webpack_require__) {
  26254. "use strict";
  26255. var utils = __webpack_require__(/*! ../utils */ 209);
  26256. var assert = utils.assert;
  26257. var parseBytes = utils.parseBytes;
  26258. var cachedProperty = utils.cachedProperty;
  26259. /**
  26260. * @param {EDDSA} eddsa - instance
  26261. * @param {Object} params - public/private key parameters
  26262. *
  26263. * @param {Array<Byte>} [params.secret] - secret seed bytes
  26264. * @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
  26265. * @param {Array<Byte>} [params.pub] - public key point encoded as bytes
  26266. *
  26267. */
  26268. function KeyPair(eddsa, params) {
  26269. this.eddsa = eddsa;
  26270. this._secret = parseBytes(params.secret);
  26271. if (eddsa.isPoint(params.pub))
  26272. this._pub = params.pub;
  26273. else
  26274. this._pubBytes = parseBytes(params.pub);
  26275. }
  26276. KeyPair.fromPublic = function fromPublic(eddsa, pub) {
  26277. if (pub instanceof KeyPair)
  26278. return pub;
  26279. return new KeyPair(eddsa, { pub: pub });
  26280. };
  26281. KeyPair.fromSecret = function fromSecret(eddsa, secret) {
  26282. if (secret instanceof KeyPair)
  26283. return secret;
  26284. return new KeyPair(eddsa, { secret: secret });
  26285. };
  26286. KeyPair.prototype.secret = function secret() {
  26287. return this._secret;
  26288. };
  26289. cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
  26290. return this.eddsa.encodePoint(this.pub());
  26291. });
  26292. cachedProperty(KeyPair, 'pub', function pub() {
  26293. if (this._pubBytes)
  26294. return this.eddsa.decodePoint(this._pubBytes);
  26295. return this.eddsa.g.mul(this.priv());
  26296. });
  26297. cachedProperty(KeyPair, 'privBytes', function privBytes() {
  26298. var eddsa = this.eddsa;
  26299. var hash = this.hash();
  26300. var lastIx = eddsa.encodingLength - 1;
  26301. var a = hash.slice(0, eddsa.encodingLength);
  26302. a[0] &= 248;
  26303. a[lastIx] &= 127;
  26304. a[lastIx] |= 64;
  26305. return a;
  26306. });
  26307. cachedProperty(KeyPair, 'priv', function priv() {
  26308. return this.eddsa.decodeInt(this.privBytes());
  26309. });
  26310. cachedProperty(KeyPair, 'hash', function hash() {
  26311. return this.eddsa.hash().update(this.secret()).digest();
  26312. });
  26313. cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
  26314. return this.hash().slice(this.eddsa.encodingLength);
  26315. });
  26316. KeyPair.prototype.sign = function sign(message) {
  26317. assert(this._secret, 'KeyPair can only verify');
  26318. return this.eddsa.sign(message, this);
  26319. };
  26320. KeyPair.prototype.verify = function verify(message, sig) {
  26321. return this.eddsa.verify(message, sig, this);
  26322. };
  26323. KeyPair.prototype.getSecret = function getSecret(enc) {
  26324. assert(this._secret, 'KeyPair is public only');
  26325. return utils.encode(this.secret(), enc);
  26326. };
  26327. KeyPair.prototype.getPublic = function getPublic(enc) {
  26328. return utils.encode(this.pubBytes(), enc);
  26329. };
  26330. module.exports = KeyPair;
  26331. /***/ }),
  26332. /* 236 */
  26333. /*!***************************************************************!*\
  26334. !*** ./node_modules/elliptic/lib/elliptic/eddsa/signature.js ***!
  26335. \***************************************************************/
  26336. /*! no static exports found */
  26337. /***/ (function(module, exports, __webpack_require__) {
  26338. "use strict";
  26339. var BN = __webpack_require__(/*! bn.js */ 196);
  26340. var utils = __webpack_require__(/*! ../utils */ 209);
  26341. var assert = utils.assert;
  26342. var cachedProperty = utils.cachedProperty;
  26343. var parseBytes = utils.parseBytes;
  26344. /**
  26345. * @param {EDDSA} eddsa - eddsa instance
  26346. * @param {Array<Bytes>|Object} sig -
  26347. * @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
  26348. * @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
  26349. * @param {Array<Bytes>} [sig.Rencoded] - R point encoded
  26350. * @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
  26351. */
  26352. function Signature(eddsa, sig) {
  26353. this.eddsa = eddsa;
  26354. if (typeof sig !== 'object')
  26355. sig = parseBytes(sig);
  26356. if (Array.isArray(sig)) {
  26357. sig = {
  26358. R: sig.slice(0, eddsa.encodingLength),
  26359. S: sig.slice(eddsa.encodingLength)
  26360. };
  26361. }
  26362. assert(sig.R && sig.S, 'Signature without R or S');
  26363. if (eddsa.isPoint(sig.R))
  26364. this._R = sig.R;
  26365. if (sig.S instanceof BN)
  26366. this._S = sig.S;
  26367. this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
  26368. this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
  26369. }
  26370. cachedProperty(Signature, 'S', function S() {
  26371. return this.eddsa.decodeInt(this.Sencoded());
  26372. });
  26373. cachedProperty(Signature, 'R', function R() {
  26374. return this.eddsa.decodePoint(this.Rencoded());
  26375. });
  26376. cachedProperty(Signature, 'Rencoded', function Rencoded() {
  26377. return this.eddsa.encodePoint(this.R());
  26378. });
  26379. cachedProperty(Signature, 'Sencoded', function Sencoded() {
  26380. return this.eddsa.encodeInt(this.S());
  26381. });
  26382. Signature.prototype.toBytes = function toBytes() {
  26383. return this.Rencoded().concat(this.Sencoded());
  26384. };
  26385. Signature.prototype.toHex = function toHex() {
  26386. return utils.encode(this.toBytes(), 'hex').toUpperCase();
  26387. };
  26388. module.exports = Signature;
  26389. /***/ }),
  26390. /* 237 */
  26391. /*!******************************************!*\
  26392. !*** ./node_modules/parse-asn1/index.js ***!
  26393. \******************************************/
  26394. /*! no static exports found */
  26395. /***/ (function(module, exports, __webpack_require__) {
  26396. var asn1 = __webpack_require__(/*! ./asn1 */ 238)
  26397. var aesid = __webpack_require__(/*! ./aesid.json */ 255)
  26398. var fixProc = __webpack_require__(/*! ./fixProc */ 256)
  26399. var ciphers = __webpack_require__(/*! browserify-aes */ 174)
  26400. var compat = __webpack_require__(/*! pbkdf2 */ 159)
  26401. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  26402. module.exports = parseKeys
  26403. function parseKeys (buffer) {
  26404. var password
  26405. if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {
  26406. password = buffer.passphrase
  26407. buffer = buffer.key
  26408. }
  26409. if (typeof buffer === 'string') {
  26410. buffer = Buffer.from(buffer)
  26411. }
  26412. var stripped = fixProc(buffer, password)
  26413. var type = stripped.tag
  26414. var data = stripped.data
  26415. var subtype, ndata
  26416. switch (type) {
  26417. case 'CERTIFICATE':
  26418. ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo
  26419. // falls through
  26420. case 'PUBLIC KEY':
  26421. if (!ndata) {
  26422. ndata = asn1.PublicKey.decode(data, 'der')
  26423. }
  26424. subtype = ndata.algorithm.algorithm.join('.')
  26425. switch (subtype) {
  26426. case '1.2.840.113549.1.1.1':
  26427. return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')
  26428. case '1.2.840.10045.2.1':
  26429. ndata.subjectPrivateKey = ndata.subjectPublicKey
  26430. return {
  26431. type: 'ec',
  26432. data: ndata
  26433. }
  26434. case '1.2.840.10040.4.1':
  26435. ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')
  26436. return {
  26437. type: 'dsa',
  26438. data: ndata.algorithm.params
  26439. }
  26440. default: throw new Error('unknown key id ' + subtype)
  26441. }
  26442. throw new Error('unknown key type ' + type)
  26443. case 'ENCRYPTED PRIVATE KEY':
  26444. data = asn1.EncryptedPrivateKey.decode(data, 'der')
  26445. data = decrypt(data, password)
  26446. // falls through
  26447. case 'PRIVATE KEY':
  26448. ndata = asn1.PrivateKey.decode(data, 'der')
  26449. subtype = ndata.algorithm.algorithm.join('.')
  26450. switch (subtype) {
  26451. case '1.2.840.113549.1.1.1':
  26452. return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')
  26453. case '1.2.840.10045.2.1':
  26454. return {
  26455. curve: ndata.algorithm.curve,
  26456. privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
  26457. }
  26458. case '1.2.840.10040.4.1':
  26459. ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')
  26460. return {
  26461. type: 'dsa',
  26462. params: ndata.algorithm.params
  26463. }
  26464. default: throw new Error('unknown key id ' + subtype)
  26465. }
  26466. throw new Error('unknown key type ' + type)
  26467. case 'RSA PUBLIC KEY':
  26468. return asn1.RSAPublicKey.decode(data, 'der')
  26469. case 'RSA PRIVATE KEY':
  26470. return asn1.RSAPrivateKey.decode(data, 'der')
  26471. case 'DSA PRIVATE KEY':
  26472. return {
  26473. type: 'dsa',
  26474. params: asn1.DSAPrivateKey.decode(data, 'der')
  26475. }
  26476. case 'EC PRIVATE KEY':
  26477. data = asn1.ECPrivateKey.decode(data, 'der')
  26478. return {
  26479. curve: data.parameters.value,
  26480. privateKey: data.privateKey
  26481. }
  26482. default: throw new Error('unknown key type ' + type)
  26483. }
  26484. }
  26485. parseKeys.signature = asn1.signature
  26486. function decrypt (data, password) {
  26487. var salt = data.algorithm.decrypt.kde.kdeparams.salt
  26488. var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)
  26489. var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]
  26490. var iv = data.algorithm.decrypt.cipher.iv
  26491. var cipherText = data.subjectPrivateKey
  26492. var keylen = parseInt(algo.split('-')[1], 10) / 8
  26493. var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1')
  26494. var cipher = ciphers.createDecipheriv(algo, key, iv)
  26495. var out = []
  26496. out.push(cipher.update(cipherText))
  26497. out.push(cipher.final())
  26498. return Buffer.concat(out)
  26499. }
  26500. /***/ }),
  26501. /* 238 */
  26502. /*!*****************************************!*\
  26503. !*** ./node_modules/parse-asn1/asn1.js ***!
  26504. \*****************************************/
  26505. /*! no static exports found */
  26506. /***/ (function(module, exports, __webpack_require__) {
  26507. "use strict";
  26508. // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
  26509. // Fedor, you are amazing.
  26510. var asn1 = __webpack_require__(/*! asn1.js */ 239)
  26511. exports.certificate = __webpack_require__(/*! ./certificate */ 254)
  26512. var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
  26513. this.seq().obj(
  26514. this.key('version').int(),
  26515. this.key('modulus').int(),
  26516. this.key('publicExponent').int(),
  26517. this.key('privateExponent').int(),
  26518. this.key('prime1').int(),
  26519. this.key('prime2').int(),
  26520. this.key('exponent1').int(),
  26521. this.key('exponent2').int(),
  26522. this.key('coefficient').int()
  26523. )
  26524. })
  26525. exports.RSAPrivateKey = RSAPrivateKey
  26526. var RSAPublicKey = asn1.define('RSAPublicKey', function () {
  26527. this.seq().obj(
  26528. this.key('modulus').int(),
  26529. this.key('publicExponent').int()
  26530. )
  26531. })
  26532. exports.RSAPublicKey = RSAPublicKey
  26533. var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
  26534. this.seq().obj(
  26535. this.key('algorithm').use(AlgorithmIdentifier),
  26536. this.key('subjectPublicKey').bitstr()
  26537. )
  26538. })
  26539. exports.PublicKey = PublicKey
  26540. var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {
  26541. this.seq().obj(
  26542. this.key('algorithm').objid(),
  26543. this.key('none').null_().optional(),
  26544. this.key('curve').objid().optional(),
  26545. this.key('params').seq().obj(
  26546. this.key('p').int(),
  26547. this.key('q').int(),
  26548. this.key('g').int()
  26549. ).optional()
  26550. )
  26551. })
  26552. var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {
  26553. this.seq().obj(
  26554. this.key('version').int(),
  26555. this.key('algorithm').use(AlgorithmIdentifier),
  26556. this.key('subjectPrivateKey').octstr()
  26557. )
  26558. })
  26559. exports.PrivateKey = PrivateKeyInfo
  26560. var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {
  26561. this.seq().obj(
  26562. this.key('algorithm').seq().obj(
  26563. this.key('id').objid(),
  26564. this.key('decrypt').seq().obj(
  26565. this.key('kde').seq().obj(
  26566. this.key('id').objid(),
  26567. this.key('kdeparams').seq().obj(
  26568. this.key('salt').octstr(),
  26569. this.key('iters').int()
  26570. )
  26571. ),
  26572. this.key('cipher').seq().obj(
  26573. this.key('algo').objid(),
  26574. this.key('iv').octstr()
  26575. )
  26576. )
  26577. ),
  26578. this.key('subjectPrivateKey').octstr()
  26579. )
  26580. })
  26581. exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo
  26582. var DSAPrivateKey = asn1.define('DSAPrivateKey', function () {
  26583. this.seq().obj(
  26584. this.key('version').int(),
  26585. this.key('p').int(),
  26586. this.key('q').int(),
  26587. this.key('g').int(),
  26588. this.key('pub_key').int(),
  26589. this.key('priv_key').int()
  26590. )
  26591. })
  26592. exports.DSAPrivateKey = DSAPrivateKey
  26593. exports.DSAparam = asn1.define('DSAparam', function () {
  26594. this.int()
  26595. })
  26596. var ECPrivateKey = asn1.define('ECPrivateKey', function () {
  26597. this.seq().obj(
  26598. this.key('version').int(),
  26599. this.key('privateKey').octstr(),
  26600. this.key('parameters').optional().explicit(0).use(ECParameters),
  26601. this.key('publicKey').optional().explicit(1).bitstr()
  26602. )
  26603. })
  26604. exports.ECPrivateKey = ECPrivateKey
  26605. var ECParameters = asn1.define('ECParameters', function () {
  26606. this.choice({
  26607. namedCurve: this.objid()
  26608. })
  26609. })
  26610. exports.signature = asn1.define('signature', function () {
  26611. this.seq().obj(
  26612. this.key('r').int(),
  26613. this.key('s').int()
  26614. )
  26615. })
  26616. /***/ }),
  26617. /* 239 */
  26618. /*!******************************************!*\
  26619. !*** ./node_modules/asn1.js/lib/asn1.js ***!
  26620. \******************************************/
  26621. /*! no static exports found */
  26622. /***/ (function(module, exports, __webpack_require__) {
  26623. var asn1 = exports;
  26624. asn1.bignum = __webpack_require__(/*! bn.js */ 196);
  26625. asn1.define = __webpack_require__(/*! ./asn1/api */ 240).define;
  26626. asn1.base = __webpack_require__(/*! ./asn1/base */ 242);
  26627. asn1.constants = __webpack_require__(/*! ./asn1/constants */ 246);
  26628. asn1.decoders = __webpack_require__(/*! ./asn1/decoders */ 248);
  26629. asn1.encoders = __webpack_require__(/*! ./asn1/encoders */ 251);
  26630. /***/ }),
  26631. /* 240 */
  26632. /*!**********************************************!*\
  26633. !*** ./node_modules/asn1.js/lib/asn1/api.js ***!
  26634. \**********************************************/
  26635. /*! no static exports found */
  26636. /***/ (function(module, exports, __webpack_require__) {
  26637. var asn1 = __webpack_require__(/*! ../asn1 */ 239);
  26638. var inherits = __webpack_require__(/*! inherits */ 120);
  26639. var api = exports;
  26640. api.define = function define(name, body) {
  26641. return new Entity(name, body);
  26642. };
  26643. function Entity(name, body) {
  26644. this.name = name;
  26645. this.body = body;
  26646. this.decoders = {};
  26647. this.encoders = {};
  26648. };
  26649. Entity.prototype._createNamed = function createNamed(base) {
  26650. var named;
  26651. try {
  26652. named = __webpack_require__(/*! vm */ 241).runInThisContext(
  26653. '(function ' + this.name + '(entity) {\n' +
  26654. ' this._initNamed(entity);\n' +
  26655. '})'
  26656. );
  26657. } catch (e) {
  26658. named = function (entity) {
  26659. this._initNamed(entity);
  26660. };
  26661. }
  26662. inherits(named, base);
  26663. named.prototype._initNamed = function initnamed(entity) {
  26664. base.call(this, entity);
  26665. };
  26666. return new named(this);
  26667. };
  26668. Entity.prototype._getDecoder = function _getDecoder(enc) {
  26669. enc = enc || 'der';
  26670. // Lazily create decoder
  26671. if (!this.decoders.hasOwnProperty(enc))
  26672. this.decoders[enc] = this._createNamed(asn1.decoders[enc]);
  26673. return this.decoders[enc];
  26674. };
  26675. Entity.prototype.decode = function decode(data, enc, options) {
  26676. return this._getDecoder(enc).decode(data, options);
  26677. };
  26678. Entity.prototype._getEncoder = function _getEncoder(enc) {
  26679. enc = enc || 'der';
  26680. // Lazily create encoder
  26681. if (!this.encoders.hasOwnProperty(enc))
  26682. this.encoders[enc] = this._createNamed(asn1.encoders[enc]);
  26683. return this.encoders[enc];
  26684. };
  26685. Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
  26686. return this._getEncoder(enc).encode(data, reporter);
  26687. };
  26688. /***/ }),
  26689. /* 241 */
  26690. /*!*********************************************!*\
  26691. !*** ./node_modules/vm-browserify/index.js ***!
  26692. \*********************************************/
  26693. /*! no static exports found */
  26694. /***/ (function(module, exports) {
  26695. var indexOf = function (xs, item) {
  26696. if (xs.indexOf) return xs.indexOf(item);
  26697. else for (var i = 0; i < xs.length; i++) {
  26698. if (xs[i] === item) return i;
  26699. }
  26700. return -1;
  26701. };
  26702. var Object_keys = function (obj) {
  26703. if (Object.keys) return Object.keys(obj)
  26704. else {
  26705. var res = [];
  26706. for (var key in obj) res.push(key)
  26707. return res;
  26708. }
  26709. };
  26710. var forEach = function (xs, fn) {
  26711. if (xs.forEach) return xs.forEach(fn)
  26712. else for (var i = 0; i < xs.length; i++) {
  26713. fn(xs[i], i, xs);
  26714. }
  26715. };
  26716. var defineProp = (function() {
  26717. try {
  26718. Object.defineProperty({}, '_', {});
  26719. return function(obj, name, value) {
  26720. Object.defineProperty(obj, name, {
  26721. writable: true,
  26722. enumerable: false,
  26723. configurable: true,
  26724. value: value
  26725. })
  26726. };
  26727. } catch(e) {
  26728. return function(obj, name, value) {
  26729. obj[name] = value;
  26730. };
  26731. }
  26732. }());
  26733. var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',
  26734. 'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',
  26735. 'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',
  26736. 'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',
  26737. 'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];
  26738. function Context() {}
  26739. Context.prototype = {};
  26740. var Script = exports.Script = function NodeScript (code) {
  26741. if (!(this instanceof Script)) return new Script(code);
  26742. this.code = code;
  26743. };
  26744. Script.prototype.runInContext = function (context) {
  26745. if (!(context instanceof Context)) {
  26746. throw new TypeError("needs a 'context' argument.");
  26747. }
  26748. var iframe = document.createElement('iframe');
  26749. if (!iframe.style) iframe.style = {};
  26750. iframe.style.display = 'none';
  26751. document.body.appendChild(iframe);
  26752. var win = iframe.contentWindow;
  26753. var wEval = win.eval, wExecScript = win.execScript;
  26754. if (!wEval && wExecScript) {
  26755. // win.eval() magically appears when this is called in IE:
  26756. wExecScript.call(win, 'null');
  26757. wEval = win.eval;
  26758. }
  26759. forEach(Object_keys(context), function (key) {
  26760. win[key] = context[key];
  26761. });
  26762. forEach(globals, function (key) {
  26763. if (context[key]) {
  26764. win[key] = context[key];
  26765. }
  26766. });
  26767. var winKeys = Object_keys(win);
  26768. var res = wEval.call(win, this.code);
  26769. forEach(Object_keys(win), function (key) {
  26770. // Avoid copying circular objects like `top` and `window` by only
  26771. // updating existing context properties or new properties in the `win`
  26772. // that was only introduced after the eval.
  26773. if (key in context || indexOf(winKeys, key) === -1) {
  26774. context[key] = win[key];
  26775. }
  26776. });
  26777. forEach(globals, function (key) {
  26778. if (!(key in context)) {
  26779. defineProp(context, key, win[key]);
  26780. }
  26781. });
  26782. document.body.removeChild(iframe);
  26783. return res;
  26784. };
  26785. Script.prototype.runInThisContext = function () {
  26786. return eval(this.code); // maybe...
  26787. };
  26788. Script.prototype.runInNewContext = function (context) {
  26789. var ctx = Script.createContext(context);
  26790. var res = this.runInContext(ctx);
  26791. if (context) {
  26792. forEach(Object_keys(ctx), function (key) {
  26793. context[key] = ctx[key];
  26794. });
  26795. }
  26796. return res;
  26797. };
  26798. forEach(Object_keys(Script.prototype), function (name) {
  26799. exports[name] = Script[name] = function (code) {
  26800. var s = Script(code);
  26801. return s[name].apply(s, [].slice.call(arguments, 1));
  26802. };
  26803. });
  26804. exports.isContext = function (context) {
  26805. return context instanceof Context;
  26806. };
  26807. exports.createScript = function (code) {
  26808. return exports.Script(code);
  26809. };
  26810. exports.createContext = Script.createContext = function (context) {
  26811. var copy = new Context();
  26812. if(typeof context === 'object') {
  26813. forEach(Object_keys(context), function (key) {
  26814. copy[key] = context[key];
  26815. });
  26816. }
  26817. return copy;
  26818. };
  26819. /***/ }),
  26820. /* 242 */
  26821. /*!*****************************************************!*\
  26822. !*** ./node_modules/asn1.js/lib/asn1/base/index.js ***!
  26823. \*****************************************************/
  26824. /*! no static exports found */
  26825. /***/ (function(module, exports, __webpack_require__) {
  26826. var base = exports;
  26827. base.Reporter = __webpack_require__(/*! ./reporter */ 243).Reporter;
  26828. base.DecoderBuffer = __webpack_require__(/*! ./buffer */ 244).DecoderBuffer;
  26829. base.EncoderBuffer = __webpack_require__(/*! ./buffer */ 244).EncoderBuffer;
  26830. base.Node = __webpack_require__(/*! ./node */ 245);
  26831. /***/ }),
  26832. /* 243 */
  26833. /*!********************************************************!*\
  26834. !*** ./node_modules/asn1.js/lib/asn1/base/reporter.js ***!
  26835. \********************************************************/
  26836. /*! no static exports found */
  26837. /***/ (function(module, exports, __webpack_require__) {
  26838. var inherits = __webpack_require__(/*! inherits */ 120);
  26839. function Reporter(options) {
  26840. this._reporterState = {
  26841. obj: null,
  26842. path: [],
  26843. options: options || {},
  26844. errors: []
  26845. };
  26846. }
  26847. exports.Reporter = Reporter;
  26848. Reporter.prototype.isError = function isError(obj) {
  26849. return obj instanceof ReporterError;
  26850. };
  26851. Reporter.prototype.save = function save() {
  26852. var state = this._reporterState;
  26853. return { obj: state.obj, pathLen: state.path.length };
  26854. };
  26855. Reporter.prototype.restore = function restore(data) {
  26856. var state = this._reporterState;
  26857. state.obj = data.obj;
  26858. state.path = state.path.slice(0, data.pathLen);
  26859. };
  26860. Reporter.prototype.enterKey = function enterKey(key) {
  26861. return this._reporterState.path.push(key);
  26862. };
  26863. Reporter.prototype.exitKey = function exitKey(index) {
  26864. var state = this._reporterState;
  26865. state.path = state.path.slice(0, index - 1);
  26866. };
  26867. Reporter.prototype.leaveKey = function leaveKey(index, key, value) {
  26868. var state = this._reporterState;
  26869. this.exitKey(index);
  26870. if (state.obj !== null)
  26871. state.obj[key] = value;
  26872. };
  26873. Reporter.prototype.path = function path() {
  26874. return this._reporterState.path.join('/');
  26875. };
  26876. Reporter.prototype.enterObject = function enterObject() {
  26877. var state = this._reporterState;
  26878. var prev = state.obj;
  26879. state.obj = {};
  26880. return prev;
  26881. };
  26882. Reporter.prototype.leaveObject = function leaveObject(prev) {
  26883. var state = this._reporterState;
  26884. var now = state.obj;
  26885. state.obj = prev;
  26886. return now;
  26887. };
  26888. Reporter.prototype.error = function error(msg) {
  26889. var err;
  26890. var state = this._reporterState;
  26891. var inherited = msg instanceof ReporterError;
  26892. if (inherited) {
  26893. err = msg;
  26894. } else {
  26895. err = new ReporterError(state.path.map(function(elem) {
  26896. return '[' + JSON.stringify(elem) + ']';
  26897. }).join(''), msg.message || msg, msg.stack);
  26898. }
  26899. if (!state.options.partial)
  26900. throw err;
  26901. if (!inherited)
  26902. state.errors.push(err);
  26903. return err;
  26904. };
  26905. Reporter.prototype.wrapResult = function wrapResult(result) {
  26906. var state = this._reporterState;
  26907. if (!state.options.partial)
  26908. return result;
  26909. return {
  26910. result: this.isError(result) ? null : result,
  26911. errors: state.errors
  26912. };
  26913. };
  26914. function ReporterError(path, msg) {
  26915. this.path = path;
  26916. this.rethrow(msg);
  26917. };
  26918. inherits(ReporterError, Error);
  26919. ReporterError.prototype.rethrow = function rethrow(msg) {
  26920. this.message = msg + ' at: ' + (this.path || '(shallow)');
  26921. if (Error.captureStackTrace)
  26922. Error.captureStackTrace(this, ReporterError);
  26923. if (!this.stack) {
  26924. try {
  26925. // IE only adds stack when thrown
  26926. throw new Error(this.message);
  26927. } catch (e) {
  26928. this.stack = e.stack;
  26929. }
  26930. }
  26931. return this;
  26932. };
  26933. /***/ }),
  26934. /* 244 */
  26935. /*!******************************************************!*\
  26936. !*** ./node_modules/asn1.js/lib/asn1/base/buffer.js ***!
  26937. \******************************************************/
  26938. /*! no static exports found */
  26939. /***/ (function(module, exports, __webpack_require__) {
  26940. var inherits = __webpack_require__(/*! inherits */ 120);
  26941. var Reporter = __webpack_require__(/*! ../base */ 242).Reporter;
  26942. var Buffer = __webpack_require__(/*! buffer */ 115).Buffer;
  26943. function DecoderBuffer(base, options) {
  26944. Reporter.call(this, options);
  26945. if (!Buffer.isBuffer(base)) {
  26946. this.error('Input not Buffer');
  26947. return;
  26948. }
  26949. this.base = base;
  26950. this.offset = 0;
  26951. this.length = base.length;
  26952. }
  26953. inherits(DecoderBuffer, Reporter);
  26954. exports.DecoderBuffer = DecoderBuffer;
  26955. DecoderBuffer.prototype.save = function save() {
  26956. return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };
  26957. };
  26958. DecoderBuffer.prototype.restore = function restore(save) {
  26959. // Return skipped data
  26960. var res = new DecoderBuffer(this.base);
  26961. res.offset = save.offset;
  26962. res.length = this.offset;
  26963. this.offset = save.offset;
  26964. Reporter.prototype.restore.call(this, save.reporter);
  26965. return res;
  26966. };
  26967. DecoderBuffer.prototype.isEmpty = function isEmpty() {
  26968. return this.offset === this.length;
  26969. };
  26970. DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {
  26971. if (this.offset + 1 <= this.length)
  26972. return this.base.readUInt8(this.offset++, true);
  26973. else
  26974. return this.error(fail || 'DecoderBuffer overrun');
  26975. }
  26976. DecoderBuffer.prototype.skip = function skip(bytes, fail) {
  26977. if (!(this.offset + bytes <= this.length))
  26978. return this.error(fail || 'DecoderBuffer overrun');
  26979. var res = new DecoderBuffer(this.base);
  26980. // Share reporter state
  26981. res._reporterState = this._reporterState;
  26982. res.offset = this.offset;
  26983. res.length = this.offset + bytes;
  26984. this.offset += bytes;
  26985. return res;
  26986. }
  26987. DecoderBuffer.prototype.raw = function raw(save) {
  26988. return this.base.slice(save ? save.offset : this.offset, this.length);
  26989. }
  26990. function EncoderBuffer(value, reporter) {
  26991. if (Array.isArray(value)) {
  26992. this.length = 0;
  26993. this.value = value.map(function(item) {
  26994. if (!(item instanceof EncoderBuffer))
  26995. item = new EncoderBuffer(item, reporter);
  26996. this.length += item.length;
  26997. return item;
  26998. }, this);
  26999. } else if (typeof value === 'number') {
  27000. if (!(0 <= value && value <= 0xff))
  27001. return reporter.error('non-byte EncoderBuffer value');
  27002. this.value = value;
  27003. this.length = 1;
  27004. } else if (typeof value === 'string') {
  27005. this.value = value;
  27006. this.length = Buffer.byteLength(value);
  27007. } else if (Buffer.isBuffer(value)) {
  27008. this.value = value;
  27009. this.length = value.length;
  27010. } else {
  27011. return reporter.error('Unsupported type: ' + typeof value);
  27012. }
  27013. }
  27014. exports.EncoderBuffer = EncoderBuffer;
  27015. EncoderBuffer.prototype.join = function join(out, offset) {
  27016. if (!out)
  27017. out = new Buffer(this.length);
  27018. if (!offset)
  27019. offset = 0;
  27020. if (this.length === 0)
  27021. return out;
  27022. if (Array.isArray(this.value)) {
  27023. this.value.forEach(function(item) {
  27024. item.join(out, offset);
  27025. offset += item.length;
  27026. });
  27027. } else {
  27028. if (typeof this.value === 'number')
  27029. out[offset] = this.value;
  27030. else if (typeof this.value === 'string')
  27031. out.write(this.value, offset);
  27032. else if (Buffer.isBuffer(this.value))
  27033. this.value.copy(out, offset);
  27034. offset += this.length;
  27035. }
  27036. return out;
  27037. };
  27038. /***/ }),
  27039. /* 245 */
  27040. /*!****************************************************!*\
  27041. !*** ./node_modules/asn1.js/lib/asn1/base/node.js ***!
  27042. \****************************************************/
  27043. /*! no static exports found */
  27044. /***/ (function(module, exports, __webpack_require__) {
  27045. var Reporter = __webpack_require__(/*! ../base */ 242).Reporter;
  27046. var EncoderBuffer = __webpack_require__(/*! ../base */ 242).EncoderBuffer;
  27047. var DecoderBuffer = __webpack_require__(/*! ../base */ 242).DecoderBuffer;
  27048. var assert = __webpack_require__(/*! minimalistic-assert */ 170);
  27049. // Supported tags
  27050. var tags = [
  27051. 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',
  27052. 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',
  27053. 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',
  27054. 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'
  27055. ];
  27056. // Public methods list
  27057. var methods = [
  27058. 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',
  27059. 'any', 'contains'
  27060. ].concat(tags);
  27061. // Overrided methods list
  27062. var overrided = [
  27063. '_peekTag', '_decodeTag', '_use',
  27064. '_decodeStr', '_decodeObjid', '_decodeTime',
  27065. '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',
  27066. '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',
  27067. '_encodeNull', '_encodeInt', '_encodeBool'
  27068. ];
  27069. function Node(enc, parent) {
  27070. var state = {};
  27071. this._baseState = state;
  27072. state.enc = enc;
  27073. state.parent = parent || null;
  27074. state.children = null;
  27075. // State
  27076. state.tag = null;
  27077. state.args = null;
  27078. state.reverseArgs = null;
  27079. state.choice = null;
  27080. state.optional = false;
  27081. state.any = false;
  27082. state.obj = false;
  27083. state.use = null;
  27084. state.useDecoder = null;
  27085. state.key = null;
  27086. state['default'] = null;
  27087. state.explicit = null;
  27088. state.implicit = null;
  27089. state.contains = null;
  27090. // Should create new instance on each method
  27091. if (!state.parent) {
  27092. state.children = [];
  27093. this._wrap();
  27094. }
  27095. }
  27096. module.exports = Node;
  27097. var stateProps = [
  27098. 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',
  27099. 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',
  27100. 'implicit', 'contains'
  27101. ];
  27102. Node.prototype.clone = function clone() {
  27103. var state = this._baseState;
  27104. var cstate = {};
  27105. stateProps.forEach(function(prop) {
  27106. cstate[prop] = state[prop];
  27107. });
  27108. var res = new this.constructor(cstate.parent);
  27109. res._baseState = cstate;
  27110. return res;
  27111. };
  27112. Node.prototype._wrap = function wrap() {
  27113. var state = this._baseState;
  27114. methods.forEach(function(method) {
  27115. this[method] = function _wrappedMethod() {
  27116. var clone = new this.constructor(this);
  27117. state.children.push(clone);
  27118. return clone[method].apply(clone, arguments);
  27119. };
  27120. }, this);
  27121. };
  27122. Node.prototype._init = function init(body) {
  27123. var state = this._baseState;
  27124. assert(state.parent === null);
  27125. body.call(this);
  27126. // Filter children
  27127. state.children = state.children.filter(function(child) {
  27128. return child._baseState.parent === this;
  27129. }, this);
  27130. assert.equal(state.children.length, 1, 'Root node can have only one child');
  27131. };
  27132. Node.prototype._useArgs = function useArgs(args) {
  27133. var state = this._baseState;
  27134. // Filter children and args
  27135. var children = args.filter(function(arg) {
  27136. return arg instanceof this.constructor;
  27137. }, this);
  27138. args = args.filter(function(arg) {
  27139. return !(arg instanceof this.constructor);
  27140. }, this);
  27141. if (children.length !== 0) {
  27142. assert(state.children === null);
  27143. state.children = children;
  27144. // Replace parent to maintain backward link
  27145. children.forEach(function(child) {
  27146. child._baseState.parent = this;
  27147. }, this);
  27148. }
  27149. if (args.length !== 0) {
  27150. assert(state.args === null);
  27151. state.args = args;
  27152. state.reverseArgs = args.map(function(arg) {
  27153. if (typeof arg !== 'object' || arg.constructor !== Object)
  27154. return arg;
  27155. var res = {};
  27156. Object.keys(arg).forEach(function(key) {
  27157. if (key == (key | 0))
  27158. key |= 0;
  27159. var value = arg[key];
  27160. res[value] = key;
  27161. });
  27162. return res;
  27163. });
  27164. }
  27165. };
  27166. //
  27167. // Overrided methods
  27168. //
  27169. overrided.forEach(function(method) {
  27170. Node.prototype[method] = function _overrided() {
  27171. var state = this._baseState;
  27172. throw new Error(method + ' not implemented for encoding: ' + state.enc);
  27173. };
  27174. });
  27175. //
  27176. // Public methods
  27177. //
  27178. tags.forEach(function(tag) {
  27179. Node.prototype[tag] = function _tagMethod() {
  27180. var state = this._baseState;
  27181. var args = Array.prototype.slice.call(arguments);
  27182. assert(state.tag === null);
  27183. state.tag = tag;
  27184. this._useArgs(args);
  27185. return this;
  27186. };
  27187. });
  27188. Node.prototype.use = function use(item) {
  27189. assert(item);
  27190. var state = this._baseState;
  27191. assert(state.use === null);
  27192. state.use = item;
  27193. return this;
  27194. };
  27195. Node.prototype.optional = function optional() {
  27196. var state = this._baseState;
  27197. state.optional = true;
  27198. return this;
  27199. };
  27200. Node.prototype.def = function def(val) {
  27201. var state = this._baseState;
  27202. assert(state['default'] === null);
  27203. state['default'] = val;
  27204. state.optional = true;
  27205. return this;
  27206. };
  27207. Node.prototype.explicit = function explicit(num) {
  27208. var state = this._baseState;
  27209. assert(state.explicit === null && state.implicit === null);
  27210. state.explicit = num;
  27211. return this;
  27212. };
  27213. Node.prototype.implicit = function implicit(num) {
  27214. var state = this._baseState;
  27215. assert(state.explicit === null && state.implicit === null);
  27216. state.implicit = num;
  27217. return this;
  27218. };
  27219. Node.prototype.obj = function obj() {
  27220. var state = this._baseState;
  27221. var args = Array.prototype.slice.call(arguments);
  27222. state.obj = true;
  27223. if (args.length !== 0)
  27224. this._useArgs(args);
  27225. return this;
  27226. };
  27227. Node.prototype.key = function key(newKey) {
  27228. var state = this._baseState;
  27229. assert(state.key === null);
  27230. state.key = newKey;
  27231. return this;
  27232. };
  27233. Node.prototype.any = function any() {
  27234. var state = this._baseState;
  27235. state.any = true;
  27236. return this;
  27237. };
  27238. Node.prototype.choice = function choice(obj) {
  27239. var state = this._baseState;
  27240. assert(state.choice === null);
  27241. state.choice = obj;
  27242. this._useArgs(Object.keys(obj).map(function(key) {
  27243. return obj[key];
  27244. }));
  27245. return this;
  27246. };
  27247. Node.prototype.contains = function contains(item) {
  27248. var state = this._baseState;
  27249. assert(state.use === null);
  27250. state.contains = item;
  27251. return this;
  27252. };
  27253. //
  27254. // Decoding
  27255. //
  27256. Node.prototype._decode = function decode(input, options) {
  27257. var state = this._baseState;
  27258. // Decode root node
  27259. if (state.parent === null)
  27260. return input.wrapResult(state.children[0]._decode(input, options));
  27261. var result = state['default'];
  27262. var present = true;
  27263. var prevKey = null;
  27264. if (state.key !== null)
  27265. prevKey = input.enterKey(state.key);
  27266. // Check if tag is there
  27267. if (state.optional) {
  27268. var tag = null;
  27269. if (state.explicit !== null)
  27270. tag = state.explicit;
  27271. else if (state.implicit !== null)
  27272. tag = state.implicit;
  27273. else if (state.tag !== null)
  27274. tag = state.tag;
  27275. if (tag === null && !state.any) {
  27276. // Trial and Error
  27277. var save = input.save();
  27278. try {
  27279. if (state.choice === null)
  27280. this._decodeGeneric(state.tag, input, options);
  27281. else
  27282. this._decodeChoice(input, options);
  27283. present = true;
  27284. } catch (e) {
  27285. present = false;
  27286. }
  27287. input.restore(save);
  27288. } else {
  27289. present = this._peekTag(input, tag, state.any);
  27290. if (input.isError(present))
  27291. return present;
  27292. }
  27293. }
  27294. // Push object on stack
  27295. var prevObj;
  27296. if (state.obj && present)
  27297. prevObj = input.enterObject();
  27298. if (present) {
  27299. // Unwrap explicit values
  27300. if (state.explicit !== null) {
  27301. var explicit = this._decodeTag(input, state.explicit);
  27302. if (input.isError(explicit))
  27303. return explicit;
  27304. input = explicit;
  27305. }
  27306. var start = input.offset;
  27307. // Unwrap implicit and normal values
  27308. if (state.use === null && state.choice === null) {
  27309. if (state.any)
  27310. var save = input.save();
  27311. var body = this._decodeTag(
  27312. input,
  27313. state.implicit !== null ? state.implicit : state.tag,
  27314. state.any
  27315. );
  27316. if (input.isError(body))
  27317. return body;
  27318. if (state.any)
  27319. result = input.raw(save);
  27320. else
  27321. input = body;
  27322. }
  27323. if (options && options.track && state.tag !== null)
  27324. options.track(input.path(), start, input.length, 'tagged');
  27325. if (options && options.track && state.tag !== null)
  27326. options.track(input.path(), input.offset, input.length, 'content');
  27327. // Select proper method for tag
  27328. if (state.any)
  27329. result = result;
  27330. else if (state.choice === null)
  27331. result = this._decodeGeneric(state.tag, input, options);
  27332. else
  27333. result = this._decodeChoice(input, options);
  27334. if (input.isError(result))
  27335. return result;
  27336. // Decode children
  27337. if (!state.any && state.choice === null && state.children !== null) {
  27338. state.children.forEach(function decodeChildren(child) {
  27339. // NOTE: We are ignoring errors here, to let parser continue with other
  27340. // parts of encoded data
  27341. child._decode(input, options);
  27342. });
  27343. }
  27344. // Decode contained/encoded by schema, only in bit or octet strings
  27345. if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {
  27346. var data = new DecoderBuffer(result);
  27347. result = this._getUse(state.contains, input._reporterState.obj)
  27348. ._decode(data, options);
  27349. }
  27350. }
  27351. // Pop object
  27352. if (state.obj && present)
  27353. result = input.leaveObject(prevObj);
  27354. // Set key
  27355. if (state.key !== null && (result !== null || present === true))
  27356. input.leaveKey(prevKey, state.key, result);
  27357. else if (prevKey !== null)
  27358. input.exitKey(prevKey);
  27359. return result;
  27360. };
  27361. Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {
  27362. var state = this._baseState;
  27363. if (tag === 'seq' || tag === 'set')
  27364. return null;
  27365. if (tag === 'seqof' || tag === 'setof')
  27366. return this._decodeList(input, tag, state.args[0], options);
  27367. else if (/str$/.test(tag))
  27368. return this._decodeStr(input, tag, options);
  27369. else if (tag === 'objid' && state.args)
  27370. return this._decodeObjid(input, state.args[0], state.args[1], options);
  27371. else if (tag === 'objid')
  27372. return this._decodeObjid(input, null, null, options);
  27373. else if (tag === 'gentime' || tag === 'utctime')
  27374. return this._decodeTime(input, tag, options);
  27375. else if (tag === 'null_')
  27376. return this._decodeNull(input, options);
  27377. else if (tag === 'bool')
  27378. return this._decodeBool(input, options);
  27379. else if (tag === 'objDesc')
  27380. return this._decodeStr(input, tag, options);
  27381. else if (tag === 'int' || tag === 'enum')
  27382. return this._decodeInt(input, state.args && state.args[0], options);
  27383. if (state.use !== null) {
  27384. return this._getUse(state.use, input._reporterState.obj)
  27385. ._decode(input, options);
  27386. } else {
  27387. return input.error('unknown tag: ' + tag);
  27388. }
  27389. };
  27390. Node.prototype._getUse = function _getUse(entity, obj) {
  27391. var state = this._baseState;
  27392. // Create altered use decoder if implicit is set
  27393. state.useDecoder = this._use(entity, obj);
  27394. assert(state.useDecoder._baseState.parent === null);
  27395. state.useDecoder = state.useDecoder._baseState.children[0];
  27396. if (state.implicit !== state.useDecoder._baseState.implicit) {
  27397. state.useDecoder = state.useDecoder.clone();
  27398. state.useDecoder._baseState.implicit = state.implicit;
  27399. }
  27400. return state.useDecoder;
  27401. };
  27402. Node.prototype._decodeChoice = function decodeChoice(input, options) {
  27403. var state = this._baseState;
  27404. var result = null;
  27405. var match = false;
  27406. Object.keys(state.choice).some(function(key) {
  27407. var save = input.save();
  27408. var node = state.choice[key];
  27409. try {
  27410. var value = node._decode(input, options);
  27411. if (input.isError(value))
  27412. return false;
  27413. result = { type: key, value: value };
  27414. match = true;
  27415. } catch (e) {
  27416. input.restore(save);
  27417. return false;
  27418. }
  27419. return true;
  27420. }, this);
  27421. if (!match)
  27422. return input.error('Choice not matched');
  27423. return result;
  27424. };
  27425. //
  27426. // Encoding
  27427. //
  27428. Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) {
  27429. return new EncoderBuffer(data, this.reporter);
  27430. };
  27431. Node.prototype._encode = function encode(data, reporter, parent) {
  27432. var state = this._baseState;
  27433. if (state['default'] !== null && state['default'] === data)
  27434. return;
  27435. var result = this._encodeValue(data, reporter, parent);
  27436. if (result === undefined)
  27437. return;
  27438. if (this._skipDefault(result, reporter, parent))
  27439. return;
  27440. return result;
  27441. };
  27442. Node.prototype._encodeValue = function encode(data, reporter, parent) {
  27443. var state = this._baseState;
  27444. // Decode root node
  27445. if (state.parent === null)
  27446. return state.children[0]._encode(data, reporter || new Reporter());
  27447. var result = null;
  27448. // Set reporter to share it with a child class
  27449. this.reporter = reporter;
  27450. // Check if data is there
  27451. if (state.optional && data === undefined) {
  27452. if (state['default'] !== null)
  27453. data = state['default']
  27454. else
  27455. return;
  27456. }
  27457. // Encode children first
  27458. var content = null;
  27459. var primitive = false;
  27460. if (state.any) {
  27461. // Anything that was given is translated to buffer
  27462. result = this._createEncoderBuffer(data);
  27463. } else if (state.choice) {
  27464. result = this._encodeChoice(data, reporter);
  27465. } else if (state.contains) {
  27466. content = this._getUse(state.contains, parent)._encode(data, reporter);
  27467. primitive = true;
  27468. } else if (state.children) {
  27469. content = state.children.map(function(child) {
  27470. if (child._baseState.tag === 'null_')
  27471. return child._encode(null, reporter, data);
  27472. if (child._baseState.key === null)
  27473. return reporter.error('Child should have a key');
  27474. var prevKey = reporter.enterKey(child._baseState.key);
  27475. if (typeof data !== 'object')
  27476. return reporter.error('Child expected, but input is not object');
  27477. var res = child._encode(data[child._baseState.key], reporter, data);
  27478. reporter.leaveKey(prevKey);
  27479. return res;
  27480. }, this).filter(function(child) {
  27481. return child;
  27482. });
  27483. content = this._createEncoderBuffer(content);
  27484. } else {
  27485. if (state.tag === 'seqof' || state.tag === 'setof') {
  27486. // TODO(indutny): this should be thrown on DSL level
  27487. if (!(state.args && state.args.length === 1))
  27488. return reporter.error('Too many args for : ' + state.tag);
  27489. if (!Array.isArray(data))
  27490. return reporter.error('seqof/setof, but data is not Array');
  27491. var child = this.clone();
  27492. child._baseState.implicit = null;
  27493. content = this._createEncoderBuffer(data.map(function(item) {
  27494. var state = this._baseState;
  27495. return this._getUse(state.args[0], data)._encode(item, reporter);
  27496. }, child));
  27497. } else if (state.use !== null) {
  27498. result = this._getUse(state.use, parent)._encode(data, reporter);
  27499. } else {
  27500. content = this._encodePrimitive(state.tag, data);
  27501. primitive = true;
  27502. }
  27503. }
  27504. // Encode data itself
  27505. var result;
  27506. if (!state.any && state.choice === null) {
  27507. var tag = state.implicit !== null ? state.implicit : state.tag;
  27508. var cls = state.implicit === null ? 'universal' : 'context';
  27509. if (tag === null) {
  27510. if (state.use === null)
  27511. reporter.error('Tag could be omitted only for .use()');
  27512. } else {
  27513. if (state.use === null)
  27514. result = this._encodeComposite(tag, primitive, cls, content);
  27515. }
  27516. }
  27517. // Wrap in explicit
  27518. if (state.explicit !== null)
  27519. result = this._encodeComposite(state.explicit, false, 'context', result);
  27520. return result;
  27521. };
  27522. Node.prototype._encodeChoice = function encodeChoice(data, reporter) {
  27523. var state = this._baseState;
  27524. var node = state.choice[data.type];
  27525. if (!node) {
  27526. assert(
  27527. false,
  27528. data.type + ' not found in ' +
  27529. JSON.stringify(Object.keys(state.choice)));
  27530. }
  27531. return node._encode(data.value, reporter);
  27532. };
  27533. Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
  27534. var state = this._baseState;
  27535. if (/str$/.test(tag))
  27536. return this._encodeStr(data, tag);
  27537. else if (tag === 'objid' && state.args)
  27538. return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
  27539. else if (tag === 'objid')
  27540. return this._encodeObjid(data, null, null);
  27541. else if (tag === 'gentime' || tag === 'utctime')
  27542. return this._encodeTime(data, tag);
  27543. else if (tag === 'null_')
  27544. return this._encodeNull();
  27545. else if (tag === 'int' || tag === 'enum')
  27546. return this._encodeInt(data, state.args && state.reverseArgs[0]);
  27547. else if (tag === 'bool')
  27548. return this._encodeBool(data);
  27549. else if (tag === 'objDesc')
  27550. return this._encodeStr(data, tag);
  27551. else
  27552. throw new Error('Unsupported tag: ' + tag);
  27553. };
  27554. Node.prototype._isNumstr = function isNumstr(str) {
  27555. return /^[0-9 ]*$/.test(str);
  27556. };
  27557. Node.prototype._isPrintstr = function isPrintstr(str) {
  27558. return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str);
  27559. };
  27560. /***/ }),
  27561. /* 246 */
  27562. /*!**********************************************************!*\
  27563. !*** ./node_modules/asn1.js/lib/asn1/constants/index.js ***!
  27564. \**********************************************************/
  27565. /*! no static exports found */
  27566. /***/ (function(module, exports, __webpack_require__) {
  27567. var constants = exports;
  27568. // Helper
  27569. constants._reverse = function reverse(map) {
  27570. var res = {};
  27571. Object.keys(map).forEach(function(key) {
  27572. // Convert key to integer if it is stringified
  27573. if ((key | 0) == key)
  27574. key = key | 0;
  27575. var value = map[key];
  27576. res[value] = key;
  27577. });
  27578. return res;
  27579. };
  27580. constants.der = __webpack_require__(/*! ./der */ 247);
  27581. /***/ }),
  27582. /* 247 */
  27583. /*!********************************************************!*\
  27584. !*** ./node_modules/asn1.js/lib/asn1/constants/der.js ***!
  27585. \********************************************************/
  27586. /*! no static exports found */
  27587. /***/ (function(module, exports, __webpack_require__) {
  27588. var constants = __webpack_require__(/*! ../constants */ 246);
  27589. exports.tagClass = {
  27590. 0: 'universal',
  27591. 1: 'application',
  27592. 2: 'context',
  27593. 3: 'private'
  27594. };
  27595. exports.tagClassByName = constants._reverse(exports.tagClass);
  27596. exports.tag = {
  27597. 0x00: 'end',
  27598. 0x01: 'bool',
  27599. 0x02: 'int',
  27600. 0x03: 'bitstr',
  27601. 0x04: 'octstr',
  27602. 0x05: 'null_',
  27603. 0x06: 'objid',
  27604. 0x07: 'objDesc',
  27605. 0x08: 'external',
  27606. 0x09: 'real',
  27607. 0x0a: 'enum',
  27608. 0x0b: 'embed',
  27609. 0x0c: 'utf8str',
  27610. 0x0d: 'relativeOid',
  27611. 0x10: 'seq',
  27612. 0x11: 'set',
  27613. 0x12: 'numstr',
  27614. 0x13: 'printstr',
  27615. 0x14: 't61str',
  27616. 0x15: 'videostr',
  27617. 0x16: 'ia5str',
  27618. 0x17: 'utctime',
  27619. 0x18: 'gentime',
  27620. 0x19: 'graphstr',
  27621. 0x1a: 'iso646str',
  27622. 0x1b: 'genstr',
  27623. 0x1c: 'unistr',
  27624. 0x1d: 'charstr',
  27625. 0x1e: 'bmpstr'
  27626. };
  27627. exports.tagByName = constants._reverse(exports.tag);
  27628. /***/ }),
  27629. /* 248 */
  27630. /*!*********************************************************!*\
  27631. !*** ./node_modules/asn1.js/lib/asn1/decoders/index.js ***!
  27632. \*********************************************************/
  27633. /*! no static exports found */
  27634. /***/ (function(module, exports, __webpack_require__) {
  27635. var decoders = exports;
  27636. decoders.der = __webpack_require__(/*! ./der */ 249);
  27637. decoders.pem = __webpack_require__(/*! ./pem */ 250);
  27638. /***/ }),
  27639. /* 249 */
  27640. /*!*******************************************************!*\
  27641. !*** ./node_modules/asn1.js/lib/asn1/decoders/der.js ***!
  27642. \*******************************************************/
  27643. /*! no static exports found */
  27644. /***/ (function(module, exports, __webpack_require__) {
  27645. var inherits = __webpack_require__(/*! inherits */ 120);
  27646. var asn1 = __webpack_require__(/*! ../../asn1 */ 239);
  27647. var base = asn1.base;
  27648. var bignum = asn1.bignum;
  27649. // Import DER constants
  27650. var der = asn1.constants.der;
  27651. function DERDecoder(entity) {
  27652. this.enc = 'der';
  27653. this.name = entity.name;
  27654. this.entity = entity;
  27655. // Construct base tree
  27656. this.tree = new DERNode();
  27657. this.tree._init(entity.body);
  27658. };
  27659. module.exports = DERDecoder;
  27660. DERDecoder.prototype.decode = function decode(data, options) {
  27661. if (!(data instanceof base.DecoderBuffer))
  27662. data = new base.DecoderBuffer(data, options);
  27663. return this.tree._decode(data, options);
  27664. };
  27665. // Tree methods
  27666. function DERNode(parent) {
  27667. base.Node.call(this, 'der', parent);
  27668. }
  27669. inherits(DERNode, base.Node);
  27670. DERNode.prototype._peekTag = function peekTag(buffer, tag, any) {
  27671. if (buffer.isEmpty())
  27672. return false;
  27673. var state = buffer.save();
  27674. var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
  27675. if (buffer.isError(decodedTag))
  27676. return decodedTag;
  27677. buffer.restore(state);
  27678. return decodedTag.tag === tag || decodedTag.tagStr === tag ||
  27679. (decodedTag.tagStr + 'of') === tag || any;
  27680. };
  27681. DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {
  27682. var decodedTag = derDecodeTag(buffer,
  27683. 'Failed to decode tag of "' + tag + '"');
  27684. if (buffer.isError(decodedTag))
  27685. return decodedTag;
  27686. var len = derDecodeLen(buffer,
  27687. decodedTag.primitive,
  27688. 'Failed to get length of "' + tag + '"');
  27689. // Failure
  27690. if (buffer.isError(len))
  27691. return len;
  27692. if (!any &&
  27693. decodedTag.tag !== tag &&
  27694. decodedTag.tagStr !== tag &&
  27695. decodedTag.tagStr + 'of' !== tag) {
  27696. return buffer.error('Failed to match tag: "' + tag + '"');
  27697. }
  27698. if (decodedTag.primitive || len !== null)
  27699. return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
  27700. // Indefinite length... find END tag
  27701. var state = buffer.save();
  27702. var res = this._skipUntilEnd(
  27703. buffer,
  27704. 'Failed to skip indefinite length body: "' + this.tag + '"');
  27705. if (buffer.isError(res))
  27706. return res;
  27707. len = buffer.offset - state.offset;
  27708. buffer.restore(state);
  27709. return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
  27710. };
  27711. DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {
  27712. while (true) {
  27713. var tag = derDecodeTag(buffer, fail);
  27714. if (buffer.isError(tag))
  27715. return tag;
  27716. var len = derDecodeLen(buffer, tag.primitive, fail);
  27717. if (buffer.isError(len))
  27718. return len;
  27719. var res;
  27720. if (tag.primitive || len !== null)
  27721. res = buffer.skip(len)
  27722. else
  27723. res = this._skipUntilEnd(buffer, fail);
  27724. // Failure
  27725. if (buffer.isError(res))
  27726. return res;
  27727. if (tag.tagStr === 'end')
  27728. break;
  27729. }
  27730. };
  27731. DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,
  27732. options) {
  27733. var result = [];
  27734. while (!buffer.isEmpty()) {
  27735. var possibleEnd = this._peekTag(buffer, 'end');
  27736. if (buffer.isError(possibleEnd))
  27737. return possibleEnd;
  27738. var res = decoder.decode(buffer, 'der', options);
  27739. if (buffer.isError(res) && possibleEnd)
  27740. break;
  27741. result.push(res);
  27742. }
  27743. return result;
  27744. };
  27745. DERNode.prototype._decodeStr = function decodeStr(buffer, tag) {
  27746. if (tag === 'bitstr') {
  27747. var unused = buffer.readUInt8();
  27748. if (buffer.isError(unused))
  27749. return unused;
  27750. return { unused: unused, data: buffer.raw() };
  27751. } else if (tag === 'bmpstr') {
  27752. var raw = buffer.raw();
  27753. if (raw.length % 2 === 1)
  27754. return buffer.error('Decoding of string type: bmpstr length mismatch');
  27755. var str = '';
  27756. for (var i = 0; i < raw.length / 2; i++) {
  27757. str += String.fromCharCode(raw.readUInt16BE(i * 2));
  27758. }
  27759. return str;
  27760. } else if (tag === 'numstr') {
  27761. var numstr = buffer.raw().toString('ascii');
  27762. if (!this._isNumstr(numstr)) {
  27763. return buffer.error('Decoding of string type: ' +
  27764. 'numstr unsupported characters');
  27765. }
  27766. return numstr;
  27767. } else if (tag === 'octstr') {
  27768. return buffer.raw();
  27769. } else if (tag === 'objDesc') {
  27770. return buffer.raw();
  27771. } else if (tag === 'printstr') {
  27772. var printstr = buffer.raw().toString('ascii');
  27773. if (!this._isPrintstr(printstr)) {
  27774. return buffer.error('Decoding of string type: ' +
  27775. 'printstr unsupported characters');
  27776. }
  27777. return printstr;
  27778. } else if (/str$/.test(tag)) {
  27779. return buffer.raw().toString();
  27780. } else {
  27781. return buffer.error('Decoding of string type: ' + tag + ' unsupported');
  27782. }
  27783. };
  27784. DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {
  27785. var result;
  27786. var identifiers = [];
  27787. var ident = 0;
  27788. while (!buffer.isEmpty()) {
  27789. var subident = buffer.readUInt8();
  27790. ident <<= 7;
  27791. ident |= subident & 0x7f;
  27792. if ((subident & 0x80) === 0) {
  27793. identifiers.push(ident);
  27794. ident = 0;
  27795. }
  27796. }
  27797. if (subident & 0x80)
  27798. identifiers.push(ident);
  27799. var first = (identifiers[0] / 40) | 0;
  27800. var second = identifiers[0] % 40;
  27801. if (relative)
  27802. result = identifiers;
  27803. else
  27804. result = [first, second].concat(identifiers.slice(1));
  27805. if (values) {
  27806. var tmp = values[result.join(' ')];
  27807. if (tmp === undefined)
  27808. tmp = values[result.join('.')];
  27809. if (tmp !== undefined)
  27810. result = tmp;
  27811. }
  27812. return result;
  27813. };
  27814. DERNode.prototype._decodeTime = function decodeTime(buffer, tag) {
  27815. var str = buffer.raw().toString();
  27816. if (tag === 'gentime') {
  27817. var year = str.slice(0, 4) | 0;
  27818. var mon = str.slice(4, 6) | 0;
  27819. var day = str.slice(6, 8) | 0;
  27820. var hour = str.slice(8, 10) | 0;
  27821. var min = str.slice(10, 12) | 0;
  27822. var sec = str.slice(12, 14) | 0;
  27823. } else if (tag === 'utctime') {
  27824. var year = str.slice(0, 2) | 0;
  27825. var mon = str.slice(2, 4) | 0;
  27826. var day = str.slice(4, 6) | 0;
  27827. var hour = str.slice(6, 8) | 0;
  27828. var min = str.slice(8, 10) | 0;
  27829. var sec = str.slice(10, 12) | 0;
  27830. if (year < 70)
  27831. year = 2000 + year;
  27832. else
  27833. year = 1900 + year;
  27834. } else {
  27835. return buffer.error('Decoding ' + tag + ' time is not supported yet');
  27836. }
  27837. return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
  27838. };
  27839. DERNode.prototype._decodeNull = function decodeNull(buffer) {
  27840. return null;
  27841. };
  27842. DERNode.prototype._decodeBool = function decodeBool(buffer) {
  27843. var res = buffer.readUInt8();
  27844. if (buffer.isError(res))
  27845. return res;
  27846. else
  27847. return res !== 0;
  27848. };
  27849. DERNode.prototype._decodeInt = function decodeInt(buffer, values) {
  27850. // Bigint, return as it is (assume big endian)
  27851. var raw = buffer.raw();
  27852. var res = new bignum(raw);
  27853. if (values)
  27854. res = values[res.toString(10)] || res;
  27855. return res;
  27856. };
  27857. DERNode.prototype._use = function use(entity, obj) {
  27858. if (typeof entity === 'function')
  27859. entity = entity(obj);
  27860. return entity._getDecoder('der').tree;
  27861. };
  27862. // Utility methods
  27863. function derDecodeTag(buf, fail) {
  27864. var tag = buf.readUInt8(fail);
  27865. if (buf.isError(tag))
  27866. return tag;
  27867. var cls = der.tagClass[tag >> 6];
  27868. var primitive = (tag & 0x20) === 0;
  27869. // Multi-octet tag - load
  27870. if ((tag & 0x1f) === 0x1f) {
  27871. var oct = tag;
  27872. tag = 0;
  27873. while ((oct & 0x80) === 0x80) {
  27874. oct = buf.readUInt8(fail);
  27875. if (buf.isError(oct))
  27876. return oct;
  27877. tag <<= 7;
  27878. tag |= oct & 0x7f;
  27879. }
  27880. } else {
  27881. tag &= 0x1f;
  27882. }
  27883. var tagStr = der.tag[tag];
  27884. return {
  27885. cls: cls,
  27886. primitive: primitive,
  27887. tag: tag,
  27888. tagStr: tagStr
  27889. };
  27890. }
  27891. function derDecodeLen(buf, primitive, fail) {
  27892. var len = buf.readUInt8(fail);
  27893. if (buf.isError(len))
  27894. return len;
  27895. // Indefinite form
  27896. if (!primitive && len === 0x80)
  27897. return null;
  27898. // Definite form
  27899. if ((len & 0x80) === 0) {
  27900. // Short form
  27901. return len;
  27902. }
  27903. // Long form
  27904. var num = len & 0x7f;
  27905. if (num > 4)
  27906. return buf.error('length octect is too long');
  27907. len = 0;
  27908. for (var i = 0; i < num; i++) {
  27909. len <<= 8;
  27910. var j = buf.readUInt8(fail);
  27911. if (buf.isError(j))
  27912. return j;
  27913. len |= j;
  27914. }
  27915. return len;
  27916. }
  27917. /***/ }),
  27918. /* 250 */
  27919. /*!*******************************************************!*\
  27920. !*** ./node_modules/asn1.js/lib/asn1/decoders/pem.js ***!
  27921. \*******************************************************/
  27922. /*! no static exports found */
  27923. /***/ (function(module, exports, __webpack_require__) {
  27924. var inherits = __webpack_require__(/*! inherits */ 120);
  27925. var Buffer = __webpack_require__(/*! buffer */ 115).Buffer;
  27926. var DERDecoder = __webpack_require__(/*! ./der */ 249);
  27927. function PEMDecoder(entity) {
  27928. DERDecoder.call(this, entity);
  27929. this.enc = 'pem';
  27930. };
  27931. inherits(PEMDecoder, DERDecoder);
  27932. module.exports = PEMDecoder;
  27933. PEMDecoder.prototype.decode = function decode(data, options) {
  27934. var lines = data.toString().split(/[\r\n]+/g);
  27935. var label = options.label.toUpperCase();
  27936. var re = /^-----(BEGIN|END) ([^-]+)-----$/;
  27937. var start = -1;
  27938. var end = -1;
  27939. for (var i = 0; i < lines.length; i++) {
  27940. var match = lines[i].match(re);
  27941. if (match === null)
  27942. continue;
  27943. if (match[2] !== label)
  27944. continue;
  27945. if (start === -1) {
  27946. if (match[1] !== 'BEGIN')
  27947. break;
  27948. start = i;
  27949. } else {
  27950. if (match[1] !== 'END')
  27951. break;
  27952. end = i;
  27953. break;
  27954. }
  27955. }
  27956. if (start === -1 || end === -1)
  27957. throw new Error('PEM section not found for: ' + label);
  27958. var base64 = lines.slice(start + 1, end).join('');
  27959. // Remove excessive symbols
  27960. base64.replace(/[^a-z0-9\+\/=]+/gi, '');
  27961. var input = new Buffer(base64, 'base64');
  27962. return DERDecoder.prototype.decode.call(this, input, options);
  27963. };
  27964. /***/ }),
  27965. /* 251 */
  27966. /*!*********************************************************!*\
  27967. !*** ./node_modules/asn1.js/lib/asn1/encoders/index.js ***!
  27968. \*********************************************************/
  27969. /*! no static exports found */
  27970. /***/ (function(module, exports, __webpack_require__) {
  27971. var encoders = exports;
  27972. encoders.der = __webpack_require__(/*! ./der */ 252);
  27973. encoders.pem = __webpack_require__(/*! ./pem */ 253);
  27974. /***/ }),
  27975. /* 252 */
  27976. /*!*******************************************************!*\
  27977. !*** ./node_modules/asn1.js/lib/asn1/encoders/der.js ***!
  27978. \*******************************************************/
  27979. /*! no static exports found */
  27980. /***/ (function(module, exports, __webpack_require__) {
  27981. var inherits = __webpack_require__(/*! inherits */ 120);
  27982. var Buffer = __webpack_require__(/*! buffer */ 115).Buffer;
  27983. var asn1 = __webpack_require__(/*! ../../asn1 */ 239);
  27984. var base = asn1.base;
  27985. // Import DER constants
  27986. var der = asn1.constants.der;
  27987. function DEREncoder(entity) {
  27988. this.enc = 'der';
  27989. this.name = entity.name;
  27990. this.entity = entity;
  27991. // Construct base tree
  27992. this.tree = new DERNode();
  27993. this.tree._init(entity.body);
  27994. };
  27995. module.exports = DEREncoder;
  27996. DEREncoder.prototype.encode = function encode(data, reporter) {
  27997. return this.tree._encode(data, reporter).join();
  27998. };
  27999. // Tree methods
  28000. function DERNode(parent) {
  28001. base.Node.call(this, 'der', parent);
  28002. }
  28003. inherits(DERNode, base.Node);
  28004. DERNode.prototype._encodeComposite = function encodeComposite(tag,
  28005. primitive,
  28006. cls,
  28007. content) {
  28008. var encodedTag = encodeTag(tag, primitive, cls, this.reporter);
  28009. // Short form
  28010. if (content.length < 0x80) {
  28011. var header = new Buffer(2);
  28012. header[0] = encodedTag;
  28013. header[1] = content.length;
  28014. return this._createEncoderBuffer([ header, content ]);
  28015. }
  28016. // Long form
  28017. // Count octets required to store length
  28018. var lenOctets = 1;
  28019. for (var i = content.length; i >= 0x100; i >>= 8)
  28020. lenOctets++;
  28021. var header = new Buffer(1 + 1 + lenOctets);
  28022. header[0] = encodedTag;
  28023. header[1] = 0x80 | lenOctets;
  28024. for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)
  28025. header[i] = j & 0xff;
  28026. return this._createEncoderBuffer([ header, content ]);
  28027. };
  28028. DERNode.prototype._encodeStr = function encodeStr(str, tag) {
  28029. if (tag === 'bitstr') {
  28030. return this._createEncoderBuffer([ str.unused | 0, str.data ]);
  28031. } else if (tag === 'bmpstr') {
  28032. var buf = new Buffer(str.length * 2);
  28033. for (var i = 0; i < str.length; i++) {
  28034. buf.writeUInt16BE(str.charCodeAt(i), i * 2);
  28035. }
  28036. return this._createEncoderBuffer(buf);
  28037. } else if (tag === 'numstr') {
  28038. if (!this._isNumstr(str)) {
  28039. return this.reporter.error('Encoding of string type: numstr supports ' +
  28040. 'only digits and space');
  28041. }
  28042. return this._createEncoderBuffer(str);
  28043. } else if (tag === 'printstr') {
  28044. if (!this._isPrintstr(str)) {
  28045. return this.reporter.error('Encoding of string type: printstr supports ' +
  28046. 'only latin upper and lower case letters, ' +
  28047. 'digits, space, apostrophe, left and rigth ' +
  28048. 'parenthesis, plus sign, comma, hyphen, ' +
  28049. 'dot, slash, colon, equal sign, ' +
  28050. 'question mark');
  28051. }
  28052. return this._createEncoderBuffer(str);
  28053. } else if (/str$/.test(tag)) {
  28054. return this._createEncoderBuffer(str);
  28055. } else if (tag === 'objDesc') {
  28056. return this._createEncoderBuffer(str);
  28057. } else {
  28058. return this.reporter.error('Encoding of string type: ' + tag +
  28059. ' unsupported');
  28060. }
  28061. };
  28062. DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {
  28063. if (typeof id === 'string') {
  28064. if (!values)
  28065. return this.reporter.error('string objid given, but no values map found');
  28066. if (!values.hasOwnProperty(id))
  28067. return this.reporter.error('objid not found in values map');
  28068. id = values[id].split(/[\s\.]+/g);
  28069. for (var i = 0; i < id.length; i++)
  28070. id[i] |= 0;
  28071. } else if (Array.isArray(id)) {
  28072. id = id.slice();
  28073. for (var i = 0; i < id.length; i++)
  28074. id[i] |= 0;
  28075. }
  28076. if (!Array.isArray(id)) {
  28077. return this.reporter.error('objid() should be either array or string, ' +
  28078. 'got: ' + JSON.stringify(id));
  28079. }
  28080. if (!relative) {
  28081. if (id[1] >= 40)
  28082. return this.reporter.error('Second objid identifier OOB');
  28083. id.splice(0, 2, id[0] * 40 + id[1]);
  28084. }
  28085. // Count number of octets
  28086. var size = 0;
  28087. for (var i = 0; i < id.length; i++) {
  28088. var ident = id[i];
  28089. for (size++; ident >= 0x80; ident >>= 7)
  28090. size++;
  28091. }
  28092. var objid = new Buffer(size);
  28093. var offset = objid.length - 1;
  28094. for (var i = id.length - 1; i >= 0; i--) {
  28095. var ident = id[i];
  28096. objid[offset--] = ident & 0x7f;
  28097. while ((ident >>= 7) > 0)
  28098. objid[offset--] = 0x80 | (ident & 0x7f);
  28099. }
  28100. return this._createEncoderBuffer(objid);
  28101. };
  28102. function two(num) {
  28103. if (num < 10)
  28104. return '0' + num;
  28105. else
  28106. return num;
  28107. }
  28108. DERNode.prototype._encodeTime = function encodeTime(time, tag) {
  28109. var str;
  28110. var date = new Date(time);
  28111. if (tag === 'gentime') {
  28112. str = [
  28113. two(date.getFullYear()),
  28114. two(date.getUTCMonth() + 1),
  28115. two(date.getUTCDate()),
  28116. two(date.getUTCHours()),
  28117. two(date.getUTCMinutes()),
  28118. two(date.getUTCSeconds()),
  28119. 'Z'
  28120. ].join('');
  28121. } else if (tag === 'utctime') {
  28122. str = [
  28123. two(date.getFullYear() % 100),
  28124. two(date.getUTCMonth() + 1),
  28125. two(date.getUTCDate()),
  28126. two(date.getUTCHours()),
  28127. two(date.getUTCMinutes()),
  28128. two(date.getUTCSeconds()),
  28129. 'Z'
  28130. ].join('');
  28131. } else {
  28132. this.reporter.error('Encoding ' + tag + ' time is not supported yet');
  28133. }
  28134. return this._encodeStr(str, 'octstr');
  28135. };
  28136. DERNode.prototype._encodeNull = function encodeNull() {
  28137. return this._createEncoderBuffer('');
  28138. };
  28139. DERNode.prototype._encodeInt = function encodeInt(num, values) {
  28140. if (typeof num === 'string') {
  28141. if (!values)
  28142. return this.reporter.error('String int or enum given, but no values map');
  28143. if (!values.hasOwnProperty(num)) {
  28144. return this.reporter.error('Values map doesn\'t contain: ' +
  28145. JSON.stringify(num));
  28146. }
  28147. num = values[num];
  28148. }
  28149. // Bignum, assume big endian
  28150. if (typeof num !== 'number' && !Buffer.isBuffer(num)) {
  28151. var numArray = num.toArray();
  28152. if (!num.sign && numArray[0] & 0x80) {
  28153. numArray.unshift(0);
  28154. }
  28155. num = new Buffer(numArray);
  28156. }
  28157. if (Buffer.isBuffer(num)) {
  28158. var size = num.length;
  28159. if (num.length === 0)
  28160. size++;
  28161. var out = new Buffer(size);
  28162. num.copy(out);
  28163. if (num.length === 0)
  28164. out[0] = 0
  28165. return this._createEncoderBuffer(out);
  28166. }
  28167. if (num < 0x80)
  28168. return this._createEncoderBuffer(num);
  28169. if (num < 0x100)
  28170. return this._createEncoderBuffer([0, num]);
  28171. var size = 1;
  28172. for (var i = num; i >= 0x100; i >>= 8)
  28173. size++;
  28174. var out = new Array(size);
  28175. for (var i = out.length - 1; i >= 0; i--) {
  28176. out[i] = num & 0xff;
  28177. num >>= 8;
  28178. }
  28179. if(out[0] & 0x80) {
  28180. out.unshift(0);
  28181. }
  28182. return this._createEncoderBuffer(new Buffer(out));
  28183. };
  28184. DERNode.prototype._encodeBool = function encodeBool(value) {
  28185. return this._createEncoderBuffer(value ? 0xff : 0);
  28186. };
  28187. DERNode.prototype._use = function use(entity, obj) {
  28188. if (typeof entity === 'function')
  28189. entity = entity(obj);
  28190. return entity._getEncoder('der').tree;
  28191. };
  28192. DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {
  28193. var state = this._baseState;
  28194. var i;
  28195. if (state['default'] === null)
  28196. return false;
  28197. var data = dataBuffer.join();
  28198. if (state.defaultBuffer === undefined)
  28199. state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();
  28200. if (data.length !== state.defaultBuffer.length)
  28201. return false;
  28202. for (i=0; i < data.length; i++)
  28203. if (data[i] !== state.defaultBuffer[i])
  28204. return false;
  28205. return true;
  28206. };
  28207. // Utility methods
  28208. function encodeTag(tag, primitive, cls, reporter) {
  28209. var res;
  28210. if (tag === 'seqof')
  28211. tag = 'seq';
  28212. else if (tag === 'setof')
  28213. tag = 'set';
  28214. if (der.tagByName.hasOwnProperty(tag))
  28215. res = der.tagByName[tag];
  28216. else if (typeof tag === 'number' && (tag | 0) === tag)
  28217. res = tag;
  28218. else
  28219. return reporter.error('Unknown tag: ' + tag);
  28220. if (res >= 0x1f)
  28221. return reporter.error('Multi-octet tag encoding unsupported');
  28222. if (!primitive)
  28223. res |= 0x20;
  28224. res |= (der.tagClassByName[cls || 'universal'] << 6);
  28225. return res;
  28226. }
  28227. /***/ }),
  28228. /* 253 */
  28229. /*!*******************************************************!*\
  28230. !*** ./node_modules/asn1.js/lib/asn1/encoders/pem.js ***!
  28231. \*******************************************************/
  28232. /*! no static exports found */
  28233. /***/ (function(module, exports, __webpack_require__) {
  28234. var inherits = __webpack_require__(/*! inherits */ 120);
  28235. var DEREncoder = __webpack_require__(/*! ./der */ 252);
  28236. function PEMEncoder(entity) {
  28237. DEREncoder.call(this, entity);
  28238. this.enc = 'pem';
  28239. };
  28240. inherits(PEMEncoder, DEREncoder);
  28241. module.exports = PEMEncoder;
  28242. PEMEncoder.prototype.encode = function encode(data, options) {
  28243. var buf = DEREncoder.prototype.encode.call(this, data);
  28244. var p = buf.toString('base64');
  28245. var out = [ '-----BEGIN ' + options.label + '-----' ];
  28246. for (var i = 0; i < p.length; i += 64)
  28247. out.push(p.slice(i, i + 64));
  28248. out.push('-----END ' + options.label + '-----');
  28249. return out.join('\n');
  28250. };
  28251. /***/ }),
  28252. /* 254 */
  28253. /*!************************************************!*\
  28254. !*** ./node_modules/parse-asn1/certificate.js ***!
  28255. \************************************************/
  28256. /*! no static exports found */
  28257. /***/ (function(module, exports, __webpack_require__) {
  28258. "use strict";
  28259. // from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js
  28260. // thanks to @Rantanen
  28261. var asn = __webpack_require__(/*! asn1.js */ 239)
  28262. var Time = asn.define('Time', function () {
  28263. this.choice({
  28264. utcTime: this.utctime(),
  28265. generalTime: this.gentime()
  28266. })
  28267. })
  28268. var AttributeTypeValue = asn.define('AttributeTypeValue', function () {
  28269. this.seq().obj(
  28270. this.key('type').objid(),
  28271. this.key('value').any()
  28272. )
  28273. })
  28274. var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () {
  28275. this.seq().obj(
  28276. this.key('algorithm').objid(),
  28277. this.key('parameters').optional(),
  28278. this.key('curve').objid().optional()
  28279. )
  28280. })
  28281. var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () {
  28282. this.seq().obj(
  28283. this.key('algorithm').use(AlgorithmIdentifier),
  28284. this.key('subjectPublicKey').bitstr()
  28285. )
  28286. })
  28287. var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () {
  28288. this.setof(AttributeTypeValue)
  28289. })
  28290. var RDNSequence = asn.define('RDNSequence', function () {
  28291. this.seqof(RelativeDistinguishedName)
  28292. })
  28293. var Name = asn.define('Name', function () {
  28294. this.choice({
  28295. rdnSequence: this.use(RDNSequence)
  28296. })
  28297. })
  28298. var Validity = asn.define('Validity', function () {
  28299. this.seq().obj(
  28300. this.key('notBefore').use(Time),
  28301. this.key('notAfter').use(Time)
  28302. )
  28303. })
  28304. var Extension = asn.define('Extension', function () {
  28305. this.seq().obj(
  28306. this.key('extnID').objid(),
  28307. this.key('critical').bool().def(false),
  28308. this.key('extnValue').octstr()
  28309. )
  28310. })
  28311. var TBSCertificate = asn.define('TBSCertificate', function () {
  28312. this.seq().obj(
  28313. this.key('version').explicit(0).int().optional(),
  28314. this.key('serialNumber').int(),
  28315. this.key('signature').use(AlgorithmIdentifier),
  28316. this.key('issuer').use(Name),
  28317. this.key('validity').use(Validity),
  28318. this.key('subject').use(Name),
  28319. this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo),
  28320. this.key('issuerUniqueID').implicit(1).bitstr().optional(),
  28321. this.key('subjectUniqueID').implicit(2).bitstr().optional(),
  28322. this.key('extensions').explicit(3).seqof(Extension).optional()
  28323. )
  28324. })
  28325. var X509Certificate = asn.define('X509Certificate', function () {
  28326. this.seq().obj(
  28327. this.key('tbsCertificate').use(TBSCertificate),
  28328. this.key('signatureAlgorithm').use(AlgorithmIdentifier),
  28329. this.key('signatureValue').bitstr()
  28330. )
  28331. })
  28332. module.exports = X509Certificate
  28333. /***/ }),
  28334. /* 255 */
  28335. /*!********************************************!*\
  28336. !*** ./node_modules/parse-asn1/aesid.json ***!
  28337. \********************************************/
  28338. /*! exports provided: 2.16.840.1.101.3.4.1.1, 2.16.840.1.101.3.4.1.2, 2.16.840.1.101.3.4.1.3, 2.16.840.1.101.3.4.1.4, 2.16.840.1.101.3.4.1.21, 2.16.840.1.101.3.4.1.22, 2.16.840.1.101.3.4.1.23, 2.16.840.1.101.3.4.1.24, 2.16.840.1.101.3.4.1.41, 2.16.840.1.101.3.4.1.42, 2.16.840.1.101.3.4.1.43, 2.16.840.1.101.3.4.1.44, default */
  28339. /***/ (function(module) {
  28340. module.exports = JSON.parse("{\"2.16.840.1.101.3.4.1.1\":\"aes-128-ecb\",\"2.16.840.1.101.3.4.1.2\":\"aes-128-cbc\",\"2.16.840.1.101.3.4.1.3\":\"aes-128-ofb\",\"2.16.840.1.101.3.4.1.4\":\"aes-128-cfb\",\"2.16.840.1.101.3.4.1.21\":\"aes-192-ecb\",\"2.16.840.1.101.3.4.1.22\":\"aes-192-cbc\",\"2.16.840.1.101.3.4.1.23\":\"aes-192-ofb\",\"2.16.840.1.101.3.4.1.24\":\"aes-192-cfb\",\"2.16.840.1.101.3.4.1.41\":\"aes-256-ecb\",\"2.16.840.1.101.3.4.1.42\":\"aes-256-cbc\",\"2.16.840.1.101.3.4.1.43\":\"aes-256-ofb\",\"2.16.840.1.101.3.4.1.44\":\"aes-256-cfb\"}");
  28341. /***/ }),
  28342. /* 256 */
  28343. /*!********************************************!*\
  28344. !*** ./node_modules/parse-asn1/fixProc.js ***!
  28345. \********************************************/
  28346. /*! no static exports found */
  28347. /***/ (function(module, exports, __webpack_require__) {
  28348. // adapted from https://github.com/apatil/pemstrip
  28349. var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m
  28350. var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m
  28351. var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m
  28352. var evp = __webpack_require__(/*! evp_bytestokey */ 191)
  28353. var ciphers = __webpack_require__(/*! browserify-aes */ 174)
  28354. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  28355. module.exports = function (okey, password) {
  28356. var key = okey.toString()
  28357. var match = key.match(findProc)
  28358. var decrypted
  28359. if (!match) {
  28360. var match2 = key.match(fullRegex)
  28361. decrypted = new Buffer(match2[2].replace(/[\r\n]/g, ''), 'base64')
  28362. } else {
  28363. var suite = 'aes' + match[1]
  28364. var iv = Buffer.from(match[2], 'hex')
  28365. var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64')
  28366. var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key
  28367. var out = []
  28368. var cipher = ciphers.createDecipheriv(suite, cipherKey, iv)
  28369. out.push(cipher.update(cipherText))
  28370. out.push(cipher.final())
  28371. decrypted = Buffer.concat(out)
  28372. }
  28373. var tag = key.match(startRegex)[1]
  28374. return {
  28375. tag: tag,
  28376. data: decrypted
  28377. }
  28378. }
  28379. /***/ }),
  28380. /* 257 */
  28381. /*!**********************************************************!*\
  28382. !*** ./node_modules/browserify-sign/browser/curves.json ***!
  28383. \**********************************************************/
  28384. /*! exports provided: 1.3.132.0.10, 1.3.132.0.33, 1.2.840.10045.3.1.1, 1.2.840.10045.3.1.7, 1.3.132.0.34, 1.3.132.0.35, default */
  28385. /***/ (function(module) {
  28386. module.exports = JSON.parse("{\"1.3.132.0.10\":\"secp256k1\",\"1.3.132.0.33\":\"p224\",\"1.2.840.10045.3.1.1\":\"p192\",\"1.2.840.10045.3.1.7\":\"p256\",\"1.3.132.0.34\":\"p384\",\"1.3.132.0.35\":\"p521\"}");
  28387. /***/ }),
  28388. /* 258 */
  28389. /*!********************************************************!*\
  28390. !*** ./node_modules/browserify-sign/browser/verify.js ***!
  28391. \********************************************************/
  28392. /*! no static exports found */
  28393. /***/ (function(module, exports, __webpack_require__) {
  28394. // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
  28395. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  28396. var BN = __webpack_require__(/*! bn.js */ 196)
  28397. var EC = __webpack_require__(/*! elliptic */ 207).ec
  28398. var parseKeys = __webpack_require__(/*! parse-asn1 */ 237)
  28399. var curves = __webpack_require__(/*! ./curves.json */ 257)
  28400. function verify (sig, hash, key, signType, tag) {
  28401. var pub = parseKeys(key)
  28402. if (pub.type === 'ec') {
  28403. // rsa keys can be interpreted as ecdsa ones in openssl
  28404. if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
  28405. return ecVerify(sig, hash, pub)
  28406. } else if (pub.type === 'dsa') {
  28407. if (signType !== 'dsa') throw new Error('wrong public key type')
  28408. return dsaVerify(sig, hash, pub)
  28409. } else {
  28410. if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
  28411. }
  28412. hash = Buffer.concat([tag, hash])
  28413. var len = pub.modulus.byteLength()
  28414. var pad = [1]
  28415. var padNum = 0
  28416. while (hash.length + pad.length + 2 < len) {
  28417. pad.push(0xff)
  28418. padNum++
  28419. }
  28420. pad.push(0x00)
  28421. var i = -1
  28422. while (++i < hash.length) {
  28423. pad.push(hash[i])
  28424. }
  28425. pad = Buffer.from(pad)
  28426. var red = BN.mont(pub.modulus)
  28427. sig = new BN(sig).toRed(red)
  28428. sig = sig.redPow(new BN(pub.publicExponent))
  28429. sig = Buffer.from(sig.fromRed().toArray())
  28430. var out = padNum < 8 ? 1 : 0
  28431. len = Math.min(sig.length, pad.length)
  28432. if (sig.length !== pad.length) out = 1
  28433. i = -1
  28434. while (++i < len) out |= sig[i] ^ pad[i]
  28435. return out === 0
  28436. }
  28437. function ecVerify (sig, hash, pub) {
  28438. var curveId = curves[pub.data.algorithm.curve.join('.')]
  28439. if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'))
  28440. var curve = new EC(curveId)
  28441. var pubkey = pub.data.subjectPrivateKey.data
  28442. return curve.verify(hash, sig, pubkey)
  28443. }
  28444. function dsaVerify (sig, hash, pub) {
  28445. var p = pub.data.p
  28446. var q = pub.data.q
  28447. var g = pub.data.g
  28448. var y = pub.data.pub_key
  28449. var unpacked = parseKeys.signature.decode(sig, 'der')
  28450. var s = unpacked.s
  28451. var r = unpacked.r
  28452. checkValue(s, q)
  28453. checkValue(r, q)
  28454. var montp = BN.mont(p)
  28455. var w = s.invm(q)
  28456. var v = g.toRed(montp)
  28457. .redPow(new BN(hash).mul(w).mod(q))
  28458. .fromRed()
  28459. .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed())
  28460. .mod(p)
  28461. .mod(q)
  28462. return v.cmp(r) === 0
  28463. }
  28464. function checkValue (b, q) {
  28465. if (b.cmpn(0) <= 0) throw new Error('invalid sig')
  28466. if (b.cmp(q) >= q) throw new Error('invalid sig')
  28467. }
  28468. module.exports = verify
  28469. /***/ }),
  28470. /* 259 */
  28471. /*!*********************************************!*\
  28472. !*** ./node_modules/create-ecdh/browser.js ***!
  28473. \*********************************************/
  28474. /*! no static exports found */
  28475. /***/ (function(module, exports, __webpack_require__) {
  28476. /* WEBPACK VAR INJECTION */(function(Buffer) {var elliptic = __webpack_require__(/*! elliptic */ 207)
  28477. var BN = __webpack_require__(/*! bn.js */ 196)
  28478. module.exports = function createECDH (curve) {
  28479. return new ECDH(curve)
  28480. }
  28481. var aliases = {
  28482. secp256k1: {
  28483. name: 'secp256k1',
  28484. byteLength: 32
  28485. },
  28486. secp224r1: {
  28487. name: 'p224',
  28488. byteLength: 28
  28489. },
  28490. prime256v1: {
  28491. name: 'p256',
  28492. byteLength: 32
  28493. },
  28494. prime192v1: {
  28495. name: 'p192',
  28496. byteLength: 24
  28497. },
  28498. ed25519: {
  28499. name: 'ed25519',
  28500. byteLength: 32
  28501. },
  28502. secp384r1: {
  28503. name: 'p384',
  28504. byteLength: 48
  28505. },
  28506. secp521r1: {
  28507. name: 'p521',
  28508. byteLength: 66
  28509. }
  28510. }
  28511. aliases.p224 = aliases.secp224r1
  28512. aliases.p256 = aliases.secp256r1 = aliases.prime256v1
  28513. aliases.p192 = aliases.secp192r1 = aliases.prime192v1
  28514. aliases.p384 = aliases.secp384r1
  28515. aliases.p521 = aliases.secp521r1
  28516. function ECDH (curve) {
  28517. this.curveType = aliases[curve]
  28518. if (!this.curveType) {
  28519. this.curveType = {
  28520. name: curve
  28521. }
  28522. }
  28523. this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap
  28524. this.keys = void 0
  28525. }
  28526. ECDH.prototype.generateKeys = function (enc, format) {
  28527. this.keys = this.curve.genKeyPair()
  28528. return this.getPublicKey(enc, format)
  28529. }
  28530. ECDH.prototype.computeSecret = function (other, inenc, enc) {
  28531. inenc = inenc || 'utf8'
  28532. if (!Buffer.isBuffer(other)) {
  28533. other = new Buffer(other, inenc)
  28534. }
  28535. var otherPub = this.curve.keyFromPublic(other).getPublic()
  28536. var out = otherPub.mul(this.keys.getPrivate()).getX()
  28537. return formatReturnValue(out, enc, this.curveType.byteLength)
  28538. }
  28539. ECDH.prototype.getPublicKey = function (enc, format) {
  28540. var key = this.keys.getPublic(format === 'compressed', true)
  28541. if (format === 'hybrid') {
  28542. if (key[key.length - 1] % 2) {
  28543. key[0] = 7
  28544. } else {
  28545. key[0] = 6
  28546. }
  28547. }
  28548. return formatReturnValue(key, enc)
  28549. }
  28550. ECDH.prototype.getPrivateKey = function (enc) {
  28551. return formatReturnValue(this.keys.getPrivate(), enc)
  28552. }
  28553. ECDH.prototype.setPublicKey = function (pub, enc) {
  28554. enc = enc || 'utf8'
  28555. if (!Buffer.isBuffer(pub)) {
  28556. pub = new Buffer(pub, enc)
  28557. }
  28558. this.keys._importPublic(pub)
  28559. return this
  28560. }
  28561. ECDH.prototype.setPrivateKey = function (priv, enc) {
  28562. enc = enc || 'utf8'
  28563. if (!Buffer.isBuffer(priv)) {
  28564. priv = new Buffer(priv, enc)
  28565. }
  28566. var _priv = new BN(priv)
  28567. _priv = _priv.toString(16)
  28568. this.keys = this.curve.genKeyPair()
  28569. this.keys._importPrivate(_priv)
  28570. return this
  28571. }
  28572. function formatReturnValue (bn, enc, len) {
  28573. if (!Array.isArray(bn)) {
  28574. bn = bn.toArray()
  28575. }
  28576. var buf = new Buffer(bn)
  28577. if (len && buf.length < len) {
  28578. var zeros = new Buffer(len - buf.length)
  28579. zeros.fill(0)
  28580. buf = Buffer.concat([zeros, buf])
  28581. }
  28582. if (!enc) {
  28583. return buf
  28584. } else {
  28585. return buf.toString(enc)
  28586. }
  28587. }
  28588. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 115).Buffer))
  28589. /***/ }),
  28590. /* 260 */
  28591. /*!************************************************!*\
  28592. !*** ./node_modules/public-encrypt/browser.js ***!
  28593. \************************************************/
  28594. /*! no static exports found */
  28595. /***/ (function(module, exports, __webpack_require__) {
  28596. exports.publicEncrypt = __webpack_require__(/*! ./publicEncrypt */ 261)
  28597. exports.privateDecrypt = __webpack_require__(/*! ./privateDecrypt */ 265)
  28598. exports.privateEncrypt = function privateEncrypt (key, buf) {
  28599. return exports.publicEncrypt(key, buf, true)
  28600. }
  28601. exports.publicDecrypt = function publicDecrypt (key, buf) {
  28602. return exports.privateDecrypt(key, buf, true)
  28603. }
  28604. /***/ }),
  28605. /* 261 */
  28606. /*!******************************************************!*\
  28607. !*** ./node_modules/public-encrypt/publicEncrypt.js ***!
  28608. \******************************************************/
  28609. /*! no static exports found */
  28610. /***/ (function(module, exports, __webpack_require__) {
  28611. var parseKeys = __webpack_require__(/*! parse-asn1 */ 237)
  28612. var randomBytes = __webpack_require__(/*! randombytes */ 111)
  28613. var createHash = __webpack_require__(/*! create-hash */ 119)
  28614. var mgf = __webpack_require__(/*! ./mgf */ 262)
  28615. var xor = __webpack_require__(/*! ./xor */ 263)
  28616. var BN = __webpack_require__(/*! bn.js */ 196)
  28617. var withPublic = __webpack_require__(/*! ./withPublic */ 264)
  28618. var crt = __webpack_require__(/*! browserify-rsa */ 206)
  28619. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  28620. module.exports = function publicEncrypt (publicKey, msg, reverse) {
  28621. var padding
  28622. if (publicKey.padding) {
  28623. padding = publicKey.padding
  28624. } else if (reverse) {
  28625. padding = 1
  28626. } else {
  28627. padding = 4
  28628. }
  28629. var key = parseKeys(publicKey)
  28630. var paddedMsg
  28631. if (padding === 4) {
  28632. paddedMsg = oaep(key, msg)
  28633. } else if (padding === 1) {
  28634. paddedMsg = pkcs1(key, msg, reverse)
  28635. } else if (padding === 3) {
  28636. paddedMsg = new BN(msg)
  28637. if (paddedMsg.cmp(key.modulus) >= 0) {
  28638. throw new Error('data too long for modulus')
  28639. }
  28640. } else {
  28641. throw new Error('unknown padding')
  28642. }
  28643. if (reverse) {
  28644. return crt(paddedMsg, key)
  28645. } else {
  28646. return withPublic(paddedMsg, key)
  28647. }
  28648. }
  28649. function oaep (key, msg) {
  28650. var k = key.modulus.byteLength()
  28651. var mLen = msg.length
  28652. var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()
  28653. var hLen = iHash.length
  28654. var hLen2 = 2 * hLen
  28655. if (mLen > k - hLen2 - 2) {
  28656. throw new Error('message too long')
  28657. }
  28658. var ps = Buffer.alloc(k - mLen - hLen2 - 2)
  28659. var dblen = k - hLen - 1
  28660. var seed = randomBytes(hLen)
  28661. var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen))
  28662. var maskedSeed = xor(seed, mgf(maskedDb, hLen))
  28663. return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k))
  28664. }
  28665. function pkcs1 (key, msg, reverse) {
  28666. var mLen = msg.length
  28667. var k = key.modulus.byteLength()
  28668. if (mLen > k - 11) {
  28669. throw new Error('message too long')
  28670. }
  28671. var ps
  28672. if (reverse) {
  28673. ps = Buffer.alloc(k - mLen - 3, 0xff)
  28674. } else {
  28675. ps = nonZero(k - mLen - 3)
  28676. }
  28677. return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k))
  28678. }
  28679. function nonZero (len) {
  28680. var out = Buffer.allocUnsafe(len)
  28681. var i = 0
  28682. var cache = randomBytes(len * 2)
  28683. var cur = 0
  28684. var num
  28685. while (i < len) {
  28686. if (cur === cache.length) {
  28687. cache = randomBytes(len * 2)
  28688. cur = 0
  28689. }
  28690. num = cache[cur++]
  28691. if (num) {
  28692. out[i++] = num
  28693. }
  28694. }
  28695. return out
  28696. }
  28697. /***/ }),
  28698. /* 262 */
  28699. /*!********************************************!*\
  28700. !*** ./node_modules/public-encrypt/mgf.js ***!
  28701. \********************************************/
  28702. /*! no static exports found */
  28703. /***/ (function(module, exports, __webpack_require__) {
  28704. var createHash = __webpack_require__(/*! create-hash */ 119)
  28705. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  28706. module.exports = function (seed, len) {
  28707. var t = Buffer.alloc(0)
  28708. var i = 0
  28709. var c
  28710. while (t.length < len) {
  28711. c = i2ops(i++)
  28712. t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()])
  28713. }
  28714. return t.slice(0, len)
  28715. }
  28716. function i2ops (c) {
  28717. var out = Buffer.allocUnsafe(4)
  28718. out.writeUInt32BE(c, 0)
  28719. return out
  28720. }
  28721. /***/ }),
  28722. /* 263 */
  28723. /*!********************************************!*\
  28724. !*** ./node_modules/public-encrypt/xor.js ***!
  28725. \********************************************/
  28726. /*! no static exports found */
  28727. /***/ (function(module, exports) {
  28728. module.exports = function xor (a, b) {
  28729. var len = a.length
  28730. var i = -1
  28731. while (++i < len) {
  28732. a[i] ^= b[i]
  28733. }
  28734. return a
  28735. }
  28736. /***/ }),
  28737. /* 264 */
  28738. /*!***************************************************!*\
  28739. !*** ./node_modules/public-encrypt/withPublic.js ***!
  28740. \***************************************************/
  28741. /*! no static exports found */
  28742. /***/ (function(module, exports, __webpack_require__) {
  28743. var BN = __webpack_require__(/*! bn.js */ 196)
  28744. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  28745. function withPublic (paddedMsg, key) {
  28746. return Buffer.from(paddedMsg
  28747. .toRed(BN.mont(key.modulus))
  28748. .redPow(new BN(key.publicExponent))
  28749. .fromRed()
  28750. .toArray())
  28751. }
  28752. module.exports = withPublic
  28753. /***/ }),
  28754. /* 265 */
  28755. /*!*******************************************************!*\
  28756. !*** ./node_modules/public-encrypt/privateDecrypt.js ***!
  28757. \*******************************************************/
  28758. /*! no static exports found */
  28759. /***/ (function(module, exports, __webpack_require__) {
  28760. var parseKeys = __webpack_require__(/*! parse-asn1 */ 237)
  28761. var mgf = __webpack_require__(/*! ./mgf */ 262)
  28762. var xor = __webpack_require__(/*! ./xor */ 263)
  28763. var BN = __webpack_require__(/*! bn.js */ 196)
  28764. var crt = __webpack_require__(/*! browserify-rsa */ 206)
  28765. var createHash = __webpack_require__(/*! create-hash */ 119)
  28766. var withPublic = __webpack_require__(/*! ./withPublic */ 264)
  28767. var Buffer = __webpack_require__(/*! safe-buffer */ 114).Buffer
  28768. module.exports = function privateDecrypt (privateKey, enc, reverse) {
  28769. var padding
  28770. if (privateKey.padding) {
  28771. padding = privateKey.padding
  28772. } else if (reverse) {
  28773. padding = 1
  28774. } else {
  28775. padding = 4
  28776. }
  28777. var key = parseKeys(privateKey)
  28778. var k = key.modulus.byteLength()
  28779. if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) {
  28780. throw new Error('decryption error')
  28781. }
  28782. var msg
  28783. if (reverse) {
  28784. msg = withPublic(new BN(enc), key)
  28785. } else {
  28786. msg = crt(enc, key)
  28787. }
  28788. var zBuffer = Buffer.alloc(k - msg.length)
  28789. msg = Buffer.concat([zBuffer, msg], k)
  28790. if (padding === 4) {
  28791. return oaep(key, msg)
  28792. } else if (padding === 1) {
  28793. return pkcs1(key, msg, reverse)
  28794. } else if (padding === 3) {
  28795. return msg
  28796. } else {
  28797. throw new Error('unknown padding')
  28798. }
  28799. }
  28800. function oaep (key, msg) {
  28801. var k = key.modulus.byteLength()
  28802. var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()
  28803. var hLen = iHash.length
  28804. if (msg[0] !== 0) {
  28805. throw new Error('decryption error')
  28806. }
  28807. var maskedSeed = msg.slice(1, hLen + 1)
  28808. var maskedDb = msg.slice(hLen + 1)
  28809. var seed = xor(maskedSeed, mgf(maskedDb, hLen))
  28810. var db = xor(maskedDb, mgf(seed, k - hLen - 1))
  28811. if (compare(iHash, db.slice(0, hLen))) {
  28812. throw new Error('decryption error')
  28813. }
  28814. var i = hLen
  28815. while (db[i] === 0) {
  28816. i++
  28817. }
  28818. if (db[i++] !== 1) {
  28819. throw new Error('decryption error')
  28820. }
  28821. return db.slice(i)
  28822. }
  28823. function pkcs1 (key, msg, reverse) {
  28824. var p1 = msg.slice(0, 2)
  28825. var i = 2
  28826. var status = 0
  28827. while (msg[i++] !== 0) {
  28828. if (i >= msg.length) {
  28829. status++
  28830. break
  28831. }
  28832. }
  28833. var ps = msg.slice(2, i - 1)
  28834. if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) {
  28835. status++
  28836. }
  28837. if (ps.length < 8) {
  28838. status++
  28839. }
  28840. if (status) {
  28841. throw new Error('decryption error')
  28842. }
  28843. return msg.slice(i)
  28844. }
  28845. function compare (a, b) {
  28846. a = Buffer.from(a)
  28847. b = Buffer.from(b)
  28848. var dif = 0
  28849. var len = a.length
  28850. if (a.length !== b.length) {
  28851. dif++
  28852. len = Math.min(a.length, b.length)
  28853. }
  28854. var i = -1
  28855. while (++i < len) {
  28856. dif += (a[i] ^ b[i])
  28857. }
  28858. return dif
  28859. }
  28860. /***/ }),
  28861. /* 266 */
  28862. /*!********************************************!*\
  28863. !*** ./node_modules/randomfill/browser.js ***!
  28864. \********************************************/
  28865. /*! no static exports found */
  28866. /***/ (function(module, exports, __webpack_require__) {
  28867. "use strict";
  28868. /* WEBPACK VAR INJECTION */(function(global, process) {
  28869. function oldBrowser () {
  28870. throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')
  28871. }
  28872. var safeBuffer = __webpack_require__(/*! safe-buffer */ 114)
  28873. var randombytes = __webpack_require__(/*! randombytes */ 111)
  28874. var Buffer = safeBuffer.Buffer
  28875. var kBufferMaxLength = safeBuffer.kMaxLength
  28876. var crypto = global.crypto || global.msCrypto
  28877. var kMaxUint32 = Math.pow(2, 32) - 1
  28878. function assertOffset (offset, length) {
  28879. if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare
  28880. throw new TypeError('offset must be a number')
  28881. }
  28882. if (offset > kMaxUint32 || offset < 0) {
  28883. throw new TypeError('offset must be a uint32')
  28884. }
  28885. if (offset > kBufferMaxLength || offset > length) {
  28886. throw new RangeError('offset out of range')
  28887. }
  28888. }
  28889. function assertSize (size, offset, length) {
  28890. if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare
  28891. throw new TypeError('size must be a number')
  28892. }
  28893. if (size > kMaxUint32 || size < 0) {
  28894. throw new TypeError('size must be a uint32')
  28895. }
  28896. if (size + offset > length || size > kBufferMaxLength) {
  28897. throw new RangeError('buffer too small')
  28898. }
  28899. }
  28900. if ((crypto && crypto.getRandomValues) || !process.browser) {
  28901. exports.randomFill = randomFill
  28902. exports.randomFillSync = randomFillSync
  28903. } else {
  28904. exports.randomFill = oldBrowser
  28905. exports.randomFillSync = oldBrowser
  28906. }
  28907. function randomFill (buf, offset, size, cb) {
  28908. if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
  28909. throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
  28910. }
  28911. if (typeof offset === 'function') {
  28912. cb = offset
  28913. offset = 0
  28914. size = buf.length
  28915. } else if (typeof size === 'function') {
  28916. cb = size
  28917. size = buf.length - offset
  28918. } else if (typeof cb !== 'function') {
  28919. throw new TypeError('"cb" argument must be a function')
  28920. }
  28921. assertOffset(offset, buf.length)
  28922. assertSize(size, offset, buf.length)
  28923. return actualFill(buf, offset, size, cb)
  28924. }
  28925. function actualFill (buf, offset, size, cb) {
  28926. if (process.browser) {
  28927. var ourBuf = buf.buffer
  28928. var uint = new Uint8Array(ourBuf, offset, size)
  28929. crypto.getRandomValues(uint)
  28930. if (cb) {
  28931. process.nextTick(function () {
  28932. cb(null, buf)
  28933. })
  28934. return
  28935. }
  28936. return buf
  28937. }
  28938. if (cb) {
  28939. randombytes(size, function (err, bytes) {
  28940. if (err) {
  28941. return cb(err)
  28942. }
  28943. bytes.copy(buf, offset)
  28944. cb(null, buf)
  28945. })
  28946. return
  28947. }
  28948. var bytes = randombytes(size)
  28949. bytes.copy(buf, offset)
  28950. return buf
  28951. }
  28952. function randomFillSync (buf, offset, size) {
  28953. if (typeof offset === 'undefined') {
  28954. offset = 0
  28955. }
  28956. if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
  28957. throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
  28958. }
  28959. assertOffset(offset, buf.length)
  28960. if (size === undefined) size = buf.length - offset
  28961. assertSize(size, offset, buf.length)
  28962. return actualFill(buf, offset, size)
  28963. }
  28964. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 112)))
  28965. /***/ }),
  28966. /* 267 */
  28967. /*!**********************************************!*\
  28968. !*** F:/uniapp/sqxp-uniapp/api/studytime.js ***!
  28969. \**********************************************/
  28970. /*! no static exports found */
  28971. /***/ (function(module, exports, __webpack_require__) {
  28972. "use strict";
  28973. Object.defineProperty(exports, "__esModule", { value: true });exports.addTime = addTime;exports.getTime = getTime;exports.getTimeInfo = getTimeInfo;exports.getStudentInfo = getStudentInfo;var _request = _interopRequireDefault(__webpack_require__(/*! @/utils/request */ 13));
  28974. var _baseurl = __webpack_require__(/*! @/api/baseurl */ 15);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  28975. // 上传学时
  28976. function addTime(data) {
  28977. return (0, _request.default)({
  28978. url: _baseurl.baseUrl + '/student/gzpt-train-record',
  28979. method: 'post',
  28980. data: data });
  28981. }
  28982. // 查询已完成科目学时
  28983. function getTime(data) {
  28984. return (0, _request.default)({
  28985. url: _baseurl.baseUrl + '/student/gzpt-train-record/getTrainFinishKm',
  28986. method: 'get' });
  28987. }
  28988. // 查询额定学时
  28989. function getTimeInfo(data) {
  28990. return (0, _request.default)({
  28991. url: _baseurl.baseUrl + '/student/gzpt-train-record/getTrainSubjectCredit',
  28992. method: 'get' });
  28993. }
  28994. // 获取学员详细信息
  28995. function getStudentInfo(data) {
  28996. return (0, _request.default)({
  28997. url: _baseurl.baseUrl + '/student/gzpt/userInfo',
  28998. method: 'get' });
  28999. }
  29000. /***/ })
  29001. ]]);
  29002. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map