specs.js 275 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, {
  40. /******/ configurable: false,
  41. /******/ enumerable: true,
  42. /******/ get: getter
  43. /******/ });
  44. /******/ }
  45. /******/ };
  46. /******/
  47. /******/ // getDefaultExport function for compatibility with non-harmony modules
  48. /******/ __webpack_require__.n = function(module) {
  49. /******/ var getter = module && module.__esModule ?
  50. /******/ function getDefault() { return module['default']; } :
  51. /******/ function getModuleExports() { return module; };
  52. /******/ __webpack_require__.d(getter, 'a', getter);
  53. /******/ return getter;
  54. /******/ };
  55. /******/
  56. /******/ // Object.prototype.hasOwnProperty.call
  57. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  58. /******/
  59. /******/ // __webpack_public_path__
  60. /******/ __webpack_require__.p = "";
  61. /******/
  62. /******/ // Load entry module and return exports
  63. /******/ return __webpack_require__(__webpack_require__.s = 5);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ([
  67. /* 0 */
  68. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69. "use strict";
  70. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return inBrowser; });
  71. /* harmony export (immutable) */ __webpack_exports__["u"] = warn;
  72. /* harmony export (immutable) */ __webpack_exports__["e"] = error;
  73. /* harmony export (immutable) */ __webpack_exports__["o"] = nextTick;
  74. /* harmony export (immutable) */ __webpack_exports__["s"] = trim;
  75. /* harmony export (immutable) */ __webpack_exports__["t"] = trimEnd;
  76. /* harmony export (immutable) */ __webpack_exports__["q"] = toLower;
  77. /* harmony export (immutable) */ __webpack_exports__["r"] = toUpper;
  78. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isArray; });
  79. /* harmony export (immutable) */ __webpack_exports__["m"] = isString;
  80. /* unused harmony export isBoolean */
  81. /* harmony export (immutable) */ __webpack_exports__["j"] = isFunction;
  82. /* harmony export (immutable) */ __webpack_exports__["k"] = isObject;
  83. /* harmony export (immutable) */ __webpack_exports__["l"] = isPlainObject;
  84. /* harmony export (immutable) */ __webpack_exports__["h"] = isBlob;
  85. /* harmony export (immutable) */ __webpack_exports__["i"] = isFormData;
  86. /* harmony export (immutable) */ __webpack_exports__["v"] = when;
  87. /* harmony export (immutable) */ __webpack_exports__["p"] = options;
  88. /* harmony export (immutable) */ __webpack_exports__["d"] = each;
  89. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return assign; });
  90. /* harmony export (immutable) */ __webpack_exports__["n"] = merge;
  91. /* harmony export (immutable) */ __webpack_exports__["c"] = defaults;
  92. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__promise__ = __webpack_require__(1);
  93. /**
  94. * Utility functions.
  95. */
  96. var ref = {};
  97. var hasOwnProperty = ref.hasOwnProperty;
  98. ;
  99. var ref$1 = [];
  100. var slice = ref$1.slice;
  101. var debug = false, ntick;
  102. var inBrowser = typeof window !== 'undefined';
  103. /* harmony default export */ __webpack_exports__["b"] = (function (ref) {
  104. var config = ref.config;
  105. var nextTick = ref.nextTick;
  106. ntick = nextTick;
  107. debug = config.debug || !config.silent;
  108. });
  109. function warn(msg) {
  110. if (typeof console !== 'undefined' && debug) {
  111. console.warn('[VueResource warn]: ' + msg);
  112. }
  113. }
  114. function error(msg) {
  115. if (typeof console !== 'undefined') {
  116. console.error(msg);
  117. }
  118. }
  119. function nextTick(cb, ctx) {
  120. return ntick(cb, ctx);
  121. }
  122. function trim(str) {
  123. return str ? str.replace(/^\s*|\s*$/g, '') : '';
  124. }
  125. function trimEnd(str, chars) {
  126. if (str && chars === undefined) {
  127. return str.replace(/\s+$/, '');
  128. }
  129. if (!str || !chars) {
  130. return str;
  131. }
  132. return str.replace(new RegExp(("[" + chars + "]+$")), '');
  133. }
  134. function toLower(str) {
  135. return str ? str.toLowerCase() : '';
  136. }
  137. function toUpper(str) {
  138. return str ? str.toUpperCase() : '';
  139. }
  140. var isArray = Array.isArray;
  141. function isString(val) {
  142. return typeof val === 'string';
  143. }
  144. function isBoolean(val) {
  145. return val === true || val === false;
  146. }
  147. function isFunction(val) {
  148. return typeof val === 'function';
  149. }
  150. function isObject(obj) {
  151. return obj !== null && typeof obj === 'object';
  152. }
  153. function isPlainObject(obj) {
  154. return isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;
  155. }
  156. function isBlob(obj) {
  157. return typeof Blob !== 'undefined' && obj instanceof Blob;
  158. }
  159. function isFormData(obj) {
  160. return typeof FormData !== 'undefined' && obj instanceof FormData;
  161. }
  162. function when(value, fulfilled, rejected) {
  163. var promise = __WEBPACK_IMPORTED_MODULE_0__promise__["a" /* default */].resolve(value);
  164. if (arguments.length < 2) {
  165. return promise;
  166. }
  167. return promise.then(fulfilled, rejected);
  168. }
  169. function options(fn, obj, opts) {
  170. opts = opts || {};
  171. if (isFunction(opts)) {
  172. opts = opts.call(obj);
  173. }
  174. return merge(fn.bind({$vm: obj, $options: opts}), fn, {$options: opts});
  175. }
  176. function each(obj, iterator) {
  177. var i, key;
  178. if (isArray(obj)) {
  179. for (i = 0; i < obj.length; i++) {
  180. iterator.call(obj[i], obj[i], i);
  181. }
  182. } else if (isObject(obj)) {
  183. for (key in obj) {
  184. if (hasOwnProperty.call(obj, key)) {
  185. iterator.call(obj[key], obj[key], key);
  186. }
  187. }
  188. }
  189. return obj;
  190. }
  191. var assign = Object.assign || _assign;
  192. function merge(target) {
  193. var args = slice.call(arguments, 1);
  194. args.forEach(function (source) {
  195. _merge(target, source, true);
  196. });
  197. return target;
  198. }
  199. function defaults(target) {
  200. var args = slice.call(arguments, 1);
  201. args.forEach(function (source) {
  202. for (var key in source) {
  203. if (target[key] === undefined) {
  204. target[key] = source[key];
  205. }
  206. }
  207. });
  208. return target;
  209. }
  210. function _assign(target) {
  211. var args = slice.call(arguments, 1);
  212. args.forEach(function (source) {
  213. _merge(target, source);
  214. });
  215. return target;
  216. }
  217. function _merge(target, source, deep) {
  218. for (var key in source) {
  219. if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
  220. if (isPlainObject(source[key]) && !isPlainObject(target[key])) {
  221. target[key] = {};
  222. }
  223. if (isArray(source[key]) && !isArray(target[key])) {
  224. target[key] = [];
  225. }
  226. _merge(target[key], source[key], deep);
  227. } else if (source[key] !== undefined) {
  228. target[key] = source[key];
  229. }
  230. }
  231. }
  232. /***/ }),
  233. /* 1 */
  234. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  235. "use strict";
  236. // EXTERNAL MODULE: ./src/util.js
  237. var util = __webpack_require__(0);
  238. // CONCATENATED MODULE: ./src/lib/promise.js
  239. /**
  240. * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
  241. */
  242. var RESOLVED = 0;
  243. var REJECTED = 1;
  244. var PENDING = 2;
  245. function promise_Promise(executor) {
  246. this.state = PENDING;
  247. this.value = undefined;
  248. this.deferred = [];
  249. var promise = this;
  250. try {
  251. executor(function (x) {
  252. promise.resolve(x);
  253. }, function (r) {
  254. promise.reject(r);
  255. });
  256. } catch (e) {
  257. promise.reject(e);
  258. }
  259. }
  260. promise_Promise.reject = function (r) {
  261. return new promise_Promise(function (resolve, reject) {
  262. reject(r);
  263. });
  264. };
  265. promise_Promise.resolve = function (x) {
  266. return new promise_Promise(function (resolve, reject) {
  267. resolve(x);
  268. });
  269. };
  270. promise_Promise.all = function all(iterable) {
  271. return new promise_Promise(function (resolve, reject) {
  272. var count = 0, result = [];
  273. if (iterable.length === 0) {
  274. resolve(result);
  275. }
  276. function resolver(i) {
  277. return function (x) {
  278. result[i] = x;
  279. count += 1;
  280. if (count === iterable.length) {
  281. resolve(result);
  282. }
  283. };
  284. }
  285. for (var i = 0; i < iterable.length; i += 1) {
  286. promise_Promise.resolve(iterable[i]).then(resolver(i), reject);
  287. }
  288. });
  289. };
  290. promise_Promise.race = function race(iterable) {
  291. return new promise_Promise(function (resolve, reject) {
  292. for (var i = 0; i < iterable.length; i += 1) {
  293. promise_Promise.resolve(iterable[i]).then(resolve, reject);
  294. }
  295. });
  296. };
  297. var p = promise_Promise.prototype;
  298. p.resolve = function resolve(x) {
  299. var promise = this;
  300. if (promise.state === PENDING) {
  301. if (x === promise) {
  302. throw new TypeError('Promise settled with itself.');
  303. }
  304. var called = false;
  305. try {
  306. var then = x && x['then'];
  307. if (x !== null && typeof x === 'object' && typeof then === 'function') {
  308. then.call(x, function (x) {
  309. if (!called) {
  310. promise.resolve(x);
  311. }
  312. called = true;
  313. }, function (r) {
  314. if (!called) {
  315. promise.reject(r);
  316. }
  317. called = true;
  318. });
  319. return;
  320. }
  321. } catch (e) {
  322. if (!called) {
  323. promise.reject(e);
  324. }
  325. return;
  326. }
  327. promise.state = RESOLVED;
  328. promise.value = x;
  329. promise.notify();
  330. }
  331. };
  332. p.reject = function reject(reason) {
  333. var promise = this;
  334. if (promise.state === PENDING) {
  335. if (reason === promise) {
  336. throw new TypeError('Promise settled with itself.');
  337. }
  338. promise.state = REJECTED;
  339. promise.value = reason;
  340. promise.notify();
  341. }
  342. };
  343. p.notify = function notify() {
  344. var promise = this;
  345. Object(util["o" /* nextTick */])(function () {
  346. if (promise.state !== PENDING) {
  347. while (promise.deferred.length) {
  348. var deferred = promise.deferred.shift(),
  349. onResolved = deferred[0],
  350. onRejected = deferred[1],
  351. resolve = deferred[2],
  352. reject = deferred[3];
  353. try {
  354. if (promise.state === RESOLVED) {
  355. if (typeof onResolved === 'function') {
  356. resolve(onResolved.call(undefined, promise.value));
  357. } else {
  358. resolve(promise.value);
  359. }
  360. } else if (promise.state === REJECTED) {
  361. if (typeof onRejected === 'function') {
  362. resolve(onRejected.call(undefined, promise.value));
  363. } else {
  364. reject(promise.value);
  365. }
  366. }
  367. } catch (e) {
  368. reject(e);
  369. }
  370. }
  371. }
  372. });
  373. };
  374. p.then = function then(onResolved, onRejected) {
  375. var promise = this;
  376. return new promise_Promise(function (resolve, reject) {
  377. promise.deferred.push([onResolved, onRejected, resolve, reject]);
  378. promise.notify();
  379. });
  380. };
  381. p.catch = function (onRejected) {
  382. return this.then(undefined, onRejected);
  383. };
  384. // CONCATENATED MODULE: ./src/promise.js
  385. /* harmony export (immutable) */ __webpack_exports__["a"] = PromiseObj;
  386. /**
  387. * Promise adapter.
  388. */
  389. if (typeof Promise === 'undefined') {
  390. window.Promise = promise_Promise;
  391. }
  392. function PromiseObj(executor, context) {
  393. if (executor instanceof Promise) {
  394. this.promise = executor;
  395. } else {
  396. this.promise = new Promise(executor.bind(context));
  397. }
  398. this.context = context;
  399. }
  400. PromiseObj.all = function (iterable, context) {
  401. return new PromiseObj(Promise.all(iterable), context);
  402. };
  403. PromiseObj.resolve = function (value, context) {
  404. return new PromiseObj(Promise.resolve(value), context);
  405. };
  406. PromiseObj.reject = function (reason, context) {
  407. return new PromiseObj(Promise.reject(reason), context);
  408. };
  409. PromiseObj.race = function (iterable, context) {
  410. return new PromiseObj(Promise.race(iterable), context);
  411. };
  412. var promise_p = PromiseObj.prototype;
  413. promise_p.bind = function (context) {
  414. this.context = context;
  415. return this;
  416. };
  417. promise_p.then = function (fulfilled, rejected) {
  418. if (fulfilled && fulfilled.bind && this.context) {
  419. fulfilled = fulfilled.bind(this.context);
  420. }
  421. if (rejected && rejected.bind && this.context) {
  422. rejected = rejected.bind(this.context);
  423. }
  424. return new PromiseObj(this.promise.then(fulfilled, rejected), this.context);
  425. };
  426. promise_p.catch = function (rejected) {
  427. if (rejected && rejected.bind && this.context) {
  428. rejected = rejected.bind(this.context);
  429. }
  430. return new PromiseObj(this.promise.catch(rejected), this.context);
  431. };
  432. promise_p.finally = function (callback) {
  433. return this.then(function (value) {
  434. callback.call(this);
  435. return value;
  436. }, function (reason) {
  437. callback.call(this);
  438. return Promise.reject(reason);
  439. }
  440. );
  441. };
  442. /***/ }),
  443. /* 2 */
  444. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  445. "use strict";
  446. /* WEBPACK VAR INJECTION */(function(process, global, setImmediate) {/*!
  447. * Vue.js v2.5.13
  448. * (c) 2014-2017 Evan You
  449. * Released under the MIT License.
  450. */
  451. /* */
  452. var emptyObject = Object.freeze({});
  453. // these helpers produces better vm code in JS engines due to their
  454. // explicitness and function inlining
  455. function isUndef (v) {
  456. return v === undefined || v === null
  457. }
  458. function isDef (v) {
  459. return v !== undefined && v !== null
  460. }
  461. function isTrue (v) {
  462. return v === true
  463. }
  464. function isFalse (v) {
  465. return v === false
  466. }
  467. /**
  468. * Check if value is primitive
  469. */
  470. function isPrimitive (value) {
  471. return (
  472. typeof value === 'string' ||
  473. typeof value === 'number' ||
  474. // $flow-disable-line
  475. typeof value === 'symbol' ||
  476. typeof value === 'boolean'
  477. )
  478. }
  479. /**
  480. * Quick object check - this is primarily used to tell
  481. * Objects from primitive values when we know the value
  482. * is a JSON-compliant type.
  483. */
  484. function isObject (obj) {
  485. return obj !== null && typeof obj === 'object'
  486. }
  487. /**
  488. * Get the raw type string of a value e.g. [object Object]
  489. */
  490. var _toString = Object.prototype.toString;
  491. function toRawType (value) {
  492. return _toString.call(value).slice(8, -1)
  493. }
  494. /**
  495. * Strict object type check. Only returns true
  496. * for plain JavaScript objects.
  497. */
  498. function isPlainObject (obj) {
  499. return _toString.call(obj) === '[object Object]'
  500. }
  501. function isRegExp (v) {
  502. return _toString.call(v) === '[object RegExp]'
  503. }
  504. /**
  505. * Check if val is a valid array index.
  506. */
  507. function isValidArrayIndex (val) {
  508. var n = parseFloat(String(val));
  509. return n >= 0 && Math.floor(n) === n && isFinite(val)
  510. }
  511. /**
  512. * Convert a value to a string that is actually rendered.
  513. */
  514. function toString (val) {
  515. return val == null
  516. ? ''
  517. : typeof val === 'object'
  518. ? JSON.stringify(val, null, 2)
  519. : String(val)
  520. }
  521. /**
  522. * Convert a input value to a number for persistence.
  523. * If the conversion fails, return original string.
  524. */
  525. function toNumber (val) {
  526. var n = parseFloat(val);
  527. return isNaN(n) ? val : n
  528. }
  529. /**
  530. * Make a map and return a function for checking if a key
  531. * is in that map.
  532. */
  533. function makeMap (
  534. str,
  535. expectsLowerCase
  536. ) {
  537. var map = Object.create(null);
  538. var list = str.split(',');
  539. for (var i = 0; i < list.length; i++) {
  540. map[list[i]] = true;
  541. }
  542. return expectsLowerCase
  543. ? function (val) { return map[val.toLowerCase()]; }
  544. : function (val) { return map[val]; }
  545. }
  546. /**
  547. * Check if a tag is a built-in tag.
  548. */
  549. var isBuiltInTag = makeMap('slot,component', true);
  550. /**
  551. * Check if a attribute is a reserved attribute.
  552. */
  553. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  554. /**
  555. * Remove an item from an array
  556. */
  557. function remove (arr, item) {
  558. if (arr.length) {
  559. var index = arr.indexOf(item);
  560. if (index > -1) {
  561. return arr.splice(index, 1)
  562. }
  563. }
  564. }
  565. /**
  566. * Check whether the object has the property.
  567. */
  568. var hasOwnProperty = Object.prototype.hasOwnProperty;
  569. function hasOwn (obj, key) {
  570. return hasOwnProperty.call(obj, key)
  571. }
  572. /**
  573. * Create a cached version of a pure function.
  574. */
  575. function cached (fn) {
  576. var cache = Object.create(null);
  577. return (function cachedFn (str) {
  578. var hit = cache[str];
  579. return hit || (cache[str] = fn(str))
  580. })
  581. }
  582. /**
  583. * Camelize a hyphen-delimited string.
  584. */
  585. var camelizeRE = /-(\w)/g;
  586. var camelize = cached(function (str) {
  587. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  588. });
  589. /**
  590. * Capitalize a string.
  591. */
  592. var capitalize = cached(function (str) {
  593. return str.charAt(0).toUpperCase() + str.slice(1)
  594. });
  595. /**
  596. * Hyphenate a camelCase string.
  597. */
  598. var hyphenateRE = /\B([A-Z])/g;
  599. var hyphenate = cached(function (str) {
  600. return str.replace(hyphenateRE, '-$1').toLowerCase()
  601. });
  602. /**
  603. * Simple bind, faster than native
  604. */
  605. function bind (fn, ctx) {
  606. function boundFn (a) {
  607. var l = arguments.length;
  608. return l
  609. ? l > 1
  610. ? fn.apply(ctx, arguments)
  611. : fn.call(ctx, a)
  612. : fn.call(ctx)
  613. }
  614. // record original fn length
  615. boundFn._length = fn.length;
  616. return boundFn
  617. }
  618. /**
  619. * Convert an Array-like object to a real Array.
  620. */
  621. function toArray (list, start) {
  622. start = start || 0;
  623. var i = list.length - start;
  624. var ret = new Array(i);
  625. while (i--) {
  626. ret[i] = list[i + start];
  627. }
  628. return ret
  629. }
  630. /**
  631. * Mix properties into target object.
  632. */
  633. function extend (to, _from) {
  634. for (var key in _from) {
  635. to[key] = _from[key];
  636. }
  637. return to
  638. }
  639. /**
  640. * Merge an Array of Objects into a single Object.
  641. */
  642. function toObject (arr) {
  643. var res = {};
  644. for (var i = 0; i < arr.length; i++) {
  645. if (arr[i]) {
  646. extend(res, arr[i]);
  647. }
  648. }
  649. return res
  650. }
  651. /**
  652. * Perform no operation.
  653. * Stubbing args to make Flow happy without leaving useless transpiled code
  654. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
  655. */
  656. function noop (a, b, c) {}
  657. /**
  658. * Always return false.
  659. */
  660. var no = function (a, b, c) { return false; };
  661. /**
  662. * Return same value
  663. */
  664. var identity = function (_) { return _; };
  665. /**
  666. * Generate a static keys string from compiler modules.
  667. */
  668. /**
  669. * Check if two values are loosely equal - that is,
  670. * if they are plain objects, do they have the same shape?
  671. */
  672. function looseEqual (a, b) {
  673. if (a === b) { return true }
  674. var isObjectA = isObject(a);
  675. var isObjectB = isObject(b);
  676. if (isObjectA && isObjectB) {
  677. try {
  678. var isArrayA = Array.isArray(a);
  679. var isArrayB = Array.isArray(b);
  680. if (isArrayA && isArrayB) {
  681. return a.length === b.length && a.every(function (e, i) {
  682. return looseEqual(e, b[i])
  683. })
  684. } else if (!isArrayA && !isArrayB) {
  685. var keysA = Object.keys(a);
  686. var keysB = Object.keys(b);
  687. return keysA.length === keysB.length && keysA.every(function (key) {
  688. return looseEqual(a[key], b[key])
  689. })
  690. } else {
  691. /* istanbul ignore next */
  692. return false
  693. }
  694. } catch (e) {
  695. /* istanbul ignore next */
  696. return false
  697. }
  698. } else if (!isObjectA && !isObjectB) {
  699. return String(a) === String(b)
  700. } else {
  701. return false
  702. }
  703. }
  704. function looseIndexOf (arr, val) {
  705. for (var i = 0; i < arr.length; i++) {
  706. if (looseEqual(arr[i], val)) { return i }
  707. }
  708. return -1
  709. }
  710. /**
  711. * Ensure a function is called only once.
  712. */
  713. function once (fn) {
  714. var called = false;
  715. return function () {
  716. if (!called) {
  717. called = true;
  718. fn.apply(this, arguments);
  719. }
  720. }
  721. }
  722. var SSR_ATTR = 'data-server-rendered';
  723. var ASSET_TYPES = [
  724. 'component',
  725. 'directive',
  726. 'filter'
  727. ];
  728. var LIFECYCLE_HOOKS = [
  729. 'beforeCreate',
  730. 'created',
  731. 'beforeMount',
  732. 'mounted',
  733. 'beforeUpdate',
  734. 'updated',
  735. 'beforeDestroy',
  736. 'destroyed',
  737. 'activated',
  738. 'deactivated',
  739. 'errorCaptured'
  740. ];
  741. /* */
  742. var config = ({
  743. /**
  744. * Option merge strategies (used in core/util/options)
  745. */
  746. // $flow-disable-line
  747. optionMergeStrategies: Object.create(null),
  748. /**
  749. * Whether to suppress warnings.
  750. */
  751. silent: false,
  752. /**
  753. * Show production mode tip message on boot?
  754. */
  755. productionTip: process.env.NODE_ENV !== 'production',
  756. /**
  757. * Whether to enable devtools
  758. */
  759. devtools: process.env.NODE_ENV !== 'production',
  760. /**
  761. * Whether to record perf
  762. */
  763. performance: false,
  764. /**
  765. * Error handler for watcher errors
  766. */
  767. errorHandler: null,
  768. /**
  769. * Warn handler for watcher warns
  770. */
  771. warnHandler: null,
  772. /**
  773. * Ignore certain custom elements
  774. */
  775. ignoredElements: [],
  776. /**
  777. * Custom user key aliases for v-on
  778. */
  779. // $flow-disable-line
  780. keyCodes: Object.create(null),
  781. /**
  782. * Check if a tag is reserved so that it cannot be registered as a
  783. * component. This is platform-dependent and may be overwritten.
  784. */
  785. isReservedTag: no,
  786. /**
  787. * Check if an attribute is reserved so that it cannot be used as a component
  788. * prop. This is platform-dependent and may be overwritten.
  789. */
  790. isReservedAttr: no,
  791. /**
  792. * Check if a tag is an unknown element.
  793. * Platform-dependent.
  794. */
  795. isUnknownElement: no,
  796. /**
  797. * Get the namespace of an element
  798. */
  799. getTagNamespace: noop,
  800. /**
  801. * Parse the real tag name for the specific platform.
  802. */
  803. parsePlatformTagName: identity,
  804. /**
  805. * Check if an attribute must be bound using property, e.g. value
  806. * Platform-dependent.
  807. */
  808. mustUseProp: no,
  809. /**
  810. * Exposed for legacy reasons
  811. */
  812. _lifecycleHooks: LIFECYCLE_HOOKS
  813. });
  814. /* */
  815. /**
  816. * Check if a string starts with $ or _
  817. */
  818. function isReserved (str) {
  819. var c = (str + '').charCodeAt(0);
  820. return c === 0x24 || c === 0x5F
  821. }
  822. /**
  823. * Define a property.
  824. */
  825. function def (obj, key, val, enumerable) {
  826. Object.defineProperty(obj, key, {
  827. value: val,
  828. enumerable: !!enumerable,
  829. writable: true,
  830. configurable: true
  831. });
  832. }
  833. /**
  834. * Parse simple path.
  835. */
  836. var bailRE = /[^\w.$]/;
  837. function parsePath (path) {
  838. if (bailRE.test(path)) {
  839. return
  840. }
  841. var segments = path.split('.');
  842. return function (obj) {
  843. for (var i = 0; i < segments.length; i++) {
  844. if (!obj) { return }
  845. obj = obj[segments[i]];
  846. }
  847. return obj
  848. }
  849. }
  850. /* */
  851. // can we use __proto__?
  852. var hasProto = '__proto__' in {};
  853. // Browser environment sniffing
  854. var inBrowser = typeof window !== 'undefined';
  855. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  856. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  857. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  858. var isIE = UA && /msie|trident/.test(UA);
  859. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  860. var isEdge = UA && UA.indexOf('edge/') > 0;
  861. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  862. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  863. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  864. // Firefox has a "watch" function on Object.prototype...
  865. var nativeWatch = ({}).watch;
  866. var supportsPassive = false;
  867. if (inBrowser) {
  868. try {
  869. var opts = {};
  870. Object.defineProperty(opts, 'passive', ({
  871. get: function get () {
  872. /* istanbul ignore next */
  873. supportsPassive = true;
  874. }
  875. })); // https://github.com/facebook/flow/issues/285
  876. window.addEventListener('test-passive', null, opts);
  877. } catch (e) {}
  878. }
  879. // this needs to be lazy-evaled because vue may be required before
  880. // vue-server-renderer can set VUE_ENV
  881. var _isServer;
  882. var isServerRendering = function () {
  883. if (_isServer === undefined) {
  884. /* istanbul ignore if */
  885. if (!inBrowser && typeof global !== 'undefined') {
  886. // detect presence of vue-server-renderer and avoid
  887. // Webpack shimming the process
  888. _isServer = global['process'].env.VUE_ENV === 'server';
  889. } else {
  890. _isServer = false;
  891. }
  892. }
  893. return _isServer
  894. };
  895. // detect devtools
  896. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  897. /* istanbul ignore next */
  898. function isNative (Ctor) {
  899. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  900. }
  901. var hasSymbol =
  902. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  903. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  904. var _Set;
  905. /* istanbul ignore if */ // $flow-disable-line
  906. if (typeof Set !== 'undefined' && isNative(Set)) {
  907. // use native Set when available.
  908. _Set = Set;
  909. } else {
  910. // a non-standard Set polyfill that only works with primitive keys.
  911. _Set = (function () {
  912. function Set () {
  913. this.set = Object.create(null);
  914. }
  915. Set.prototype.has = function has (key) {
  916. return this.set[key] === true
  917. };
  918. Set.prototype.add = function add (key) {
  919. this.set[key] = true;
  920. };
  921. Set.prototype.clear = function clear () {
  922. this.set = Object.create(null);
  923. };
  924. return Set;
  925. }());
  926. }
  927. /* */
  928. var warn = noop;
  929. var tip = noop;
  930. var generateComponentTrace = (noop); // work around flow check
  931. var formatComponentName = (noop);
  932. if (process.env.NODE_ENV !== 'production') {
  933. var hasConsole = typeof console !== 'undefined';
  934. var classifyRE = /(?:^|[-_])(\w)/g;
  935. var classify = function (str) { return str
  936. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  937. .replace(/[-_]/g, ''); };
  938. warn = function (msg, vm) {
  939. var trace = vm ? generateComponentTrace(vm) : '';
  940. if (config.warnHandler) {
  941. config.warnHandler.call(null, msg, vm, trace);
  942. } else if (hasConsole && (!config.silent)) {
  943. console.error(("[Vue warn]: " + msg + trace));
  944. }
  945. };
  946. tip = function (msg, vm) {
  947. if (hasConsole && (!config.silent)) {
  948. console.warn("[Vue tip]: " + msg + (
  949. vm ? generateComponentTrace(vm) : ''
  950. ));
  951. }
  952. };
  953. formatComponentName = function (vm, includeFile) {
  954. if (vm.$root === vm) {
  955. return '<Root>'
  956. }
  957. var options = typeof vm === 'function' && vm.cid != null
  958. ? vm.options
  959. : vm._isVue
  960. ? vm.$options || vm.constructor.options
  961. : vm || {};
  962. var name = options.name || options._componentTag;
  963. var file = options.__file;
  964. if (!name && file) {
  965. var match = file.match(/([^/\\]+)\.vue$/);
  966. name = match && match[1];
  967. }
  968. return (
  969. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  970. (file && includeFile !== false ? (" at " + file) : '')
  971. )
  972. };
  973. var repeat = function (str, n) {
  974. var res = '';
  975. while (n) {
  976. if (n % 2 === 1) { res += str; }
  977. if (n > 1) { str += str; }
  978. n >>= 1;
  979. }
  980. return res
  981. };
  982. generateComponentTrace = function (vm) {
  983. if (vm._isVue && vm.$parent) {
  984. var tree = [];
  985. var currentRecursiveSequence = 0;
  986. while (vm) {
  987. if (tree.length > 0) {
  988. var last = tree[tree.length - 1];
  989. if (last.constructor === vm.constructor) {
  990. currentRecursiveSequence++;
  991. vm = vm.$parent;
  992. continue
  993. } else if (currentRecursiveSequence > 0) {
  994. tree[tree.length - 1] = [last, currentRecursiveSequence];
  995. currentRecursiveSequence = 0;
  996. }
  997. }
  998. tree.push(vm);
  999. vm = vm.$parent;
  1000. }
  1001. return '\n\nfound in\n\n' + tree
  1002. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  1003. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  1004. : formatComponentName(vm))); })
  1005. .join('\n')
  1006. } else {
  1007. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  1008. }
  1009. };
  1010. }
  1011. /* */
  1012. var uid$1 = 0;
  1013. /**
  1014. * A dep is an observable that can have multiple
  1015. * directives subscribing to it.
  1016. */
  1017. var Dep = function Dep () {
  1018. this.id = uid$1++;
  1019. this.subs = [];
  1020. };
  1021. Dep.prototype.addSub = function addSub (sub) {
  1022. this.subs.push(sub);
  1023. };
  1024. Dep.prototype.removeSub = function removeSub (sub) {
  1025. remove(this.subs, sub);
  1026. };
  1027. Dep.prototype.depend = function depend () {
  1028. if (Dep.target) {
  1029. Dep.target.addDep(this);
  1030. }
  1031. };
  1032. Dep.prototype.notify = function notify () {
  1033. // stabilize the subscriber list first
  1034. var subs = this.subs.slice();
  1035. for (var i = 0, l = subs.length; i < l; i++) {
  1036. subs[i].update();
  1037. }
  1038. };
  1039. // the current target watcher being evaluated.
  1040. // this is globally unique because there could be only one
  1041. // watcher being evaluated at any time.
  1042. Dep.target = null;
  1043. var targetStack = [];
  1044. function pushTarget (_target) {
  1045. if (Dep.target) { targetStack.push(Dep.target); }
  1046. Dep.target = _target;
  1047. }
  1048. function popTarget () {
  1049. Dep.target = targetStack.pop();
  1050. }
  1051. /* */
  1052. var VNode = function VNode (
  1053. tag,
  1054. data,
  1055. children,
  1056. text,
  1057. elm,
  1058. context,
  1059. componentOptions,
  1060. asyncFactory
  1061. ) {
  1062. this.tag = tag;
  1063. this.data = data;
  1064. this.children = children;
  1065. this.text = text;
  1066. this.elm = elm;
  1067. this.ns = undefined;
  1068. this.context = context;
  1069. this.fnContext = undefined;
  1070. this.fnOptions = undefined;
  1071. this.fnScopeId = undefined;
  1072. this.key = data && data.key;
  1073. this.componentOptions = componentOptions;
  1074. this.componentInstance = undefined;
  1075. this.parent = undefined;
  1076. this.raw = false;
  1077. this.isStatic = false;
  1078. this.isRootInsert = true;
  1079. this.isComment = false;
  1080. this.isCloned = false;
  1081. this.isOnce = false;
  1082. this.asyncFactory = asyncFactory;
  1083. this.asyncMeta = undefined;
  1084. this.isAsyncPlaceholder = false;
  1085. };
  1086. var prototypeAccessors = { child: { configurable: true } };
  1087. // DEPRECATED: alias for componentInstance for backwards compat.
  1088. /* istanbul ignore next */
  1089. prototypeAccessors.child.get = function () {
  1090. return this.componentInstance
  1091. };
  1092. Object.defineProperties( VNode.prototype, prototypeAccessors );
  1093. var createEmptyVNode = function (text) {
  1094. if ( text === void 0 ) text = '';
  1095. var node = new VNode();
  1096. node.text = text;
  1097. node.isComment = true;
  1098. return node
  1099. };
  1100. function createTextVNode (val) {
  1101. return new VNode(undefined, undefined, undefined, String(val))
  1102. }
  1103. // optimized shallow clone
  1104. // used for static nodes and slot nodes because they may be reused across
  1105. // multiple renders, cloning them avoids errors when DOM manipulations rely
  1106. // on their elm reference.
  1107. function cloneVNode (vnode, deep) {
  1108. var componentOptions = vnode.componentOptions;
  1109. var cloned = new VNode(
  1110. vnode.tag,
  1111. vnode.data,
  1112. vnode.children,
  1113. vnode.text,
  1114. vnode.elm,
  1115. vnode.context,
  1116. componentOptions,
  1117. vnode.asyncFactory
  1118. );
  1119. cloned.ns = vnode.ns;
  1120. cloned.isStatic = vnode.isStatic;
  1121. cloned.key = vnode.key;
  1122. cloned.isComment = vnode.isComment;
  1123. cloned.fnContext = vnode.fnContext;
  1124. cloned.fnOptions = vnode.fnOptions;
  1125. cloned.fnScopeId = vnode.fnScopeId;
  1126. cloned.isCloned = true;
  1127. if (deep) {
  1128. if (vnode.children) {
  1129. cloned.children = cloneVNodes(vnode.children, true);
  1130. }
  1131. if (componentOptions && componentOptions.children) {
  1132. componentOptions.children = cloneVNodes(componentOptions.children, true);
  1133. }
  1134. }
  1135. return cloned
  1136. }
  1137. function cloneVNodes (vnodes, deep) {
  1138. var len = vnodes.length;
  1139. var res = new Array(len);
  1140. for (var i = 0; i < len; i++) {
  1141. res[i] = cloneVNode(vnodes[i], deep);
  1142. }
  1143. return res
  1144. }
  1145. /*
  1146. * not type checking this file because flow doesn't play well with
  1147. * dynamically accessing methods on Array prototype
  1148. */
  1149. var arrayProto = Array.prototype;
  1150. var arrayMethods = Object.create(arrayProto);[
  1151. 'push',
  1152. 'pop',
  1153. 'shift',
  1154. 'unshift',
  1155. 'splice',
  1156. 'sort',
  1157. 'reverse'
  1158. ].forEach(function (method) {
  1159. // cache original method
  1160. var original = arrayProto[method];
  1161. def(arrayMethods, method, function mutator () {
  1162. var args = [], len = arguments.length;
  1163. while ( len-- ) args[ len ] = arguments[ len ];
  1164. var result = original.apply(this, args);
  1165. var ob = this.__ob__;
  1166. var inserted;
  1167. switch (method) {
  1168. case 'push':
  1169. case 'unshift':
  1170. inserted = args;
  1171. break
  1172. case 'splice':
  1173. inserted = args.slice(2);
  1174. break
  1175. }
  1176. if (inserted) { ob.observeArray(inserted); }
  1177. // notify change
  1178. ob.dep.notify();
  1179. return result
  1180. });
  1181. });
  1182. /* */
  1183. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  1184. /**
  1185. * By default, when a reactive property is set, the new value is
  1186. * also converted to become reactive. However when passing down props,
  1187. * we don't want to force conversion because the value may be a nested value
  1188. * under a frozen data structure. Converting it would defeat the optimization.
  1189. */
  1190. var observerState = {
  1191. shouldConvert: true
  1192. };
  1193. /**
  1194. * Observer class that are attached to each observed
  1195. * object. Once attached, the observer converts target
  1196. * object's property keys into getter/setters that
  1197. * collect dependencies and dispatches updates.
  1198. */
  1199. var Observer = function Observer (value) {
  1200. this.value = value;
  1201. this.dep = new Dep();
  1202. this.vmCount = 0;
  1203. def(value, '__ob__', this);
  1204. if (Array.isArray(value)) {
  1205. var augment = hasProto
  1206. ? protoAugment
  1207. : copyAugment;
  1208. augment(value, arrayMethods, arrayKeys);
  1209. this.observeArray(value);
  1210. } else {
  1211. this.walk(value);
  1212. }
  1213. };
  1214. /**
  1215. * Walk through each property and convert them into
  1216. * getter/setters. This method should only be called when
  1217. * value type is Object.
  1218. */
  1219. Observer.prototype.walk = function walk (obj) {
  1220. var keys = Object.keys(obj);
  1221. for (var i = 0; i < keys.length; i++) {
  1222. defineReactive(obj, keys[i], obj[keys[i]]);
  1223. }
  1224. };
  1225. /**
  1226. * Observe a list of Array items.
  1227. */
  1228. Observer.prototype.observeArray = function observeArray (items) {
  1229. for (var i = 0, l = items.length; i < l; i++) {
  1230. observe(items[i]);
  1231. }
  1232. };
  1233. // helpers
  1234. /**
  1235. * Augment an target Object or Array by intercepting
  1236. * the prototype chain using __proto__
  1237. */
  1238. function protoAugment (target, src, keys) {
  1239. /* eslint-disable no-proto */
  1240. target.__proto__ = src;
  1241. /* eslint-enable no-proto */
  1242. }
  1243. /**
  1244. * Augment an target Object or Array by defining
  1245. * hidden properties.
  1246. */
  1247. /* istanbul ignore next */
  1248. function copyAugment (target, src, keys) {
  1249. for (var i = 0, l = keys.length; i < l; i++) {
  1250. var key = keys[i];
  1251. def(target, key, src[key]);
  1252. }
  1253. }
  1254. /**
  1255. * Attempt to create an observer instance for a value,
  1256. * returns the new observer if successfully observed,
  1257. * or the existing observer if the value already has one.
  1258. */
  1259. function observe (value, asRootData) {
  1260. if (!isObject(value) || value instanceof VNode) {
  1261. return
  1262. }
  1263. var ob;
  1264. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  1265. ob = value.__ob__;
  1266. } else if (
  1267. observerState.shouldConvert &&
  1268. !isServerRendering() &&
  1269. (Array.isArray(value) || isPlainObject(value)) &&
  1270. Object.isExtensible(value) &&
  1271. !value._isVue
  1272. ) {
  1273. ob = new Observer(value);
  1274. }
  1275. if (asRootData && ob) {
  1276. ob.vmCount++;
  1277. }
  1278. return ob
  1279. }
  1280. /**
  1281. * Define a reactive property on an Object.
  1282. */
  1283. function defineReactive (
  1284. obj,
  1285. key,
  1286. val,
  1287. customSetter,
  1288. shallow
  1289. ) {
  1290. var dep = new Dep();
  1291. var property = Object.getOwnPropertyDescriptor(obj, key);
  1292. if (property && property.configurable === false) {
  1293. return
  1294. }
  1295. // cater for pre-defined getter/setters
  1296. var getter = property && property.get;
  1297. var setter = property && property.set;
  1298. var childOb = !shallow && observe(val);
  1299. Object.defineProperty(obj, key, {
  1300. enumerable: true,
  1301. configurable: true,
  1302. get: function reactiveGetter () {
  1303. var value = getter ? getter.call(obj) : val;
  1304. if (Dep.target) {
  1305. dep.depend();
  1306. if (childOb) {
  1307. childOb.dep.depend();
  1308. if (Array.isArray(value)) {
  1309. dependArray(value);
  1310. }
  1311. }
  1312. }
  1313. return value
  1314. },
  1315. set: function reactiveSetter (newVal) {
  1316. var value = getter ? getter.call(obj) : val;
  1317. /* eslint-disable no-self-compare */
  1318. if (newVal === value || (newVal !== newVal && value !== value)) {
  1319. return
  1320. }
  1321. /* eslint-enable no-self-compare */
  1322. if (process.env.NODE_ENV !== 'production' && customSetter) {
  1323. customSetter();
  1324. }
  1325. if (setter) {
  1326. setter.call(obj, newVal);
  1327. } else {
  1328. val = newVal;
  1329. }
  1330. childOb = !shallow && observe(newVal);
  1331. dep.notify();
  1332. }
  1333. });
  1334. }
  1335. /**
  1336. * Set a property on an object. Adds the new property and
  1337. * triggers change notification if the property doesn't
  1338. * already exist.
  1339. */
  1340. function set (target, key, val) {
  1341. if (Array.isArray(target) && isValidArrayIndex(key)) {
  1342. target.length = Math.max(target.length, key);
  1343. target.splice(key, 1, val);
  1344. return val
  1345. }
  1346. if (key in target && !(key in Object.prototype)) {
  1347. target[key] = val;
  1348. return val
  1349. }
  1350. var ob = (target).__ob__;
  1351. if (target._isVue || (ob && ob.vmCount)) {
  1352. process.env.NODE_ENV !== 'production' && warn(
  1353. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  1354. 'at runtime - declare it upfront in the data option.'
  1355. );
  1356. return val
  1357. }
  1358. if (!ob) {
  1359. target[key] = val;
  1360. return val
  1361. }
  1362. defineReactive(ob.value, key, val);
  1363. ob.dep.notify();
  1364. return val
  1365. }
  1366. /**
  1367. * Delete a property and trigger change if necessary.
  1368. */
  1369. function del (target, key) {
  1370. if (Array.isArray(target) && isValidArrayIndex(key)) {
  1371. target.splice(key, 1);
  1372. return
  1373. }
  1374. var ob = (target).__ob__;
  1375. if (target._isVue || (ob && ob.vmCount)) {
  1376. process.env.NODE_ENV !== 'production' && warn(
  1377. 'Avoid deleting properties on a Vue instance or its root $data ' +
  1378. '- just set it to null.'
  1379. );
  1380. return
  1381. }
  1382. if (!hasOwn(target, key)) {
  1383. return
  1384. }
  1385. delete target[key];
  1386. if (!ob) {
  1387. return
  1388. }
  1389. ob.dep.notify();
  1390. }
  1391. /**
  1392. * Collect dependencies on array elements when the array is touched, since
  1393. * we cannot intercept array element access like property getters.
  1394. */
  1395. function dependArray (value) {
  1396. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1397. e = value[i];
  1398. e && e.__ob__ && e.__ob__.dep.depend();
  1399. if (Array.isArray(e)) {
  1400. dependArray(e);
  1401. }
  1402. }
  1403. }
  1404. /* */
  1405. /**
  1406. * Option overwriting strategies are functions that handle
  1407. * how to merge a parent option value and a child option
  1408. * value into the final value.
  1409. */
  1410. var strats = config.optionMergeStrategies;
  1411. /**
  1412. * Options with restrictions
  1413. */
  1414. if (process.env.NODE_ENV !== 'production') {
  1415. strats.el = strats.propsData = function (parent, child, vm, key) {
  1416. if (!vm) {
  1417. warn(
  1418. "option \"" + key + "\" can only be used during instance " +
  1419. 'creation with the `new` keyword.'
  1420. );
  1421. }
  1422. return defaultStrat(parent, child)
  1423. };
  1424. }
  1425. /**
  1426. * Helper that recursively merges two data objects together.
  1427. */
  1428. function mergeData (to, from) {
  1429. if (!from) { return to }
  1430. var key, toVal, fromVal;
  1431. var keys = Object.keys(from);
  1432. for (var i = 0; i < keys.length; i++) {
  1433. key = keys[i];
  1434. toVal = to[key];
  1435. fromVal = from[key];
  1436. if (!hasOwn(to, key)) {
  1437. set(to, key, fromVal);
  1438. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  1439. mergeData(toVal, fromVal);
  1440. }
  1441. }
  1442. return to
  1443. }
  1444. /**
  1445. * Data
  1446. */
  1447. function mergeDataOrFn (
  1448. parentVal,
  1449. childVal,
  1450. vm
  1451. ) {
  1452. if (!vm) {
  1453. // in a Vue.extend merge, both should be functions
  1454. if (!childVal) {
  1455. return parentVal
  1456. }
  1457. if (!parentVal) {
  1458. return childVal
  1459. }
  1460. // when parentVal & childVal are both present,
  1461. // we need to return a function that returns the
  1462. // merged result of both functions... no need to
  1463. // check if parentVal is a function here because
  1464. // it has to be a function to pass previous merges.
  1465. return function mergedDataFn () {
  1466. return mergeData(
  1467. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1468. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1469. )
  1470. }
  1471. } else {
  1472. return function mergedInstanceDataFn () {
  1473. // instance merge
  1474. var instanceData = typeof childVal === 'function'
  1475. ? childVal.call(vm, vm)
  1476. : childVal;
  1477. var defaultData = typeof parentVal === 'function'
  1478. ? parentVal.call(vm, vm)
  1479. : parentVal;
  1480. if (instanceData) {
  1481. return mergeData(instanceData, defaultData)
  1482. } else {
  1483. return defaultData
  1484. }
  1485. }
  1486. }
  1487. }
  1488. strats.data = function (
  1489. parentVal,
  1490. childVal,
  1491. vm
  1492. ) {
  1493. if (!vm) {
  1494. if (childVal && typeof childVal !== 'function') {
  1495. process.env.NODE_ENV !== 'production' && warn(
  1496. 'The "data" option should be a function ' +
  1497. 'that returns a per-instance value in component ' +
  1498. 'definitions.',
  1499. vm
  1500. );
  1501. return parentVal
  1502. }
  1503. return mergeDataOrFn(parentVal, childVal)
  1504. }
  1505. return mergeDataOrFn(parentVal, childVal, vm)
  1506. };
  1507. /**
  1508. * Hooks and props are merged as arrays.
  1509. */
  1510. function mergeHook (
  1511. parentVal,
  1512. childVal
  1513. ) {
  1514. return childVal
  1515. ? parentVal
  1516. ? parentVal.concat(childVal)
  1517. : Array.isArray(childVal)
  1518. ? childVal
  1519. : [childVal]
  1520. : parentVal
  1521. }
  1522. LIFECYCLE_HOOKS.forEach(function (hook) {
  1523. strats[hook] = mergeHook;
  1524. });
  1525. /**
  1526. * Assets
  1527. *
  1528. * When a vm is present (instance creation), we need to do
  1529. * a three-way merge between constructor options, instance
  1530. * options and parent options.
  1531. */
  1532. function mergeAssets (
  1533. parentVal,
  1534. childVal,
  1535. vm,
  1536. key
  1537. ) {
  1538. var res = Object.create(parentVal || null);
  1539. if (childVal) {
  1540. process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
  1541. return extend(res, childVal)
  1542. } else {
  1543. return res
  1544. }
  1545. }
  1546. ASSET_TYPES.forEach(function (type) {
  1547. strats[type + 's'] = mergeAssets;
  1548. });
  1549. /**
  1550. * Watchers.
  1551. *
  1552. * Watchers hashes should not overwrite one
  1553. * another, so we merge them as arrays.
  1554. */
  1555. strats.watch = function (
  1556. parentVal,
  1557. childVal,
  1558. vm,
  1559. key
  1560. ) {
  1561. // work around Firefox's Object.prototype.watch...
  1562. if (parentVal === nativeWatch) { parentVal = undefined; }
  1563. if (childVal === nativeWatch) { childVal = undefined; }
  1564. /* istanbul ignore if */
  1565. if (!childVal) { return Object.create(parentVal || null) }
  1566. if (process.env.NODE_ENV !== 'production') {
  1567. assertObjectType(key, childVal, vm);
  1568. }
  1569. if (!parentVal) { return childVal }
  1570. var ret = {};
  1571. extend(ret, parentVal);
  1572. for (var key$1 in childVal) {
  1573. var parent = ret[key$1];
  1574. var child = childVal[key$1];
  1575. if (parent && !Array.isArray(parent)) {
  1576. parent = [parent];
  1577. }
  1578. ret[key$1] = parent
  1579. ? parent.concat(child)
  1580. : Array.isArray(child) ? child : [child];
  1581. }
  1582. return ret
  1583. };
  1584. /**
  1585. * Other object hashes.
  1586. */
  1587. strats.props =
  1588. strats.methods =
  1589. strats.inject =
  1590. strats.computed = function (
  1591. parentVal,
  1592. childVal,
  1593. vm,
  1594. key
  1595. ) {
  1596. if (childVal && process.env.NODE_ENV !== 'production') {
  1597. assertObjectType(key, childVal, vm);
  1598. }
  1599. if (!parentVal) { return childVal }
  1600. var ret = Object.create(null);
  1601. extend(ret, parentVal);
  1602. if (childVal) { extend(ret, childVal); }
  1603. return ret
  1604. };
  1605. strats.provide = mergeDataOrFn;
  1606. /**
  1607. * Default strategy.
  1608. */
  1609. var defaultStrat = function (parentVal, childVal) {
  1610. return childVal === undefined
  1611. ? parentVal
  1612. : childVal
  1613. };
  1614. /**
  1615. * Validate component names
  1616. */
  1617. function checkComponents (options) {
  1618. for (var key in options.components) {
  1619. validateComponentName(key);
  1620. }
  1621. }
  1622. function validateComponentName (name) {
  1623. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  1624. warn(
  1625. 'Invalid component name: "' + name + '". Component names ' +
  1626. 'can only contain alphanumeric characters and the hyphen, ' +
  1627. 'and must start with a letter.'
  1628. );
  1629. }
  1630. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1631. warn(
  1632. 'Do not use built-in or reserved HTML elements as component ' +
  1633. 'id: ' + name
  1634. );
  1635. }
  1636. }
  1637. /**
  1638. * Ensure all props option syntax are normalized into the
  1639. * Object-based format.
  1640. */
  1641. function normalizeProps (options, vm) {
  1642. var props = options.props;
  1643. if (!props) { return }
  1644. var res = {};
  1645. var i, val, name;
  1646. if (Array.isArray(props)) {
  1647. i = props.length;
  1648. while (i--) {
  1649. val = props[i];
  1650. if (typeof val === 'string') {
  1651. name = camelize(val);
  1652. res[name] = { type: null };
  1653. } else if (process.env.NODE_ENV !== 'production') {
  1654. warn('props must be strings when using array syntax.');
  1655. }
  1656. }
  1657. } else if (isPlainObject(props)) {
  1658. for (var key in props) {
  1659. val = props[key];
  1660. name = camelize(key);
  1661. res[name] = isPlainObject(val)
  1662. ? val
  1663. : { type: val };
  1664. }
  1665. } else if (process.env.NODE_ENV !== 'production') {
  1666. warn(
  1667. "Invalid value for option \"props\": expected an Array or an Object, " +
  1668. "but got " + (toRawType(props)) + ".",
  1669. vm
  1670. );
  1671. }
  1672. options.props = res;
  1673. }
  1674. /**
  1675. * Normalize all injections into Object-based format
  1676. */
  1677. function normalizeInject (options, vm) {
  1678. var inject = options.inject;
  1679. if (!inject) { return }
  1680. var normalized = options.inject = {};
  1681. if (Array.isArray(inject)) {
  1682. for (var i = 0; i < inject.length; i++) {
  1683. normalized[inject[i]] = { from: inject[i] };
  1684. }
  1685. } else if (isPlainObject(inject)) {
  1686. for (var key in inject) {
  1687. var val = inject[key];
  1688. normalized[key] = isPlainObject(val)
  1689. ? extend({ from: key }, val)
  1690. : { from: val };
  1691. }
  1692. } else if (process.env.NODE_ENV !== 'production') {
  1693. warn(
  1694. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1695. "but got " + (toRawType(inject)) + ".",
  1696. vm
  1697. );
  1698. }
  1699. }
  1700. /**
  1701. * Normalize raw function directives into object format.
  1702. */
  1703. function normalizeDirectives (options) {
  1704. var dirs = options.directives;
  1705. if (dirs) {
  1706. for (var key in dirs) {
  1707. var def = dirs[key];
  1708. if (typeof def === 'function') {
  1709. dirs[key] = { bind: def, update: def };
  1710. }
  1711. }
  1712. }
  1713. }
  1714. function assertObjectType (name, value, vm) {
  1715. if (!isPlainObject(value)) {
  1716. warn(
  1717. "Invalid value for option \"" + name + "\": expected an Object, " +
  1718. "but got " + (toRawType(value)) + ".",
  1719. vm
  1720. );
  1721. }
  1722. }
  1723. /**
  1724. * Merge two option objects into a new one.
  1725. * Core utility used in both instantiation and inheritance.
  1726. */
  1727. function mergeOptions (
  1728. parent,
  1729. child,
  1730. vm
  1731. ) {
  1732. if (process.env.NODE_ENV !== 'production') {
  1733. checkComponents(child);
  1734. }
  1735. if (typeof child === 'function') {
  1736. child = child.options;
  1737. }
  1738. normalizeProps(child, vm);
  1739. normalizeInject(child, vm);
  1740. normalizeDirectives(child);
  1741. var extendsFrom = child.extends;
  1742. if (extendsFrom) {
  1743. parent = mergeOptions(parent, extendsFrom, vm);
  1744. }
  1745. if (child.mixins) {
  1746. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1747. parent = mergeOptions(parent, child.mixins[i], vm);
  1748. }
  1749. }
  1750. var options = {};
  1751. var key;
  1752. for (key in parent) {
  1753. mergeField(key);
  1754. }
  1755. for (key in child) {
  1756. if (!hasOwn(parent, key)) {
  1757. mergeField(key);
  1758. }
  1759. }
  1760. function mergeField (key) {
  1761. var strat = strats[key] || defaultStrat;
  1762. options[key] = strat(parent[key], child[key], vm, key);
  1763. }
  1764. return options
  1765. }
  1766. /**
  1767. * Resolve an asset.
  1768. * This function is used because child instances need access
  1769. * to assets defined in its ancestor chain.
  1770. */
  1771. function resolveAsset (
  1772. options,
  1773. type,
  1774. id,
  1775. warnMissing
  1776. ) {
  1777. /* istanbul ignore if */
  1778. if (typeof id !== 'string') {
  1779. return
  1780. }
  1781. var assets = options[type];
  1782. // check local registration variations first
  1783. if (hasOwn(assets, id)) { return assets[id] }
  1784. var camelizedId = camelize(id);
  1785. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1786. var PascalCaseId = capitalize(camelizedId);
  1787. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1788. // fallback to prototype chain
  1789. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1790. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  1791. warn(
  1792. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1793. options
  1794. );
  1795. }
  1796. return res
  1797. }
  1798. /* */
  1799. function validateProp (
  1800. key,
  1801. propOptions,
  1802. propsData,
  1803. vm
  1804. ) {
  1805. var prop = propOptions[key];
  1806. var absent = !hasOwn(propsData, key);
  1807. var value = propsData[key];
  1808. // handle boolean props
  1809. if (isType(Boolean, prop.type)) {
  1810. if (absent && !hasOwn(prop, 'default')) {
  1811. value = false;
  1812. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  1813. value = true;
  1814. }
  1815. }
  1816. // check default value
  1817. if (value === undefined) {
  1818. value = getPropDefaultValue(vm, prop, key);
  1819. // since the default value is a fresh copy,
  1820. // make sure to observe it.
  1821. var prevShouldConvert = observerState.shouldConvert;
  1822. observerState.shouldConvert = true;
  1823. observe(value);
  1824. observerState.shouldConvert = prevShouldConvert;
  1825. }
  1826. if (
  1827. process.env.NODE_ENV !== 'production' &&
  1828. // skip validation for weex recycle-list child component props
  1829. !(false && isObject(value) && ('@binding' in value))
  1830. ) {
  1831. assertProp(prop, key, value, vm, absent);
  1832. }
  1833. return value
  1834. }
  1835. /**
  1836. * Get the default value of a prop.
  1837. */
  1838. function getPropDefaultValue (vm, prop, key) {
  1839. // no default, return undefined
  1840. if (!hasOwn(prop, 'default')) {
  1841. return undefined
  1842. }
  1843. var def = prop.default;
  1844. // warn against non-factory defaults for Object & Array
  1845. if (process.env.NODE_ENV !== 'production' && isObject(def)) {
  1846. warn(
  1847. 'Invalid default value for prop "' + key + '": ' +
  1848. 'Props with type Object/Array must use a factory function ' +
  1849. 'to return the default value.',
  1850. vm
  1851. );
  1852. }
  1853. // the raw prop value was also undefined from previous render,
  1854. // return previous default value to avoid unnecessary watcher trigger
  1855. if (vm && vm.$options.propsData &&
  1856. vm.$options.propsData[key] === undefined &&
  1857. vm._props[key] !== undefined
  1858. ) {
  1859. return vm._props[key]
  1860. }
  1861. // call factory function for non-Function types
  1862. // a value is Function if its prototype is function even across different execution context
  1863. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1864. ? def.call(vm)
  1865. : def
  1866. }
  1867. /**
  1868. * Assert whether a prop is valid.
  1869. */
  1870. function assertProp (
  1871. prop,
  1872. name,
  1873. value,
  1874. vm,
  1875. absent
  1876. ) {
  1877. if (prop.required && absent) {
  1878. warn(
  1879. 'Missing required prop: "' + name + '"',
  1880. vm
  1881. );
  1882. return
  1883. }
  1884. if (value == null && !prop.required) {
  1885. return
  1886. }
  1887. var type = prop.type;
  1888. var valid = !type || type === true;
  1889. var expectedTypes = [];
  1890. if (type) {
  1891. if (!Array.isArray(type)) {
  1892. type = [type];
  1893. }
  1894. for (var i = 0; i < type.length && !valid; i++) {
  1895. var assertedType = assertType(value, type[i]);
  1896. expectedTypes.push(assertedType.expectedType || '');
  1897. valid = assertedType.valid;
  1898. }
  1899. }
  1900. if (!valid) {
  1901. warn(
  1902. "Invalid prop: type check failed for prop \"" + name + "\"." +
  1903. " Expected " + (expectedTypes.map(capitalize).join(', ')) +
  1904. ", got " + (toRawType(value)) + ".",
  1905. vm
  1906. );
  1907. return
  1908. }
  1909. var validator = prop.validator;
  1910. if (validator) {
  1911. if (!validator(value)) {
  1912. warn(
  1913. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1914. vm
  1915. );
  1916. }
  1917. }
  1918. }
  1919. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1920. function assertType (value, type) {
  1921. var valid;
  1922. var expectedType = getType(type);
  1923. if (simpleCheckRE.test(expectedType)) {
  1924. var t = typeof value;
  1925. valid = t === expectedType.toLowerCase();
  1926. // for primitive wrapper objects
  1927. if (!valid && t === 'object') {
  1928. valid = value instanceof type;
  1929. }
  1930. } else if (expectedType === 'Object') {
  1931. valid = isPlainObject(value);
  1932. } else if (expectedType === 'Array') {
  1933. valid = Array.isArray(value);
  1934. } else {
  1935. valid = value instanceof type;
  1936. }
  1937. return {
  1938. valid: valid,
  1939. expectedType: expectedType
  1940. }
  1941. }
  1942. /**
  1943. * Use function string name to check built-in types,
  1944. * because a simple equality check will fail when running
  1945. * across different vms / iframes.
  1946. */
  1947. function getType (fn) {
  1948. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1949. return match ? match[1] : ''
  1950. }
  1951. function isType (type, fn) {
  1952. if (!Array.isArray(fn)) {
  1953. return getType(fn) === getType(type)
  1954. }
  1955. for (var i = 0, len = fn.length; i < len; i++) {
  1956. if (getType(fn[i]) === getType(type)) {
  1957. return true
  1958. }
  1959. }
  1960. /* istanbul ignore next */
  1961. return false
  1962. }
  1963. /* */
  1964. function handleError (err, vm, info) {
  1965. if (vm) {
  1966. var cur = vm;
  1967. while ((cur = cur.$parent)) {
  1968. var hooks = cur.$options.errorCaptured;
  1969. if (hooks) {
  1970. for (var i = 0; i < hooks.length; i++) {
  1971. try {
  1972. var capture = hooks[i].call(cur, err, vm, info) === false;
  1973. if (capture) { return }
  1974. } catch (e) {
  1975. globalHandleError(e, cur, 'errorCaptured hook');
  1976. }
  1977. }
  1978. }
  1979. }
  1980. }
  1981. globalHandleError(err, vm, info);
  1982. }
  1983. function globalHandleError (err, vm, info) {
  1984. if (config.errorHandler) {
  1985. try {
  1986. return config.errorHandler.call(null, err, vm, info)
  1987. } catch (e) {
  1988. logError(e, null, 'config.errorHandler');
  1989. }
  1990. }
  1991. logError(err, vm, info);
  1992. }
  1993. function logError (err, vm, info) {
  1994. if (process.env.NODE_ENV !== 'production') {
  1995. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1996. }
  1997. /* istanbul ignore else */
  1998. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1999. console.error(err);
  2000. } else {
  2001. throw err
  2002. }
  2003. }
  2004. /* */
  2005. /* globals MessageChannel */
  2006. var callbacks = [];
  2007. var pending = false;
  2008. function flushCallbacks () {
  2009. pending = false;
  2010. var copies = callbacks.slice(0);
  2011. callbacks.length = 0;
  2012. for (var i = 0; i < copies.length; i++) {
  2013. copies[i]();
  2014. }
  2015. }
  2016. // Here we have async deferring wrappers using both micro and macro tasks.
  2017. // In < 2.4 we used micro tasks everywhere, but there are some scenarios where
  2018. // micro tasks have too high a priority and fires in between supposedly
  2019. // sequential events (e.g. #4521, #6690) or even between bubbling of the same
  2020. // event (#6566). However, using macro tasks everywhere also has subtle problems
  2021. // when state is changed right before repaint (e.g. #6813, out-in transitions).
  2022. // Here we use micro task by default, but expose a way to force macro task when
  2023. // needed (e.g. in event handlers attached by v-on).
  2024. var microTimerFunc;
  2025. var macroTimerFunc;
  2026. var useMacroTask = false;
  2027. // Determine (macro) Task defer implementation.
  2028. // Technically setImmediate should be the ideal choice, but it's only available
  2029. // in IE. The only polyfill that consistently queues the callback after all DOM
  2030. // events triggered in the same loop is by using MessageChannel.
  2031. /* istanbul ignore if */
  2032. if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  2033. macroTimerFunc = function () {
  2034. setImmediate(flushCallbacks);
  2035. };
  2036. } else if (typeof MessageChannel !== 'undefined' && (
  2037. isNative(MessageChannel) ||
  2038. // PhantomJS
  2039. MessageChannel.toString() === '[object MessageChannelConstructor]'
  2040. )) {
  2041. var channel = new MessageChannel();
  2042. var port = channel.port2;
  2043. channel.port1.onmessage = flushCallbacks;
  2044. macroTimerFunc = function () {
  2045. port.postMessage(1);
  2046. };
  2047. } else {
  2048. /* istanbul ignore next */
  2049. macroTimerFunc = function () {
  2050. setTimeout(flushCallbacks, 0);
  2051. };
  2052. }
  2053. // Determine MicroTask defer implementation.
  2054. /* istanbul ignore next, $flow-disable-line */
  2055. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  2056. var p = Promise.resolve();
  2057. microTimerFunc = function () {
  2058. p.then(flushCallbacks);
  2059. // in problematic UIWebViews, Promise.then doesn't completely break, but
  2060. // it can get stuck in a weird state where callbacks are pushed into the
  2061. // microtask queue but the queue isn't being flushed, until the browser
  2062. // needs to do some other work, e.g. handle a timer. Therefore we can
  2063. // "force" the microtask queue to be flushed by adding an empty timer.
  2064. if (isIOS) { setTimeout(noop); }
  2065. };
  2066. } else {
  2067. // fallback to macro
  2068. microTimerFunc = macroTimerFunc;
  2069. }
  2070. /**
  2071. * Wrap a function so that if any code inside triggers state change,
  2072. * the changes are queued using a Task instead of a MicroTask.
  2073. */
  2074. function withMacroTask (fn) {
  2075. return fn._withTask || (fn._withTask = function () {
  2076. useMacroTask = true;
  2077. var res = fn.apply(null, arguments);
  2078. useMacroTask = false;
  2079. return res
  2080. })
  2081. }
  2082. function nextTick (cb, ctx) {
  2083. var _resolve;
  2084. callbacks.push(function () {
  2085. if (cb) {
  2086. try {
  2087. cb.call(ctx);
  2088. } catch (e) {
  2089. handleError(e, ctx, 'nextTick');
  2090. }
  2091. } else if (_resolve) {
  2092. _resolve(ctx);
  2093. }
  2094. });
  2095. if (!pending) {
  2096. pending = true;
  2097. if (useMacroTask) {
  2098. macroTimerFunc();
  2099. } else {
  2100. microTimerFunc();
  2101. }
  2102. }
  2103. // $flow-disable-line
  2104. if (!cb && typeof Promise !== 'undefined') {
  2105. return new Promise(function (resolve) {
  2106. _resolve = resolve;
  2107. })
  2108. }
  2109. }
  2110. /* */
  2111. /* not type checking this file because flow doesn't play well with Proxy */
  2112. var initProxy;
  2113. if (process.env.NODE_ENV !== 'production') {
  2114. var allowedGlobals = makeMap(
  2115. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  2116. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  2117. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  2118. 'require' // for Webpack/Browserify
  2119. );
  2120. var warnNonPresent = function (target, key) {
  2121. warn(
  2122. "Property or method \"" + key + "\" is not defined on the instance but " +
  2123. 'referenced during render. Make sure that this property is reactive, ' +
  2124. 'either in the data option, or for class-based components, by ' +
  2125. 'initializing the property. ' +
  2126. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  2127. target
  2128. );
  2129. };
  2130. var hasProxy =
  2131. typeof Proxy !== 'undefined' &&
  2132. Proxy.toString().match(/native code/);
  2133. if (hasProxy) {
  2134. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  2135. config.keyCodes = new Proxy(config.keyCodes, {
  2136. set: function set (target, key, value) {
  2137. if (isBuiltInModifier(key)) {
  2138. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  2139. return false
  2140. } else {
  2141. target[key] = value;
  2142. return true
  2143. }
  2144. }
  2145. });
  2146. }
  2147. var hasHandler = {
  2148. has: function has (target, key) {
  2149. var has = key in target;
  2150. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  2151. if (!has && !isAllowed) {
  2152. warnNonPresent(target, key);
  2153. }
  2154. return has || !isAllowed
  2155. }
  2156. };
  2157. var getHandler = {
  2158. get: function get (target, key) {
  2159. if (typeof key === 'string' && !(key in target)) {
  2160. warnNonPresent(target, key);
  2161. }
  2162. return target[key]
  2163. }
  2164. };
  2165. initProxy = function initProxy (vm) {
  2166. if (hasProxy) {
  2167. // determine which proxy handler to use
  2168. var options = vm.$options;
  2169. var handlers = options.render && options.render._withStripped
  2170. ? getHandler
  2171. : hasHandler;
  2172. vm._renderProxy = new Proxy(vm, handlers);
  2173. } else {
  2174. vm._renderProxy = vm;
  2175. }
  2176. };
  2177. }
  2178. /* */
  2179. var seenObjects = new _Set();
  2180. /**
  2181. * Recursively traverse an object to evoke all converted
  2182. * getters, so that every nested property inside the object
  2183. * is collected as a "deep" dependency.
  2184. */
  2185. function traverse (val) {
  2186. _traverse(val, seenObjects);
  2187. seenObjects.clear();
  2188. }
  2189. function _traverse (val, seen) {
  2190. var i, keys;
  2191. var isA = Array.isArray(val);
  2192. if ((!isA && !isObject(val)) || Object.isFrozen(val)) {
  2193. return
  2194. }
  2195. if (val.__ob__) {
  2196. var depId = val.__ob__.dep.id;
  2197. if (seen.has(depId)) {
  2198. return
  2199. }
  2200. seen.add(depId);
  2201. }
  2202. if (isA) {
  2203. i = val.length;
  2204. while (i--) { _traverse(val[i], seen); }
  2205. } else {
  2206. keys = Object.keys(val);
  2207. i = keys.length;
  2208. while (i--) { _traverse(val[keys[i]], seen); }
  2209. }
  2210. }
  2211. var mark;
  2212. var measure;
  2213. if (process.env.NODE_ENV !== 'production') {
  2214. var perf = inBrowser && window.performance;
  2215. /* istanbul ignore if */
  2216. if (
  2217. perf &&
  2218. perf.mark &&
  2219. perf.measure &&
  2220. perf.clearMarks &&
  2221. perf.clearMeasures
  2222. ) {
  2223. mark = function (tag) { return perf.mark(tag); };
  2224. measure = function (name, startTag, endTag) {
  2225. perf.measure(name, startTag, endTag);
  2226. perf.clearMarks(startTag);
  2227. perf.clearMarks(endTag);
  2228. perf.clearMeasures(name);
  2229. };
  2230. }
  2231. }
  2232. /* */
  2233. var normalizeEvent = cached(function (name) {
  2234. var passive = name.charAt(0) === '&';
  2235. name = passive ? name.slice(1) : name;
  2236. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  2237. name = once$$1 ? name.slice(1) : name;
  2238. var capture = name.charAt(0) === '!';
  2239. name = capture ? name.slice(1) : name;
  2240. return {
  2241. name: name,
  2242. once: once$$1,
  2243. capture: capture,
  2244. passive: passive
  2245. }
  2246. });
  2247. function createFnInvoker (fns) {
  2248. function invoker () {
  2249. var arguments$1 = arguments;
  2250. var fns = invoker.fns;
  2251. if (Array.isArray(fns)) {
  2252. var cloned = fns.slice();
  2253. for (var i = 0; i < cloned.length; i++) {
  2254. cloned[i].apply(null, arguments$1);
  2255. }
  2256. } else {
  2257. // return handler return value for single handlers
  2258. return fns.apply(null, arguments)
  2259. }
  2260. }
  2261. invoker.fns = fns;
  2262. return invoker
  2263. }
  2264. function updateListeners (
  2265. on,
  2266. oldOn,
  2267. add,
  2268. remove$$1,
  2269. vm
  2270. ) {
  2271. var name, def, cur, old, event;
  2272. for (name in on) {
  2273. def = cur = on[name];
  2274. old = oldOn[name];
  2275. event = normalizeEvent(name);
  2276. /* istanbul ignore if */
  2277. if (isUndef(cur)) {
  2278. process.env.NODE_ENV !== 'production' && warn(
  2279. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  2280. vm
  2281. );
  2282. } else if (isUndef(old)) {
  2283. if (isUndef(cur.fns)) {
  2284. cur = on[name] = createFnInvoker(cur);
  2285. }
  2286. add(event.name, cur, event.once, event.capture, event.passive, event.params);
  2287. } else if (cur !== old) {
  2288. old.fns = cur;
  2289. on[name] = old;
  2290. }
  2291. }
  2292. for (name in oldOn) {
  2293. if (isUndef(on[name])) {
  2294. event = normalizeEvent(name);
  2295. remove$$1(event.name, oldOn[name], event.capture);
  2296. }
  2297. }
  2298. }
  2299. /* */
  2300. function mergeVNodeHook (def, hookKey, hook) {
  2301. if (def instanceof VNode) {
  2302. def = def.data.hook || (def.data.hook = {});
  2303. }
  2304. var invoker;
  2305. var oldHook = def[hookKey];
  2306. function wrappedHook () {
  2307. hook.apply(this, arguments);
  2308. // important: remove merged hook to ensure it's called only once
  2309. // and prevent memory leak
  2310. remove(invoker.fns, wrappedHook);
  2311. }
  2312. if (isUndef(oldHook)) {
  2313. // no existing hook
  2314. invoker = createFnInvoker([wrappedHook]);
  2315. } else {
  2316. /* istanbul ignore if */
  2317. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2318. // already a merged invoker
  2319. invoker = oldHook;
  2320. invoker.fns.push(wrappedHook);
  2321. } else {
  2322. // existing plain hook
  2323. invoker = createFnInvoker([oldHook, wrappedHook]);
  2324. }
  2325. }
  2326. invoker.merged = true;
  2327. def[hookKey] = invoker;
  2328. }
  2329. /* */
  2330. function extractPropsFromVNodeData (
  2331. data,
  2332. Ctor,
  2333. tag
  2334. ) {
  2335. // we are only extracting raw values here.
  2336. // validation and default values are handled in the child
  2337. // component itself.
  2338. var propOptions = Ctor.options.props;
  2339. if (isUndef(propOptions)) {
  2340. return
  2341. }
  2342. var res = {};
  2343. var attrs = data.attrs;
  2344. var props = data.props;
  2345. if (isDef(attrs) || isDef(props)) {
  2346. for (var key in propOptions) {
  2347. var altKey = hyphenate(key);
  2348. if (process.env.NODE_ENV !== 'production') {
  2349. var keyInLowerCase = key.toLowerCase();
  2350. if (
  2351. key !== keyInLowerCase &&
  2352. attrs && hasOwn(attrs, keyInLowerCase)
  2353. ) {
  2354. tip(
  2355. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2356. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2357. " \"" + key + "\". " +
  2358. "Note that HTML attributes are case-insensitive and camelCased " +
  2359. "props need to use their kebab-case equivalents when using in-DOM " +
  2360. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2361. );
  2362. }
  2363. }
  2364. checkProp(res, props, key, altKey, true) ||
  2365. checkProp(res, attrs, key, altKey, false);
  2366. }
  2367. }
  2368. return res
  2369. }
  2370. function checkProp (
  2371. res,
  2372. hash,
  2373. key,
  2374. altKey,
  2375. preserve
  2376. ) {
  2377. if (isDef(hash)) {
  2378. if (hasOwn(hash, key)) {
  2379. res[key] = hash[key];
  2380. if (!preserve) {
  2381. delete hash[key];
  2382. }
  2383. return true
  2384. } else if (hasOwn(hash, altKey)) {
  2385. res[key] = hash[altKey];
  2386. if (!preserve) {
  2387. delete hash[altKey];
  2388. }
  2389. return true
  2390. }
  2391. }
  2392. return false
  2393. }
  2394. /* */
  2395. // The template compiler attempts to minimize the need for normalization by
  2396. // statically analyzing the template at compile time.
  2397. //
  2398. // For plain HTML markup, normalization can be completely skipped because the
  2399. // generated render function is guaranteed to return Array<VNode>. There are
  2400. // two cases where extra normalization is needed:
  2401. // 1. When the children contains components - because a functional component
  2402. // may return an Array instead of a single root. In this case, just a simple
  2403. // normalization is needed - if any child is an Array, we flatten the whole
  2404. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2405. // because functional components already normalize their own children.
  2406. function simpleNormalizeChildren (children) {
  2407. for (var i = 0; i < children.length; i++) {
  2408. if (Array.isArray(children[i])) {
  2409. return Array.prototype.concat.apply([], children)
  2410. }
  2411. }
  2412. return children
  2413. }
  2414. // 2. When the children contains constructs that always generated nested Arrays,
  2415. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2416. // with hand-written render functions / JSX. In such cases a full normalization
  2417. // is needed to cater to all possible types of children values.
  2418. function normalizeChildren (children) {
  2419. return isPrimitive(children)
  2420. ? [createTextVNode(children)]
  2421. : Array.isArray(children)
  2422. ? normalizeArrayChildren(children)
  2423. : undefined
  2424. }
  2425. function isTextNode (node) {
  2426. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2427. }
  2428. function normalizeArrayChildren (children, nestedIndex) {
  2429. var res = [];
  2430. var i, c, lastIndex, last;
  2431. for (i = 0; i < children.length; i++) {
  2432. c = children[i];
  2433. if (isUndef(c) || typeof c === 'boolean') { continue }
  2434. lastIndex = res.length - 1;
  2435. last = res[lastIndex];
  2436. // nested
  2437. if (Array.isArray(c)) {
  2438. if (c.length > 0) {
  2439. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2440. // merge adjacent text nodes
  2441. if (isTextNode(c[0]) && isTextNode(last)) {
  2442. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2443. c.shift();
  2444. }
  2445. res.push.apply(res, c);
  2446. }
  2447. } else if (isPrimitive(c)) {
  2448. if (isTextNode(last)) {
  2449. // merge adjacent text nodes
  2450. // this is necessary for SSR hydration because text nodes are
  2451. // essentially merged when rendered to HTML strings
  2452. res[lastIndex] = createTextVNode(last.text + c);
  2453. } else if (c !== '') {
  2454. // convert primitive to vnode
  2455. res.push(createTextVNode(c));
  2456. }
  2457. } else {
  2458. if (isTextNode(c) && isTextNode(last)) {
  2459. // merge adjacent text nodes
  2460. res[lastIndex] = createTextVNode(last.text + c.text);
  2461. } else {
  2462. // default key for nested array children (likely generated by v-for)
  2463. if (isTrue(children._isVList) &&
  2464. isDef(c.tag) &&
  2465. isUndef(c.key) &&
  2466. isDef(nestedIndex)) {
  2467. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2468. }
  2469. res.push(c);
  2470. }
  2471. }
  2472. }
  2473. return res
  2474. }
  2475. /* */
  2476. function ensureCtor (comp, base) {
  2477. if (
  2478. comp.__esModule ||
  2479. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  2480. ) {
  2481. comp = comp.default;
  2482. }
  2483. return isObject(comp)
  2484. ? base.extend(comp)
  2485. : comp
  2486. }
  2487. function createAsyncPlaceholder (
  2488. factory,
  2489. data,
  2490. context,
  2491. children,
  2492. tag
  2493. ) {
  2494. var node = createEmptyVNode();
  2495. node.asyncFactory = factory;
  2496. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  2497. return node
  2498. }
  2499. function resolveAsyncComponent (
  2500. factory,
  2501. baseCtor,
  2502. context
  2503. ) {
  2504. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  2505. return factory.errorComp
  2506. }
  2507. if (isDef(factory.resolved)) {
  2508. return factory.resolved
  2509. }
  2510. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  2511. return factory.loadingComp
  2512. }
  2513. if (isDef(factory.contexts)) {
  2514. // already pending
  2515. factory.contexts.push(context);
  2516. } else {
  2517. var contexts = factory.contexts = [context];
  2518. var sync = true;
  2519. var forceRender = function () {
  2520. for (var i = 0, l = contexts.length; i < l; i++) {
  2521. contexts[i].$forceUpdate();
  2522. }
  2523. };
  2524. var resolve = once(function (res) {
  2525. // cache resolved
  2526. factory.resolved = ensureCtor(res, baseCtor);
  2527. // invoke callbacks only if this is not a synchronous resolve
  2528. // (async resolves are shimmed as synchronous during SSR)
  2529. if (!sync) {
  2530. forceRender();
  2531. }
  2532. });
  2533. var reject = once(function (reason) {
  2534. process.env.NODE_ENV !== 'production' && warn(
  2535. "Failed to resolve async component: " + (String(factory)) +
  2536. (reason ? ("\nReason: " + reason) : '')
  2537. );
  2538. if (isDef(factory.errorComp)) {
  2539. factory.error = true;
  2540. forceRender();
  2541. }
  2542. });
  2543. var res = factory(resolve, reject);
  2544. if (isObject(res)) {
  2545. if (typeof res.then === 'function') {
  2546. // () => Promise
  2547. if (isUndef(factory.resolved)) {
  2548. res.then(resolve, reject);
  2549. }
  2550. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  2551. res.component.then(resolve, reject);
  2552. if (isDef(res.error)) {
  2553. factory.errorComp = ensureCtor(res.error, baseCtor);
  2554. }
  2555. if (isDef(res.loading)) {
  2556. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  2557. if (res.delay === 0) {
  2558. factory.loading = true;
  2559. } else {
  2560. setTimeout(function () {
  2561. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2562. factory.loading = true;
  2563. forceRender();
  2564. }
  2565. }, res.delay || 200);
  2566. }
  2567. }
  2568. if (isDef(res.timeout)) {
  2569. setTimeout(function () {
  2570. if (isUndef(factory.resolved)) {
  2571. reject(
  2572. process.env.NODE_ENV !== 'production'
  2573. ? ("timeout (" + (res.timeout) + "ms)")
  2574. : null
  2575. );
  2576. }
  2577. }, res.timeout);
  2578. }
  2579. }
  2580. }
  2581. sync = false;
  2582. // return in case resolved synchronously
  2583. return factory.loading
  2584. ? factory.loadingComp
  2585. : factory.resolved
  2586. }
  2587. }
  2588. /* */
  2589. function isAsyncPlaceholder (node) {
  2590. return node.isComment && node.asyncFactory
  2591. }
  2592. /* */
  2593. function getFirstComponentChild (children) {
  2594. if (Array.isArray(children)) {
  2595. for (var i = 0; i < children.length; i++) {
  2596. var c = children[i];
  2597. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2598. return c
  2599. }
  2600. }
  2601. }
  2602. }
  2603. /* */
  2604. /* */
  2605. function initEvents (vm) {
  2606. vm._events = Object.create(null);
  2607. vm._hasHookEvent = false;
  2608. // init parent attached events
  2609. var listeners = vm.$options._parentListeners;
  2610. if (listeners) {
  2611. updateComponentListeners(vm, listeners);
  2612. }
  2613. }
  2614. var target;
  2615. function add (event, fn, once) {
  2616. if (once) {
  2617. target.$once(event, fn);
  2618. } else {
  2619. target.$on(event, fn);
  2620. }
  2621. }
  2622. function remove$1 (event, fn) {
  2623. target.$off(event, fn);
  2624. }
  2625. function updateComponentListeners (
  2626. vm,
  2627. listeners,
  2628. oldListeners
  2629. ) {
  2630. target = vm;
  2631. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  2632. target = undefined;
  2633. }
  2634. function eventsMixin (Vue) {
  2635. var hookRE = /^hook:/;
  2636. Vue.prototype.$on = function (event, fn) {
  2637. var this$1 = this;
  2638. var vm = this;
  2639. if (Array.isArray(event)) {
  2640. for (var i = 0, l = event.length; i < l; i++) {
  2641. this$1.$on(event[i], fn);
  2642. }
  2643. } else {
  2644. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2645. // optimize hook:event cost by using a boolean flag marked at registration
  2646. // instead of a hash lookup
  2647. if (hookRE.test(event)) {
  2648. vm._hasHookEvent = true;
  2649. }
  2650. }
  2651. return vm
  2652. };
  2653. Vue.prototype.$once = function (event, fn) {
  2654. var vm = this;
  2655. function on () {
  2656. vm.$off(event, on);
  2657. fn.apply(vm, arguments);
  2658. }
  2659. on.fn = fn;
  2660. vm.$on(event, on);
  2661. return vm
  2662. };
  2663. Vue.prototype.$off = function (event, fn) {
  2664. var this$1 = this;
  2665. var vm = this;
  2666. // all
  2667. if (!arguments.length) {
  2668. vm._events = Object.create(null);
  2669. return vm
  2670. }
  2671. // array of events
  2672. if (Array.isArray(event)) {
  2673. for (var i = 0, l = event.length; i < l; i++) {
  2674. this$1.$off(event[i], fn);
  2675. }
  2676. return vm
  2677. }
  2678. // specific event
  2679. var cbs = vm._events[event];
  2680. if (!cbs) {
  2681. return vm
  2682. }
  2683. if (!fn) {
  2684. vm._events[event] = null;
  2685. return vm
  2686. }
  2687. if (fn) {
  2688. // specific handler
  2689. var cb;
  2690. var i$1 = cbs.length;
  2691. while (i$1--) {
  2692. cb = cbs[i$1];
  2693. if (cb === fn || cb.fn === fn) {
  2694. cbs.splice(i$1, 1);
  2695. break
  2696. }
  2697. }
  2698. }
  2699. return vm
  2700. };
  2701. Vue.prototype.$emit = function (event) {
  2702. var vm = this;
  2703. if (process.env.NODE_ENV !== 'production') {
  2704. var lowerCaseEvent = event.toLowerCase();
  2705. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  2706. tip(
  2707. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  2708. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  2709. "Note that HTML attributes are case-insensitive and you cannot use " +
  2710. "v-on to listen to camelCase events when using in-DOM templates. " +
  2711. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  2712. );
  2713. }
  2714. }
  2715. var cbs = vm._events[event];
  2716. if (cbs) {
  2717. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2718. var args = toArray(arguments, 1);
  2719. for (var i = 0, l = cbs.length; i < l; i++) {
  2720. try {
  2721. cbs[i].apply(vm, args);
  2722. } catch (e) {
  2723. handleError(e, vm, ("event handler for \"" + event + "\""));
  2724. }
  2725. }
  2726. }
  2727. return vm
  2728. };
  2729. }
  2730. /* */
  2731. /**
  2732. * Runtime helper for resolving raw children VNodes into a slot object.
  2733. */
  2734. function resolveSlots (
  2735. children,
  2736. context
  2737. ) {
  2738. var slots = {};
  2739. if (!children) {
  2740. return slots
  2741. }
  2742. for (var i = 0, l = children.length; i < l; i++) {
  2743. var child = children[i];
  2744. var data = child.data;
  2745. // remove slot attribute if the node is resolved as a Vue slot node
  2746. if (data && data.attrs && data.attrs.slot) {
  2747. delete data.attrs.slot;
  2748. }
  2749. // named slots should only be respected if the vnode was rendered in the
  2750. // same context.
  2751. if ((child.context === context || child.fnContext === context) &&
  2752. data && data.slot != null
  2753. ) {
  2754. var name = data.slot;
  2755. var slot = (slots[name] || (slots[name] = []));
  2756. if (child.tag === 'template') {
  2757. slot.push.apply(slot, child.children || []);
  2758. } else {
  2759. slot.push(child);
  2760. }
  2761. } else {
  2762. (slots.default || (slots.default = [])).push(child);
  2763. }
  2764. }
  2765. // ignore slots that contains only whitespace
  2766. for (var name$1 in slots) {
  2767. if (slots[name$1].every(isWhitespace)) {
  2768. delete slots[name$1];
  2769. }
  2770. }
  2771. return slots
  2772. }
  2773. function isWhitespace (node) {
  2774. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2775. }
  2776. function resolveScopedSlots (
  2777. fns, // see flow/vnode
  2778. res
  2779. ) {
  2780. res = res || {};
  2781. for (var i = 0; i < fns.length; i++) {
  2782. if (Array.isArray(fns[i])) {
  2783. resolveScopedSlots(fns[i], res);
  2784. } else {
  2785. res[fns[i].key] = fns[i].fn;
  2786. }
  2787. }
  2788. return res
  2789. }
  2790. /* */
  2791. var activeInstance = null;
  2792. var isUpdatingChildComponent = false;
  2793. function initLifecycle (vm) {
  2794. var options = vm.$options;
  2795. // locate first non-abstract parent
  2796. var parent = options.parent;
  2797. if (parent && !options.abstract) {
  2798. while (parent.$options.abstract && parent.$parent) {
  2799. parent = parent.$parent;
  2800. }
  2801. parent.$children.push(vm);
  2802. }
  2803. vm.$parent = parent;
  2804. vm.$root = parent ? parent.$root : vm;
  2805. vm.$children = [];
  2806. vm.$refs = {};
  2807. vm._watcher = null;
  2808. vm._inactive = null;
  2809. vm._directInactive = false;
  2810. vm._isMounted = false;
  2811. vm._isDestroyed = false;
  2812. vm._isBeingDestroyed = false;
  2813. }
  2814. function lifecycleMixin (Vue) {
  2815. Vue.prototype._update = function (vnode, hydrating) {
  2816. var vm = this;
  2817. if (vm._isMounted) {
  2818. callHook(vm, 'beforeUpdate');
  2819. }
  2820. var prevEl = vm.$el;
  2821. var prevVnode = vm._vnode;
  2822. var prevActiveInstance = activeInstance;
  2823. activeInstance = vm;
  2824. vm._vnode = vnode;
  2825. // Vue.prototype.__patch__ is injected in entry points
  2826. // based on the rendering backend used.
  2827. if (!prevVnode) {
  2828. // initial render
  2829. vm.$el = vm.__patch__(
  2830. vm.$el, vnode, hydrating, false /* removeOnly */,
  2831. vm.$options._parentElm,
  2832. vm.$options._refElm
  2833. );
  2834. // no need for the ref nodes after initial patch
  2835. // this prevents keeping a detached DOM tree in memory (#5851)
  2836. vm.$options._parentElm = vm.$options._refElm = null;
  2837. } else {
  2838. // updates
  2839. vm.$el = vm.__patch__(prevVnode, vnode);
  2840. }
  2841. activeInstance = prevActiveInstance;
  2842. // update __vue__ reference
  2843. if (prevEl) {
  2844. prevEl.__vue__ = null;
  2845. }
  2846. if (vm.$el) {
  2847. vm.$el.__vue__ = vm;
  2848. }
  2849. // if parent is an HOC, update its $el as well
  2850. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  2851. vm.$parent.$el = vm.$el;
  2852. }
  2853. // updated hook is called by the scheduler to ensure that children are
  2854. // updated in a parent's updated hook.
  2855. };
  2856. Vue.prototype.$forceUpdate = function () {
  2857. var vm = this;
  2858. if (vm._watcher) {
  2859. vm._watcher.update();
  2860. }
  2861. };
  2862. Vue.prototype.$destroy = function () {
  2863. var vm = this;
  2864. if (vm._isBeingDestroyed) {
  2865. return
  2866. }
  2867. callHook(vm, 'beforeDestroy');
  2868. vm._isBeingDestroyed = true;
  2869. // remove self from parent
  2870. var parent = vm.$parent;
  2871. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2872. remove(parent.$children, vm);
  2873. }
  2874. // teardown watchers
  2875. if (vm._watcher) {
  2876. vm._watcher.teardown();
  2877. }
  2878. var i = vm._watchers.length;
  2879. while (i--) {
  2880. vm._watchers[i].teardown();
  2881. }
  2882. // remove reference from data ob
  2883. // frozen object may not have observer.
  2884. if (vm._data.__ob__) {
  2885. vm._data.__ob__.vmCount--;
  2886. }
  2887. // call the last hook...
  2888. vm._isDestroyed = true;
  2889. // invoke destroy hooks on current rendered tree
  2890. vm.__patch__(vm._vnode, null);
  2891. // fire destroyed hook
  2892. callHook(vm, 'destroyed');
  2893. // turn off all instance listeners.
  2894. vm.$off();
  2895. // remove __vue__ reference
  2896. if (vm.$el) {
  2897. vm.$el.__vue__ = null;
  2898. }
  2899. // release circular reference (#6759)
  2900. if (vm.$vnode) {
  2901. vm.$vnode.parent = null;
  2902. }
  2903. };
  2904. }
  2905. function mountComponent (
  2906. vm,
  2907. el,
  2908. hydrating
  2909. ) {
  2910. vm.$el = el;
  2911. if (!vm.$options.render) {
  2912. vm.$options.render = createEmptyVNode;
  2913. if (process.env.NODE_ENV !== 'production') {
  2914. /* istanbul ignore if */
  2915. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  2916. vm.$options.el || el) {
  2917. warn(
  2918. 'You are using the runtime-only build of Vue where the template ' +
  2919. 'compiler is not available. Either pre-compile the templates into ' +
  2920. 'render functions, or use the compiler-included build.',
  2921. vm
  2922. );
  2923. } else {
  2924. warn(
  2925. 'Failed to mount component: template or render function not defined.',
  2926. vm
  2927. );
  2928. }
  2929. }
  2930. }
  2931. callHook(vm, 'beforeMount');
  2932. var updateComponent;
  2933. /* istanbul ignore if */
  2934. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  2935. updateComponent = function () {
  2936. var name = vm._name;
  2937. var id = vm._uid;
  2938. var startTag = "vue-perf-start:" + id;
  2939. var endTag = "vue-perf-end:" + id;
  2940. mark(startTag);
  2941. var vnode = vm._render();
  2942. mark(endTag);
  2943. measure(("vue " + name + " render"), startTag, endTag);
  2944. mark(startTag);
  2945. vm._update(vnode, hydrating);
  2946. mark(endTag);
  2947. measure(("vue " + name + " patch"), startTag, endTag);
  2948. };
  2949. } else {
  2950. updateComponent = function () {
  2951. vm._update(vm._render(), hydrating);
  2952. };
  2953. }
  2954. // we set this to vm._watcher inside the watcher's constructor
  2955. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  2956. // component's mounted hook), which relies on vm._watcher being already defined
  2957. new Watcher(vm, updateComponent, noop, null, true /* isRenderWatcher */);
  2958. hydrating = false;
  2959. // manually mounted instance, call mounted on self
  2960. // mounted is called for render-created child components in its inserted hook
  2961. if (vm.$vnode == null) {
  2962. vm._isMounted = true;
  2963. callHook(vm, 'mounted');
  2964. }
  2965. return vm
  2966. }
  2967. function updateChildComponent (
  2968. vm,
  2969. propsData,
  2970. listeners,
  2971. parentVnode,
  2972. renderChildren
  2973. ) {
  2974. if (process.env.NODE_ENV !== 'production') {
  2975. isUpdatingChildComponent = true;
  2976. }
  2977. // determine whether component has slot children
  2978. // we need to do this before overwriting $options._renderChildren
  2979. var hasChildren = !!(
  2980. renderChildren || // has new static slots
  2981. vm.$options._renderChildren || // has old static slots
  2982. parentVnode.data.scopedSlots || // has new scoped slots
  2983. vm.$scopedSlots !== emptyObject // has old scoped slots
  2984. );
  2985. vm.$options._parentVnode = parentVnode;
  2986. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  2987. if (vm._vnode) { // update child tree's parent
  2988. vm._vnode.parent = parentVnode;
  2989. }
  2990. vm.$options._renderChildren = renderChildren;
  2991. // update $attrs and $listeners hash
  2992. // these are also reactive so they may trigger child update if the child
  2993. // used them during render
  2994. vm.$attrs = (parentVnode.data && parentVnode.data.attrs) || emptyObject;
  2995. vm.$listeners = listeners || emptyObject;
  2996. // update props
  2997. if (propsData && vm.$options.props) {
  2998. observerState.shouldConvert = false;
  2999. var props = vm._props;
  3000. var propKeys = vm.$options._propKeys || [];
  3001. for (var i = 0; i < propKeys.length; i++) {
  3002. var key = propKeys[i];
  3003. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  3004. }
  3005. observerState.shouldConvert = true;
  3006. // keep a copy of raw propsData
  3007. vm.$options.propsData = propsData;
  3008. }
  3009. // update listeners
  3010. if (listeners) {
  3011. var oldListeners = vm.$options._parentListeners;
  3012. vm.$options._parentListeners = listeners;
  3013. updateComponentListeners(vm, listeners, oldListeners);
  3014. }
  3015. // resolve slots + force update if has children
  3016. if (hasChildren) {
  3017. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3018. vm.$forceUpdate();
  3019. }
  3020. if (process.env.NODE_ENV !== 'production') {
  3021. isUpdatingChildComponent = false;
  3022. }
  3023. }
  3024. function isInInactiveTree (vm) {
  3025. while (vm && (vm = vm.$parent)) {
  3026. if (vm._inactive) { return true }
  3027. }
  3028. return false
  3029. }
  3030. function activateChildComponent (vm, direct) {
  3031. if (direct) {
  3032. vm._directInactive = false;
  3033. if (isInInactiveTree(vm)) {
  3034. return
  3035. }
  3036. } else if (vm._directInactive) {
  3037. return
  3038. }
  3039. if (vm._inactive || vm._inactive === null) {
  3040. vm._inactive = false;
  3041. for (var i = 0; i < vm.$children.length; i++) {
  3042. activateChildComponent(vm.$children[i]);
  3043. }
  3044. callHook(vm, 'activated');
  3045. }
  3046. }
  3047. function deactivateChildComponent (vm, direct) {
  3048. if (direct) {
  3049. vm._directInactive = true;
  3050. if (isInInactiveTree(vm)) {
  3051. return
  3052. }
  3053. }
  3054. if (!vm._inactive) {
  3055. vm._inactive = true;
  3056. for (var i = 0; i < vm.$children.length; i++) {
  3057. deactivateChildComponent(vm.$children[i]);
  3058. }
  3059. callHook(vm, 'deactivated');
  3060. }
  3061. }
  3062. function callHook (vm, hook) {
  3063. var handlers = vm.$options[hook];
  3064. if (handlers) {
  3065. for (var i = 0, j = handlers.length; i < j; i++) {
  3066. try {
  3067. handlers[i].call(vm);
  3068. } catch (e) {
  3069. handleError(e, vm, (hook + " hook"));
  3070. }
  3071. }
  3072. }
  3073. if (vm._hasHookEvent) {
  3074. vm.$emit('hook:' + hook);
  3075. }
  3076. }
  3077. /* */
  3078. var MAX_UPDATE_COUNT = 100;
  3079. var queue = [];
  3080. var activatedChildren = [];
  3081. var has = {};
  3082. var circular = {};
  3083. var waiting = false;
  3084. var flushing = false;
  3085. var index = 0;
  3086. /**
  3087. * Reset the scheduler's state.
  3088. */
  3089. function resetSchedulerState () {
  3090. index = queue.length = activatedChildren.length = 0;
  3091. has = {};
  3092. if (process.env.NODE_ENV !== 'production') {
  3093. circular = {};
  3094. }
  3095. waiting = flushing = false;
  3096. }
  3097. /**
  3098. * Flush both queues and run the watchers.
  3099. */
  3100. function flushSchedulerQueue () {
  3101. flushing = true;
  3102. var watcher, id;
  3103. // Sort queue before flush.
  3104. // This ensures that:
  3105. // 1. Components are updated from parent to child. (because parent is always
  3106. // created before the child)
  3107. // 2. A component's user watchers are run before its render watcher (because
  3108. // user watchers are created before the render watcher)
  3109. // 3. If a component is destroyed during a parent component's watcher run,
  3110. // its watchers can be skipped.
  3111. queue.sort(function (a, b) { return a.id - b.id; });
  3112. // do not cache length because more watchers might be pushed
  3113. // as we run existing watchers
  3114. for (index = 0; index < queue.length; index++) {
  3115. watcher = queue[index];
  3116. id = watcher.id;
  3117. has[id] = null;
  3118. watcher.run();
  3119. // in dev build, check and stop circular updates.
  3120. if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  3121. circular[id] = (circular[id] || 0) + 1;
  3122. if (circular[id] > MAX_UPDATE_COUNT) {
  3123. warn(
  3124. 'You may have an infinite update loop ' + (
  3125. watcher.user
  3126. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3127. : "in a component render function."
  3128. ),
  3129. watcher.vm
  3130. );
  3131. break
  3132. }
  3133. }
  3134. }
  3135. // keep copies of post queues before resetting state
  3136. var activatedQueue = activatedChildren.slice();
  3137. var updatedQueue = queue.slice();
  3138. resetSchedulerState();
  3139. // call component updated and activated hooks
  3140. callActivatedHooks(activatedQueue);
  3141. callUpdatedHooks(updatedQueue);
  3142. // devtool hook
  3143. /* istanbul ignore if */
  3144. if (devtools && config.devtools) {
  3145. devtools.emit('flush');
  3146. }
  3147. }
  3148. function callUpdatedHooks (queue) {
  3149. var i = queue.length;
  3150. while (i--) {
  3151. var watcher = queue[i];
  3152. var vm = watcher.vm;
  3153. if (vm._watcher === watcher && vm._isMounted) {
  3154. callHook(vm, 'updated');
  3155. }
  3156. }
  3157. }
  3158. /**
  3159. * Queue a kept-alive component that was activated during patch.
  3160. * The queue will be processed after the entire tree has been patched.
  3161. */
  3162. function queueActivatedComponent (vm) {
  3163. // setting _inactive to false here so that a render function can
  3164. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3165. vm._inactive = false;
  3166. activatedChildren.push(vm);
  3167. }
  3168. function callActivatedHooks (queue) {
  3169. for (var i = 0; i < queue.length; i++) {
  3170. queue[i]._inactive = true;
  3171. activateChildComponent(queue[i], true /* true */);
  3172. }
  3173. }
  3174. /**
  3175. * Push a watcher into the watcher queue.
  3176. * Jobs with duplicate IDs will be skipped unless it's
  3177. * pushed when the queue is being flushed.
  3178. */
  3179. function queueWatcher (watcher) {
  3180. var id = watcher.id;
  3181. if (has[id] == null) {
  3182. has[id] = true;
  3183. if (!flushing) {
  3184. queue.push(watcher);
  3185. } else {
  3186. // if already flushing, splice the watcher based on its id
  3187. // if already past its id, it will be run next immediately.
  3188. var i = queue.length - 1;
  3189. while (i > index && queue[i].id > watcher.id) {
  3190. i--;
  3191. }
  3192. queue.splice(i + 1, 0, watcher);
  3193. }
  3194. // queue the flush
  3195. if (!waiting) {
  3196. waiting = true;
  3197. nextTick(flushSchedulerQueue);
  3198. }
  3199. }
  3200. }
  3201. /* */
  3202. var uid$2 = 0;
  3203. /**
  3204. * A watcher parses an expression, collects dependencies,
  3205. * and fires callback when the expression value changes.
  3206. * This is used for both the $watch() api and directives.
  3207. */
  3208. var Watcher = function Watcher (
  3209. vm,
  3210. expOrFn,
  3211. cb,
  3212. options,
  3213. isRenderWatcher
  3214. ) {
  3215. this.vm = vm;
  3216. if (isRenderWatcher) {
  3217. vm._watcher = this;
  3218. }
  3219. vm._watchers.push(this);
  3220. // options
  3221. if (options) {
  3222. this.deep = !!options.deep;
  3223. this.user = !!options.user;
  3224. this.lazy = !!options.lazy;
  3225. this.sync = !!options.sync;
  3226. } else {
  3227. this.deep = this.user = this.lazy = this.sync = false;
  3228. }
  3229. this.cb = cb;
  3230. this.id = ++uid$2; // uid for batching
  3231. this.active = true;
  3232. this.dirty = this.lazy; // for lazy watchers
  3233. this.deps = [];
  3234. this.newDeps = [];
  3235. this.depIds = new _Set();
  3236. this.newDepIds = new _Set();
  3237. this.expression = process.env.NODE_ENV !== 'production'
  3238. ? expOrFn.toString()
  3239. : '';
  3240. // parse expression for getter
  3241. if (typeof expOrFn === 'function') {
  3242. this.getter = expOrFn;
  3243. } else {
  3244. this.getter = parsePath(expOrFn);
  3245. if (!this.getter) {
  3246. this.getter = function () {};
  3247. process.env.NODE_ENV !== 'production' && warn(
  3248. "Failed watching path: \"" + expOrFn + "\" " +
  3249. 'Watcher only accepts simple dot-delimited paths. ' +
  3250. 'For full control, use a function instead.',
  3251. vm
  3252. );
  3253. }
  3254. }
  3255. this.value = this.lazy
  3256. ? undefined
  3257. : this.get();
  3258. };
  3259. /**
  3260. * Evaluate the getter, and re-collect dependencies.
  3261. */
  3262. Watcher.prototype.get = function get () {
  3263. pushTarget(this);
  3264. var value;
  3265. var vm = this.vm;
  3266. try {
  3267. value = this.getter.call(vm, vm);
  3268. } catch (e) {
  3269. if (this.user) {
  3270. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  3271. } else {
  3272. throw e
  3273. }
  3274. } finally {
  3275. // "touch" every property so they are all tracked as
  3276. // dependencies for deep watching
  3277. if (this.deep) {
  3278. traverse(value);
  3279. }
  3280. popTarget();
  3281. this.cleanupDeps();
  3282. }
  3283. return value
  3284. };
  3285. /**
  3286. * Add a dependency to this directive.
  3287. */
  3288. Watcher.prototype.addDep = function addDep (dep) {
  3289. var id = dep.id;
  3290. if (!this.newDepIds.has(id)) {
  3291. this.newDepIds.add(id);
  3292. this.newDeps.push(dep);
  3293. if (!this.depIds.has(id)) {
  3294. dep.addSub(this);
  3295. }
  3296. }
  3297. };
  3298. /**
  3299. * Clean up for dependency collection.
  3300. */
  3301. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  3302. var this$1 = this;
  3303. var i = this.deps.length;
  3304. while (i--) {
  3305. var dep = this$1.deps[i];
  3306. if (!this$1.newDepIds.has(dep.id)) {
  3307. dep.removeSub(this$1);
  3308. }
  3309. }
  3310. var tmp = this.depIds;
  3311. this.depIds = this.newDepIds;
  3312. this.newDepIds = tmp;
  3313. this.newDepIds.clear();
  3314. tmp = this.deps;
  3315. this.deps = this.newDeps;
  3316. this.newDeps = tmp;
  3317. this.newDeps.length = 0;
  3318. };
  3319. /**
  3320. * Subscriber interface.
  3321. * Will be called when a dependency changes.
  3322. */
  3323. Watcher.prototype.update = function update () {
  3324. /* istanbul ignore else */
  3325. if (this.lazy) {
  3326. this.dirty = true;
  3327. } else if (this.sync) {
  3328. this.run();
  3329. } else {
  3330. queueWatcher(this);
  3331. }
  3332. };
  3333. /**
  3334. * Scheduler job interface.
  3335. * Will be called by the scheduler.
  3336. */
  3337. Watcher.prototype.run = function run () {
  3338. if (this.active) {
  3339. var value = this.get();
  3340. if (
  3341. value !== this.value ||
  3342. // Deep watchers and watchers on Object/Arrays should fire even
  3343. // when the value is the same, because the value may
  3344. // have mutated.
  3345. isObject(value) ||
  3346. this.deep
  3347. ) {
  3348. // set new value
  3349. var oldValue = this.value;
  3350. this.value = value;
  3351. if (this.user) {
  3352. try {
  3353. this.cb.call(this.vm, value, oldValue);
  3354. } catch (e) {
  3355. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  3356. }
  3357. } else {
  3358. this.cb.call(this.vm, value, oldValue);
  3359. }
  3360. }
  3361. }
  3362. };
  3363. /**
  3364. * Evaluate the value of the watcher.
  3365. * This only gets called for lazy watchers.
  3366. */
  3367. Watcher.prototype.evaluate = function evaluate () {
  3368. this.value = this.get();
  3369. this.dirty = false;
  3370. };
  3371. /**
  3372. * Depend on all deps collected by this watcher.
  3373. */
  3374. Watcher.prototype.depend = function depend () {
  3375. var this$1 = this;
  3376. var i = this.deps.length;
  3377. while (i--) {
  3378. this$1.deps[i].depend();
  3379. }
  3380. };
  3381. /**
  3382. * Remove self from all dependencies' subscriber list.
  3383. */
  3384. Watcher.prototype.teardown = function teardown () {
  3385. var this$1 = this;
  3386. if (this.active) {
  3387. // remove self from vm's watcher list
  3388. // this is a somewhat expensive operation so we skip it
  3389. // if the vm is being destroyed.
  3390. if (!this.vm._isBeingDestroyed) {
  3391. remove(this.vm._watchers, this);
  3392. }
  3393. var i = this.deps.length;
  3394. while (i--) {
  3395. this$1.deps[i].removeSub(this$1);
  3396. }
  3397. this.active = false;
  3398. }
  3399. };
  3400. /* */
  3401. var sharedPropertyDefinition = {
  3402. enumerable: true,
  3403. configurable: true,
  3404. get: noop,
  3405. set: noop
  3406. };
  3407. function proxy (target, sourceKey, key) {
  3408. sharedPropertyDefinition.get = function proxyGetter () {
  3409. return this[sourceKey][key]
  3410. };
  3411. sharedPropertyDefinition.set = function proxySetter (val) {
  3412. this[sourceKey][key] = val;
  3413. };
  3414. Object.defineProperty(target, key, sharedPropertyDefinition);
  3415. }
  3416. function initState (vm) {
  3417. vm._watchers = [];
  3418. var opts = vm.$options;
  3419. if (opts.props) { initProps(vm, opts.props); }
  3420. if (opts.methods) { initMethods(vm, opts.methods); }
  3421. if (opts.data) {
  3422. initData(vm);
  3423. } else {
  3424. observe(vm._data = {}, true /* asRootData */);
  3425. }
  3426. if (opts.computed) { initComputed(vm, opts.computed); }
  3427. if (opts.watch && opts.watch !== nativeWatch) {
  3428. initWatch(vm, opts.watch);
  3429. }
  3430. }
  3431. function initProps (vm, propsOptions) {
  3432. var propsData = vm.$options.propsData || {};
  3433. var props = vm._props = {};
  3434. // cache prop keys so that future props updates can iterate using Array
  3435. // instead of dynamic object key enumeration.
  3436. var keys = vm.$options._propKeys = [];
  3437. var isRoot = !vm.$parent;
  3438. // root instance props should be converted
  3439. observerState.shouldConvert = isRoot;
  3440. var loop = function ( key ) {
  3441. keys.push(key);
  3442. var value = validateProp(key, propsOptions, propsData, vm);
  3443. /* istanbul ignore else */
  3444. if (process.env.NODE_ENV !== 'production') {
  3445. var hyphenatedKey = hyphenate(key);
  3446. if (isReservedAttribute(hyphenatedKey) ||
  3447. config.isReservedAttr(hyphenatedKey)) {
  3448. warn(
  3449. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  3450. vm
  3451. );
  3452. }
  3453. defineReactive(props, key, value, function () {
  3454. if (vm.$parent && !isUpdatingChildComponent) {
  3455. warn(
  3456. "Avoid mutating a prop directly since the value will be " +
  3457. "overwritten whenever the parent component re-renders. " +
  3458. "Instead, use a data or computed property based on the prop's " +
  3459. "value. Prop being mutated: \"" + key + "\"",
  3460. vm
  3461. );
  3462. }
  3463. });
  3464. } else {
  3465. defineReactive(props, key, value);
  3466. }
  3467. // static props are already proxied on the component's prototype
  3468. // during Vue.extend(). We only need to proxy props defined at
  3469. // instantiation here.
  3470. if (!(key in vm)) {
  3471. proxy(vm, "_props", key);
  3472. }
  3473. };
  3474. for (var key in propsOptions) loop( key );
  3475. observerState.shouldConvert = true;
  3476. }
  3477. function initData (vm) {
  3478. var data = vm.$options.data;
  3479. data = vm._data = typeof data === 'function'
  3480. ? getData(data, vm)
  3481. : data || {};
  3482. if (!isPlainObject(data)) {
  3483. data = {};
  3484. process.env.NODE_ENV !== 'production' && warn(
  3485. 'data functions should return an object:\n' +
  3486. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  3487. vm
  3488. );
  3489. }
  3490. // proxy data on instance
  3491. var keys = Object.keys(data);
  3492. var props = vm.$options.props;
  3493. var methods = vm.$options.methods;
  3494. var i = keys.length;
  3495. while (i--) {
  3496. var key = keys[i];
  3497. if (process.env.NODE_ENV !== 'production') {
  3498. if (methods && hasOwn(methods, key)) {
  3499. warn(
  3500. ("Method \"" + key + "\" has already been defined as a data property."),
  3501. vm
  3502. );
  3503. }
  3504. }
  3505. if (props && hasOwn(props, key)) {
  3506. process.env.NODE_ENV !== 'production' && warn(
  3507. "The data property \"" + key + "\" is already declared as a prop. " +
  3508. "Use prop default value instead.",
  3509. vm
  3510. );
  3511. } else if (!isReserved(key)) {
  3512. proxy(vm, "_data", key);
  3513. }
  3514. }
  3515. // observe data
  3516. observe(data, true /* asRootData */);
  3517. }
  3518. function getData (data, vm) {
  3519. try {
  3520. return data.call(vm, vm)
  3521. } catch (e) {
  3522. handleError(e, vm, "data()");
  3523. return {}
  3524. }
  3525. }
  3526. var computedWatcherOptions = { lazy: true };
  3527. function initComputed (vm, computed) {
  3528. // $flow-disable-line
  3529. var watchers = vm._computedWatchers = Object.create(null);
  3530. // computed properties are just getters during SSR
  3531. var isSSR = isServerRendering();
  3532. for (var key in computed) {
  3533. var userDef = computed[key];
  3534. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  3535. if (process.env.NODE_ENV !== 'production' && getter == null) {
  3536. warn(
  3537. ("Getter is missing for computed property \"" + key + "\"."),
  3538. vm
  3539. );
  3540. }
  3541. if (!isSSR) {
  3542. // create internal watcher for the computed property.
  3543. watchers[key] = new Watcher(
  3544. vm,
  3545. getter || noop,
  3546. noop,
  3547. computedWatcherOptions
  3548. );
  3549. }
  3550. // component-defined computed properties are already defined on the
  3551. // component prototype. We only need to define computed properties defined
  3552. // at instantiation here.
  3553. if (!(key in vm)) {
  3554. defineComputed(vm, key, userDef);
  3555. } else if (process.env.NODE_ENV !== 'production') {
  3556. if (key in vm.$data) {
  3557. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  3558. } else if (vm.$options.props && key in vm.$options.props) {
  3559. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  3560. }
  3561. }
  3562. }
  3563. }
  3564. function defineComputed (
  3565. target,
  3566. key,
  3567. userDef
  3568. ) {
  3569. var shouldCache = !isServerRendering();
  3570. if (typeof userDef === 'function') {
  3571. sharedPropertyDefinition.get = shouldCache
  3572. ? createComputedGetter(key)
  3573. : userDef;
  3574. sharedPropertyDefinition.set = noop;
  3575. } else {
  3576. sharedPropertyDefinition.get = userDef.get
  3577. ? shouldCache && userDef.cache !== false
  3578. ? createComputedGetter(key)
  3579. : userDef.get
  3580. : noop;
  3581. sharedPropertyDefinition.set = userDef.set
  3582. ? userDef.set
  3583. : noop;
  3584. }
  3585. if (process.env.NODE_ENV !== 'production' &&
  3586. sharedPropertyDefinition.set === noop) {
  3587. sharedPropertyDefinition.set = function () {
  3588. warn(
  3589. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  3590. this
  3591. );
  3592. };
  3593. }
  3594. Object.defineProperty(target, key, sharedPropertyDefinition);
  3595. }
  3596. function createComputedGetter (key) {
  3597. return function computedGetter () {
  3598. var watcher = this._computedWatchers && this._computedWatchers[key];
  3599. if (watcher) {
  3600. if (watcher.dirty) {
  3601. watcher.evaluate();
  3602. }
  3603. if (Dep.target) {
  3604. watcher.depend();
  3605. }
  3606. return watcher.value
  3607. }
  3608. }
  3609. }
  3610. function initMethods (vm, methods) {
  3611. var props = vm.$options.props;
  3612. for (var key in methods) {
  3613. if (process.env.NODE_ENV !== 'production') {
  3614. if (methods[key] == null) {
  3615. warn(
  3616. "Method \"" + key + "\" has an undefined value in the component definition. " +
  3617. "Did you reference the function correctly?",
  3618. vm
  3619. );
  3620. }
  3621. if (props && hasOwn(props, key)) {
  3622. warn(
  3623. ("Method \"" + key + "\" has already been defined as a prop."),
  3624. vm
  3625. );
  3626. }
  3627. if ((key in vm) && isReserved(key)) {
  3628. warn(
  3629. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  3630. "Avoid defining component methods that start with _ or $."
  3631. );
  3632. }
  3633. }
  3634. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  3635. }
  3636. }
  3637. function initWatch (vm, watch) {
  3638. for (var key in watch) {
  3639. var handler = watch[key];
  3640. if (Array.isArray(handler)) {
  3641. for (var i = 0; i < handler.length; i++) {
  3642. createWatcher(vm, key, handler[i]);
  3643. }
  3644. } else {
  3645. createWatcher(vm, key, handler);
  3646. }
  3647. }
  3648. }
  3649. function createWatcher (
  3650. vm,
  3651. keyOrFn,
  3652. handler,
  3653. options
  3654. ) {
  3655. if (isPlainObject(handler)) {
  3656. options = handler;
  3657. handler = handler.handler;
  3658. }
  3659. if (typeof handler === 'string') {
  3660. handler = vm[handler];
  3661. }
  3662. return vm.$watch(keyOrFn, handler, options)
  3663. }
  3664. function stateMixin (Vue) {
  3665. // flow somehow has problems with directly declared definition object
  3666. // when using Object.defineProperty, so we have to procedurally build up
  3667. // the object here.
  3668. var dataDef = {};
  3669. dataDef.get = function () { return this._data };
  3670. var propsDef = {};
  3671. propsDef.get = function () { return this._props };
  3672. if (process.env.NODE_ENV !== 'production') {
  3673. dataDef.set = function (newData) {
  3674. warn(
  3675. 'Avoid replacing instance root $data. ' +
  3676. 'Use nested data properties instead.',
  3677. this
  3678. );
  3679. };
  3680. propsDef.set = function () {
  3681. warn("$props is readonly.", this);
  3682. };
  3683. }
  3684. Object.defineProperty(Vue.prototype, '$data', dataDef);
  3685. Object.defineProperty(Vue.prototype, '$props', propsDef);
  3686. Vue.prototype.$set = set;
  3687. Vue.prototype.$delete = del;
  3688. Vue.prototype.$watch = function (
  3689. expOrFn,
  3690. cb,
  3691. options
  3692. ) {
  3693. var vm = this;
  3694. if (isPlainObject(cb)) {
  3695. return createWatcher(vm, expOrFn, cb, options)
  3696. }
  3697. options = options || {};
  3698. options.user = true;
  3699. var watcher = new Watcher(vm, expOrFn, cb, options);
  3700. if (options.immediate) {
  3701. cb.call(vm, watcher.value);
  3702. }
  3703. return function unwatchFn () {
  3704. watcher.teardown();
  3705. }
  3706. };
  3707. }
  3708. /* */
  3709. function initProvide (vm) {
  3710. var provide = vm.$options.provide;
  3711. if (provide) {
  3712. vm._provided = typeof provide === 'function'
  3713. ? provide.call(vm)
  3714. : provide;
  3715. }
  3716. }
  3717. function initInjections (vm) {
  3718. var result = resolveInject(vm.$options.inject, vm);
  3719. if (result) {
  3720. observerState.shouldConvert = false;
  3721. Object.keys(result).forEach(function (key) {
  3722. /* istanbul ignore else */
  3723. if (process.env.NODE_ENV !== 'production') {
  3724. defineReactive(vm, key, result[key], function () {
  3725. warn(
  3726. "Avoid mutating an injected value directly since the changes will be " +
  3727. "overwritten whenever the provided component re-renders. " +
  3728. "injection being mutated: \"" + key + "\"",
  3729. vm
  3730. );
  3731. });
  3732. } else {
  3733. defineReactive(vm, key, result[key]);
  3734. }
  3735. });
  3736. observerState.shouldConvert = true;
  3737. }
  3738. }
  3739. function resolveInject (inject, vm) {
  3740. if (inject) {
  3741. // inject is :any because flow is not smart enough to figure out cached
  3742. var result = Object.create(null);
  3743. var keys = hasSymbol
  3744. ? Reflect.ownKeys(inject).filter(function (key) {
  3745. /* istanbul ignore next */
  3746. return Object.getOwnPropertyDescriptor(inject, key).enumerable
  3747. })
  3748. : Object.keys(inject);
  3749. for (var i = 0; i < keys.length; i++) {
  3750. var key = keys[i];
  3751. var provideKey = inject[key].from;
  3752. var source = vm;
  3753. while (source) {
  3754. if (source._provided && provideKey in source._provided) {
  3755. result[key] = source._provided[provideKey];
  3756. break
  3757. }
  3758. source = source.$parent;
  3759. }
  3760. if (!source) {
  3761. if ('default' in inject[key]) {
  3762. var provideDefault = inject[key].default;
  3763. result[key] = typeof provideDefault === 'function'
  3764. ? provideDefault.call(vm)
  3765. : provideDefault;
  3766. } else if (process.env.NODE_ENV !== 'production') {
  3767. warn(("Injection \"" + key + "\" not found"), vm);
  3768. }
  3769. }
  3770. }
  3771. return result
  3772. }
  3773. }
  3774. /* */
  3775. /**
  3776. * Runtime helper for rendering v-for lists.
  3777. */
  3778. function renderList (
  3779. val,
  3780. render
  3781. ) {
  3782. var ret, i, l, keys, key;
  3783. if (Array.isArray(val) || typeof val === 'string') {
  3784. ret = new Array(val.length);
  3785. for (i = 0, l = val.length; i < l; i++) {
  3786. ret[i] = render(val[i], i);
  3787. }
  3788. } else if (typeof val === 'number') {
  3789. ret = new Array(val);
  3790. for (i = 0; i < val; i++) {
  3791. ret[i] = render(i + 1, i);
  3792. }
  3793. } else if (isObject(val)) {
  3794. keys = Object.keys(val);
  3795. ret = new Array(keys.length);
  3796. for (i = 0, l = keys.length; i < l; i++) {
  3797. key = keys[i];
  3798. ret[i] = render(val[key], key, i);
  3799. }
  3800. }
  3801. if (isDef(ret)) {
  3802. (ret)._isVList = true;
  3803. }
  3804. return ret
  3805. }
  3806. /* */
  3807. /**
  3808. * Runtime helper for rendering <slot>
  3809. */
  3810. function renderSlot (
  3811. name,
  3812. fallback,
  3813. props,
  3814. bindObject
  3815. ) {
  3816. var scopedSlotFn = this.$scopedSlots[name];
  3817. var nodes;
  3818. if (scopedSlotFn) { // scoped slot
  3819. props = props || {};
  3820. if (bindObject) {
  3821. if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
  3822. warn(
  3823. 'slot v-bind without argument expects an Object',
  3824. this
  3825. );
  3826. }
  3827. props = extend(extend({}, bindObject), props);
  3828. }
  3829. nodes = scopedSlotFn(props) || fallback;
  3830. } else {
  3831. var slotNodes = this.$slots[name];
  3832. // warn duplicate slot usage
  3833. if (slotNodes) {
  3834. if (process.env.NODE_ENV !== 'production' && slotNodes._rendered) {
  3835. warn(
  3836. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  3837. "- this will likely cause render errors.",
  3838. this
  3839. );
  3840. }
  3841. slotNodes._rendered = true;
  3842. }
  3843. nodes = slotNodes || fallback;
  3844. }
  3845. var target = props && props.slot;
  3846. if (target) {
  3847. return this.$createElement('template', { slot: target }, nodes)
  3848. } else {
  3849. return nodes
  3850. }
  3851. }
  3852. /* */
  3853. /**
  3854. * Runtime helper for resolving filters
  3855. */
  3856. function resolveFilter (id) {
  3857. return resolveAsset(this.$options, 'filters', id, true) || identity
  3858. }
  3859. /* */
  3860. /**
  3861. * Runtime helper for checking keyCodes from config.
  3862. * exposed as Vue.prototype._k
  3863. * passing in eventKeyName as last argument separately for backwards compat
  3864. */
  3865. function checkKeyCodes (
  3866. eventKeyCode,
  3867. key,
  3868. builtInAlias,
  3869. eventKeyName
  3870. ) {
  3871. var keyCodes = config.keyCodes[key] || builtInAlias;
  3872. if (keyCodes) {
  3873. if (Array.isArray(keyCodes)) {
  3874. return keyCodes.indexOf(eventKeyCode) === -1
  3875. } else {
  3876. return keyCodes !== eventKeyCode
  3877. }
  3878. } else if (eventKeyName) {
  3879. return hyphenate(eventKeyName) !== key
  3880. }
  3881. }
  3882. /* */
  3883. /**
  3884. * Runtime helper for merging v-bind="object" into a VNode's data.
  3885. */
  3886. function bindObjectProps (
  3887. data,
  3888. tag,
  3889. value,
  3890. asProp,
  3891. isSync
  3892. ) {
  3893. if (value) {
  3894. if (!isObject(value)) {
  3895. process.env.NODE_ENV !== 'production' && warn(
  3896. 'v-bind without argument expects an Object or Array value',
  3897. this
  3898. );
  3899. } else {
  3900. if (Array.isArray(value)) {
  3901. value = toObject(value);
  3902. }
  3903. var hash;
  3904. var loop = function ( key ) {
  3905. if (
  3906. key === 'class' ||
  3907. key === 'style' ||
  3908. isReservedAttribute(key)
  3909. ) {
  3910. hash = data;
  3911. } else {
  3912. var type = data.attrs && data.attrs.type;
  3913. hash = asProp || config.mustUseProp(tag, type, key)
  3914. ? data.domProps || (data.domProps = {})
  3915. : data.attrs || (data.attrs = {});
  3916. }
  3917. if (!(key in hash)) {
  3918. hash[key] = value[key];
  3919. if (isSync) {
  3920. var on = data.on || (data.on = {});
  3921. on[("update:" + key)] = function ($event) {
  3922. value[key] = $event;
  3923. };
  3924. }
  3925. }
  3926. };
  3927. for (var key in value) loop( key );
  3928. }
  3929. }
  3930. return data
  3931. }
  3932. /* */
  3933. /**
  3934. * Runtime helper for rendering static trees.
  3935. */
  3936. function renderStatic (
  3937. index,
  3938. isInFor
  3939. ) {
  3940. var cached = this._staticTrees || (this._staticTrees = []);
  3941. var tree = cached[index];
  3942. // if has already-rendered static tree and not inside v-for,
  3943. // we can reuse the same tree by doing a shallow clone.
  3944. if (tree && !isInFor) {
  3945. return Array.isArray(tree)
  3946. ? cloneVNodes(tree)
  3947. : cloneVNode(tree)
  3948. }
  3949. // otherwise, render a fresh tree.
  3950. tree = cached[index] = this.$options.staticRenderFns[index].call(
  3951. this._renderProxy,
  3952. null,
  3953. this // for render fns generated for functional component templates
  3954. );
  3955. markStatic(tree, ("__static__" + index), false);
  3956. return tree
  3957. }
  3958. /**
  3959. * Runtime helper for v-once.
  3960. * Effectively it means marking the node as static with a unique key.
  3961. */
  3962. function markOnce (
  3963. tree,
  3964. index,
  3965. key
  3966. ) {
  3967. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  3968. return tree
  3969. }
  3970. function markStatic (
  3971. tree,
  3972. key,
  3973. isOnce
  3974. ) {
  3975. if (Array.isArray(tree)) {
  3976. for (var i = 0; i < tree.length; i++) {
  3977. if (tree[i] && typeof tree[i] !== 'string') {
  3978. markStaticNode(tree[i], (key + "_" + i), isOnce);
  3979. }
  3980. }
  3981. } else {
  3982. markStaticNode(tree, key, isOnce);
  3983. }
  3984. }
  3985. function markStaticNode (node, key, isOnce) {
  3986. node.isStatic = true;
  3987. node.key = key;
  3988. node.isOnce = isOnce;
  3989. }
  3990. /* */
  3991. function bindObjectListeners (data, value) {
  3992. if (value) {
  3993. if (!isPlainObject(value)) {
  3994. process.env.NODE_ENV !== 'production' && warn(
  3995. 'v-on without argument expects an Object value',
  3996. this
  3997. );
  3998. } else {
  3999. var on = data.on = data.on ? extend({}, data.on) : {};
  4000. for (var key in value) {
  4001. var existing = on[key];
  4002. var ours = value[key];
  4003. on[key] = existing ? [].concat(existing, ours) : ours;
  4004. }
  4005. }
  4006. }
  4007. return data
  4008. }
  4009. /* */
  4010. function installRenderHelpers (target) {
  4011. target._o = markOnce;
  4012. target._n = toNumber;
  4013. target._s = toString;
  4014. target._l = renderList;
  4015. target._t = renderSlot;
  4016. target._q = looseEqual;
  4017. target._i = looseIndexOf;
  4018. target._m = renderStatic;
  4019. target._f = resolveFilter;
  4020. target._k = checkKeyCodes;
  4021. target._b = bindObjectProps;
  4022. target._v = createTextVNode;
  4023. target._e = createEmptyVNode;
  4024. target._u = resolveScopedSlots;
  4025. target._g = bindObjectListeners;
  4026. }
  4027. /* */
  4028. function FunctionalRenderContext (
  4029. data,
  4030. props,
  4031. children,
  4032. parent,
  4033. Ctor
  4034. ) {
  4035. var options = Ctor.options;
  4036. this.data = data;
  4037. this.props = props;
  4038. this.children = children;
  4039. this.parent = parent;
  4040. this.listeners = data.on || emptyObject;
  4041. this.injections = resolveInject(options.inject, parent);
  4042. this.slots = function () { return resolveSlots(children, parent); };
  4043. // ensure the createElement function in functional components
  4044. // gets a unique context - this is necessary for correct named slot check
  4045. var contextVm = Object.create(parent);
  4046. var isCompiled = isTrue(options._compiled);
  4047. var needNormalization = !isCompiled;
  4048. // support for compiled functional template
  4049. if (isCompiled) {
  4050. // exposing $options for renderStatic()
  4051. this.$options = options;
  4052. // pre-resolve slots for renderSlot()
  4053. this.$slots = this.slots();
  4054. this.$scopedSlots = data.scopedSlots || emptyObject;
  4055. }
  4056. if (options._scopeId) {
  4057. this._c = function (a, b, c, d) {
  4058. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  4059. if (vnode) {
  4060. vnode.fnScopeId = options._scopeId;
  4061. vnode.fnContext = parent;
  4062. }
  4063. return vnode
  4064. };
  4065. } else {
  4066. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  4067. }
  4068. }
  4069. installRenderHelpers(FunctionalRenderContext.prototype);
  4070. function createFunctionalComponent (
  4071. Ctor,
  4072. propsData,
  4073. data,
  4074. contextVm,
  4075. children
  4076. ) {
  4077. var options = Ctor.options;
  4078. var props = {};
  4079. var propOptions = options.props;
  4080. if (isDef(propOptions)) {
  4081. for (var key in propOptions) {
  4082. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4083. }
  4084. } else {
  4085. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  4086. if (isDef(data.props)) { mergeProps(props, data.props); }
  4087. }
  4088. var renderContext = new FunctionalRenderContext(
  4089. data,
  4090. props,
  4091. children,
  4092. contextVm,
  4093. Ctor
  4094. );
  4095. var vnode = options.render.call(null, renderContext._c, renderContext);
  4096. if (vnode instanceof VNode) {
  4097. vnode.fnContext = contextVm;
  4098. vnode.fnOptions = options;
  4099. if (data.slot) {
  4100. (vnode.data || (vnode.data = {})).slot = data.slot;
  4101. }
  4102. }
  4103. return vnode
  4104. }
  4105. function mergeProps (to, from) {
  4106. for (var key in from) {
  4107. to[camelize(key)] = from[key];
  4108. }
  4109. }
  4110. /* */
  4111. // Register the component hook to weex native render engine.
  4112. // The hook will be triggered by native, not javascript.
  4113. // Updates the state of the component to weex native render engine.
  4114. /* */
  4115. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  4116. // listening on native callback
  4117. /* */
  4118. /* */
  4119. // hooks to be invoked on component VNodes during patch
  4120. var componentVNodeHooks = {
  4121. init: function init (
  4122. vnode,
  4123. hydrating,
  4124. parentElm,
  4125. refElm
  4126. ) {
  4127. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  4128. var child = vnode.componentInstance = createComponentInstanceForVnode(
  4129. vnode,
  4130. activeInstance,
  4131. parentElm,
  4132. refElm
  4133. );
  4134. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4135. } else if (vnode.data.keepAlive) {
  4136. // kept-alive components, treat as a patch
  4137. var mountedNode = vnode; // work around flow
  4138. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4139. }
  4140. },
  4141. prepatch: function prepatch (oldVnode, vnode) {
  4142. var options = vnode.componentOptions;
  4143. var child = vnode.componentInstance = oldVnode.componentInstance;
  4144. updateChildComponent(
  4145. child,
  4146. options.propsData, // updated props
  4147. options.listeners, // updated listeners
  4148. vnode, // new parent vnode
  4149. options.children // new children
  4150. );
  4151. },
  4152. insert: function insert (vnode) {
  4153. var context = vnode.context;
  4154. var componentInstance = vnode.componentInstance;
  4155. if (!componentInstance._isMounted) {
  4156. componentInstance._isMounted = true;
  4157. callHook(componentInstance, 'mounted');
  4158. }
  4159. if (vnode.data.keepAlive) {
  4160. if (context._isMounted) {
  4161. // vue-router#1212
  4162. // During updates, a kept-alive component's child components may
  4163. // change, so directly walking the tree here may call activated hooks
  4164. // on incorrect children. Instead we push them into a queue which will
  4165. // be processed after the whole patch process ended.
  4166. queueActivatedComponent(componentInstance);
  4167. } else {
  4168. activateChildComponent(componentInstance, true /* direct */);
  4169. }
  4170. }
  4171. },
  4172. destroy: function destroy (vnode) {
  4173. var componentInstance = vnode.componentInstance;
  4174. if (!componentInstance._isDestroyed) {
  4175. if (!vnode.data.keepAlive) {
  4176. componentInstance.$destroy();
  4177. } else {
  4178. deactivateChildComponent(componentInstance, true /* direct */);
  4179. }
  4180. }
  4181. }
  4182. };
  4183. var hooksToMerge = Object.keys(componentVNodeHooks);
  4184. function createComponent (
  4185. Ctor,
  4186. data,
  4187. context,
  4188. children,
  4189. tag
  4190. ) {
  4191. if (isUndef(Ctor)) {
  4192. return
  4193. }
  4194. var baseCtor = context.$options._base;
  4195. // plain options object: turn it into a constructor
  4196. if (isObject(Ctor)) {
  4197. Ctor = baseCtor.extend(Ctor);
  4198. }
  4199. // if at this stage it's not a constructor or an async component factory,
  4200. // reject.
  4201. if (typeof Ctor !== 'function') {
  4202. if (process.env.NODE_ENV !== 'production') {
  4203. warn(("Invalid Component definition: " + (String(Ctor))), context);
  4204. }
  4205. return
  4206. }
  4207. // async component
  4208. var asyncFactory;
  4209. if (isUndef(Ctor.cid)) {
  4210. asyncFactory = Ctor;
  4211. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  4212. if (Ctor === undefined) {
  4213. // return a placeholder node for async component, which is rendered
  4214. // as a comment node but preserves all the raw information for the node.
  4215. // the information will be used for async server-rendering and hydration.
  4216. return createAsyncPlaceholder(
  4217. asyncFactory,
  4218. data,
  4219. context,
  4220. children,
  4221. tag
  4222. )
  4223. }
  4224. }
  4225. data = data || {};
  4226. // resolve constructor options in case global mixins are applied after
  4227. // component constructor creation
  4228. resolveConstructorOptions(Ctor);
  4229. // transform component v-model data into props & events
  4230. if (isDef(data.model)) {
  4231. transformModel(Ctor.options, data);
  4232. }
  4233. // extract props
  4234. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  4235. // functional component
  4236. if (isTrue(Ctor.options.functional)) {
  4237. return createFunctionalComponent(Ctor, propsData, data, context, children)
  4238. }
  4239. // extract listeners, since these needs to be treated as
  4240. // child component listeners instead of DOM listeners
  4241. var listeners = data.on;
  4242. // replace with listeners with .native modifier
  4243. // so it gets processed during parent component patch.
  4244. data.on = data.nativeOn;
  4245. if (isTrue(Ctor.options.abstract)) {
  4246. // abstract components do not keep anything
  4247. // other than props & listeners & slot
  4248. // work around flow
  4249. var slot = data.slot;
  4250. data = {};
  4251. if (slot) {
  4252. data.slot = slot;
  4253. }
  4254. }
  4255. // merge component management hooks onto the placeholder node
  4256. mergeHooks(data);
  4257. // return a placeholder vnode
  4258. var name = Ctor.options.name || tag;
  4259. var vnode = new VNode(
  4260. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  4261. data, undefined, undefined, undefined, context,
  4262. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  4263. asyncFactory
  4264. );
  4265. // Weex specific: invoke recycle-list optimized @render function for
  4266. // extracting cell-slot template.
  4267. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  4268. /* istanbul ignore if */
  4269. return vnode
  4270. }
  4271. function createComponentInstanceForVnode (
  4272. vnode, // we know it's MountedComponentVNode but flow doesn't
  4273. parent, // activeInstance in lifecycle state
  4274. parentElm,
  4275. refElm
  4276. ) {
  4277. var options = {
  4278. _isComponent: true,
  4279. parent: parent,
  4280. _parentVnode: vnode,
  4281. _parentElm: parentElm || null,
  4282. _refElm: refElm || null
  4283. };
  4284. // check inline-template render functions
  4285. var inlineTemplate = vnode.data.inlineTemplate;
  4286. if (isDef(inlineTemplate)) {
  4287. options.render = inlineTemplate.render;
  4288. options.staticRenderFns = inlineTemplate.staticRenderFns;
  4289. }
  4290. return new vnode.componentOptions.Ctor(options)
  4291. }
  4292. function mergeHooks (data) {
  4293. if (!data.hook) {
  4294. data.hook = {};
  4295. }
  4296. for (var i = 0; i < hooksToMerge.length; i++) {
  4297. var key = hooksToMerge[i];
  4298. var fromParent = data.hook[key];
  4299. var ours = componentVNodeHooks[key];
  4300. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  4301. }
  4302. }
  4303. function mergeHook$1 (one, two) {
  4304. return function (a, b, c, d) {
  4305. one(a, b, c, d);
  4306. two(a, b, c, d);
  4307. }
  4308. }
  4309. // transform component v-model info (value and callback) into
  4310. // prop and event handler respectively.
  4311. function transformModel (options, data) {
  4312. var prop = (options.model && options.model.prop) || 'value';
  4313. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  4314. var on = data.on || (data.on = {});
  4315. if (isDef(on[event])) {
  4316. on[event] = [data.model.callback].concat(on[event]);
  4317. } else {
  4318. on[event] = data.model.callback;
  4319. }
  4320. }
  4321. /* */
  4322. var SIMPLE_NORMALIZE = 1;
  4323. var ALWAYS_NORMALIZE = 2;
  4324. // wrapper function for providing a more flexible interface
  4325. // without getting yelled at by flow
  4326. function createElement (
  4327. context,
  4328. tag,
  4329. data,
  4330. children,
  4331. normalizationType,
  4332. alwaysNormalize
  4333. ) {
  4334. if (Array.isArray(data) || isPrimitive(data)) {
  4335. normalizationType = children;
  4336. children = data;
  4337. data = undefined;
  4338. }
  4339. if (isTrue(alwaysNormalize)) {
  4340. normalizationType = ALWAYS_NORMALIZE;
  4341. }
  4342. return _createElement(context, tag, data, children, normalizationType)
  4343. }
  4344. function _createElement (
  4345. context,
  4346. tag,
  4347. data,
  4348. children,
  4349. normalizationType
  4350. ) {
  4351. if (isDef(data) && isDef((data).__ob__)) {
  4352. process.env.NODE_ENV !== 'production' && warn(
  4353. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  4354. 'Always create fresh vnode data objects in each render!',
  4355. context
  4356. );
  4357. return createEmptyVNode()
  4358. }
  4359. // object syntax in v-bind
  4360. if (isDef(data) && isDef(data.is)) {
  4361. tag = data.is;
  4362. }
  4363. if (!tag) {
  4364. // in case of component :is set to falsy value
  4365. return createEmptyVNode()
  4366. }
  4367. // warn against non-primitive key
  4368. if (process.env.NODE_ENV !== 'production' &&
  4369. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  4370. ) {
  4371. {
  4372. warn(
  4373. 'Avoid using non-primitive value as key, ' +
  4374. 'use string/number value instead.',
  4375. context
  4376. );
  4377. }
  4378. }
  4379. // support single function children as default scoped slot
  4380. if (Array.isArray(children) &&
  4381. typeof children[0] === 'function'
  4382. ) {
  4383. data = data || {};
  4384. data.scopedSlots = { default: children[0] };
  4385. children.length = 0;
  4386. }
  4387. if (normalizationType === ALWAYS_NORMALIZE) {
  4388. children = normalizeChildren(children);
  4389. } else if (normalizationType === SIMPLE_NORMALIZE) {
  4390. children = simpleNormalizeChildren(children);
  4391. }
  4392. var vnode, ns;
  4393. if (typeof tag === 'string') {
  4394. var Ctor;
  4395. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  4396. if (config.isReservedTag(tag)) {
  4397. // platform built-in elements
  4398. vnode = new VNode(
  4399. config.parsePlatformTagName(tag), data, children,
  4400. undefined, undefined, context
  4401. );
  4402. } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  4403. // component
  4404. vnode = createComponent(Ctor, data, context, children, tag);
  4405. } else {
  4406. // unknown or unlisted namespaced elements
  4407. // check at runtime because it may get assigned a namespace when its
  4408. // parent normalizes children
  4409. vnode = new VNode(
  4410. tag, data, children,
  4411. undefined, undefined, context
  4412. );
  4413. }
  4414. } else {
  4415. // direct component options / constructor
  4416. vnode = createComponent(tag, data, context, children);
  4417. }
  4418. if (isDef(vnode)) {
  4419. if (ns) { applyNS(vnode, ns); }
  4420. return vnode
  4421. } else {
  4422. return createEmptyVNode()
  4423. }
  4424. }
  4425. function applyNS (vnode, ns, force) {
  4426. vnode.ns = ns;
  4427. if (vnode.tag === 'foreignObject') {
  4428. // use default namespace inside foreignObject
  4429. ns = undefined;
  4430. force = true;
  4431. }
  4432. if (isDef(vnode.children)) {
  4433. for (var i = 0, l = vnode.children.length; i < l; i++) {
  4434. var child = vnode.children[i];
  4435. if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force))) {
  4436. applyNS(child, ns, force);
  4437. }
  4438. }
  4439. }
  4440. }
  4441. /* */
  4442. function initRender (vm) {
  4443. vm._vnode = null; // the root of the child tree
  4444. vm._staticTrees = null; // v-once cached trees
  4445. var options = vm.$options;
  4446. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4447. var renderContext = parentVnode && parentVnode.context;
  4448. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4449. vm.$scopedSlots = emptyObject;
  4450. // bind the createElement fn to this instance
  4451. // so that we get proper render context inside it.
  4452. // args order: tag, data, children, normalizationType, alwaysNormalize
  4453. // internal version is used by render functions compiled from templates
  4454. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4455. // normalization is always applied for the public version, used in
  4456. // user-written render functions.
  4457. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4458. // $attrs & $listeners are exposed for easier HOC creation.
  4459. // they need to be reactive so that HOCs using them are always updated
  4460. var parentData = parentVnode && parentVnode.data;
  4461. /* istanbul ignore else */
  4462. if (process.env.NODE_ENV !== 'production') {
  4463. defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4464. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4465. }, true);
  4466. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4467. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4468. }, true);
  4469. } else {
  4470. defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
  4471. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  4472. }
  4473. }
  4474. function renderMixin (Vue) {
  4475. // install runtime convenience helpers
  4476. installRenderHelpers(Vue.prototype);
  4477. Vue.prototype.$nextTick = function (fn) {
  4478. return nextTick(fn, this)
  4479. };
  4480. Vue.prototype._render = function () {
  4481. var vm = this;
  4482. var ref = vm.$options;
  4483. var render = ref.render;
  4484. var _parentVnode = ref._parentVnode;
  4485. if (vm._isMounted) {
  4486. // if the parent didn't update, the slot nodes will be the ones from
  4487. // last render. They need to be cloned to ensure "freshness" for this render.
  4488. for (var key in vm.$slots) {
  4489. var slot = vm.$slots[key];
  4490. // _rendered is a flag added by renderSlot, but may not be present
  4491. // if the slot is passed from manually written render functions
  4492. if (slot._rendered || (slot[0] && slot[0].elm)) {
  4493. vm.$slots[key] = cloneVNodes(slot, true /* deep */);
  4494. }
  4495. }
  4496. }
  4497. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  4498. // set parent vnode. this allows render functions to have access
  4499. // to the data on the placeholder node.
  4500. vm.$vnode = _parentVnode;
  4501. // render self
  4502. var vnode;
  4503. try {
  4504. vnode = render.call(vm._renderProxy, vm.$createElement);
  4505. } catch (e) {
  4506. handleError(e, vm, "render");
  4507. // return error render result,
  4508. // or previous vnode to prevent render error causing blank component
  4509. /* istanbul ignore else */
  4510. if (process.env.NODE_ENV !== 'production') {
  4511. if (vm.$options.renderError) {
  4512. try {
  4513. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4514. } catch (e) {
  4515. handleError(e, vm, "renderError");
  4516. vnode = vm._vnode;
  4517. }
  4518. } else {
  4519. vnode = vm._vnode;
  4520. }
  4521. } else {
  4522. vnode = vm._vnode;
  4523. }
  4524. }
  4525. // return empty vnode in case the render function errored out
  4526. if (!(vnode instanceof VNode)) {
  4527. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  4528. warn(
  4529. 'Multiple root nodes returned from render function. Render function ' +
  4530. 'should return a single root node.',
  4531. vm
  4532. );
  4533. }
  4534. vnode = createEmptyVNode();
  4535. }
  4536. // set parent
  4537. vnode.parent = _parentVnode;
  4538. return vnode
  4539. };
  4540. }
  4541. /* */
  4542. var uid = 0;
  4543. function initMixin (Vue) {
  4544. Vue.prototype._init = function (options) {
  4545. var vm = this;
  4546. // a uid
  4547. vm._uid = uid++;
  4548. var startTag, endTag;
  4549. /* istanbul ignore if */
  4550. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4551. startTag = "vue-perf-start:" + (vm._uid);
  4552. endTag = "vue-perf-end:" + (vm._uid);
  4553. mark(startTag);
  4554. }
  4555. // a flag to avoid this being observed
  4556. vm._isVue = true;
  4557. // merge options
  4558. if (options && options._isComponent) {
  4559. // optimize internal component instantiation
  4560. // since dynamic options merging is pretty slow, and none of the
  4561. // internal component options needs special treatment.
  4562. initInternalComponent(vm, options);
  4563. } else {
  4564. vm.$options = mergeOptions(
  4565. resolveConstructorOptions(vm.constructor),
  4566. options || {},
  4567. vm
  4568. );
  4569. }
  4570. /* istanbul ignore else */
  4571. if (process.env.NODE_ENV !== 'production') {
  4572. initProxy(vm);
  4573. } else {
  4574. vm._renderProxy = vm;
  4575. }
  4576. // expose real self
  4577. vm._self = vm;
  4578. initLifecycle(vm);
  4579. initEvents(vm);
  4580. initRender(vm);
  4581. callHook(vm, 'beforeCreate');
  4582. initInjections(vm); // resolve injections before data/props
  4583. initState(vm);
  4584. initProvide(vm); // resolve provide after data/props
  4585. callHook(vm, 'created');
  4586. /* istanbul ignore if */
  4587. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4588. vm._name = formatComponentName(vm, false);
  4589. mark(endTag);
  4590. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4591. }
  4592. if (vm.$options.el) {
  4593. vm.$mount(vm.$options.el);
  4594. }
  4595. };
  4596. }
  4597. function initInternalComponent (vm, options) {
  4598. var opts = vm.$options = Object.create(vm.constructor.options);
  4599. // doing this because it's faster than dynamic enumeration.
  4600. var parentVnode = options._parentVnode;
  4601. opts.parent = options.parent;
  4602. opts._parentVnode = parentVnode;
  4603. opts._parentElm = options._parentElm;
  4604. opts._refElm = options._refElm;
  4605. var vnodeComponentOptions = parentVnode.componentOptions;
  4606. opts.propsData = vnodeComponentOptions.propsData;
  4607. opts._parentListeners = vnodeComponentOptions.listeners;
  4608. opts._renderChildren = vnodeComponentOptions.children;
  4609. opts._componentTag = vnodeComponentOptions.tag;
  4610. if (options.render) {
  4611. opts.render = options.render;
  4612. opts.staticRenderFns = options.staticRenderFns;
  4613. }
  4614. }
  4615. function resolveConstructorOptions (Ctor) {
  4616. var options = Ctor.options;
  4617. if (Ctor.super) {
  4618. var superOptions = resolveConstructorOptions(Ctor.super);
  4619. var cachedSuperOptions = Ctor.superOptions;
  4620. if (superOptions !== cachedSuperOptions) {
  4621. // super option changed,
  4622. // need to resolve new options.
  4623. Ctor.superOptions = superOptions;
  4624. // check if there are any late-modified/attached options (#4976)
  4625. var modifiedOptions = resolveModifiedOptions(Ctor);
  4626. // update base extend options
  4627. if (modifiedOptions) {
  4628. extend(Ctor.extendOptions, modifiedOptions);
  4629. }
  4630. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4631. if (options.name) {
  4632. options.components[options.name] = Ctor;
  4633. }
  4634. }
  4635. }
  4636. return options
  4637. }
  4638. function resolveModifiedOptions (Ctor) {
  4639. var modified;
  4640. var latest = Ctor.options;
  4641. var extended = Ctor.extendOptions;
  4642. var sealed = Ctor.sealedOptions;
  4643. for (var key in latest) {
  4644. if (latest[key] !== sealed[key]) {
  4645. if (!modified) { modified = {}; }
  4646. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  4647. }
  4648. }
  4649. return modified
  4650. }
  4651. function dedupe (latest, extended, sealed) {
  4652. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  4653. // between merges
  4654. if (Array.isArray(latest)) {
  4655. var res = [];
  4656. sealed = Array.isArray(sealed) ? sealed : [sealed];
  4657. extended = Array.isArray(extended) ? extended : [extended];
  4658. for (var i = 0; i < latest.length; i++) {
  4659. // push original options and not sealed options to exclude duplicated options
  4660. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  4661. res.push(latest[i]);
  4662. }
  4663. }
  4664. return res
  4665. } else {
  4666. return latest
  4667. }
  4668. }
  4669. function Vue$3 (options) {
  4670. if (process.env.NODE_ENV !== 'production' &&
  4671. !(this instanceof Vue$3)
  4672. ) {
  4673. warn('Vue is a constructor and should be called with the `new` keyword');
  4674. }
  4675. this._init(options);
  4676. }
  4677. initMixin(Vue$3);
  4678. stateMixin(Vue$3);
  4679. eventsMixin(Vue$3);
  4680. lifecycleMixin(Vue$3);
  4681. renderMixin(Vue$3);
  4682. /* */
  4683. function initUse (Vue) {
  4684. Vue.use = function (plugin) {
  4685. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4686. if (installedPlugins.indexOf(plugin) > -1) {
  4687. return this
  4688. }
  4689. // additional parameters
  4690. var args = toArray(arguments, 1);
  4691. args.unshift(this);
  4692. if (typeof plugin.install === 'function') {
  4693. plugin.install.apply(plugin, args);
  4694. } else if (typeof plugin === 'function') {
  4695. plugin.apply(null, args);
  4696. }
  4697. installedPlugins.push(plugin);
  4698. return this
  4699. };
  4700. }
  4701. /* */
  4702. function initMixin$1 (Vue) {
  4703. Vue.mixin = function (mixin) {
  4704. this.options = mergeOptions(this.options, mixin);
  4705. return this
  4706. };
  4707. }
  4708. /* */
  4709. function initExtend (Vue) {
  4710. /**
  4711. * Each instance constructor, including Vue, has a unique
  4712. * cid. This enables us to create wrapped "child
  4713. * constructors" for prototypal inheritance and cache them.
  4714. */
  4715. Vue.cid = 0;
  4716. var cid = 1;
  4717. /**
  4718. * Class inheritance
  4719. */
  4720. Vue.extend = function (extendOptions) {
  4721. extendOptions = extendOptions || {};
  4722. var Super = this;
  4723. var SuperId = Super.cid;
  4724. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4725. if (cachedCtors[SuperId]) {
  4726. return cachedCtors[SuperId]
  4727. }
  4728. var name = extendOptions.name || Super.options.name;
  4729. if (process.env.NODE_ENV !== 'production' && name) {
  4730. validateComponentName(name);
  4731. }
  4732. var Sub = function VueComponent (options) {
  4733. this._init(options);
  4734. };
  4735. Sub.prototype = Object.create(Super.prototype);
  4736. Sub.prototype.constructor = Sub;
  4737. Sub.cid = cid++;
  4738. Sub.options = mergeOptions(
  4739. Super.options,
  4740. extendOptions
  4741. );
  4742. Sub['super'] = Super;
  4743. // For props and computed properties, we define the proxy getters on
  4744. // the Vue instances at extension time, on the extended prototype. This
  4745. // avoids Object.defineProperty calls for each instance created.
  4746. if (Sub.options.props) {
  4747. initProps$1(Sub);
  4748. }
  4749. if (Sub.options.computed) {
  4750. initComputed$1(Sub);
  4751. }
  4752. // allow further extension/mixin/plugin usage
  4753. Sub.extend = Super.extend;
  4754. Sub.mixin = Super.mixin;
  4755. Sub.use = Super.use;
  4756. // create asset registers, so extended classes
  4757. // can have their private assets too.
  4758. ASSET_TYPES.forEach(function (type) {
  4759. Sub[type] = Super[type];
  4760. });
  4761. // enable recursive self-lookup
  4762. if (name) {
  4763. Sub.options.components[name] = Sub;
  4764. }
  4765. // keep a reference to the super options at extension time.
  4766. // later at instantiation we can check if Super's options have
  4767. // been updated.
  4768. Sub.superOptions = Super.options;
  4769. Sub.extendOptions = extendOptions;
  4770. Sub.sealedOptions = extend({}, Sub.options);
  4771. // cache constructor
  4772. cachedCtors[SuperId] = Sub;
  4773. return Sub
  4774. };
  4775. }
  4776. function initProps$1 (Comp) {
  4777. var props = Comp.options.props;
  4778. for (var key in props) {
  4779. proxy(Comp.prototype, "_props", key);
  4780. }
  4781. }
  4782. function initComputed$1 (Comp) {
  4783. var computed = Comp.options.computed;
  4784. for (var key in computed) {
  4785. defineComputed(Comp.prototype, key, computed[key]);
  4786. }
  4787. }
  4788. /* */
  4789. function initAssetRegisters (Vue) {
  4790. /**
  4791. * Create asset registration methods.
  4792. */
  4793. ASSET_TYPES.forEach(function (type) {
  4794. Vue[type] = function (
  4795. id,
  4796. definition
  4797. ) {
  4798. if (!definition) {
  4799. return this.options[type + 's'][id]
  4800. } else {
  4801. /* istanbul ignore if */
  4802. if (process.env.NODE_ENV !== 'production' && type === 'component') {
  4803. validateComponentName(id);
  4804. }
  4805. if (type === 'component' && isPlainObject(definition)) {
  4806. definition.name = definition.name || id;
  4807. definition = this.options._base.extend(definition);
  4808. }
  4809. if (type === 'directive' && typeof definition === 'function') {
  4810. definition = { bind: definition, update: definition };
  4811. }
  4812. this.options[type + 's'][id] = definition;
  4813. return definition
  4814. }
  4815. };
  4816. });
  4817. }
  4818. /* */
  4819. function getComponentName (opts) {
  4820. return opts && (opts.Ctor.options.name || opts.tag)
  4821. }
  4822. function matches (pattern, name) {
  4823. if (Array.isArray(pattern)) {
  4824. return pattern.indexOf(name) > -1
  4825. } else if (typeof pattern === 'string') {
  4826. return pattern.split(',').indexOf(name) > -1
  4827. } else if (isRegExp(pattern)) {
  4828. return pattern.test(name)
  4829. }
  4830. /* istanbul ignore next */
  4831. return false
  4832. }
  4833. function pruneCache (keepAliveInstance, filter) {
  4834. var cache = keepAliveInstance.cache;
  4835. var keys = keepAliveInstance.keys;
  4836. var _vnode = keepAliveInstance._vnode;
  4837. for (var key in cache) {
  4838. var cachedNode = cache[key];
  4839. if (cachedNode) {
  4840. var name = getComponentName(cachedNode.componentOptions);
  4841. if (name && !filter(name)) {
  4842. pruneCacheEntry(cache, key, keys, _vnode);
  4843. }
  4844. }
  4845. }
  4846. }
  4847. function pruneCacheEntry (
  4848. cache,
  4849. key,
  4850. keys,
  4851. current
  4852. ) {
  4853. var cached$$1 = cache[key];
  4854. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4855. cached$$1.componentInstance.$destroy();
  4856. }
  4857. cache[key] = null;
  4858. remove(keys, key);
  4859. }
  4860. var patternTypes = [String, RegExp, Array];
  4861. var KeepAlive = {
  4862. name: 'keep-alive',
  4863. abstract: true,
  4864. props: {
  4865. include: patternTypes,
  4866. exclude: patternTypes,
  4867. max: [String, Number]
  4868. },
  4869. created: function created () {
  4870. this.cache = Object.create(null);
  4871. this.keys = [];
  4872. },
  4873. destroyed: function destroyed () {
  4874. var this$1 = this;
  4875. for (var key in this$1.cache) {
  4876. pruneCacheEntry(this$1.cache, key, this$1.keys);
  4877. }
  4878. },
  4879. watch: {
  4880. include: function include (val) {
  4881. pruneCache(this, function (name) { return matches(val, name); });
  4882. },
  4883. exclude: function exclude (val) {
  4884. pruneCache(this, function (name) { return !matches(val, name); });
  4885. }
  4886. },
  4887. render: function render () {
  4888. var slot = this.$slots.default;
  4889. var vnode = getFirstComponentChild(slot);
  4890. var componentOptions = vnode && vnode.componentOptions;
  4891. if (componentOptions) {
  4892. // check pattern
  4893. var name = getComponentName(componentOptions);
  4894. var ref = this;
  4895. var include = ref.include;
  4896. var exclude = ref.exclude;
  4897. if (
  4898. // not included
  4899. (include && (!name || !matches(include, name))) ||
  4900. // excluded
  4901. (exclude && name && matches(exclude, name))
  4902. ) {
  4903. return vnode
  4904. }
  4905. var ref$1 = this;
  4906. var cache = ref$1.cache;
  4907. var keys = ref$1.keys;
  4908. var key = vnode.key == null
  4909. // same constructor may get registered as different local components
  4910. // so cid alone is not enough (#3269)
  4911. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4912. : vnode.key;
  4913. if (cache[key]) {
  4914. vnode.componentInstance = cache[key].componentInstance;
  4915. // make current key freshest
  4916. remove(keys, key);
  4917. keys.push(key);
  4918. } else {
  4919. cache[key] = vnode;
  4920. keys.push(key);
  4921. // prune oldest entry
  4922. if (this.max && keys.length > parseInt(this.max)) {
  4923. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4924. }
  4925. }
  4926. vnode.data.keepAlive = true;
  4927. }
  4928. return vnode || (slot && slot[0])
  4929. }
  4930. };
  4931. var builtInComponents = {
  4932. KeepAlive: KeepAlive
  4933. };
  4934. /* */
  4935. function initGlobalAPI (Vue) {
  4936. // config
  4937. var configDef = {};
  4938. configDef.get = function () { return config; };
  4939. if (process.env.NODE_ENV !== 'production') {
  4940. configDef.set = function () {
  4941. warn(
  4942. 'Do not replace the Vue.config object, set individual fields instead.'
  4943. );
  4944. };
  4945. }
  4946. Object.defineProperty(Vue, 'config', configDef);
  4947. // exposed util methods.
  4948. // NOTE: these are not considered part of the public API - avoid relying on
  4949. // them unless you are aware of the risk.
  4950. Vue.util = {
  4951. warn: warn,
  4952. extend: extend,
  4953. mergeOptions: mergeOptions,
  4954. defineReactive: defineReactive
  4955. };
  4956. Vue.set = set;
  4957. Vue.delete = del;
  4958. Vue.nextTick = nextTick;
  4959. Vue.options = Object.create(null);
  4960. ASSET_TYPES.forEach(function (type) {
  4961. Vue.options[type + 's'] = Object.create(null);
  4962. });
  4963. // this is used to identify the "base" constructor to extend all plain-object
  4964. // components with in Weex's multi-instance scenarios.
  4965. Vue.options._base = Vue;
  4966. extend(Vue.options.components, builtInComponents);
  4967. initUse(Vue);
  4968. initMixin$1(Vue);
  4969. initExtend(Vue);
  4970. initAssetRegisters(Vue);
  4971. }
  4972. initGlobalAPI(Vue$3);
  4973. Object.defineProperty(Vue$3.prototype, '$isServer', {
  4974. get: isServerRendering
  4975. });
  4976. Object.defineProperty(Vue$3.prototype, '$ssrContext', {
  4977. get: function get () {
  4978. /* istanbul ignore next */
  4979. return this.$vnode && this.$vnode.ssrContext
  4980. }
  4981. });
  4982. Vue$3.version = '2.5.13';
  4983. /* */
  4984. // these are reserved for web because they are directly compiled away
  4985. // during template compilation
  4986. var isReservedAttr = makeMap('style,class');
  4987. // attributes that should be using props for binding
  4988. var acceptValue = makeMap('input,textarea,option,select,progress');
  4989. var mustUseProp = function (tag, type, attr) {
  4990. return (
  4991. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4992. (attr === 'selected' && tag === 'option') ||
  4993. (attr === 'checked' && tag === 'input') ||
  4994. (attr === 'muted' && tag === 'video')
  4995. )
  4996. };
  4997. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4998. var isBooleanAttr = makeMap(
  4999. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  5000. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  5001. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  5002. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  5003. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  5004. 'truespeed,typemustmatch,visible'
  5005. );
  5006. var xlinkNS = 'http://www.w3.org/1999/xlink';
  5007. var isXlink = function (name) {
  5008. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  5009. };
  5010. var getXlinkProp = function (name) {
  5011. return isXlink(name) ? name.slice(6, name.length) : ''
  5012. };
  5013. var isFalsyAttrValue = function (val) {
  5014. return val == null || val === false
  5015. };
  5016. /* */
  5017. function genClassForVnode (vnode) {
  5018. var data = vnode.data;
  5019. var parentNode = vnode;
  5020. var childNode = vnode;
  5021. while (isDef(childNode.componentInstance)) {
  5022. childNode = childNode.componentInstance._vnode;
  5023. if (childNode && childNode.data) {
  5024. data = mergeClassData(childNode.data, data);
  5025. }
  5026. }
  5027. while (isDef(parentNode = parentNode.parent)) {
  5028. if (parentNode && parentNode.data) {
  5029. data = mergeClassData(data, parentNode.data);
  5030. }
  5031. }
  5032. return renderClass(data.staticClass, data.class)
  5033. }
  5034. function mergeClassData (child, parent) {
  5035. return {
  5036. staticClass: concat(child.staticClass, parent.staticClass),
  5037. class: isDef(child.class)
  5038. ? [child.class, parent.class]
  5039. : parent.class
  5040. }
  5041. }
  5042. function renderClass (
  5043. staticClass,
  5044. dynamicClass
  5045. ) {
  5046. if (isDef(staticClass) || isDef(dynamicClass)) {
  5047. return concat(staticClass, stringifyClass(dynamicClass))
  5048. }
  5049. /* istanbul ignore next */
  5050. return ''
  5051. }
  5052. function concat (a, b) {
  5053. return a ? b ? (a + ' ' + b) : a : (b || '')
  5054. }
  5055. function stringifyClass (value) {
  5056. if (Array.isArray(value)) {
  5057. return stringifyArray(value)
  5058. }
  5059. if (isObject(value)) {
  5060. return stringifyObject(value)
  5061. }
  5062. if (typeof value === 'string') {
  5063. return value
  5064. }
  5065. /* istanbul ignore next */
  5066. return ''
  5067. }
  5068. function stringifyArray (value) {
  5069. var res = '';
  5070. var stringified;
  5071. for (var i = 0, l = value.length; i < l; i++) {
  5072. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5073. if (res) { res += ' '; }
  5074. res += stringified;
  5075. }
  5076. }
  5077. return res
  5078. }
  5079. function stringifyObject (value) {
  5080. var res = '';
  5081. for (var key in value) {
  5082. if (value[key]) {
  5083. if (res) { res += ' '; }
  5084. res += key;
  5085. }
  5086. }
  5087. return res
  5088. }
  5089. /* */
  5090. var namespaceMap = {
  5091. svg: 'http://www.w3.org/2000/svg',
  5092. math: 'http://www.w3.org/1998/Math/MathML'
  5093. };
  5094. var isHTMLTag = makeMap(
  5095. 'html,body,base,head,link,meta,style,title,' +
  5096. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5097. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5098. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5099. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5100. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5101. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5102. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5103. 'output,progress,select,textarea,' +
  5104. 'details,dialog,menu,menuitem,summary,' +
  5105. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5106. );
  5107. // this map is intentionally selective, only covering SVG elements that may
  5108. // contain child elements.
  5109. var isSVG = makeMap(
  5110. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5111. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5112. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5113. true
  5114. );
  5115. var isReservedTag = function (tag) {
  5116. return isHTMLTag(tag) || isSVG(tag)
  5117. };
  5118. function getTagNamespace (tag) {
  5119. if (isSVG(tag)) {
  5120. return 'svg'
  5121. }
  5122. // basic support for MathML
  5123. // note it doesn't support other MathML elements being component roots
  5124. if (tag === 'math') {
  5125. return 'math'
  5126. }
  5127. }
  5128. var unknownElementCache = Object.create(null);
  5129. function isUnknownElement (tag) {
  5130. /* istanbul ignore if */
  5131. if (!inBrowser) {
  5132. return true
  5133. }
  5134. if (isReservedTag(tag)) {
  5135. return false
  5136. }
  5137. tag = tag.toLowerCase();
  5138. /* istanbul ignore if */
  5139. if (unknownElementCache[tag] != null) {
  5140. return unknownElementCache[tag]
  5141. }
  5142. var el = document.createElement(tag);
  5143. if (tag.indexOf('-') > -1) {
  5144. // http://stackoverflow.com/a/28210364/1070244
  5145. return (unknownElementCache[tag] = (
  5146. el.constructor === window.HTMLUnknownElement ||
  5147. el.constructor === window.HTMLElement
  5148. ))
  5149. } else {
  5150. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5151. }
  5152. }
  5153. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5154. /* */
  5155. /**
  5156. * Query an element selector if it's not an element already.
  5157. */
  5158. function query (el) {
  5159. if (typeof el === 'string') {
  5160. var selected = document.querySelector(el);
  5161. if (!selected) {
  5162. process.env.NODE_ENV !== 'production' && warn(
  5163. 'Cannot find element: ' + el
  5164. );
  5165. return document.createElement('div')
  5166. }
  5167. return selected
  5168. } else {
  5169. return el
  5170. }
  5171. }
  5172. /* */
  5173. function createElement$1 (tagName, vnode) {
  5174. var elm = document.createElement(tagName);
  5175. if (tagName !== 'select') {
  5176. return elm
  5177. }
  5178. // false or null will remove the attribute but undefined will not
  5179. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5180. elm.setAttribute('multiple', 'multiple');
  5181. }
  5182. return elm
  5183. }
  5184. function createElementNS (namespace, tagName) {
  5185. return document.createElementNS(namespaceMap[namespace], tagName)
  5186. }
  5187. function createTextNode (text) {
  5188. return document.createTextNode(text)
  5189. }
  5190. function createComment (text) {
  5191. return document.createComment(text)
  5192. }
  5193. function insertBefore (parentNode, newNode, referenceNode) {
  5194. parentNode.insertBefore(newNode, referenceNode);
  5195. }
  5196. function removeChild (node, child) {
  5197. node.removeChild(child);
  5198. }
  5199. function appendChild (node, child) {
  5200. node.appendChild(child);
  5201. }
  5202. function parentNode (node) {
  5203. return node.parentNode
  5204. }
  5205. function nextSibling (node) {
  5206. return node.nextSibling
  5207. }
  5208. function tagName (node) {
  5209. return node.tagName
  5210. }
  5211. function setTextContent (node, text) {
  5212. node.textContent = text;
  5213. }
  5214. function setAttribute (node, key, val) {
  5215. node.setAttribute(key, val);
  5216. }
  5217. var nodeOps = Object.freeze({
  5218. createElement: createElement$1,
  5219. createElementNS: createElementNS,
  5220. createTextNode: createTextNode,
  5221. createComment: createComment,
  5222. insertBefore: insertBefore,
  5223. removeChild: removeChild,
  5224. appendChild: appendChild,
  5225. parentNode: parentNode,
  5226. nextSibling: nextSibling,
  5227. tagName: tagName,
  5228. setTextContent: setTextContent,
  5229. setAttribute: setAttribute
  5230. });
  5231. /* */
  5232. var ref = {
  5233. create: function create (_, vnode) {
  5234. registerRef(vnode);
  5235. },
  5236. update: function update (oldVnode, vnode) {
  5237. if (oldVnode.data.ref !== vnode.data.ref) {
  5238. registerRef(oldVnode, true);
  5239. registerRef(vnode);
  5240. }
  5241. },
  5242. destroy: function destroy (vnode) {
  5243. registerRef(vnode, true);
  5244. }
  5245. };
  5246. function registerRef (vnode, isRemoval) {
  5247. var key = vnode.data.ref;
  5248. if (!key) { return }
  5249. var vm = vnode.context;
  5250. var ref = vnode.componentInstance || vnode.elm;
  5251. var refs = vm.$refs;
  5252. if (isRemoval) {
  5253. if (Array.isArray(refs[key])) {
  5254. remove(refs[key], ref);
  5255. } else if (refs[key] === ref) {
  5256. refs[key] = undefined;
  5257. }
  5258. } else {
  5259. if (vnode.data.refInFor) {
  5260. if (!Array.isArray(refs[key])) {
  5261. refs[key] = [ref];
  5262. } else if (refs[key].indexOf(ref) < 0) {
  5263. // $flow-disable-line
  5264. refs[key].push(ref);
  5265. }
  5266. } else {
  5267. refs[key] = ref;
  5268. }
  5269. }
  5270. }
  5271. /**
  5272. * Virtual DOM patching algorithm based on Snabbdom by
  5273. * Simon Friis Vindum (@paldepind)
  5274. * Licensed under the MIT License
  5275. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5276. *
  5277. * modified by Evan You (@yyx990803)
  5278. *
  5279. * Not type-checking this because this file is perf-critical and the cost
  5280. * of making flow understand it is not worth it.
  5281. */
  5282. var emptyNode = new VNode('', {}, []);
  5283. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5284. function sameVnode (a, b) {
  5285. return (
  5286. a.key === b.key && (
  5287. (
  5288. a.tag === b.tag &&
  5289. a.isComment === b.isComment &&
  5290. isDef(a.data) === isDef(b.data) &&
  5291. sameInputType(a, b)
  5292. ) || (
  5293. isTrue(a.isAsyncPlaceholder) &&
  5294. a.asyncFactory === b.asyncFactory &&
  5295. isUndef(b.asyncFactory.error)
  5296. )
  5297. )
  5298. )
  5299. }
  5300. function sameInputType (a, b) {
  5301. if (a.tag !== 'input') { return true }
  5302. var i;
  5303. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5304. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5305. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5306. }
  5307. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5308. var i, key;
  5309. var map = {};
  5310. for (i = beginIdx; i <= endIdx; ++i) {
  5311. key = children[i].key;
  5312. if (isDef(key)) { map[key] = i; }
  5313. }
  5314. return map
  5315. }
  5316. function createPatchFunction (backend) {
  5317. var i, j;
  5318. var cbs = {};
  5319. var modules = backend.modules;
  5320. var nodeOps = backend.nodeOps;
  5321. for (i = 0; i < hooks.length; ++i) {
  5322. cbs[hooks[i]] = [];
  5323. for (j = 0; j < modules.length; ++j) {
  5324. if (isDef(modules[j][hooks[i]])) {
  5325. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5326. }
  5327. }
  5328. }
  5329. function emptyNodeAt (elm) {
  5330. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5331. }
  5332. function createRmCb (childElm, listeners) {
  5333. function remove () {
  5334. if (--remove.listeners === 0) {
  5335. removeNode(childElm);
  5336. }
  5337. }
  5338. remove.listeners = listeners;
  5339. return remove
  5340. }
  5341. function removeNode (el) {
  5342. var parent = nodeOps.parentNode(el);
  5343. // element may have already been removed due to v-html / v-text
  5344. if (isDef(parent)) {
  5345. nodeOps.removeChild(parent, el);
  5346. }
  5347. }
  5348. function isUnknownElement$$1 (vnode, inVPre) {
  5349. return (
  5350. !inVPre &&
  5351. !vnode.ns &&
  5352. !(
  5353. config.ignoredElements.length &&
  5354. config.ignoredElements.some(function (ignore) {
  5355. return isRegExp(ignore)
  5356. ? ignore.test(vnode.tag)
  5357. : ignore === vnode.tag
  5358. })
  5359. ) &&
  5360. config.isUnknownElement(vnode.tag)
  5361. )
  5362. }
  5363. var creatingElmInVPre = 0;
  5364. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  5365. vnode.isRootInsert = !nested; // for transition enter check
  5366. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5367. return
  5368. }
  5369. var data = vnode.data;
  5370. var children = vnode.children;
  5371. var tag = vnode.tag;
  5372. if (isDef(tag)) {
  5373. if (process.env.NODE_ENV !== 'production') {
  5374. if (data && data.pre) {
  5375. creatingElmInVPre++;
  5376. }
  5377. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5378. warn(
  5379. 'Unknown custom element: <' + tag + '> - did you ' +
  5380. 'register the component correctly? For recursive components, ' +
  5381. 'make sure to provide the "name" option.',
  5382. vnode.context
  5383. );
  5384. }
  5385. }
  5386. vnode.elm = vnode.ns
  5387. ? nodeOps.createElementNS(vnode.ns, tag)
  5388. : nodeOps.createElement(tag, vnode);
  5389. setScope(vnode);
  5390. /* istanbul ignore if */
  5391. {
  5392. createChildren(vnode, children, insertedVnodeQueue);
  5393. if (isDef(data)) {
  5394. invokeCreateHooks(vnode, insertedVnodeQueue);
  5395. }
  5396. insert(parentElm, vnode.elm, refElm);
  5397. }
  5398. if (process.env.NODE_ENV !== 'production' && data && data.pre) {
  5399. creatingElmInVPre--;
  5400. }
  5401. } else if (isTrue(vnode.isComment)) {
  5402. vnode.elm = nodeOps.createComment(vnode.text);
  5403. insert(parentElm, vnode.elm, refElm);
  5404. } else {
  5405. vnode.elm = nodeOps.createTextNode(vnode.text);
  5406. insert(parentElm, vnode.elm, refElm);
  5407. }
  5408. }
  5409. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5410. var i = vnode.data;
  5411. if (isDef(i)) {
  5412. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5413. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5414. i(vnode, false /* hydrating */, parentElm, refElm);
  5415. }
  5416. // after calling the init hook, if the vnode is a child component
  5417. // it should've created a child instance and mounted it. the child
  5418. // component also has set the placeholder vnode's elm.
  5419. // in that case we can just return the element and be done.
  5420. if (isDef(vnode.componentInstance)) {
  5421. initComponent(vnode, insertedVnodeQueue);
  5422. if (isTrue(isReactivated)) {
  5423. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5424. }
  5425. return true
  5426. }
  5427. }
  5428. }
  5429. function initComponent (vnode, insertedVnodeQueue) {
  5430. if (isDef(vnode.data.pendingInsert)) {
  5431. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5432. vnode.data.pendingInsert = null;
  5433. }
  5434. vnode.elm = vnode.componentInstance.$el;
  5435. if (isPatchable(vnode)) {
  5436. invokeCreateHooks(vnode, insertedVnodeQueue);
  5437. setScope(vnode);
  5438. } else {
  5439. // empty component root.
  5440. // skip all element-related modules except for ref (#3455)
  5441. registerRef(vnode);
  5442. // make sure to invoke the insert hook
  5443. insertedVnodeQueue.push(vnode);
  5444. }
  5445. }
  5446. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5447. var i;
  5448. // hack for #4339: a reactivated component with inner transition
  5449. // does not trigger because the inner node's created hooks are not called
  5450. // again. It's not ideal to involve module-specific logic in here but
  5451. // there doesn't seem to be a better way to do it.
  5452. var innerNode = vnode;
  5453. while (innerNode.componentInstance) {
  5454. innerNode = innerNode.componentInstance._vnode;
  5455. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5456. for (i = 0; i < cbs.activate.length; ++i) {
  5457. cbs.activate[i](emptyNode, innerNode);
  5458. }
  5459. insertedVnodeQueue.push(innerNode);
  5460. break
  5461. }
  5462. }
  5463. // unlike a newly created component,
  5464. // a reactivated keep-alive component doesn't insert itself
  5465. insert(parentElm, vnode.elm, refElm);
  5466. }
  5467. function insert (parent, elm, ref$$1) {
  5468. if (isDef(parent)) {
  5469. if (isDef(ref$$1)) {
  5470. if (ref$$1.parentNode === parent) {
  5471. nodeOps.insertBefore(parent, elm, ref$$1);
  5472. }
  5473. } else {
  5474. nodeOps.appendChild(parent, elm);
  5475. }
  5476. }
  5477. }
  5478. function createChildren (vnode, children, insertedVnodeQueue) {
  5479. if (Array.isArray(children)) {
  5480. if (process.env.NODE_ENV !== 'production') {
  5481. checkDuplicateKeys(children);
  5482. }
  5483. for (var i = 0; i < children.length; ++i) {
  5484. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  5485. }
  5486. } else if (isPrimitive(vnode.text)) {
  5487. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5488. }
  5489. }
  5490. function isPatchable (vnode) {
  5491. while (vnode.componentInstance) {
  5492. vnode = vnode.componentInstance._vnode;
  5493. }
  5494. return isDef(vnode.tag)
  5495. }
  5496. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5497. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5498. cbs.create[i$1](emptyNode, vnode);
  5499. }
  5500. i = vnode.data.hook; // Reuse variable
  5501. if (isDef(i)) {
  5502. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5503. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5504. }
  5505. }
  5506. // set scope id attribute for scoped CSS.
  5507. // this is implemented as a special case to avoid the overhead
  5508. // of going through the normal attribute patching process.
  5509. function setScope (vnode) {
  5510. var i;
  5511. if (isDef(i = vnode.fnScopeId)) {
  5512. nodeOps.setAttribute(vnode.elm, i, '');
  5513. } else {
  5514. var ancestor = vnode;
  5515. while (ancestor) {
  5516. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5517. nodeOps.setAttribute(vnode.elm, i, '');
  5518. }
  5519. ancestor = ancestor.parent;
  5520. }
  5521. }
  5522. // for slot content they should also get the scopeId from the host instance.
  5523. if (isDef(i = activeInstance) &&
  5524. i !== vnode.context &&
  5525. i !== vnode.fnContext &&
  5526. isDef(i = i.$options._scopeId)
  5527. ) {
  5528. nodeOps.setAttribute(vnode.elm, i, '');
  5529. }
  5530. }
  5531. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5532. for (; startIdx <= endIdx; ++startIdx) {
  5533. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  5534. }
  5535. }
  5536. function invokeDestroyHook (vnode) {
  5537. var i, j;
  5538. var data = vnode.data;
  5539. if (isDef(data)) {
  5540. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5541. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5542. }
  5543. if (isDef(i = vnode.children)) {
  5544. for (j = 0; j < vnode.children.length; ++j) {
  5545. invokeDestroyHook(vnode.children[j]);
  5546. }
  5547. }
  5548. }
  5549. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5550. for (; startIdx <= endIdx; ++startIdx) {
  5551. var ch = vnodes[startIdx];
  5552. if (isDef(ch)) {
  5553. if (isDef(ch.tag)) {
  5554. removeAndInvokeRemoveHook(ch);
  5555. invokeDestroyHook(ch);
  5556. } else { // Text node
  5557. removeNode(ch.elm);
  5558. }
  5559. }
  5560. }
  5561. }
  5562. function removeAndInvokeRemoveHook (vnode, rm) {
  5563. if (isDef(rm) || isDef(vnode.data)) {
  5564. var i;
  5565. var listeners = cbs.remove.length + 1;
  5566. if (isDef(rm)) {
  5567. // we have a recursively passed down rm callback
  5568. // increase the listeners count
  5569. rm.listeners += listeners;
  5570. } else {
  5571. // directly removing
  5572. rm = createRmCb(vnode.elm, listeners);
  5573. }
  5574. // recursively invoke hooks on child component root node
  5575. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5576. removeAndInvokeRemoveHook(i, rm);
  5577. }
  5578. for (i = 0; i < cbs.remove.length; ++i) {
  5579. cbs.remove[i](vnode, rm);
  5580. }
  5581. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5582. i(vnode, rm);
  5583. } else {
  5584. rm();
  5585. }
  5586. } else {
  5587. removeNode(vnode.elm);
  5588. }
  5589. }
  5590. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5591. var oldStartIdx = 0;
  5592. var newStartIdx = 0;
  5593. var oldEndIdx = oldCh.length - 1;
  5594. var oldStartVnode = oldCh[0];
  5595. var oldEndVnode = oldCh[oldEndIdx];
  5596. var newEndIdx = newCh.length - 1;
  5597. var newStartVnode = newCh[0];
  5598. var newEndVnode = newCh[newEndIdx];
  5599. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5600. // removeOnly is a special flag used only by <transition-group>
  5601. // to ensure removed elements stay in correct relative positions
  5602. // during leaving transitions
  5603. var canMove = !removeOnly;
  5604. if (process.env.NODE_ENV !== 'production') {
  5605. checkDuplicateKeys(newCh);
  5606. }
  5607. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5608. if (isUndef(oldStartVnode)) {
  5609. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5610. } else if (isUndef(oldEndVnode)) {
  5611. oldEndVnode = oldCh[--oldEndIdx];
  5612. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5613. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  5614. oldStartVnode = oldCh[++oldStartIdx];
  5615. newStartVnode = newCh[++newStartIdx];
  5616. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5617. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  5618. oldEndVnode = oldCh[--oldEndIdx];
  5619. newEndVnode = newCh[--newEndIdx];
  5620. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5621. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  5622. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5623. oldStartVnode = oldCh[++oldStartIdx];
  5624. newEndVnode = newCh[--newEndIdx];
  5625. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5626. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  5627. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5628. oldEndVnode = oldCh[--oldEndIdx];
  5629. newStartVnode = newCh[++newStartIdx];
  5630. } else {
  5631. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5632. idxInOld = isDef(newStartVnode.key)
  5633. ? oldKeyToIdx[newStartVnode.key]
  5634. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5635. if (isUndef(idxInOld)) { // New element
  5636. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  5637. } else {
  5638. vnodeToMove = oldCh[idxInOld];
  5639. if (sameVnode(vnodeToMove, newStartVnode)) {
  5640. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue);
  5641. oldCh[idxInOld] = undefined;
  5642. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5643. } else {
  5644. // same key but different element. treat as new element
  5645. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  5646. }
  5647. }
  5648. newStartVnode = newCh[++newStartIdx];
  5649. }
  5650. }
  5651. if (oldStartIdx > oldEndIdx) {
  5652. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5653. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5654. } else if (newStartIdx > newEndIdx) {
  5655. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5656. }
  5657. }
  5658. function checkDuplicateKeys (children) {
  5659. var seenKeys = {};
  5660. for (var i = 0; i < children.length; i++) {
  5661. var vnode = children[i];
  5662. var key = vnode.key;
  5663. if (isDef(key)) {
  5664. if (seenKeys[key]) {
  5665. warn(
  5666. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5667. vnode.context
  5668. );
  5669. } else {
  5670. seenKeys[key] = true;
  5671. }
  5672. }
  5673. }
  5674. }
  5675. function findIdxInOld (node, oldCh, start, end) {
  5676. for (var i = start; i < end; i++) {
  5677. var c = oldCh[i];
  5678. if (isDef(c) && sameVnode(node, c)) { return i }
  5679. }
  5680. }
  5681. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  5682. if (oldVnode === vnode) {
  5683. return
  5684. }
  5685. var elm = vnode.elm = oldVnode.elm;
  5686. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5687. if (isDef(vnode.asyncFactory.resolved)) {
  5688. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5689. } else {
  5690. vnode.isAsyncPlaceholder = true;
  5691. }
  5692. return
  5693. }
  5694. // reuse element for static trees.
  5695. // note we only do this if the vnode is cloned -
  5696. // if the new node is not cloned it means the render functions have been
  5697. // reset by the hot-reload-api and we need to do a proper re-render.
  5698. if (isTrue(vnode.isStatic) &&
  5699. isTrue(oldVnode.isStatic) &&
  5700. vnode.key === oldVnode.key &&
  5701. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5702. ) {
  5703. vnode.componentInstance = oldVnode.componentInstance;
  5704. return
  5705. }
  5706. var i;
  5707. var data = vnode.data;
  5708. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5709. i(oldVnode, vnode);
  5710. }
  5711. var oldCh = oldVnode.children;
  5712. var ch = vnode.children;
  5713. if (isDef(data) && isPatchable(vnode)) {
  5714. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5715. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5716. }
  5717. if (isUndef(vnode.text)) {
  5718. if (isDef(oldCh) && isDef(ch)) {
  5719. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5720. } else if (isDef(ch)) {
  5721. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5722. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5723. } else if (isDef(oldCh)) {
  5724. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5725. } else if (isDef(oldVnode.text)) {
  5726. nodeOps.setTextContent(elm, '');
  5727. }
  5728. } else if (oldVnode.text !== vnode.text) {
  5729. nodeOps.setTextContent(elm, vnode.text);
  5730. }
  5731. if (isDef(data)) {
  5732. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5733. }
  5734. }
  5735. function invokeInsertHook (vnode, queue, initial) {
  5736. // delay insert hooks for component root nodes, invoke them after the
  5737. // element is really inserted
  5738. if (isTrue(initial) && isDef(vnode.parent)) {
  5739. vnode.parent.data.pendingInsert = queue;
  5740. } else {
  5741. for (var i = 0; i < queue.length; ++i) {
  5742. queue[i].data.hook.insert(queue[i]);
  5743. }
  5744. }
  5745. }
  5746. var hydrationBailed = false;
  5747. // list of modules that can skip create hook during hydration because they
  5748. // are already rendered on the client or has no need for initialization
  5749. // Note: style is excluded because it relies on initial clone for future
  5750. // deep updates (#7063).
  5751. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5752. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5753. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5754. var i;
  5755. var tag = vnode.tag;
  5756. var data = vnode.data;
  5757. var children = vnode.children;
  5758. inVPre = inVPre || (data && data.pre);
  5759. vnode.elm = elm;
  5760. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5761. vnode.isAsyncPlaceholder = true;
  5762. return true
  5763. }
  5764. // assert node match
  5765. if (process.env.NODE_ENV !== 'production') {
  5766. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5767. return false
  5768. }
  5769. }
  5770. if (isDef(data)) {
  5771. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5772. if (isDef(i = vnode.componentInstance)) {
  5773. // child component. it should have hydrated its own tree.
  5774. initComponent(vnode, insertedVnodeQueue);
  5775. return true
  5776. }
  5777. }
  5778. if (isDef(tag)) {
  5779. if (isDef(children)) {
  5780. // empty element, allow client to pick up and populate children
  5781. if (!elm.hasChildNodes()) {
  5782. createChildren(vnode, children, insertedVnodeQueue);
  5783. } else {
  5784. // v-html and domProps: innerHTML
  5785. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5786. if (i !== elm.innerHTML) {
  5787. /* istanbul ignore if */
  5788. if (process.env.NODE_ENV !== 'production' &&
  5789. typeof console !== 'undefined' &&
  5790. !hydrationBailed
  5791. ) {
  5792. hydrationBailed = true;
  5793. console.warn('Parent: ', elm);
  5794. console.warn('server innerHTML: ', i);
  5795. console.warn('client innerHTML: ', elm.innerHTML);
  5796. }
  5797. return false
  5798. }
  5799. } else {
  5800. // iterate and compare children lists
  5801. var childrenMatch = true;
  5802. var childNode = elm.firstChild;
  5803. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5804. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5805. childrenMatch = false;
  5806. break
  5807. }
  5808. childNode = childNode.nextSibling;
  5809. }
  5810. // if childNode is not null, it means the actual childNodes list is
  5811. // longer than the virtual children list.
  5812. if (!childrenMatch || childNode) {
  5813. /* istanbul ignore if */
  5814. if (process.env.NODE_ENV !== 'production' &&
  5815. typeof console !== 'undefined' &&
  5816. !hydrationBailed
  5817. ) {
  5818. hydrationBailed = true;
  5819. console.warn('Parent: ', elm);
  5820. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5821. }
  5822. return false
  5823. }
  5824. }
  5825. }
  5826. }
  5827. if (isDef(data)) {
  5828. var fullInvoke = false;
  5829. for (var key in data) {
  5830. if (!isRenderedModule(key)) {
  5831. fullInvoke = true;
  5832. invokeCreateHooks(vnode, insertedVnodeQueue);
  5833. break
  5834. }
  5835. }
  5836. if (!fullInvoke && data['class']) {
  5837. // ensure collecting deps for deep class bindings for future updates
  5838. traverse(data['class']);
  5839. }
  5840. }
  5841. } else if (elm.data !== vnode.text) {
  5842. elm.data = vnode.text;
  5843. }
  5844. return true
  5845. }
  5846. function assertNodeMatch (node, vnode, inVPre) {
  5847. if (isDef(vnode.tag)) {
  5848. return vnode.tag.indexOf('vue-component') === 0 || (
  5849. !isUnknownElement$$1(vnode, inVPre) &&
  5850. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5851. )
  5852. } else {
  5853. return node.nodeType === (vnode.isComment ? 8 : 3)
  5854. }
  5855. }
  5856. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  5857. if (isUndef(vnode)) {
  5858. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5859. return
  5860. }
  5861. var isInitialPatch = false;
  5862. var insertedVnodeQueue = [];
  5863. if (isUndef(oldVnode)) {
  5864. // empty mount (likely as component), create new root element
  5865. isInitialPatch = true;
  5866. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  5867. } else {
  5868. var isRealElement = isDef(oldVnode.nodeType);
  5869. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5870. // patch existing root node
  5871. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  5872. } else {
  5873. if (isRealElement) {
  5874. // mounting to a real element
  5875. // check if this is server-rendered content and if we can perform
  5876. // a successful hydration.
  5877. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5878. oldVnode.removeAttribute(SSR_ATTR);
  5879. hydrating = true;
  5880. }
  5881. if (isTrue(hydrating)) {
  5882. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5883. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5884. return oldVnode
  5885. } else if (process.env.NODE_ENV !== 'production') {
  5886. warn(
  5887. 'The client-side rendered virtual DOM tree is not matching ' +
  5888. 'server-rendered content. This is likely caused by incorrect ' +
  5889. 'HTML markup, for example nesting block-level elements inside ' +
  5890. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5891. 'full client-side render.'
  5892. );
  5893. }
  5894. }
  5895. // either not server-rendered, or hydration failed.
  5896. // create an empty node and replace it
  5897. oldVnode = emptyNodeAt(oldVnode);
  5898. }
  5899. // replacing existing element
  5900. var oldElm = oldVnode.elm;
  5901. var parentElm$1 = nodeOps.parentNode(oldElm);
  5902. // create new node
  5903. createElm(
  5904. vnode,
  5905. insertedVnodeQueue,
  5906. // extremely rare edge case: do not insert if old element is in a
  5907. // leaving transition. Only happens when combining transition +
  5908. // keep-alive + HOCs. (#4590)
  5909. oldElm._leaveCb ? null : parentElm$1,
  5910. nodeOps.nextSibling(oldElm)
  5911. );
  5912. // update parent placeholder node element, recursively
  5913. if (isDef(vnode.parent)) {
  5914. var ancestor = vnode.parent;
  5915. var patchable = isPatchable(vnode);
  5916. while (ancestor) {
  5917. for (var i = 0; i < cbs.destroy.length; ++i) {
  5918. cbs.destroy[i](ancestor);
  5919. }
  5920. ancestor.elm = vnode.elm;
  5921. if (patchable) {
  5922. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5923. cbs.create[i$1](emptyNode, ancestor);
  5924. }
  5925. // #6513
  5926. // invoke insert hooks that may have been merged by create hooks.
  5927. // e.g. for directives that uses the "inserted" hook.
  5928. var insert = ancestor.data.hook.insert;
  5929. if (insert.merged) {
  5930. // start at index 1 to avoid re-invoking component mounted hook
  5931. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5932. insert.fns[i$2]();
  5933. }
  5934. }
  5935. } else {
  5936. registerRef(ancestor);
  5937. }
  5938. ancestor = ancestor.parent;
  5939. }
  5940. }
  5941. // destroy old node
  5942. if (isDef(parentElm$1)) {
  5943. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  5944. } else if (isDef(oldVnode.tag)) {
  5945. invokeDestroyHook(oldVnode);
  5946. }
  5947. }
  5948. }
  5949. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5950. return vnode.elm
  5951. }
  5952. }
  5953. /* */
  5954. var directives = {
  5955. create: updateDirectives,
  5956. update: updateDirectives,
  5957. destroy: function unbindDirectives (vnode) {
  5958. updateDirectives(vnode, emptyNode);
  5959. }
  5960. };
  5961. function updateDirectives (oldVnode, vnode) {
  5962. if (oldVnode.data.directives || vnode.data.directives) {
  5963. _update(oldVnode, vnode);
  5964. }
  5965. }
  5966. function _update (oldVnode, vnode) {
  5967. var isCreate = oldVnode === emptyNode;
  5968. var isDestroy = vnode === emptyNode;
  5969. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5970. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5971. var dirsWithInsert = [];
  5972. var dirsWithPostpatch = [];
  5973. var key, oldDir, dir;
  5974. for (key in newDirs) {
  5975. oldDir = oldDirs[key];
  5976. dir = newDirs[key];
  5977. if (!oldDir) {
  5978. // new directive, bind
  5979. callHook$1(dir, 'bind', vnode, oldVnode);
  5980. if (dir.def && dir.def.inserted) {
  5981. dirsWithInsert.push(dir);
  5982. }
  5983. } else {
  5984. // existing directive, update
  5985. dir.oldValue = oldDir.value;
  5986. callHook$1(dir, 'update', vnode, oldVnode);
  5987. if (dir.def && dir.def.componentUpdated) {
  5988. dirsWithPostpatch.push(dir);
  5989. }
  5990. }
  5991. }
  5992. if (dirsWithInsert.length) {
  5993. var callInsert = function () {
  5994. for (var i = 0; i < dirsWithInsert.length; i++) {
  5995. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5996. }
  5997. };
  5998. if (isCreate) {
  5999. mergeVNodeHook(vnode, 'insert', callInsert);
  6000. } else {
  6001. callInsert();
  6002. }
  6003. }
  6004. if (dirsWithPostpatch.length) {
  6005. mergeVNodeHook(vnode, 'postpatch', function () {
  6006. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  6007. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  6008. }
  6009. });
  6010. }
  6011. if (!isCreate) {
  6012. for (key in oldDirs) {
  6013. if (!newDirs[key]) {
  6014. // no longer present, unbind
  6015. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6016. }
  6017. }
  6018. }
  6019. }
  6020. var emptyModifiers = Object.create(null);
  6021. function normalizeDirectives$1 (
  6022. dirs,
  6023. vm
  6024. ) {
  6025. var res = Object.create(null);
  6026. if (!dirs) {
  6027. // $flow-disable-line
  6028. return res
  6029. }
  6030. var i, dir;
  6031. for (i = 0; i < dirs.length; i++) {
  6032. dir = dirs[i];
  6033. if (!dir.modifiers) {
  6034. // $flow-disable-line
  6035. dir.modifiers = emptyModifiers;
  6036. }
  6037. res[getRawDirName(dir)] = dir;
  6038. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6039. }
  6040. // $flow-disable-line
  6041. return res
  6042. }
  6043. function getRawDirName (dir) {
  6044. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6045. }
  6046. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6047. var fn = dir.def && dir.def[hook];
  6048. if (fn) {
  6049. try {
  6050. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6051. } catch (e) {
  6052. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6053. }
  6054. }
  6055. }
  6056. var baseModules = [
  6057. ref,
  6058. directives
  6059. ];
  6060. /* */
  6061. function updateAttrs (oldVnode, vnode) {
  6062. var opts = vnode.componentOptions;
  6063. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6064. return
  6065. }
  6066. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6067. return
  6068. }
  6069. var key, cur, old;
  6070. var elm = vnode.elm;
  6071. var oldAttrs = oldVnode.data.attrs || {};
  6072. var attrs = vnode.data.attrs || {};
  6073. // clone observed objects, as the user probably wants to mutate it
  6074. if (isDef(attrs.__ob__)) {
  6075. attrs = vnode.data.attrs = extend({}, attrs);
  6076. }
  6077. for (key in attrs) {
  6078. cur = attrs[key];
  6079. old = oldAttrs[key];
  6080. if (old !== cur) {
  6081. setAttr(elm, key, cur);
  6082. }
  6083. }
  6084. // #4391: in IE9, setting type can reset value for input[type=radio]
  6085. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6086. /* istanbul ignore if */
  6087. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6088. setAttr(elm, 'value', attrs.value);
  6089. }
  6090. for (key in oldAttrs) {
  6091. if (isUndef(attrs[key])) {
  6092. if (isXlink(key)) {
  6093. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6094. } else if (!isEnumeratedAttr(key)) {
  6095. elm.removeAttribute(key);
  6096. }
  6097. }
  6098. }
  6099. }
  6100. function setAttr (el, key, value) {
  6101. if (isBooleanAttr(key)) {
  6102. // set attribute for blank value
  6103. // e.g. <option disabled>Select one</option>
  6104. if (isFalsyAttrValue(value)) {
  6105. el.removeAttribute(key);
  6106. } else {
  6107. // technically allowfullscreen is a boolean attribute for <iframe>,
  6108. // but Flash expects a value of "true" when used on <embed> tag
  6109. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6110. ? 'true'
  6111. : key;
  6112. el.setAttribute(key, value);
  6113. }
  6114. } else if (isEnumeratedAttr(key)) {
  6115. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  6116. } else if (isXlink(key)) {
  6117. if (isFalsyAttrValue(value)) {
  6118. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6119. } else {
  6120. el.setAttributeNS(xlinkNS, key, value);
  6121. }
  6122. } else {
  6123. if (isFalsyAttrValue(value)) {
  6124. el.removeAttribute(key);
  6125. } else {
  6126. // #7138: IE10 & 11 fires input event when setting placeholder on
  6127. // <textarea>... block the first input event and remove the blocker
  6128. // immediately.
  6129. /* istanbul ignore if */
  6130. if (
  6131. isIE && !isIE9 &&
  6132. el.tagName === 'TEXTAREA' &&
  6133. key === 'placeholder' && !el.__ieph
  6134. ) {
  6135. var blocker = function (e) {
  6136. e.stopImmediatePropagation();
  6137. el.removeEventListener('input', blocker);
  6138. };
  6139. el.addEventListener('input', blocker);
  6140. // $flow-disable-line
  6141. el.__ieph = true; /* IE placeholder patched */
  6142. }
  6143. el.setAttribute(key, value);
  6144. }
  6145. }
  6146. }
  6147. var attrs = {
  6148. create: updateAttrs,
  6149. update: updateAttrs
  6150. };
  6151. /* */
  6152. function updateClass (oldVnode, vnode) {
  6153. var el = vnode.elm;
  6154. var data = vnode.data;
  6155. var oldData = oldVnode.data;
  6156. if (
  6157. isUndef(data.staticClass) &&
  6158. isUndef(data.class) && (
  6159. isUndef(oldData) || (
  6160. isUndef(oldData.staticClass) &&
  6161. isUndef(oldData.class)
  6162. )
  6163. )
  6164. ) {
  6165. return
  6166. }
  6167. var cls = genClassForVnode(vnode);
  6168. // handle transition classes
  6169. var transitionClass = el._transitionClasses;
  6170. if (isDef(transitionClass)) {
  6171. cls = concat(cls, stringifyClass(transitionClass));
  6172. }
  6173. // set the class
  6174. if (cls !== el._prevClass) {
  6175. el.setAttribute('class', cls);
  6176. el._prevClass = cls;
  6177. }
  6178. }
  6179. var klass = {
  6180. create: updateClass,
  6181. update: updateClass
  6182. };
  6183. /* */
  6184. /* */
  6185. // add a raw attr (use this in preTransforms)
  6186. // note: this only removes the attr from the Array (attrsList) so that it
  6187. // doesn't get processed by processAttrs.
  6188. // By default it does NOT remove it from the map (attrsMap) because the map is
  6189. // needed during codegen.
  6190. /* */
  6191. /**
  6192. * Cross-platform code generation for component v-model
  6193. */
  6194. /**
  6195. * Cross-platform codegen helper for generating v-model value assignment code.
  6196. */
  6197. /* */
  6198. // in some cases, the event used has to be determined at runtime
  6199. // so we used some reserved tokens during compile.
  6200. var RANGE_TOKEN = '__r';
  6201. var CHECKBOX_RADIO_TOKEN = '__c';
  6202. /* */
  6203. // normalize v-model event tokens that can only be determined at runtime.
  6204. // it's important to place the event as the first in the array because
  6205. // the whole point is ensuring the v-model callback gets called before
  6206. // user-attached handlers.
  6207. function normalizeEvents (on) {
  6208. /* istanbul ignore if */
  6209. if (isDef(on[RANGE_TOKEN])) {
  6210. // IE input[type=range] only supports `change` event
  6211. var event = isIE ? 'change' : 'input';
  6212. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6213. delete on[RANGE_TOKEN];
  6214. }
  6215. // This was originally intended to fix #4521 but no longer necessary
  6216. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6217. /* istanbul ignore if */
  6218. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6219. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6220. delete on[CHECKBOX_RADIO_TOKEN];
  6221. }
  6222. }
  6223. var target$1;
  6224. function createOnceHandler (handler, event, capture) {
  6225. var _target = target$1; // save current target element in closure
  6226. return function onceHandler () {
  6227. var res = handler.apply(null, arguments);
  6228. if (res !== null) {
  6229. remove$2(event, onceHandler, capture, _target);
  6230. }
  6231. }
  6232. }
  6233. function add$1 (
  6234. event,
  6235. handler,
  6236. once$$1,
  6237. capture,
  6238. passive
  6239. ) {
  6240. handler = withMacroTask(handler);
  6241. if (once$$1) { handler = createOnceHandler(handler, event, capture); }
  6242. target$1.addEventListener(
  6243. event,
  6244. handler,
  6245. supportsPassive
  6246. ? { capture: capture, passive: passive }
  6247. : capture
  6248. );
  6249. }
  6250. function remove$2 (
  6251. event,
  6252. handler,
  6253. capture,
  6254. _target
  6255. ) {
  6256. (_target || target$1).removeEventListener(
  6257. event,
  6258. handler._withTask || handler,
  6259. capture
  6260. );
  6261. }
  6262. function updateDOMListeners (oldVnode, vnode) {
  6263. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6264. return
  6265. }
  6266. var on = vnode.data.on || {};
  6267. var oldOn = oldVnode.data.on || {};
  6268. target$1 = vnode.elm;
  6269. normalizeEvents(on);
  6270. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  6271. target$1 = undefined;
  6272. }
  6273. var events = {
  6274. create: updateDOMListeners,
  6275. update: updateDOMListeners
  6276. };
  6277. /* */
  6278. function updateDOMProps (oldVnode, vnode) {
  6279. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6280. return
  6281. }
  6282. var key, cur;
  6283. var elm = vnode.elm;
  6284. var oldProps = oldVnode.data.domProps || {};
  6285. var props = vnode.data.domProps || {};
  6286. // clone observed objects, as the user probably wants to mutate it
  6287. if (isDef(props.__ob__)) {
  6288. props = vnode.data.domProps = extend({}, props);
  6289. }
  6290. for (key in oldProps) {
  6291. if (isUndef(props[key])) {
  6292. elm[key] = '';
  6293. }
  6294. }
  6295. for (key in props) {
  6296. cur = props[key];
  6297. // ignore children if the node has textContent or innerHTML,
  6298. // as these will throw away existing DOM nodes and cause removal errors
  6299. // on subsequent patches (#3360)
  6300. if (key === 'textContent' || key === 'innerHTML') {
  6301. if (vnode.children) { vnode.children.length = 0; }
  6302. if (cur === oldProps[key]) { continue }
  6303. // #6601 work around Chrome version <= 55 bug where single textNode
  6304. // replaced by innerHTML/textContent retains its parentNode property
  6305. if (elm.childNodes.length === 1) {
  6306. elm.removeChild(elm.childNodes[0]);
  6307. }
  6308. }
  6309. if (key === 'value') {
  6310. // store value as _value as well since
  6311. // non-string values will be stringified
  6312. elm._value = cur;
  6313. // avoid resetting cursor position when value is the same
  6314. var strCur = isUndef(cur) ? '' : String(cur);
  6315. if (shouldUpdateValue(elm, strCur)) {
  6316. elm.value = strCur;
  6317. }
  6318. } else {
  6319. elm[key] = cur;
  6320. }
  6321. }
  6322. }
  6323. // check platforms/web/util/attrs.js acceptValue
  6324. function shouldUpdateValue (elm, checkVal) {
  6325. return (!elm.composing && (
  6326. elm.tagName === 'OPTION' ||
  6327. isNotInFocusAndDirty(elm, checkVal) ||
  6328. isDirtyWithModifiers(elm, checkVal)
  6329. ))
  6330. }
  6331. function isNotInFocusAndDirty (elm, checkVal) {
  6332. // return true when textbox (.number and .trim) loses focus and its value is
  6333. // not equal to the updated value
  6334. var notInFocus = true;
  6335. // #6157
  6336. // work around IE bug when accessing document.activeElement in an iframe
  6337. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6338. return notInFocus && elm.value !== checkVal
  6339. }
  6340. function isDirtyWithModifiers (elm, newVal) {
  6341. var value = elm.value;
  6342. var modifiers = elm._vModifiers; // injected by v-model runtime
  6343. if (isDef(modifiers)) {
  6344. if (modifiers.lazy) {
  6345. // inputs with lazy should only be updated when not in focus
  6346. return false
  6347. }
  6348. if (modifiers.number) {
  6349. return toNumber(value) !== toNumber(newVal)
  6350. }
  6351. if (modifiers.trim) {
  6352. return value.trim() !== newVal.trim()
  6353. }
  6354. }
  6355. return value !== newVal
  6356. }
  6357. var domProps = {
  6358. create: updateDOMProps,
  6359. update: updateDOMProps
  6360. };
  6361. /* */
  6362. var parseStyleText = cached(function (cssText) {
  6363. var res = {};
  6364. var listDelimiter = /;(?![^(]*\))/g;
  6365. var propertyDelimiter = /:(.+)/;
  6366. cssText.split(listDelimiter).forEach(function (item) {
  6367. if (item) {
  6368. var tmp = item.split(propertyDelimiter);
  6369. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6370. }
  6371. });
  6372. return res
  6373. });
  6374. // merge static and dynamic style data on the same vnode
  6375. function normalizeStyleData (data) {
  6376. var style = normalizeStyleBinding(data.style);
  6377. // static style is pre-processed into an object during compilation
  6378. // and is always a fresh object, so it's safe to merge into it
  6379. return data.staticStyle
  6380. ? extend(data.staticStyle, style)
  6381. : style
  6382. }
  6383. // normalize possible array / string values into Object
  6384. function normalizeStyleBinding (bindingStyle) {
  6385. if (Array.isArray(bindingStyle)) {
  6386. return toObject(bindingStyle)
  6387. }
  6388. if (typeof bindingStyle === 'string') {
  6389. return parseStyleText(bindingStyle)
  6390. }
  6391. return bindingStyle
  6392. }
  6393. /**
  6394. * parent component style should be after child's
  6395. * so that parent component's style could override it
  6396. */
  6397. function getStyle (vnode, checkChild) {
  6398. var res = {};
  6399. var styleData;
  6400. if (checkChild) {
  6401. var childNode = vnode;
  6402. while (childNode.componentInstance) {
  6403. childNode = childNode.componentInstance._vnode;
  6404. if (
  6405. childNode && childNode.data &&
  6406. (styleData = normalizeStyleData(childNode.data))
  6407. ) {
  6408. extend(res, styleData);
  6409. }
  6410. }
  6411. }
  6412. if ((styleData = normalizeStyleData(vnode.data))) {
  6413. extend(res, styleData);
  6414. }
  6415. var parentNode = vnode;
  6416. while ((parentNode = parentNode.parent)) {
  6417. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6418. extend(res, styleData);
  6419. }
  6420. }
  6421. return res
  6422. }
  6423. /* */
  6424. var cssVarRE = /^--/;
  6425. var importantRE = /\s*!important$/;
  6426. var setProp = function (el, name, val) {
  6427. /* istanbul ignore if */
  6428. if (cssVarRE.test(name)) {
  6429. el.style.setProperty(name, val);
  6430. } else if (importantRE.test(val)) {
  6431. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  6432. } else {
  6433. var normalizedName = normalize(name);
  6434. if (Array.isArray(val)) {
  6435. // Support values array created by autoprefixer, e.g.
  6436. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  6437. // Set them one by one, and the browser will only set those it can recognize
  6438. for (var i = 0, len = val.length; i < len; i++) {
  6439. el.style[normalizedName] = val[i];
  6440. }
  6441. } else {
  6442. el.style[normalizedName] = val;
  6443. }
  6444. }
  6445. };
  6446. var vendorNames = ['Webkit', 'Moz', 'ms'];
  6447. var emptyStyle;
  6448. var normalize = cached(function (prop) {
  6449. emptyStyle = emptyStyle || document.createElement('div').style;
  6450. prop = camelize(prop);
  6451. if (prop !== 'filter' && (prop in emptyStyle)) {
  6452. return prop
  6453. }
  6454. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  6455. for (var i = 0; i < vendorNames.length; i++) {
  6456. var name = vendorNames[i] + capName;
  6457. if (name in emptyStyle) {
  6458. return name
  6459. }
  6460. }
  6461. });
  6462. function updateStyle (oldVnode, vnode) {
  6463. var data = vnode.data;
  6464. var oldData = oldVnode.data;
  6465. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  6466. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  6467. ) {
  6468. return
  6469. }
  6470. var cur, name;
  6471. var el = vnode.elm;
  6472. var oldStaticStyle = oldData.staticStyle;
  6473. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  6474. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  6475. var oldStyle = oldStaticStyle || oldStyleBinding;
  6476. var style = normalizeStyleBinding(vnode.data.style) || {};
  6477. // store normalized style under a different key for next diff
  6478. // make sure to clone it if it's reactive, since the user likely wants
  6479. // to mutate it.
  6480. vnode.data.normalizedStyle = isDef(style.__ob__)
  6481. ? extend({}, style)
  6482. : style;
  6483. var newStyle = getStyle(vnode, true);
  6484. for (name in oldStyle) {
  6485. if (isUndef(newStyle[name])) {
  6486. setProp(el, name, '');
  6487. }
  6488. }
  6489. for (name in newStyle) {
  6490. cur = newStyle[name];
  6491. if (cur !== oldStyle[name]) {
  6492. // ie9 setting to null has no effect, must use empty string
  6493. setProp(el, name, cur == null ? '' : cur);
  6494. }
  6495. }
  6496. }
  6497. var style = {
  6498. create: updateStyle,
  6499. update: updateStyle
  6500. };
  6501. /* */
  6502. /**
  6503. * Add class with compatibility for SVG since classList is not supported on
  6504. * SVG elements in IE
  6505. */
  6506. function addClass (el, cls) {
  6507. /* istanbul ignore if */
  6508. if (!cls || !(cls = cls.trim())) {
  6509. return
  6510. }
  6511. /* istanbul ignore else */
  6512. if (el.classList) {
  6513. if (cls.indexOf(' ') > -1) {
  6514. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  6515. } else {
  6516. el.classList.add(cls);
  6517. }
  6518. } else {
  6519. var cur = " " + (el.getAttribute('class') || '') + " ";
  6520. if (cur.indexOf(' ' + cls + ' ') < 0) {
  6521. el.setAttribute('class', (cur + cls).trim());
  6522. }
  6523. }
  6524. }
  6525. /**
  6526. * Remove class with compatibility for SVG since classList is not supported on
  6527. * SVG elements in IE
  6528. */
  6529. function removeClass (el, cls) {
  6530. /* istanbul ignore if */
  6531. if (!cls || !(cls = cls.trim())) {
  6532. return
  6533. }
  6534. /* istanbul ignore else */
  6535. if (el.classList) {
  6536. if (cls.indexOf(' ') > -1) {
  6537. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  6538. } else {
  6539. el.classList.remove(cls);
  6540. }
  6541. if (!el.classList.length) {
  6542. el.removeAttribute('class');
  6543. }
  6544. } else {
  6545. var cur = " " + (el.getAttribute('class') || '') + " ";
  6546. var tar = ' ' + cls + ' ';
  6547. while (cur.indexOf(tar) >= 0) {
  6548. cur = cur.replace(tar, ' ');
  6549. }
  6550. cur = cur.trim();
  6551. if (cur) {
  6552. el.setAttribute('class', cur);
  6553. } else {
  6554. el.removeAttribute('class');
  6555. }
  6556. }
  6557. }
  6558. /* */
  6559. function resolveTransition (def) {
  6560. if (!def) {
  6561. return
  6562. }
  6563. /* istanbul ignore else */
  6564. if (typeof def === 'object') {
  6565. var res = {};
  6566. if (def.css !== false) {
  6567. extend(res, autoCssTransition(def.name || 'v'));
  6568. }
  6569. extend(res, def);
  6570. return res
  6571. } else if (typeof def === 'string') {
  6572. return autoCssTransition(def)
  6573. }
  6574. }
  6575. var autoCssTransition = cached(function (name) {
  6576. return {
  6577. enterClass: (name + "-enter"),
  6578. enterToClass: (name + "-enter-to"),
  6579. enterActiveClass: (name + "-enter-active"),
  6580. leaveClass: (name + "-leave"),
  6581. leaveToClass: (name + "-leave-to"),
  6582. leaveActiveClass: (name + "-leave-active")
  6583. }
  6584. });
  6585. var hasTransition = inBrowser && !isIE9;
  6586. var TRANSITION = 'transition';
  6587. var ANIMATION = 'animation';
  6588. // Transition property/event sniffing
  6589. var transitionProp = 'transition';
  6590. var transitionEndEvent = 'transitionend';
  6591. var animationProp = 'animation';
  6592. var animationEndEvent = 'animationend';
  6593. if (hasTransition) {
  6594. /* istanbul ignore if */
  6595. if (window.ontransitionend === undefined &&
  6596. window.onwebkittransitionend !== undefined
  6597. ) {
  6598. transitionProp = 'WebkitTransition';
  6599. transitionEndEvent = 'webkitTransitionEnd';
  6600. }
  6601. if (window.onanimationend === undefined &&
  6602. window.onwebkitanimationend !== undefined
  6603. ) {
  6604. animationProp = 'WebkitAnimation';
  6605. animationEndEvent = 'webkitAnimationEnd';
  6606. }
  6607. }
  6608. // binding to window is necessary to make hot reload work in IE in strict mode
  6609. var raf = inBrowser
  6610. ? window.requestAnimationFrame
  6611. ? window.requestAnimationFrame.bind(window)
  6612. : setTimeout
  6613. : /* istanbul ignore next */ function (fn) { return fn(); };
  6614. function nextFrame (fn) {
  6615. raf(function () {
  6616. raf(fn);
  6617. });
  6618. }
  6619. function addTransitionClass (el, cls) {
  6620. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  6621. if (transitionClasses.indexOf(cls) < 0) {
  6622. transitionClasses.push(cls);
  6623. addClass(el, cls);
  6624. }
  6625. }
  6626. function removeTransitionClass (el, cls) {
  6627. if (el._transitionClasses) {
  6628. remove(el._transitionClasses, cls);
  6629. }
  6630. removeClass(el, cls);
  6631. }
  6632. function whenTransitionEnds (
  6633. el,
  6634. expectedType,
  6635. cb
  6636. ) {
  6637. var ref = getTransitionInfo(el, expectedType);
  6638. var type = ref.type;
  6639. var timeout = ref.timeout;
  6640. var propCount = ref.propCount;
  6641. if (!type) { return cb() }
  6642. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  6643. var ended = 0;
  6644. var end = function () {
  6645. el.removeEventListener(event, onEnd);
  6646. cb();
  6647. };
  6648. var onEnd = function (e) {
  6649. if (e.target === el) {
  6650. if (++ended >= propCount) {
  6651. end();
  6652. }
  6653. }
  6654. };
  6655. setTimeout(function () {
  6656. if (ended < propCount) {
  6657. end();
  6658. }
  6659. }, timeout + 1);
  6660. el.addEventListener(event, onEnd);
  6661. }
  6662. var transformRE = /\b(transform|all)(,|$)/;
  6663. function getTransitionInfo (el, expectedType) {
  6664. var styles = window.getComputedStyle(el);
  6665. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  6666. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  6667. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  6668. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  6669. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  6670. var animationTimeout = getTimeout(animationDelays, animationDurations);
  6671. var type;
  6672. var timeout = 0;
  6673. var propCount = 0;
  6674. /* istanbul ignore if */
  6675. if (expectedType === TRANSITION) {
  6676. if (transitionTimeout > 0) {
  6677. type = TRANSITION;
  6678. timeout = transitionTimeout;
  6679. propCount = transitionDurations.length;
  6680. }
  6681. } else if (expectedType === ANIMATION) {
  6682. if (animationTimeout > 0) {
  6683. type = ANIMATION;
  6684. timeout = animationTimeout;
  6685. propCount = animationDurations.length;
  6686. }
  6687. } else {
  6688. timeout = Math.max(transitionTimeout, animationTimeout);
  6689. type = timeout > 0
  6690. ? transitionTimeout > animationTimeout
  6691. ? TRANSITION
  6692. : ANIMATION
  6693. : null;
  6694. propCount = type
  6695. ? type === TRANSITION
  6696. ? transitionDurations.length
  6697. : animationDurations.length
  6698. : 0;
  6699. }
  6700. var hasTransform =
  6701. type === TRANSITION &&
  6702. transformRE.test(styles[transitionProp + 'Property']);
  6703. return {
  6704. type: type,
  6705. timeout: timeout,
  6706. propCount: propCount,
  6707. hasTransform: hasTransform
  6708. }
  6709. }
  6710. function getTimeout (delays, durations) {
  6711. /* istanbul ignore next */
  6712. while (delays.length < durations.length) {
  6713. delays = delays.concat(delays);
  6714. }
  6715. return Math.max.apply(null, durations.map(function (d, i) {
  6716. return toMs(d) + toMs(delays[i])
  6717. }))
  6718. }
  6719. function toMs (s) {
  6720. return Number(s.slice(0, -1)) * 1000
  6721. }
  6722. /* */
  6723. function enter (vnode, toggleDisplay) {
  6724. var el = vnode.elm;
  6725. // call leave callback now
  6726. if (isDef(el._leaveCb)) {
  6727. el._leaveCb.cancelled = true;
  6728. el._leaveCb();
  6729. }
  6730. var data = resolveTransition(vnode.data.transition);
  6731. if (isUndef(data)) {
  6732. return
  6733. }
  6734. /* istanbul ignore if */
  6735. if (isDef(el._enterCb) || el.nodeType !== 1) {
  6736. return
  6737. }
  6738. var css = data.css;
  6739. var type = data.type;
  6740. var enterClass = data.enterClass;
  6741. var enterToClass = data.enterToClass;
  6742. var enterActiveClass = data.enterActiveClass;
  6743. var appearClass = data.appearClass;
  6744. var appearToClass = data.appearToClass;
  6745. var appearActiveClass = data.appearActiveClass;
  6746. var beforeEnter = data.beforeEnter;
  6747. var enter = data.enter;
  6748. var afterEnter = data.afterEnter;
  6749. var enterCancelled = data.enterCancelled;
  6750. var beforeAppear = data.beforeAppear;
  6751. var appear = data.appear;
  6752. var afterAppear = data.afterAppear;
  6753. var appearCancelled = data.appearCancelled;
  6754. var duration = data.duration;
  6755. // activeInstance will always be the <transition> component managing this
  6756. // transition. One edge case to check is when the <transition> is placed
  6757. // as the root node of a child component. In that case we need to check
  6758. // <transition>'s parent for appear check.
  6759. var context = activeInstance;
  6760. var transitionNode = activeInstance.$vnode;
  6761. while (transitionNode && transitionNode.parent) {
  6762. transitionNode = transitionNode.parent;
  6763. context = transitionNode.context;
  6764. }
  6765. var isAppear = !context._isMounted || !vnode.isRootInsert;
  6766. if (isAppear && !appear && appear !== '') {
  6767. return
  6768. }
  6769. var startClass = isAppear && appearClass
  6770. ? appearClass
  6771. : enterClass;
  6772. var activeClass = isAppear && appearActiveClass
  6773. ? appearActiveClass
  6774. : enterActiveClass;
  6775. var toClass = isAppear && appearToClass
  6776. ? appearToClass
  6777. : enterToClass;
  6778. var beforeEnterHook = isAppear
  6779. ? (beforeAppear || beforeEnter)
  6780. : beforeEnter;
  6781. var enterHook = isAppear
  6782. ? (typeof appear === 'function' ? appear : enter)
  6783. : enter;
  6784. var afterEnterHook = isAppear
  6785. ? (afterAppear || afterEnter)
  6786. : afterEnter;
  6787. var enterCancelledHook = isAppear
  6788. ? (appearCancelled || enterCancelled)
  6789. : enterCancelled;
  6790. var explicitEnterDuration = toNumber(
  6791. isObject(duration)
  6792. ? duration.enter
  6793. : duration
  6794. );
  6795. if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
  6796. checkDuration(explicitEnterDuration, 'enter', vnode);
  6797. }
  6798. var expectsCSS = css !== false && !isIE9;
  6799. var userWantsControl = getHookArgumentsLength(enterHook);
  6800. var cb = el._enterCb = once(function () {
  6801. if (expectsCSS) {
  6802. removeTransitionClass(el, toClass);
  6803. removeTransitionClass(el, activeClass);
  6804. }
  6805. if (cb.cancelled) {
  6806. if (expectsCSS) {
  6807. removeTransitionClass(el, startClass);
  6808. }
  6809. enterCancelledHook && enterCancelledHook(el);
  6810. } else {
  6811. afterEnterHook && afterEnterHook(el);
  6812. }
  6813. el._enterCb = null;
  6814. });
  6815. if (!vnode.data.show) {
  6816. // remove pending leave element on enter by injecting an insert hook
  6817. mergeVNodeHook(vnode, 'insert', function () {
  6818. var parent = el.parentNode;
  6819. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  6820. if (pendingNode &&
  6821. pendingNode.tag === vnode.tag &&
  6822. pendingNode.elm._leaveCb
  6823. ) {
  6824. pendingNode.elm._leaveCb();
  6825. }
  6826. enterHook && enterHook(el, cb);
  6827. });
  6828. }
  6829. // start enter transition
  6830. beforeEnterHook && beforeEnterHook(el);
  6831. if (expectsCSS) {
  6832. addTransitionClass(el, startClass);
  6833. addTransitionClass(el, activeClass);
  6834. nextFrame(function () {
  6835. addTransitionClass(el, toClass);
  6836. removeTransitionClass(el, startClass);
  6837. if (!cb.cancelled && !userWantsControl) {
  6838. if (isValidDuration(explicitEnterDuration)) {
  6839. setTimeout(cb, explicitEnterDuration);
  6840. } else {
  6841. whenTransitionEnds(el, type, cb);
  6842. }
  6843. }
  6844. });
  6845. }
  6846. if (vnode.data.show) {
  6847. toggleDisplay && toggleDisplay();
  6848. enterHook && enterHook(el, cb);
  6849. }
  6850. if (!expectsCSS && !userWantsControl) {
  6851. cb();
  6852. }
  6853. }
  6854. function leave (vnode, rm) {
  6855. var el = vnode.elm;
  6856. // call enter callback now
  6857. if (isDef(el._enterCb)) {
  6858. el._enterCb.cancelled = true;
  6859. el._enterCb();
  6860. }
  6861. var data = resolveTransition(vnode.data.transition);
  6862. if (isUndef(data) || el.nodeType !== 1) {
  6863. return rm()
  6864. }
  6865. /* istanbul ignore if */
  6866. if (isDef(el._leaveCb)) {
  6867. return
  6868. }
  6869. var css = data.css;
  6870. var type = data.type;
  6871. var leaveClass = data.leaveClass;
  6872. var leaveToClass = data.leaveToClass;
  6873. var leaveActiveClass = data.leaveActiveClass;
  6874. var beforeLeave = data.beforeLeave;
  6875. var leave = data.leave;
  6876. var afterLeave = data.afterLeave;
  6877. var leaveCancelled = data.leaveCancelled;
  6878. var delayLeave = data.delayLeave;
  6879. var duration = data.duration;
  6880. var expectsCSS = css !== false && !isIE9;
  6881. var userWantsControl = getHookArgumentsLength(leave);
  6882. var explicitLeaveDuration = toNumber(
  6883. isObject(duration)
  6884. ? duration.leave
  6885. : duration
  6886. );
  6887. if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
  6888. checkDuration(explicitLeaveDuration, 'leave', vnode);
  6889. }
  6890. var cb = el._leaveCb = once(function () {
  6891. if (el.parentNode && el.parentNode._pending) {
  6892. el.parentNode._pending[vnode.key] = null;
  6893. }
  6894. if (expectsCSS) {
  6895. removeTransitionClass(el, leaveToClass);
  6896. removeTransitionClass(el, leaveActiveClass);
  6897. }
  6898. if (cb.cancelled) {
  6899. if (expectsCSS) {
  6900. removeTransitionClass(el, leaveClass);
  6901. }
  6902. leaveCancelled && leaveCancelled(el);
  6903. } else {
  6904. rm();
  6905. afterLeave && afterLeave(el);
  6906. }
  6907. el._leaveCb = null;
  6908. });
  6909. if (delayLeave) {
  6910. delayLeave(performLeave);
  6911. } else {
  6912. performLeave();
  6913. }
  6914. function performLeave () {
  6915. // the delayed leave may have already been cancelled
  6916. if (cb.cancelled) {
  6917. return
  6918. }
  6919. // record leaving element
  6920. if (!vnode.data.show) {
  6921. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  6922. }
  6923. beforeLeave && beforeLeave(el);
  6924. if (expectsCSS) {
  6925. addTransitionClass(el, leaveClass);
  6926. addTransitionClass(el, leaveActiveClass);
  6927. nextFrame(function () {
  6928. addTransitionClass(el, leaveToClass);
  6929. removeTransitionClass(el, leaveClass);
  6930. if (!cb.cancelled && !userWantsControl) {
  6931. if (isValidDuration(explicitLeaveDuration)) {
  6932. setTimeout(cb, explicitLeaveDuration);
  6933. } else {
  6934. whenTransitionEnds(el, type, cb);
  6935. }
  6936. }
  6937. });
  6938. }
  6939. leave && leave(el, cb);
  6940. if (!expectsCSS && !userWantsControl) {
  6941. cb();
  6942. }
  6943. }
  6944. }
  6945. // only used in dev mode
  6946. function checkDuration (val, name, vnode) {
  6947. if (typeof val !== 'number') {
  6948. warn(
  6949. "<transition> explicit " + name + " duration is not a valid number - " +
  6950. "got " + (JSON.stringify(val)) + ".",
  6951. vnode.context
  6952. );
  6953. } else if (isNaN(val)) {
  6954. warn(
  6955. "<transition> explicit " + name + " duration is NaN - " +
  6956. 'the duration expression might be incorrect.',
  6957. vnode.context
  6958. );
  6959. }
  6960. }
  6961. function isValidDuration (val) {
  6962. return typeof val === 'number' && !isNaN(val)
  6963. }
  6964. /**
  6965. * Normalize a transition hook's argument length. The hook may be:
  6966. * - a merged hook (invoker) with the original in .fns
  6967. * - a wrapped component method (check ._length)
  6968. * - a plain function (.length)
  6969. */
  6970. function getHookArgumentsLength (fn) {
  6971. if (isUndef(fn)) {
  6972. return false
  6973. }
  6974. var invokerFns = fn.fns;
  6975. if (isDef(invokerFns)) {
  6976. // invoker
  6977. return getHookArgumentsLength(
  6978. Array.isArray(invokerFns)
  6979. ? invokerFns[0]
  6980. : invokerFns
  6981. )
  6982. } else {
  6983. return (fn._length || fn.length) > 1
  6984. }
  6985. }
  6986. function _enter (_, vnode) {
  6987. if (vnode.data.show !== true) {
  6988. enter(vnode);
  6989. }
  6990. }
  6991. var transition = inBrowser ? {
  6992. create: _enter,
  6993. activate: _enter,
  6994. remove: function remove$$1 (vnode, rm) {
  6995. /* istanbul ignore else */
  6996. if (vnode.data.show !== true) {
  6997. leave(vnode, rm);
  6998. } else {
  6999. rm();
  7000. }
  7001. }
  7002. } : {};
  7003. var platformModules = [
  7004. attrs,
  7005. klass,
  7006. events,
  7007. domProps,
  7008. style,
  7009. transition
  7010. ];
  7011. /* */
  7012. // the directive module should be applied last, after all
  7013. // built-in modules have been applied.
  7014. var modules = platformModules.concat(baseModules);
  7015. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7016. /**
  7017. * Not type checking this file because flow doesn't like attaching
  7018. * properties to Elements.
  7019. */
  7020. /* istanbul ignore if */
  7021. if (isIE9) {
  7022. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7023. document.addEventListener('selectionchange', function () {
  7024. var el = document.activeElement;
  7025. if (el && el.vmodel) {
  7026. trigger(el, 'input');
  7027. }
  7028. });
  7029. }
  7030. var directive = {
  7031. inserted: function inserted (el, binding, vnode, oldVnode) {
  7032. if (vnode.tag === 'select') {
  7033. // #6903
  7034. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7035. mergeVNodeHook(vnode, 'postpatch', function () {
  7036. directive.componentUpdated(el, binding, vnode);
  7037. });
  7038. } else {
  7039. setSelected(el, binding, vnode.context);
  7040. }
  7041. el._vOptions = [].map.call(el.options, getValue);
  7042. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7043. el._vModifiers = binding.modifiers;
  7044. if (!binding.modifiers.lazy) {
  7045. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7046. // switching focus before confirming composition choice
  7047. // this also fixes the issue where some browsers e.g. iOS Chrome
  7048. // fires "change" instead of "input" on autocomplete.
  7049. el.addEventListener('change', onCompositionEnd);
  7050. if (!isAndroid) {
  7051. el.addEventListener('compositionstart', onCompositionStart);
  7052. el.addEventListener('compositionend', onCompositionEnd);
  7053. }
  7054. /* istanbul ignore if */
  7055. if (isIE9) {
  7056. el.vmodel = true;
  7057. }
  7058. }
  7059. }
  7060. },
  7061. componentUpdated: function componentUpdated (el, binding, vnode) {
  7062. if (vnode.tag === 'select') {
  7063. setSelected(el, binding, vnode.context);
  7064. // in case the options rendered by v-for have changed,
  7065. // it's possible that the value is out-of-sync with the rendered options.
  7066. // detect such cases and filter out values that no longer has a matching
  7067. // option in the DOM.
  7068. var prevOptions = el._vOptions;
  7069. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7070. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7071. // trigger change event if
  7072. // no matching option found for at least one value
  7073. var needReset = el.multiple
  7074. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7075. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7076. if (needReset) {
  7077. trigger(el, 'change');
  7078. }
  7079. }
  7080. }
  7081. }
  7082. };
  7083. function setSelected (el, binding, vm) {
  7084. actuallySetSelected(el, binding, vm);
  7085. /* istanbul ignore if */
  7086. if (isIE || isEdge) {
  7087. setTimeout(function () {
  7088. actuallySetSelected(el, binding, vm);
  7089. }, 0);
  7090. }
  7091. }
  7092. function actuallySetSelected (el, binding, vm) {
  7093. var value = binding.value;
  7094. var isMultiple = el.multiple;
  7095. if (isMultiple && !Array.isArray(value)) {
  7096. process.env.NODE_ENV !== 'production' && warn(
  7097. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7098. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7099. vm
  7100. );
  7101. return
  7102. }
  7103. var selected, option;
  7104. for (var i = 0, l = el.options.length; i < l; i++) {
  7105. option = el.options[i];
  7106. if (isMultiple) {
  7107. selected = looseIndexOf(value, getValue(option)) > -1;
  7108. if (option.selected !== selected) {
  7109. option.selected = selected;
  7110. }
  7111. } else {
  7112. if (looseEqual(getValue(option), value)) {
  7113. if (el.selectedIndex !== i) {
  7114. el.selectedIndex = i;
  7115. }
  7116. return
  7117. }
  7118. }
  7119. }
  7120. if (!isMultiple) {
  7121. el.selectedIndex = -1;
  7122. }
  7123. }
  7124. function hasNoMatchingOption (value, options) {
  7125. return options.every(function (o) { return !looseEqual(o, value); })
  7126. }
  7127. function getValue (option) {
  7128. return '_value' in option
  7129. ? option._value
  7130. : option.value
  7131. }
  7132. function onCompositionStart (e) {
  7133. e.target.composing = true;
  7134. }
  7135. function onCompositionEnd (e) {
  7136. // prevent triggering an input event for no reason
  7137. if (!e.target.composing) { return }
  7138. e.target.composing = false;
  7139. trigger(e.target, 'input');
  7140. }
  7141. function trigger (el, type) {
  7142. var e = document.createEvent('HTMLEvents');
  7143. e.initEvent(type, true, true);
  7144. el.dispatchEvent(e);
  7145. }
  7146. /* */
  7147. // recursively search for possible transition defined inside the component root
  7148. function locateNode (vnode) {
  7149. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7150. ? locateNode(vnode.componentInstance._vnode)
  7151. : vnode
  7152. }
  7153. var show = {
  7154. bind: function bind (el, ref, vnode) {
  7155. var value = ref.value;
  7156. vnode = locateNode(vnode);
  7157. var transition$$1 = vnode.data && vnode.data.transition;
  7158. var originalDisplay = el.__vOriginalDisplay =
  7159. el.style.display === 'none' ? '' : el.style.display;
  7160. if (value && transition$$1) {
  7161. vnode.data.show = true;
  7162. enter(vnode, function () {
  7163. el.style.display = originalDisplay;
  7164. });
  7165. } else {
  7166. el.style.display = value ? originalDisplay : 'none';
  7167. }
  7168. },
  7169. update: function update (el, ref, vnode) {
  7170. var value = ref.value;
  7171. var oldValue = ref.oldValue;
  7172. /* istanbul ignore if */
  7173. if (value === oldValue) { return }
  7174. vnode = locateNode(vnode);
  7175. var transition$$1 = vnode.data && vnode.data.transition;
  7176. if (transition$$1) {
  7177. vnode.data.show = true;
  7178. if (value) {
  7179. enter(vnode, function () {
  7180. el.style.display = el.__vOriginalDisplay;
  7181. });
  7182. } else {
  7183. leave(vnode, function () {
  7184. el.style.display = 'none';
  7185. });
  7186. }
  7187. } else {
  7188. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7189. }
  7190. },
  7191. unbind: function unbind (
  7192. el,
  7193. binding,
  7194. vnode,
  7195. oldVnode,
  7196. isDestroy
  7197. ) {
  7198. if (!isDestroy) {
  7199. el.style.display = el.__vOriginalDisplay;
  7200. }
  7201. }
  7202. };
  7203. var platformDirectives = {
  7204. model: directive,
  7205. show: show
  7206. };
  7207. /* */
  7208. // Provides transition support for a single element/component.
  7209. // supports transition mode (out-in / in-out)
  7210. var transitionProps = {
  7211. name: String,
  7212. appear: Boolean,
  7213. css: Boolean,
  7214. mode: String,
  7215. type: String,
  7216. enterClass: String,
  7217. leaveClass: String,
  7218. enterToClass: String,
  7219. leaveToClass: String,
  7220. enterActiveClass: String,
  7221. leaveActiveClass: String,
  7222. appearClass: String,
  7223. appearActiveClass: String,
  7224. appearToClass: String,
  7225. duration: [Number, String, Object]
  7226. };
  7227. // in case the child is also an abstract component, e.g. <keep-alive>
  7228. // we want to recursively retrieve the real component to be rendered
  7229. function getRealChild (vnode) {
  7230. var compOptions = vnode && vnode.componentOptions;
  7231. if (compOptions && compOptions.Ctor.options.abstract) {
  7232. return getRealChild(getFirstComponentChild(compOptions.children))
  7233. } else {
  7234. return vnode
  7235. }
  7236. }
  7237. function extractTransitionData (comp) {
  7238. var data = {};
  7239. var options = comp.$options;
  7240. // props
  7241. for (var key in options.propsData) {
  7242. data[key] = comp[key];
  7243. }
  7244. // events.
  7245. // extract listeners and pass them directly to the transition methods
  7246. var listeners = options._parentListeners;
  7247. for (var key$1 in listeners) {
  7248. data[camelize(key$1)] = listeners[key$1];
  7249. }
  7250. return data
  7251. }
  7252. function placeholder (h, rawChild) {
  7253. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7254. return h('keep-alive', {
  7255. props: rawChild.componentOptions.propsData
  7256. })
  7257. }
  7258. }
  7259. function hasParentTransition (vnode) {
  7260. while ((vnode = vnode.parent)) {
  7261. if (vnode.data.transition) {
  7262. return true
  7263. }
  7264. }
  7265. }
  7266. function isSameChild (child, oldChild) {
  7267. return oldChild.key === child.key && oldChild.tag === child.tag
  7268. }
  7269. var Transition = {
  7270. name: 'transition',
  7271. props: transitionProps,
  7272. abstract: true,
  7273. render: function render (h) {
  7274. var this$1 = this;
  7275. var children = this.$slots.default;
  7276. if (!children) {
  7277. return
  7278. }
  7279. // filter out text nodes (possible whitespaces)
  7280. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  7281. /* istanbul ignore if */
  7282. if (!children.length) {
  7283. return
  7284. }
  7285. // warn multiple elements
  7286. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  7287. warn(
  7288. '<transition> can only be used on a single element. Use ' +
  7289. '<transition-group> for lists.',
  7290. this.$parent
  7291. );
  7292. }
  7293. var mode = this.mode;
  7294. // warn invalid mode
  7295. if (process.env.NODE_ENV !== 'production' &&
  7296. mode && mode !== 'in-out' && mode !== 'out-in'
  7297. ) {
  7298. warn(
  7299. 'invalid <transition> mode: ' + mode,
  7300. this.$parent
  7301. );
  7302. }
  7303. var rawChild = children[0];
  7304. // if this is a component root node and the component's
  7305. // parent container node also has transition, skip.
  7306. if (hasParentTransition(this.$vnode)) {
  7307. return rawChild
  7308. }
  7309. // apply transition data to child
  7310. // use getRealChild() to ignore abstract components e.g. keep-alive
  7311. var child = getRealChild(rawChild);
  7312. /* istanbul ignore if */
  7313. if (!child) {
  7314. return rawChild
  7315. }
  7316. if (this._leaving) {
  7317. return placeholder(h, rawChild)
  7318. }
  7319. // ensure a key that is unique to the vnode type and to this transition
  7320. // component instance. This key will be used to remove pending leaving nodes
  7321. // during entering.
  7322. var id = "__transition-" + (this._uid) + "-";
  7323. child.key = child.key == null
  7324. ? child.isComment
  7325. ? id + 'comment'
  7326. : id + child.tag
  7327. : isPrimitive(child.key)
  7328. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7329. : child.key;
  7330. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7331. var oldRawChild = this._vnode;
  7332. var oldChild = getRealChild(oldRawChild);
  7333. // mark v-show
  7334. // so that the transition module can hand over the control to the directive
  7335. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  7336. child.data.show = true;
  7337. }
  7338. if (
  7339. oldChild &&
  7340. oldChild.data &&
  7341. !isSameChild(child, oldChild) &&
  7342. !isAsyncPlaceholder(oldChild) &&
  7343. // #6687 component root is a comment node
  7344. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7345. ) {
  7346. // replace old child transition data with fresh one
  7347. // important for dynamic transitions!
  7348. var oldData = oldChild.data.transition = extend({}, data);
  7349. // handle transition mode
  7350. if (mode === 'out-in') {
  7351. // return placeholder node and queue update when leave finishes
  7352. this._leaving = true;
  7353. mergeVNodeHook(oldData, 'afterLeave', function () {
  7354. this$1._leaving = false;
  7355. this$1.$forceUpdate();
  7356. });
  7357. return placeholder(h, rawChild)
  7358. } else if (mode === 'in-out') {
  7359. if (isAsyncPlaceholder(child)) {
  7360. return oldRawChild
  7361. }
  7362. var delayedLeave;
  7363. var performLeave = function () { delayedLeave(); };
  7364. mergeVNodeHook(data, 'afterEnter', performLeave);
  7365. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7366. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7367. }
  7368. }
  7369. return rawChild
  7370. }
  7371. };
  7372. /* */
  7373. // Provides transition support for list items.
  7374. // supports move transitions using the FLIP technique.
  7375. // Because the vdom's children update algorithm is "unstable" - i.e.
  7376. // it doesn't guarantee the relative positioning of removed elements,
  7377. // we force transition-group to update its children into two passes:
  7378. // in the first pass, we remove all nodes that need to be removed,
  7379. // triggering their leaving transition; in the second pass, we insert/move
  7380. // into the final desired state. This way in the second pass removed
  7381. // nodes will remain where they should be.
  7382. var props = extend({
  7383. tag: String,
  7384. moveClass: String
  7385. }, transitionProps);
  7386. delete props.mode;
  7387. var TransitionGroup = {
  7388. props: props,
  7389. render: function render (h) {
  7390. var tag = this.tag || this.$vnode.data.tag || 'span';
  7391. var map = Object.create(null);
  7392. var prevChildren = this.prevChildren = this.children;
  7393. var rawChildren = this.$slots.default || [];
  7394. var children = this.children = [];
  7395. var transitionData = extractTransitionData(this);
  7396. for (var i = 0; i < rawChildren.length; i++) {
  7397. var c = rawChildren[i];
  7398. if (c.tag) {
  7399. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7400. children.push(c);
  7401. map[c.key] = c
  7402. ;(c.data || (c.data = {})).transition = transitionData;
  7403. } else if (process.env.NODE_ENV !== 'production') {
  7404. var opts = c.componentOptions;
  7405. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7406. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7407. }
  7408. }
  7409. }
  7410. if (prevChildren) {
  7411. var kept = [];
  7412. var removed = [];
  7413. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7414. var c$1 = prevChildren[i$1];
  7415. c$1.data.transition = transitionData;
  7416. c$1.data.pos = c$1.elm.getBoundingClientRect();
  7417. if (map[c$1.key]) {
  7418. kept.push(c$1);
  7419. } else {
  7420. removed.push(c$1);
  7421. }
  7422. }
  7423. this.kept = h(tag, null, kept);
  7424. this.removed = removed;
  7425. }
  7426. return h(tag, null, children)
  7427. },
  7428. beforeUpdate: function beforeUpdate () {
  7429. // force removing pass
  7430. this.__patch__(
  7431. this._vnode,
  7432. this.kept,
  7433. false, // hydrating
  7434. true // removeOnly (!important avoids unnecessary moves)
  7435. );
  7436. this._vnode = this.kept;
  7437. },
  7438. updated: function updated () {
  7439. var children = this.prevChildren;
  7440. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  7441. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  7442. return
  7443. }
  7444. // we divide the work into three loops to avoid mixing DOM reads and writes
  7445. // in each iteration - which helps prevent layout thrashing.
  7446. children.forEach(callPendingCbs);
  7447. children.forEach(recordPosition);
  7448. children.forEach(applyTranslation);
  7449. // force reflow to put everything in position
  7450. // assign to this to avoid being removed in tree-shaking
  7451. // $flow-disable-line
  7452. this._reflow = document.body.offsetHeight;
  7453. children.forEach(function (c) {
  7454. if (c.data.moved) {
  7455. var el = c.elm;
  7456. var s = el.style;
  7457. addTransitionClass(el, moveClass);
  7458. s.transform = s.WebkitTransform = s.transitionDuration = '';
  7459. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  7460. if (!e || /transform$/.test(e.propertyName)) {
  7461. el.removeEventListener(transitionEndEvent, cb);
  7462. el._moveCb = null;
  7463. removeTransitionClass(el, moveClass);
  7464. }
  7465. });
  7466. }
  7467. });
  7468. },
  7469. methods: {
  7470. hasMove: function hasMove (el, moveClass) {
  7471. /* istanbul ignore if */
  7472. if (!hasTransition) {
  7473. return false
  7474. }
  7475. /* istanbul ignore if */
  7476. if (this._hasMove) {
  7477. return this._hasMove
  7478. }
  7479. // Detect whether an element with the move class applied has
  7480. // CSS transitions. Since the element may be inside an entering
  7481. // transition at this very moment, we make a clone of it and remove
  7482. // all other transition classes applied to ensure only the move class
  7483. // is applied.
  7484. var clone = el.cloneNode();
  7485. if (el._transitionClasses) {
  7486. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  7487. }
  7488. addClass(clone, moveClass);
  7489. clone.style.display = 'none';
  7490. this.$el.appendChild(clone);
  7491. var info = getTransitionInfo(clone);
  7492. this.$el.removeChild(clone);
  7493. return (this._hasMove = info.hasTransform)
  7494. }
  7495. }
  7496. };
  7497. function callPendingCbs (c) {
  7498. /* istanbul ignore if */
  7499. if (c.elm._moveCb) {
  7500. c.elm._moveCb();
  7501. }
  7502. /* istanbul ignore if */
  7503. if (c.elm._enterCb) {
  7504. c.elm._enterCb();
  7505. }
  7506. }
  7507. function recordPosition (c) {
  7508. c.data.newPos = c.elm.getBoundingClientRect();
  7509. }
  7510. function applyTranslation (c) {
  7511. var oldPos = c.data.pos;
  7512. var newPos = c.data.newPos;
  7513. var dx = oldPos.left - newPos.left;
  7514. var dy = oldPos.top - newPos.top;
  7515. if (dx || dy) {
  7516. c.data.moved = true;
  7517. var s = c.elm.style;
  7518. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  7519. s.transitionDuration = '0s';
  7520. }
  7521. }
  7522. var platformComponents = {
  7523. Transition: Transition,
  7524. TransitionGroup: TransitionGroup
  7525. };
  7526. /* */
  7527. // install platform specific utils
  7528. Vue$3.config.mustUseProp = mustUseProp;
  7529. Vue$3.config.isReservedTag = isReservedTag;
  7530. Vue$3.config.isReservedAttr = isReservedAttr;
  7531. Vue$3.config.getTagNamespace = getTagNamespace;
  7532. Vue$3.config.isUnknownElement = isUnknownElement;
  7533. // install platform runtime directives & components
  7534. extend(Vue$3.options.directives, platformDirectives);
  7535. extend(Vue$3.options.components, platformComponents);
  7536. // install platform patch function
  7537. Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
  7538. // public mount method
  7539. Vue$3.prototype.$mount = function (
  7540. el,
  7541. hydrating
  7542. ) {
  7543. el = el && inBrowser ? query(el) : undefined;
  7544. return mountComponent(this, el, hydrating)
  7545. };
  7546. // devtools global hook
  7547. /* istanbul ignore next */
  7548. Vue$3.nextTick(function () {
  7549. if (config.devtools) {
  7550. if (devtools) {
  7551. devtools.emit('init', Vue$3);
  7552. } else if (process.env.NODE_ENV !== 'production' && isChrome) {
  7553. console[console.info ? 'info' : 'log'](
  7554. 'Download the Vue Devtools extension for a better development experience:\n' +
  7555. 'https://github.com/vuejs/vue-devtools'
  7556. );
  7557. }
  7558. }
  7559. if (process.env.NODE_ENV !== 'production' &&
  7560. config.productionTip !== false &&
  7561. inBrowser && typeof console !== 'undefined'
  7562. ) {
  7563. console[console.info ? 'info' : 'log'](
  7564. "You are running Vue in development mode.\n" +
  7565. "Make sure to turn on production mode when deploying for production.\n" +
  7566. "See more tips at https://vuejs.org/guide/deployment.html"
  7567. );
  7568. }
  7569. }, 0);
  7570. /* */
  7571. /* harmony default export */ __webpack_exports__["a"] = (Vue$3);
  7572. /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(4), __webpack_require__(3), __webpack_require__(6).setImmediate))
  7573. /***/ }),
  7574. /* 3 */
  7575. /***/ (function(module, exports) {
  7576. var g;
  7577. // This works in non-strict mode
  7578. g = (function() {
  7579. return this;
  7580. })();
  7581. try {
  7582. // This works if eval is allowed (see CSP)
  7583. g = g || Function("return this")() || (1,eval)("this");
  7584. } catch(e) {
  7585. // This works if the window reference is available
  7586. if(typeof window === "object")
  7587. g = window;
  7588. }
  7589. // g can still be undefined, but nothing to do about it...
  7590. // We return undefined, instead of nothing here, so it's
  7591. // easier to handle this case. if(!global) { ...}
  7592. module.exports = g;
  7593. /***/ }),
  7594. /* 4 */
  7595. /***/ (function(module, exports) {
  7596. // shim for using process in browser
  7597. var process = module.exports = {};
  7598. // cached from whatever global is present so that test runners that stub it
  7599. // don't break things. But we need to wrap it in a try catch in case it is
  7600. // wrapped in strict mode code which doesn't define any globals. It's inside a
  7601. // function because try/catches deoptimize in certain engines.
  7602. var cachedSetTimeout;
  7603. var cachedClearTimeout;
  7604. function defaultSetTimout() {
  7605. throw new Error('setTimeout has not been defined');
  7606. }
  7607. function defaultClearTimeout () {
  7608. throw new Error('clearTimeout has not been defined');
  7609. }
  7610. (function () {
  7611. try {
  7612. if (typeof setTimeout === 'function') {
  7613. cachedSetTimeout = setTimeout;
  7614. } else {
  7615. cachedSetTimeout = defaultSetTimout;
  7616. }
  7617. } catch (e) {
  7618. cachedSetTimeout = defaultSetTimout;
  7619. }
  7620. try {
  7621. if (typeof clearTimeout === 'function') {
  7622. cachedClearTimeout = clearTimeout;
  7623. } else {
  7624. cachedClearTimeout = defaultClearTimeout;
  7625. }
  7626. } catch (e) {
  7627. cachedClearTimeout = defaultClearTimeout;
  7628. }
  7629. } ())
  7630. function runTimeout(fun) {
  7631. if (cachedSetTimeout === setTimeout) {
  7632. //normal enviroments in sane situations
  7633. return setTimeout(fun, 0);
  7634. }
  7635. // if setTimeout wasn't available but was latter defined
  7636. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  7637. cachedSetTimeout = setTimeout;
  7638. return setTimeout(fun, 0);
  7639. }
  7640. try {
  7641. // when when somebody has screwed with setTimeout but no I.E. maddness
  7642. return cachedSetTimeout(fun, 0);
  7643. } catch(e){
  7644. try {
  7645. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  7646. return cachedSetTimeout.call(null, fun, 0);
  7647. } catch(e){
  7648. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  7649. return cachedSetTimeout.call(this, fun, 0);
  7650. }
  7651. }
  7652. }
  7653. function runClearTimeout(marker) {
  7654. if (cachedClearTimeout === clearTimeout) {
  7655. //normal enviroments in sane situations
  7656. return clearTimeout(marker);
  7657. }
  7658. // if clearTimeout wasn't available but was latter defined
  7659. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  7660. cachedClearTimeout = clearTimeout;
  7661. return clearTimeout(marker);
  7662. }
  7663. try {
  7664. // when when somebody has screwed with setTimeout but no I.E. maddness
  7665. return cachedClearTimeout(marker);
  7666. } catch (e){
  7667. try {
  7668. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  7669. return cachedClearTimeout.call(null, marker);
  7670. } catch (e){
  7671. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  7672. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  7673. return cachedClearTimeout.call(this, marker);
  7674. }
  7675. }
  7676. }
  7677. var queue = [];
  7678. var draining = false;
  7679. var currentQueue;
  7680. var queueIndex = -1;
  7681. function cleanUpNextTick() {
  7682. if (!draining || !currentQueue) {
  7683. return;
  7684. }
  7685. draining = false;
  7686. if (currentQueue.length) {
  7687. queue = currentQueue.concat(queue);
  7688. } else {
  7689. queueIndex = -1;
  7690. }
  7691. if (queue.length) {
  7692. drainQueue();
  7693. }
  7694. }
  7695. function drainQueue() {
  7696. if (draining) {
  7697. return;
  7698. }
  7699. var timeout = runTimeout(cleanUpNextTick);
  7700. draining = true;
  7701. var len = queue.length;
  7702. while(len) {
  7703. currentQueue = queue;
  7704. queue = [];
  7705. while (++queueIndex < len) {
  7706. if (currentQueue) {
  7707. currentQueue[queueIndex].run();
  7708. }
  7709. }
  7710. queueIndex = -1;
  7711. len = queue.length;
  7712. }
  7713. currentQueue = null;
  7714. draining = false;
  7715. runClearTimeout(timeout);
  7716. }
  7717. process.nextTick = function (fun) {
  7718. var args = new Array(arguments.length - 1);
  7719. if (arguments.length > 1) {
  7720. for (var i = 1; i < arguments.length; i++) {
  7721. args[i - 1] = arguments[i];
  7722. }
  7723. }
  7724. queue.push(new Item(fun, args));
  7725. if (queue.length === 1 && !draining) {
  7726. runTimeout(drainQueue);
  7727. }
  7728. };
  7729. // v8 likes predictible objects
  7730. function Item(fun, array) {
  7731. this.fun = fun;
  7732. this.array = array;
  7733. }
  7734. Item.prototype.run = function () {
  7735. this.fun.apply(null, this.array);
  7736. };
  7737. process.title = 'browser';
  7738. process.browser = true;
  7739. process.env = {};
  7740. process.argv = [];
  7741. process.version = ''; // empty string to avoid regexp issues
  7742. process.versions = {};
  7743. function noop() {}
  7744. process.on = noop;
  7745. process.addListener = noop;
  7746. process.once = noop;
  7747. process.off = noop;
  7748. process.removeListener = noop;
  7749. process.removeAllListeners = noop;
  7750. process.emit = noop;
  7751. process.prependListener = noop;
  7752. process.prependOnceListener = noop;
  7753. process.listeners = function (name) { return [] }
  7754. process.binding = function (name) {
  7755. throw new Error('process.binding is not supported');
  7756. };
  7757. process.cwd = function () { return '/' };
  7758. process.chdir = function (dir) {
  7759. throw new Error('process.chdir is not supported');
  7760. };
  7761. process.umask = function() { return 0; };
  7762. /***/ }),
  7763. /* 5 */
  7764. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7765. "use strict";
  7766. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  7767. // EXTERNAL MODULE: ./node_modules/vue/dist/vue.runtime.esm.js
  7768. var vue_runtime_esm = __webpack_require__(2);
  7769. // EXTERNAL MODULE: ./src/util.js
  7770. var util = __webpack_require__(0);
  7771. // CONCATENATED MODULE: ./src/url/root.js
  7772. /**
  7773. * Root Prefix Transform.
  7774. */
  7775. /* harmony default export */ var root = (function (options, next) {
  7776. var url = next(options);
  7777. if (Object(util["m" /* isString */])(options.root) && !/^(https?:)?\//.test(url)) {
  7778. url = Object(util["t" /* trimEnd */])(options.root, '/') + '/' + url;
  7779. }
  7780. return url;
  7781. });
  7782. // CONCATENATED MODULE: ./src/url/query.js
  7783. /**
  7784. * Query Parameter Transform.
  7785. */
  7786. /* harmony default export */ var url_query = (function (options, next) {
  7787. var urlParams = Object.keys(Url.options.params), query = {}, url = next(options);
  7788. Object(util["d" /* each */])(options.params, function (value, key) {
  7789. if (urlParams.indexOf(key) === -1) {
  7790. query[key] = value;
  7791. }
  7792. });
  7793. query = Url.params(query);
  7794. if (query) {
  7795. url += (url.indexOf('?') == -1 ? '?' : '&') + query;
  7796. }
  7797. return url;
  7798. });
  7799. // CONCATENATED MODULE: ./src/lib/url-template.js
  7800. /**
  7801. * URL Template v2.0.6 (https://github.com/bramstein/url-template)
  7802. */
  7803. function expand(url, params, variables) {
  7804. var tmpl = parse(url), expanded = tmpl.expand(params);
  7805. if (variables) {
  7806. variables.push.apply(variables, tmpl.vars);
  7807. }
  7808. return expanded;
  7809. }
  7810. function parse(template) {
  7811. var operators = ['+', '#', '.', '/', ';', '?', '&'], variables = [];
  7812. return {
  7813. vars: variables,
  7814. expand: function expand(context) {
  7815. return template.replace(/\{([^{}]+)\}|([^{}]+)/g, function (_, expression, literal) {
  7816. if (expression) {
  7817. var operator = null, values = [];
  7818. if (operators.indexOf(expression.charAt(0)) !== -1) {
  7819. operator = expression.charAt(0);
  7820. expression = expression.substr(1);
  7821. }
  7822. expression.split(/,/g).forEach(function (variable) {
  7823. var tmp = /([^:*]*)(?::(\d+)|(\*))?/.exec(variable);
  7824. values.push.apply(values, getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
  7825. variables.push(tmp[1]);
  7826. });
  7827. if (operator && operator !== '+') {
  7828. var separator = ',';
  7829. if (operator === '?') {
  7830. separator = '&';
  7831. } else if (operator !== '#') {
  7832. separator = operator;
  7833. }
  7834. return (values.length !== 0 ? operator : '') + values.join(separator);
  7835. } else {
  7836. return values.join(',');
  7837. }
  7838. } else {
  7839. return encodeReserved(literal);
  7840. }
  7841. });
  7842. }
  7843. };
  7844. }
  7845. function getValues(context, operator, key, modifier) {
  7846. var value = context[key], result = [];
  7847. if (isDefined(value) && value !== '') {
  7848. if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
  7849. value = value.toString();
  7850. if (modifier && modifier !== '*') {
  7851. value = value.substring(0, parseInt(modifier, 10));
  7852. }
  7853. result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
  7854. } else {
  7855. if (modifier === '*') {
  7856. if (Array.isArray(value)) {
  7857. value.filter(isDefined).forEach(function (value) {
  7858. result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
  7859. });
  7860. } else {
  7861. Object.keys(value).forEach(function (k) {
  7862. if (isDefined(value[k])) {
  7863. result.push(encodeValue(operator, value[k], k));
  7864. }
  7865. });
  7866. }
  7867. } else {
  7868. var tmp = [];
  7869. if (Array.isArray(value)) {
  7870. value.filter(isDefined).forEach(function (value) {
  7871. tmp.push(encodeValue(operator, value));
  7872. });
  7873. } else {
  7874. Object.keys(value).forEach(function (k) {
  7875. if (isDefined(value[k])) {
  7876. tmp.push(encodeURIComponent(k));
  7877. tmp.push(encodeValue(operator, value[k].toString()));
  7878. }
  7879. });
  7880. }
  7881. if (isKeyOperator(operator)) {
  7882. result.push(encodeURIComponent(key) + '=' + tmp.join(','));
  7883. } else if (tmp.length !== 0) {
  7884. result.push(tmp.join(','));
  7885. }
  7886. }
  7887. }
  7888. } else {
  7889. if (operator === ';') {
  7890. result.push(encodeURIComponent(key));
  7891. } else if (value === '' && (operator === '&' || operator === '?')) {
  7892. result.push(encodeURIComponent(key) + '=');
  7893. } else if (value === '') {
  7894. result.push('');
  7895. }
  7896. }
  7897. return result;
  7898. }
  7899. function isDefined(value) {
  7900. return value !== undefined && value !== null;
  7901. }
  7902. function isKeyOperator(operator) {
  7903. return operator === ';' || operator === '&' || operator === '?';
  7904. }
  7905. function encodeValue(operator, value, key) {
  7906. value = (operator === '+' || operator === '#') ? encodeReserved(value) : encodeURIComponent(value);
  7907. if (key) {
  7908. return encodeURIComponent(key) + '=' + value;
  7909. } else {
  7910. return value;
  7911. }
  7912. }
  7913. function encodeReserved(str) {
  7914. return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
  7915. if (!/%[0-9A-Fa-f]/.test(part)) {
  7916. part = encodeURI(part);
  7917. }
  7918. return part;
  7919. }).join('');
  7920. }
  7921. // CONCATENATED MODULE: ./src/url/template.js
  7922. /**
  7923. * URL Template (RFC 6570) Transform.
  7924. */
  7925. /* harmony default export */ var template = (function (options) {
  7926. var variables = [], url = expand(options.url, options.params, variables);
  7927. variables.forEach(function (key) {
  7928. delete options.params[key];
  7929. });
  7930. return url;
  7931. });
  7932. // CONCATENATED MODULE: ./src/url/index.js
  7933. /**
  7934. * Service for URL templating.
  7935. */
  7936. function Url(url, params) {
  7937. var self = this || {}, options = url, transform;
  7938. if (Object(util["m" /* isString */])(url)) {
  7939. options = {url: url, params: params};
  7940. }
  7941. options = Object(util["n" /* merge */])({}, Url.options, self.$options, options);
  7942. Url.transforms.forEach(function (handler) {
  7943. if (Object(util["m" /* isString */])(handler)) {
  7944. handler = Url.transform[handler];
  7945. }
  7946. if (Object(util["j" /* isFunction */])(handler)) {
  7947. transform = factory(handler, transform, self.$vm);
  7948. }
  7949. });
  7950. return transform(options);
  7951. }
  7952. /**
  7953. * Url options.
  7954. */
  7955. Url.options = {
  7956. url: '',
  7957. root: null,
  7958. params: {}
  7959. };
  7960. /**
  7961. * Url transforms.
  7962. */
  7963. Url.transform = {template: template, query: url_query, root: root};
  7964. Url.transforms = ['template', 'query', 'root'];
  7965. /**
  7966. * Encodes a Url parameter string.
  7967. *
  7968. * @param {Object} obj
  7969. */
  7970. Url.params = function (obj) {
  7971. var params = [], escape = encodeURIComponent;
  7972. params.add = function (key, value) {
  7973. if (Object(util["j" /* isFunction */])(value)) {
  7974. value = value();
  7975. }
  7976. if (value === null) {
  7977. value = '';
  7978. }
  7979. this.push(escape(key) + '=' + escape(value));
  7980. };
  7981. serialize(params, obj);
  7982. return params.join('&').replace(/%20/g, '+');
  7983. };
  7984. /**
  7985. * Parse a URL and return its components.
  7986. *
  7987. * @param {String} url
  7988. */
  7989. Url.parse = function (url) {
  7990. var el = document.createElement('a');
  7991. if (document.documentMode) {
  7992. el.href = url;
  7993. url = el.href;
  7994. }
  7995. el.href = url;
  7996. return {
  7997. href: el.href,
  7998. protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',
  7999. port: el.port,
  8000. host: el.host,
  8001. hostname: el.hostname,
  8002. pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,
  8003. search: el.search ? el.search.replace(/^\?/, '') : '',
  8004. hash: el.hash ? el.hash.replace(/^#/, '') : ''
  8005. };
  8006. };
  8007. function factory(handler, next, vm) {
  8008. return function (options) {
  8009. return handler.call(vm, options, next);
  8010. };
  8011. }
  8012. function serialize(params, obj, scope) {
  8013. var array = Object(util["g" /* isArray */])(obj), plain = Object(util["l" /* isPlainObject */])(obj), hash;
  8014. Object(util["d" /* each */])(obj, function (value, key) {
  8015. hash = Object(util["k" /* isObject */])(value) || Object(util["g" /* isArray */])(value);
  8016. if (scope) {
  8017. key = scope + '[' + (plain || hash ? key : '') + ']';
  8018. }
  8019. if (!scope && array) {
  8020. params.add(value.name, value.value);
  8021. } else if (hash) {
  8022. serialize(params, value, key);
  8023. } else {
  8024. params.add(key, value);
  8025. }
  8026. });
  8027. }
  8028. // EXTERNAL MODULE: ./src/promise.js + 1 modules
  8029. var promise = __webpack_require__(1);
  8030. // CONCATENATED MODULE: ./src/http/client/xdr.js
  8031. /**
  8032. * XDomain client (Internet Explorer).
  8033. */
  8034. /* harmony default export */ var xdr = (function (request) {
  8035. return new promise["a" /* default */](function (resolve) {
  8036. var xdr = new XDomainRequest(), handler = function (ref) {
  8037. var type = ref.type;
  8038. var status = 0;
  8039. if (type === 'load') {
  8040. status = 200;
  8041. } else if (type === 'error') {
  8042. status = 500;
  8043. }
  8044. resolve(request.respondWith(xdr.responseText, {status: status}));
  8045. };
  8046. request.abort = function () { return xdr.abort(); };
  8047. xdr.open(request.method, request.getUrl());
  8048. if (request.timeout) {
  8049. xdr.timeout = request.timeout;
  8050. }
  8051. xdr.onload = handler;
  8052. xdr.onabort = handler;
  8053. xdr.onerror = handler;
  8054. xdr.ontimeout = handler;
  8055. xdr.onprogress = function () {};
  8056. xdr.send(request.getBody());
  8057. });
  8058. });
  8059. // CONCATENATED MODULE: ./src/http/interceptor/cors.js
  8060. /**
  8061. * CORS Interceptor.
  8062. */
  8063. var SUPPORTS_CORS = util["f" /* inBrowser */] && 'withCredentials' in new XMLHttpRequest();
  8064. /* harmony default export */ var cors = (function (request) {
  8065. if (util["f" /* inBrowser */]) {
  8066. var orgUrl = Url.parse(location.href);
  8067. var reqUrl = Url.parse(request.getUrl());
  8068. if (reqUrl.protocol !== orgUrl.protocol || reqUrl.host !== orgUrl.host) {
  8069. request.crossOrigin = true;
  8070. request.emulateHTTP = false;
  8071. if (!SUPPORTS_CORS) {
  8072. request.client = xdr;
  8073. }
  8074. }
  8075. }
  8076. });
  8077. // CONCATENATED MODULE: ./src/http/interceptor/form.js
  8078. /**
  8079. * Form data Interceptor.
  8080. */
  8081. /* harmony default export */ var interceptor_form = (function (request) {
  8082. if (Object(util["i" /* isFormData */])(request.body)) {
  8083. request.headers.delete('Content-Type');
  8084. } else if (Object(util["k" /* isObject */])(request.body) && request.emulateJSON) {
  8085. request.body = Url.params(request.body);
  8086. request.headers.set('Content-Type', 'application/x-www-form-urlencoded');
  8087. }
  8088. });
  8089. // CONCATENATED MODULE: ./src/http/interceptor/json.js
  8090. /**
  8091. * JSON Interceptor.
  8092. */
  8093. /* harmony default export */ var interceptor_json = (function (request) {
  8094. var type = request.headers.get('Content-Type') || '';
  8095. if (Object(util["k" /* isObject */])(request.body) && type.indexOf('application/json') === 0) {
  8096. request.body = JSON.stringify(request.body);
  8097. }
  8098. return function (response) {
  8099. return response.bodyText ? Object(util["v" /* when */])(response.text(), function (text) {
  8100. var type = response.headers.get('Content-Type') || '';
  8101. if (type.indexOf('application/json') === 0 || isJson(text)) {
  8102. try {
  8103. response.body = JSON.parse(text);
  8104. } catch (e) {
  8105. response.body = null;
  8106. }
  8107. } else {
  8108. response.body = text;
  8109. }
  8110. return response;
  8111. }) : response;
  8112. };
  8113. });
  8114. function isJson(str) {
  8115. var start = str.match(/^\s*(\[|\{)/);
  8116. var end = {'[': /]\s*$/, '{': /}\s*$/};
  8117. return start && end[start[1]].test(str);
  8118. }
  8119. // CONCATENATED MODULE: ./src/http/client/jsonp.js
  8120. /**
  8121. * JSONP client (Browser).
  8122. */
  8123. /* harmony default export */ var jsonp = (function (request) {
  8124. return new promise["a" /* default */](function (resolve) {
  8125. var name = request.jsonp || 'callback', callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script;
  8126. handler = function (ref) {
  8127. var type = ref.type;
  8128. var status = 0;
  8129. if (type === 'load' && body !== null) {
  8130. status = 200;
  8131. } else if (type === 'error') {
  8132. status = 500;
  8133. }
  8134. if (status && window[callback]) {
  8135. delete window[callback];
  8136. document.body.removeChild(script);
  8137. }
  8138. resolve(request.respondWith(body, {status: status}));
  8139. };
  8140. window[callback] = function (result) {
  8141. body = JSON.stringify(result);
  8142. };
  8143. request.abort = function () {
  8144. handler({type: 'abort'});
  8145. };
  8146. request.params[name] = callback;
  8147. if (request.timeout) {
  8148. setTimeout(request.abort, request.timeout);
  8149. }
  8150. script = document.createElement('script');
  8151. script.src = request.getUrl();
  8152. script.type = 'text/javascript';
  8153. script.async = true;
  8154. script.onload = handler;
  8155. script.onerror = handler;
  8156. document.body.appendChild(script);
  8157. });
  8158. });
  8159. // CONCATENATED MODULE: ./src/http/interceptor/jsonp.js
  8160. /**
  8161. * JSONP Interceptor.
  8162. */
  8163. /* harmony default export */ var interceptor_jsonp = (function (request) {
  8164. if (request.method == 'JSONP') {
  8165. request.client = jsonp;
  8166. }
  8167. });
  8168. // CONCATENATED MODULE: ./src/http/interceptor/before.js
  8169. /**
  8170. * Before Interceptor.
  8171. */
  8172. /* harmony default export */ var before = (function (request) {
  8173. if (Object(util["j" /* isFunction */])(request.before)) {
  8174. request.before.call(this, request);
  8175. }
  8176. });
  8177. // CONCATENATED MODULE: ./src/http/interceptor/method.js
  8178. /**
  8179. * HTTP method override Interceptor.
  8180. */
  8181. /* harmony default export */ var interceptor_method = (function (request) {
  8182. if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {
  8183. request.headers.set('X-HTTP-Method-Override', request.method);
  8184. request.method = 'POST';
  8185. }
  8186. });
  8187. // CONCATENATED MODULE: ./src/http/interceptor/header.js
  8188. /**
  8189. * Header Interceptor.
  8190. */
  8191. /* harmony default export */ var header = (function (request) {
  8192. var headers = Object(util["a" /* assign */])({}, Http.headers.common,
  8193. !request.crossOrigin ? Http.headers.custom : {},
  8194. Http.headers[Object(util["q" /* toLower */])(request.method)]
  8195. );
  8196. Object(util["d" /* each */])(headers, function (value, name) {
  8197. if (!request.headers.has(name)) {
  8198. request.headers.set(name, value);
  8199. }
  8200. });
  8201. });
  8202. // CONCATENATED MODULE: ./src/http/client/xhr.js
  8203. /**
  8204. * XMLHttp client (Browser).
  8205. */
  8206. /* harmony default export */ var client_xhr = (function (request) {
  8207. return new promise["a" /* default */](function (resolve) {
  8208. var xhr = new XMLHttpRequest(), handler = function (event) {
  8209. var response = request.respondWith(
  8210. 'response' in xhr ? xhr.response : xhr.responseText, {
  8211. status: xhr.status === 1223 ? 204 : xhr.status, // IE9 status bug
  8212. statusText: xhr.status === 1223 ? 'No Content' : Object(util["s" /* trim */])(xhr.statusText)
  8213. });
  8214. Object(util["d" /* each */])(Object(util["s" /* trim */])(xhr.getAllResponseHeaders()).split('\n'), function (row) {
  8215. response.headers.append(row.slice(0, row.indexOf(':')), row.slice(row.indexOf(':') + 1));
  8216. });
  8217. resolve(response);
  8218. };
  8219. request.abort = function () { return xhr.abort(); };
  8220. xhr.open(request.method, request.getUrl(), true);
  8221. if (request.timeout) {
  8222. xhr.timeout = request.timeout;
  8223. }
  8224. if (request.responseType && 'responseType' in xhr) {
  8225. xhr.responseType = request.responseType;
  8226. }
  8227. if (request.withCredentials || request.credentials) {
  8228. xhr.withCredentials = true;
  8229. }
  8230. if (!request.crossOrigin) {
  8231. request.headers.set('X-Requested-With', 'XMLHttpRequest');
  8232. }
  8233. // deprecated use downloadProgress
  8234. if (Object(util["j" /* isFunction */])(request.progress) && request.method === 'GET') {
  8235. xhr.addEventListener('progress', request.progress);
  8236. }
  8237. if (Object(util["j" /* isFunction */])(request.downloadProgress)) {
  8238. xhr.addEventListener('progress', request.downloadProgress);
  8239. }
  8240. // deprecated use uploadProgress
  8241. if (Object(util["j" /* isFunction */])(request.progress) && /^(POST|PUT)$/i.test(request.method)) {
  8242. xhr.upload.addEventListener('progress', request.progress);
  8243. }
  8244. if (Object(util["j" /* isFunction */])(request.uploadProgress) && xhr.upload) {
  8245. xhr.upload.addEventListener('progress', request.uploadProgress);
  8246. }
  8247. request.headers.forEach(function (value, name) {
  8248. xhr.setRequestHeader(name, value);
  8249. });
  8250. xhr.onload = handler;
  8251. xhr.onabort = handler;
  8252. xhr.onerror = handler;
  8253. xhr.ontimeout = handler;
  8254. xhr.send(request.getBody());
  8255. });
  8256. });
  8257. // CONCATENATED MODULE: ./src/http/client/node.js
  8258. /**
  8259. * Http client (Node).
  8260. */
  8261. /* harmony default export */ var node = (function (request) {
  8262. var client = __webpack_require__(8);
  8263. return new promise["a" /* default */](function (resolve) {
  8264. var url = request.getUrl();
  8265. var body = request.getBody();
  8266. var method = request.method;
  8267. var headers = {}, handler;
  8268. request.headers.forEach(function (value, name) {
  8269. headers[name] = value;
  8270. });
  8271. client(url, {body: body, method: method, headers: headers}).then(handler = function (resp) {
  8272. var response = request.respondWith(resp.body, {
  8273. status: resp.statusCode,
  8274. statusText: Object(util["s" /* trim */])(resp.statusMessage)
  8275. });
  8276. Object(util["d" /* each */])(resp.headers, function (value, name) {
  8277. response.headers.set(name, value);
  8278. });
  8279. resolve(response);
  8280. }, function (error) { return handler(error.response); });
  8281. });
  8282. });
  8283. // CONCATENATED MODULE: ./src/http/client/index.js
  8284. /**
  8285. * Base client.
  8286. */
  8287. /* harmony default export */ var http_client = (function (context) {
  8288. var reqHandlers = [sendRequest], resHandlers = [];
  8289. if (!Object(util["k" /* isObject */])(context)) {
  8290. context = null;
  8291. }
  8292. function Client(request) {
  8293. while (reqHandlers.length) {
  8294. var handler = reqHandlers.pop();
  8295. if (Object(util["j" /* isFunction */])(handler)) {
  8296. var response = (void 0), next = (void 0);
  8297. response = handler.call(context, request, function (val) { return next = val; }) || next;
  8298. if (Object(util["k" /* isObject */])(response)) {
  8299. return new promise["a" /* default */](function (resolve, reject) {
  8300. resHandlers.forEach(function (handler) {
  8301. response = Object(util["v" /* when */])(response, function (response) {
  8302. return handler.call(context, response) || response;
  8303. }, reject);
  8304. });
  8305. Object(util["v" /* when */])(response, resolve, reject);
  8306. }, context);
  8307. }
  8308. if (Object(util["j" /* isFunction */])(response)) {
  8309. resHandlers.unshift(response);
  8310. }
  8311. } else {
  8312. Object(util["u" /* warn */])(("Invalid interceptor of type " + (typeof handler) + ", must be a function"));
  8313. }
  8314. }
  8315. }
  8316. Client.use = function (handler) {
  8317. reqHandlers.push(handler);
  8318. };
  8319. return Client;
  8320. });
  8321. function sendRequest(request) {
  8322. var client = request.client || (util["f" /* inBrowser */] ? client_xhr : node);
  8323. return client(request);
  8324. }
  8325. // CONCATENATED MODULE: ./src/http/headers.js
  8326. /**
  8327. * HTTP Headers.
  8328. */
  8329. var headers_Headers = function Headers(headers) {
  8330. var this$1 = this;
  8331. this.map = {};
  8332. Object(util["d" /* each */])(headers, function (value, name) { return this$1.append(name, value); });
  8333. };
  8334. headers_Headers.prototype.has = function has (name) {
  8335. return getName(this.map, name) !== null;
  8336. };
  8337. headers_Headers.prototype.get = function get (name) {
  8338. var list = this.map[getName(this.map, name)];
  8339. return list ? list.join() : null;
  8340. };
  8341. headers_Headers.prototype.getAll = function getAll (name) {
  8342. return this.map[getName(this.map, name)] || [];
  8343. };
  8344. headers_Headers.prototype.set = function set (name, value) {
  8345. this.map[normalizeName(getName(this.map, name) || name)] = [Object(util["s" /* trim */])(value)];
  8346. };
  8347. headers_Headers.prototype.append = function append (name, value) {
  8348. var list = this.map[getName(this.map, name)];
  8349. if (list) {
  8350. list.push(Object(util["s" /* trim */])(value));
  8351. } else {
  8352. this.set(name, value);
  8353. }
  8354. };
  8355. headers_Headers.prototype.delete = function delete$1 (name) {
  8356. delete this.map[getName(this.map, name)];
  8357. };
  8358. headers_Headers.prototype.deleteAll = function deleteAll () {
  8359. this.map = {};
  8360. };
  8361. headers_Headers.prototype.forEach = function forEach (callback, thisArg) {
  8362. var this$1 = this;
  8363. Object(util["d" /* each */])(this.map, function (list, name) {
  8364. Object(util["d" /* each */])(list, function (value) { return callback.call(thisArg, value, name, this$1); });
  8365. });
  8366. };
  8367. /* harmony default export */ var http_headers = (headers_Headers);
  8368. function getName(map, name) {
  8369. return Object.keys(map).reduce(function (prev, curr) {
  8370. return Object(util["q" /* toLower */])(name) === Object(util["q" /* toLower */])(curr) ? curr : prev;
  8371. }, null);
  8372. }
  8373. function normalizeName(name) {
  8374. if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
  8375. throw new TypeError('Invalid character in header field name');
  8376. }
  8377. return Object(util["s" /* trim */])(name);
  8378. }
  8379. // CONCATENATED MODULE: ./src/http/response.js
  8380. /**
  8381. * HTTP Response.
  8382. */
  8383. var response_Response = function Response(body, ref) {
  8384. var url = ref.url;
  8385. var headers = ref.headers;
  8386. var status = ref.status;
  8387. var statusText = ref.statusText;
  8388. this.url = url;
  8389. this.ok = status >= 200 && status < 300;
  8390. this.status = status || 0;
  8391. this.statusText = statusText || '';
  8392. this.headers = new http_headers(headers);
  8393. this.body = body;
  8394. if (Object(util["m" /* isString */])(body)) {
  8395. this.bodyText = body;
  8396. } else if (Object(util["h" /* isBlob */])(body)) {
  8397. this.bodyBlob = body;
  8398. if (isBlobText(body)) {
  8399. this.bodyText = blobText(body);
  8400. }
  8401. }
  8402. };
  8403. response_Response.prototype.blob = function blob () {
  8404. return Object(util["v" /* when */])(this.bodyBlob);
  8405. };
  8406. response_Response.prototype.text = function text () {
  8407. return Object(util["v" /* when */])(this.bodyText);
  8408. };
  8409. response_Response.prototype.json = function json () {
  8410. return Object(util["v" /* when */])(this.text(), function (text) { return JSON.parse(text); });
  8411. };
  8412. /* harmony default export */ var http_response = (response_Response);
  8413. Object.defineProperty(response_Response.prototype, 'data', {
  8414. get: function get() {
  8415. return this.body;
  8416. },
  8417. set: function set(body) {
  8418. this.body = body;
  8419. }
  8420. });
  8421. function blobText(body) {
  8422. return new promise["a" /* default */](function (resolve) {
  8423. var reader = new FileReader();
  8424. reader.readAsText(body);
  8425. reader.onload = function () {
  8426. resolve(reader.result);
  8427. };
  8428. });
  8429. }
  8430. function isBlobText(body) {
  8431. return body.type.indexOf('text') === 0 || body.type.indexOf('json') !== -1;
  8432. }
  8433. // CONCATENATED MODULE: ./src/http/request.js
  8434. /**
  8435. * HTTP Request.
  8436. */
  8437. var request_Request = function Request(options) {
  8438. this.body = null;
  8439. this.params = {};
  8440. Object(util["a" /* assign */])(this, options, {
  8441. method: Object(util["r" /* toUpper */])(options.method || 'GET')
  8442. });
  8443. if (!(this.headers instanceof http_headers)) {
  8444. this.headers = new http_headers(this.headers);
  8445. }
  8446. };
  8447. request_Request.prototype.getUrl = function getUrl () {
  8448. return Url(this);
  8449. };
  8450. request_Request.prototype.getBody = function getBody () {
  8451. return this.body;
  8452. };
  8453. request_Request.prototype.respondWith = function respondWith (body, options) {
  8454. return new http_response(body, Object(util["a" /* assign */])(options || {}, {url: this.getUrl()}));
  8455. };
  8456. /* harmony default export */ var http_request = (request_Request);
  8457. // CONCATENATED MODULE: ./src/http/index.js
  8458. /**
  8459. * Service for sending network requests.
  8460. */
  8461. var COMMON_HEADERS = {'Accept': 'application/json, text/plain, */*'};
  8462. var JSON_CONTENT_TYPE = {'Content-Type': 'application/json;charset=utf-8'};
  8463. function Http(options) {
  8464. var self = this || {}, client = http_client(self.$vm);
  8465. Object(util["c" /* defaults */])(options || {}, self.$options, Http.options);
  8466. Http.interceptors.forEach(function (handler) {
  8467. if (Object(util["m" /* isString */])(handler)) {
  8468. handler = Http.interceptor[handler];
  8469. }
  8470. if (Object(util["j" /* isFunction */])(handler)) {
  8471. client.use(handler);
  8472. }
  8473. });
  8474. return client(new http_request(options)).then(function (response) {
  8475. return response.ok ? response : promise["a" /* default */].reject(response);
  8476. }, function (response) {
  8477. if (response instanceof Error) {
  8478. Object(util["e" /* error */])(response);
  8479. }
  8480. return promise["a" /* default */].reject(response);
  8481. });
  8482. }
  8483. Http.options = {};
  8484. Http.headers = {
  8485. put: JSON_CONTENT_TYPE,
  8486. post: JSON_CONTENT_TYPE,
  8487. patch: JSON_CONTENT_TYPE,
  8488. delete: JSON_CONTENT_TYPE,
  8489. common: COMMON_HEADERS,
  8490. custom: {}
  8491. };
  8492. Http.interceptor = {before: before, method: interceptor_method, jsonp: interceptor_jsonp, json: interceptor_json, form: interceptor_form, header: header, cors: cors};
  8493. Http.interceptors = ['before', 'method', 'jsonp', 'json', 'form', 'header', 'cors'];
  8494. ['get', 'delete', 'head', 'jsonp'].forEach(function (method) {
  8495. Http[method] = function (url, options) {
  8496. return this(Object(util["a" /* assign */])(options || {}, {url: url, method: method}));
  8497. };
  8498. });
  8499. ['post', 'put', 'patch'].forEach(function (method) {
  8500. Http[method] = function (url, body, options) {
  8501. return this(Object(util["a" /* assign */])(options || {}, {url: url, method: method, body: body}));
  8502. };
  8503. });
  8504. // CONCATENATED MODULE: ./src/resource.js
  8505. /**
  8506. * Service for interacting with RESTful services.
  8507. */
  8508. function Resource(url, params, actions, options) {
  8509. var self = this || {}, resource = {};
  8510. actions = Object(util["a" /* assign */])({},
  8511. Resource.actions,
  8512. actions
  8513. );
  8514. Object(util["d" /* each */])(actions, function (action, name) {
  8515. action = Object(util["n" /* merge */])({url: url, params: Object(util["a" /* assign */])({}, params)}, options, action);
  8516. resource[name] = function () {
  8517. return (self.$http || Http)(opts(action, arguments));
  8518. };
  8519. });
  8520. return resource;
  8521. }
  8522. function opts(action, args) {
  8523. var options = Object(util["a" /* assign */])({}, action), params = {}, body;
  8524. switch (args.length) {
  8525. case 2:
  8526. params = args[0];
  8527. body = args[1];
  8528. break;
  8529. case 1:
  8530. if (/^(POST|PUT|PATCH)$/i.test(options.method)) {
  8531. body = args[0];
  8532. } else {
  8533. params = args[0];
  8534. }
  8535. break;
  8536. case 0:
  8537. break;
  8538. default:
  8539. throw 'Expected up to 2 arguments [params, body], got ' + args.length + ' arguments';
  8540. }
  8541. options.body = body;
  8542. options.params = Object(util["a" /* assign */])({}, options.params, params);
  8543. return options;
  8544. }
  8545. Resource.actions = {
  8546. get: {method: 'GET'},
  8547. save: {method: 'POST'},
  8548. query: {method: 'GET'},
  8549. update: {method: 'PUT'},
  8550. remove: {method: 'DELETE'},
  8551. delete: {method: 'DELETE'}
  8552. };
  8553. // CONCATENATED MODULE: ./src/index.js
  8554. /**
  8555. * Install plugin.
  8556. */
  8557. function src_plugin(Vue) {
  8558. if (src_plugin.installed) {
  8559. return;
  8560. }
  8561. Object(util["b" /* default */])(Vue);
  8562. Vue.url = Url;
  8563. Vue.http = Http;
  8564. Vue.resource = Resource;
  8565. Vue.Promise = promise["a" /* default */];
  8566. Object.defineProperties(Vue.prototype, {
  8567. $url: {
  8568. get: function get() {
  8569. return Object(util["p" /* options */])(Vue.url, this, this.$options.url);
  8570. }
  8571. },
  8572. $http: {
  8573. get: function get() {
  8574. return Object(util["p" /* options */])(Vue.http, this, this.$options.http);
  8575. }
  8576. },
  8577. $resource: {
  8578. get: function get() {
  8579. return Vue.resource.bind(this);
  8580. }
  8581. },
  8582. $promise: {
  8583. get: function get() {
  8584. var this$1 = this;
  8585. return function (executor) { return new Vue.Promise(executor, this$1); };
  8586. }
  8587. }
  8588. });
  8589. }
  8590. if (typeof window !== 'undefined' && window.Vue) {
  8591. window.Vue.use(src_plugin);
  8592. }
  8593. /* harmony default export */ var src = (src_plugin);
  8594. // CONCATENATED MODULE: ./test/index.js
  8595. vue_runtime_esm["a" /* default */].use(src);
  8596. __webpack_require__(9);
  8597. __webpack_require__(10);
  8598. __webpack_require__(11);
  8599. __webpack_require__(12);
  8600. /***/ }),
  8601. /* 6 */
  8602. /***/ (function(module, exports, __webpack_require__) {
  8603. /* WEBPACK VAR INJECTION */(function(global) {var apply = Function.prototype.apply;
  8604. // DOM APIs, for completeness
  8605. exports.setTimeout = function() {
  8606. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  8607. };
  8608. exports.setInterval = function() {
  8609. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  8610. };
  8611. exports.clearTimeout =
  8612. exports.clearInterval = function(timeout) {
  8613. if (timeout) {
  8614. timeout.close();
  8615. }
  8616. };
  8617. function Timeout(id, clearFn) {
  8618. this._id = id;
  8619. this._clearFn = clearFn;
  8620. }
  8621. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  8622. Timeout.prototype.close = function() {
  8623. this._clearFn.call(window, this._id);
  8624. };
  8625. // Does not start the time, just sets up the members needed.
  8626. exports.enroll = function(item, msecs) {
  8627. clearTimeout(item._idleTimeoutId);
  8628. item._idleTimeout = msecs;
  8629. };
  8630. exports.unenroll = function(item) {
  8631. clearTimeout(item._idleTimeoutId);
  8632. item._idleTimeout = -1;
  8633. };
  8634. exports._unrefActive = exports.active = function(item) {
  8635. clearTimeout(item._idleTimeoutId);
  8636. var msecs = item._idleTimeout;
  8637. if (msecs >= 0) {
  8638. item._idleTimeoutId = setTimeout(function onTimeout() {
  8639. if (item._onTimeout)
  8640. item._onTimeout();
  8641. }, msecs);
  8642. }
  8643. };
  8644. // setimmediate attaches itself to the global object
  8645. __webpack_require__(7);
  8646. // On some exotic environments, it's not clear which object `setimmeidate` was
  8647. // able to install onto. Search each possibility in the same order as the
  8648. // `setimmediate` library.
  8649. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  8650. (typeof global !== "undefined" && global.setImmediate) ||
  8651. (this && this.setImmediate);
  8652. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  8653. (typeof global !== "undefined" && global.clearImmediate) ||
  8654. (this && this.clearImmediate);
  8655. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  8656. /***/ }),
  8657. /* 7 */
  8658. /***/ (function(module, exports, __webpack_require__) {
  8659. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  8660. "use strict";
  8661. if (global.setImmediate) {
  8662. return;
  8663. }
  8664. var nextHandle = 1; // Spec says greater than zero
  8665. var tasksByHandle = {};
  8666. var currentlyRunningATask = false;
  8667. var doc = global.document;
  8668. var registerImmediate;
  8669. function setImmediate(callback) {
  8670. // Callback can either be a function or a string
  8671. if (typeof callback !== "function") {
  8672. callback = new Function("" + callback);
  8673. }
  8674. // Copy function arguments
  8675. var args = new Array(arguments.length - 1);
  8676. for (var i = 0; i < args.length; i++) {
  8677. args[i] = arguments[i + 1];
  8678. }
  8679. // Store and register the task
  8680. var task = { callback: callback, args: args };
  8681. tasksByHandle[nextHandle] = task;
  8682. registerImmediate(nextHandle);
  8683. return nextHandle++;
  8684. }
  8685. function clearImmediate(handle) {
  8686. delete tasksByHandle[handle];
  8687. }
  8688. function run(task) {
  8689. var callback = task.callback;
  8690. var args = task.args;
  8691. switch (args.length) {
  8692. case 0:
  8693. callback();
  8694. break;
  8695. case 1:
  8696. callback(args[0]);
  8697. break;
  8698. case 2:
  8699. callback(args[0], args[1]);
  8700. break;
  8701. case 3:
  8702. callback(args[0], args[1], args[2]);
  8703. break;
  8704. default:
  8705. callback.apply(undefined, args);
  8706. break;
  8707. }
  8708. }
  8709. function runIfPresent(handle) {
  8710. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  8711. // So if we're currently running a task, we'll need to delay this invocation.
  8712. if (currentlyRunningATask) {
  8713. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  8714. // "too much recursion" error.
  8715. setTimeout(runIfPresent, 0, handle);
  8716. } else {
  8717. var task = tasksByHandle[handle];
  8718. if (task) {
  8719. currentlyRunningATask = true;
  8720. try {
  8721. run(task);
  8722. } finally {
  8723. clearImmediate(handle);
  8724. currentlyRunningATask = false;
  8725. }
  8726. }
  8727. }
  8728. }
  8729. function installNextTickImplementation() {
  8730. registerImmediate = function(handle) {
  8731. process.nextTick(function () { runIfPresent(handle); });
  8732. };
  8733. }
  8734. function canUsePostMessage() {
  8735. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  8736. // where `global.postMessage` means something completely different and can't be used for this purpose.
  8737. if (global.postMessage && !global.importScripts) {
  8738. var postMessageIsAsynchronous = true;
  8739. var oldOnMessage = global.onmessage;
  8740. global.onmessage = function() {
  8741. postMessageIsAsynchronous = false;
  8742. };
  8743. global.postMessage("", "*");
  8744. global.onmessage = oldOnMessage;
  8745. return postMessageIsAsynchronous;
  8746. }
  8747. }
  8748. function installPostMessageImplementation() {
  8749. // Installs an event handler on `global` for the `message` event: see
  8750. // * https://developer.mozilla.org/en/DOM/window.postMessage
  8751. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  8752. var messagePrefix = "setImmediate$" + Math.random() + "$";
  8753. var onGlobalMessage = function(event) {
  8754. if (event.source === global &&
  8755. typeof event.data === "string" &&
  8756. event.data.indexOf(messagePrefix) === 0) {
  8757. runIfPresent(+event.data.slice(messagePrefix.length));
  8758. }
  8759. };
  8760. if (global.addEventListener) {
  8761. global.addEventListener("message", onGlobalMessage, false);
  8762. } else {
  8763. global.attachEvent("onmessage", onGlobalMessage);
  8764. }
  8765. registerImmediate = function(handle) {
  8766. global.postMessage(messagePrefix + handle, "*");
  8767. };
  8768. }
  8769. function installMessageChannelImplementation() {
  8770. var channel = new MessageChannel();
  8771. channel.port1.onmessage = function(event) {
  8772. var handle = event.data;
  8773. runIfPresent(handle);
  8774. };
  8775. registerImmediate = function(handle) {
  8776. channel.port2.postMessage(handle);
  8777. };
  8778. }
  8779. function installReadyStateChangeImplementation() {
  8780. var html = doc.documentElement;
  8781. registerImmediate = function(handle) {
  8782. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  8783. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  8784. var script = doc.createElement("script");
  8785. script.onreadystatechange = function () {
  8786. runIfPresent(handle);
  8787. script.onreadystatechange = null;
  8788. html.removeChild(script);
  8789. script = null;
  8790. };
  8791. html.appendChild(script);
  8792. };
  8793. }
  8794. function installSetTimeoutImplementation() {
  8795. registerImmediate = function(handle) {
  8796. setTimeout(runIfPresent, 0, handle);
  8797. };
  8798. }
  8799. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  8800. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  8801. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  8802. // Don't get fooled by e.g. browserify environments.
  8803. if ({}.toString.call(global.process) === "[object process]") {
  8804. // For Node.js before 0.9
  8805. installNextTickImplementation();
  8806. } else if (canUsePostMessage()) {
  8807. // For non-IE10 modern browsers
  8808. installPostMessageImplementation();
  8809. } else if (global.MessageChannel) {
  8810. // For web workers, where supported
  8811. installMessageChannelImplementation();
  8812. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  8813. // For IE 6–8
  8814. installReadyStateChangeImplementation();
  8815. } else {
  8816. // For older browsers
  8817. installSetTimeoutImplementation();
  8818. }
  8819. attachTo.setImmediate = setImmediate;
  8820. attachTo.clearImmediate = clearImmediate;
  8821. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  8822. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(4)))
  8823. /***/ }),
  8824. /* 8 */
  8825. /***/ (function(module, exports) {
  8826. /* (ignored) */
  8827. /***/ }),
  8828. /* 9 */
  8829. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8830. "use strict";
  8831. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  8832. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(2);
  8833. describe('Vue.url', function () {
  8834. it('data{/id}', function () {
  8835. expect(__WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].url('data{/id}')).toBe('data');
  8836. expect(__WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].url('data{/id}', {id: 1})).toBe('data/1');
  8837. });
  8838. it('data{/array}', function () {
  8839. expect(__WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].url('data{?array}')).toBe('data');
  8840. expect(__WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].url('data{?array}', {array: [1,2,3]})).toBe('data?array=1,2,3');
  8841. });
  8842. it('{+path}data', function () {
  8843. expect(__WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].url('{+path}data')).toBe('data');
  8844. expect(__WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].url('{+path}data', {path: 'path1/path2/'})).toBe('path1/path2/data');
  8845. });
  8846. it('{+base}data', function () {
  8847. __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].url.options.params.base = 'base/path/';
  8848. expect(__WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].url('{+base}data')).toBe('base/path/data');
  8849. });
  8850. });
  8851. /***/ }),
  8852. /* 10 */
  8853. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8854. "use strict";
  8855. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  8856. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(2);
  8857. describe('Vue.http', function () {
  8858. it('get("data/text.txt")', function (done) {
  8859. __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].http.get('data/text.txt').then(function (res) {
  8860. expect(res.ok).toBe(true);
  8861. expect(res.status).toBe(200);
  8862. expect(res.body).toBe('text');
  8863. expect(res.data).toBe(res.body);
  8864. expect(res.headers.get('Content-Type')).toBe('text/plain');
  8865. done();
  8866. });
  8867. });
  8868. it('get("data/valid.json")', function (done) {
  8869. __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].http.get('data/valid.json').then(function (res) {
  8870. expect(res.ok).toBe(true);
  8871. expect(res.status).toBe(200);
  8872. expect(typeof res.body).toBe('object');
  8873. expect(res.body.foo).toBe('bar');
  8874. done();
  8875. });
  8876. });
  8877. it('get("data/invalid.json")', function (done) {
  8878. __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].http.get('data/invalid.json').then(function (res) {
  8879. expect(res.ok).toBe(true);
  8880. expect(res.status).toBe(200);
  8881. expect(res.body).toBeNull();
  8882. done();
  8883. });
  8884. });
  8885. it('get("github.com/avatar")', function (done) {
  8886. __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].http.get('https://avatars1.githubusercontent.com/u/6128107', {responseType: 'blob'}).then(function (res) {
  8887. expect(res.ok).toBe(true);
  8888. expect(res.status).toBe(200);
  8889. expect(res.body instanceof Blob).toBe(true);
  8890. expect(res.body.type).toBe('image/png');
  8891. done();
  8892. });
  8893. });
  8894. it('get("cors-api.appspot.com")', function (done) {
  8895. __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].http.get('http://server.cors-api.appspot.com/server?id=1&enable=true').then(function (res) {
  8896. expect(res.ok).toBe(true);
  8897. expect(res.status).toBe(200);
  8898. expect(typeof res.body).toBe('object');
  8899. expect(res.body.shift().requestType).toBe('cors');
  8900. if (res.headers.get('Content-Type')) {
  8901. expect(res.headers.get('Content-Type')).toBe('application/json');
  8902. }
  8903. done();
  8904. });
  8905. });
  8906. it('jsonp("jsfiddle.net/jsonp")', function (done) {
  8907. __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */].http.jsonp('http://jsfiddle.net/echo/jsonp/', {params: {foo: 'bar'}}).then(function (res) {
  8908. expect(res.ok).toBe(true);
  8909. expect(res.status).toBe(200);
  8910. expect(typeof res.body).toBe('object');
  8911. expect(res.body.foo).toBe('bar');
  8912. done();
  8913. });
  8914. });
  8915. });
  8916. describe('this.$http', function () {
  8917. it('get("data/valid.json")', function (done) {
  8918. var vm = new __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */]({
  8919. created: function created() {
  8920. var this$1 = this;
  8921. this.$http.get('data/valid.json').then(function (res) {
  8922. expect(this$1).toBe(vm);
  8923. expect(res.ok).toBe(true);
  8924. expect(res.status).toBe(200);
  8925. expect(typeof res.body).toBe('object');
  8926. expect(res.body.foo).toBe('bar');
  8927. done();
  8928. });
  8929. }
  8930. });
  8931. });
  8932. it('get("data/valid.json") with timeout', function (done) {
  8933. var vm = new __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */]({
  8934. created: function created() {
  8935. var random = Math.random().toString(36).substr(2);
  8936. this.$http.get(("data/valid.json?" + random), {timeout: 1}).then(function (res) {
  8937. fail('Callback has been called');
  8938. }, function (res) {
  8939. expect(res.ok).toBe(false);
  8940. expect(res.status).toBe(0);
  8941. done();
  8942. });
  8943. }
  8944. });
  8945. });
  8946. it('get("data/valid.json") with abort()', function (done) {
  8947. var vm = new __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */]({
  8948. created: function created() {
  8949. var random = Math.random().toString(36).substr(2);
  8950. this.$http.get(("data/valid.json?" + random), {
  8951. before: function before(req) {
  8952. setTimeout(function () {
  8953. expect(typeof req.abort).toBe('function');
  8954. req.abort();
  8955. }, 0);
  8956. }
  8957. }).then(function (res) {
  8958. fail('Callback has been called');
  8959. }, function (res) {
  8960. done();
  8961. });
  8962. }
  8963. });
  8964. });
  8965. it('get("data/notfound.json") using catch()', function (done) {
  8966. var vm = new __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */]({
  8967. created: function created() {
  8968. var this$1 = this;
  8969. this.$http.get('data/notfound.json').catch(function (res) {
  8970. expect(this$1).toBe(vm);
  8971. expect(res.ok).toBe(false);
  8972. expect(res.status).toBe(404);
  8973. done();
  8974. });
  8975. }
  8976. });
  8977. });
  8978. });
  8979. /***/ }),
  8980. /* 11 */
  8981. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8982. "use strict";
  8983. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  8984. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(2);
  8985. describe('this.$resource', function () {
  8986. it('get({file: "valid.json"})', function (done) {
  8987. var vm = new __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */]({
  8988. created: function created() {
  8989. var resource = this.$resource('data{/file}');
  8990. resource.get({file: 'valid.json'}).then(function (res) {
  8991. expect(res.ok).toBe(true);
  8992. expect(res.status).toBe(200);
  8993. expect(res.data.foo).toBe('bar');
  8994. done();
  8995. });
  8996. }
  8997. });
  8998. });
  8999. it('save({file: "valid.json"}, {foo: "bar"})', function (done) {
  9000. var vm = new __WEBPACK_IMPORTED_MODULE_0_vue__["a" /* default */]({
  9001. created: function created() {
  9002. var resource = this.$resource('data{/file}');
  9003. resource.save({file: 'valid.json'}, {foo: 'bar'}).then(function (res) {
  9004. expect(res.ok).toBe(true);
  9005. expect(res.status).toBe(200);
  9006. expect(res.data.foo).toBe('bar');
  9007. done();
  9008. });
  9009. }
  9010. });
  9011. });
  9012. });
  9013. /***/ }),
  9014. /* 12 */
  9015. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9016. "use strict";
  9017. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  9018. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_promise__ = __webpack_require__(1);
  9019. describe('Vue.promise ' + (window.Promise !== undefined ? '(native)' : '(polyfill)'), function () {
  9020. it('then fulfill', function (done) {
  9021. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].resolve(1).then(function (value) {
  9022. expect(value).toBe(1);
  9023. done();
  9024. });
  9025. });
  9026. it('then reject', function (done) {
  9027. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].reject(1).then(undefined, function (value) {
  9028. expect(value).toBe(1);
  9029. done();
  9030. });
  9031. });
  9032. it('catch', function (done) {
  9033. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].reject(1).catch(function (value) {
  9034. expect(value).toBe(1);
  9035. done();
  9036. });
  9037. });
  9038. it('finally fulfill', function (done) {
  9039. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].resolve(1).finally(function (arg) {
  9040. expect(arg).toBe(undefined);
  9041. }).then(function (arg) {
  9042. expect(arg).toBe(1);
  9043. done();
  9044. });
  9045. });
  9046. it('finally reject', function (done) {
  9047. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].reject(1).finally(function (arg) {
  9048. expect(arg).toBe(undefined);
  9049. }).catch(function (arg) {
  9050. expect(arg).toBe(1);
  9051. done();
  9052. });
  9053. });
  9054. it('all', function (done) {
  9055. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].all([
  9056. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].resolve(1),
  9057. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].resolve(2)
  9058. ]).then(function (values) {
  9059. expect(values[0]).toBe(1);
  9060. expect(values[1]).toBe(2);
  9061. done();
  9062. });
  9063. });
  9064. it('duplicate', function (done) {
  9065. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].all([
  9066. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].resolve(1).then(function (value) {
  9067. expect(value).toBe(1);
  9068. }),
  9069. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].resolve(2).then(function (value) {
  9070. expect(value).toBe(2);
  9071. })
  9072. ]).then(done);
  9073. });
  9074. it('context', function (done) {
  9075. var context = {foo: 'bar'};
  9076. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].resolve().bind(context).then(function () {
  9077. expect(this).toBe(context);
  9078. done();
  9079. });
  9080. });
  9081. it('context chain fulfill', function (done) {
  9082. var context = {foo: 'bar'};
  9083. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].resolve().bind(context).catch(undefined).finally(function () {
  9084. expect(this).toBe(context);
  9085. }).then(function () {
  9086. expect(this).toBe(context);
  9087. done();
  9088. });
  9089. });
  9090. it('context chain reject', function (done) {
  9091. var context = {foo: 'bar'};
  9092. __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].reject().bind(context).catch(function () {
  9093. expect(this).toBe(context);
  9094. return __WEBPACK_IMPORTED_MODULE_0__src_promise__["a" /* default */].reject();
  9095. }).finally(function () {
  9096. expect(this).toBe(context);
  9097. }).catch(function () {
  9098. expect(this).toBe(context);
  9099. done();
  9100. });
  9101. });
  9102. });
  9103. /***/ })
  9104. /******/ ]);