vue.js 240 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374
  1. /*!
  2. * Vue.js v1.0.4
  3. * (c) 2015 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function webpackUniversalModuleDefinition(root, factory) {
  7. if(typeof exports === 'object' && typeof module === 'object')
  8. module.exports = factory();
  9. else if(typeof define === 'function' && define.amd)
  10. define([], factory);
  11. else if(typeof exports === 'object')
  12. exports["Vue"] = factory();
  13. else
  14. root["Vue"] = factory();
  15. })(this, function() {
  16. return /******/ (function(modules) { // webpackBootstrap
  17. /******/ // The module cache
  18. /******/ var installedModules = {};
  19. /******/ // The require function
  20. /******/ function __webpack_require__(moduleId) {
  21. /******/ // Check if module is in cache
  22. /******/ if(installedModules[moduleId])
  23. /******/ return installedModules[moduleId].exports;
  24. /******/ // Create a new module (and put it into the cache)
  25. /******/ var module = installedModules[moduleId] = {
  26. /******/ exports: {},
  27. /******/ id: moduleId,
  28. /******/ loaded: false
  29. /******/ };
  30. /******/ // Execute the module function
  31. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  32. /******/ // Flag the module as loaded
  33. /******/ module.loaded = true;
  34. /******/ // Return the exports of the module
  35. /******/ return module.exports;
  36. /******/ }
  37. /******/ // expose the modules object (__webpack_modules__)
  38. /******/ __webpack_require__.m = modules;
  39. /******/ // expose the module cache
  40. /******/ __webpack_require__.c = installedModules;
  41. /******/ // __webpack_public_path__
  42. /******/ __webpack_require__.p = "";
  43. /******/ // Load entry module and return exports
  44. /******/ return __webpack_require__(0);
  45. /******/ })
  46. /************************************************************************/
  47. /******/ ([
  48. /* 0 */
  49. /***/ function(module, exports, __webpack_require__) {
  50. var _ = __webpack_require__(1)
  51. var extend = _.extend
  52. /**
  53. * The exposed Vue constructor.
  54. *
  55. * API conventions:
  56. * - public API methods/properties are prefiexed with `$`
  57. * - internal methods/properties are prefixed with `_`
  58. * - non-prefixed properties are assumed to be proxied user
  59. * data.
  60. *
  61. * @constructor
  62. * @param {Object} [options]
  63. * @public
  64. */
  65. function Vue (options) {
  66. this._init(options)
  67. }
  68. /**
  69. * Mixin global API
  70. */
  71. extend(Vue, __webpack_require__(13))
  72. /**
  73. * Vue and every constructor that extends Vue has an
  74. * associated options object, which can be accessed during
  75. * compilation steps as `this.constructor.options`.
  76. *
  77. * These can be seen as the default options of every
  78. * Vue instance.
  79. */
  80. Vue.options = {
  81. replace: true,
  82. directives: __webpack_require__(16),
  83. elementDirectives: __webpack_require__(50),
  84. filters: __webpack_require__(53),
  85. transitions: {},
  86. components: {},
  87. partials: {}
  88. }
  89. /**
  90. * Build up the prototype
  91. */
  92. var p = Vue.prototype
  93. /**
  94. * $data has a setter which does a bunch of
  95. * teardown/setup work
  96. */
  97. Object.defineProperty(p, '$data', {
  98. get: function () {
  99. return this._data
  100. },
  101. set: function (newData) {
  102. if (newData !== this._data) {
  103. this._setData(newData)
  104. }
  105. }
  106. })
  107. /**
  108. * Mixin internal instance methods
  109. */
  110. extend(p, __webpack_require__(55))
  111. extend(p, __webpack_require__(56))
  112. extend(p, __webpack_require__(57))
  113. extend(p, __webpack_require__(60))
  114. extend(p, __webpack_require__(62))
  115. /**
  116. * Mixin public API methods
  117. */
  118. extend(p, __webpack_require__(63))
  119. extend(p, __webpack_require__(64))
  120. extend(p, __webpack_require__(65))
  121. extend(p, __webpack_require__(66))
  122. Vue.version = '1.0.4'
  123. module.exports = _.Vue = Vue
  124. /* istanbul ignore if */
  125. if (true) {
  126. if (_.inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__) {
  127. window.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit('init', Vue)
  128. }
  129. }
  130. /***/ },
  131. /* 1 */
  132. /***/ function(module, exports, __webpack_require__) {
  133. var lang = __webpack_require__(2)
  134. var extend = lang.extend
  135. extend(exports, lang)
  136. extend(exports, __webpack_require__(3))
  137. extend(exports, __webpack_require__(4))
  138. extend(exports, __webpack_require__(10))
  139. extend(exports, __webpack_require__(11))
  140. extend(exports, __webpack_require__(12))
  141. /***/ },
  142. /* 2 */
  143. /***/ function(module, exports) {
  144. /**
  145. * Set a property on an object. Adds the new property and
  146. * triggers change notification if the property doesn't
  147. * already exist.
  148. *
  149. * @param {Object} obj
  150. * @param {String} key
  151. * @param {*} val
  152. * @public
  153. */
  154. exports.set = function set (obj, key, val) {
  155. if (obj.hasOwnProperty(key)) {
  156. obj[key] = val
  157. return
  158. }
  159. if (obj._isVue) {
  160. set(obj._data, key, val)
  161. return
  162. }
  163. var ob = obj.__ob__
  164. if (!ob) {
  165. obj[key] = val
  166. return
  167. }
  168. ob.convert(key, val)
  169. ob.dep.notify()
  170. if (ob.vms) {
  171. var i = ob.vms.length
  172. while (i--) {
  173. var vm = ob.vms[i]
  174. vm._proxy(key)
  175. vm._digest()
  176. }
  177. }
  178. }
  179. /**
  180. * Delete a property and trigger change if necessary.
  181. *
  182. * @param {Object} obj
  183. * @param {String} key
  184. */
  185. exports.delete = function (obj, key) {
  186. if (!obj.hasOwnProperty(key)) {
  187. return
  188. }
  189. delete obj[key]
  190. var ob = obj.__ob__
  191. if (!ob) {
  192. return
  193. }
  194. ob.dep.notify()
  195. if (ob.vms) {
  196. var i = ob.vms.length
  197. while (i--) {
  198. var vm = ob.vms[i]
  199. vm._unproxy(key)
  200. vm._digest()
  201. }
  202. }
  203. }
  204. /**
  205. * Check if an expression is a literal value.
  206. *
  207. * @param {String} exp
  208. * @return {Boolean}
  209. */
  210. var literalValueRE = /^\s?(true|false|[\d\.]+|'[^']*'|"[^"]*")\s?$/
  211. exports.isLiteral = function (exp) {
  212. return literalValueRE.test(exp)
  213. }
  214. /**
  215. * Check if a string starts with $ or _
  216. *
  217. * @param {String} str
  218. * @return {Boolean}
  219. */
  220. exports.isReserved = function (str) {
  221. var c = (str + '').charCodeAt(0)
  222. return c === 0x24 || c === 0x5F
  223. }
  224. /**
  225. * Guard text output, make sure undefined outputs
  226. * empty string
  227. *
  228. * @param {*} value
  229. * @return {String}
  230. */
  231. exports.toString = function (value) {
  232. return value == null
  233. ? ''
  234. : value.toString()
  235. }
  236. /**
  237. * Check and convert possible numeric strings to numbers
  238. * before settings back to data
  239. *
  240. * @param {*} value
  241. * @return {*|Number}
  242. */
  243. exports.toNumber = function (value) {
  244. if (typeof value !== 'string') {
  245. return value
  246. } else {
  247. var parsed = Number(value)
  248. return isNaN(parsed)
  249. ? value
  250. : parsed
  251. }
  252. }
  253. /**
  254. * Convert string boolean literals into real booleans.
  255. *
  256. * @param {*} value
  257. * @return {*|Boolean}
  258. */
  259. exports.toBoolean = function (value) {
  260. return value === 'true'
  261. ? true
  262. : value === 'false'
  263. ? false
  264. : value
  265. }
  266. /**
  267. * Strip quotes from a string
  268. *
  269. * @param {String} str
  270. * @return {String | false}
  271. */
  272. exports.stripQuotes = function (str) {
  273. var a = str.charCodeAt(0)
  274. var b = str.charCodeAt(str.length - 1)
  275. return a === b && (a === 0x22 || a === 0x27)
  276. ? str.slice(1, -1)
  277. : str
  278. }
  279. /**
  280. * Camelize a hyphen-delmited string.
  281. *
  282. * @param {String} str
  283. * @return {String}
  284. */
  285. var camelizeRE = /-(\w)/g
  286. exports.camelize = function (str) {
  287. return str.replace(camelizeRE, toUpper)
  288. }
  289. function toUpper (_, c) {
  290. return c ? c.toUpperCase() : ''
  291. }
  292. /**
  293. * Hyphenate a camelCase string.
  294. *
  295. * @param {String} str
  296. * @return {String}
  297. */
  298. var hyphenateRE = /([a-z\d])([A-Z])/g
  299. exports.hyphenate = function (str) {
  300. return str
  301. .replace(hyphenateRE, '$1-$2')
  302. .toLowerCase()
  303. }
  304. /**
  305. * Converts hyphen/underscore/slash delimitered names into
  306. * camelized classNames.
  307. *
  308. * e.g. my-component => MyComponent
  309. * some_else => SomeElse
  310. * some/comp => SomeComp
  311. *
  312. * @param {String} str
  313. * @return {String}
  314. */
  315. var classifyRE = /(?:^|[-_\/])(\w)/g
  316. exports.classify = function (str) {
  317. return str.replace(classifyRE, toUpper)
  318. }
  319. /**
  320. * Simple bind, faster than native
  321. *
  322. * @param {Function} fn
  323. * @param {Object} ctx
  324. * @return {Function}
  325. */
  326. exports.bind = function (fn, ctx) {
  327. return function (a) {
  328. var l = arguments.length
  329. return l
  330. ? l > 1
  331. ? fn.apply(ctx, arguments)
  332. : fn.call(ctx, a)
  333. : fn.call(ctx)
  334. }
  335. }
  336. /**
  337. * Convert an Array-like object to a real Array.
  338. *
  339. * @param {Array-like} list
  340. * @param {Number} [start] - start index
  341. * @return {Array}
  342. */
  343. exports.toArray = function (list, start) {
  344. start = start || 0
  345. var i = list.length - start
  346. var ret = new Array(i)
  347. while (i--) {
  348. ret[i] = list[i + start]
  349. }
  350. return ret
  351. }
  352. /**
  353. * Mix properties into target object.
  354. *
  355. * @param {Object} to
  356. * @param {Object} from
  357. */
  358. exports.extend = function (to, from) {
  359. var keys = Object.keys(from)
  360. var i = keys.length
  361. while (i--) {
  362. to[keys[i]] = from[keys[i]]
  363. }
  364. return to
  365. }
  366. /**
  367. * Quick object check - this is primarily used to tell
  368. * Objects from primitive values when we know the value
  369. * is a JSON-compliant type.
  370. *
  371. * @param {*} obj
  372. * @return {Boolean}
  373. */
  374. exports.isObject = function (obj) {
  375. return obj !== null && typeof obj === 'object'
  376. }
  377. /**
  378. * Strict object type check. Only returns true
  379. * for plain JavaScript objects.
  380. *
  381. * @param {*} obj
  382. * @return {Boolean}
  383. */
  384. var toString = Object.prototype.toString
  385. var OBJECT_STRING = '[object Object]'
  386. exports.isPlainObject = function (obj) {
  387. return toString.call(obj) === OBJECT_STRING
  388. }
  389. /**
  390. * Array type check.
  391. *
  392. * @param {*} obj
  393. * @return {Boolean}
  394. */
  395. exports.isArray = Array.isArray
  396. /**
  397. * Define a non-enumerable property
  398. *
  399. * @param {Object} obj
  400. * @param {String} key
  401. * @param {*} val
  402. * @param {Boolean} [enumerable]
  403. */
  404. exports.define = function (obj, key, val, enumerable) {
  405. Object.defineProperty(obj, key, {
  406. value: val,
  407. enumerable: !!enumerable,
  408. writable: true,
  409. configurable: true
  410. })
  411. }
  412. /**
  413. * Debounce a function so it only gets called after the
  414. * input stops arriving after the given wait period.
  415. *
  416. * @param {Function} func
  417. * @param {Number} wait
  418. * @return {Function} - the debounced function
  419. */
  420. exports.debounce = function (func, wait) {
  421. var timeout, args, context, timestamp, result
  422. var later = function () {
  423. var last = Date.now() - timestamp
  424. if (last < wait && last >= 0) {
  425. timeout = setTimeout(later, wait - last)
  426. } else {
  427. timeout = null
  428. result = func.apply(context, args)
  429. if (!timeout) context = args = null
  430. }
  431. }
  432. return function () {
  433. context = this
  434. args = arguments
  435. timestamp = Date.now()
  436. if (!timeout) {
  437. timeout = setTimeout(later, wait)
  438. }
  439. return result
  440. }
  441. }
  442. /**
  443. * Manual indexOf because it's slightly faster than
  444. * native.
  445. *
  446. * @param {Array} arr
  447. * @param {*} obj
  448. */
  449. exports.indexOf = function (arr, obj) {
  450. var i = arr.length
  451. while (i--) {
  452. if (arr[i] === obj) return i
  453. }
  454. return -1
  455. }
  456. /**
  457. * Make a cancellable version of an async callback.
  458. *
  459. * @param {Function} fn
  460. * @return {Function}
  461. */
  462. exports.cancellable = function (fn) {
  463. var cb = function () {
  464. if (!cb.cancelled) {
  465. return fn.apply(this, arguments)
  466. }
  467. }
  468. cb.cancel = function () {
  469. cb.cancelled = true
  470. }
  471. return cb
  472. }
  473. /**
  474. * Check if two values are loosely equal - that is,
  475. * if they are plain objects, do they have the same shape?
  476. *
  477. * @param {*} a
  478. * @param {*} b
  479. * @return {Boolean}
  480. */
  481. exports.looseEqual = function (a, b) {
  482. /* eslint-disable eqeqeq */
  483. return a == b || (
  484. exports.isObject(a) && exports.isObject(b)
  485. ? JSON.stringify(a) === JSON.stringify(b)
  486. : false
  487. )
  488. /* eslint-enable eqeqeq */
  489. }
  490. /***/ },
  491. /* 3 */
  492. /***/ function(module, exports) {
  493. // can we use __proto__?
  494. exports.hasProto = '__proto__' in {}
  495. // Browser environment sniffing
  496. var inBrowser = exports.inBrowser =
  497. typeof window !== 'undefined' &&
  498. Object.prototype.toString.call(window) !== '[object Object]'
  499. exports.isIE9 =
  500. inBrowser &&
  501. navigator.userAgent.toLowerCase().indexOf('msie 9.0') > 0
  502. exports.isAndroid =
  503. inBrowser &&
  504. navigator.userAgent.toLowerCase().indexOf('android') > 0
  505. // Transition property/event sniffing
  506. if (inBrowser && !exports.isIE9) {
  507. var isWebkitTrans =
  508. window.ontransitionend === undefined &&
  509. window.onwebkittransitionend !== undefined
  510. var isWebkitAnim =
  511. window.onanimationend === undefined &&
  512. window.onwebkitanimationend !== undefined
  513. exports.transitionProp = isWebkitTrans
  514. ? 'WebkitTransition'
  515. : 'transition'
  516. exports.transitionEndEvent = isWebkitTrans
  517. ? 'webkitTransitionEnd'
  518. : 'transitionend'
  519. exports.animationProp = isWebkitAnim
  520. ? 'WebkitAnimation'
  521. : 'animation'
  522. exports.animationEndEvent = isWebkitAnim
  523. ? 'webkitAnimationEnd'
  524. : 'animationend'
  525. }
  526. /**
  527. * Defer a task to execute it asynchronously. Ideally this
  528. * should be executed as a microtask, so we leverage
  529. * MutationObserver if it's available, and fallback to
  530. * setTimeout(0).
  531. *
  532. * @param {Function} cb
  533. * @param {Object} ctx
  534. */
  535. exports.nextTick = (function () {
  536. var callbacks = []
  537. var pending = false
  538. var timerFunc
  539. function nextTickHandler () {
  540. pending = false
  541. var copies = callbacks.slice(0)
  542. callbacks = []
  543. for (var i = 0; i < copies.length; i++) {
  544. copies[i]()
  545. }
  546. }
  547. /* istanbul ignore if */
  548. if (typeof MutationObserver !== 'undefined') {
  549. var counter = 1
  550. var observer = new MutationObserver(nextTickHandler)
  551. var textNode = document.createTextNode(counter)
  552. observer.observe(textNode, {
  553. characterData: true
  554. })
  555. timerFunc = function () {
  556. counter = (counter + 1) % 2
  557. textNode.data = counter
  558. }
  559. } else {
  560. timerFunc = setTimeout
  561. }
  562. return function (cb, ctx) {
  563. var func = ctx
  564. ? function () { cb.call(ctx) }
  565. : cb
  566. callbacks.push(func)
  567. if (pending) return
  568. pending = true
  569. timerFunc(nextTickHandler, 0)
  570. }
  571. })()
  572. /***/ },
  573. /* 4 */
  574. /***/ function(module, exports, __webpack_require__) {
  575. var _ = __webpack_require__(1)
  576. var config = __webpack_require__(5)
  577. var transition = __webpack_require__(9)
  578. /**
  579. * Query an element selector if it's not an element already.
  580. *
  581. * @param {String|Element} el
  582. * @return {Element}
  583. */
  584. exports.query = function (el) {
  585. if (typeof el === 'string') {
  586. var selector = el
  587. el = document.querySelector(el)
  588. if (!el) {
  589. ("development") !== 'production' && _.warn(
  590. 'Cannot find element: ' + selector
  591. )
  592. }
  593. }
  594. return el
  595. }
  596. /**
  597. * Check if a node is in the document.
  598. * Note: document.documentElement.contains should work here
  599. * but always returns false for comment nodes in phantomjs,
  600. * making unit tests difficult. This is fixed by doing the
  601. * contains() check on the node's parentNode instead of
  602. * the node itself.
  603. *
  604. * @param {Node} node
  605. * @return {Boolean}
  606. */
  607. exports.inDoc = function (node) {
  608. var doc = document.documentElement
  609. var parent = node && node.parentNode
  610. return doc === node ||
  611. doc === parent ||
  612. !!(parent && parent.nodeType === 1 && (doc.contains(parent)))
  613. }
  614. /**
  615. * Get and remove an attribute from a node.
  616. *
  617. * @param {Node} node
  618. * @param {String} attr
  619. */
  620. exports.attr = function (node, attr) {
  621. var val = node.getAttribute(attr)
  622. if (val !== null) {
  623. node.removeAttribute(attr)
  624. }
  625. return val
  626. }
  627. /**
  628. * Get an attribute with colon or v-bind: prefix.
  629. *
  630. * @param {Node} node
  631. * @param {String} name
  632. * @return {String|null}
  633. */
  634. exports.getBindAttr = function (node, name) {
  635. var val = exports.attr(node, ':' + name)
  636. if (val === null) {
  637. val = exports.attr(node, 'v-bind:' + name)
  638. }
  639. return val
  640. }
  641. /**
  642. * Insert el before target
  643. *
  644. * @param {Element} el
  645. * @param {Element} target
  646. */
  647. exports.before = function (el, target) {
  648. target.parentNode.insertBefore(el, target)
  649. }
  650. /**
  651. * Insert el after target
  652. *
  653. * @param {Element} el
  654. * @param {Element} target
  655. */
  656. exports.after = function (el, target) {
  657. if (target.nextSibling) {
  658. exports.before(el, target.nextSibling)
  659. } else {
  660. target.parentNode.appendChild(el)
  661. }
  662. }
  663. /**
  664. * Remove el from DOM
  665. *
  666. * @param {Element} el
  667. */
  668. exports.remove = function (el) {
  669. el.parentNode.removeChild(el)
  670. }
  671. /**
  672. * Prepend el to target
  673. *
  674. * @param {Element} el
  675. * @param {Element} target
  676. */
  677. exports.prepend = function (el, target) {
  678. if (target.firstChild) {
  679. exports.before(el, target.firstChild)
  680. } else {
  681. target.appendChild(el)
  682. }
  683. }
  684. /**
  685. * Replace target with el
  686. *
  687. * @param {Element} target
  688. * @param {Element} el
  689. */
  690. exports.replace = function (target, el) {
  691. var parent = target.parentNode
  692. if (parent) {
  693. parent.replaceChild(el, target)
  694. }
  695. }
  696. /**
  697. * Add event listener shorthand.
  698. *
  699. * @param {Element} el
  700. * @param {String} event
  701. * @param {Function} cb
  702. */
  703. exports.on = function (el, event, cb) {
  704. el.addEventListener(event, cb)
  705. }
  706. /**
  707. * Remove event listener shorthand.
  708. *
  709. * @param {Element} el
  710. * @param {String} event
  711. * @param {Function} cb
  712. */
  713. exports.off = function (el, event, cb) {
  714. el.removeEventListener(event, cb)
  715. }
  716. /**
  717. * Add class with compatibility for IE & SVG
  718. *
  719. * @param {Element} el
  720. * @param {Strong} cls
  721. */
  722. exports.addClass = function (el, cls) {
  723. if (el.classList) {
  724. el.classList.add(cls)
  725. } else {
  726. var cur = ' ' + (el.getAttribute('class') || '') + ' '
  727. if (cur.indexOf(' ' + cls + ' ') < 0) {
  728. el.setAttribute('class', (cur + cls).trim())
  729. }
  730. }
  731. }
  732. /**
  733. * Remove class with compatibility for IE & SVG
  734. *
  735. * @param {Element} el
  736. * @param {Strong} cls
  737. */
  738. exports.removeClass = function (el, cls) {
  739. if (el.classList) {
  740. el.classList.remove(cls)
  741. } else {
  742. var cur = ' ' + (el.getAttribute('class') || '') + ' '
  743. var tar = ' ' + cls + ' '
  744. while (cur.indexOf(tar) >= 0) {
  745. cur = cur.replace(tar, ' ')
  746. }
  747. el.setAttribute('class', cur.trim())
  748. }
  749. if (!el.className) {
  750. el.removeAttribute('class')
  751. }
  752. }
  753. /**
  754. * Extract raw content inside an element into a temporary
  755. * container div
  756. *
  757. * @param {Element} el
  758. * @param {Boolean} asFragment
  759. * @return {Element}
  760. */
  761. exports.extractContent = function (el, asFragment) {
  762. var child
  763. var rawContent
  764. /* istanbul ignore if */
  765. if (
  766. exports.isTemplate(el) &&
  767. el.content instanceof DocumentFragment
  768. ) {
  769. el = el.content
  770. }
  771. if (el.hasChildNodes()) {
  772. exports.trimNode(el)
  773. rawContent = asFragment
  774. ? document.createDocumentFragment()
  775. : document.createElement('div')
  776. /* eslint-disable no-cond-assign */
  777. while (child = el.firstChild) {
  778. /* eslint-enable no-cond-assign */
  779. rawContent.appendChild(child)
  780. }
  781. }
  782. return rawContent
  783. }
  784. /**
  785. * Trim possible empty head/tail textNodes inside a parent.
  786. *
  787. * @param {Node} node
  788. */
  789. exports.trimNode = function (node) {
  790. trim(node, node.firstChild)
  791. trim(node, node.lastChild)
  792. }
  793. function trim (parent, node) {
  794. if (node && node.nodeType === 3 && !node.data.trim()) {
  795. parent.removeChild(node)
  796. }
  797. }
  798. /**
  799. * Check if an element is a template tag.
  800. * Note if the template appears inside an SVG its tagName
  801. * will be in lowercase.
  802. *
  803. * @param {Element} el
  804. */
  805. exports.isTemplate = function (el) {
  806. return el.tagName &&
  807. el.tagName.toLowerCase() === 'template'
  808. }
  809. /**
  810. * Create an "anchor" for performing dom insertion/removals.
  811. * This is used in a number of scenarios:
  812. * - fragment instance
  813. * - v-html
  814. * - v-if
  815. * - v-for
  816. * - component
  817. *
  818. * @param {String} content
  819. * @param {Boolean} persist - IE trashes empty textNodes on
  820. * cloneNode(true), so in certain
  821. * cases the anchor needs to be
  822. * non-empty to be persisted in
  823. * templates.
  824. * @return {Comment|Text}
  825. */
  826. exports.createAnchor = function (content, persist) {
  827. return config.debug
  828. ? document.createComment(content)
  829. : document.createTextNode(persist ? ' ' : '')
  830. }
  831. /**
  832. * Find a component ref attribute that starts with $.
  833. *
  834. * @param {Element} node
  835. * @return {String|undefined}
  836. */
  837. var refRE = /^v-ref:/
  838. exports.findRef = function (node) {
  839. if (node.hasAttributes()) {
  840. var attrs = node.attributes
  841. for (var i = 0, l = attrs.length; i < l; i++) {
  842. var name = attrs[i].name
  843. if (refRE.test(name)) {
  844. node.removeAttribute(name)
  845. return _.camelize(name.replace(refRE, ''))
  846. }
  847. }
  848. }
  849. }
  850. /**
  851. * Map a function to a range of nodes .
  852. *
  853. * @param {Node} node
  854. * @param {Node} end
  855. * @param {Function} op
  856. */
  857. exports.mapNodeRange = function (node, end, op) {
  858. var next
  859. while (node !== end) {
  860. next = node.nextSibling
  861. op(node)
  862. node = next
  863. }
  864. op(end)
  865. }
  866. /**
  867. * Remove a range of nodes with transition, store
  868. * the nodes in a fragment with correct ordering,
  869. * and call callback when done.
  870. *
  871. * @param {Node} start
  872. * @param {Node} end
  873. * @param {Vue} vm
  874. * @param {DocumentFragment} frag
  875. * @param {Function} cb
  876. */
  877. exports.removeNodeRange = function (start, end, vm, frag, cb) {
  878. var done = false
  879. var removed = 0
  880. var nodes = []
  881. exports.mapNodeRange(start, end, function (node) {
  882. if (node === end) done = true
  883. nodes.push(node)
  884. transition.remove(node, vm, onRemoved)
  885. })
  886. function onRemoved () {
  887. removed++
  888. if (done && removed >= nodes.length) {
  889. for (var i = 0; i < nodes.length; i++) {
  890. frag.appendChild(nodes[i])
  891. }
  892. cb && cb()
  893. }
  894. }
  895. }
  896. /***/ },
  897. /* 5 */
  898. /***/ function(module, exports, __webpack_require__) {
  899. module.exports = {
  900. /**
  901. * Whether to print debug messages.
  902. * Also enables stack trace for warnings.
  903. *
  904. * @type {Boolean}
  905. */
  906. debug: false,
  907. /**
  908. * Whether to suppress warnings.
  909. *
  910. * @type {Boolean}
  911. */
  912. silent: false,
  913. /**
  914. * Whether to use async rendering.
  915. */
  916. async: true,
  917. /**
  918. * Whether to warn against errors caught when evaluating
  919. * expressions.
  920. */
  921. warnExpressionErrors: true,
  922. /**
  923. * Internal flag to indicate the delimiters have been
  924. * changed.
  925. *
  926. * @type {Boolean}
  927. */
  928. _delimitersChanged: true,
  929. /**
  930. * List of asset types that a component can own.
  931. *
  932. * @type {Array}
  933. */
  934. _assetTypes: [
  935. 'component',
  936. 'directive',
  937. 'elementDirective',
  938. 'filter',
  939. 'transition',
  940. 'partial'
  941. ],
  942. /**
  943. * prop binding modes
  944. */
  945. _propBindingModes: {
  946. ONE_WAY: 0,
  947. TWO_WAY: 1,
  948. ONE_TIME: 2
  949. },
  950. /**
  951. * Max circular updates allowed in a batcher flush cycle.
  952. */
  953. _maxUpdateCount: 100
  954. }
  955. /**
  956. * Interpolation delimiters. Changing these would trigger
  957. * the text parser to re-compile the regular expressions.
  958. *
  959. * @type {Array<String>}
  960. */
  961. var delimiters = ['{{', '}}']
  962. var unsafeDelimiters = ['{{{', '}}}']
  963. var textParser = __webpack_require__(6)
  964. Object.defineProperty(module.exports, 'delimiters', {
  965. get: function () {
  966. return delimiters
  967. },
  968. set: function (val) {
  969. delimiters = val
  970. textParser.compileRegex()
  971. }
  972. })
  973. Object.defineProperty(module.exports, 'unsafeDelimiters', {
  974. get: function () {
  975. return unsafeDelimiters
  976. },
  977. set: function (val) {
  978. unsafeDelimiters = val
  979. textParser.compileRegex()
  980. }
  981. })
  982. /***/ },
  983. /* 6 */
  984. /***/ function(module, exports, __webpack_require__) {
  985. var Cache = __webpack_require__(7)
  986. var config = __webpack_require__(5)
  987. var dirParser = __webpack_require__(8)
  988. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g
  989. var cache, tagRE, htmlRE
  990. /**
  991. * Escape a string so it can be used in a RegExp
  992. * constructor.
  993. *
  994. * @param {String} str
  995. */
  996. function escapeRegex (str) {
  997. return str.replace(regexEscapeRE, '\\$&')
  998. }
  999. exports.compileRegex = function () {
  1000. var open = escapeRegex(config.delimiters[0])
  1001. var close = escapeRegex(config.delimiters[1])
  1002. var unsafeOpen = escapeRegex(config.unsafeDelimiters[0])
  1003. var unsafeClose = escapeRegex(config.unsafeDelimiters[1])
  1004. tagRE = new RegExp(
  1005. unsafeOpen + '(.+?)' + unsafeClose + '|' +
  1006. open + '(.+?)' + close,
  1007. 'g'
  1008. )
  1009. htmlRE = new RegExp(
  1010. '^' + unsafeOpen + '.*' + unsafeClose + '$'
  1011. )
  1012. // reset cache
  1013. cache = new Cache(1000)
  1014. }
  1015. /**
  1016. * Parse a template text string into an array of tokens.
  1017. *
  1018. * @param {String} text
  1019. * @return {Array<Object> | null}
  1020. * - {String} type
  1021. * - {String} value
  1022. * - {Boolean} [html]
  1023. * - {Boolean} [oneTime]
  1024. */
  1025. exports.parse = function (text) {
  1026. if (!cache) {
  1027. exports.compileRegex()
  1028. }
  1029. var hit = cache.get(text)
  1030. if (hit) {
  1031. return hit
  1032. }
  1033. text = text.replace(/\n/g, '')
  1034. if (!tagRE.test(text)) {
  1035. return null
  1036. }
  1037. var tokens = []
  1038. var lastIndex = tagRE.lastIndex = 0
  1039. var match, index, html, value, first, oneTime
  1040. /* eslint-disable no-cond-assign */
  1041. while (match = tagRE.exec(text)) {
  1042. /* eslint-enable no-cond-assign */
  1043. index = match.index
  1044. // push text token
  1045. if (index > lastIndex) {
  1046. tokens.push({
  1047. value: text.slice(lastIndex, index)
  1048. })
  1049. }
  1050. // tag token
  1051. html = htmlRE.test(match[0])
  1052. value = html ? match[1] : match[2]
  1053. first = value.charCodeAt(0)
  1054. oneTime = first === 42 // *
  1055. value = oneTime
  1056. ? value.slice(1)
  1057. : value
  1058. tokens.push({
  1059. tag: true,
  1060. value: value.trim(),
  1061. html: html,
  1062. oneTime: oneTime
  1063. })
  1064. lastIndex = index + match[0].length
  1065. }
  1066. if (lastIndex < text.length) {
  1067. tokens.push({
  1068. value: text.slice(lastIndex)
  1069. })
  1070. }
  1071. cache.put(text, tokens)
  1072. return tokens
  1073. }
  1074. /**
  1075. * Format a list of tokens into an expression.
  1076. * e.g. tokens parsed from 'a {{b}} c' can be serialized
  1077. * into one single expression as '"a " + b + " c"'.
  1078. *
  1079. * @param {Array} tokens
  1080. * @return {String}
  1081. */
  1082. exports.tokensToExp = function (tokens) {
  1083. if (tokens.length > 1) {
  1084. return tokens.map(function (token) {
  1085. return formatToken(token)
  1086. }).join('+')
  1087. } else {
  1088. return formatToken(tokens[0], true)
  1089. }
  1090. }
  1091. /**
  1092. * Format a single token.
  1093. *
  1094. * @param {Object} token
  1095. * @param {Boolean} single
  1096. * @return {String}
  1097. */
  1098. function formatToken (token, single) {
  1099. return token.tag
  1100. ? inlineFilters(token.value, single)
  1101. : '"' + token.value + '"'
  1102. }
  1103. /**
  1104. * For an attribute with multiple interpolation tags,
  1105. * e.g. attr="some-{{thing | filter}}", in order to combine
  1106. * the whole thing into a single watchable expression, we
  1107. * have to inline those filters. This function does exactly
  1108. * that. This is a bit hacky but it avoids heavy changes
  1109. * to directive parser and watcher mechanism.
  1110. *
  1111. * @param {String} exp
  1112. * @param {Boolean} single
  1113. * @return {String}
  1114. */
  1115. var filterRE = /[^|]\|[^|]/
  1116. function inlineFilters (exp, single) {
  1117. if (!filterRE.test(exp)) {
  1118. return single
  1119. ? exp
  1120. : '(' + exp + ')'
  1121. } else {
  1122. var dir = dirParser.parse(exp)
  1123. if (!dir.filters) {
  1124. return '(' + exp + ')'
  1125. } else {
  1126. return 'this._applyFilters(' +
  1127. dir.expression + // value
  1128. ',null,' + // oldValue (null for read)
  1129. JSON.stringify(dir.filters) + // filter descriptors
  1130. ',false)' // write?
  1131. }
  1132. }
  1133. }
  1134. /***/ },
  1135. /* 7 */
  1136. /***/ function(module, exports) {
  1137. /**
  1138. * A doubly linked list-based Least Recently Used (LRU)
  1139. * cache. Will keep most recently used items while
  1140. * discarding least recently used items when its limit is
  1141. * reached. This is a bare-bone version of
  1142. * Rasmus Andersson's js-lru:
  1143. *
  1144. * https://github.com/rsms/js-lru
  1145. *
  1146. * @param {Number} limit
  1147. * @constructor
  1148. */
  1149. function Cache (limit) {
  1150. this.size = 0
  1151. this.limit = limit
  1152. this.head = this.tail = undefined
  1153. this._keymap = Object.create(null)
  1154. }
  1155. var p = Cache.prototype
  1156. /**
  1157. * Put <value> into the cache associated with <key>.
  1158. * Returns the entry which was removed to make room for
  1159. * the new entry. Otherwise undefined is returned.
  1160. * (i.e. if there was enough room already).
  1161. *
  1162. * @param {String} key
  1163. * @param {*} value
  1164. * @return {Entry|undefined}
  1165. */
  1166. p.put = function (key, value) {
  1167. var entry = {
  1168. key: key,
  1169. value: value
  1170. }
  1171. this._keymap[key] = entry
  1172. if (this.tail) {
  1173. this.tail.newer = entry
  1174. entry.older = this.tail
  1175. } else {
  1176. this.head = entry
  1177. }
  1178. this.tail = entry
  1179. if (this.size === this.limit) {
  1180. return this.shift()
  1181. } else {
  1182. this.size++
  1183. }
  1184. }
  1185. /**
  1186. * Purge the least recently used (oldest) entry from the
  1187. * cache. Returns the removed entry or undefined if the
  1188. * cache was empty.
  1189. */
  1190. p.shift = function () {
  1191. var entry = this.head
  1192. if (entry) {
  1193. this.head = this.head.newer
  1194. this.head.older = undefined
  1195. entry.newer = entry.older = undefined
  1196. this._keymap[entry.key] = undefined
  1197. }
  1198. return entry
  1199. }
  1200. /**
  1201. * Get and register recent use of <key>. Returns the value
  1202. * associated with <key> or undefined if not in cache.
  1203. *
  1204. * @param {String} key
  1205. * @param {Boolean} returnEntry
  1206. * @return {Entry|*}
  1207. */
  1208. p.get = function (key, returnEntry) {
  1209. var entry = this._keymap[key]
  1210. if (entry === undefined) return
  1211. if (entry === this.tail) {
  1212. return returnEntry
  1213. ? entry
  1214. : entry.value
  1215. }
  1216. // HEAD--------------TAIL
  1217. // <.older .newer>
  1218. // <--- add direction --
  1219. // A B C <D> E
  1220. if (entry.newer) {
  1221. if (entry === this.head) {
  1222. this.head = entry.newer
  1223. }
  1224. entry.newer.older = entry.older // C <-- E.
  1225. }
  1226. if (entry.older) {
  1227. entry.older.newer = entry.newer // C. --> E
  1228. }
  1229. entry.newer = undefined // D --x
  1230. entry.older = this.tail // D. --> E
  1231. if (this.tail) {
  1232. this.tail.newer = entry // E. <-- D
  1233. }
  1234. this.tail = entry
  1235. return returnEntry
  1236. ? entry
  1237. : entry.value
  1238. }
  1239. module.exports = Cache
  1240. /***/ },
  1241. /* 8 */
  1242. /***/ function(module, exports, __webpack_require__) {
  1243. var _ = __webpack_require__(1)
  1244. var Cache = __webpack_require__(7)
  1245. var cache = new Cache(1000)
  1246. var filterTokenRE = /[^\s'"]+|'[^']*'|"[^"]*"/g
  1247. var reservedArgRE = /^in$|^-?\d+/
  1248. /**
  1249. * Parser state
  1250. */
  1251. var str, dir
  1252. var c, i, l, lastFilterIndex
  1253. var inSingle, inDouble, curly, square, paren
  1254. /**
  1255. * Push a filter to the current directive object
  1256. */
  1257. function pushFilter () {
  1258. var exp = str.slice(lastFilterIndex, i).trim()
  1259. var filter
  1260. if (exp) {
  1261. filter = {}
  1262. var tokens = exp.match(filterTokenRE)
  1263. filter.name = tokens[0]
  1264. if (tokens.length > 1) {
  1265. filter.args = tokens.slice(1).map(processFilterArg)
  1266. }
  1267. }
  1268. if (filter) {
  1269. (dir.filters = dir.filters || []).push(filter)
  1270. }
  1271. lastFilterIndex = i + 1
  1272. }
  1273. /**
  1274. * Check if an argument is dynamic and strip quotes.
  1275. *
  1276. * @param {String} arg
  1277. * @return {Object}
  1278. */
  1279. function processFilterArg (arg) {
  1280. if (reservedArgRE.test(arg)) {
  1281. return {
  1282. value: _.toNumber(arg),
  1283. dynamic: false
  1284. }
  1285. } else {
  1286. var stripped = _.stripQuotes(arg)
  1287. var dynamic = stripped === arg
  1288. return {
  1289. value: dynamic ? arg : stripped,
  1290. dynamic: dynamic
  1291. }
  1292. }
  1293. }
  1294. /**
  1295. * Parse a directive value and extract the expression
  1296. * and its filters into a descriptor.
  1297. *
  1298. * Example:
  1299. *
  1300. * "a + 1 | uppercase" will yield:
  1301. * {
  1302. * expression: 'a + 1',
  1303. * filters: [
  1304. * { name: 'uppercase', args: null }
  1305. * ]
  1306. * }
  1307. *
  1308. * @param {String} str
  1309. * @return {Object}
  1310. */
  1311. exports.parse = function (s) {
  1312. var hit = cache.get(s)
  1313. if (hit) {
  1314. return hit
  1315. }
  1316. // reset parser state
  1317. str = s
  1318. inSingle = inDouble = false
  1319. curly = square = paren = 0
  1320. lastFilterIndex = 0
  1321. dir = {}
  1322. for (i = 0, l = str.length; i < l; i++) {
  1323. c = str.charCodeAt(i)
  1324. if (inSingle) {
  1325. // check single quote
  1326. if (c === 0x27) inSingle = !inSingle
  1327. } else if (inDouble) {
  1328. // check double quote
  1329. if (c === 0x22) inDouble = !inDouble
  1330. } else if (
  1331. c === 0x7C && // pipe
  1332. str.charCodeAt(i + 1) !== 0x7C &&
  1333. str.charCodeAt(i - 1) !== 0x7C
  1334. ) {
  1335. if (dir.expression == null) {
  1336. // first filter, end of expression
  1337. lastFilterIndex = i + 1
  1338. dir.expression = str.slice(0, i).trim()
  1339. } else {
  1340. // already has filter
  1341. pushFilter()
  1342. }
  1343. } else {
  1344. switch (c) {
  1345. case 0x22: inDouble = true; break // "
  1346. case 0x27: inSingle = true; break // '
  1347. case 0x28: paren++; break // (
  1348. case 0x29: paren--; break // )
  1349. case 0x5B: square++; break // [
  1350. case 0x5D: square--; break // ]
  1351. case 0x7B: curly++; break // {
  1352. case 0x7D: curly--; break // }
  1353. }
  1354. }
  1355. }
  1356. if (dir.expression == null) {
  1357. dir.expression = str.slice(0, i).trim()
  1358. } else if (lastFilterIndex !== 0) {
  1359. pushFilter()
  1360. }
  1361. cache.put(s, dir)
  1362. return dir
  1363. }
  1364. /***/ },
  1365. /* 9 */
  1366. /***/ function(module, exports, __webpack_require__) {
  1367. var _ = __webpack_require__(1)
  1368. /**
  1369. * Append with transition.
  1370. *
  1371. * @param {Element} el
  1372. * @param {Element} target
  1373. * @param {Vue} vm
  1374. * @param {Function} [cb]
  1375. */
  1376. exports.append = function (el, target, vm, cb) {
  1377. apply(el, 1, function () {
  1378. target.appendChild(el)
  1379. }, vm, cb)
  1380. }
  1381. /**
  1382. * InsertBefore with transition.
  1383. *
  1384. * @param {Element} el
  1385. * @param {Element} target
  1386. * @param {Vue} vm
  1387. * @param {Function} [cb]
  1388. */
  1389. exports.before = function (el, target, vm, cb) {
  1390. apply(el, 1, function () {
  1391. _.before(el, target)
  1392. }, vm, cb)
  1393. }
  1394. /**
  1395. * Remove with transition.
  1396. *
  1397. * @param {Element} el
  1398. * @param {Vue} vm
  1399. * @param {Function} [cb]
  1400. */
  1401. exports.remove = function (el, vm, cb) {
  1402. apply(el, -1, function () {
  1403. _.remove(el)
  1404. }, vm, cb)
  1405. }
  1406. /**
  1407. * Apply transitions with an operation callback.
  1408. *
  1409. * @param {Element} el
  1410. * @param {Number} direction
  1411. * 1: enter
  1412. * -1: leave
  1413. * @param {Function} op - the actual DOM operation
  1414. * @param {Vue} vm
  1415. * @param {Function} [cb]
  1416. */
  1417. var apply = exports.apply = function (el, direction, op, vm, cb) {
  1418. var transition = el.__v_trans
  1419. if (
  1420. !transition ||
  1421. // skip if there are no js hooks and CSS transition is
  1422. // not supported
  1423. (!transition.hooks && !_.transitionEndEvent) ||
  1424. // skip transitions for initial compile
  1425. !vm._isCompiled ||
  1426. // if the vm is being manipulated by a parent directive
  1427. // during the parent's compilation phase, skip the
  1428. // animation.
  1429. (vm.$parent && !vm.$parent._isCompiled)
  1430. ) {
  1431. op()
  1432. if (cb) cb()
  1433. return
  1434. }
  1435. var action = direction > 0 ? 'enter' : 'leave'
  1436. transition[action](op, cb)
  1437. }
  1438. /***/ },
  1439. /* 10 */
  1440. /***/ function(module, exports, __webpack_require__) {
  1441. var _ = __webpack_require__(1)
  1442. var config = __webpack_require__(5)
  1443. var extend = _.extend
  1444. /**
  1445. * Option overwriting strategies are functions that handle
  1446. * how to merge a parent option value and a child option
  1447. * value into the final value.
  1448. *
  1449. * All strategy functions follow the same signature:
  1450. *
  1451. * @param {*} parentVal
  1452. * @param {*} childVal
  1453. * @param {Vue} [vm]
  1454. */
  1455. var strats = config.optionMergeStrategies = Object.create(null)
  1456. /**
  1457. * Helper that recursively merges two data objects together.
  1458. */
  1459. function mergeData (to, from) {
  1460. var key, toVal, fromVal
  1461. for (key in from) {
  1462. toVal = to[key]
  1463. fromVal = from[key]
  1464. if (!to.hasOwnProperty(key)) {
  1465. _.set(to, key, fromVal)
  1466. } else if (_.isObject(toVal) && _.isObject(fromVal)) {
  1467. mergeData(toVal, fromVal)
  1468. }
  1469. }
  1470. return to
  1471. }
  1472. /**
  1473. * Data
  1474. */
  1475. strats.data = function (parentVal, childVal, vm) {
  1476. if (!vm) {
  1477. // in a Vue.extend merge, both should be functions
  1478. if (!childVal) {
  1479. return parentVal
  1480. }
  1481. if (typeof childVal !== 'function') {
  1482. ("development") !== 'production' && _.warn(
  1483. 'The "data" option should be a function ' +
  1484. 'that returns a per-instance value in component ' +
  1485. 'definitions.'
  1486. )
  1487. return parentVal
  1488. }
  1489. if (!parentVal) {
  1490. return childVal
  1491. }
  1492. // when parentVal & childVal are both present,
  1493. // we need to return a function that returns the
  1494. // merged result of both functions... no need to
  1495. // check if parentVal is a function here because
  1496. // it has to be a function to pass previous merges.
  1497. return function mergedDataFn () {
  1498. return mergeData(
  1499. childVal.call(this),
  1500. parentVal.call(this)
  1501. )
  1502. }
  1503. } else if (parentVal || childVal) {
  1504. return function mergedInstanceDataFn () {
  1505. // instance merge
  1506. var instanceData = typeof childVal === 'function'
  1507. ? childVal.call(vm)
  1508. : childVal
  1509. var defaultData = typeof parentVal === 'function'
  1510. ? parentVal.call(vm)
  1511. : undefined
  1512. if (instanceData) {
  1513. return mergeData(instanceData, defaultData)
  1514. } else {
  1515. return defaultData
  1516. }
  1517. }
  1518. }
  1519. }
  1520. /**
  1521. * El
  1522. */
  1523. strats.el = function (parentVal, childVal, vm) {
  1524. if (!vm && childVal && typeof childVal !== 'function') {
  1525. ("development") !== 'production' && _.warn(
  1526. 'The "el" option should be a function ' +
  1527. 'that returns a per-instance value in component ' +
  1528. 'definitions.'
  1529. )
  1530. return
  1531. }
  1532. var ret = childVal || parentVal
  1533. // invoke the element factory if this is instance merge
  1534. return vm && typeof ret === 'function'
  1535. ? ret.call(vm)
  1536. : ret
  1537. }
  1538. /**
  1539. * Hooks and param attributes are merged as arrays.
  1540. */
  1541. strats.init =
  1542. strats.created =
  1543. strats.ready =
  1544. strats.attached =
  1545. strats.detached =
  1546. strats.beforeCompile =
  1547. strats.compiled =
  1548. strats.beforeDestroy =
  1549. strats.destroyed = function (parentVal, childVal) {
  1550. return childVal
  1551. ? parentVal
  1552. ? parentVal.concat(childVal)
  1553. : _.isArray(childVal)
  1554. ? childVal
  1555. : [childVal]
  1556. : parentVal
  1557. }
  1558. /**
  1559. * 0.11 deprecation warning
  1560. */
  1561. strats.paramAttributes = function () {
  1562. /* istanbul ignore next */
  1563. ("development") !== 'production' && _.warn(
  1564. '"paramAttributes" option has been deprecated in 0.12. ' +
  1565. 'Use "props" instead.'
  1566. )
  1567. }
  1568. /**
  1569. * Assets
  1570. *
  1571. * When a vm is present (instance creation), we need to do
  1572. * a three-way merge between constructor options, instance
  1573. * options and parent options.
  1574. */
  1575. function mergeAssets (parentVal, childVal) {
  1576. var res = Object.create(parentVal)
  1577. return childVal
  1578. ? extend(res, guardArrayAssets(childVal))
  1579. : res
  1580. }
  1581. config._assetTypes.forEach(function (type) {
  1582. strats[type + 's'] = mergeAssets
  1583. })
  1584. /**
  1585. * Events & Watchers.
  1586. *
  1587. * Events & watchers hashes should not overwrite one
  1588. * another, so we merge them as arrays.
  1589. */
  1590. strats.watch =
  1591. strats.events = function (parentVal, childVal) {
  1592. if (!childVal) return parentVal
  1593. if (!parentVal) return childVal
  1594. var ret = {}
  1595. extend(ret, parentVal)
  1596. for (var key in childVal) {
  1597. var parent = ret[key]
  1598. var child = childVal[key]
  1599. if (parent && !_.isArray(parent)) {
  1600. parent = [parent]
  1601. }
  1602. ret[key] = parent
  1603. ? parent.concat(child)
  1604. : [child]
  1605. }
  1606. return ret
  1607. }
  1608. /**
  1609. * Other object hashes.
  1610. */
  1611. strats.props =
  1612. strats.methods =
  1613. strats.computed = function (parentVal, childVal) {
  1614. if (!childVal) return parentVal
  1615. if (!parentVal) return childVal
  1616. var ret = Object.create(null)
  1617. extend(ret, parentVal)
  1618. extend(ret, childVal)
  1619. return ret
  1620. }
  1621. /**
  1622. * Default strategy.
  1623. */
  1624. var defaultStrat = function (parentVal, childVal) {
  1625. return childVal === undefined
  1626. ? parentVal
  1627. : childVal
  1628. }
  1629. /**
  1630. * Make sure component options get converted to actual
  1631. * constructors.
  1632. *
  1633. * @param {Object} options
  1634. */
  1635. function guardComponents (options) {
  1636. if (options.components) {
  1637. var components = options.components =
  1638. guardArrayAssets(options.components)
  1639. var def
  1640. var ids = Object.keys(components)
  1641. for (var i = 0, l = ids.length; i < l; i++) {
  1642. var key = ids[i]
  1643. if (_.commonTagRE.test(key)) {
  1644. ("development") !== 'production' && _.warn(
  1645. 'Do not use built-in HTML elements as component ' +
  1646. 'id: ' + key
  1647. )
  1648. continue
  1649. }
  1650. def = components[key]
  1651. if (_.isPlainObject(def)) {
  1652. components[key] = _.Vue.extend(def)
  1653. }
  1654. }
  1655. }
  1656. }
  1657. /**
  1658. * Ensure all props option syntax are normalized into the
  1659. * Object-based format.
  1660. *
  1661. * @param {Object} options
  1662. */
  1663. function guardProps (options) {
  1664. var props = options.props
  1665. var i
  1666. if (_.isArray(props)) {
  1667. options.props = {}
  1668. i = props.length
  1669. while (i--) {
  1670. options.props[props[i]] = null
  1671. }
  1672. } else if (_.isPlainObject(props)) {
  1673. var keys = Object.keys(props)
  1674. i = keys.length
  1675. while (i--) {
  1676. var val = props[keys[i]]
  1677. if (typeof val === 'function') {
  1678. props[keys[i]] = { type: val }
  1679. }
  1680. }
  1681. }
  1682. }
  1683. /**
  1684. * Guard an Array-format assets option and converted it
  1685. * into the key-value Object format.
  1686. *
  1687. * @param {Object|Array} assets
  1688. * @return {Object}
  1689. */
  1690. function guardArrayAssets (assets) {
  1691. if (_.isArray(assets)) {
  1692. var res = {}
  1693. var i = assets.length
  1694. var asset
  1695. while (i--) {
  1696. asset = assets[i]
  1697. var id = typeof asset === 'function'
  1698. ? ((asset.options && asset.options.name) || asset.id)
  1699. : (asset.name || asset.id)
  1700. if (!id) {
  1701. ("development") !== 'production' && _.warn(
  1702. 'Array-syntax assets must provide a "name" or "id" field.'
  1703. )
  1704. } else {
  1705. res[id] = asset
  1706. }
  1707. }
  1708. return res
  1709. }
  1710. return assets
  1711. }
  1712. /**
  1713. * Merge two option objects into a new one.
  1714. * Core utility used in both instantiation and inheritance.
  1715. *
  1716. * @param {Object} parent
  1717. * @param {Object} child
  1718. * @param {Vue} [vm] - if vm is present, indicates this is
  1719. * an instantiation merge.
  1720. */
  1721. exports.mergeOptions = function merge (parent, child, vm) {
  1722. guardComponents(child)
  1723. guardProps(child)
  1724. var options = {}
  1725. var key
  1726. if (child.mixins) {
  1727. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1728. parent = merge(parent, child.mixins[i], vm)
  1729. }
  1730. }
  1731. for (key in parent) {
  1732. mergeField(key)
  1733. }
  1734. for (key in child) {
  1735. if (!(parent.hasOwnProperty(key))) {
  1736. mergeField(key)
  1737. }
  1738. }
  1739. function mergeField (key) {
  1740. var strat = strats[key] || defaultStrat
  1741. options[key] = strat(parent[key], child[key], vm, key)
  1742. }
  1743. return options
  1744. }
  1745. /**
  1746. * Resolve an asset.
  1747. * This function is used because child instances need access
  1748. * to assets defined in its ancestor chain.
  1749. *
  1750. * @param {Object} options
  1751. * @param {String} type
  1752. * @param {String} id
  1753. * @return {Object|Function}
  1754. */
  1755. exports.resolveAsset = function resolve (options, type, id) {
  1756. var assets = options[type]
  1757. var camelizedId
  1758. return assets[id] ||
  1759. // camelCase ID
  1760. assets[camelizedId = _.camelize(id)] ||
  1761. // Pascal Case ID
  1762. assets[camelizedId.charAt(0).toUpperCase() + camelizedId.slice(1)]
  1763. }
  1764. /***/ },
  1765. /* 11 */
  1766. /***/ function(module, exports, __webpack_require__) {
  1767. var _ = __webpack_require__(1)
  1768. /**
  1769. * Check if an element is a component, if yes return its
  1770. * component id.
  1771. *
  1772. * @param {Element} el
  1773. * @param {Object} options
  1774. * @return {Object|undefined}
  1775. */
  1776. exports.commonTagRE = /^(div|p|span|img|a|b|i|br|ul|ol|li|h1|h2|h3|h4|h5|h6|code|pre|table|th|td|tr|form|label|input|select|option|nav|article|section|header|footer)$/
  1777. exports.checkComponent = function (el, options) {
  1778. var tag = el.tagName.toLowerCase()
  1779. var hasAttrs = el.hasAttributes()
  1780. if (!exports.commonTagRE.test(tag) && tag !== 'component') {
  1781. if (_.resolveAsset(options, 'components', tag)) {
  1782. return { id: tag }
  1783. } else {
  1784. var is = hasAttrs && getIsBinding(el)
  1785. if (is) {
  1786. return is
  1787. } else if (true) {
  1788. if (
  1789. tag.indexOf('-') > -1 ||
  1790. (
  1791. /HTMLUnknownElement/.test(el.toString()) &&
  1792. // Chrome returns unknown for several HTML5 elements.
  1793. // https://code.google.com/p/chromium/issues/detail?id=540526
  1794. !/^(data|time|rtc|rb)$/.test(tag)
  1795. )
  1796. ) {
  1797. _.warn(
  1798. 'Unknown custom element: <' + tag + '> - did you ' +
  1799. 'register the component correctly?'
  1800. )
  1801. }
  1802. }
  1803. }
  1804. } else if (hasAttrs) {
  1805. return getIsBinding(el)
  1806. }
  1807. }
  1808. /**
  1809. * Get "is" binding from an element.
  1810. *
  1811. * @param {Element} el
  1812. * @return {Object|undefined}
  1813. */
  1814. function getIsBinding (el) {
  1815. // dynamic syntax
  1816. var exp = _.attr(el, 'is')
  1817. if (exp != null) {
  1818. return { id: exp }
  1819. } else {
  1820. exp = _.getBindAttr(el, 'is')
  1821. if (exp != null) {
  1822. return { id: exp, dynamic: true }
  1823. }
  1824. }
  1825. }
  1826. /**
  1827. * Set a prop's initial value on a vm and its data object.
  1828. *
  1829. * @param {Vue} vm
  1830. * @param {Object} prop
  1831. * @param {*} value
  1832. */
  1833. exports.initProp = function (vm, prop, value) {
  1834. if (exports.assertProp(prop, value)) {
  1835. var key = prop.path
  1836. vm[key] = vm._data[key] = value
  1837. }
  1838. }
  1839. /**
  1840. * Assert whether a prop is valid.
  1841. *
  1842. * @param {Object} prop
  1843. * @param {*} value
  1844. */
  1845. exports.assertProp = function (prop, value) {
  1846. // if a prop is not provided and is not required,
  1847. // skip the check.
  1848. if (prop.raw === null && !prop.required) {
  1849. return true
  1850. }
  1851. var options = prop.options
  1852. var type = options.type
  1853. var valid = true
  1854. var expectedType
  1855. if (type) {
  1856. if (type === String) {
  1857. expectedType = 'string'
  1858. valid = typeof value === expectedType
  1859. } else if (type === Number) {
  1860. expectedType = 'number'
  1861. valid = typeof value === 'number'
  1862. } else if (type === Boolean) {
  1863. expectedType = 'boolean'
  1864. valid = typeof value === 'boolean'
  1865. } else if (type === Function) {
  1866. expectedType = 'function'
  1867. valid = typeof value === 'function'
  1868. } else if (type === Object) {
  1869. expectedType = 'object'
  1870. valid = _.isPlainObject(value)
  1871. } else if (type === Array) {
  1872. expectedType = 'array'
  1873. valid = _.isArray(value)
  1874. } else {
  1875. valid = value instanceof type
  1876. }
  1877. }
  1878. if (!valid) {
  1879. ("development") !== 'production' && _.warn(
  1880. 'Invalid prop: type check failed for ' +
  1881. prop.path + '="' + prop.raw + '".' +
  1882. ' Expected ' + formatType(expectedType) +
  1883. ', got ' + formatValue(value) + '.'
  1884. )
  1885. return false
  1886. }
  1887. var validator = options.validator
  1888. if (validator) {
  1889. if (!validator.call(null, value)) {
  1890. ("development") !== 'production' && _.warn(
  1891. 'Invalid prop: custom validator check failed for ' +
  1892. prop.path + '="' + prop.raw + '"'
  1893. )
  1894. return false
  1895. }
  1896. }
  1897. return true
  1898. }
  1899. function formatType (val) {
  1900. return val
  1901. ? val.charAt(0).toUpperCase() + val.slice(1)
  1902. : 'custom type'
  1903. }
  1904. function formatValue (val) {
  1905. return Object.prototype.toString.call(val).slice(8, -1)
  1906. }
  1907. /***/ },
  1908. /* 12 */
  1909. /***/ function(module, exports, __webpack_require__) {
  1910. /**
  1911. * Enable debug utilities.
  1912. */
  1913. if (true) {
  1914. var config = __webpack_require__(5)
  1915. var hasConsole = typeof console !== 'undefined'
  1916. /**
  1917. * Log a message.
  1918. *
  1919. * @param {String} msg
  1920. */
  1921. exports.log = function (msg) {
  1922. if (hasConsole && config.debug) {
  1923. console.log('[Vue info]: ' + msg)
  1924. }
  1925. }
  1926. /**
  1927. * We've got a problem here.
  1928. *
  1929. * @param {String} msg
  1930. */
  1931. exports.warn = function (msg, e) {
  1932. if (hasConsole && (!config.silent || config.debug)) {
  1933. console.warn('[Vue warn]: ' + msg)
  1934. /* istanbul ignore if */
  1935. if (config.debug) {
  1936. console.warn((e || new Error('Warning Stack Trace')).stack)
  1937. }
  1938. }
  1939. }
  1940. /**
  1941. * Assert asset exists
  1942. */
  1943. exports.assertAsset = function (val, type, id) {
  1944. if (!val) {
  1945. exports.warn('Failed to resolve ' + type + ': ' + id)
  1946. }
  1947. }
  1948. }
  1949. /***/ },
  1950. /* 13 */
  1951. /***/ function(module, exports, __webpack_require__) {
  1952. var _ = __webpack_require__(1)
  1953. var config = __webpack_require__(5)
  1954. /**
  1955. * Expose useful internals
  1956. */
  1957. exports.util = _
  1958. exports.config = config
  1959. exports.set = _.set
  1960. exports.delete = _.delete
  1961. exports.nextTick = _.nextTick
  1962. /**
  1963. * The following are exposed for advanced usage / plugins
  1964. */
  1965. exports.compiler = __webpack_require__(14)
  1966. exports.FragmentFactory = __webpack_require__(21)
  1967. exports.internalDirectives = __webpack_require__(36)
  1968. exports.parsers = {
  1969. path: __webpack_require__(43),
  1970. text: __webpack_require__(6),
  1971. template: __webpack_require__(19),
  1972. directive: __webpack_require__(8),
  1973. expression: __webpack_require__(42)
  1974. }
  1975. /**
  1976. * Each instance constructor, including Vue, has a unique
  1977. * cid. This enables us to create wrapped "child
  1978. * constructors" for prototypal inheritance and cache them.
  1979. */
  1980. exports.cid = 0
  1981. var cid = 1
  1982. /**
  1983. * Class inheritance
  1984. *
  1985. * @param {Object} extendOptions
  1986. */
  1987. exports.extend = function (extendOptions) {
  1988. extendOptions = extendOptions || {}
  1989. var Super = this
  1990. var isFirstExtend = Super.cid === 0
  1991. if (isFirstExtend && extendOptions._Ctor) {
  1992. return extendOptions._Ctor
  1993. }
  1994. var name = extendOptions.name || Super.options.name
  1995. var Sub = createClass(name || 'VueComponent')
  1996. Sub.prototype = Object.create(Super.prototype)
  1997. Sub.prototype.constructor = Sub
  1998. Sub.cid = cid++
  1999. Sub.options = _.mergeOptions(
  2000. Super.options,
  2001. extendOptions
  2002. )
  2003. Sub['super'] = Super
  2004. // allow further extension
  2005. Sub.extend = Super.extend
  2006. // create asset registers, so extended classes
  2007. // can have their private assets too.
  2008. config._assetTypes.forEach(function (type) {
  2009. Sub[type] = Super[type]
  2010. })
  2011. // enable recursive self-lookup
  2012. if (name) {
  2013. Sub.options.components[name] = Sub
  2014. }
  2015. // cache constructor
  2016. if (isFirstExtend) {
  2017. extendOptions._Ctor = Sub
  2018. }
  2019. return Sub
  2020. }
  2021. /**
  2022. * A function that returns a sub-class constructor with the
  2023. * given name. This gives us much nicer output when
  2024. * logging instances in the console.
  2025. *
  2026. * @param {String} name
  2027. * @return {Function}
  2028. */
  2029. function createClass (name) {
  2030. return new Function(
  2031. 'return function ' + _.classify(name) +
  2032. ' (options) { this._init(options) }'
  2033. )()
  2034. }
  2035. /**
  2036. * Plugin system
  2037. *
  2038. * @param {Object} plugin
  2039. */
  2040. exports.use = function (plugin) {
  2041. /* istanbul ignore if */
  2042. if (plugin.installed) {
  2043. return
  2044. }
  2045. // additional parameters
  2046. var args = _.toArray(arguments, 1)
  2047. args.unshift(this)
  2048. if (typeof plugin.install === 'function') {
  2049. plugin.install.apply(plugin, args)
  2050. } else {
  2051. plugin.apply(null, args)
  2052. }
  2053. plugin.installed = true
  2054. return this
  2055. }
  2056. /**
  2057. * Apply a global mixin by merging it into the default
  2058. * options.
  2059. */
  2060. exports.mixin = function (mixin) {
  2061. var Vue = _.Vue
  2062. Vue.options = _.mergeOptions(Vue.options, mixin)
  2063. }
  2064. /**
  2065. * Create asset registration methods with the following
  2066. * signature:
  2067. *
  2068. * @param {String} id
  2069. * @param {*} definition
  2070. */
  2071. config._assetTypes.forEach(function (type) {
  2072. exports[type] = function (id, definition) {
  2073. if (!definition) {
  2074. return this.options[type + 's'][id]
  2075. } else {
  2076. if (
  2077. type === 'component' &&
  2078. _.isPlainObject(definition)
  2079. ) {
  2080. definition.name = id
  2081. definition = _.Vue.extend(definition)
  2082. }
  2083. this.options[type + 's'][id] = definition
  2084. return definition
  2085. }
  2086. }
  2087. })
  2088. /***/ },
  2089. /* 14 */
  2090. /***/ function(module, exports, __webpack_require__) {
  2091. var _ = __webpack_require__(1)
  2092. _.extend(exports, __webpack_require__(15))
  2093. _.extend(exports, __webpack_require__(49))
  2094. /***/ },
  2095. /* 15 */
  2096. /***/ function(module, exports, __webpack_require__) {
  2097. var _ = __webpack_require__(1)
  2098. var publicDirectives = __webpack_require__(16)
  2099. var internalDirectives = __webpack_require__(36)
  2100. var compileProps = __webpack_require__(48)
  2101. var textParser = __webpack_require__(6)
  2102. var dirParser = __webpack_require__(8)
  2103. var templateParser = __webpack_require__(19)
  2104. var resolveAsset = _.resolveAsset
  2105. // special binding prefixes
  2106. var bindRE = /^v-bind:|^:/
  2107. var onRE = /^v-on:|^@/
  2108. var argRE = /:(.*)$/
  2109. var modifierRE = /\.[^\.]+/g
  2110. var transitionRE = /^(v-bind:|:)?transition$/
  2111. // terminal directives
  2112. var terminalDirectives = [
  2113. 'for',
  2114. 'if'
  2115. ]
  2116. // default directive priority
  2117. var DEFAULT_PRIORITY = 1000
  2118. /**
  2119. * Compile a template and return a reusable composite link
  2120. * function, which recursively contains more link functions
  2121. * inside. This top level compile function would normally
  2122. * be called on instance root nodes, but can also be used
  2123. * for partial compilation if the partial argument is true.
  2124. *
  2125. * The returned composite link function, when called, will
  2126. * return an unlink function that tearsdown all directives
  2127. * created during the linking phase.
  2128. *
  2129. * @param {Element|DocumentFragment} el
  2130. * @param {Object} options
  2131. * @param {Boolean} partial
  2132. * @return {Function}
  2133. */
  2134. exports.compile = function (el, options, partial) {
  2135. // link function for the node itself.
  2136. var nodeLinkFn = partial || !options._asComponent
  2137. ? compileNode(el, options)
  2138. : null
  2139. // link function for the childNodes
  2140. var childLinkFn =
  2141. !(nodeLinkFn && nodeLinkFn.terminal) &&
  2142. el.tagName !== 'SCRIPT' &&
  2143. el.hasChildNodes()
  2144. ? compileNodeList(el.childNodes, options)
  2145. : null
  2146. /**
  2147. * A composite linker function to be called on a already
  2148. * compiled piece of DOM, which instantiates all directive
  2149. * instances.
  2150. *
  2151. * @param {Vue} vm
  2152. * @param {Element|DocumentFragment} el
  2153. * @param {Vue} [host] - host vm of transcluded content
  2154. * @param {Object} [scope] - v-for scope
  2155. * @param {Fragment} [frag] - link context fragment
  2156. * @return {Function|undefined}
  2157. */
  2158. return function compositeLinkFn (vm, el, host, scope, frag) {
  2159. // cache childNodes before linking parent, fix #657
  2160. var childNodes = _.toArray(el.childNodes)
  2161. // link
  2162. var dirs = linkAndCapture(function compositeLinkCapturer () {
  2163. if (nodeLinkFn) nodeLinkFn(vm, el, host, scope, frag)
  2164. if (childLinkFn) childLinkFn(vm, childNodes, host, scope, frag)
  2165. }, vm)
  2166. return makeUnlinkFn(vm, dirs)
  2167. }
  2168. }
  2169. /**
  2170. * Apply a linker to a vm/element pair and capture the
  2171. * directives created during the process.
  2172. *
  2173. * @param {Function} linker
  2174. * @param {Vue} vm
  2175. */
  2176. function linkAndCapture (linker, vm) {
  2177. var originalDirCount = vm._directives.length
  2178. linker()
  2179. var dirs = vm._directives.slice(originalDirCount)
  2180. dirs.sort(directiveComparator)
  2181. for (var i = 0, l = dirs.length; i < l; i++) {
  2182. dirs[i]._bind()
  2183. }
  2184. return dirs
  2185. }
  2186. /**
  2187. * Directive priority sort comparator
  2188. *
  2189. * @param {Object} a
  2190. * @param {Object} b
  2191. */
  2192. function directiveComparator (a, b) {
  2193. a = a.descriptor.def.priority || DEFAULT_PRIORITY
  2194. b = b.descriptor.def.priority || DEFAULT_PRIORITY
  2195. return a > b ? -1 : a === b ? 0 : 1
  2196. }
  2197. /**
  2198. * Linker functions return an unlink function that
  2199. * tearsdown all directives instances generated during
  2200. * the process.
  2201. *
  2202. * We create unlink functions with only the necessary
  2203. * information to avoid retaining additional closures.
  2204. *
  2205. * @param {Vue} vm
  2206. * @param {Array} dirs
  2207. * @param {Vue} [context]
  2208. * @param {Array} [contextDirs]
  2209. * @return {Function}
  2210. */
  2211. function makeUnlinkFn (vm, dirs, context, contextDirs) {
  2212. return function unlink (destroying) {
  2213. teardownDirs(vm, dirs, destroying)
  2214. if (context && contextDirs) {
  2215. teardownDirs(context, contextDirs)
  2216. }
  2217. }
  2218. }
  2219. /**
  2220. * Teardown partial linked directives.
  2221. *
  2222. * @param {Vue} vm
  2223. * @param {Array} dirs
  2224. * @param {Boolean} destroying
  2225. */
  2226. function teardownDirs (vm, dirs, destroying) {
  2227. var i = dirs.length
  2228. while (i--) {
  2229. dirs[i]._teardown()
  2230. if (!destroying) {
  2231. vm._directives.$remove(dirs[i])
  2232. }
  2233. }
  2234. }
  2235. /**
  2236. * Compile link props on an instance.
  2237. *
  2238. * @param {Vue} vm
  2239. * @param {Element} el
  2240. * @param {Object} props
  2241. * @param {Object} [scope]
  2242. * @return {Function}
  2243. */
  2244. exports.compileAndLinkProps = function (vm, el, props, scope) {
  2245. var propsLinkFn = compileProps(el, props)
  2246. var propDirs = linkAndCapture(function () {
  2247. propsLinkFn(vm, scope)
  2248. }, vm)
  2249. return makeUnlinkFn(vm, propDirs)
  2250. }
  2251. /**
  2252. * Compile the root element of an instance.
  2253. *
  2254. * 1. attrs on context container (context scope)
  2255. * 2. attrs on the component template root node, if
  2256. * replace:true (child scope)
  2257. *
  2258. * If this is a fragment instance, we only need to compile 1.
  2259. *
  2260. * @param {Vue} vm
  2261. * @param {Element} el
  2262. * @param {Object} options
  2263. * @param {Object} contextOptions
  2264. * @return {Function}
  2265. */
  2266. exports.compileRoot = function (el, options, contextOptions) {
  2267. var containerAttrs = options._containerAttrs
  2268. var replacerAttrs = options._replacerAttrs
  2269. var contextLinkFn, replacerLinkFn
  2270. // only need to compile other attributes for
  2271. // non-fragment instances
  2272. if (el.nodeType !== 11) {
  2273. // for components, container and replacer need to be
  2274. // compiled separately and linked in different scopes.
  2275. if (options._asComponent) {
  2276. // 2. container attributes
  2277. if (containerAttrs && contextOptions) {
  2278. contextLinkFn = compileDirectives(containerAttrs, contextOptions)
  2279. }
  2280. if (replacerAttrs) {
  2281. // 3. replacer attributes
  2282. replacerLinkFn = compileDirectives(replacerAttrs, options)
  2283. }
  2284. } else {
  2285. // non-component, just compile as a normal element.
  2286. replacerLinkFn = compileDirectives(el.attributes, options)
  2287. }
  2288. } else if (("development") !== 'production' && containerAttrs) {
  2289. // warn container directives for fragment instances
  2290. var names = containerAttrs.map(function (attr) {
  2291. return '"' + attr.name + '"'
  2292. }).join(', ')
  2293. var plural = containerAttrs.length > 1
  2294. _.warn(
  2295. 'Attribute' + (plural ? 's ' : ' ') + names +
  2296. (plural ? ' are' : ' is') + ' ignored on component ' +
  2297. '<' + options.el.tagName.toLowerCase() + '> because ' +
  2298. 'the component is a fragment instance: ' +
  2299. 'http://vuejs.org/guide/components.html#Fragment_Instance'
  2300. )
  2301. }
  2302. return function rootLinkFn (vm, el, scope) {
  2303. // link context scope dirs
  2304. var context = vm._context
  2305. var contextDirs
  2306. if (context && contextLinkFn) {
  2307. contextDirs = linkAndCapture(function () {
  2308. contextLinkFn(context, el, null, scope)
  2309. }, context)
  2310. }
  2311. // link self
  2312. var selfDirs = linkAndCapture(function () {
  2313. if (replacerLinkFn) replacerLinkFn(vm, el)
  2314. }, vm)
  2315. // return the unlink function that tearsdown context
  2316. // container directives.
  2317. return makeUnlinkFn(vm, selfDirs, context, contextDirs)
  2318. }
  2319. }
  2320. /**
  2321. * Compile a node and return a nodeLinkFn based on the
  2322. * node type.
  2323. *
  2324. * @param {Node} node
  2325. * @param {Object} options
  2326. * @return {Function|null}
  2327. */
  2328. function compileNode (node, options) {
  2329. var type = node.nodeType
  2330. if (type === 1 && node.tagName !== 'SCRIPT') {
  2331. return compileElement(node, options)
  2332. } else if (type === 3 && node.data.trim()) {
  2333. return compileTextNode(node, options)
  2334. } else {
  2335. return null
  2336. }
  2337. }
  2338. /**
  2339. * Compile an element and return a nodeLinkFn.
  2340. *
  2341. * @param {Element} el
  2342. * @param {Object} options
  2343. * @return {Function|null}
  2344. */
  2345. function compileElement (el, options) {
  2346. // preprocess textareas.
  2347. // textarea treats its text content as the initial value.
  2348. // just bind it as an attr directive for value.
  2349. if (el.tagName === 'TEXTAREA') {
  2350. var tokens = textParser.parse(el.value)
  2351. if (tokens) {
  2352. el.setAttribute(':value', textParser.tokensToExp(tokens))
  2353. el.value = ''
  2354. }
  2355. }
  2356. var linkFn
  2357. var hasAttrs = el.hasAttributes()
  2358. // check terminal directives (for & if)
  2359. if (hasAttrs) {
  2360. linkFn = checkTerminalDirectives(el, options)
  2361. }
  2362. // check element directives
  2363. if (!linkFn) {
  2364. linkFn = checkElementDirectives(el, options)
  2365. }
  2366. // check component
  2367. if (!linkFn) {
  2368. linkFn = checkComponent(el, options)
  2369. }
  2370. // normal directives
  2371. if (!linkFn && hasAttrs) {
  2372. linkFn = compileDirectives(el.attributes, options)
  2373. }
  2374. return linkFn
  2375. }
  2376. /**
  2377. * Compile a textNode and return a nodeLinkFn.
  2378. *
  2379. * @param {TextNode} node
  2380. * @param {Object} options
  2381. * @return {Function|null} textNodeLinkFn
  2382. */
  2383. function compileTextNode (node, options) {
  2384. var tokens = textParser.parse(node.data)
  2385. if (!tokens) {
  2386. return null
  2387. }
  2388. var frag = document.createDocumentFragment()
  2389. var el, token
  2390. for (var i = 0, l = tokens.length; i < l; i++) {
  2391. token = tokens[i]
  2392. el = token.tag
  2393. ? processTextToken(token, options)
  2394. : document.createTextNode(token.value)
  2395. frag.appendChild(el)
  2396. }
  2397. return makeTextNodeLinkFn(tokens, frag, options)
  2398. }
  2399. /**
  2400. * Process a single text token.
  2401. *
  2402. * @param {Object} token
  2403. * @param {Object} options
  2404. * @return {Node}
  2405. */
  2406. function processTextToken (token, options) {
  2407. var el
  2408. if (token.oneTime) {
  2409. el = document.createTextNode(token.value)
  2410. } else {
  2411. if (token.html) {
  2412. el = document.createComment('v-html')
  2413. setTokenType('html')
  2414. } else {
  2415. // IE will clean up empty textNodes during
  2416. // frag.cloneNode(true), so we have to give it
  2417. // something here...
  2418. el = document.createTextNode(' ')
  2419. setTokenType('text')
  2420. }
  2421. }
  2422. function setTokenType (type) {
  2423. if (token.descriptor) return
  2424. var parsed = dirParser.parse(token.value)
  2425. token.descriptor = {
  2426. name: type,
  2427. def: publicDirectives[type],
  2428. expression: parsed.expression,
  2429. filters: parsed.filters
  2430. }
  2431. }
  2432. return el
  2433. }
  2434. /**
  2435. * Build a function that processes a textNode.
  2436. *
  2437. * @param {Array<Object>} tokens
  2438. * @param {DocumentFragment} frag
  2439. */
  2440. function makeTextNodeLinkFn (tokens, frag) {
  2441. return function textNodeLinkFn (vm, el, host, scope) {
  2442. var fragClone = frag.cloneNode(true)
  2443. var childNodes = _.toArray(fragClone.childNodes)
  2444. var token, value, node
  2445. for (var i = 0, l = tokens.length; i < l; i++) {
  2446. token = tokens[i]
  2447. value = token.value
  2448. if (token.tag) {
  2449. node = childNodes[i]
  2450. if (token.oneTime) {
  2451. value = (scope || vm).$eval(value)
  2452. if (token.html) {
  2453. _.replace(node, templateParser.parse(value, true))
  2454. } else {
  2455. node.data = value
  2456. }
  2457. } else {
  2458. vm._bindDir(token.descriptor, node, host, scope)
  2459. }
  2460. }
  2461. }
  2462. _.replace(el, fragClone)
  2463. }
  2464. }
  2465. /**
  2466. * Compile a node list and return a childLinkFn.
  2467. *
  2468. * @param {NodeList} nodeList
  2469. * @param {Object} options
  2470. * @return {Function|undefined}
  2471. */
  2472. function compileNodeList (nodeList, options) {
  2473. var linkFns = []
  2474. var nodeLinkFn, childLinkFn, node
  2475. for (var i = 0, l = nodeList.length; i < l; i++) {
  2476. node = nodeList[i]
  2477. nodeLinkFn = compileNode(node, options)
  2478. childLinkFn =
  2479. !(nodeLinkFn && nodeLinkFn.terminal) &&
  2480. node.tagName !== 'SCRIPT' &&
  2481. node.hasChildNodes()
  2482. ? compileNodeList(node.childNodes, options)
  2483. : null
  2484. linkFns.push(nodeLinkFn, childLinkFn)
  2485. }
  2486. return linkFns.length
  2487. ? makeChildLinkFn(linkFns)
  2488. : null
  2489. }
  2490. /**
  2491. * Make a child link function for a node's childNodes.
  2492. *
  2493. * @param {Array<Function>} linkFns
  2494. * @return {Function} childLinkFn
  2495. */
  2496. function makeChildLinkFn (linkFns) {
  2497. return function childLinkFn (vm, nodes, host, scope, frag) {
  2498. var node, nodeLinkFn, childrenLinkFn
  2499. for (var i = 0, n = 0, l = linkFns.length; i < l; n++) {
  2500. node = nodes[n]
  2501. nodeLinkFn = linkFns[i++]
  2502. childrenLinkFn = linkFns[i++]
  2503. // cache childNodes before linking parent, fix #657
  2504. var childNodes = _.toArray(node.childNodes)
  2505. if (nodeLinkFn) {
  2506. nodeLinkFn(vm, node, host, scope, frag)
  2507. }
  2508. if (childrenLinkFn) {
  2509. childrenLinkFn(vm, childNodes, host, scope, frag)
  2510. }
  2511. }
  2512. }
  2513. }
  2514. /**
  2515. * Check for element directives (custom elements that should
  2516. * be resovled as terminal directives).
  2517. *
  2518. * @param {Element} el
  2519. * @param {Object} options
  2520. */
  2521. function checkElementDirectives (el, options) {
  2522. var tag = el.tagName.toLowerCase()
  2523. if (_.commonTagRE.test(tag)) return
  2524. var def = resolveAsset(options, 'elementDirectives', tag)
  2525. if (def) {
  2526. return makeTerminalNodeLinkFn(el, tag, '', options, def)
  2527. }
  2528. }
  2529. /**
  2530. * Check if an element is a component. If yes, return
  2531. * a component link function.
  2532. *
  2533. * @param {Element} el
  2534. * @param {Object} options
  2535. * @return {Function|undefined}
  2536. */
  2537. function checkComponent (el, options) {
  2538. var component = _.checkComponent(el, options)
  2539. if (component) {
  2540. var descriptor = {
  2541. name: 'component',
  2542. expression: component.id,
  2543. def: internalDirectives.component,
  2544. modifiers: {
  2545. literal: !component.dynamic
  2546. }
  2547. }
  2548. var componentLinkFn = function (vm, el, host, scope, frag) {
  2549. vm._bindDir(descriptor, el, host, scope, frag)
  2550. }
  2551. componentLinkFn.terminal = true
  2552. return componentLinkFn
  2553. }
  2554. }
  2555. /**
  2556. * Check an element for terminal directives in fixed order.
  2557. * If it finds one, return a terminal link function.
  2558. *
  2559. * @param {Element} el
  2560. * @param {Object} options
  2561. * @return {Function} terminalLinkFn
  2562. */
  2563. function checkTerminalDirectives (el, options) {
  2564. // skip v-pre
  2565. if (_.attr(el, 'v-pre') !== null) {
  2566. return skip
  2567. }
  2568. // skip v-else block, but only if following v-if
  2569. if (el.hasAttribute('v-else')) {
  2570. var prev = el.previousElementSibling
  2571. if (prev && prev.hasAttribute('v-if')) {
  2572. return skip
  2573. }
  2574. }
  2575. var value, dirName
  2576. for (var i = 0, l = terminalDirectives.length; i < l; i++) {
  2577. dirName = terminalDirectives[i]
  2578. /* eslint-disable no-cond-assign */
  2579. if (value = el.getAttribute('v-' + dirName)) {
  2580. return makeTerminalNodeLinkFn(el, dirName, value, options)
  2581. }
  2582. /* eslint-enable no-cond-assign */
  2583. }
  2584. }
  2585. function skip () {}
  2586. skip.terminal = true
  2587. /**
  2588. * Build a node link function for a terminal directive.
  2589. * A terminal link function terminates the current
  2590. * compilation recursion and handles compilation of the
  2591. * subtree in the directive.
  2592. *
  2593. * @param {Element} el
  2594. * @param {String} dirName
  2595. * @param {String} value
  2596. * @param {Object} options
  2597. * @param {Object} [def]
  2598. * @return {Function} terminalLinkFn
  2599. */
  2600. function makeTerminalNodeLinkFn (el, dirName, value, options, def) {
  2601. var parsed = dirParser.parse(value)
  2602. var descriptor = {
  2603. name: dirName,
  2604. expression: parsed.expression,
  2605. filters: parsed.filters,
  2606. raw: value,
  2607. // either an element directive, or if/for
  2608. def: def || publicDirectives[dirName]
  2609. }
  2610. var fn = function terminalNodeLinkFn (vm, el, host, scope, frag) {
  2611. vm._bindDir(descriptor, el, host, scope, frag)
  2612. }
  2613. fn.terminal = true
  2614. return fn
  2615. }
  2616. /**
  2617. * Compile the directives on an element and return a linker.
  2618. *
  2619. * @param {Array|NamedNodeMap} attrs
  2620. * @param {Object} options
  2621. * @return {Function}
  2622. */
  2623. function compileDirectives (attrs, options) {
  2624. var i = attrs.length
  2625. var dirs = []
  2626. var attr, name, value, rawName, rawValue, dirName, arg, modifiers, dirDef, tokens
  2627. while (i--) {
  2628. attr = attrs[i]
  2629. name = rawName = attr.name
  2630. value = rawValue = attr.value
  2631. tokens = textParser.parse(value)
  2632. // reset arg
  2633. arg = null
  2634. // check modifiers
  2635. modifiers = parseModifiers(name)
  2636. name = name.replace(modifierRE, '')
  2637. // attribute interpolations
  2638. if (tokens) {
  2639. value = textParser.tokensToExp(tokens)
  2640. arg = name
  2641. pushDir('bind', publicDirectives.bind, true)
  2642. } else
  2643. // special attribute: transition
  2644. if (transitionRE.test(name)) {
  2645. modifiers.literal = !bindRE.test(name)
  2646. pushDir('transition', internalDirectives.transition)
  2647. } else
  2648. // event handlers
  2649. if (onRE.test(name)) {
  2650. arg = name.replace(onRE, '')
  2651. pushDir('on', publicDirectives.on)
  2652. } else
  2653. // attribute bindings
  2654. if (bindRE.test(name)) {
  2655. dirName = name.replace(bindRE, '')
  2656. if (dirName === 'style' || dirName === 'class') {
  2657. pushDir(dirName, internalDirectives[dirName])
  2658. } else {
  2659. arg = dirName
  2660. pushDir('bind', publicDirectives.bind)
  2661. }
  2662. } else
  2663. // normal directives
  2664. if (name.indexOf('v-') === 0) {
  2665. // check arg
  2666. arg = (arg = name.match(argRE)) && arg[1]
  2667. if (arg) {
  2668. name = name.replace(argRE, '')
  2669. }
  2670. // extract directive name
  2671. dirName = name.slice(2)
  2672. // skip v-else (when used with v-show)
  2673. if (dirName === 'else') {
  2674. continue
  2675. }
  2676. dirDef = resolveAsset(options, 'directives', dirName)
  2677. if (true) {
  2678. _.assertAsset(dirDef, 'directive', dirName)
  2679. }
  2680. if (dirDef) {
  2681. if (_.isLiteral(value)) {
  2682. value = _.stripQuotes(value)
  2683. modifiers.literal = true
  2684. }
  2685. pushDir(dirName, dirDef)
  2686. }
  2687. }
  2688. }
  2689. /**
  2690. * Push a directive.
  2691. *
  2692. * @param {String} dirName
  2693. * @param {Object|Function} def
  2694. * @param {Boolean} [interp]
  2695. */
  2696. function pushDir (dirName, def, interp) {
  2697. var parsed = dirParser.parse(value)
  2698. dirs.push({
  2699. name: dirName,
  2700. attr: rawName,
  2701. raw: rawValue,
  2702. def: def,
  2703. arg: arg,
  2704. modifiers: modifiers,
  2705. expression: parsed.expression,
  2706. filters: parsed.filters,
  2707. interp: interp
  2708. })
  2709. }
  2710. if (dirs.length) {
  2711. return makeNodeLinkFn(dirs)
  2712. }
  2713. }
  2714. /**
  2715. * Parse modifiers from directive attribute name.
  2716. *
  2717. * @param {String} name
  2718. * @return {Object}
  2719. */
  2720. function parseModifiers (name) {
  2721. var res = Object.create(null)
  2722. var match = name.match(modifierRE)
  2723. if (match) {
  2724. var i = match.length
  2725. while (i--) {
  2726. res[match[i].slice(1)] = true
  2727. }
  2728. }
  2729. return res
  2730. }
  2731. /**
  2732. * Build a link function for all directives on a single node.
  2733. *
  2734. * @param {Array} directives
  2735. * @return {Function} directivesLinkFn
  2736. */
  2737. function makeNodeLinkFn (directives) {
  2738. return function nodeLinkFn (vm, el, host, scope, frag) {
  2739. // reverse apply because it's sorted low to high
  2740. var i = directives.length
  2741. while (i--) {
  2742. vm._bindDir(directives[i], el, host, scope, frag)
  2743. }
  2744. }
  2745. }
  2746. /***/ },
  2747. /* 16 */
  2748. /***/ function(module, exports, __webpack_require__) {
  2749. // text & html
  2750. exports.text = __webpack_require__(17)
  2751. exports.html = __webpack_require__(18)
  2752. // logic control
  2753. exports['for'] = __webpack_require__(20)
  2754. exports['if'] = __webpack_require__(23)
  2755. exports.show = __webpack_require__(24)
  2756. // two-way binding
  2757. exports.model = __webpack_require__(25)
  2758. // event handling
  2759. exports.on = __webpack_require__(30)
  2760. // attributes
  2761. exports.bind = __webpack_require__(31)
  2762. // ref & el
  2763. exports.el = __webpack_require__(33)
  2764. exports.ref = __webpack_require__(34)
  2765. // cloak
  2766. exports.cloak = __webpack_require__(35)
  2767. /***/ },
  2768. /* 17 */
  2769. /***/ function(module, exports, __webpack_require__) {
  2770. var _ = __webpack_require__(1)
  2771. module.exports = {
  2772. bind: function () {
  2773. this.attr = this.el.nodeType === 3
  2774. ? 'data'
  2775. : 'textContent'
  2776. },
  2777. update: function (value) {
  2778. this.el[this.attr] = _.toString(value)
  2779. }
  2780. }
  2781. /***/ },
  2782. /* 18 */
  2783. /***/ function(module, exports, __webpack_require__) {
  2784. var _ = __webpack_require__(1)
  2785. var templateParser = __webpack_require__(19)
  2786. module.exports = {
  2787. bind: function () {
  2788. // a comment node means this is a binding for
  2789. // {{{ inline unescaped html }}}
  2790. if (this.el.nodeType === 8) {
  2791. // hold nodes
  2792. this.nodes = []
  2793. // replace the placeholder with proper anchor
  2794. this.anchor = _.createAnchor('v-html')
  2795. _.replace(this.el, this.anchor)
  2796. }
  2797. },
  2798. update: function (value) {
  2799. value = _.toString(value)
  2800. if (this.nodes) {
  2801. this.swap(value)
  2802. } else {
  2803. this.el.innerHTML = value
  2804. }
  2805. },
  2806. swap: function (value) {
  2807. // remove old nodes
  2808. var i = this.nodes.length
  2809. while (i--) {
  2810. _.remove(this.nodes[i])
  2811. }
  2812. // convert new value to a fragment
  2813. // do not attempt to retrieve from id selector
  2814. var frag = templateParser.parse(value, true, true)
  2815. // save a reference to these nodes so we can remove later
  2816. this.nodes = _.toArray(frag.childNodes)
  2817. _.before(frag, this.anchor)
  2818. }
  2819. }
  2820. /***/ },
  2821. /* 19 */
  2822. /***/ function(module, exports, __webpack_require__) {
  2823. var _ = __webpack_require__(1)
  2824. var Cache = __webpack_require__(7)
  2825. var templateCache = new Cache(1000)
  2826. var idSelectorCache = new Cache(1000)
  2827. var map = {
  2828. _default: [0, '', ''],
  2829. legend: [1, '<fieldset>', '</fieldset>'],
  2830. tr: [2, '<table><tbody>', '</tbody></table>'],
  2831. col: [
  2832. 2,
  2833. '<table><tbody></tbody><colgroup>',
  2834. '</colgroup></table>'
  2835. ]
  2836. }
  2837. map.td =
  2838. map.th = [
  2839. 3,
  2840. '<table><tbody><tr>',
  2841. '</tr></tbody></table>'
  2842. ]
  2843. map.option =
  2844. map.optgroup = [
  2845. 1,
  2846. '<select multiple="multiple">',
  2847. '</select>'
  2848. ]
  2849. map.thead =
  2850. map.tbody =
  2851. map.colgroup =
  2852. map.caption =
  2853. map.tfoot = [1, '<table>', '</table>']
  2854. map.g =
  2855. map.defs =
  2856. map.symbol =
  2857. map.use =
  2858. map.image =
  2859. map.text =
  2860. map.circle =
  2861. map.ellipse =
  2862. map.line =
  2863. map.path =
  2864. map.polygon =
  2865. map.polyline =
  2866. map.rect = [
  2867. 1,
  2868. '<svg ' +
  2869. 'xmlns="http://www.w3.org/2000/svg" ' +
  2870. 'xmlns:xlink="http://www.w3.org/1999/xlink" ' +
  2871. 'xmlns:ev="http://www.w3.org/2001/xml-events"' +
  2872. 'version="1.1">',
  2873. '</svg>'
  2874. ]
  2875. /**
  2876. * Check if a node is a supported template node with a
  2877. * DocumentFragment content.
  2878. *
  2879. * @param {Node} node
  2880. * @return {Boolean}
  2881. */
  2882. function isRealTemplate (node) {
  2883. return _.isTemplate(node) &&
  2884. node.content instanceof DocumentFragment
  2885. }
  2886. var tagRE = /<([\w:]+)/
  2887. var entityRE = /&\w+;|&#\d+;|&#x[\dA-F]+;/
  2888. /**
  2889. * Convert a string template to a DocumentFragment.
  2890. * Determines correct wrapping by tag types. Wrapping
  2891. * strategy found in jQuery & component/domify.
  2892. *
  2893. * @param {String} templateString
  2894. * @return {DocumentFragment}
  2895. */
  2896. function stringToFragment (templateString) {
  2897. // try a cache hit first
  2898. var hit = templateCache.get(templateString)
  2899. if (hit) {
  2900. return hit
  2901. }
  2902. var frag = document.createDocumentFragment()
  2903. var tagMatch = templateString.match(tagRE)
  2904. var entityMatch = entityRE.test(templateString)
  2905. if (!tagMatch && !entityMatch) {
  2906. // text only, return a single text node.
  2907. frag.appendChild(
  2908. document.createTextNode(templateString)
  2909. )
  2910. } else {
  2911. var tag = tagMatch && tagMatch[1]
  2912. var wrap = map[tag] || map._default
  2913. var depth = wrap[0]
  2914. var prefix = wrap[1]
  2915. var suffix = wrap[2]
  2916. var node = document.createElement('div')
  2917. node.innerHTML = prefix + templateString.trim() + suffix
  2918. while (depth--) {
  2919. node = node.lastChild
  2920. }
  2921. var child
  2922. /* eslint-disable no-cond-assign */
  2923. while (child = node.firstChild) {
  2924. /* eslint-enable no-cond-assign */
  2925. frag.appendChild(child)
  2926. }
  2927. }
  2928. templateCache.put(templateString, frag)
  2929. return frag
  2930. }
  2931. /**
  2932. * Convert a template node to a DocumentFragment.
  2933. *
  2934. * @param {Node} node
  2935. * @return {DocumentFragment}
  2936. */
  2937. function nodeToFragment (node) {
  2938. // if its a template tag and the browser supports it,
  2939. // its content is already a document fragment.
  2940. if (isRealTemplate(node)) {
  2941. _.trimNode(node.content)
  2942. return node.content
  2943. }
  2944. // script template
  2945. if (node.tagName === 'SCRIPT') {
  2946. return stringToFragment(node.textContent)
  2947. }
  2948. // normal node, clone it to avoid mutating the original
  2949. var clone = exports.clone(node)
  2950. var frag = document.createDocumentFragment()
  2951. var child
  2952. /* eslint-disable no-cond-assign */
  2953. while (child = clone.firstChild) {
  2954. /* eslint-enable no-cond-assign */
  2955. frag.appendChild(child)
  2956. }
  2957. _.trimNode(frag)
  2958. return frag
  2959. }
  2960. // Test for the presence of the Safari template cloning bug
  2961. // https://bugs.webkit.org/show_bug.cgi?id=137755
  2962. var hasBrokenTemplate = (function () {
  2963. /* istanbul ignore else */
  2964. if (_.inBrowser) {
  2965. var a = document.createElement('div')
  2966. a.innerHTML = '<template>1</template>'
  2967. return !a.cloneNode(true).firstChild.innerHTML
  2968. } else {
  2969. return false
  2970. }
  2971. })()
  2972. // Test for IE10/11 textarea placeholder clone bug
  2973. var hasTextareaCloneBug = (function () {
  2974. /* istanbul ignore else */
  2975. if (_.inBrowser) {
  2976. var t = document.createElement('textarea')
  2977. t.placeholder = 't'
  2978. return t.cloneNode(true).value === 't'
  2979. } else {
  2980. return false
  2981. }
  2982. })()
  2983. /**
  2984. * 1. Deal with Safari cloning nested <template> bug by
  2985. * manually cloning all template instances.
  2986. * 2. Deal with IE10/11 textarea placeholder bug by settings
  2987. * the correct value after cloning.
  2988. *
  2989. * @param {Element|DocumentFragment} node
  2990. * @return {Element|DocumentFragment}
  2991. */
  2992. exports.clone = function (node) {
  2993. if (!node.querySelectorAll) {
  2994. return node.cloneNode()
  2995. }
  2996. var res = node.cloneNode(true)
  2997. var i, original, cloned
  2998. /* istanbul ignore if */
  2999. if (hasBrokenTemplate) {
  3000. var clone = res
  3001. if (isRealTemplate(node)) {
  3002. node = node.content
  3003. clone = res.content
  3004. }
  3005. original = node.querySelectorAll('template')
  3006. if (original.length) {
  3007. cloned = clone.querySelectorAll('template')
  3008. i = cloned.length
  3009. while (i--) {
  3010. cloned[i].parentNode.replaceChild(
  3011. exports.clone(original[i]),
  3012. cloned[i]
  3013. )
  3014. }
  3015. }
  3016. }
  3017. /* istanbul ignore if */
  3018. if (hasTextareaCloneBug) {
  3019. if (node.tagName === 'TEXTAREA') {
  3020. res.value = node.value
  3021. } else {
  3022. original = node.querySelectorAll('textarea')
  3023. if (original.length) {
  3024. cloned = res.querySelectorAll('textarea')
  3025. i = cloned.length
  3026. while (i--) {
  3027. cloned[i].value = original[i].value
  3028. }
  3029. }
  3030. }
  3031. }
  3032. return res
  3033. }
  3034. /**
  3035. * Process the template option and normalizes it into a
  3036. * a DocumentFragment that can be used as a partial or a
  3037. * instance template.
  3038. *
  3039. * @param {*} template
  3040. * Possible values include:
  3041. * - DocumentFragment object
  3042. * - Node object of type Template
  3043. * - id selector: '#some-template-id'
  3044. * - template string: '<div><span>{{msg}}</span></div>'
  3045. * @param {Boolean} clone
  3046. * @param {Boolean} noSelector
  3047. * @return {DocumentFragment|undefined}
  3048. */
  3049. exports.parse = function (template, clone, noSelector) {
  3050. var node, frag
  3051. // if the template is already a document fragment,
  3052. // do nothing
  3053. if (template instanceof DocumentFragment) {
  3054. _.trimNode(template)
  3055. return clone
  3056. ? exports.clone(template)
  3057. : template
  3058. }
  3059. if (typeof template === 'string') {
  3060. // id selector
  3061. if (!noSelector && template.charAt(0) === '#') {
  3062. // id selector can be cached too
  3063. frag = idSelectorCache.get(template)
  3064. if (!frag) {
  3065. node = document.getElementById(template.slice(1))
  3066. if (node) {
  3067. frag = nodeToFragment(node)
  3068. // save selector to cache
  3069. idSelectorCache.put(template, frag)
  3070. }
  3071. }
  3072. } else {
  3073. // normal string template
  3074. frag = stringToFragment(template)
  3075. }
  3076. } else if (template.nodeType) {
  3077. // a direct node
  3078. frag = nodeToFragment(template)
  3079. }
  3080. return frag && clone
  3081. ? exports.clone(frag)
  3082. : frag
  3083. }
  3084. /***/ },
  3085. /* 20 */
  3086. /***/ function(module, exports, __webpack_require__) {
  3087. var _ = __webpack_require__(1)
  3088. var FragmentFactory = __webpack_require__(21)
  3089. var isObject = _.isObject
  3090. var uid = 0
  3091. module.exports = {
  3092. priority: 2000,
  3093. params: [
  3094. 'track-by',
  3095. 'stagger',
  3096. 'enter-stagger',
  3097. 'leave-stagger'
  3098. ],
  3099. bind: function () {
  3100. // support "item in items" syntax
  3101. var inMatch = this.expression.match(/(.*) in (.*)/)
  3102. if (inMatch) {
  3103. var itMatch = inMatch[1].match(/\((.*),(.*)\)/)
  3104. if (itMatch) {
  3105. this.iterator = itMatch[1].trim()
  3106. this.alias = itMatch[2].trim()
  3107. } else {
  3108. this.alias = inMatch[1].trim()
  3109. }
  3110. this.expression = inMatch[2]
  3111. }
  3112. if (!this.alias) {
  3113. ("development") !== 'production' && _.warn(
  3114. 'Alias is required in v-for.'
  3115. )
  3116. return
  3117. }
  3118. // uid as a cache identifier
  3119. this.id = '__v-for__' + (++uid)
  3120. // check if this is an option list,
  3121. // so that we know if we need to update the <select>'s
  3122. // v-model when the option list has changed.
  3123. // because v-model has a lower priority than v-for,
  3124. // the v-model is not bound here yet, so we have to
  3125. // retrive it in the actual updateModel() function.
  3126. var tag = this.el.tagName
  3127. this.isOption =
  3128. (tag === 'OPTION' || tag === 'OPTGROUP') &&
  3129. this.el.parentNode.tagName === 'SELECT'
  3130. // setup anchor nodes
  3131. this.start = _.createAnchor('v-for-start')
  3132. this.end = _.createAnchor('v-for-end')
  3133. _.replace(this.el, this.end)
  3134. _.before(this.start, this.end)
  3135. // check ref
  3136. this.ref = _.findRef(this.el)
  3137. // cache
  3138. this.cache = Object.create(null)
  3139. // fragment factory
  3140. this.factory = new FragmentFactory(this.vm, this.el)
  3141. },
  3142. update: function (data) {
  3143. this.diff(data)
  3144. this.updateRef()
  3145. this.updateModel()
  3146. },
  3147. /**
  3148. * Diff, based on new data and old data, determine the
  3149. * minimum amount of DOM manipulations needed to make the
  3150. * DOM reflect the new data Array.
  3151. *
  3152. * The algorithm diffs the new data Array by storing a
  3153. * hidden reference to an owner vm instance on previously
  3154. * seen data. This allows us to achieve O(n) which is
  3155. * better than a levenshtein distance based algorithm,
  3156. * which is O(m * n).
  3157. *
  3158. * @param {Array} data
  3159. */
  3160. diff: function (data) {
  3161. // check if the Array was converted from an Object
  3162. var item = data[0]
  3163. var convertedFromObject = this.fromObject =
  3164. isObject(item) &&
  3165. item.hasOwnProperty('$key') &&
  3166. item.hasOwnProperty('$value')
  3167. var trackByKey = this.params.trackBy
  3168. var oldFrags = this.frags
  3169. var frags = this.frags = new Array(data.length)
  3170. var alias = this.alias
  3171. var iterator = this.iterator
  3172. var start = this.start
  3173. var end = this.end
  3174. var inDoc = _.inDoc(start)
  3175. var init = !oldFrags
  3176. var i, l, frag, key, value, primitive
  3177. // First pass, go through the new Array and fill up
  3178. // the new frags array. If a piece of data has a cached
  3179. // instance for it, we reuse it. Otherwise build a new
  3180. // instance.
  3181. for (i = 0, l = data.length; i < l; i++) {
  3182. item = data[i]
  3183. key = convertedFromObject ? item.$key : null
  3184. value = convertedFromObject ? item.$value : item
  3185. primitive = !isObject(value)
  3186. frag = !init && this.getCachedFrag(value, i, key)
  3187. if (frag) { // reusable fragment
  3188. frag.reused = true
  3189. // update $index
  3190. frag.scope.$index = i
  3191. // update $key
  3192. if (key) {
  3193. frag.scope.$key = key
  3194. }
  3195. // update iterator
  3196. if (iterator) {
  3197. frag.scope[iterator] = key !== null ? key : i
  3198. }
  3199. // update data for track-by, object repeat &
  3200. // primitive values.
  3201. if (trackByKey || convertedFromObject || primitive) {
  3202. frag.scope[alias] = value
  3203. }
  3204. } else { // new isntance
  3205. frag = this.create(value, alias, i, key)
  3206. frag.fresh = !init
  3207. }
  3208. frags[i] = frag
  3209. if (init) {
  3210. frag.before(end)
  3211. }
  3212. }
  3213. // we're done for the initial render.
  3214. if (init) {
  3215. return
  3216. }
  3217. // Second pass, go through the old fragments and
  3218. // destroy those who are not reused (and remove them
  3219. // from cache)
  3220. var removalIndex = 0
  3221. var totalRemoved = oldFrags.length - frags.length
  3222. for (i = 0, l = oldFrags.length; i < l; i++) {
  3223. frag = oldFrags[i]
  3224. if (!frag.reused) {
  3225. this.deleteCachedFrag(frag)
  3226. this.remove(frag, removalIndex++, totalRemoved, inDoc)
  3227. }
  3228. }
  3229. // Final pass, move/insert new fragments into the
  3230. // right place.
  3231. var targetPrev, prevEl, currentPrev
  3232. var insertionIndex = 0
  3233. for (i = 0, l = frags.length; i < l; i++) {
  3234. frag = frags[i]
  3235. // this is the frag that we should be after
  3236. targetPrev = frags[i - 1]
  3237. prevEl = targetPrev
  3238. ? targetPrev.staggerCb
  3239. ? targetPrev.staggerAnchor
  3240. : targetPrev.end || targetPrev.node
  3241. : start
  3242. if (frag.reused && !frag.staggerCb) {
  3243. currentPrev = findPrevFrag(frag, start, this.id)
  3244. if (currentPrev !== targetPrev) {
  3245. this.move(frag, prevEl)
  3246. }
  3247. } else {
  3248. // new instance, or still in stagger.
  3249. // insert with updated stagger index.
  3250. this.insert(frag, insertionIndex++, prevEl, inDoc)
  3251. }
  3252. frag.reused = frag.fresh = false
  3253. }
  3254. },
  3255. /**
  3256. * Create a new fragment instance.
  3257. *
  3258. * @param {*} value
  3259. * @param {String} alias
  3260. * @param {Number} index
  3261. * @param {String} [key]
  3262. * @return {Fragment}
  3263. */
  3264. create: function (value, alias, index, key) {
  3265. var host = this._host
  3266. // create iteration scope
  3267. var parentScope = this._scope || this.vm
  3268. var scope = Object.create(parentScope)
  3269. // ref holder for the scope
  3270. scope.$refs = Object.create(parentScope.$refs)
  3271. scope.$els = Object.create(parentScope.$els)
  3272. // make sure point $parent to parent scope
  3273. scope.$parent = parentScope
  3274. // for two-way binding on alias
  3275. scope.$forContext = this
  3276. // define scope properties
  3277. _.defineReactive(scope, alias, value)
  3278. _.defineReactive(scope, '$index', index)
  3279. if (key) {
  3280. _.defineReactive(scope, '$key', key)
  3281. } else if (scope.$key) {
  3282. // avoid accidental fallback
  3283. _.define(scope, '$key', null)
  3284. }
  3285. if (this.iterator) {
  3286. _.defineReactive(scope, this.iterator, key !== null ? key : index)
  3287. }
  3288. var frag = this.factory.create(host, scope, this._frag)
  3289. frag.forId = this.id
  3290. this.cacheFrag(value, frag, index, key)
  3291. return frag
  3292. },
  3293. /**
  3294. * Update the v-ref on owner vm.
  3295. */
  3296. updateRef: function () {
  3297. var ref = this.ref
  3298. if (!ref) return
  3299. var hash = (this._scope || this.vm).$refs
  3300. var refs
  3301. if (!this.fromObject) {
  3302. refs = this.frags.map(findVmFromFrag)
  3303. } else {
  3304. refs = {}
  3305. this.frags.forEach(function (frag) {
  3306. refs[frag.scope.$key] = findVmFromFrag(frag)
  3307. })
  3308. }
  3309. if (!hash.hasOwnProperty(ref)) {
  3310. _.defineReactive(hash, ref, refs)
  3311. } else {
  3312. hash[ref] = refs
  3313. }
  3314. },
  3315. /**
  3316. * For option lists, update the containing v-model on
  3317. * parent <select>.
  3318. */
  3319. updateModel: function () {
  3320. if (this.isOption) {
  3321. var parent = this.start.parentNode
  3322. var model = parent && parent.__v_model
  3323. if (model) {
  3324. model.forceUpdate()
  3325. }
  3326. }
  3327. },
  3328. /**
  3329. * Insert a fragment. Handles staggering.
  3330. *
  3331. * @param {Fragment} frag
  3332. * @param {Number} index
  3333. * @param {Node} prevEl
  3334. * @param {Boolean} inDoc
  3335. */
  3336. insert: function (frag, index, prevEl, inDoc) {
  3337. if (frag.staggerCb) {
  3338. frag.staggerCb.cancel()
  3339. frag.staggerCb = null
  3340. }
  3341. var staggerAmount = this.getStagger(frag, index, null, 'enter')
  3342. if (inDoc && staggerAmount) {
  3343. // create an anchor and insert it synchronously,
  3344. // so that we can resolve the correct order without
  3345. // worrying about some elements not inserted yet
  3346. var anchor = frag.staggerAnchor
  3347. if (!anchor) {
  3348. anchor = frag.staggerAnchor = _.createAnchor('stagger-anchor')
  3349. anchor.__vfrag__ = frag
  3350. }
  3351. _.after(anchor, prevEl)
  3352. var op = frag.staggerCb = _.cancellable(function () {
  3353. frag.staggerCb = null
  3354. frag.before(anchor)
  3355. _.remove(anchor)
  3356. })
  3357. setTimeout(op, staggerAmount)
  3358. } else {
  3359. frag.before(prevEl.nextSibling)
  3360. }
  3361. },
  3362. /**
  3363. * Remove a fragment. Handles staggering.
  3364. *
  3365. * @param {Fragment} frag
  3366. * @param {Number} index
  3367. * @param {Number} total
  3368. * @param {Boolean} inDoc
  3369. */
  3370. remove: function (frag, index, total, inDoc) {
  3371. if (frag.staggerCb) {
  3372. frag.staggerCb.cancel()
  3373. frag.staggerCb = null
  3374. // it's not possible for the same frag to be removed
  3375. // twice, so if we have a pending stagger callback,
  3376. // it means this frag is queued for enter but removed
  3377. // before its transition started. Since it is already
  3378. // destroyed, we can just leave it in detached state.
  3379. return
  3380. }
  3381. var staggerAmount = this.getStagger(frag, index, total, 'leave')
  3382. if (inDoc && staggerAmount) {
  3383. var op = frag.staggerCb = _.cancellable(function () {
  3384. frag.staggerCb = null
  3385. frag.remove(true)
  3386. })
  3387. setTimeout(op, staggerAmount)
  3388. } else {
  3389. frag.remove(true)
  3390. }
  3391. },
  3392. /**
  3393. * Move a fragment to a new position.
  3394. * Force no transition.
  3395. *
  3396. * @param {Fragment} frag
  3397. * @param {Node} prevEl
  3398. */
  3399. move: function (frag, prevEl) {
  3400. frag.before(prevEl.nextSibling, false)
  3401. },
  3402. /**
  3403. * Cache a fragment using track-by or the object key.
  3404. *
  3405. * @param {*} value
  3406. * @param {Fragment} frag
  3407. * @param {Number} index
  3408. * @param {String} [key]
  3409. */
  3410. cacheFrag: function (value, frag, index, key) {
  3411. var trackByKey = this.params.trackBy
  3412. var cache = this.cache
  3413. var primitive = !isObject(value)
  3414. var id
  3415. if (key || trackByKey || primitive) {
  3416. id = trackByKey
  3417. ? trackByKey === '$index'
  3418. ? index
  3419. : value[trackByKey]
  3420. : (key || value)
  3421. if (!cache[id]) {
  3422. cache[id] = frag
  3423. } else if (trackByKey !== '$index') {
  3424. ("development") !== 'production' &&
  3425. this.warnDuplicate(value)
  3426. }
  3427. } else {
  3428. id = this.id
  3429. if (value.hasOwnProperty(id)) {
  3430. if (value[id] === null) {
  3431. value[id] = frag
  3432. } else {
  3433. ("development") !== 'production' &&
  3434. this.warnDuplicate(value)
  3435. }
  3436. } else {
  3437. _.define(value, id, frag)
  3438. }
  3439. }
  3440. frag.raw = value
  3441. },
  3442. /**
  3443. * Get a cached fragment from the value/index/key
  3444. *
  3445. * @param {*} value
  3446. * @param {Number} index
  3447. * @param {String} key
  3448. * @return {Fragment}
  3449. */
  3450. getCachedFrag: function (value, index, key) {
  3451. var trackByKey = this.params.trackBy
  3452. var primitive = !isObject(value)
  3453. var frag
  3454. if (key || trackByKey || primitive) {
  3455. var id = trackByKey
  3456. ? trackByKey === '$index'
  3457. ? index
  3458. : value[trackByKey]
  3459. : (key || value)
  3460. frag = this.cache[id]
  3461. } else {
  3462. frag = value[this.id]
  3463. }
  3464. if (frag && (frag.reused || frag.fresh)) {
  3465. ("development") !== 'production' &&
  3466. this.warnDuplicate(value)
  3467. }
  3468. return frag
  3469. },
  3470. /**
  3471. * Delete a fragment from cache.
  3472. *
  3473. * @param {Fragment} frag
  3474. */
  3475. deleteCachedFrag: function (frag) {
  3476. var value = frag.raw
  3477. var trackByKey = this.params.trackBy
  3478. var scope = frag.scope
  3479. var index = scope.$index
  3480. // fix #948: avoid accidentally fall through to
  3481. // a parent repeater which happens to have $key.
  3482. var key = scope.hasOwnProperty('$key') && scope.$key
  3483. var primitive = !isObject(value)
  3484. if (trackByKey || key || primitive) {
  3485. var id = trackByKey
  3486. ? trackByKey === '$index'
  3487. ? index
  3488. : value[trackByKey]
  3489. : (key || value)
  3490. this.cache[id] = null
  3491. } else {
  3492. value[this.id] = null
  3493. frag.raw = null
  3494. }
  3495. },
  3496. /**
  3497. * Get the stagger amount for an insertion/removal.
  3498. *
  3499. * @param {Fragment} frag
  3500. * @param {Number} index
  3501. * @param {Number} total
  3502. * @param {String} type
  3503. */
  3504. getStagger: function (frag, index, total, type) {
  3505. type = type + 'Stagger'
  3506. var trans = frag.node.__v_trans
  3507. var hooks = trans && trans.hooks
  3508. var hook = hooks && (hooks[type] || hooks.stagger)
  3509. return hook
  3510. ? hook.call(frag, index, total)
  3511. : index * parseInt(this.params[type] || this.params.stagger, 10)
  3512. },
  3513. /**
  3514. * Pre-process the value before piping it through the
  3515. * filters. This is passed to and called by the watcher.
  3516. */
  3517. _preProcess: function (value) {
  3518. // regardless of type, store the un-filtered raw value.
  3519. this.rawValue = value
  3520. return value
  3521. },
  3522. /**
  3523. * Post-process the value after it has been piped through
  3524. * the filters. This is passed to and called by the watcher.
  3525. *
  3526. * It is necessary for this to be called during the
  3527. * wathcer's dependency collection phase because we want
  3528. * the v-for to update when the source Object is mutated.
  3529. */
  3530. _postProcess: function (value) {
  3531. if (_.isArray(value)) {
  3532. return value
  3533. } else if (_.isPlainObject(value)) {
  3534. // convert plain object to array.
  3535. var keys = Object.keys(value)
  3536. var i = keys.length
  3537. var res = new Array(i)
  3538. var key
  3539. while (i--) {
  3540. key = keys[i]
  3541. res[i] = {
  3542. $key: key,
  3543. $value: value[key]
  3544. }
  3545. }
  3546. return res
  3547. } else {
  3548. var type = typeof value
  3549. if (type === 'number') {
  3550. value = range(value)
  3551. } else if (type === 'string') {
  3552. value = _.toArray(value)
  3553. }
  3554. return value || []
  3555. }
  3556. },
  3557. unbind: function () {
  3558. if (this.ref) {
  3559. (this._scope || this.vm).$refs[this.ref] = null
  3560. }
  3561. if (this.frags) {
  3562. var i = this.frags.length
  3563. var frag
  3564. while (i--) {
  3565. frag = this.frags[i]
  3566. this.deleteCachedFrag(frag)
  3567. frag.destroy()
  3568. }
  3569. }
  3570. }
  3571. }
  3572. /**
  3573. * Helper to find the previous element that is a fragment
  3574. * anchor. This is necessary because a destroyed frag's
  3575. * element could still be lingering in the DOM before its
  3576. * leaving transition finishes, but its inserted flag
  3577. * should have been set to false so we can skip them.
  3578. *
  3579. * If this is a block repeat, we want to make sure we only
  3580. * return frag that is bound to this v-for. (see #929)
  3581. *
  3582. * @param {Fragment} frag
  3583. * @param {Comment|Text} anchor
  3584. * @param {String} id
  3585. * @return {Fragment}
  3586. */
  3587. function findPrevFrag (frag, anchor, id) {
  3588. var el = frag.node.previousSibling
  3589. /* istanbul ignore if */
  3590. if (!el) return
  3591. frag = el.__vfrag__
  3592. while (
  3593. (!frag || frag.forId !== id || !frag.inserted) &&
  3594. el !== anchor
  3595. ) {
  3596. el = el.previousSibling
  3597. /* istanbul ignore if */
  3598. if (!el) return
  3599. frag = el.__vfrag__
  3600. }
  3601. return frag
  3602. }
  3603. /**
  3604. * Find a vm from a fragment.
  3605. *
  3606. * @param {Fragment} frag
  3607. * @return {Vue|undefined}
  3608. */
  3609. function findVmFromFrag (frag) {
  3610. return frag.node.__vue__ || frag.node.nextSibling.__vue__
  3611. }
  3612. /**
  3613. * Create a range array from given number.
  3614. *
  3615. * @param {Number} n
  3616. * @return {Array}
  3617. */
  3618. function range (n) {
  3619. var i = -1
  3620. var ret = new Array(n)
  3621. while (++i < n) {
  3622. ret[i] = i
  3623. }
  3624. return ret
  3625. }
  3626. if (true) {
  3627. module.exports.warnDuplicate = function (value) {
  3628. _.warn(
  3629. 'Duplicate value found in v-for="' + this.descriptor.raw + '": ' +
  3630. JSON.stringify(value) + '. Use track-by="$index" if ' +
  3631. 'you are expecting duplicate values.'
  3632. )
  3633. }
  3634. }
  3635. /***/ },
  3636. /* 21 */
  3637. /***/ function(module, exports, __webpack_require__) {
  3638. var _ = __webpack_require__(1)
  3639. var compiler = __webpack_require__(14)
  3640. var templateParser = __webpack_require__(19)
  3641. var Fragment = __webpack_require__(22)
  3642. var Cache = __webpack_require__(7)
  3643. var linkerCache = new Cache(5000)
  3644. /**
  3645. * A factory that can be used to create instances of a
  3646. * fragment. Caches the compiled linker if possible.
  3647. *
  3648. * @param {Vue} vm
  3649. * @param {Element|String} el
  3650. */
  3651. function FragmentFactory (vm, el) {
  3652. this.vm = vm
  3653. var template
  3654. var isString = typeof el === 'string'
  3655. if (isString || _.isTemplate(el)) {
  3656. template = templateParser.parse(el, true)
  3657. } else {
  3658. template = document.createDocumentFragment()
  3659. template.appendChild(el)
  3660. }
  3661. this.template = template
  3662. // linker can be cached, but only for components
  3663. var linker
  3664. var cid = vm.constructor.cid
  3665. if (cid > 0) {
  3666. var cacheId = cid + (isString ? el : el.outerHTML)
  3667. linker = linkerCache.get(cacheId)
  3668. if (!linker) {
  3669. linker = compiler.compile(template, vm.$options, true)
  3670. linkerCache.put(cacheId, linker)
  3671. }
  3672. } else {
  3673. linker = compiler.compile(template, vm.$options, true)
  3674. }
  3675. this.linker = linker
  3676. }
  3677. /**
  3678. * Create a fragment instance with given host and scope.
  3679. *
  3680. * @param {Vue} host
  3681. * @param {Object} scope
  3682. * @param {Fragment} parentFrag
  3683. */
  3684. FragmentFactory.prototype.create = function (host, scope, parentFrag) {
  3685. var frag = templateParser.clone(this.template)
  3686. return new Fragment(this.linker, this.vm, frag, host, scope, parentFrag)
  3687. }
  3688. module.exports = FragmentFactory
  3689. /***/ },
  3690. /* 22 */
  3691. /***/ function(module, exports, __webpack_require__) {
  3692. var _ = __webpack_require__(1)
  3693. var transition = __webpack_require__(9)
  3694. /**
  3695. * Abstraction for a partially-compiled fragment.
  3696. * Can optionally compile content with a child scope.
  3697. *
  3698. * @param {Function} linker
  3699. * @param {Vue} vm
  3700. * @param {DocumentFragment} frag
  3701. * @param {Vue} [host]
  3702. * @param {Object} [scope]
  3703. */
  3704. function Fragment (linker, vm, frag, host, scope, parentFrag) {
  3705. this.children = []
  3706. this.childFrags = []
  3707. this.vm = vm
  3708. this.scope = scope
  3709. this.inserted = false
  3710. this.parentFrag = parentFrag
  3711. if (parentFrag) {
  3712. parentFrag.childFrags.push(this)
  3713. }
  3714. this.unlink = linker(vm, frag, host, scope, this)
  3715. var single = this.single = frag.childNodes.length === 1
  3716. if (single) {
  3717. this.node = frag.childNodes[0]
  3718. this.before = singleBefore
  3719. this.remove = singleRemove
  3720. } else {
  3721. this.node = _.createAnchor('fragment-start')
  3722. this.end = _.createAnchor('fragment-end')
  3723. this.frag = frag
  3724. _.prepend(this.node, frag)
  3725. frag.appendChild(this.end)
  3726. this.before = multiBefore
  3727. this.remove = multiRemove
  3728. }
  3729. this.node.__vfrag__ = this
  3730. }
  3731. /**
  3732. * Call attach/detach for all components contained within
  3733. * this fragment. Also do so recursively for all child
  3734. * fragments.
  3735. *
  3736. * @param {Function} hook
  3737. */
  3738. Fragment.prototype.callHook = function (hook) {
  3739. var i, l
  3740. for (i = 0, l = this.children.length; i < l; i++) {
  3741. hook(this.children[i])
  3742. }
  3743. for (i = 0, l = this.childFrags.length; i < l; i++) {
  3744. this.childFrags[i].callHook(hook)
  3745. }
  3746. }
  3747. /**
  3748. * Destroy the fragment.
  3749. */
  3750. Fragment.prototype.destroy = function () {
  3751. if (this.parentFrag) {
  3752. this.parentFrag.childFrags.$remove(this)
  3753. }
  3754. this.unlink()
  3755. }
  3756. /**
  3757. * Insert fragment before target, single node version
  3758. *
  3759. * @param {Node} target
  3760. * @param {Boolean} withTransition
  3761. */
  3762. function singleBefore (target, withTransition) {
  3763. this.inserted = true
  3764. var method = withTransition !== false
  3765. ? transition.before
  3766. : _.before
  3767. method(this.node, target, this.vm)
  3768. if (_.inDoc(this.node)) {
  3769. this.callHook(attach)
  3770. }
  3771. }
  3772. /**
  3773. * Remove fragment, single node version
  3774. *
  3775. * @param {Boolean} [destroy]
  3776. */
  3777. function singleRemove (destroy) {
  3778. this.inserted = false
  3779. var shouldCallRemove = _.inDoc(this.node)
  3780. var self = this
  3781. transition.remove(this.node, this.vm, function () {
  3782. if (shouldCallRemove) {
  3783. self.callHook(detach)
  3784. }
  3785. if (destroy) {
  3786. self.destroy()
  3787. }
  3788. })
  3789. }
  3790. /**
  3791. * Insert fragment before target, multi-nodes version
  3792. *
  3793. * @param {Node} target
  3794. * @param {Boolean} withTransition
  3795. */
  3796. function multiBefore (target, withTransition) {
  3797. this.inserted = true
  3798. var vm = this.vm
  3799. var method = withTransition !== false
  3800. ? transition.before
  3801. : _.before
  3802. _.mapNodeRange(this.node, this.end, function (node) {
  3803. method(node, target, vm)
  3804. })
  3805. if (_.inDoc(this.node)) {
  3806. this.callHook(attach)
  3807. }
  3808. }
  3809. /**
  3810. * Remove fragment, multi-nodes version
  3811. *
  3812. * @param {Boolean} [destroy]
  3813. */
  3814. function multiRemove (destroy) {
  3815. this.inserted = false
  3816. var self = this
  3817. var shouldCallRemove = _.inDoc(this.node)
  3818. _.removeNodeRange(this.node, this.end, this.vm, this.frag, function () {
  3819. if (shouldCallRemove) {
  3820. self.callHook(detach)
  3821. }
  3822. if (destroy) {
  3823. self.destroy()
  3824. }
  3825. })
  3826. }
  3827. /**
  3828. * Call attach hook for a Vue instance.
  3829. *
  3830. * @param {Vue} child
  3831. */
  3832. function attach (child) {
  3833. if (!child._isAttached) {
  3834. child._callHook('attached')
  3835. }
  3836. }
  3837. /**
  3838. * Call detach hook for a Vue instance.
  3839. *
  3840. * @param {Vue} child
  3841. */
  3842. function detach (child) {
  3843. if (child._isAttached) {
  3844. child._callHook('detached')
  3845. }
  3846. }
  3847. module.exports = Fragment
  3848. /***/ },
  3849. /* 23 */
  3850. /***/ function(module, exports, __webpack_require__) {
  3851. var _ = __webpack_require__(1)
  3852. var FragmentFactory = __webpack_require__(21)
  3853. module.exports = {
  3854. priority: 2000,
  3855. bind: function () {
  3856. var el = this.el
  3857. if (!el.__vue__) {
  3858. // check else block
  3859. var next = el.nextElementSibling
  3860. if (next && _.attr(next, 'v-else') !== null) {
  3861. _.remove(next)
  3862. this.elseFactory = new FragmentFactory(this.vm, next)
  3863. }
  3864. // check main block
  3865. this.anchor = _.createAnchor('v-if')
  3866. _.replace(el, this.anchor)
  3867. this.factory = new FragmentFactory(this.vm, el)
  3868. } else {
  3869. ("development") !== 'production' && _.warn(
  3870. 'v-if="' + this.expression + '" cannot be ' +
  3871. 'used on an instance root element.'
  3872. )
  3873. this.invalid = true
  3874. }
  3875. },
  3876. update: function (value) {
  3877. if (this.invalid) return
  3878. if (value) {
  3879. if (!this.frag) {
  3880. this.insert()
  3881. }
  3882. } else {
  3883. this.remove()
  3884. }
  3885. },
  3886. insert: function () {
  3887. if (this.elseFrag) {
  3888. this.elseFrag.remove(true)
  3889. this.elseFrag = null
  3890. }
  3891. this.frag = this.factory.create(this._host, this._scope, this._frag)
  3892. this.frag.before(this.anchor)
  3893. },
  3894. remove: function () {
  3895. if (this.frag) {
  3896. this.frag.remove(true)
  3897. this.frag = null
  3898. }
  3899. if (this.elseFactory) {
  3900. this.elseFrag = this.elseFactory.create(this._host, this._scope, this._frag)
  3901. this.elseFrag.before(this.anchor)
  3902. }
  3903. },
  3904. unbind: function () {
  3905. if (this.frag) {
  3906. this.frag.destroy()
  3907. }
  3908. }
  3909. }
  3910. /***/ },
  3911. /* 24 */
  3912. /***/ function(module, exports, __webpack_require__) {
  3913. var _ = __webpack_require__(1)
  3914. var transition = __webpack_require__(9)
  3915. module.exports = {
  3916. bind: function () {
  3917. // check else block
  3918. var next = this.el.nextElementSibling
  3919. if (next && _.attr(next, 'v-else') !== null) {
  3920. this.elseEl = next
  3921. }
  3922. },
  3923. update: function (value) {
  3924. var el = this.el
  3925. transition.apply(el, value ? 1 : -1, function () {
  3926. el.style.display = value ? '' : 'none'
  3927. }, this.vm)
  3928. var elseEl = this.elseEl
  3929. if (elseEl) {
  3930. transition.apply(elseEl, value ? -1 : 1, function () {
  3931. elseEl.style.display = value ? 'none' : ''
  3932. }, this.vm)
  3933. }
  3934. }
  3935. }
  3936. /***/ },
  3937. /* 25 */
  3938. /***/ function(module, exports, __webpack_require__) {
  3939. var _ = __webpack_require__(1)
  3940. var handlers = {
  3941. text: __webpack_require__(26),
  3942. radio: __webpack_require__(27),
  3943. select: __webpack_require__(28),
  3944. checkbox: __webpack_require__(29)
  3945. }
  3946. module.exports = {
  3947. priority: 800,
  3948. twoWay: true,
  3949. handlers: handlers,
  3950. params: ['lazy', 'number', 'debounce'],
  3951. /**
  3952. * Possible elements:
  3953. * <select>
  3954. * <textarea>
  3955. * <input type="*">
  3956. * - text
  3957. * - checkbox
  3958. * - radio
  3959. * - number
  3960. */
  3961. bind: function () {
  3962. // friendly warning...
  3963. this.checkFilters()
  3964. if (this.hasRead && !this.hasWrite) {
  3965. ("development") !== 'production' && _.warn(
  3966. 'It seems you are using a read-only filter with ' +
  3967. 'v-model. You might want to use a two-way filter ' +
  3968. 'to ensure correct behavior.'
  3969. )
  3970. }
  3971. var el = this.el
  3972. var tag = el.tagName
  3973. var handler
  3974. if (tag === 'INPUT') {
  3975. handler = handlers[el.type] || handlers.text
  3976. } else if (tag === 'SELECT') {
  3977. handler = handlers.select
  3978. } else if (tag === 'TEXTAREA') {
  3979. handler = handlers.text
  3980. } else {
  3981. ("development") !== 'production' && _.warn(
  3982. 'v-model does not support element type: ' + tag
  3983. )
  3984. return
  3985. }
  3986. el.__v_model = this
  3987. handler.bind.call(this)
  3988. this.update = handler.update
  3989. this._unbind = handler.unbind
  3990. },
  3991. /**
  3992. * Check read/write filter stats.
  3993. */
  3994. checkFilters: function () {
  3995. var filters = this.filters
  3996. if (!filters) return
  3997. var i = filters.length
  3998. while (i--) {
  3999. var filter = _.resolveAsset(this.vm.$options, 'filters', filters[i].name)
  4000. if (typeof filter === 'function' || filter.read) {
  4001. this.hasRead = true
  4002. }
  4003. if (filter.write) {
  4004. this.hasWrite = true
  4005. }
  4006. }
  4007. },
  4008. unbind: function () {
  4009. this.el.__v_model = null
  4010. this._unbind && this._unbind()
  4011. }
  4012. }
  4013. /***/ },
  4014. /* 26 */
  4015. /***/ function(module, exports, __webpack_require__) {
  4016. var _ = __webpack_require__(1)
  4017. module.exports = {
  4018. bind: function () {
  4019. var self = this
  4020. var el = this.el
  4021. var isRange = el.type === 'range'
  4022. var lazy = this.params.lazy
  4023. var number = this.params.number
  4024. var debounce = this.params.debounce
  4025. // handle composition events.
  4026. // http://blog.evanyou.me/2014/01/03/composition-event/
  4027. // skip this for Android because it handles composition
  4028. // events quite differently. Android doesn't trigger
  4029. // composition events for language input methods e.g.
  4030. // Chinese, but instead triggers them for spelling
  4031. // suggestions... (see Discussion/#162)
  4032. var composing = false
  4033. if (!_.isAndroid && !isRange) {
  4034. this.on('compositionstart', function () {
  4035. composing = true
  4036. })
  4037. this.on('compositionend', function () {
  4038. composing = false
  4039. // in IE11 the "compositionend" event fires AFTER
  4040. // the "input" event, so the input handler is blocked
  4041. // at the end... have to call it here.
  4042. //
  4043. // #1327: in lazy mode this is unecessary.
  4044. if (!lazy) {
  4045. self.listener()
  4046. }
  4047. })
  4048. }
  4049. // prevent messing with the input when user is typing,
  4050. // and force update on blur.
  4051. this.focused = false
  4052. if (!isRange) {
  4053. this.on('focus', function () {
  4054. self.focused = true
  4055. })
  4056. this.on('blur', function () {
  4057. self.focused = false
  4058. self.listener()
  4059. })
  4060. }
  4061. // Now attach the main listener
  4062. this.listener = function () {
  4063. if (composing) return
  4064. var val = number || isRange
  4065. ? _.toNumber(el.value)
  4066. : el.value
  4067. self.set(val)
  4068. // force update on next tick to avoid lock & same value
  4069. // also only update when user is not typing
  4070. _.nextTick(function () {
  4071. if (self._bound && !self.focused) {
  4072. self.update(self._watcher.value)
  4073. }
  4074. })
  4075. }
  4076. // apply debounce
  4077. if (debounce) {
  4078. this.listener = _.debounce(this.listener, debounce)
  4079. }
  4080. // Support jQuery events, since jQuery.trigger() doesn't
  4081. // trigger native events in some cases and some plugins
  4082. // rely on $.trigger()
  4083. //
  4084. // We want to make sure if a listener is attached using
  4085. // jQuery, it is also removed with jQuery, that's why
  4086. // we do the check for each directive instance and
  4087. // store that check result on itself. This also allows
  4088. // easier test coverage control by unsetting the global
  4089. // jQuery variable in tests.
  4090. this.hasjQuery = typeof jQuery === 'function'
  4091. if (this.hasjQuery) {
  4092. jQuery(el).on('change', this.listener)
  4093. if (!lazy) {
  4094. jQuery(el).on('input', this.listener)
  4095. }
  4096. } else {
  4097. this.on('change', this.listener)
  4098. if (!lazy) {
  4099. this.on('input', this.listener)
  4100. }
  4101. }
  4102. // IE9 doesn't fire input event on backspace/del/cut
  4103. if (!lazy && _.isIE9) {
  4104. this.on('cut', function () {
  4105. _.nextTick(self.listener)
  4106. })
  4107. this.on('keyup', function (e) {
  4108. if (e.keyCode === 46 || e.keyCode === 8) {
  4109. self.listener()
  4110. }
  4111. })
  4112. }
  4113. // set initial value if present
  4114. if (
  4115. el.hasAttribute('value') ||
  4116. (el.tagName === 'TEXTAREA' && el.value.trim())
  4117. ) {
  4118. this.afterBind = this.listener
  4119. }
  4120. },
  4121. update: function (value) {
  4122. this.el.value = _.toString(value)
  4123. },
  4124. unbind: function () {
  4125. var el = this.el
  4126. if (this.hasjQuery) {
  4127. jQuery(el).off('change', this.listener)
  4128. jQuery(el).off('input', this.listener)
  4129. }
  4130. }
  4131. }
  4132. /***/ },
  4133. /* 27 */
  4134. /***/ function(module, exports, __webpack_require__) {
  4135. var _ = __webpack_require__(1)
  4136. module.exports = {
  4137. bind: function () {
  4138. var self = this
  4139. var el = this.el
  4140. this.getValue = function () {
  4141. // value overwrite via v-bind:value
  4142. if (el.hasOwnProperty('_value')) {
  4143. return el._value
  4144. }
  4145. var val = el.value
  4146. if (self.params.number) {
  4147. val = _.toNumber(val)
  4148. }
  4149. return val
  4150. }
  4151. this.listener = function () {
  4152. self.set(self.getValue())
  4153. }
  4154. this.on('change', this.listener)
  4155. if (el.checked) {
  4156. this.afterBind = this.listener
  4157. }
  4158. },
  4159. update: function (value) {
  4160. this.el.checked = _.looseEqual(value, this.getValue())
  4161. }
  4162. }
  4163. /***/ },
  4164. /* 28 */
  4165. /***/ function(module, exports, __webpack_require__) {
  4166. var _ = __webpack_require__(1)
  4167. module.exports = {
  4168. bind: function () {
  4169. var self = this
  4170. var el = this.el
  4171. // method to force update DOM using latest value.
  4172. this.forceUpdate = function () {
  4173. if (self._watcher) {
  4174. self.update(self._watcher.get())
  4175. }
  4176. }
  4177. // check if this is a multiple select
  4178. var multiple = this.multiple = el.hasAttribute('multiple')
  4179. // attach listener
  4180. this.listener = function () {
  4181. var value = getValue(el, multiple)
  4182. value = self.params.number
  4183. ? _.isArray(value)
  4184. ? value.map(_.toNumber)
  4185. : _.toNumber(value)
  4186. : value
  4187. self.set(value)
  4188. }
  4189. this.on('change', this.listener)
  4190. // if has initial value, set afterBind
  4191. var initValue = getValue(el, multiple, true)
  4192. if ((multiple && initValue.length) ||
  4193. (!multiple && initValue !== null)) {
  4194. this.afterBind = this.listener
  4195. }
  4196. // All major browsers except Firefox resets
  4197. // selectedIndex with value -1 to 0 when the element
  4198. // is appended to a new parent, therefore we have to
  4199. // force a DOM update whenever that happens...
  4200. this.vm.$on('hook:attached', this.forceUpdate)
  4201. },
  4202. update: function (value) {
  4203. var el = this.el
  4204. el.selectedIndex = -1
  4205. var multi = this.multiple && _.isArray(value)
  4206. var options = el.options
  4207. var i = options.length
  4208. var op, val
  4209. while (i--) {
  4210. op = options[i]
  4211. val = op.hasOwnProperty('_value')
  4212. ? op._value
  4213. : op.value
  4214. /* eslint-disable eqeqeq */
  4215. op.selected = multi
  4216. ? indexOf(value, val) > -1
  4217. : _.looseEqual(value, val)
  4218. /* eslint-enable eqeqeq */
  4219. }
  4220. },
  4221. unbind: function () {
  4222. /* istanbul ignore next */
  4223. this.vm.$off('hook:attached', this.forceUpdate)
  4224. }
  4225. }
  4226. /**
  4227. * Get select value
  4228. *
  4229. * @param {SelectElement} el
  4230. * @param {Boolean} multi
  4231. * @param {Boolean} init
  4232. * @return {Array|*}
  4233. */
  4234. function getValue (el, multi, init) {
  4235. var res = multi ? [] : null
  4236. var op, val, selected
  4237. for (var i = 0, l = el.options.length; i < l; i++) {
  4238. op = el.options[i]
  4239. selected = init
  4240. ? op.hasAttribute('selected')
  4241. : op.selected
  4242. if (selected) {
  4243. val = op.hasOwnProperty('_value')
  4244. ? op._value
  4245. : op.value
  4246. if (multi) {
  4247. res.push(val)
  4248. } else {
  4249. return val
  4250. }
  4251. }
  4252. }
  4253. return res
  4254. }
  4255. /**
  4256. * Native Array.indexOf uses strict equal, but in this
  4257. * case we need to match string/numbers with custom equal.
  4258. *
  4259. * @param {Array} arr
  4260. * @param {*} val
  4261. */
  4262. function indexOf (arr, val) {
  4263. var i = arr.length
  4264. while (i--) {
  4265. if (_.looseEqual(arr[i], val)) {
  4266. return i
  4267. }
  4268. }
  4269. return -1
  4270. }
  4271. /***/ },
  4272. /* 29 */
  4273. /***/ function(module, exports, __webpack_require__) {
  4274. var _ = __webpack_require__(1)
  4275. module.exports = {
  4276. bind: function () {
  4277. var self = this
  4278. var el = this.el
  4279. this.getValue = function () {
  4280. return el.hasOwnProperty('_value')
  4281. ? el._value
  4282. : self.params.number
  4283. ? _.toNumber(el.value)
  4284. : el.value
  4285. }
  4286. function getBooleanValue () {
  4287. var val = el.checked
  4288. if (val && el.hasOwnProperty('_trueValue')) {
  4289. return el._trueValue
  4290. }
  4291. if (!val && el.hasOwnProperty('_falseValue')) {
  4292. return el._falseValue
  4293. }
  4294. return val
  4295. }
  4296. this.listener = function () {
  4297. var model = self._watcher.value
  4298. if (_.isArray(model)) {
  4299. var val = self.getValue()
  4300. if (el.checked) {
  4301. if (_.indexOf(model, val) < 0) {
  4302. model.push(val)
  4303. }
  4304. } else {
  4305. model.$remove(val)
  4306. }
  4307. } else {
  4308. self.set(getBooleanValue())
  4309. }
  4310. }
  4311. this.on('change', this.listener)
  4312. if (el.checked) {
  4313. this.afterBind = this.listener
  4314. }
  4315. },
  4316. update: function (value) {
  4317. var el = this.el
  4318. if (_.isArray(value)) {
  4319. el.checked = _.indexOf(value, this.getValue()) > -1
  4320. } else {
  4321. if (el.hasOwnProperty('_trueValue')) {
  4322. el.checked = _.looseEqual(value, el._trueValue)
  4323. } else {
  4324. el.checked = !!value
  4325. }
  4326. }
  4327. }
  4328. }
  4329. /***/ },
  4330. /* 30 */
  4331. /***/ function(module, exports, __webpack_require__) {
  4332. var _ = __webpack_require__(1)
  4333. // keyCode aliases
  4334. var keyCodes = {
  4335. esc: 27,
  4336. tab: 9,
  4337. enter: 13,
  4338. space: 32,
  4339. 'delete': 46,
  4340. up: 38,
  4341. left: 37,
  4342. right: 39,
  4343. down: 40
  4344. }
  4345. function keyFilter (handler, keys) {
  4346. var codes = keys.map(function (key) {
  4347. var code = keyCodes[key]
  4348. if (!code) {
  4349. code = parseInt(key, 10)
  4350. }
  4351. return code
  4352. })
  4353. return function keyHandler (e) {
  4354. if (codes.indexOf(e.keyCode) > -1) {
  4355. return handler.call(this, e)
  4356. }
  4357. }
  4358. }
  4359. function stopFilter (handler) {
  4360. return function stopHandler (e) {
  4361. e.stopPropagation()
  4362. return handler.call(this, e)
  4363. }
  4364. }
  4365. function preventFilter (handler) {
  4366. return function preventHandler (e) {
  4367. e.preventDefault()
  4368. return handler.call(this, e)
  4369. }
  4370. }
  4371. module.exports = {
  4372. acceptStatement: true,
  4373. priority: 700,
  4374. bind: function () {
  4375. // deal with iframes
  4376. if (
  4377. this.el.tagName === 'IFRAME' &&
  4378. this.arg !== 'load'
  4379. ) {
  4380. var self = this
  4381. this.iframeBind = function () {
  4382. _.on(self.el.contentWindow, self.arg, self.handler)
  4383. }
  4384. this.on('load', this.iframeBind)
  4385. }
  4386. },
  4387. update: function (handler) {
  4388. // stub a noop for v-on with no value,
  4389. // e.g. @mousedown.prevent
  4390. if (!this.descriptor.raw) {
  4391. handler = function () {}
  4392. }
  4393. if (typeof handler !== 'function') {
  4394. ("development") !== 'production' && _.warn(
  4395. 'v-on:' + this.arg + '="' +
  4396. this.expression + '" expects a function value, ' +
  4397. 'got ' + handler
  4398. )
  4399. return
  4400. }
  4401. // apply modifiers
  4402. if (this.modifiers.stop) {
  4403. handler = stopFilter(handler)
  4404. }
  4405. if (this.modifiers.prevent) {
  4406. handler = preventFilter(handler)
  4407. }
  4408. // key filter
  4409. var keys = Object.keys(this.modifiers)
  4410. .filter(function (key) {
  4411. return key !== 'stop' && key !== 'prevent'
  4412. })
  4413. if (keys.length) {
  4414. handler = keyFilter(handler, keys)
  4415. }
  4416. this.reset()
  4417. var scope = this._scope || this.vm
  4418. this.handler = function (e) {
  4419. scope.$event = e
  4420. var res = handler(e)
  4421. scope.$event = null
  4422. return res
  4423. }
  4424. if (this.iframeBind) {
  4425. this.iframeBind()
  4426. } else {
  4427. _.on(this.el, this.arg, this.handler)
  4428. }
  4429. },
  4430. reset: function () {
  4431. var el = this.iframeBind
  4432. ? this.el.contentWindow
  4433. : this.el
  4434. if (this.handler) {
  4435. _.off(el, this.arg, this.handler)
  4436. }
  4437. },
  4438. unbind: function () {
  4439. this.reset()
  4440. }
  4441. }
  4442. /***/ },
  4443. /* 31 */
  4444. /***/ function(module, exports, __webpack_require__) {
  4445. var _ = __webpack_require__(1)
  4446. // xlink
  4447. var xlinkNS = 'http://www.w3.org/1999/xlink'
  4448. var xlinkRE = /^xlink:/
  4449. // these input element attributes should also set their
  4450. // corresponding properties
  4451. var inputProps = {
  4452. value: 1,
  4453. checked: 1,
  4454. selected: 1
  4455. }
  4456. // these attributes should set a hidden property for
  4457. // binding v-model to object values
  4458. var modelProps = {
  4459. value: '_value',
  4460. 'true-value': '_trueValue',
  4461. 'false-value': '_falseValue'
  4462. }
  4463. // check for attributes that prohibit interpolations
  4464. var disallowedInterpAttrRE = /^v-|^:|^@|^(is|transition|transition-mode|debounce|track-by|stagger|enter-stagger|leave-stagger)$/
  4465. module.exports = {
  4466. priority: 850,
  4467. bind: function () {
  4468. var attr = this.arg
  4469. var tag = this.el.tagName
  4470. // should be deep watch on object mode
  4471. if (!attr) {
  4472. this.deep = true
  4473. }
  4474. // handle interpolation bindings
  4475. if (this.descriptor.interp) {
  4476. // only allow binding on native attributes
  4477. if (
  4478. disallowedInterpAttrRE.test(attr) ||
  4479. (attr === 'name' && (tag === 'PARTIAL' || tag === 'SLOT'))
  4480. ) {
  4481. ("development") !== 'production' && _.warn(
  4482. attr + '="' + this.descriptor.raw + '": ' +
  4483. 'attribute interpolation is not allowed in Vue.js ' +
  4484. 'directives and special attributes.'
  4485. )
  4486. this.el.removeAttribute(attr)
  4487. this.invalid = true
  4488. }
  4489. /* istanbul ignore if */
  4490. if (true) {
  4491. var raw = attr + '="' + this.descriptor.raw + '": '
  4492. // warn src
  4493. if (attr === 'src') {
  4494. _.warn(
  4495. raw + 'interpolation in "src" attribute will cause ' +
  4496. 'a 404 request. Use v-bind:src instead.'
  4497. )
  4498. }
  4499. // warn style
  4500. if (attr === 'style') {
  4501. _.warn(
  4502. raw + 'interpolation in "style" attribute will cause ' +
  4503. 'the attribute to be discarded in Internet Explorer. ' +
  4504. 'Use v-bind:style instead.'
  4505. )
  4506. }
  4507. }
  4508. }
  4509. },
  4510. update: function (value) {
  4511. if (this.invalid) {
  4512. return
  4513. }
  4514. var attr = this.arg
  4515. if (this.arg) {
  4516. this.handleSingle(attr, value)
  4517. } else {
  4518. this.handleObject(value || {})
  4519. }
  4520. },
  4521. // share object handler with v-bind:class
  4522. handleObject: __webpack_require__(32).handleObject,
  4523. handleSingle: function (attr, value) {
  4524. if (inputProps[attr] && attr in this.el) {
  4525. this.el[attr] = attr === 'value'
  4526. ? (value || '') // IE9 will set input.value to "null" for null...
  4527. : value
  4528. }
  4529. // set model props
  4530. var modelProp = modelProps[attr]
  4531. if (modelProp) {
  4532. this.el[modelProp] = value
  4533. // update v-model if present
  4534. var model = this.el.__v_model
  4535. if (model) {
  4536. model.listener()
  4537. }
  4538. }
  4539. // do not set value attribute for textarea
  4540. if (attr === 'value' && this.el.tagName === 'TEXTAREA') {
  4541. this.el.removeAttribute(attr)
  4542. return
  4543. }
  4544. // update attribute
  4545. if (value != null && value !== false) {
  4546. if (xlinkRE.test(attr)) {
  4547. this.el.setAttributeNS(xlinkNS, attr, value)
  4548. } else {
  4549. this.el.setAttribute(attr, value)
  4550. }
  4551. } else {
  4552. this.el.removeAttribute(attr)
  4553. }
  4554. }
  4555. }
  4556. /***/ },
  4557. /* 32 */
  4558. /***/ function(module, exports, __webpack_require__) {
  4559. var _ = __webpack_require__(1)
  4560. var prefixes = ['-webkit-', '-moz-', '-ms-']
  4561. var camelPrefixes = ['Webkit', 'Moz', 'ms']
  4562. var importantRE = /!important;?$/
  4563. var testEl = null
  4564. var propCache = {}
  4565. module.exports = {
  4566. deep: true,
  4567. update: function (value) {
  4568. if (typeof value === 'string') {
  4569. this.el.style.cssText = value
  4570. } else if (_.isArray(value)) {
  4571. this.handleObject(value.reduce(_.extend, {}))
  4572. } else {
  4573. this.handleObject(value || {})
  4574. }
  4575. },
  4576. handleObject: function (value) {
  4577. // cache object styles so that only changed props
  4578. // are actually updated.
  4579. var cache = this.cache || (this.cache = {})
  4580. var name, val
  4581. for (name in cache) {
  4582. if (!(name in value)) {
  4583. this.handleSingle(name, null)
  4584. delete cache[name]
  4585. }
  4586. }
  4587. for (name in value) {
  4588. val = value[name]
  4589. if (val !== cache[name]) {
  4590. cache[name] = val
  4591. this.handleSingle(name, val)
  4592. }
  4593. }
  4594. },
  4595. handleSingle: function (prop, value) {
  4596. prop = normalize(prop)
  4597. if (!prop) return // unsupported prop
  4598. // cast possible numbers/booleans into strings
  4599. if (value != null) value += ''
  4600. if (value) {
  4601. var isImportant = importantRE.test(value)
  4602. ? 'important'
  4603. : ''
  4604. if (isImportant) {
  4605. value = value.replace(importantRE, '').trim()
  4606. }
  4607. this.el.style.setProperty(prop, value, isImportant)
  4608. } else {
  4609. this.el.style.removeProperty(prop)
  4610. }
  4611. }
  4612. }
  4613. /**
  4614. * Normalize a CSS property name.
  4615. * - cache result
  4616. * - auto prefix
  4617. * - camelCase -> dash-case
  4618. *
  4619. * @param {String} prop
  4620. * @return {String}
  4621. */
  4622. function normalize (prop) {
  4623. if (propCache[prop]) {
  4624. return propCache[prop]
  4625. }
  4626. var res = prefix(prop)
  4627. propCache[prop] = propCache[res] = res
  4628. return res
  4629. }
  4630. /**
  4631. * Auto detect the appropriate prefix for a CSS property.
  4632. * https://gist.github.com/paulirish/523692
  4633. *
  4634. * @param {String} prop
  4635. * @return {String}
  4636. */
  4637. function prefix (prop) {
  4638. prop = _.hyphenate(prop)
  4639. var camel = _.camelize(prop)
  4640. var upper = camel.charAt(0).toUpperCase() + camel.slice(1)
  4641. if (!testEl) {
  4642. testEl = document.createElement('div')
  4643. }
  4644. if (camel in testEl.style) {
  4645. return prop
  4646. }
  4647. var i = prefixes.length
  4648. var prefixed
  4649. while (i--) {
  4650. prefixed = camelPrefixes[i] + upper
  4651. if (prefixed in testEl.style) {
  4652. return prefixes[i] + prop
  4653. }
  4654. }
  4655. }
  4656. /***/ },
  4657. /* 33 */
  4658. /***/ function(module, exports, __webpack_require__) {
  4659. var _ = __webpack_require__(1)
  4660. module.exports = {
  4661. priority: 1500,
  4662. bind: function () {
  4663. /* istanbul ignore if */
  4664. if (!this.arg) {
  4665. return
  4666. }
  4667. var id = this.id = _.camelize(this.arg)
  4668. var refs = (this._scope || this.vm).$els
  4669. if (refs.hasOwnProperty(id)) {
  4670. refs[id] = this.el
  4671. } else {
  4672. _.defineReactive(refs, id, this.el)
  4673. }
  4674. },
  4675. unbind: function () {
  4676. var refs = (this._scope || this.vm).$els
  4677. if (refs[this.id] === this.el) {
  4678. refs[this.id] = null
  4679. }
  4680. }
  4681. }
  4682. /***/ },
  4683. /* 34 */
  4684. /***/ function(module, exports, __webpack_require__) {
  4685. if (true) {
  4686. module.exports = {
  4687. bind: function () {
  4688. __webpack_require__(1).warn(
  4689. 'v-ref:' + this.arg + ' must be used on a child ' +
  4690. 'component. Found on <' + this.el.tagName.toLowerCase() + '>.'
  4691. )
  4692. }
  4693. }
  4694. }
  4695. /***/ },
  4696. /* 35 */
  4697. /***/ function(module, exports) {
  4698. module.exports = {
  4699. bind: function () {
  4700. var el = this.el
  4701. this.vm.$once('hook:compiled', function () {
  4702. el.removeAttribute('v-cloak')
  4703. })
  4704. }
  4705. }
  4706. /***/ },
  4707. /* 36 */
  4708. /***/ function(module, exports, __webpack_require__) {
  4709. exports.style = __webpack_require__(32)
  4710. exports['class'] = __webpack_require__(37)
  4711. exports.component = __webpack_require__(38)
  4712. exports.prop = __webpack_require__(39)
  4713. exports.transition = __webpack_require__(45)
  4714. /***/ },
  4715. /* 37 */
  4716. /***/ function(module, exports, __webpack_require__) {
  4717. var _ = __webpack_require__(1)
  4718. var addClass = _.addClass
  4719. var removeClass = _.removeClass
  4720. module.exports = {
  4721. deep: true,
  4722. update: function (value) {
  4723. if (value && typeof value === 'string') {
  4724. this.handleObject(stringToObject(value))
  4725. } else if (_.isPlainObject(value)) {
  4726. this.handleObject(value)
  4727. } else if (_.isArray(value)) {
  4728. this.handleArray(value)
  4729. } else {
  4730. this.cleanup()
  4731. }
  4732. },
  4733. handleObject: function (value) {
  4734. this.cleanup(value)
  4735. var keys = this.prevKeys = Object.keys(value)
  4736. for (var i = 0, l = keys.length; i < l; i++) {
  4737. var key = keys[i]
  4738. if (value[key]) {
  4739. addClass(this.el, key)
  4740. } else {
  4741. removeClass(this.el, key)
  4742. }
  4743. }
  4744. },
  4745. handleArray: function (value) {
  4746. this.cleanup(value)
  4747. for (var i = 0, l = value.length; i < l; i++) {
  4748. if (value[i]) {
  4749. addClass(this.el, value[i])
  4750. }
  4751. }
  4752. this.prevKeys = value.slice()
  4753. },
  4754. cleanup: function (value) {
  4755. if (this.prevKeys) {
  4756. var i = this.prevKeys.length
  4757. while (i--) {
  4758. var key = this.prevKeys[i]
  4759. if (key && (!value || !contains(value, key))) {
  4760. removeClass(this.el, key)
  4761. }
  4762. }
  4763. }
  4764. }
  4765. }
  4766. function stringToObject (value) {
  4767. var res = {}
  4768. var keys = value.trim().split(/\s+/)
  4769. var i = keys.length
  4770. while (i--) {
  4771. res[keys[i]] = true
  4772. }
  4773. return res
  4774. }
  4775. function contains (value, key) {
  4776. return _.isArray(value)
  4777. ? value.indexOf(key) > -1
  4778. : value.hasOwnProperty(key)
  4779. }
  4780. /***/ },
  4781. /* 38 */
  4782. /***/ function(module, exports, __webpack_require__) {
  4783. var _ = __webpack_require__(1)
  4784. var templateParser = __webpack_require__(19)
  4785. module.exports = {
  4786. priority: 1500,
  4787. params: [
  4788. 'keep-alive',
  4789. 'transition-mode',
  4790. 'inline-template'
  4791. ],
  4792. /**
  4793. * Setup. Two possible usages:
  4794. *
  4795. * - static:
  4796. * <comp> or <div v-component="comp">
  4797. *
  4798. * - dynamic:
  4799. * <component :is="view">
  4800. */
  4801. bind: function () {
  4802. if (!this.el.__vue__) {
  4803. // check ref
  4804. this.ref = _.findRef(this.el)
  4805. var refs = (this._scope || this.vm).$refs
  4806. if (this.ref && !refs.hasOwnProperty(this.ref)) {
  4807. _.defineReactive(refs, this.ref, null)
  4808. }
  4809. // keep-alive cache
  4810. this.keepAlive = this.params.keepAlive
  4811. if (this.keepAlive) {
  4812. this.cache = {}
  4813. }
  4814. // check inline-template
  4815. if (this.params.inlineTemplate) {
  4816. // extract inline template as a DocumentFragment
  4817. this.inlineTemplate = _.extractContent(this.el, true)
  4818. }
  4819. // component resolution related state
  4820. this.pendingComponentCb =
  4821. this.Component = null
  4822. // transition related state
  4823. this.pendingRemovals = 0
  4824. this.pendingRemovalCb = null
  4825. // check dynamic component params
  4826. // create a ref anchor
  4827. this.anchor = _.createAnchor('v-component')
  4828. _.replace(this.el, this.anchor)
  4829. // if static, build right now.
  4830. if (this.literal) {
  4831. this.setComponent(this.expression)
  4832. }
  4833. } else {
  4834. ("development") !== 'production' && _.warn(
  4835. 'cannot mount component "' + this.expression + '" ' +
  4836. 'on already mounted element: ' + this.el
  4837. )
  4838. }
  4839. },
  4840. /**
  4841. * Public update, called by the watcher in the dynamic
  4842. * literal scenario, e.g. <component :is="view">
  4843. */
  4844. update: function (value) {
  4845. if (!this.literal) {
  4846. this.setComponent(value)
  4847. }
  4848. },
  4849. /**
  4850. * Switch dynamic components. May resolve the component
  4851. * asynchronously, and perform transition based on
  4852. * specified transition mode. Accepts a few additional
  4853. * arguments specifically for vue-router.
  4854. *
  4855. * The callback is called when the full transition is
  4856. * finished.
  4857. *
  4858. * @param {String} value
  4859. * @param {Function} [cb]
  4860. */
  4861. setComponent: function (value, cb) {
  4862. this.invalidatePending()
  4863. if (!value) {
  4864. // just remove current
  4865. this.unbuild(true)
  4866. this.remove(this.childVM, cb)
  4867. this.childVM = null
  4868. } else {
  4869. var self = this
  4870. this.resolveComponent(value, function () {
  4871. self.mountComponent(cb)
  4872. })
  4873. }
  4874. },
  4875. /**
  4876. * Resolve the component constructor to use when creating
  4877. * the child vm.
  4878. */
  4879. resolveComponent: function (id, cb) {
  4880. var self = this
  4881. this.pendingComponentCb = _.cancellable(function (Component) {
  4882. self.ComponentName = Component.options.name || id
  4883. self.Component = Component
  4884. cb()
  4885. })
  4886. this.vm._resolveComponent(id, this.pendingComponentCb)
  4887. },
  4888. /**
  4889. * Create a new instance using the current constructor and
  4890. * replace the existing instance. This method doesn't care
  4891. * whether the new component and the old one are actually
  4892. * the same.
  4893. *
  4894. * @param {Function} [cb]
  4895. */
  4896. mountComponent: function (cb) {
  4897. // actual mount
  4898. this.unbuild(true)
  4899. var self = this
  4900. var activateHook = this.Component.options.activate
  4901. var cached = this.getCached()
  4902. var newComponent = this.build()
  4903. if (activateHook && !cached) {
  4904. this.waitingFor = newComponent
  4905. activateHook.call(newComponent, function () {
  4906. self.waitingFor = null
  4907. self.transition(newComponent, cb)
  4908. })
  4909. } else {
  4910. this.transition(newComponent, cb)
  4911. }
  4912. },
  4913. /**
  4914. * When the component changes or unbinds before an async
  4915. * constructor is resolved, we need to invalidate its
  4916. * pending callback.
  4917. */
  4918. invalidatePending: function () {
  4919. if (this.pendingComponentCb) {
  4920. this.pendingComponentCb.cancel()
  4921. this.pendingComponentCb = null
  4922. }
  4923. },
  4924. /**
  4925. * Instantiate/insert a new child vm.
  4926. * If keep alive and has cached instance, insert that
  4927. * instance; otherwise build a new one and cache it.
  4928. *
  4929. * @param {Object} [extraOptions]
  4930. * @return {Vue} - the created instance
  4931. */
  4932. build: function (extraOptions) {
  4933. var cached = this.getCached()
  4934. if (cached) {
  4935. return cached
  4936. }
  4937. if (this.Component) {
  4938. // default options
  4939. var options = {
  4940. name: this.ComponentName,
  4941. el: templateParser.clone(this.el),
  4942. template: this.inlineTemplate,
  4943. // make sure to add the child with correct parent
  4944. // if this is a transcluded component, its parent
  4945. // should be the transclusion host.
  4946. parent: this._host || this.vm,
  4947. // if no inline-template, then the compiled
  4948. // linker can be cached for better performance.
  4949. _linkerCachable: !this.inlineTemplate,
  4950. _ref: this.ref,
  4951. _asComponent: true,
  4952. _isRouterView: this._isRouterView,
  4953. // if this is a transcluded component, context
  4954. // will be the common parent vm of this instance
  4955. // and its host.
  4956. _context: this.vm,
  4957. // if this is inside an inline v-for, the scope
  4958. // will be the intermediate scope created for this
  4959. // repeat fragment. this is used for linking props
  4960. // and container directives.
  4961. _scope: this._scope,
  4962. // pass in the owner fragment of this component.
  4963. // this is necessary so that the fragment can keep
  4964. // track of its contained components in order to
  4965. // call attach/detach hooks for them.
  4966. _frag: this._frag
  4967. }
  4968. // extra options
  4969. // in 1.0.0 this is used by vue-router only
  4970. /* istanbul ignore if */
  4971. if (extraOptions) {
  4972. _.extend(options, extraOptions)
  4973. }
  4974. var child = new this.Component(options)
  4975. if (this.keepAlive) {
  4976. this.cache[this.Component.cid] = child
  4977. }
  4978. /* istanbul ignore if */
  4979. if (("development") !== 'production' &&
  4980. this.el.hasAttribute('transition') &&
  4981. child._isFragment) {
  4982. _.warn(
  4983. 'Transitions will not work on a fragment instance. ' +
  4984. 'Template: ' + child.$options.template
  4985. )
  4986. }
  4987. return child
  4988. }
  4989. },
  4990. /**
  4991. * Try to get a cached instance of the current component.
  4992. *
  4993. * @return {Vue|undefined}
  4994. */
  4995. getCached: function () {
  4996. return this.keepAlive && this.cache[this.Component.cid]
  4997. },
  4998. /**
  4999. * Teardown the current child, but defers cleanup so
  5000. * that we can separate the destroy and removal steps.
  5001. *
  5002. * @param {Boolean} defer
  5003. */
  5004. unbuild: function (defer) {
  5005. if (this.waitingFor) {
  5006. this.waitingFor.$destroy()
  5007. this.waitingFor = null
  5008. }
  5009. var child = this.childVM
  5010. if (!child || this.keepAlive) {
  5011. return
  5012. }
  5013. // the sole purpose of `deferCleanup` is so that we can
  5014. // "deactivate" the vm right now and perform DOM removal
  5015. // later.
  5016. child.$destroy(false, defer)
  5017. },
  5018. /**
  5019. * Remove current destroyed child and manually do
  5020. * the cleanup after removal.
  5021. *
  5022. * @param {Function} cb
  5023. */
  5024. remove: function (child, cb) {
  5025. var keepAlive = this.keepAlive
  5026. if (child) {
  5027. // we may have a component switch when a previous
  5028. // component is still being transitioned out.
  5029. // we want to trigger only one lastest insertion cb
  5030. // when the existing transition finishes. (#1119)
  5031. this.pendingRemovals++
  5032. this.pendingRemovalCb = cb
  5033. var self = this
  5034. child.$remove(function () {
  5035. self.pendingRemovals--
  5036. if (!keepAlive) child._cleanup()
  5037. if (!self.pendingRemovals && self.pendingRemovalCb) {
  5038. self.pendingRemovalCb()
  5039. self.pendingRemovalCb = null
  5040. }
  5041. })
  5042. } else if (cb) {
  5043. cb()
  5044. }
  5045. },
  5046. /**
  5047. * Actually swap the components, depending on the
  5048. * transition mode. Defaults to simultaneous.
  5049. *
  5050. * @param {Vue} target
  5051. * @param {Function} [cb]
  5052. */
  5053. transition: function (target, cb) {
  5054. var self = this
  5055. var current = this.childVM
  5056. // for devtool inspection
  5057. if (true) {
  5058. if (current) current._inactive = true
  5059. target._inactive = false
  5060. }
  5061. this.childVM = target
  5062. switch (self.params.transitionMode) {
  5063. case 'in-out':
  5064. target.$before(self.anchor, function () {
  5065. self.remove(current, cb)
  5066. })
  5067. break
  5068. case 'out-in':
  5069. self.remove(current, function () {
  5070. target.$before(self.anchor, cb)
  5071. })
  5072. break
  5073. default:
  5074. self.remove(current)
  5075. target.$before(self.anchor, cb)
  5076. }
  5077. },
  5078. /**
  5079. * Unbind.
  5080. */
  5081. unbind: function () {
  5082. this.invalidatePending()
  5083. // Do not defer cleanup when unbinding
  5084. this.unbuild()
  5085. // destroy all keep-alive cached instances
  5086. if (this.cache) {
  5087. for (var key in this.cache) {
  5088. this.cache[key].$destroy()
  5089. }
  5090. this.cache = null
  5091. }
  5092. }
  5093. }
  5094. /***/ },
  5095. /* 39 */
  5096. /***/ function(module, exports, __webpack_require__) {
  5097. // NOTE: the prop internal directive is compiled and linked
  5098. // during _initScope(), before the created hook is called.
  5099. // The purpose is to make the initial prop values available
  5100. // inside `created` hooks and `data` functions.
  5101. var _ = __webpack_require__(1)
  5102. var Watcher = __webpack_require__(40)
  5103. var bindingModes = __webpack_require__(5)._propBindingModes
  5104. module.exports = {
  5105. bind: function () {
  5106. var child = this.vm
  5107. var parent = child._context
  5108. // passed in from compiler directly
  5109. var prop = this.descriptor.prop
  5110. var childKey = prop.path
  5111. var parentKey = prop.parentPath
  5112. var twoWay = prop.mode === bindingModes.TWO_WAY
  5113. var parentWatcher = this.parentWatcher = new Watcher(
  5114. parent,
  5115. parentKey,
  5116. function (val) {
  5117. if (_.assertProp(prop, val)) {
  5118. child[childKey] = val
  5119. }
  5120. }, {
  5121. twoWay: twoWay,
  5122. filters: prop.filters,
  5123. // important: props need to be observed on the
  5124. // v-for scope if present
  5125. scope: this._scope
  5126. }
  5127. )
  5128. // set the child initial value.
  5129. _.initProp(child, prop, parentWatcher.value)
  5130. // setup two-way binding
  5131. if (twoWay) {
  5132. // important: defer the child watcher creation until
  5133. // the created hook (after data observation)
  5134. var self = this
  5135. child.$once('hook:created', function () {
  5136. self.childWatcher = new Watcher(
  5137. child,
  5138. childKey,
  5139. function (val) {
  5140. parentWatcher.set(val)
  5141. }
  5142. )
  5143. })
  5144. }
  5145. },
  5146. unbind: function () {
  5147. this.parentWatcher.teardown()
  5148. if (this.childWatcher) {
  5149. this.childWatcher.teardown()
  5150. }
  5151. }
  5152. }
  5153. /***/ },
  5154. /* 40 */
  5155. /***/ function(module, exports, __webpack_require__) {
  5156. var _ = __webpack_require__(1)
  5157. var config = __webpack_require__(5)
  5158. var Dep = __webpack_require__(41)
  5159. var expParser = __webpack_require__(42)
  5160. var batcher = __webpack_require__(44)
  5161. var uid = 0
  5162. /**
  5163. * A watcher parses an expression, collects dependencies,
  5164. * and fires callback when the expression value changes.
  5165. * This is used for both the $watch() api and directives.
  5166. *
  5167. * @param {Vue} vm
  5168. * @param {String} expression
  5169. * @param {Function} cb
  5170. * @param {Object} options
  5171. * - {Array} filters
  5172. * - {Boolean} twoWay
  5173. * - {Boolean} deep
  5174. * - {Boolean} user
  5175. * - {Boolean} sync
  5176. * - {Boolean} lazy
  5177. * - {Function} [preProcess]
  5178. * - {Function} [postProcess]
  5179. * @constructor
  5180. */
  5181. function Watcher (vm, expOrFn, cb, options) {
  5182. // mix in options
  5183. if (options) {
  5184. _.extend(this, options)
  5185. }
  5186. var isFn = typeof expOrFn === 'function'
  5187. this.vm = vm
  5188. vm._watchers.push(this)
  5189. this.expression = isFn ? expOrFn.toString() : expOrFn
  5190. this.cb = cb
  5191. this.id = ++uid // uid for batching
  5192. this.active = true
  5193. this.dirty = this.lazy // for lazy watchers
  5194. this.deps = Object.create(null)
  5195. this.newDeps = null
  5196. this.prevError = null // for async error stacks
  5197. // parse expression for getter/setter
  5198. if (isFn) {
  5199. this.getter = expOrFn
  5200. this.setter = undefined
  5201. } else {
  5202. var res = expParser.parse(expOrFn, this.twoWay)
  5203. this.getter = res.get
  5204. this.setter = res.set
  5205. }
  5206. this.value = this.lazy
  5207. ? undefined
  5208. : this.get()
  5209. // state for avoiding false triggers for deep and Array
  5210. // watchers during vm._digest()
  5211. this.queued = this.shallow = false
  5212. }
  5213. /**
  5214. * Add a dependency to this directive.
  5215. *
  5216. * @param {Dep} dep
  5217. */
  5218. Watcher.prototype.addDep = function (dep) {
  5219. var id = dep.id
  5220. if (!this.newDeps[id]) {
  5221. this.newDeps[id] = dep
  5222. if (!this.deps[id]) {
  5223. this.deps[id] = dep
  5224. dep.addSub(this)
  5225. }
  5226. }
  5227. }
  5228. /**
  5229. * Evaluate the getter, and re-collect dependencies.
  5230. */
  5231. Watcher.prototype.get = function () {
  5232. this.beforeGet()
  5233. var scope = this.scope || this.vm
  5234. var value
  5235. try {
  5236. value = this.getter.call(scope, scope)
  5237. } catch (e) {
  5238. if (
  5239. ("development") !== 'production' &&
  5240. config.warnExpressionErrors
  5241. ) {
  5242. _.warn(
  5243. 'Error when evaluating expression "' +
  5244. this.expression + '". ' +
  5245. (config.debug
  5246. ? ''
  5247. : 'Turn on debug mode to see stack trace.'
  5248. ), e
  5249. )
  5250. }
  5251. }
  5252. // "touch" every property so they are all tracked as
  5253. // dependencies for deep watching
  5254. if (this.deep) {
  5255. traverse(value)
  5256. }
  5257. if (this.preProcess) {
  5258. value = this.preProcess(value)
  5259. }
  5260. if (this.filters) {
  5261. value = scope._applyFilters(value, null, this.filters, false)
  5262. }
  5263. if (this.postProcess) {
  5264. value = this.postProcess(value)
  5265. }
  5266. this.afterGet()
  5267. return value
  5268. }
  5269. /**
  5270. * Set the corresponding value with the setter.
  5271. *
  5272. * @param {*} value
  5273. */
  5274. Watcher.prototype.set = function (value) {
  5275. var scope = this.scope || this.vm
  5276. if (this.filters) {
  5277. value = scope._applyFilters(
  5278. value, this.value, this.filters, true)
  5279. }
  5280. try {
  5281. this.setter.call(scope, scope, value)
  5282. } catch (e) {
  5283. if (
  5284. ("development") !== 'production' &&
  5285. config.warnExpressionErrors
  5286. ) {
  5287. _.warn(
  5288. 'Error when evaluating setter "' +
  5289. this.expression + '"', e
  5290. )
  5291. }
  5292. }
  5293. // two-way sync for v-for alias
  5294. var forContext = scope.$forContext
  5295. if (true) {
  5296. if (
  5297. forContext &&
  5298. forContext.filters &&
  5299. (new RegExp(forContext.alias + '\\b')).test(this.expression)
  5300. ) {
  5301. _.warn(
  5302. 'It seems you are using two-way binding on ' +
  5303. 'a v-for alias (' + this.expression + '), and the ' +
  5304. 'v-for has filters. This will not work properly. ' +
  5305. 'Either remove the filters or use an array of ' +
  5306. 'objects and bind to object properties instead.'
  5307. )
  5308. }
  5309. }
  5310. if (
  5311. forContext &&
  5312. forContext.alias === this.expression &&
  5313. !forContext.filters
  5314. ) {
  5315. if (scope.$key) { // original is an object
  5316. forContext.rawValue[scope.$key] = value
  5317. } else {
  5318. forContext.rawValue.$set(scope.$index, value)
  5319. }
  5320. }
  5321. }
  5322. /**
  5323. * Prepare for dependency collection.
  5324. */
  5325. Watcher.prototype.beforeGet = function () {
  5326. Dep.target = this
  5327. this.newDeps = Object.create(null)
  5328. }
  5329. /**
  5330. * Clean up for dependency collection.
  5331. */
  5332. Watcher.prototype.afterGet = function () {
  5333. Dep.target = null
  5334. var ids = Object.keys(this.deps)
  5335. var i = ids.length
  5336. while (i--) {
  5337. var id = ids[i]
  5338. if (!this.newDeps[id]) {
  5339. this.deps[id].removeSub(this)
  5340. }
  5341. }
  5342. this.deps = this.newDeps
  5343. }
  5344. /**
  5345. * Subscriber interface.
  5346. * Will be called when a dependency changes.
  5347. *
  5348. * @param {Boolean} shallow
  5349. */
  5350. Watcher.prototype.update = function (shallow) {
  5351. if (this.lazy) {
  5352. this.dirty = true
  5353. } else if (this.sync || !config.async) {
  5354. this.run()
  5355. } else {
  5356. // if queued, only overwrite shallow with non-shallow,
  5357. // but not the other way around.
  5358. this.shallow = this.queued
  5359. ? shallow
  5360. ? this.shallow
  5361. : false
  5362. : !!shallow
  5363. this.queued = true
  5364. // record before-push error stack in debug mode
  5365. /* istanbul ignore if */
  5366. if (("development") !== 'production' && config.debug) {
  5367. this.prevError = new Error('[vue] async stack trace')
  5368. }
  5369. batcher.push(this)
  5370. }
  5371. }
  5372. /**
  5373. * Batcher job interface.
  5374. * Will be called by the batcher.
  5375. */
  5376. Watcher.prototype.run = function () {
  5377. if (this.active) {
  5378. var value = this.get()
  5379. if (
  5380. value !== this.value ||
  5381. // Deep watchers and Array watchers should fire even
  5382. // when the value is the same, because the value may
  5383. // have mutated; but only do so if this is a
  5384. // non-shallow update (caused by a vm digest).
  5385. ((_.isArray(value) || this.deep) && !this.shallow)
  5386. ) {
  5387. // set new value
  5388. var oldValue = this.value
  5389. this.value = value
  5390. // in debug + async mode, when a watcher callbacks
  5391. // throws, we also throw the saved before-push error
  5392. // so the full cross-tick stack trace is available.
  5393. var prevError = this.prevError
  5394. /* istanbul ignore if */
  5395. if (("development") !== 'production' &&
  5396. config.debug && prevError) {
  5397. this.prevError = null
  5398. try {
  5399. this.cb.call(this.vm, value, oldValue)
  5400. } catch (e) {
  5401. _.nextTick(function () {
  5402. throw prevError
  5403. }, 0)
  5404. throw e
  5405. }
  5406. } else {
  5407. this.cb.call(this.vm, value, oldValue)
  5408. }
  5409. }
  5410. this.queued = this.shallow = false
  5411. }
  5412. }
  5413. /**
  5414. * Evaluate the value of the watcher.
  5415. * This only gets called for lazy watchers.
  5416. */
  5417. Watcher.prototype.evaluate = function () {
  5418. // avoid overwriting another watcher that is being
  5419. // collected.
  5420. var current = Dep.target
  5421. this.value = this.get()
  5422. this.dirty = false
  5423. Dep.target = current
  5424. }
  5425. /**
  5426. * Depend on all deps collected by this watcher.
  5427. */
  5428. Watcher.prototype.depend = function () {
  5429. var depIds = Object.keys(this.deps)
  5430. var i = depIds.length
  5431. while (i--) {
  5432. this.deps[depIds[i]].depend()
  5433. }
  5434. }
  5435. /**
  5436. * Remove self from all dependencies' subcriber list.
  5437. */
  5438. Watcher.prototype.teardown = function () {
  5439. if (this.active) {
  5440. // remove self from vm's watcher list
  5441. // we can skip this if the vm if being destroyed
  5442. // which can improve teardown performance.
  5443. if (!this.vm._isBeingDestroyed) {
  5444. this.vm._watchers.$remove(this)
  5445. }
  5446. var depIds = Object.keys(this.deps)
  5447. var i = depIds.length
  5448. while (i--) {
  5449. this.deps[depIds[i]].removeSub(this)
  5450. }
  5451. this.active = false
  5452. this.vm = this.cb = this.value = null
  5453. }
  5454. }
  5455. /**
  5456. * Recrusively traverse an object to evoke all converted
  5457. * getters, so that every nested property inside the object
  5458. * is collected as a "deep" dependency.
  5459. *
  5460. * @param {*} val
  5461. */
  5462. function traverse (val) {
  5463. var i, keys
  5464. if (_.isArray(val)) {
  5465. i = val.length
  5466. while (i--) traverse(val[i])
  5467. } else if (_.isObject(val)) {
  5468. keys = Object.keys(val)
  5469. i = keys.length
  5470. while (i--) traverse(val[keys[i]])
  5471. }
  5472. }
  5473. module.exports = Watcher
  5474. /***/ },
  5475. /* 41 */
  5476. /***/ function(module, exports, __webpack_require__) {
  5477. var _ = __webpack_require__(1)
  5478. var uid = 0
  5479. /**
  5480. * A dep is an observable that can have multiple
  5481. * directives subscribing to it.
  5482. *
  5483. * @constructor
  5484. */
  5485. function Dep () {
  5486. this.id = uid++
  5487. this.subs = []
  5488. }
  5489. // the current target watcher being evaluated.
  5490. // this is globally unique because there could be only one
  5491. // watcher being evaluated at any time.
  5492. Dep.target = null
  5493. /**
  5494. * Add a directive subscriber.
  5495. *
  5496. * @param {Directive} sub
  5497. */
  5498. Dep.prototype.addSub = function (sub) {
  5499. this.subs.push(sub)
  5500. }
  5501. /**
  5502. * Remove a directive subscriber.
  5503. *
  5504. * @param {Directive} sub
  5505. */
  5506. Dep.prototype.removeSub = function (sub) {
  5507. this.subs.$remove(sub)
  5508. }
  5509. /**
  5510. * Add self as a dependency to the target watcher.
  5511. */
  5512. Dep.prototype.depend = function () {
  5513. Dep.target.addDep(this)
  5514. }
  5515. /**
  5516. * Notify all subscribers of a new value.
  5517. */
  5518. Dep.prototype.notify = function () {
  5519. // stablize the subscriber list first
  5520. var subs = _.toArray(this.subs)
  5521. for (var i = 0, l = subs.length; i < l; i++) {
  5522. subs[i].update()
  5523. }
  5524. }
  5525. module.exports = Dep
  5526. /***/ },
  5527. /* 42 */
  5528. /***/ function(module, exports, __webpack_require__) {
  5529. var _ = __webpack_require__(1)
  5530. var Path = __webpack_require__(43)
  5531. var Cache = __webpack_require__(7)
  5532. var expressionCache = new Cache(1000)
  5533. var allowedKeywords =
  5534. 'Math,Date,this,true,false,null,undefined,Infinity,NaN,' +
  5535. 'isNaN,isFinite,decodeURI,decodeURIComponent,encodeURI,' +
  5536. 'encodeURIComponent,parseInt,parseFloat'
  5537. var allowedKeywordsRE =
  5538. new RegExp('^(' + allowedKeywords.replace(/,/g, '\\b|') + '\\b)')
  5539. // keywords that don't make sense inside expressions
  5540. var improperKeywords =
  5541. 'break,case,class,catch,const,continue,debugger,default,' +
  5542. 'delete,do,else,export,extends,finally,for,function,if,' +
  5543. 'import,in,instanceof,let,return,super,switch,throw,try,' +
  5544. 'var,while,with,yield,enum,await,implements,package,' +
  5545. 'proctected,static,interface,private,public'
  5546. var improperKeywordsRE =
  5547. new RegExp('^(' + improperKeywords.replace(/,/g, '\\b|') + '\\b)')
  5548. var wsRE = /\s/g
  5549. var newlineRE = /\n/g
  5550. var saveRE = /[\{,]\s*[\w\$_]+\s*:|('[^']*'|"[^"]*")|new |typeof |void /g
  5551. var restoreRE = /"(\d+)"/g
  5552. var pathTestRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/
  5553. var pathReplaceRE = /[^\w$\.]([A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\])*)/g
  5554. var booleanLiteralRE = /^(true|false)$/
  5555. /**
  5556. * Save / Rewrite / Restore
  5557. *
  5558. * When rewriting paths found in an expression, it is
  5559. * possible for the same letter sequences to be found in
  5560. * strings and Object literal property keys. Therefore we
  5561. * remove and store these parts in a temporary array, and
  5562. * restore them after the path rewrite.
  5563. */
  5564. var saved = []
  5565. /**
  5566. * Save replacer
  5567. *
  5568. * The save regex can match two possible cases:
  5569. * 1. An opening object literal
  5570. * 2. A string
  5571. * If matched as a plain string, we need to escape its
  5572. * newlines, since the string needs to be preserved when
  5573. * generating the function body.
  5574. *
  5575. * @param {String} str
  5576. * @param {String} isString - str if matched as a string
  5577. * @return {String} - placeholder with index
  5578. */
  5579. function save (str, isString) {
  5580. var i = saved.length
  5581. saved[i] = isString
  5582. ? str.replace(newlineRE, '\\n')
  5583. : str
  5584. return '"' + i + '"'
  5585. }
  5586. /**
  5587. * Path rewrite replacer
  5588. *
  5589. * @param {String} raw
  5590. * @return {String}
  5591. */
  5592. function rewrite (raw) {
  5593. var c = raw.charAt(0)
  5594. var path = raw.slice(1)
  5595. if (allowedKeywordsRE.test(path)) {
  5596. return raw
  5597. } else {
  5598. path = path.indexOf('"') > -1
  5599. ? path.replace(restoreRE, restore)
  5600. : path
  5601. return c + 'scope.' + path
  5602. }
  5603. }
  5604. /**
  5605. * Restore replacer
  5606. *
  5607. * @param {String} str
  5608. * @param {String} i - matched save index
  5609. * @return {String}
  5610. */
  5611. function restore (str, i) {
  5612. return saved[i]
  5613. }
  5614. /**
  5615. * Rewrite an expression, prefixing all path accessors with
  5616. * `scope.` and generate getter/setter functions.
  5617. *
  5618. * @param {String} exp
  5619. * @param {Boolean} needSet
  5620. * @return {Function}
  5621. */
  5622. function compileExpFns (exp, needSet) {
  5623. if (improperKeywordsRE.test(exp)) {
  5624. ("development") !== 'production' && _.warn(
  5625. 'Avoid using reserved keywords in expression: ' + exp
  5626. )
  5627. }
  5628. // reset state
  5629. saved.length = 0
  5630. // save strings and object literal keys
  5631. var body = exp
  5632. .replace(saveRE, save)
  5633. .replace(wsRE, '')
  5634. // rewrite all paths
  5635. // pad 1 space here becaue the regex matches 1 extra char
  5636. body = (' ' + body)
  5637. .replace(pathReplaceRE, rewrite)
  5638. .replace(restoreRE, restore)
  5639. var getter = makeGetter(body)
  5640. if (getter) {
  5641. return {
  5642. get: getter,
  5643. body: body,
  5644. set: needSet
  5645. ? makeSetter(body)
  5646. : null
  5647. }
  5648. }
  5649. }
  5650. /**
  5651. * Compile getter setters for a simple path.
  5652. *
  5653. * @param {String} exp
  5654. * @return {Function}
  5655. */
  5656. function compilePathFns (exp) {
  5657. var getter, path
  5658. if (exp.indexOf('[') < 0) {
  5659. // really simple path
  5660. path = exp.split('.')
  5661. path.raw = exp
  5662. getter = Path.compileGetter(path)
  5663. } else {
  5664. // do the real parsing
  5665. path = Path.parse(exp)
  5666. getter = path.get
  5667. }
  5668. return {
  5669. get: getter,
  5670. // always generate setter for simple paths
  5671. set: function (obj, val) {
  5672. Path.set(obj, path, val)
  5673. }
  5674. }
  5675. }
  5676. /**
  5677. * Build a getter function. Requires eval.
  5678. *
  5679. * We isolate the try/catch so it doesn't affect the
  5680. * optimization of the parse function when it is not called.
  5681. *
  5682. * @param {String} body
  5683. * @return {Function|undefined}
  5684. */
  5685. function makeGetter (body) {
  5686. try {
  5687. return new Function('scope', 'return ' + body + ';')
  5688. } catch (e) {
  5689. ("development") !== 'production' && _.warn(
  5690. 'Invalid expression. ' +
  5691. 'Generated function body: ' + body
  5692. )
  5693. }
  5694. }
  5695. /**
  5696. * Build a setter function.
  5697. *
  5698. * This is only needed in rare situations like "a[b]" where
  5699. * a settable path requires dynamic evaluation.
  5700. *
  5701. * This setter function may throw error when called if the
  5702. * expression body is not a valid left-hand expression in
  5703. * assignment.
  5704. *
  5705. * @param {String} body
  5706. * @return {Function|undefined}
  5707. */
  5708. function makeSetter (body) {
  5709. try {
  5710. return new Function('scope', 'value', body + '=value;')
  5711. } catch (e) {
  5712. ("development") !== 'production' && _.warn(
  5713. 'Invalid setter function body: ' + body
  5714. )
  5715. }
  5716. }
  5717. /**
  5718. * Check for setter existence on a cache hit.
  5719. *
  5720. * @param {Function} hit
  5721. */
  5722. function checkSetter (hit) {
  5723. if (!hit.set) {
  5724. hit.set = makeSetter(hit.body)
  5725. }
  5726. }
  5727. /**
  5728. * Parse an expression into re-written getter/setters.
  5729. *
  5730. * @param {String} exp
  5731. * @param {Boolean} needSet
  5732. * @return {Function}
  5733. */
  5734. exports.parse = function (exp, needSet) {
  5735. exp = exp.trim()
  5736. // try cache
  5737. var hit = expressionCache.get(exp)
  5738. if (hit) {
  5739. if (needSet) {
  5740. checkSetter(hit)
  5741. }
  5742. return hit
  5743. }
  5744. // we do a simple path check to optimize for them.
  5745. // the check fails valid paths with unusal whitespaces,
  5746. // but that's too rare and we don't care.
  5747. // also skip boolean literals and paths that start with
  5748. // global "Math"
  5749. var res = exports.isSimplePath(exp)
  5750. ? compilePathFns(exp)
  5751. : compileExpFns(exp, needSet)
  5752. expressionCache.put(exp, res)
  5753. return res
  5754. }
  5755. /**
  5756. * Check if an expression is a simple path.
  5757. *
  5758. * @param {String} exp
  5759. * @return {Boolean}
  5760. */
  5761. exports.isSimplePath = function (exp) {
  5762. return pathTestRE.test(exp) &&
  5763. // don't treat true/false as paths
  5764. !booleanLiteralRE.test(exp) &&
  5765. // Math constants e.g. Math.PI, Math.E etc.
  5766. exp.slice(0, 5) !== 'Math.'
  5767. }
  5768. /***/ },
  5769. /* 43 */
  5770. /***/ function(module, exports, __webpack_require__) {
  5771. var _ = __webpack_require__(1)
  5772. var Cache = __webpack_require__(7)
  5773. var pathCache = new Cache(1000)
  5774. var identRE = exports.identRE = /^[$_a-zA-Z]+[\w$]*$/
  5775. // actions
  5776. var APPEND = 0
  5777. var PUSH = 1
  5778. // states
  5779. var BEFORE_PATH = 0
  5780. var IN_PATH = 1
  5781. var BEFORE_IDENT = 2
  5782. var IN_IDENT = 3
  5783. var BEFORE_ELEMENT = 4
  5784. var AFTER_ZERO = 5
  5785. var IN_INDEX = 6
  5786. var IN_SINGLE_QUOTE = 7
  5787. var IN_DOUBLE_QUOTE = 8
  5788. var IN_SUB_PATH = 9
  5789. var AFTER_ELEMENT = 10
  5790. var AFTER_PATH = 11
  5791. var ERROR = 12
  5792. var pathStateMachine = []
  5793. pathStateMachine[BEFORE_PATH] = {
  5794. 'ws': [BEFORE_PATH],
  5795. 'ident': [IN_IDENT, APPEND],
  5796. '[': [BEFORE_ELEMENT],
  5797. 'eof': [AFTER_PATH]
  5798. }
  5799. pathStateMachine[IN_PATH] = {
  5800. 'ws': [IN_PATH],
  5801. '.': [BEFORE_IDENT],
  5802. '[': [BEFORE_ELEMENT],
  5803. 'eof': [AFTER_PATH]
  5804. }
  5805. pathStateMachine[BEFORE_IDENT] = {
  5806. 'ws': [BEFORE_IDENT],
  5807. 'ident': [IN_IDENT, APPEND]
  5808. }
  5809. pathStateMachine[IN_IDENT] = {
  5810. 'ident': [IN_IDENT, APPEND],
  5811. '0': [IN_IDENT, APPEND],
  5812. 'number': [IN_IDENT, APPEND],
  5813. 'ws': [IN_PATH, PUSH],
  5814. '.': [BEFORE_IDENT, PUSH],
  5815. '[': [BEFORE_ELEMENT, PUSH],
  5816. 'eof': [AFTER_PATH, PUSH]
  5817. }
  5818. pathStateMachine[BEFORE_ELEMENT] = {
  5819. 'ws': [BEFORE_ELEMENT],
  5820. '0': [AFTER_ZERO, APPEND],
  5821. 'number': [IN_INDEX, APPEND],
  5822. "'": [IN_SINGLE_QUOTE, APPEND, ''],
  5823. '"': [IN_DOUBLE_QUOTE, APPEND, ''],
  5824. 'ident': [IN_SUB_PATH, APPEND, '*']
  5825. }
  5826. pathStateMachine[AFTER_ZERO] = {
  5827. 'ws': [AFTER_ELEMENT, PUSH],
  5828. ']': [IN_PATH, PUSH]
  5829. }
  5830. pathStateMachine[IN_INDEX] = {
  5831. '0': [IN_INDEX, APPEND],
  5832. 'number': [IN_INDEX, APPEND],
  5833. 'ws': [AFTER_ELEMENT],
  5834. ']': [IN_PATH, PUSH]
  5835. }
  5836. pathStateMachine[IN_SINGLE_QUOTE] = {
  5837. "'": [AFTER_ELEMENT],
  5838. 'eof': ERROR,
  5839. 'else': [IN_SINGLE_QUOTE, APPEND]
  5840. }
  5841. pathStateMachine[IN_DOUBLE_QUOTE] = {
  5842. '"': [AFTER_ELEMENT],
  5843. 'eof': ERROR,
  5844. 'else': [IN_DOUBLE_QUOTE, APPEND]
  5845. }
  5846. pathStateMachine[IN_SUB_PATH] = {
  5847. 'ident': [IN_SUB_PATH, APPEND],
  5848. '0': [IN_SUB_PATH, APPEND],
  5849. 'number': [IN_SUB_PATH, APPEND],
  5850. 'ws': [AFTER_ELEMENT],
  5851. ']': [IN_PATH, PUSH]
  5852. }
  5853. pathStateMachine[AFTER_ELEMENT] = {
  5854. 'ws': [AFTER_ELEMENT],
  5855. ']': [IN_PATH, PUSH]
  5856. }
  5857. /**
  5858. * Determine the type of a character in a keypath.
  5859. *
  5860. * @param {Char} ch
  5861. * @return {String} type
  5862. */
  5863. function getPathCharType (ch) {
  5864. if (ch === undefined) {
  5865. return 'eof'
  5866. }
  5867. var code = ch.charCodeAt(0)
  5868. switch (code) {
  5869. case 0x5B: // [
  5870. case 0x5D: // ]
  5871. case 0x2E: // .
  5872. case 0x22: // "
  5873. case 0x27: // '
  5874. case 0x30: // 0
  5875. return ch
  5876. case 0x5F: // _
  5877. case 0x24: // $
  5878. return 'ident'
  5879. case 0x20: // Space
  5880. case 0x09: // Tab
  5881. case 0x0A: // Newline
  5882. case 0x0D: // Return
  5883. case 0xA0: // No-break space
  5884. case 0xFEFF: // Byte Order Mark
  5885. case 0x2028: // Line Separator
  5886. case 0x2029: // Paragraph Separator
  5887. return 'ws'
  5888. }
  5889. // a-z, A-Z
  5890. if (
  5891. (code >= 0x61 && code <= 0x7A) ||
  5892. (code >= 0x41 && code <= 0x5A)
  5893. ) {
  5894. return 'ident'
  5895. }
  5896. // 1-9
  5897. if (code >= 0x31 && code <= 0x39) {
  5898. return 'number'
  5899. }
  5900. return 'else'
  5901. }
  5902. /**
  5903. * Parse a string path into an array of segments
  5904. *
  5905. * @param {String} path
  5906. * @return {Array|undefined}
  5907. */
  5908. function parsePath (path) {
  5909. var keys = []
  5910. var index = -1
  5911. var mode = BEFORE_PATH
  5912. var c, newChar, key, type, transition, action, typeMap
  5913. var actions = []
  5914. actions[PUSH] = function () {
  5915. if (key === undefined) {
  5916. return
  5917. }
  5918. keys.push(key)
  5919. key = undefined
  5920. }
  5921. actions[APPEND] = function () {
  5922. if (key === undefined) {
  5923. key = newChar
  5924. } else {
  5925. key += newChar
  5926. }
  5927. }
  5928. function maybeUnescapeQuote () {
  5929. var nextChar = path[index + 1]
  5930. if ((mode === IN_SINGLE_QUOTE && nextChar === "'") ||
  5931. (mode === IN_DOUBLE_QUOTE && nextChar === '"')) {
  5932. index++
  5933. newChar = nextChar
  5934. actions[APPEND]()
  5935. return true
  5936. }
  5937. }
  5938. while (mode != null) {
  5939. index++
  5940. c = path[index]
  5941. if (c === '\\' && maybeUnescapeQuote()) {
  5942. continue
  5943. }
  5944. type = getPathCharType(c)
  5945. typeMap = pathStateMachine[mode]
  5946. transition = typeMap[type] || typeMap['else'] || ERROR
  5947. if (transition === ERROR) {
  5948. return // parse error
  5949. }
  5950. mode = transition[0]
  5951. action = actions[transition[1]]
  5952. if (action) {
  5953. newChar = transition[2]
  5954. newChar = newChar === undefined
  5955. ? c
  5956. : newChar === '*'
  5957. ? newChar + c
  5958. : newChar
  5959. action()
  5960. }
  5961. if (mode === AFTER_PATH) {
  5962. keys.raw = path
  5963. return keys
  5964. }
  5965. }
  5966. }
  5967. /**
  5968. * Format a accessor segment based on its type.
  5969. *
  5970. * @param {String} key
  5971. * @return {Boolean}
  5972. */
  5973. function formatAccessor (key) {
  5974. if (identRE.test(key)) { // identifier
  5975. return '.' + key
  5976. } else if (+key === key >>> 0) { // bracket index
  5977. return '[' + key + ']'
  5978. } else if (key.charAt(0) === '*') {
  5979. return '[o' + formatAccessor(key.slice(1)) + ']'
  5980. } else { // bracket string
  5981. return '["' + key.replace(/"/g, '\\"') + '"]'
  5982. }
  5983. }
  5984. /**
  5985. * Compiles a getter function with a fixed path.
  5986. * The fixed path getter supresses errors.
  5987. *
  5988. * @param {Array} path
  5989. * @return {Function}
  5990. */
  5991. exports.compileGetter = function (path) {
  5992. var body = 'return o' + path.map(formatAccessor).join('')
  5993. return new Function('o', body)
  5994. }
  5995. /**
  5996. * External parse that check for a cache hit first
  5997. *
  5998. * @param {String} path
  5999. * @return {Array|undefined}
  6000. */
  6001. exports.parse = function (path) {
  6002. var hit = pathCache.get(path)
  6003. if (!hit) {
  6004. hit = parsePath(path)
  6005. if (hit) {
  6006. hit.get = exports.compileGetter(hit)
  6007. pathCache.put(path, hit)
  6008. }
  6009. }
  6010. return hit
  6011. }
  6012. /**
  6013. * Get from an object from a path string
  6014. *
  6015. * @param {Object} obj
  6016. * @param {String} path
  6017. */
  6018. exports.get = function (obj, path) {
  6019. path = exports.parse(path)
  6020. if (path) {
  6021. return path.get(obj)
  6022. }
  6023. }
  6024. /**
  6025. * Warn against settings non-existent root path on a vm.
  6026. */
  6027. var warnNonExistent
  6028. if (true) {
  6029. warnNonExistent = function (path) {
  6030. _.warn(
  6031. 'You are settings a non-existent path "' + path.raw + '" ' +
  6032. 'on a vm instance. Consider pre-initializing the property ' +
  6033. 'with the "data" option for more reliable reactivity ' +
  6034. 'and better performance.'
  6035. )
  6036. }
  6037. }
  6038. /**
  6039. * Set on an object from a path
  6040. *
  6041. * @param {Object} obj
  6042. * @param {String | Array} path
  6043. * @param {*} val
  6044. */
  6045. exports.set = function (obj, path, val) {
  6046. var original = obj
  6047. if (typeof path === 'string') {
  6048. path = exports.parse(path)
  6049. }
  6050. if (!path || !_.isObject(obj)) {
  6051. return false
  6052. }
  6053. var last, key
  6054. for (var i = 0, l = path.length; i < l; i++) {
  6055. last = obj
  6056. key = path[i]
  6057. if (key.charAt(0) === '*') {
  6058. key = original[key.slice(1)]
  6059. }
  6060. if (i < l - 1) {
  6061. obj = obj[key]
  6062. if (!_.isObject(obj)) {
  6063. obj = {}
  6064. if (("development") !== 'production' && last._isVue) {
  6065. warnNonExistent(path)
  6066. }
  6067. _.set(last, key, obj)
  6068. }
  6069. } else {
  6070. if (_.isArray(obj)) {
  6071. obj.$set(key, val)
  6072. } else if (key in obj) {
  6073. obj[key] = val
  6074. } else {
  6075. if (("development") !== 'production' && obj._isVue) {
  6076. warnNonExistent(path)
  6077. }
  6078. _.set(obj, key, val)
  6079. }
  6080. }
  6081. }
  6082. return true
  6083. }
  6084. /***/ },
  6085. /* 44 */
  6086. /***/ function(module, exports, __webpack_require__) {
  6087. var _ = __webpack_require__(1)
  6088. var config = __webpack_require__(5)
  6089. // we have two separate queues: one for directive updates
  6090. // and one for user watcher registered via $watch().
  6091. // we want to guarantee directive updates to be called
  6092. // before user watchers so that when user watchers are
  6093. // triggered, the DOM would have already been in updated
  6094. // state.
  6095. var queue = []
  6096. var userQueue = []
  6097. var has = {}
  6098. var circular = {}
  6099. var waiting = false
  6100. var internalQueueDepleted = false
  6101. /**
  6102. * Reset the batcher's state.
  6103. */
  6104. function resetBatcherState () {
  6105. queue = []
  6106. userQueue = []
  6107. has = {}
  6108. circular = {}
  6109. waiting = internalQueueDepleted = false
  6110. }
  6111. /**
  6112. * Flush both queues and run the watchers.
  6113. */
  6114. function flushBatcherQueue () {
  6115. runBatcherQueue(queue)
  6116. internalQueueDepleted = true
  6117. runBatcherQueue(userQueue)
  6118. // dev tool hook
  6119. /* istanbul ignore if */
  6120. if (true) {
  6121. if (_.inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__) {
  6122. window.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit('flush')
  6123. }
  6124. }
  6125. resetBatcherState()
  6126. }
  6127. /**
  6128. * Run the watchers in a single queue.
  6129. *
  6130. * @param {Array} queue
  6131. */
  6132. function runBatcherQueue (queue) {
  6133. // do not cache length because more watchers might be pushed
  6134. // as we run existing watchers
  6135. for (var i = 0; i < queue.length; i++) {
  6136. var watcher = queue[i]
  6137. var id = watcher.id
  6138. has[id] = null
  6139. watcher.run()
  6140. // in dev build, check and stop circular updates.
  6141. if (("development") !== 'production' && has[id] != null) {
  6142. circular[id] = (circular[id] || 0) + 1
  6143. if (circular[id] > config._maxUpdateCount) {
  6144. queue.splice(has[id], 1)
  6145. _.warn(
  6146. 'You may have an infinite update loop for watcher ' +
  6147. 'with expression: ' + watcher.expression
  6148. )
  6149. }
  6150. }
  6151. }
  6152. }
  6153. /**
  6154. * Push a watcher into the watcher queue.
  6155. * Jobs with duplicate IDs will be skipped unless it's
  6156. * pushed when the queue is being flushed.
  6157. *
  6158. * @param {Watcher} watcher
  6159. * properties:
  6160. * - {Number} id
  6161. * - {Function} run
  6162. */
  6163. exports.push = function (watcher) {
  6164. var id = watcher.id
  6165. if (has[id] == null) {
  6166. // if an internal watcher is pushed, but the internal
  6167. // queue is already depleted, we run it immediately.
  6168. if (internalQueueDepleted && !watcher.user) {
  6169. watcher.run()
  6170. return
  6171. }
  6172. // push watcher into appropriate queue
  6173. var q = watcher.user ? userQueue : queue
  6174. has[id] = q.length
  6175. q.push(watcher)
  6176. // queue the flush
  6177. if (!waiting) {
  6178. waiting = true
  6179. _.nextTick(flushBatcherQueue)
  6180. }
  6181. }
  6182. }
  6183. /***/ },
  6184. /* 45 */
  6185. /***/ function(module, exports, __webpack_require__) {
  6186. var _ = __webpack_require__(1)
  6187. var Transition = __webpack_require__(46)
  6188. module.exports = {
  6189. priority: 1000,
  6190. update: function (id, oldId) {
  6191. var el = this.el
  6192. // resolve on owner vm
  6193. var hooks = _.resolveAsset(this.vm.$options, 'transitions', id)
  6194. id = id || 'v'
  6195. // apply on closest vm
  6196. el.__v_trans = new Transition(el, id, hooks, this.el.__vue__ || this.vm)
  6197. if (oldId) {
  6198. _.removeClass(el, oldId + '-transition')
  6199. }
  6200. _.addClass(el, id + '-transition')
  6201. }
  6202. }
  6203. /***/ },
  6204. /* 46 */
  6205. /***/ function(module, exports, __webpack_require__) {
  6206. var _ = __webpack_require__(1)
  6207. var queue = __webpack_require__(47)
  6208. var addClass = _.addClass
  6209. var removeClass = _.removeClass
  6210. var transitionEndEvent = _.transitionEndEvent
  6211. var animationEndEvent = _.animationEndEvent
  6212. var transDurationProp = _.transitionProp + 'Duration'
  6213. var animDurationProp = _.animationProp + 'Duration'
  6214. var TYPE_TRANSITION = 1
  6215. var TYPE_ANIMATION = 2
  6216. /**
  6217. * A Transition object that encapsulates the state and logic
  6218. * of the transition.
  6219. *
  6220. * @param {Element} el
  6221. * @param {String} id
  6222. * @param {Object} hooks
  6223. * @param {Vue} vm
  6224. */
  6225. function Transition (el, id, hooks, vm) {
  6226. this.id = id
  6227. this.el = el
  6228. this.enterClass = id + '-enter'
  6229. this.leaveClass = id + '-leave'
  6230. this.hooks = hooks
  6231. this.vm = vm
  6232. // async state
  6233. this.pendingCssEvent =
  6234. this.pendingCssCb =
  6235. this.cancel =
  6236. this.pendingJsCb =
  6237. this.op =
  6238. this.cb = null
  6239. this.justEntered = false
  6240. this.entered = this.left = false
  6241. this.typeCache = {}
  6242. // bind
  6243. var self = this
  6244. ;['enterNextTick', 'enterDone', 'leaveNextTick', 'leaveDone']
  6245. .forEach(function (m) {
  6246. self[m] = _.bind(self[m], self)
  6247. })
  6248. }
  6249. var p = Transition.prototype
  6250. /**
  6251. * Start an entering transition.
  6252. *
  6253. * 1. enter transition triggered
  6254. * 2. call beforeEnter hook
  6255. * 3. add enter class
  6256. * 4. insert/show element
  6257. * 5. call enter hook (with possible explicit js callback)
  6258. * 6. reflow
  6259. * 7. based on transition type:
  6260. * - transition:
  6261. * remove class now, wait for transitionend,
  6262. * then done if there's no explicit js callback.
  6263. * - animation:
  6264. * wait for animationend, remove class,
  6265. * then done if there's no explicit js callback.
  6266. * - no css transition:
  6267. * done now if there's no explicit js callback.
  6268. * 8. wait for either done or js callback, then call
  6269. * afterEnter hook.
  6270. *
  6271. * @param {Function} op - insert/show the element
  6272. * @param {Function} [cb]
  6273. */
  6274. p.enter = function (op, cb) {
  6275. this.cancelPending()
  6276. this.callHook('beforeEnter')
  6277. this.cb = cb
  6278. addClass(this.el, this.enterClass)
  6279. op()
  6280. this.entered = false
  6281. this.callHookWithCb('enter')
  6282. if (this.entered) {
  6283. return // user called done synchronously.
  6284. }
  6285. this.cancel = this.hooks && this.hooks.enterCancelled
  6286. queue.push(this.enterNextTick)
  6287. }
  6288. /**
  6289. * The "nextTick" phase of an entering transition, which is
  6290. * to be pushed into a queue and executed after a reflow so
  6291. * that removing the class can trigger a CSS transition.
  6292. */
  6293. p.enterNextTick = function () {
  6294. // Important hack:
  6295. // in Chrome, if a just-entered element is applied the
  6296. // leave class while its interpolated property still has
  6297. // a very small value (within one frame), Chrome will
  6298. // skip the leave transition entirely and not firing the
  6299. // transtionend event. Therefore we need to protected
  6300. // against such cases using a one-frame timeout.
  6301. this.justEntered = true
  6302. var self = this
  6303. setTimeout(function () {
  6304. self.justEntered = false
  6305. }, 17)
  6306. var enterDone = this.enterDone
  6307. var type = this.getCssTransitionType(this.enterClass)
  6308. if (!this.pendingJsCb) {
  6309. if (type === TYPE_TRANSITION) {
  6310. // trigger transition by removing enter class now
  6311. removeClass(this.el, this.enterClass)
  6312. this.setupCssCb(transitionEndEvent, enterDone)
  6313. } else if (type === TYPE_ANIMATION) {
  6314. this.setupCssCb(animationEndEvent, enterDone)
  6315. } else {
  6316. enterDone()
  6317. }
  6318. } else if (type === TYPE_TRANSITION) {
  6319. removeClass(this.el, this.enterClass)
  6320. }
  6321. }
  6322. /**
  6323. * The "cleanup" phase of an entering transition.
  6324. */
  6325. p.enterDone = function () {
  6326. this.entered = true
  6327. this.cancel = this.pendingJsCb = null
  6328. removeClass(this.el, this.enterClass)
  6329. this.callHook('afterEnter')
  6330. if (this.cb) this.cb()
  6331. }
  6332. /**
  6333. * Start a leaving transition.
  6334. *
  6335. * 1. leave transition triggered.
  6336. * 2. call beforeLeave hook
  6337. * 3. add leave class (trigger css transition)
  6338. * 4. call leave hook (with possible explicit js callback)
  6339. * 5. reflow if no explicit js callback is provided
  6340. * 6. based on transition type:
  6341. * - transition or animation:
  6342. * wait for end event, remove class, then done if
  6343. * there's no explicit js callback.
  6344. * - no css transition:
  6345. * done if there's no explicit js callback.
  6346. * 7. wait for either done or js callback, then call
  6347. * afterLeave hook.
  6348. *
  6349. * @param {Function} op - remove/hide the element
  6350. * @param {Function} [cb]
  6351. */
  6352. p.leave = function (op, cb) {
  6353. this.cancelPending()
  6354. this.callHook('beforeLeave')
  6355. this.op = op
  6356. this.cb = cb
  6357. addClass(this.el, this.leaveClass)
  6358. this.left = false
  6359. this.callHookWithCb('leave')
  6360. if (this.left) {
  6361. return // user called done synchronously.
  6362. }
  6363. this.cancel = this.hooks && this.hooks.leaveCancelled
  6364. // only need to handle leaveDone if
  6365. // 1. the transition is already done (synchronously called
  6366. // by the user, which causes this.op set to null)
  6367. // 2. there's no explicit js callback
  6368. if (this.op && !this.pendingJsCb) {
  6369. // if a CSS transition leaves immediately after enter,
  6370. // the transitionend event never fires. therefore we
  6371. // detect such cases and end the leave immediately.
  6372. if (this.justEntered) {
  6373. this.leaveDone()
  6374. } else {
  6375. queue.push(this.leaveNextTick)
  6376. }
  6377. }
  6378. }
  6379. /**
  6380. * The "nextTick" phase of a leaving transition.
  6381. */
  6382. p.leaveNextTick = function () {
  6383. var type = this.getCssTransitionType(this.leaveClass)
  6384. if (type) {
  6385. var event = type === TYPE_TRANSITION
  6386. ? transitionEndEvent
  6387. : animationEndEvent
  6388. this.setupCssCb(event, this.leaveDone)
  6389. } else {
  6390. this.leaveDone()
  6391. }
  6392. }
  6393. /**
  6394. * The "cleanup" phase of a leaving transition.
  6395. */
  6396. p.leaveDone = function () {
  6397. this.left = true
  6398. this.cancel = this.pendingJsCb = null
  6399. this.op()
  6400. removeClass(this.el, this.leaveClass)
  6401. this.callHook('afterLeave')
  6402. if (this.cb) this.cb()
  6403. this.op = null
  6404. }
  6405. /**
  6406. * Cancel any pending callbacks from a previously running
  6407. * but not finished transition.
  6408. */
  6409. p.cancelPending = function () {
  6410. this.op = this.cb = null
  6411. var hasPending = false
  6412. if (this.pendingCssCb) {
  6413. hasPending = true
  6414. _.off(this.el, this.pendingCssEvent, this.pendingCssCb)
  6415. this.pendingCssEvent = this.pendingCssCb = null
  6416. }
  6417. if (this.pendingJsCb) {
  6418. hasPending = true
  6419. this.pendingJsCb.cancel()
  6420. this.pendingJsCb = null
  6421. }
  6422. if (hasPending) {
  6423. removeClass(this.el, this.enterClass)
  6424. removeClass(this.el, this.leaveClass)
  6425. }
  6426. if (this.cancel) {
  6427. this.cancel.call(this.vm, this.el)
  6428. this.cancel = null
  6429. }
  6430. }
  6431. /**
  6432. * Call a user-provided synchronous hook function.
  6433. *
  6434. * @param {String} type
  6435. */
  6436. p.callHook = function (type) {
  6437. if (this.hooks && this.hooks[type]) {
  6438. this.hooks[type].call(this.vm, this.el)
  6439. }
  6440. }
  6441. /**
  6442. * Call a user-provided, potentially-async hook function.
  6443. * We check for the length of arguments to see if the hook
  6444. * expects a `done` callback. If true, the transition's end
  6445. * will be determined by when the user calls that callback;
  6446. * otherwise, the end is determined by the CSS transition or
  6447. * animation.
  6448. *
  6449. * @param {String} type
  6450. */
  6451. p.callHookWithCb = function (type) {
  6452. var hook = this.hooks && this.hooks[type]
  6453. if (hook) {
  6454. if (hook.length > 1) {
  6455. this.pendingJsCb = _.cancellable(this[type + 'Done'])
  6456. }
  6457. hook.call(this.vm, this.el, this.pendingJsCb)
  6458. }
  6459. }
  6460. /**
  6461. * Get an element's transition type based on the
  6462. * calculated styles.
  6463. *
  6464. * @param {String} className
  6465. * @return {Number}
  6466. */
  6467. p.getCssTransitionType = function (className) {
  6468. /* istanbul ignore if */
  6469. if (
  6470. !transitionEndEvent ||
  6471. // skip CSS transitions if page is not visible -
  6472. // this solves the issue of transitionend events not
  6473. // firing until the page is visible again.
  6474. // pageVisibility API is supported in IE10+, same as
  6475. // CSS transitions.
  6476. document.hidden ||
  6477. // explicit js-only transition
  6478. (this.hooks && this.hooks.css === false) ||
  6479. // element is hidden
  6480. isHidden(this.el)
  6481. ) {
  6482. return
  6483. }
  6484. var type = this.typeCache[className]
  6485. if (type) return type
  6486. var inlineStyles = this.el.style
  6487. var computedStyles = window.getComputedStyle(this.el)
  6488. var transDuration =
  6489. inlineStyles[transDurationProp] ||
  6490. computedStyles[transDurationProp]
  6491. if (transDuration && transDuration !== '0s') {
  6492. type = TYPE_TRANSITION
  6493. } else {
  6494. var animDuration =
  6495. inlineStyles[animDurationProp] ||
  6496. computedStyles[animDurationProp]
  6497. if (animDuration && animDuration !== '0s') {
  6498. type = TYPE_ANIMATION
  6499. }
  6500. }
  6501. if (type) {
  6502. this.typeCache[className] = type
  6503. }
  6504. return type
  6505. }
  6506. /**
  6507. * Setup a CSS transitionend/animationend callback.
  6508. *
  6509. * @param {String} event
  6510. * @param {Function} cb
  6511. */
  6512. p.setupCssCb = function (event, cb) {
  6513. this.pendingCssEvent = event
  6514. var self = this
  6515. var el = this.el
  6516. var onEnd = this.pendingCssCb = function (e) {
  6517. if (e.target === el) {
  6518. _.off(el, event, onEnd)
  6519. self.pendingCssEvent = self.pendingCssCb = null
  6520. if (!self.pendingJsCb && cb) {
  6521. cb()
  6522. }
  6523. }
  6524. }
  6525. _.on(el, event, onEnd)
  6526. }
  6527. /**
  6528. * Check if an element is hidden - in that case we can just
  6529. * skip the transition alltogether.
  6530. *
  6531. * @param {Element} el
  6532. * @return {Boolean}
  6533. */
  6534. function isHidden (el) {
  6535. return !(
  6536. el.offsetWidth &&
  6537. el.offsetHeight &&
  6538. el.getClientRects().length
  6539. )
  6540. }
  6541. module.exports = Transition
  6542. /***/ },
  6543. /* 47 */
  6544. /***/ function(module, exports, __webpack_require__) {
  6545. var _ = __webpack_require__(1)
  6546. var queue = []
  6547. var queued = false
  6548. /**
  6549. * Push a job into the queue.
  6550. *
  6551. * @param {Function} job
  6552. */
  6553. exports.push = function (job) {
  6554. queue.push(job)
  6555. if (!queued) {
  6556. queued = true
  6557. _.nextTick(flush)
  6558. }
  6559. }
  6560. /**
  6561. * Flush the queue, and do one forced reflow before
  6562. * triggering transitions.
  6563. */
  6564. function flush () {
  6565. // Force layout
  6566. var f = document.documentElement.offsetHeight
  6567. for (var i = 0; i < queue.length; i++) {
  6568. queue[i]()
  6569. }
  6570. queue = []
  6571. queued = false
  6572. // dummy return, so js linters don't complain about
  6573. // unused variable f
  6574. return f
  6575. }
  6576. /***/ },
  6577. /* 48 */
  6578. /***/ function(module, exports, __webpack_require__) {
  6579. var _ = __webpack_require__(1)
  6580. var dirParser = __webpack_require__(8)
  6581. var propDef = __webpack_require__(39)
  6582. var propBindingModes = __webpack_require__(5)._propBindingModes
  6583. var empty = {}
  6584. // regexes
  6585. var identRE = __webpack_require__(43).identRE
  6586. var settablePathRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\[[^\[\]]+\])*$/
  6587. /**
  6588. * Compile props on a root element and return
  6589. * a props link function.
  6590. *
  6591. * @param {Element|DocumentFragment} el
  6592. * @param {Array} propOptions
  6593. * @return {Function} propsLinkFn
  6594. */
  6595. module.exports = function compileProps (el, propOptions) {
  6596. var props = []
  6597. var names = Object.keys(propOptions)
  6598. var i = names.length
  6599. var options, name, attr, value, path, parsed, prop, isTitleBinding
  6600. while (i--) {
  6601. name = names[i]
  6602. options = propOptions[name] || empty
  6603. if (("development") !== 'production' && name === '$data') {
  6604. _.warn('Do not use $data as prop.')
  6605. continue
  6606. }
  6607. // props could contain dashes, which will be
  6608. // interpreted as minus calculations by the parser
  6609. // so we need to camelize the path here
  6610. path = _.camelize(name)
  6611. if (!identRE.test(path)) {
  6612. ("development") !== 'production' && _.warn(
  6613. 'Invalid prop key: "' + name + '". Prop keys ' +
  6614. 'must be valid identifiers.'
  6615. )
  6616. continue
  6617. }
  6618. prop = {
  6619. name: name,
  6620. path: path,
  6621. options: options,
  6622. mode: propBindingModes.ONE_WAY
  6623. }
  6624. // IE title issues
  6625. isTitleBinding = false
  6626. if (name === 'title' && (el.getAttribute(':title') || el.getAttribute('v-bind:title'))) {
  6627. isTitleBinding = true
  6628. }
  6629. // first check literal version
  6630. attr = _.hyphenate(name)
  6631. value = prop.raw = _.attr(el, attr)
  6632. if (value === null || isTitleBinding) {
  6633. // then check dynamic version
  6634. if ((value = _.getBindAttr(el, attr)) === null) {
  6635. if ((value = _.getBindAttr(el, attr + '.sync')) !== null) {
  6636. prop.mode = propBindingModes.TWO_WAY
  6637. } else if ((value = _.getBindAttr(el, attr + '.once')) !== null) {
  6638. prop.mode = propBindingModes.ONE_TIME
  6639. }
  6640. }
  6641. prop.raw = value
  6642. if (value !== null) {
  6643. parsed = dirParser.parse(value)
  6644. value = parsed.expression
  6645. prop.filters = parsed.filters
  6646. // check binding type
  6647. if (_.isLiteral(value)) {
  6648. // for expressions containing literal numbers and
  6649. // booleans, there's no need to setup a prop binding,
  6650. // so we can optimize them as a one-time set.
  6651. prop.optimizedLiteral = true
  6652. } else {
  6653. prop.dynamic = true
  6654. // check non-settable path for two-way bindings
  6655. if (("development") !== 'production' &&
  6656. prop.mode === propBindingModes.TWO_WAY &&
  6657. !settablePathRE.test(value)) {
  6658. prop.mode = propBindingModes.ONE_WAY
  6659. _.warn(
  6660. 'Cannot bind two-way prop with non-settable ' +
  6661. 'parent path: ' + value
  6662. )
  6663. }
  6664. }
  6665. prop.parentPath = value
  6666. // warn required two-way
  6667. if (
  6668. ("development") !== 'production' &&
  6669. options.twoWay &&
  6670. prop.mode !== propBindingModes.TWO_WAY
  6671. ) {
  6672. _.warn(
  6673. 'Prop "' + name + '" expects a two-way binding type.'
  6674. )
  6675. }
  6676. } else if (options.required) {
  6677. // warn missing required
  6678. ("development") !== 'production' && _.warn(
  6679. 'Missing required prop: ' + name
  6680. )
  6681. }
  6682. }
  6683. // push prop
  6684. props.push(prop)
  6685. }
  6686. return makePropsLinkFn(props)
  6687. }
  6688. /**
  6689. * Build a function that applies props to a vm.
  6690. *
  6691. * @param {Array} props
  6692. * @return {Function} propsLinkFn
  6693. */
  6694. function makePropsLinkFn (props) {
  6695. return function propsLinkFn (vm, scope) {
  6696. // store resolved props info
  6697. vm._props = {}
  6698. var i = props.length
  6699. var prop, path, options, value, raw
  6700. while (i--) {
  6701. prop = props[i]
  6702. raw = prop.raw
  6703. path = prop.path
  6704. options = prop.options
  6705. vm._props[path] = prop
  6706. if (raw === null) {
  6707. // initialize absent prop
  6708. _.initProp(vm, prop, getDefault(vm, options))
  6709. } else if (prop.dynamic) {
  6710. // dynamic prop
  6711. if (vm._context) {
  6712. if (prop.mode === propBindingModes.ONE_TIME) {
  6713. // one time binding
  6714. value = (scope || vm._context).$get(prop.parentPath)
  6715. _.initProp(vm, prop, value)
  6716. } else {
  6717. // dynamic binding
  6718. vm._bindDir({
  6719. name: 'prop',
  6720. def: propDef,
  6721. prop: prop
  6722. }, null, null, scope) // el, host, scope
  6723. }
  6724. } else {
  6725. ("development") !== 'production' && _.warn(
  6726. 'Cannot bind dynamic prop on a root instance' +
  6727. ' with no parent: ' + prop.name + '="' +
  6728. raw + '"'
  6729. )
  6730. }
  6731. } else if (prop.optimizedLiteral) {
  6732. // optimized literal, cast it and just set once
  6733. raw = _.stripQuotes(raw)
  6734. value = _.toBoolean(_.toNumber(raw))
  6735. _.initProp(vm, prop, value)
  6736. } else {
  6737. // string literal, but we need to cater for
  6738. // Boolean props with no value
  6739. value = options.type === Boolean && raw === ''
  6740. ? true
  6741. : raw
  6742. _.initProp(vm, prop, value)
  6743. }
  6744. }
  6745. }
  6746. }
  6747. /**
  6748. * Get the default value of a prop.
  6749. *
  6750. * @param {Vue} vm
  6751. * @param {Object} options
  6752. * @return {*}
  6753. */
  6754. function getDefault (vm, options) {
  6755. // no default, return undefined
  6756. if (!options.hasOwnProperty('default')) {
  6757. // absent boolean value defaults to false
  6758. return options.type === Boolean
  6759. ? false
  6760. : undefined
  6761. }
  6762. var def = options.default
  6763. // warn against non-factory defaults for Object & Array
  6764. if (_.isObject(def)) {
  6765. ("development") !== 'production' && _.warn(
  6766. 'Object/Array as default prop values will be shared ' +
  6767. 'across multiple instances. Use a factory function ' +
  6768. 'to return the default value instead.'
  6769. )
  6770. }
  6771. // call factory function for non-Function types
  6772. return typeof def === 'function' && options.type !== Function
  6773. ? def.call(vm)
  6774. : def
  6775. }
  6776. /***/ },
  6777. /* 49 */
  6778. /***/ function(module, exports, __webpack_require__) {
  6779. var _ = __webpack_require__(1)
  6780. var templateParser = __webpack_require__(19)
  6781. var specialCharRE = /[^\w\-:\.]/
  6782. /**
  6783. * Process an element or a DocumentFragment based on a
  6784. * instance option object. This allows us to transclude
  6785. * a template node/fragment before the instance is created,
  6786. * so the processed fragment can then be cloned and reused
  6787. * in v-for.
  6788. *
  6789. * @param {Element} el
  6790. * @param {Object} options
  6791. * @return {Element|DocumentFragment}
  6792. */
  6793. exports.transclude = function (el, options) {
  6794. // extract container attributes to pass them down
  6795. // to compiler, because they need to be compiled in
  6796. // parent scope. we are mutating the options object here
  6797. // assuming the same object will be used for compile
  6798. // right after this.
  6799. if (options) {
  6800. options._containerAttrs = extractAttrs(el)
  6801. }
  6802. // for template tags, what we want is its content as
  6803. // a documentFragment (for fragment instances)
  6804. if (_.isTemplate(el)) {
  6805. el = templateParser.parse(el)
  6806. }
  6807. if (options) {
  6808. if (options._asComponent && !options.template) {
  6809. options.template = '<slot></slot>'
  6810. }
  6811. if (options.template) {
  6812. options._content = _.extractContent(el)
  6813. el = transcludeTemplate(el, options)
  6814. }
  6815. }
  6816. if (el instanceof DocumentFragment) {
  6817. // anchors for fragment instance
  6818. // passing in `persist: true` to avoid them being
  6819. // discarded by IE during template cloning
  6820. _.prepend(_.createAnchor('v-start', true), el)
  6821. el.appendChild(_.createAnchor('v-end', true))
  6822. }
  6823. return el
  6824. }
  6825. /**
  6826. * Process the template option.
  6827. * If the replace option is true this will swap the $el.
  6828. *
  6829. * @param {Element} el
  6830. * @param {Object} options
  6831. * @return {Element|DocumentFragment}
  6832. */
  6833. function transcludeTemplate (el, options) {
  6834. var template = options.template
  6835. var frag = templateParser.parse(template, true)
  6836. if (frag) {
  6837. var replacer = frag.firstChild
  6838. var tag = replacer.tagName && replacer.tagName.toLowerCase()
  6839. if (options.replace) {
  6840. /* istanbul ignore if */
  6841. if (el === document.body) {
  6842. ("development") !== 'production' && _.warn(
  6843. 'You are mounting an instance with a template to ' +
  6844. '<body>. This will replace <body> entirely. You ' +
  6845. 'should probably use `replace: false` here.'
  6846. )
  6847. }
  6848. // there are many cases where the instance must
  6849. // become a fragment instance: basically anything that
  6850. // can create more than 1 root nodes.
  6851. if (
  6852. // multi-children template
  6853. frag.childNodes.length > 1 ||
  6854. // non-element template
  6855. replacer.nodeType !== 1 ||
  6856. // single nested component
  6857. tag === 'component' ||
  6858. _.resolveAsset(options, 'components', tag) ||
  6859. replacer.hasAttribute('is') ||
  6860. replacer.hasAttribute(':is') ||
  6861. replacer.hasAttribute('v-bind:is') ||
  6862. // element directive
  6863. _.resolveAsset(options, 'elementDirectives', tag) ||
  6864. // for block
  6865. replacer.hasAttribute('v-for') ||
  6866. // if block
  6867. replacer.hasAttribute('v-if')
  6868. ) {
  6869. return frag
  6870. } else {
  6871. options._replacerAttrs = extractAttrs(replacer)
  6872. mergeAttrs(el, replacer)
  6873. return replacer
  6874. }
  6875. } else {
  6876. el.appendChild(frag)
  6877. return el
  6878. }
  6879. } else {
  6880. ("development") !== 'production' && _.warn(
  6881. 'Invalid template option: ' + template
  6882. )
  6883. }
  6884. }
  6885. /**
  6886. * Helper to extract a component container's attributes
  6887. * into a plain object array.
  6888. *
  6889. * @param {Element} el
  6890. * @return {Array}
  6891. */
  6892. function extractAttrs (el) {
  6893. if (el.nodeType === 1 && el.hasAttributes()) {
  6894. return _.toArray(el.attributes)
  6895. }
  6896. }
  6897. /**
  6898. * Merge the attributes of two elements, and make sure
  6899. * the class names are merged properly.
  6900. *
  6901. * @param {Element} from
  6902. * @param {Element} to
  6903. */
  6904. function mergeAttrs (from, to) {
  6905. var attrs = from.attributes
  6906. var i = attrs.length
  6907. var name, value
  6908. while (i--) {
  6909. name = attrs[i].name
  6910. value = attrs[i].value
  6911. if (!to.hasAttribute(name) && !specialCharRE.test(name)) {
  6912. to.setAttribute(name, value)
  6913. } else if (name === 'class') {
  6914. value = to.getAttribute(name) + ' ' + value
  6915. to.setAttribute(name, value)
  6916. }
  6917. }
  6918. }
  6919. /***/ },
  6920. /* 50 */
  6921. /***/ function(module, exports, __webpack_require__) {
  6922. exports.slot = __webpack_require__(51)
  6923. exports.partial = __webpack_require__(52)
  6924. /***/ },
  6925. /* 51 */
  6926. /***/ function(module, exports, __webpack_require__) {
  6927. var _ = __webpack_require__(1)
  6928. var templateParser = __webpack_require__(19)
  6929. // This is the elementDirective that handles <content>
  6930. // transclusions. It relies on the raw content of an
  6931. // instance being stored as `$options._content` during
  6932. // the transclude phase.
  6933. module.exports = {
  6934. priority: 1750,
  6935. params: ['name'],
  6936. bind: function () {
  6937. var host = this.vm
  6938. var raw = host.$options._content
  6939. var content
  6940. if (!raw) {
  6941. this.fallback()
  6942. return
  6943. }
  6944. var context = host._context
  6945. var slotName = this.params.name
  6946. if (!slotName) {
  6947. // Default content
  6948. var self = this
  6949. var compileDefaultContent = function () {
  6950. self.compile(
  6951. extractFragment(raw.childNodes, raw, true),
  6952. context,
  6953. host
  6954. )
  6955. }
  6956. if (!host._isCompiled) {
  6957. // defer until the end of instance compilation,
  6958. // because the default outlet must wait until all
  6959. // other possible outlets with selectors have picked
  6960. // out their contents.
  6961. host.$once('hook:compiled', compileDefaultContent)
  6962. } else {
  6963. compileDefaultContent()
  6964. }
  6965. } else {
  6966. var selector = '[slot="' + slotName + '"]'
  6967. var nodes = raw.querySelectorAll(selector)
  6968. if (nodes.length) {
  6969. content = extractFragment(nodes, raw)
  6970. if (content.hasChildNodes()) {
  6971. this.compile(content, context, host)
  6972. } else {
  6973. this.fallback()
  6974. }
  6975. } else {
  6976. this.fallback()
  6977. }
  6978. }
  6979. },
  6980. fallback: function () {
  6981. this.compile(_.extractContent(this.el, true), this.vm)
  6982. },
  6983. compile: function (content, context, host) {
  6984. if (content && context) {
  6985. var scope = host
  6986. ? host._scope
  6987. : this._scope
  6988. this.unlink = context.$compile(
  6989. content, host, scope, this._frag
  6990. )
  6991. }
  6992. if (content) {
  6993. _.replace(this.el, content)
  6994. } else {
  6995. _.remove(this.el)
  6996. }
  6997. },
  6998. unbind: function () {
  6999. if (this.unlink) {
  7000. this.unlink()
  7001. }
  7002. }
  7003. }
  7004. /**
  7005. * Extract qualified content nodes from a node list.
  7006. *
  7007. * @param {NodeList} nodes
  7008. * @param {Element} parent
  7009. * @param {Boolean} main
  7010. * @return {DocumentFragment}
  7011. */
  7012. function extractFragment (nodes, parent, main) {
  7013. var frag = document.createDocumentFragment()
  7014. for (var i = 0, l = nodes.length; i < l; i++) {
  7015. var node = nodes[i]
  7016. // if this is the main outlet, we want to skip all
  7017. // previously selected nodes;
  7018. // otherwise, we want to mark the node as selected.
  7019. // clone the node so the original raw content remains
  7020. // intact. this ensures proper re-compilation in cases
  7021. // where the outlet is inside a conditional block
  7022. if (main && !node.__v_selected) {
  7023. append(node)
  7024. } else if (!main && node.parentNode === parent) {
  7025. node.__v_selected = true
  7026. append(node)
  7027. }
  7028. }
  7029. return frag
  7030. function append (node) {
  7031. if (_.isTemplate(node) &&
  7032. !node.hasAttribute('v-if') &&
  7033. !node.hasAttribute('v-for')) {
  7034. node = templateParser.parse(node)
  7035. }
  7036. node = templateParser.clone(node)
  7037. frag.appendChild(node)
  7038. }
  7039. }
  7040. /***/ },
  7041. /* 52 */
  7042. /***/ function(module, exports, __webpack_require__) {
  7043. var _ = __webpack_require__(1)
  7044. var vIf = __webpack_require__(23)
  7045. var FragmentFactory = __webpack_require__(21)
  7046. module.exports = {
  7047. priority: 1750,
  7048. params: ['name'],
  7049. // watch changes to name for dynamic partials
  7050. paramWatchers: {
  7051. name: function (value) {
  7052. vIf.remove.call(this)
  7053. if (value) {
  7054. this.insert(value)
  7055. }
  7056. }
  7057. },
  7058. bind: function () {
  7059. this.anchor = _.createAnchor('v-partial')
  7060. _.replace(this.el, this.anchor)
  7061. this.insert(this.params.name)
  7062. },
  7063. insert: function (id) {
  7064. var partial = _.resolveAsset(this.vm.$options, 'partials', id)
  7065. if (true) {
  7066. _.assertAsset(partial, 'partial', id)
  7067. }
  7068. if (partial) {
  7069. this.factory = new FragmentFactory(this.vm, partial)
  7070. vIf.insert.call(this)
  7071. }
  7072. },
  7073. unbind: function () {
  7074. if (this.frag) {
  7075. this.frag.destroy()
  7076. }
  7077. }
  7078. }
  7079. /***/ },
  7080. /* 53 */
  7081. /***/ function(module, exports, __webpack_require__) {
  7082. var _ = __webpack_require__(1)
  7083. /**
  7084. * Stringify value.
  7085. *
  7086. * @param {Number} indent
  7087. */
  7088. exports.json = {
  7089. read: function (value, indent) {
  7090. return typeof value === 'string'
  7091. ? value
  7092. : JSON.stringify(value, null, Number(indent) || 2)
  7093. },
  7094. write: function (value) {
  7095. try {
  7096. return JSON.parse(value)
  7097. } catch (e) {
  7098. return value
  7099. }
  7100. }
  7101. }
  7102. /**
  7103. * 'abc' => 'Abc'
  7104. */
  7105. exports.capitalize = function (value) {
  7106. if (!value && value !== 0) return ''
  7107. value = value.toString()
  7108. return value.charAt(0).toUpperCase() + value.slice(1)
  7109. }
  7110. /**
  7111. * 'abc' => 'ABC'
  7112. */
  7113. exports.uppercase = function (value) {
  7114. return (value || value === 0)
  7115. ? value.toString().toUpperCase()
  7116. : ''
  7117. }
  7118. /**
  7119. * 'AbC' => 'abc'
  7120. */
  7121. exports.lowercase = function (value) {
  7122. return (value || value === 0)
  7123. ? value.toString().toLowerCase()
  7124. : ''
  7125. }
  7126. /**
  7127. * 12345 => $12,345.00
  7128. *
  7129. * @param {String} sign
  7130. */
  7131. var digitsRE = /(\d{3})(?=\d)/g
  7132. exports.currency = function (value, currency) {
  7133. value = parseFloat(value)
  7134. if (!isFinite(value) || (!value && value !== 0)) return ''
  7135. currency = currency != null ? currency : '$'
  7136. var stringified = Math.abs(value).toFixed(2)
  7137. var _int = stringified.slice(0, -3)
  7138. var i = _int.length % 3
  7139. var head = i > 0
  7140. ? (_int.slice(0, i) + (_int.length > 3 ? ',' : ''))
  7141. : ''
  7142. var _float = stringified.slice(-3)
  7143. var sign = value < 0 ? '-' : ''
  7144. return currency + sign + head +
  7145. _int.slice(i).replace(digitsRE, '$1,') +
  7146. _float
  7147. }
  7148. /**
  7149. * 'item' => 'items'
  7150. *
  7151. * @params
  7152. * an array of strings corresponding to
  7153. * the single, double, triple ... forms of the word to
  7154. * be pluralized. When the number to be pluralized
  7155. * exceeds the length of the args, it will use the last
  7156. * entry in the array.
  7157. *
  7158. * e.g. ['single', 'double', 'triple', 'multiple']
  7159. */
  7160. exports.pluralize = function (value) {
  7161. var args = _.toArray(arguments, 1)
  7162. return args.length > 1
  7163. ? (args[value % 10 - 1] || args[args.length - 1])
  7164. : (args[0] + (value === 1 ? '' : 's'))
  7165. }
  7166. /**
  7167. * Debounce a handler function.
  7168. *
  7169. * @param {Function} handler
  7170. * @param {Number} delay = 300
  7171. * @return {Function}
  7172. */
  7173. exports.debounce = function (handler, delay) {
  7174. if (!handler) return
  7175. if (!delay) {
  7176. delay = 300
  7177. }
  7178. return _.debounce(handler, delay)
  7179. }
  7180. /**
  7181. * Install special array filters
  7182. */
  7183. _.extend(exports, __webpack_require__(54))
  7184. /***/ },
  7185. /* 54 */
  7186. /***/ function(module, exports, __webpack_require__) {
  7187. var _ = __webpack_require__(1)
  7188. var Path = __webpack_require__(43)
  7189. var toArray = __webpack_require__(20)._postProcess
  7190. /**
  7191. * Limit filter for arrays
  7192. *
  7193. * @param {Number} n
  7194. */
  7195. exports.limitBy = function (arr, n) {
  7196. return typeof n === 'number'
  7197. ? arr.slice(0, n)
  7198. : arr
  7199. }
  7200. /**
  7201. * Filter filter for arrays
  7202. *
  7203. * @param {String} searchKey
  7204. * @param {String} [delimiter]
  7205. * @param {String} dataKey
  7206. */
  7207. exports.filterBy = function (arr, search, delimiter /* ...dataKeys */) {
  7208. arr = toArray(arr)
  7209. if (search == null) {
  7210. return arr
  7211. }
  7212. if (typeof search === 'function') {
  7213. return arr.filter(search)
  7214. }
  7215. // cast to lowercase string
  7216. search = ('' + search).toLowerCase()
  7217. // allow optional `in` delimiter
  7218. // because why not
  7219. var n = delimiter === 'in' ? 3 : 2
  7220. // extract and flatten keys
  7221. var keys = _.toArray(arguments, n).reduce(function (prev, cur) {
  7222. return prev.concat(cur)
  7223. }, [])
  7224. var res = []
  7225. var item, key, val, j
  7226. for (var i = 0, l = arr.length; i < l; i++) {
  7227. item = arr[i]
  7228. val = (item && item.$value) || item
  7229. j = keys.length
  7230. if (j) {
  7231. while (j--) {
  7232. key = keys[j]
  7233. if ((key === '$key' && contains(item.$key, search)) ||
  7234. contains(Path.get(val, key), search)) {
  7235. res.push(item)
  7236. break
  7237. }
  7238. }
  7239. } else if (contains(item, search)) {
  7240. res.push(item)
  7241. }
  7242. }
  7243. return res
  7244. }
  7245. /**
  7246. * Filter filter for arrays
  7247. *
  7248. * @param {String} sortKey
  7249. * @param {String} reverse
  7250. */
  7251. exports.orderBy = function (arr, sortKey, reverse) {
  7252. arr = toArray(arr)
  7253. if (!sortKey) {
  7254. return arr
  7255. }
  7256. var order = (reverse && reverse < 0) ? -1 : 1
  7257. // sort on a copy to avoid mutating original array
  7258. return arr.slice().sort(function (a, b) {
  7259. if (sortKey !== '$key') {
  7260. if (_.isObject(a) && '$value' in a) a = a.$value
  7261. if (_.isObject(b) && '$value' in b) b = b.$value
  7262. }
  7263. a = _.isObject(a) ? Path.get(a, sortKey) : a
  7264. b = _.isObject(b) ? Path.get(b, sortKey) : b
  7265. return a === b ? 0 : a > b ? order : -order
  7266. })
  7267. }
  7268. /**
  7269. * String contain helper
  7270. *
  7271. * @param {*} val
  7272. * @param {String} search
  7273. */
  7274. function contains (val, search) {
  7275. var i
  7276. if (_.isPlainObject(val)) {
  7277. var keys = Object.keys(val)
  7278. i = keys.length
  7279. while (i--) {
  7280. if (contains(val[keys[i]], search)) {
  7281. return true
  7282. }
  7283. }
  7284. } else if (_.isArray(val)) {
  7285. i = val.length
  7286. while (i--) {
  7287. if (contains(val[i], search)) {
  7288. return true
  7289. }
  7290. }
  7291. } else if (val != null) {
  7292. return val.toString().toLowerCase().indexOf(search) > -1
  7293. }
  7294. }
  7295. /***/ },
  7296. /* 55 */
  7297. /***/ function(module, exports, __webpack_require__) {
  7298. var mergeOptions = __webpack_require__(1).mergeOptions
  7299. var uid = 0
  7300. /**
  7301. * The main init sequence. This is called for every
  7302. * instance, including ones that are created from extended
  7303. * constructors.
  7304. *
  7305. * @param {Object} options - this options object should be
  7306. * the result of merging class
  7307. * options and the options passed
  7308. * in to the constructor.
  7309. */
  7310. exports._init = function (options) {
  7311. options = options || {}
  7312. this.$el = null
  7313. this.$parent = options.parent
  7314. this.$root = this.$parent
  7315. ? this.$parent.$root
  7316. : this
  7317. this.$children = []
  7318. this.$refs = {} // child vm references
  7319. this.$els = {} // element references
  7320. this._watchers = [] // all watchers as an array
  7321. this._directives = [] // all directives
  7322. // a uid
  7323. this._uid = uid++
  7324. // a flag to avoid this being observed
  7325. this._isVue = true
  7326. // events bookkeeping
  7327. this._events = {} // registered callbacks
  7328. this._eventsCount = {} // for $broadcast optimization
  7329. this._shouldPropagate = false // for event propagation
  7330. // fragment instance properties
  7331. this._isFragment = false
  7332. this._fragment = // @type {DocumentFragment}
  7333. this._fragmentStart = // @type {Text|Comment}
  7334. this._fragmentEnd = null // @type {Text|Comment}
  7335. // lifecycle state
  7336. this._isCompiled =
  7337. this._isDestroyed =
  7338. this._isReady =
  7339. this._isAttached =
  7340. this._isBeingDestroyed = false
  7341. this._unlinkFn = null
  7342. // context:
  7343. // if this is a transcluded component, context
  7344. // will be the common parent vm of this instance
  7345. // and its host.
  7346. this._context = options._context || this.$parent
  7347. // scope:
  7348. // if this is inside an inline v-for, the scope
  7349. // will be the intermediate scope created for this
  7350. // repeat fragment. this is used for linking props
  7351. // and container directives.
  7352. this._scope = options._scope
  7353. // fragment:
  7354. // if this instance is compiled inside a Fragment, it
  7355. // needs to reigster itself as a child of that fragment
  7356. // for attach/detach to work properly.
  7357. this._frag = options._frag
  7358. if (this._frag) {
  7359. this._frag.children.push(this)
  7360. }
  7361. // push self into parent / transclusion host
  7362. if (this.$parent) {
  7363. this.$parent.$children.push(this)
  7364. }
  7365. // set ref
  7366. if (options._ref) {
  7367. (this._scope || this._context).$refs[options._ref] = this
  7368. }
  7369. // merge options.
  7370. options = this.$options = mergeOptions(
  7371. this.constructor.options,
  7372. options,
  7373. this
  7374. )
  7375. // initialize data as empty object.
  7376. // it will be filled up in _initScope().
  7377. this._data = {}
  7378. // call init hook
  7379. this._callHook('init')
  7380. // initialize data observation and scope inheritance.
  7381. this._initState()
  7382. // setup event system and option events.
  7383. this._initEvents()
  7384. // call created hook
  7385. this._callHook('created')
  7386. // if `el` option is passed, start compilation.
  7387. if (options.el) {
  7388. this.$mount(options.el)
  7389. }
  7390. }
  7391. /***/ },
  7392. /* 56 */
  7393. /***/ function(module, exports, __webpack_require__) {
  7394. var _ = __webpack_require__(1)
  7395. var inDoc = _.inDoc
  7396. var eventRE = /^v-on:|^@/
  7397. /**
  7398. * Setup the instance's option events & watchers.
  7399. * If the value is a string, we pull it from the
  7400. * instance's methods by name.
  7401. */
  7402. exports._initEvents = function () {
  7403. var options = this.$options
  7404. if (options._asComponent) {
  7405. registerComponentEvents(this, options.el)
  7406. }
  7407. registerCallbacks(this, '$on', options.events)
  7408. registerCallbacks(this, '$watch', options.watch)
  7409. }
  7410. /**
  7411. * Register v-on events on a child component
  7412. *
  7413. * @param {Vue} vm
  7414. * @param {Element} el
  7415. */
  7416. function registerComponentEvents (vm, el) {
  7417. var attrs = el.attributes
  7418. var name, handler
  7419. for (var i = 0, l = attrs.length; i < l; i++) {
  7420. name = attrs[i].name
  7421. if (eventRE.test(name)) {
  7422. name = name.replace(eventRE, '')
  7423. handler = (vm._scope || vm._context).$eval(attrs[i].value, true)
  7424. vm.$on(name.replace(eventRE), handler)
  7425. }
  7426. }
  7427. }
  7428. /**
  7429. * Register callbacks for option events and watchers.
  7430. *
  7431. * @param {Vue} vm
  7432. * @param {String} action
  7433. * @param {Object} hash
  7434. */
  7435. function registerCallbacks (vm, action, hash) {
  7436. if (!hash) return
  7437. var handlers, key, i, j
  7438. for (key in hash) {
  7439. handlers = hash[key]
  7440. if (_.isArray(handlers)) {
  7441. for (i = 0, j = handlers.length; i < j; i++) {
  7442. register(vm, action, key, handlers[i])
  7443. }
  7444. } else {
  7445. register(vm, action, key, handlers)
  7446. }
  7447. }
  7448. }
  7449. /**
  7450. * Helper to register an event/watch callback.
  7451. *
  7452. * @param {Vue} vm
  7453. * @param {String} action
  7454. * @param {String} key
  7455. * @param {Function|String|Object} handler
  7456. * @param {Object} [options]
  7457. */
  7458. function register (vm, action, key, handler, options) {
  7459. var type = typeof handler
  7460. if (type === 'function') {
  7461. vm[action](key, handler, options)
  7462. } else if (type === 'string') {
  7463. var methods = vm.$options.methods
  7464. var method = methods && methods[handler]
  7465. if (method) {
  7466. vm[action](key, method, options)
  7467. } else {
  7468. ("development") !== 'production' && _.warn(
  7469. 'Unknown method: "' + handler + '" when ' +
  7470. 'registering callback for ' + action +
  7471. ': "' + key + '".'
  7472. )
  7473. }
  7474. } else if (handler && type === 'object') {
  7475. register(vm, action, key, handler.handler, handler)
  7476. }
  7477. }
  7478. /**
  7479. * Setup recursive attached/detached calls
  7480. */
  7481. exports._initDOMHooks = function () {
  7482. this.$on('hook:attached', onAttached)
  7483. this.$on('hook:detached', onDetached)
  7484. }
  7485. /**
  7486. * Callback to recursively call attached hook on children
  7487. */
  7488. function onAttached () {
  7489. if (!this._isAttached) {
  7490. this._isAttached = true
  7491. this.$children.forEach(callAttach)
  7492. }
  7493. }
  7494. /**
  7495. * Iterator to call attached hook
  7496. *
  7497. * @param {Vue} child
  7498. */
  7499. function callAttach (child) {
  7500. if (!child._isAttached && inDoc(child.$el)) {
  7501. child._callHook('attached')
  7502. }
  7503. }
  7504. /**
  7505. * Callback to recursively call detached hook on children
  7506. */
  7507. function onDetached () {
  7508. if (this._isAttached) {
  7509. this._isAttached = false
  7510. this.$children.forEach(callDetach)
  7511. }
  7512. }
  7513. /**
  7514. * Iterator to call detached hook
  7515. *
  7516. * @param {Vue} child
  7517. */
  7518. function callDetach (child) {
  7519. if (child._isAttached && !inDoc(child.$el)) {
  7520. child._callHook('detached')
  7521. }
  7522. }
  7523. /**
  7524. * Trigger all handlers for a hook
  7525. *
  7526. * @param {String} hook
  7527. */
  7528. exports._callHook = function (hook) {
  7529. var handlers = this.$options[hook]
  7530. if (handlers) {
  7531. for (var i = 0, j = handlers.length; i < j; i++) {
  7532. handlers[i].call(this)
  7533. }
  7534. }
  7535. this.$emit('hook:' + hook)
  7536. }
  7537. /***/ },
  7538. /* 57 */
  7539. /***/ function(module, exports, __webpack_require__) {
  7540. var _ = __webpack_require__(1)
  7541. var compiler = __webpack_require__(14)
  7542. var Observer = __webpack_require__(58)
  7543. var Dep = __webpack_require__(41)
  7544. var Watcher = __webpack_require__(40)
  7545. /**
  7546. * Setup the scope of an instance, which contains:
  7547. * - observed data
  7548. * - computed properties
  7549. * - user methods
  7550. * - meta properties
  7551. */
  7552. exports._initState = function () {
  7553. this._initProps()
  7554. this._initMeta()
  7555. this._initMethods()
  7556. this._initData()
  7557. this._initComputed()
  7558. }
  7559. /**
  7560. * Initialize props.
  7561. */
  7562. exports._initProps = function () {
  7563. var options = this.$options
  7564. var el = options.el
  7565. var props = options.props
  7566. if (props && !el) {
  7567. ("development") !== 'production' && _.warn(
  7568. 'Props will not be compiled if no `el` option is ' +
  7569. 'provided at instantiation.'
  7570. )
  7571. }
  7572. // make sure to convert string selectors into element now
  7573. el = options.el = _.query(el)
  7574. this._propsUnlinkFn = el && el.nodeType === 1 && props
  7575. // props must be linked in proper scope if inside v-for
  7576. ? compiler.compileAndLinkProps(this, el, props, this._scope)
  7577. : null
  7578. }
  7579. /**
  7580. * Initialize the data.
  7581. */
  7582. exports._initData = function () {
  7583. var propsData = this._data
  7584. var optionsDataFn = this.$options.data
  7585. var optionsData = optionsDataFn && optionsDataFn()
  7586. if (optionsData) {
  7587. this._data = optionsData
  7588. for (var prop in propsData) {
  7589. if (("development") !== 'production' &&
  7590. optionsData.hasOwnProperty(prop)) {
  7591. _.warn(
  7592. 'Data field "' + prop + '" is already defined ' +
  7593. 'as a prop. Use prop default value instead.'
  7594. )
  7595. }
  7596. if (this._props[prop].raw !== null ||
  7597. !optionsData.hasOwnProperty(prop)) {
  7598. _.set(optionsData, prop, propsData[prop])
  7599. }
  7600. }
  7601. }
  7602. var data = this._data
  7603. // proxy data on instance
  7604. var keys = Object.keys(data)
  7605. var i, key
  7606. i = keys.length
  7607. while (i--) {
  7608. key = keys[i]
  7609. this._proxy(key)
  7610. }
  7611. // observe data
  7612. Observer.create(data, this)
  7613. }
  7614. /**
  7615. * Swap the isntance's $data. Called in $data's setter.
  7616. *
  7617. * @param {Object} newData
  7618. */
  7619. exports._setData = function (newData) {
  7620. newData = newData || {}
  7621. var oldData = this._data
  7622. this._data = newData
  7623. var keys, key, i
  7624. // unproxy keys not present in new data
  7625. keys = Object.keys(oldData)
  7626. i = keys.length
  7627. while (i--) {
  7628. key = keys[i]
  7629. if (!(key in newData)) {
  7630. this._unproxy(key)
  7631. }
  7632. }
  7633. // proxy keys not already proxied,
  7634. // and trigger change for changed values
  7635. keys = Object.keys(newData)
  7636. i = keys.length
  7637. while (i--) {
  7638. key = keys[i]
  7639. if (!this.hasOwnProperty(key)) {
  7640. // new property
  7641. this._proxy(key)
  7642. }
  7643. }
  7644. oldData.__ob__.removeVm(this)
  7645. Observer.create(newData, this)
  7646. this._digest()
  7647. }
  7648. /**
  7649. * Proxy a property, so that
  7650. * vm.prop === vm._data.prop
  7651. *
  7652. * @param {String} key
  7653. */
  7654. exports._proxy = function (key) {
  7655. if (!_.isReserved(key)) {
  7656. // need to store ref to self here
  7657. // because these getter/setters might
  7658. // be called by child scopes via
  7659. // prototype inheritance.
  7660. var self = this
  7661. Object.defineProperty(self, key, {
  7662. configurable: true,
  7663. enumerable: true,
  7664. get: function proxyGetter () {
  7665. return self._data[key]
  7666. },
  7667. set: function proxySetter (val) {
  7668. self._data[key] = val
  7669. }
  7670. })
  7671. }
  7672. }
  7673. /**
  7674. * Unproxy a property.
  7675. *
  7676. * @param {String} key
  7677. */
  7678. exports._unproxy = function (key) {
  7679. if (!_.isReserved(key)) {
  7680. delete this[key]
  7681. }
  7682. }
  7683. /**
  7684. * Force update on every watcher in scope.
  7685. */
  7686. exports._digest = function () {
  7687. for (var i = 0, l = this._watchers.length; i < l; i++) {
  7688. this._watchers[i].update(true) // shallow updates
  7689. }
  7690. }
  7691. /**
  7692. * Setup computed properties. They are essentially
  7693. * special getter/setters
  7694. */
  7695. function noop () {}
  7696. exports._initComputed = function () {
  7697. var computed = this.$options.computed
  7698. if (computed) {
  7699. for (var key in computed) {
  7700. var userDef = computed[key]
  7701. var def = {
  7702. enumerable: true,
  7703. configurable: true
  7704. }
  7705. if (typeof userDef === 'function') {
  7706. def.get = makeComputedGetter(userDef, this)
  7707. def.set = noop
  7708. } else {
  7709. def.get = userDef.get
  7710. ? userDef.cache !== false
  7711. ? makeComputedGetter(userDef.get, this)
  7712. : _.bind(userDef.get, this)
  7713. : noop
  7714. def.set = userDef.set
  7715. ? _.bind(userDef.set, this)
  7716. : noop
  7717. }
  7718. Object.defineProperty(this, key, def)
  7719. }
  7720. }
  7721. }
  7722. function makeComputedGetter (getter, owner) {
  7723. var watcher = new Watcher(owner, getter, null, {
  7724. lazy: true
  7725. })
  7726. return function computedGetter () {
  7727. if (watcher.dirty) {
  7728. watcher.evaluate()
  7729. }
  7730. if (Dep.target) {
  7731. watcher.depend()
  7732. }
  7733. return watcher.value
  7734. }
  7735. }
  7736. /**
  7737. * Setup instance methods. Methods must be bound to the
  7738. * instance since they might be passed down as a prop to
  7739. * child components.
  7740. */
  7741. exports._initMethods = function () {
  7742. var methods = this.$options.methods
  7743. if (methods) {
  7744. for (var key in methods) {
  7745. this[key] = _.bind(methods[key], this)
  7746. }
  7747. }
  7748. }
  7749. /**
  7750. * Initialize meta information like $index, $key & $value.
  7751. */
  7752. exports._initMeta = function () {
  7753. var metas = this.$options._meta
  7754. if (metas) {
  7755. for (var key in metas) {
  7756. _.defineReactive(this, key, metas[key])
  7757. }
  7758. }
  7759. }
  7760. /***/ },
  7761. /* 58 */
  7762. /***/ function(module, exports, __webpack_require__) {
  7763. var _ = __webpack_require__(1)
  7764. var Dep = __webpack_require__(41)
  7765. var arrayMethods = __webpack_require__(59)
  7766. var arrayKeys = Object.getOwnPropertyNames(arrayMethods)
  7767. /**
  7768. * Observer class that are attached to each observed
  7769. * object. Once attached, the observer converts target
  7770. * object's property keys into getter/setters that
  7771. * collect dependencies and dispatches updates.
  7772. *
  7773. * @param {Array|Object} value
  7774. * @constructor
  7775. */
  7776. function Observer (value) {
  7777. this.value = value
  7778. this.dep = new Dep()
  7779. _.define(value, '__ob__', this)
  7780. if (_.isArray(value)) {
  7781. var augment = _.hasProto
  7782. ? protoAugment
  7783. : copyAugment
  7784. augment(value, arrayMethods, arrayKeys)
  7785. this.observeArray(value)
  7786. } else {
  7787. this.walk(value)
  7788. }
  7789. }
  7790. // Static methods
  7791. /**
  7792. * Attempt to create an observer instance for a value,
  7793. * returns the new observer if successfully observed,
  7794. * or the existing observer if the value already has one.
  7795. *
  7796. * @param {*} value
  7797. * @param {Vue} [vm]
  7798. * @return {Observer|undefined}
  7799. * @static
  7800. */
  7801. Observer.create = function (value, vm) {
  7802. if (!value || typeof value !== 'object') {
  7803. return
  7804. }
  7805. var ob
  7806. if (
  7807. value.hasOwnProperty('__ob__') &&
  7808. value.__ob__ instanceof Observer
  7809. ) {
  7810. ob = value.__ob__
  7811. } else if (
  7812. (_.isArray(value) || _.isPlainObject(value)) &&
  7813. !Object.isFrozen(value) &&
  7814. !value._isVue
  7815. ) {
  7816. ob = new Observer(value)
  7817. }
  7818. if (ob && vm) {
  7819. ob.addVm(vm)
  7820. }
  7821. return ob
  7822. }
  7823. // Instance methods
  7824. /**
  7825. * Walk through each property and convert them into
  7826. * getter/setters. This method should only be called when
  7827. * value type is Object.
  7828. *
  7829. * @param {Object} obj
  7830. */
  7831. Observer.prototype.walk = function (obj) {
  7832. var keys = Object.keys(obj)
  7833. var i = keys.length
  7834. while (i--) {
  7835. this.convert(keys[i], obj[keys[i]])
  7836. }
  7837. }
  7838. /**
  7839. * Observe a list of Array items.
  7840. *
  7841. * @param {Array} items
  7842. */
  7843. Observer.prototype.observeArray = function (items) {
  7844. var i = items.length
  7845. while (i--) {
  7846. Observer.create(items[i])
  7847. }
  7848. }
  7849. /**
  7850. * Convert a property into getter/setter so we can emit
  7851. * the events when the property is accessed/changed.
  7852. *
  7853. * @param {String} key
  7854. * @param {*} val
  7855. */
  7856. Observer.prototype.convert = function (key, val) {
  7857. defineReactive(this.value, key, val)
  7858. }
  7859. /**
  7860. * Add an owner vm, so that when $set/$delete mutations
  7861. * happen we can notify owner vms to proxy the keys and
  7862. * digest the watchers. This is only called when the object
  7863. * is observed as an instance's root $data.
  7864. *
  7865. * @param {Vue} vm
  7866. */
  7867. Observer.prototype.addVm = function (vm) {
  7868. (this.vms || (this.vms = [])).push(vm)
  7869. }
  7870. /**
  7871. * Remove an owner vm. This is called when the object is
  7872. * swapped out as an instance's $data object.
  7873. *
  7874. * @param {Vue} vm
  7875. */
  7876. Observer.prototype.removeVm = function (vm) {
  7877. this.vms.$remove(vm)
  7878. }
  7879. // helpers
  7880. /**
  7881. * Augment an target Object or Array by intercepting
  7882. * the prototype chain using __proto__
  7883. *
  7884. * @param {Object|Array} target
  7885. * @param {Object} proto
  7886. */
  7887. function protoAugment (target, src) {
  7888. target.__proto__ = src
  7889. }
  7890. /**
  7891. * Augment an target Object or Array by defining
  7892. * hidden properties.
  7893. *
  7894. * @param {Object|Array} target
  7895. * @param {Object} proto
  7896. */
  7897. function copyAugment (target, src, keys) {
  7898. var i = keys.length
  7899. var key
  7900. while (i--) {
  7901. key = keys[i]
  7902. _.define(target, key, src[key])
  7903. }
  7904. }
  7905. /**
  7906. * Define a reactive property on an Object.
  7907. *
  7908. * @param {Object} obj
  7909. * @param {String} key
  7910. * @param {*} val
  7911. */
  7912. function defineReactive (obj, key, val) {
  7913. var dep = new Dep()
  7914. var childOb = Observer.create(val)
  7915. Object.defineProperty(obj, key, {
  7916. enumerable: true,
  7917. configurable: true,
  7918. get: function metaGetter () {
  7919. if (Dep.target) {
  7920. dep.depend()
  7921. if (childOb) {
  7922. childOb.dep.depend()
  7923. }
  7924. if (_.isArray(val)) {
  7925. for (var e, i = 0, l = val.length; i < l; i++) {
  7926. e = val[i]
  7927. e && e.__ob__ && e.__ob__.dep.depend()
  7928. }
  7929. }
  7930. }
  7931. return val
  7932. },
  7933. set: function metaSetter (newVal) {
  7934. if (newVal === val) return
  7935. val = newVal
  7936. childOb = Observer.create(newVal)
  7937. dep.notify()
  7938. }
  7939. })
  7940. }
  7941. // Attach to the util object so it can be used elsewhere.
  7942. _.defineReactive = defineReactive
  7943. module.exports = Observer
  7944. /***/ },
  7945. /* 59 */
  7946. /***/ function(module, exports, __webpack_require__) {
  7947. var _ = __webpack_require__(1)
  7948. var arrayProto = Array.prototype
  7949. var arrayMethods = Object.create(arrayProto)
  7950. /**
  7951. * Intercept mutating methods and emit events
  7952. */
  7953. ;[
  7954. 'push',
  7955. 'pop',
  7956. 'shift',
  7957. 'unshift',
  7958. 'splice',
  7959. 'sort',
  7960. 'reverse'
  7961. ]
  7962. .forEach(function (method) {
  7963. // cache original method
  7964. var original = arrayProto[method]
  7965. _.define(arrayMethods, method, function mutator () {
  7966. // avoid leaking arguments:
  7967. // http://jsperf.com/closure-with-arguments
  7968. var i = arguments.length
  7969. var args = new Array(i)
  7970. while (i--) {
  7971. args[i] = arguments[i]
  7972. }
  7973. var result = original.apply(this, args)
  7974. var ob = this.__ob__
  7975. var inserted
  7976. switch (method) {
  7977. case 'push':
  7978. inserted = args
  7979. break
  7980. case 'unshift':
  7981. inserted = args
  7982. break
  7983. case 'splice':
  7984. inserted = args.slice(2)
  7985. break
  7986. }
  7987. if (inserted) ob.observeArray(inserted)
  7988. // notify change
  7989. ob.dep.notify()
  7990. return result
  7991. })
  7992. })
  7993. /**
  7994. * Swap the element at the given index with a new value
  7995. * and emits corresponding event.
  7996. *
  7997. * @param {Number} index
  7998. * @param {*} val
  7999. * @return {*} - replaced element
  8000. */
  8001. _.define(
  8002. arrayProto,
  8003. '$set',
  8004. function $set (index, val) {
  8005. if (index >= this.length) {
  8006. this.length = index + 1
  8007. }
  8008. return this.splice(index, 1, val)[0]
  8009. }
  8010. )
  8011. /**
  8012. * Convenience method to remove the element at given index.
  8013. *
  8014. * @param {Number} index
  8015. * @param {*} val
  8016. */
  8017. _.define(
  8018. arrayProto,
  8019. '$remove',
  8020. function $remove (item) {
  8021. /* istanbul ignore if */
  8022. if (!this.length) return
  8023. var index = _.indexOf(this, item)
  8024. if (index > -1) {
  8025. return this.splice(index, 1)
  8026. }
  8027. }
  8028. )
  8029. module.exports = arrayMethods
  8030. /***/ },
  8031. /* 60 */
  8032. /***/ function(module, exports, __webpack_require__) {
  8033. var _ = __webpack_require__(1)
  8034. var Directive = __webpack_require__(61)
  8035. var compiler = __webpack_require__(14)
  8036. /**
  8037. * Transclude, compile and link element.
  8038. *
  8039. * If a pre-compiled linker is available, that means the
  8040. * passed in element will be pre-transcluded and compiled
  8041. * as well - all we need to do is to call the linker.
  8042. *
  8043. * Otherwise we need to call transclude/compile/link here.
  8044. *
  8045. * @param {Element} el
  8046. * @return {Element}
  8047. */
  8048. exports._compile = function (el) {
  8049. var options = this.$options
  8050. // transclude and init element
  8051. // transclude can potentially replace original
  8052. // so we need to keep reference; this step also injects
  8053. // the template and caches the original attributes
  8054. // on the container node and replacer node.
  8055. var original = el
  8056. el = compiler.transclude(el, options)
  8057. this._initElement(el)
  8058. // root is always compiled per-instance, because
  8059. // container attrs and props can be different every time.
  8060. var contextOptions = this._context && this._context.$options
  8061. var rootLinker = compiler.compileRoot(el, options, contextOptions)
  8062. // compile and link the rest
  8063. var contentLinkFn
  8064. var ctor = this.constructor
  8065. // component compilation can be cached
  8066. // as long as it's not using inline-template
  8067. if (options._linkerCachable) {
  8068. contentLinkFn = ctor.linker
  8069. if (!contentLinkFn) {
  8070. contentLinkFn = ctor.linker = compiler.compile(el, options)
  8071. }
  8072. }
  8073. // link phase
  8074. // make sure to link root with prop scope!
  8075. var rootUnlinkFn = rootLinker(this, el, this._scope)
  8076. var contentUnlinkFn = contentLinkFn
  8077. ? contentLinkFn(this, el)
  8078. : compiler.compile(el, options)(this, el)
  8079. // register composite unlink function
  8080. // to be called during instance destruction
  8081. this._unlinkFn = function () {
  8082. rootUnlinkFn()
  8083. // passing destroying: true to avoid searching and
  8084. // splicing the directives
  8085. contentUnlinkFn(true)
  8086. }
  8087. // finally replace original
  8088. if (options.replace) {
  8089. _.replace(original, el)
  8090. }
  8091. this._isCompiled = true
  8092. this._callHook('compiled')
  8093. return el
  8094. }
  8095. /**
  8096. * Initialize instance element. Called in the public
  8097. * $mount() method.
  8098. *
  8099. * @param {Element} el
  8100. */
  8101. exports._initElement = function (el) {
  8102. if (el instanceof DocumentFragment) {
  8103. this._isFragment = true
  8104. this.$el = this._fragmentStart = el.firstChild
  8105. this._fragmentEnd = el.lastChild
  8106. // set persisted text anchors to empty
  8107. if (this._fragmentStart.nodeType === 3) {
  8108. this._fragmentStart.data = this._fragmentEnd.data = ''
  8109. }
  8110. this._fragment = el
  8111. } else {
  8112. this.$el = el
  8113. }
  8114. this.$el.__vue__ = this
  8115. this._callHook('beforeCompile')
  8116. }
  8117. /**
  8118. * Create and bind a directive to an element.
  8119. *
  8120. * @param {String} name - directive name
  8121. * @param {Node} node - target node
  8122. * @param {Object} desc - parsed directive descriptor
  8123. * @param {Object} def - directive definition object
  8124. * @param {Vue} [host] - transclusion host component
  8125. * @param {Object} [scope] - v-for scope
  8126. * @param {Fragment} [frag] - owner fragment
  8127. */
  8128. exports._bindDir = function (descriptor, node, host, scope, frag) {
  8129. this._directives.push(
  8130. new Directive(descriptor, this, node, host, scope, frag)
  8131. )
  8132. }
  8133. /**
  8134. * Teardown an instance, unobserves the data, unbind all the
  8135. * directives, turn off all the event listeners, etc.
  8136. *
  8137. * @param {Boolean} remove - whether to remove the DOM node.
  8138. * @param {Boolean} deferCleanup - if true, defer cleanup to
  8139. * be called later
  8140. */
  8141. exports._destroy = function (remove, deferCleanup) {
  8142. if (this._isBeingDestroyed) {
  8143. return
  8144. }
  8145. this._callHook('beforeDestroy')
  8146. this._isBeingDestroyed = true
  8147. var i
  8148. // remove self from parent. only necessary
  8149. // if parent is not being destroyed as well.
  8150. var parent = this.$parent
  8151. if (parent && !parent._isBeingDestroyed) {
  8152. parent.$children.$remove(this)
  8153. // unregister ref
  8154. var ref = this.$options._ref
  8155. if (ref) {
  8156. var scope = this._scope || this._context
  8157. if (scope.$refs[ref] === this) {
  8158. scope.$refs[ref] = null
  8159. }
  8160. }
  8161. }
  8162. // remove self from owner fragment
  8163. if (this._frag) {
  8164. this._frag.children.$remove(this)
  8165. }
  8166. // destroy all children.
  8167. i = this.$children.length
  8168. while (i--) {
  8169. this.$children[i].$destroy()
  8170. }
  8171. // teardown props
  8172. if (this._propsUnlinkFn) {
  8173. this._propsUnlinkFn()
  8174. }
  8175. // teardown all directives. this also tearsdown all
  8176. // directive-owned watchers.
  8177. if (this._unlinkFn) {
  8178. this._unlinkFn()
  8179. }
  8180. i = this._watchers.length
  8181. while (i--) {
  8182. this._watchers[i].teardown()
  8183. }
  8184. // remove reference to self on $el
  8185. if (this.$el) {
  8186. this.$el.__vue__ = null
  8187. }
  8188. // remove DOM element
  8189. var self = this
  8190. if (remove && this.$el) {
  8191. this.$remove(function () {
  8192. self._cleanup()
  8193. })
  8194. } else if (!deferCleanup) {
  8195. this._cleanup()
  8196. }
  8197. }
  8198. /**
  8199. * Clean up to ensure garbage collection.
  8200. * This is called after the leave transition if there
  8201. * is any.
  8202. */
  8203. exports._cleanup = function () {
  8204. // remove reference from data ob
  8205. // frozen object may not have observer.
  8206. if (this._data.__ob__) {
  8207. this._data.__ob__.removeVm(this)
  8208. }
  8209. // Clean up references to private properties and other
  8210. // instances. preserve reference to _data so that proxy
  8211. // accessors still work. The only potential side effect
  8212. // here is that mutating the instance after it's destroyed
  8213. // may affect the state of other components that are still
  8214. // observing the same object, but that seems to be a
  8215. // reasonable responsibility for the user rather than
  8216. // always throwing an error on them.
  8217. this.$el =
  8218. this.$parent =
  8219. this.$root =
  8220. this.$children =
  8221. this._watchers =
  8222. this._context =
  8223. this._scope =
  8224. this._directives = null
  8225. // call the last hook...
  8226. this._isDestroyed = true
  8227. this._callHook('destroyed')
  8228. // turn off all instance listeners.
  8229. this.$off()
  8230. }
  8231. /***/ },
  8232. /* 61 */
  8233. /***/ function(module, exports, __webpack_require__) {
  8234. var _ = __webpack_require__(1)
  8235. var Watcher = __webpack_require__(40)
  8236. var expParser = __webpack_require__(42)
  8237. function noop () {}
  8238. /**
  8239. * A directive links a DOM element with a piece of data,
  8240. * which is the result of evaluating an expression.
  8241. * It registers a watcher with the expression and calls
  8242. * the DOM update function when a change is triggered.
  8243. *
  8244. * @param {String} name
  8245. * @param {Node} el
  8246. * @param {Vue} vm
  8247. * @param {Object} descriptor
  8248. * - {String} name
  8249. * - {Object} def
  8250. * - {String} expression
  8251. * - {Array<Object>} [filters]
  8252. * - {Boolean} literal
  8253. * - {String} attr
  8254. * - {String} raw
  8255. * @param {Object} def - directive definition object
  8256. * @param {Vue} [host] - transclusion host component
  8257. * @param {Object} [scope] - v-for scope
  8258. * @param {Fragment} [frag] - owner fragment
  8259. * @constructor
  8260. */
  8261. function Directive (descriptor, vm, el, host, scope, frag) {
  8262. this.vm = vm
  8263. this.el = el
  8264. // copy descriptor properties
  8265. this.descriptor = descriptor
  8266. this.name = descriptor.name
  8267. this.expression = descriptor.expression
  8268. this.arg = descriptor.arg
  8269. this.modifiers = descriptor.modifiers
  8270. this.filters = descriptor.filters
  8271. this.literal = this.modifiers && this.modifiers.literal
  8272. // private
  8273. this._locked = false
  8274. this._bound = false
  8275. this._listeners = null
  8276. // link context
  8277. this._host = host
  8278. this._scope = scope
  8279. this._frag = frag
  8280. // store directives on node in dev mode
  8281. if (("development") !== 'production' && this.el) {
  8282. this.el._vue_directives = this.el._vue_directives || []
  8283. this.el._vue_directives.push(this)
  8284. }
  8285. }
  8286. /**
  8287. * Initialize the directive, mixin definition properties,
  8288. * setup the watcher, call definition bind() and update()
  8289. * if present.
  8290. *
  8291. * @param {Object} def
  8292. */
  8293. Directive.prototype._bind = function () {
  8294. var name = this.name
  8295. var descriptor = this.descriptor
  8296. // remove attribute
  8297. if (
  8298. (name !== 'cloak' || this.vm._isCompiled) &&
  8299. this.el && this.el.removeAttribute
  8300. ) {
  8301. var attr = descriptor.attr || ('v-' + name)
  8302. this.el.removeAttribute(attr)
  8303. }
  8304. // copy def properties
  8305. var def = descriptor.def
  8306. if (typeof def === 'function') {
  8307. this.update = def
  8308. } else {
  8309. _.extend(this, def)
  8310. }
  8311. // setup directive params
  8312. this._setupParams()
  8313. // initial bind
  8314. if (this.bind) {
  8315. this.bind()
  8316. }
  8317. if (this.literal) {
  8318. this.update && this.update(descriptor.raw)
  8319. } else if (
  8320. (this.expression || this.modifiers) &&
  8321. (this.update || this.twoWay) &&
  8322. !this._checkStatement()
  8323. ) {
  8324. // wrapped updater for context
  8325. var dir = this
  8326. if (this.update) {
  8327. this._update = function (val, oldVal) {
  8328. if (!dir._locked) {
  8329. dir.update(val, oldVal)
  8330. }
  8331. }
  8332. } else {
  8333. this._update = noop
  8334. }
  8335. var preProcess = this._preProcess
  8336. ? _.bind(this._preProcess, this)
  8337. : null
  8338. var postProcess = this._postProcess
  8339. ? _.bind(this._postProcess, this)
  8340. : null
  8341. var watcher = this._watcher = new Watcher(
  8342. this.vm,
  8343. this.expression,
  8344. this._update, // callback
  8345. {
  8346. filters: this.filters,
  8347. twoWay: this.twoWay,
  8348. deep: this.deep,
  8349. preProcess: preProcess,
  8350. postProcess: postProcess,
  8351. scope: this._scope
  8352. }
  8353. )
  8354. // v-model with inital inline value need to sync back to
  8355. // model instead of update to DOM on init. They would
  8356. // set the afterBind hook to indicate that.
  8357. if (this.afterBind) {
  8358. this.afterBind()
  8359. } else if (this.update) {
  8360. this.update(watcher.value)
  8361. }
  8362. }
  8363. this._bound = true
  8364. }
  8365. /**
  8366. * Setup all param attributes, e.g. track-by,
  8367. * transition-mode, etc...
  8368. */
  8369. Directive.prototype._setupParams = function () {
  8370. if (!this.params) {
  8371. return
  8372. }
  8373. var params = this.params
  8374. // swap the params array with a fresh object.
  8375. this.params = Object.create(null)
  8376. var i = params.length
  8377. var key, val, mappedKey
  8378. while (i--) {
  8379. key = params[i]
  8380. mappedKey = _.camelize(key)
  8381. val = _.getBindAttr(this.el, key)
  8382. if (val != null) {
  8383. // dynamic
  8384. this._setupParamWatcher(mappedKey, val)
  8385. } else {
  8386. // static
  8387. val = _.attr(this.el, key)
  8388. if (val != null) {
  8389. this.params[mappedKey] = val === '' ? true : val
  8390. }
  8391. }
  8392. }
  8393. }
  8394. /**
  8395. * Setup a watcher for a dynamic param.
  8396. *
  8397. * @param {String} key
  8398. * @param {String} expression
  8399. */
  8400. Directive.prototype._setupParamWatcher = function (key, expression) {
  8401. var self = this
  8402. var called = false
  8403. var unwatch = (this._scope || this.vm).$watch(expression, function (val, oldVal) {
  8404. self.params[key] = val
  8405. // since we are in immediate mode,
  8406. // only call the param change callbacks if this is not the first update.
  8407. if (called) {
  8408. var cb = self.paramWatchers && self.paramWatchers[key]
  8409. if (cb) {
  8410. cb.call(self, val, oldVal)
  8411. }
  8412. } else {
  8413. called = true
  8414. }
  8415. }, {
  8416. immediate: true
  8417. })
  8418. ;(this._paramUnwatchFns || (this._paramUnwatchFns = [])).push(unwatch)
  8419. }
  8420. /**
  8421. * Check if the directive is a function caller
  8422. * and if the expression is a callable one. If both true,
  8423. * we wrap up the expression and use it as the event
  8424. * handler.
  8425. *
  8426. * e.g. on-click="a++"
  8427. *
  8428. * @return {Boolean}
  8429. */
  8430. Directive.prototype._checkStatement = function () {
  8431. var expression = this.expression
  8432. if (
  8433. expression && this.acceptStatement &&
  8434. !expParser.isSimplePath(expression)
  8435. ) {
  8436. var fn = expParser.parse(expression).get
  8437. var scope = this._scope || this.vm
  8438. var handler = function () {
  8439. fn.call(scope, scope)
  8440. }
  8441. if (this.filters) {
  8442. handler = scope._applyFilters(handler, null, this.filters)
  8443. }
  8444. this.update(handler)
  8445. return true
  8446. }
  8447. }
  8448. /**
  8449. * Set the corresponding value with the setter.
  8450. * This should only be used in two-way directives
  8451. * e.g. v-model.
  8452. *
  8453. * @param {*} value
  8454. * @public
  8455. */
  8456. Directive.prototype.set = function (value) {
  8457. /* istanbul ignore else */
  8458. if (this.twoWay) {
  8459. this._withLock(function () {
  8460. this._watcher.set(value)
  8461. })
  8462. } else if (true) {
  8463. _.warn(
  8464. 'Directive.set() can only be used inside twoWay' +
  8465. 'directives.'
  8466. )
  8467. }
  8468. }
  8469. /**
  8470. * Execute a function while preventing that function from
  8471. * triggering updates on this directive instance.
  8472. *
  8473. * @param {Function} fn
  8474. */
  8475. Directive.prototype._withLock = function (fn) {
  8476. var self = this
  8477. self._locked = true
  8478. fn.call(self)
  8479. _.nextTick(function () {
  8480. self._locked = false
  8481. })
  8482. }
  8483. /**
  8484. * Convenience method that attaches a DOM event listener
  8485. * to the directive element and autometically tears it down
  8486. * during unbind.
  8487. *
  8488. * @param {String} event
  8489. * @param {Function} handler
  8490. */
  8491. Directive.prototype.on = function (event, handler) {
  8492. _.on(this.el, event, handler)
  8493. ;(this._listeners || (this._listeners = []))
  8494. .push([event, handler])
  8495. }
  8496. /**
  8497. * Teardown the watcher and call unbind.
  8498. */
  8499. Directive.prototype._teardown = function () {
  8500. if (this._bound) {
  8501. this._bound = false
  8502. if (this.unbind) {
  8503. this.unbind()
  8504. }
  8505. if (this._watcher) {
  8506. this._watcher.teardown()
  8507. }
  8508. var listeners = this._listeners
  8509. var i
  8510. if (listeners) {
  8511. i = listeners.length
  8512. while (i--) {
  8513. _.off(this.el, listeners[i][0], listeners[i][1])
  8514. }
  8515. }
  8516. var unwatchFns = this._paramUnwatchFns
  8517. if (unwatchFns) {
  8518. i = unwatchFns.length
  8519. while (i--) {
  8520. unwatchFns[i]()
  8521. }
  8522. }
  8523. if (("development") !== 'production' && this.el) {
  8524. this.el._vue_directives.$remove(this)
  8525. }
  8526. this.vm = this.el = this._watcher = this._listeners = null
  8527. }
  8528. }
  8529. module.exports = Directive
  8530. /***/ },
  8531. /* 62 */
  8532. /***/ function(module, exports, __webpack_require__) {
  8533. var _ = __webpack_require__(1)
  8534. /**
  8535. * Apply a list of filter (descriptors) to a value.
  8536. * Using plain for loops here because this will be called in
  8537. * the getter of any watcher with filters so it is very
  8538. * performance sensitive.
  8539. *
  8540. * @param {*} value
  8541. * @param {*} [oldValue]
  8542. * @param {Array} filters
  8543. * @param {Boolean} write
  8544. * @return {*}
  8545. */
  8546. exports._applyFilters = function (value, oldValue, filters, write) {
  8547. var filter, fn, args, arg, offset, i, l, j, k
  8548. for (i = 0, l = filters.length; i < l; i++) {
  8549. filter = filters[i]
  8550. fn = _.resolveAsset(this.$options, 'filters', filter.name)
  8551. if (true) {
  8552. _.assertAsset(fn, 'filter', filter.name)
  8553. }
  8554. if (!fn) continue
  8555. fn = write ? fn.write : (fn.read || fn)
  8556. if (typeof fn !== 'function') continue
  8557. args = write ? [value, oldValue] : [value]
  8558. offset = write ? 2 : 1
  8559. if (filter.args) {
  8560. for (j = 0, k = filter.args.length; j < k; j++) {
  8561. arg = filter.args[j]
  8562. args[j + offset] = arg.dynamic
  8563. ? this.$get(arg.value)
  8564. : arg.value
  8565. }
  8566. }
  8567. value = fn.apply(this, args)
  8568. }
  8569. return value
  8570. }
  8571. /**
  8572. * Resolve a component, depending on whether the component
  8573. * is defined normally or using an async factory function.
  8574. * Resolves synchronously if already resolved, otherwise
  8575. * resolves asynchronously and caches the resolved
  8576. * constructor on the factory.
  8577. *
  8578. * @param {String} id
  8579. * @param {Function} cb
  8580. */
  8581. exports._resolveComponent = function (id, cb) {
  8582. var factory = _.resolveAsset(this.$options, 'components', id)
  8583. if (true) {
  8584. _.assertAsset(factory, 'component', id)
  8585. }
  8586. if (!factory) {
  8587. return
  8588. }
  8589. // async component factory
  8590. if (!factory.options) {
  8591. if (factory.resolved) {
  8592. // cached
  8593. cb(factory.resolved)
  8594. } else if (factory.requested) {
  8595. // pool callbacks
  8596. factory.pendingCallbacks.push(cb)
  8597. } else {
  8598. factory.requested = true
  8599. var cbs = factory.pendingCallbacks = [cb]
  8600. factory(function resolve (res) {
  8601. if (_.isPlainObject(res)) {
  8602. res = _.Vue.extend(res)
  8603. }
  8604. // cache resolved
  8605. factory.resolved = res
  8606. // invoke callbacks
  8607. for (var i = 0, l = cbs.length; i < l; i++) {
  8608. cbs[i](res)
  8609. }
  8610. }, function reject (reason) {
  8611. ("development") !== 'production' && _.warn(
  8612. 'Failed to resolve async component: ' + id + '. ' +
  8613. (reason ? '\nReason: ' + reason : '')
  8614. )
  8615. })
  8616. }
  8617. } else {
  8618. // normal component
  8619. cb(factory)
  8620. }
  8621. }
  8622. /***/ },
  8623. /* 63 */
  8624. /***/ function(module, exports, __webpack_require__) {
  8625. var _ = __webpack_require__(1)
  8626. var Watcher = __webpack_require__(40)
  8627. var Path = __webpack_require__(43)
  8628. var textParser = __webpack_require__(6)
  8629. var dirParser = __webpack_require__(8)
  8630. var expParser = __webpack_require__(42)
  8631. var filterRE = /[^|]\|[^|]/
  8632. /**
  8633. * Get the value from an expression on this vm.
  8634. *
  8635. * @param {String} exp
  8636. * @param {Boolean} [asStatement]
  8637. * @return {*}
  8638. */
  8639. exports.$get = function (exp, asStatement) {
  8640. var res = expParser.parse(exp)
  8641. if (res) {
  8642. if (asStatement && !expParser.isSimplePath(exp)) {
  8643. var self = this
  8644. return function statementHandler () {
  8645. res.get.call(self, self)
  8646. }
  8647. } else {
  8648. try {
  8649. return res.get.call(this, this)
  8650. } catch (e) {}
  8651. }
  8652. }
  8653. }
  8654. /**
  8655. * Set the value from an expression on this vm.
  8656. * The expression must be a valid left-hand
  8657. * expression in an assignment.
  8658. *
  8659. * @param {String} exp
  8660. * @param {*} val
  8661. */
  8662. exports.$set = function (exp, val) {
  8663. var res = expParser.parse(exp, true)
  8664. if (res && res.set) {
  8665. res.set.call(this, this, val)
  8666. }
  8667. }
  8668. /**
  8669. * Delete a property on the VM
  8670. *
  8671. * @param {String} key
  8672. */
  8673. exports.$delete = function (key) {
  8674. _.delete(this._data, key)
  8675. }
  8676. /**
  8677. * Watch an expression, trigger callback when its
  8678. * value changes.
  8679. *
  8680. * @param {String|Function} expOrFn
  8681. * @param {Function} cb
  8682. * @param {Object} [options]
  8683. * - {Boolean} deep
  8684. * - {Boolean} immediate
  8685. * @return {Function} - unwatchFn
  8686. */
  8687. exports.$watch = function (expOrFn, cb, options) {
  8688. var vm = this
  8689. var parsed
  8690. if (typeof expOrFn === 'string') {
  8691. parsed = dirParser.parse(expOrFn)
  8692. expOrFn = parsed.expression
  8693. }
  8694. var watcher = new Watcher(vm, expOrFn, cb, {
  8695. deep: options && options.deep,
  8696. filters: parsed && parsed.filters
  8697. })
  8698. if (options && options.immediate) {
  8699. cb.call(vm, watcher.value)
  8700. }
  8701. return function unwatchFn () {
  8702. watcher.teardown()
  8703. }
  8704. }
  8705. /**
  8706. * Evaluate a text directive, including filters.
  8707. *
  8708. * @param {String} text
  8709. * @param {Boolean} [asStatement]
  8710. * @return {String}
  8711. */
  8712. exports.$eval = function (text, asStatement) {
  8713. // check for filters.
  8714. if (filterRE.test(text)) {
  8715. var dir = dirParser.parse(text)
  8716. // the filter regex check might give false positive
  8717. // for pipes inside strings, so it's possible that
  8718. // we don't get any filters here
  8719. var val = this.$get(dir.expression, asStatement)
  8720. return dir.filters
  8721. ? this._applyFilters(val, null, dir.filters)
  8722. : val
  8723. } else {
  8724. // no filter
  8725. return this.$get(text, asStatement)
  8726. }
  8727. }
  8728. /**
  8729. * Interpolate a piece of template text.
  8730. *
  8731. * @param {String} text
  8732. * @return {String}
  8733. */
  8734. exports.$interpolate = function (text) {
  8735. var tokens = textParser.parse(text)
  8736. var vm = this
  8737. if (tokens) {
  8738. if (tokens.length === 1) {
  8739. return vm.$eval(tokens[0].value) + ''
  8740. } else {
  8741. return tokens.map(function (token) {
  8742. return token.tag
  8743. ? vm.$eval(token.value)
  8744. : token.value
  8745. }).join('')
  8746. }
  8747. } else {
  8748. return text
  8749. }
  8750. }
  8751. /**
  8752. * Log instance data as a plain JS object
  8753. * so that it is easier to inspect in console.
  8754. * This method assumes console is available.
  8755. *
  8756. * @param {String} [path]
  8757. */
  8758. exports.$log = function (path) {
  8759. var data = path
  8760. ? Path.get(this._data, path)
  8761. : this._data
  8762. if (data) {
  8763. data = clean(data)
  8764. }
  8765. // include computed fields
  8766. if (!path) {
  8767. for (var key in this.$options.computed) {
  8768. data[key] = clean(this[key])
  8769. }
  8770. }
  8771. console.log(data)
  8772. }
  8773. /**
  8774. * "clean" a getter/setter converted object into a plain
  8775. * object copy.
  8776. *
  8777. * @param {Object} - obj
  8778. * @return {Object}
  8779. */
  8780. function clean (obj) {
  8781. return JSON.parse(JSON.stringify(obj))
  8782. }
  8783. /***/ },
  8784. /* 64 */
  8785. /***/ function(module, exports, __webpack_require__) {
  8786. var _ = __webpack_require__(1)
  8787. var transition = __webpack_require__(9)
  8788. /**
  8789. * Convenience on-instance nextTick. The callback is
  8790. * auto-bound to the instance, and this avoids component
  8791. * modules having to rely on the global Vue.
  8792. *
  8793. * @param {Function} fn
  8794. */
  8795. exports.$nextTick = function (fn) {
  8796. _.nextTick(fn, this)
  8797. }
  8798. /**
  8799. * Append instance to target
  8800. *
  8801. * @param {Node} target
  8802. * @param {Function} [cb]
  8803. * @param {Boolean} [withTransition] - defaults to true
  8804. */
  8805. exports.$appendTo = function (target, cb, withTransition) {
  8806. return insert(
  8807. this, target, cb, withTransition,
  8808. append, transition.append
  8809. )
  8810. }
  8811. /**
  8812. * Prepend instance to target
  8813. *
  8814. * @param {Node} target
  8815. * @param {Function} [cb]
  8816. * @param {Boolean} [withTransition] - defaults to true
  8817. */
  8818. exports.$prependTo = function (target, cb, withTransition) {
  8819. target = query(target)
  8820. if (target.hasChildNodes()) {
  8821. this.$before(target.firstChild, cb, withTransition)
  8822. } else {
  8823. this.$appendTo(target, cb, withTransition)
  8824. }
  8825. return this
  8826. }
  8827. /**
  8828. * Insert instance before target
  8829. *
  8830. * @param {Node} target
  8831. * @param {Function} [cb]
  8832. * @param {Boolean} [withTransition] - defaults to true
  8833. */
  8834. exports.$before = function (target, cb, withTransition) {
  8835. return insert(
  8836. this, target, cb, withTransition,
  8837. before, transition.before
  8838. )
  8839. }
  8840. /**
  8841. * Insert instance after target
  8842. *
  8843. * @param {Node} target
  8844. * @param {Function} [cb]
  8845. * @param {Boolean} [withTransition] - defaults to true
  8846. */
  8847. exports.$after = function (target, cb, withTransition) {
  8848. target = query(target)
  8849. if (target.nextSibling) {
  8850. this.$before(target.nextSibling, cb, withTransition)
  8851. } else {
  8852. this.$appendTo(target.parentNode, cb, withTransition)
  8853. }
  8854. return this
  8855. }
  8856. /**
  8857. * Remove instance from DOM
  8858. *
  8859. * @param {Function} [cb]
  8860. * @param {Boolean} [withTransition] - defaults to true
  8861. */
  8862. exports.$remove = function (cb, withTransition) {
  8863. if (!this.$el.parentNode) {
  8864. return cb && cb()
  8865. }
  8866. var inDoc = this._isAttached && _.inDoc(this.$el)
  8867. // if we are not in document, no need to check
  8868. // for transitions
  8869. if (!inDoc) withTransition = false
  8870. var self = this
  8871. var realCb = function () {
  8872. if (inDoc) self._callHook('detached')
  8873. if (cb) cb()
  8874. }
  8875. if (this._isFragment) {
  8876. _.removeNodeRange(
  8877. this._fragmentStart,
  8878. this._fragmentEnd,
  8879. this, this._fragment, realCb
  8880. )
  8881. } else {
  8882. var op = withTransition === false
  8883. ? remove
  8884. : transition.remove
  8885. op(this.$el, this, realCb)
  8886. }
  8887. return this
  8888. }
  8889. /**
  8890. * Shared DOM insertion function.
  8891. *
  8892. * @param {Vue} vm
  8893. * @param {Element} target
  8894. * @param {Function} [cb]
  8895. * @param {Boolean} [withTransition]
  8896. * @param {Function} op1 - op for non-transition insert
  8897. * @param {Function} op2 - op for transition insert
  8898. * @return vm
  8899. */
  8900. function insert (vm, target, cb, withTransition, op1, op2) {
  8901. target = query(target)
  8902. var targetIsDetached = !_.inDoc(target)
  8903. var op = withTransition === false || targetIsDetached
  8904. ? op1
  8905. : op2
  8906. var shouldCallHook =
  8907. !targetIsDetached &&
  8908. !vm._isAttached &&
  8909. !_.inDoc(vm.$el)
  8910. if (vm._isFragment) {
  8911. _.mapNodeRange(vm._fragmentStart, vm._fragmentEnd, function (node) {
  8912. op(node, target, vm)
  8913. })
  8914. cb && cb()
  8915. } else {
  8916. op(vm.$el, target, vm, cb)
  8917. }
  8918. if (shouldCallHook) {
  8919. vm._callHook('attached')
  8920. }
  8921. return vm
  8922. }
  8923. /**
  8924. * Check for selectors
  8925. *
  8926. * @param {String|Element} el
  8927. */
  8928. function query (el) {
  8929. return typeof el === 'string'
  8930. ? document.querySelector(el)
  8931. : el
  8932. }
  8933. /**
  8934. * Append operation that takes a callback.
  8935. *
  8936. * @param {Node} el
  8937. * @param {Node} target
  8938. * @param {Vue} vm - unused
  8939. * @param {Function} [cb]
  8940. */
  8941. function append (el, target, vm, cb) {
  8942. target.appendChild(el)
  8943. if (cb) cb()
  8944. }
  8945. /**
  8946. * InsertBefore operation that takes a callback.
  8947. *
  8948. * @param {Node} el
  8949. * @param {Node} target
  8950. * @param {Vue} vm - unused
  8951. * @param {Function} [cb]
  8952. */
  8953. function before (el, target, vm, cb) {
  8954. _.before(el, target)
  8955. if (cb) cb()
  8956. }
  8957. /**
  8958. * Remove operation that takes a callback.
  8959. *
  8960. * @param {Node} el
  8961. * @param {Vue} vm - unused
  8962. * @param {Function} [cb]
  8963. */
  8964. function remove (el, vm, cb) {
  8965. _.remove(el)
  8966. if (cb) cb()
  8967. }
  8968. /***/ },
  8969. /* 65 */
  8970. /***/ function(module, exports, __webpack_require__) {
  8971. var _ = __webpack_require__(1)
  8972. /**
  8973. * Listen on the given `event` with `fn`.
  8974. *
  8975. * @param {String} event
  8976. * @param {Function} fn
  8977. */
  8978. exports.$on = function (event, fn) {
  8979. (this._events[event] || (this._events[event] = []))
  8980. .push(fn)
  8981. modifyListenerCount(this, event, 1)
  8982. return this
  8983. }
  8984. /**
  8985. * Adds an `event` listener that will be invoked a single
  8986. * time then automatically removed.
  8987. *
  8988. * @param {String} event
  8989. * @param {Function} fn
  8990. */
  8991. exports.$once = function (event, fn) {
  8992. var self = this
  8993. function on () {
  8994. self.$off(event, on)
  8995. fn.apply(this, arguments)
  8996. }
  8997. on.fn = fn
  8998. this.$on(event, on)
  8999. return this
  9000. }
  9001. /**
  9002. * Remove the given callback for `event` or all
  9003. * registered callbacks.
  9004. *
  9005. * @param {String} event
  9006. * @param {Function} fn
  9007. */
  9008. exports.$off = function (event, fn) {
  9009. var cbs
  9010. // all
  9011. if (!arguments.length) {
  9012. if (this.$parent) {
  9013. for (event in this._events) {
  9014. cbs = this._events[event]
  9015. if (cbs) {
  9016. modifyListenerCount(this, event, -cbs.length)
  9017. }
  9018. }
  9019. }
  9020. this._events = {}
  9021. return this
  9022. }
  9023. // specific event
  9024. cbs = this._events[event]
  9025. if (!cbs) {
  9026. return this
  9027. }
  9028. if (arguments.length === 1) {
  9029. modifyListenerCount(this, event, -cbs.length)
  9030. this._events[event] = null
  9031. return this
  9032. }
  9033. // specific handler
  9034. var cb
  9035. var i = cbs.length
  9036. while (i--) {
  9037. cb = cbs[i]
  9038. if (cb === fn || cb.fn === fn) {
  9039. modifyListenerCount(this, event, -1)
  9040. cbs.splice(i, 1)
  9041. break
  9042. }
  9043. }
  9044. return this
  9045. }
  9046. /**
  9047. * Trigger an event on self.
  9048. *
  9049. * @param {String} event
  9050. */
  9051. exports.$emit = function (event) {
  9052. var cbs = this._events[event]
  9053. this._shouldPropagate = !cbs
  9054. if (cbs) {
  9055. cbs = cbs.length > 1
  9056. ? _.toArray(cbs)
  9057. : cbs
  9058. var args = _.toArray(arguments, 1)
  9059. for (var i = 0, l = cbs.length; i < l; i++) {
  9060. var res = cbs[i].apply(this, args)
  9061. if (res === true) {
  9062. this._shouldPropagate = true
  9063. }
  9064. }
  9065. }
  9066. return this
  9067. }
  9068. /**
  9069. * Recursively broadcast an event to all children instances.
  9070. *
  9071. * @param {String} event
  9072. * @param {...*} additional arguments
  9073. */
  9074. exports.$broadcast = function (event) {
  9075. // if no child has registered for this event,
  9076. // then there's no need to broadcast.
  9077. if (!this._eventsCount[event]) return
  9078. var children = this.$children
  9079. for (var i = 0, l = children.length; i < l; i++) {
  9080. var child = children[i]
  9081. child.$emit.apply(child, arguments)
  9082. if (child._shouldPropagate) {
  9083. child.$broadcast.apply(child, arguments)
  9084. }
  9085. }
  9086. return this
  9087. }
  9088. /**
  9089. * Recursively propagate an event up the parent chain.
  9090. *
  9091. * @param {String} event
  9092. * @param {...*} additional arguments
  9093. */
  9094. exports.$dispatch = function () {
  9095. this.$emit.apply(this, arguments)
  9096. var parent = this.$parent
  9097. while (parent) {
  9098. parent.$emit.apply(parent, arguments)
  9099. parent = parent._shouldPropagate
  9100. ? parent.$parent
  9101. : null
  9102. }
  9103. return this
  9104. }
  9105. /**
  9106. * Modify the listener counts on all parents.
  9107. * This bookkeeping allows $broadcast to return early when
  9108. * no child has listened to a certain event.
  9109. *
  9110. * @param {Vue} vm
  9111. * @param {String} event
  9112. * @param {Number} count
  9113. */
  9114. var hookRE = /^hook:/
  9115. function modifyListenerCount (vm, event, count) {
  9116. var parent = vm.$parent
  9117. // hooks do not get broadcasted so no need
  9118. // to do bookkeeping for them
  9119. if (!parent || !count || hookRE.test(event)) return
  9120. while (parent) {
  9121. parent._eventsCount[event] =
  9122. (parent._eventsCount[event] || 0) + count
  9123. parent = parent.$parent
  9124. }
  9125. }
  9126. /***/ },
  9127. /* 66 */
  9128. /***/ function(module, exports, __webpack_require__) {
  9129. var _ = __webpack_require__(1)
  9130. var compiler = __webpack_require__(14)
  9131. /**
  9132. * Set instance target element and kick off the compilation
  9133. * process. The passed in `el` can be a selector string, an
  9134. * existing Element, or a DocumentFragment (for block
  9135. * instances).
  9136. *
  9137. * @param {Element|DocumentFragment|string} el
  9138. * @public
  9139. */
  9140. exports.$mount = function (el) {
  9141. if (this._isCompiled) {
  9142. ("development") !== 'production' && _.warn(
  9143. '$mount() should be called only once.'
  9144. )
  9145. return
  9146. }
  9147. el = _.query(el)
  9148. if (!el) {
  9149. el = document.createElement('div')
  9150. }
  9151. this._compile(el)
  9152. this._initDOMHooks()
  9153. if (_.inDoc(this.$el)) {
  9154. this._callHook('attached')
  9155. ready.call(this)
  9156. } else {
  9157. this.$once('hook:attached', ready)
  9158. }
  9159. return this
  9160. }
  9161. /**
  9162. * Mark an instance as ready.
  9163. */
  9164. function ready () {
  9165. this._isAttached = true
  9166. this._isReady = true
  9167. this._callHook('ready')
  9168. }
  9169. /**
  9170. * Teardown the instance, simply delegate to the internal
  9171. * _destroy.
  9172. */
  9173. exports.$destroy = function (remove, deferCleanup) {
  9174. this._destroy(remove, deferCleanup)
  9175. }
  9176. /**
  9177. * Partially compile a piece of DOM and return a
  9178. * decompile function.
  9179. *
  9180. * @param {Element|DocumentFragment} el
  9181. * @param {Vue} [host]
  9182. * @return {Function}
  9183. */
  9184. exports.$compile = function (el, host, scope, frag) {
  9185. return compiler.compile(el, this.$options, true)(
  9186. this, el, host, scope, frag
  9187. )
  9188. }
  9189. /***/ }
  9190. /******/ ])
  9191. });
  9192. ;