vue.esm.js 408 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895
  1. /*!
  2. * Vue.js v2.7.14
  3. * (c) 2014-2022 Evan You
  4. * Released under the MIT License.
  5. */
  6. var emptyObject = Object.freeze({});
  7. var isArray = Array.isArray;
  8. // These helpers produce better VM code in JS engines due to their
  9. // explicitness and function inlining.
  10. function isUndef(v) {
  11. return v === undefined || v === null;
  12. }
  13. function isDef(v) {
  14. return v !== undefined && v !== null;
  15. }
  16. function isTrue(v) {
  17. return v === true;
  18. }
  19. function isFalse(v) {
  20. return v === false;
  21. }
  22. /**
  23. * Check if value is primitive.
  24. */
  25. function isPrimitive(value) {
  26. return (typeof value === 'string' ||
  27. typeof value === 'number' ||
  28. // $flow-disable-line
  29. typeof value === 'symbol' ||
  30. typeof value === 'boolean');
  31. }
  32. function isFunction(value) {
  33. return typeof value === 'function';
  34. }
  35. /**
  36. * Quick object check - this is primarily used to tell
  37. * objects from primitive values when we know the value
  38. * is a JSON-compliant type.
  39. */
  40. function isObject(obj) {
  41. return obj !== null && typeof obj === 'object';
  42. }
  43. /**
  44. * Get the raw type string of a value, e.g., [object Object].
  45. */
  46. var _toString = Object.prototype.toString;
  47. function toRawType(value) {
  48. return _toString.call(value).slice(8, -1);
  49. }
  50. /**
  51. * Strict object type check. Only returns true
  52. * for plain JavaScript objects.
  53. */
  54. function isPlainObject(obj) {
  55. return _toString.call(obj) === '[object Object]';
  56. }
  57. function isRegExp(v) {
  58. return _toString.call(v) === '[object RegExp]';
  59. }
  60. /**
  61. * Check if val is a valid array index.
  62. */
  63. function isValidArrayIndex(val) {
  64. var n = parseFloat(String(val));
  65. return n >= 0 && Math.floor(n) === n && isFinite(val);
  66. }
  67. function isPromise(val) {
  68. return (isDef(val) &&
  69. typeof val.then === 'function' &&
  70. typeof val.catch === 'function');
  71. }
  72. /**
  73. * Convert a value to a string that is actually rendered.
  74. */
  75. function toString(val) {
  76. return val == null
  77. ? ''
  78. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  79. ? JSON.stringify(val, null, 2)
  80. : String(val);
  81. }
  82. /**
  83. * Convert an input value to a number for persistence.
  84. * If the conversion fails, return original string.
  85. */
  86. function toNumber(val) {
  87. var n = parseFloat(val);
  88. return isNaN(n) ? val : n;
  89. }
  90. /**
  91. * Make a map and return a function for checking if a key
  92. * is in that map.
  93. */
  94. function makeMap(str, expectsLowerCase) {
  95. var map = Object.create(null);
  96. var list = str.split(',');
  97. for (var i = 0; i < list.length; i++) {
  98. map[list[i]] = true;
  99. }
  100. return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; };
  101. }
  102. /**
  103. * Check if a tag is a built-in tag.
  104. */
  105. var isBuiltInTag = makeMap('slot,component', true);
  106. /**
  107. * Check if an attribute is a reserved attribute.
  108. */
  109. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  110. /**
  111. * Remove an item from an array.
  112. */
  113. function remove$2(arr, item) {
  114. var len = arr.length;
  115. if (len) {
  116. // fast path for the only / last item
  117. if (item === arr[len - 1]) {
  118. arr.length = len - 1;
  119. return;
  120. }
  121. var index = arr.indexOf(item);
  122. if (index > -1) {
  123. return arr.splice(index, 1);
  124. }
  125. }
  126. }
  127. /**
  128. * Check whether an object has the property.
  129. */
  130. var hasOwnProperty = Object.prototype.hasOwnProperty;
  131. function hasOwn(obj, key) {
  132. return hasOwnProperty.call(obj, key);
  133. }
  134. /**
  135. * Create a cached version of a pure function.
  136. */
  137. function cached(fn) {
  138. var cache = Object.create(null);
  139. return function cachedFn(str) {
  140. var hit = cache[str];
  141. return hit || (cache[str] = fn(str));
  142. };
  143. }
  144. /**
  145. * Camelize a hyphen-delimited string.
  146. */
  147. var camelizeRE = /-(\w)/g;
  148. var camelize = cached(function (str) {
  149. return str.replace(camelizeRE, function (_, c) { return (c ? c.toUpperCase() : ''); });
  150. });
  151. /**
  152. * Capitalize a string.
  153. */
  154. var capitalize = cached(function (str) {
  155. return str.charAt(0).toUpperCase() + str.slice(1);
  156. });
  157. /**
  158. * Hyphenate a camelCase string.
  159. */
  160. var hyphenateRE = /\B([A-Z])/g;
  161. var hyphenate = cached(function (str) {
  162. return str.replace(hyphenateRE, '-$1').toLowerCase();
  163. });
  164. /**
  165. * Simple bind polyfill for environments that do not support it,
  166. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  167. * since native bind is now performant enough in most browsers.
  168. * But removing it would mean breaking code that was able to run in
  169. * PhantomJS 1.x, so this must be kept for backward compatibility.
  170. */
  171. /* istanbul ignore next */
  172. function polyfillBind(fn, ctx) {
  173. function boundFn(a) {
  174. var l = arguments.length;
  175. return l
  176. ? l > 1
  177. ? fn.apply(ctx, arguments)
  178. : fn.call(ctx, a)
  179. : fn.call(ctx);
  180. }
  181. boundFn._length = fn.length;
  182. return boundFn;
  183. }
  184. function nativeBind(fn, ctx) {
  185. return fn.bind(ctx);
  186. }
  187. // @ts-expect-error bind cannot be `undefined`
  188. var bind$1 = Function.prototype.bind ? nativeBind : polyfillBind;
  189. /**
  190. * Convert an Array-like object to a real Array.
  191. */
  192. function toArray(list, start) {
  193. start = start || 0;
  194. var i = list.length - start;
  195. var ret = new Array(i);
  196. while (i--) {
  197. ret[i] = list[i + start];
  198. }
  199. return ret;
  200. }
  201. /**
  202. * Mix properties into target object.
  203. */
  204. function extend(to, _from) {
  205. for (var key in _from) {
  206. to[key] = _from[key];
  207. }
  208. return to;
  209. }
  210. /**
  211. * Merge an Array of Objects into a single Object.
  212. */
  213. function toObject(arr) {
  214. var res = {};
  215. for (var i = 0; i < arr.length; i++) {
  216. if (arr[i]) {
  217. extend(res, arr[i]);
  218. }
  219. }
  220. return res;
  221. }
  222. /* eslint-disable no-unused-vars */
  223. /**
  224. * Perform no operation.
  225. * Stubbing args to make Flow happy without leaving useless transpiled code
  226. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  227. */
  228. function noop(a, b, c) { }
  229. /**
  230. * Always return false.
  231. */
  232. var no = function (a, b, c) { return false; };
  233. /* eslint-enable no-unused-vars */
  234. /**
  235. * Return the same value.
  236. */
  237. var identity = function (_) { return _; };
  238. /**
  239. * Generate a string containing static keys from compiler modules.
  240. */
  241. function genStaticKeys$1(modules) {
  242. return modules
  243. .reduce(function (keys, m) {
  244. return keys.concat(m.staticKeys || []);
  245. }, [])
  246. .join(',');
  247. }
  248. /**
  249. * Check if two values are loosely equal - that is,
  250. * if they are plain objects, do they have the same shape?
  251. */
  252. function looseEqual(a, b) {
  253. if (a === b)
  254. return true;
  255. var isObjectA = isObject(a);
  256. var isObjectB = isObject(b);
  257. if (isObjectA && isObjectB) {
  258. try {
  259. var isArrayA = Array.isArray(a);
  260. var isArrayB = Array.isArray(b);
  261. if (isArrayA && isArrayB) {
  262. return (a.length === b.length &&
  263. a.every(function (e, i) {
  264. return looseEqual(e, b[i]);
  265. }));
  266. }
  267. else if (a instanceof Date && b instanceof Date) {
  268. return a.getTime() === b.getTime();
  269. }
  270. else if (!isArrayA && !isArrayB) {
  271. var keysA = Object.keys(a);
  272. var keysB = Object.keys(b);
  273. return (keysA.length === keysB.length &&
  274. keysA.every(function (key) {
  275. return looseEqual(a[key], b[key]);
  276. }));
  277. }
  278. else {
  279. /* istanbul ignore next */
  280. return false;
  281. }
  282. }
  283. catch (e) {
  284. /* istanbul ignore next */
  285. return false;
  286. }
  287. }
  288. else if (!isObjectA && !isObjectB) {
  289. return String(a) === String(b);
  290. }
  291. else {
  292. return false;
  293. }
  294. }
  295. /**
  296. * Return the first index at which a loosely equal value can be
  297. * found in the array (if value is a plain object, the array must
  298. * contain an object of the same shape), or -1 if it is not present.
  299. */
  300. function looseIndexOf(arr, val) {
  301. for (var i = 0; i < arr.length; i++) {
  302. if (looseEqual(arr[i], val))
  303. return i;
  304. }
  305. return -1;
  306. }
  307. /**
  308. * Ensure a function is called only once.
  309. */
  310. function once(fn) {
  311. var called = false;
  312. return function () {
  313. if (!called) {
  314. called = true;
  315. fn.apply(this, arguments);
  316. }
  317. };
  318. }
  319. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill
  320. function hasChanged(x, y) {
  321. if (x === y) {
  322. return x === 0 && 1 / x !== 1 / y;
  323. }
  324. else {
  325. return x === x || y === y;
  326. }
  327. }
  328. var SSR_ATTR = 'data-server-rendered';
  329. var ASSET_TYPES = ['component', 'directive', 'filter'];
  330. var LIFECYCLE_HOOKS = [
  331. 'beforeCreate',
  332. 'created',
  333. 'beforeMount',
  334. 'mounted',
  335. 'beforeUpdate',
  336. 'updated',
  337. 'beforeDestroy',
  338. 'destroyed',
  339. 'activated',
  340. 'deactivated',
  341. 'errorCaptured',
  342. 'serverPrefetch',
  343. 'renderTracked',
  344. 'renderTriggered'
  345. ];
  346. var config = {
  347. /**
  348. * Option merge strategies (used in core/util/options)
  349. */
  350. // $flow-disable-line
  351. optionMergeStrategies: Object.create(null),
  352. /**
  353. * Whether to suppress warnings.
  354. */
  355. silent: false,
  356. /**
  357. * Show production mode tip message on boot?
  358. */
  359. productionTip: process.env.NODE_ENV !== 'production',
  360. /**
  361. * Whether to enable devtools
  362. */
  363. devtools: process.env.NODE_ENV !== 'production',
  364. /**
  365. * Whether to record perf
  366. */
  367. performance: false,
  368. /**
  369. * Error handler for watcher errors
  370. */
  371. errorHandler: null,
  372. /**
  373. * Warn handler for watcher warns
  374. */
  375. warnHandler: null,
  376. /**
  377. * Ignore certain custom elements
  378. */
  379. ignoredElements: [],
  380. /**
  381. * Custom user key aliases for v-on
  382. */
  383. // $flow-disable-line
  384. keyCodes: Object.create(null),
  385. /**
  386. * Check if a tag is reserved so that it cannot be registered as a
  387. * component. This is platform-dependent and may be overwritten.
  388. */
  389. isReservedTag: no,
  390. /**
  391. * Check if an attribute is reserved so that it cannot be used as a component
  392. * prop. This is platform-dependent and may be overwritten.
  393. */
  394. isReservedAttr: no,
  395. /**
  396. * Check if a tag is an unknown element.
  397. * Platform-dependent.
  398. */
  399. isUnknownElement: no,
  400. /**
  401. * Get the namespace of an element
  402. */
  403. getTagNamespace: noop,
  404. /**
  405. * Parse the real tag name for the specific platform.
  406. */
  407. parsePlatformTagName: identity,
  408. /**
  409. * Check if an attribute must be bound using property, e.g. value
  410. * Platform-dependent.
  411. */
  412. mustUseProp: no,
  413. /**
  414. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  415. * This will significantly reduce performance if set to false.
  416. */
  417. async: true,
  418. /**
  419. * Exposed for legacy reasons
  420. */
  421. _lifecycleHooks: LIFECYCLE_HOOKS
  422. };
  423. /**
  424. * unicode letters used for parsing html tags, component names and property paths.
  425. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  426. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  427. */
  428. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  429. /**
  430. * Check if a string starts with $ or _
  431. */
  432. function isReserved(str) {
  433. var c = (str + '').charCodeAt(0);
  434. return c === 0x24 || c === 0x5f;
  435. }
  436. /**
  437. * Define a property.
  438. */
  439. function def(obj, key, val, enumerable) {
  440. Object.defineProperty(obj, key, {
  441. value: val,
  442. enumerable: !!enumerable,
  443. writable: true,
  444. configurable: true
  445. });
  446. }
  447. /**
  448. * Parse simple path.
  449. */
  450. var bailRE = new RegExp("[^".concat(unicodeRegExp.source, ".$_\\d]"));
  451. function parsePath(path) {
  452. if (bailRE.test(path)) {
  453. return;
  454. }
  455. var segments = path.split('.');
  456. return function (obj) {
  457. for (var i = 0; i < segments.length; i++) {
  458. if (!obj)
  459. return;
  460. obj = obj[segments[i]];
  461. }
  462. return obj;
  463. };
  464. }
  465. // can we use __proto__?
  466. var hasProto = '__proto__' in {};
  467. // Browser environment sniffing
  468. var inBrowser = typeof window !== 'undefined';
  469. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  470. var isIE = UA && /msie|trident/.test(UA);
  471. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  472. var isEdge = UA && UA.indexOf('edge/') > 0;
  473. UA && UA.indexOf('android') > 0;
  474. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  475. UA && /chrome\/\d+/.test(UA) && !isEdge;
  476. UA && /phantomjs/.test(UA);
  477. var isFF = UA && UA.match(/firefox\/(\d+)/);
  478. // Firefox has a "watch" function on Object.prototype...
  479. // @ts-expect-error firebox support
  480. var nativeWatch = {}.watch;
  481. var supportsPassive = false;
  482. if (inBrowser) {
  483. try {
  484. var opts = {};
  485. Object.defineProperty(opts, 'passive', {
  486. get: function () {
  487. /* istanbul ignore next */
  488. supportsPassive = true;
  489. }
  490. }); // https://github.com/facebook/flow/issues/285
  491. window.addEventListener('test-passive', null, opts);
  492. }
  493. catch (e) { }
  494. }
  495. // this needs to be lazy-evaled because vue may be required before
  496. // vue-server-renderer can set VUE_ENV
  497. var _isServer;
  498. var isServerRendering = function () {
  499. if (_isServer === undefined) {
  500. /* istanbul ignore if */
  501. if (!inBrowser && typeof global !== 'undefined') {
  502. // detect presence of vue-server-renderer and avoid
  503. // Webpack shimming the process
  504. _isServer =
  505. global['process'] && global['process'].env.VUE_ENV === 'server';
  506. }
  507. else {
  508. _isServer = false;
  509. }
  510. }
  511. return _isServer;
  512. };
  513. // detect devtools
  514. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  515. /* istanbul ignore next */
  516. function isNative(Ctor) {
  517. return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
  518. }
  519. var hasSymbol = typeof Symbol !== 'undefined' &&
  520. isNative(Symbol) &&
  521. typeof Reflect !== 'undefined' &&
  522. isNative(Reflect.ownKeys);
  523. var _Set; // $flow-disable-line
  524. /* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) {
  525. // use native Set when available.
  526. _Set = Set;
  527. }
  528. else {
  529. // a non-standard Set polyfill that only works with primitive keys.
  530. _Set = /** @class */ (function () {
  531. function Set() {
  532. this.set = Object.create(null);
  533. }
  534. Set.prototype.has = function (key) {
  535. return this.set[key] === true;
  536. };
  537. Set.prototype.add = function (key) {
  538. this.set[key] = true;
  539. };
  540. Set.prototype.clear = function () {
  541. this.set = Object.create(null);
  542. };
  543. return Set;
  544. }());
  545. }
  546. var currentInstance = null;
  547. /**
  548. * This is exposed for compatibility with v3 (e.g. some functions in VueUse
  549. * relies on it). Do not use this internally, just use `currentInstance`.
  550. *
  551. * @internal this function needs manual type declaration because it relies
  552. * on previously manually authored types from Vue 2
  553. */
  554. function getCurrentInstance() {
  555. return currentInstance && { proxy: currentInstance };
  556. }
  557. /**
  558. * @internal
  559. */
  560. function setCurrentInstance(vm) {
  561. if (vm === void 0) { vm = null; }
  562. if (!vm)
  563. currentInstance && currentInstance._scope.off();
  564. currentInstance = vm;
  565. vm && vm._scope.on();
  566. }
  567. /**
  568. * @internal
  569. */
  570. var VNode = /** @class */ (function () {
  571. function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
  572. this.tag = tag;
  573. this.data = data;
  574. this.children = children;
  575. this.text = text;
  576. this.elm = elm;
  577. this.ns = undefined;
  578. this.context = context;
  579. this.fnContext = undefined;
  580. this.fnOptions = undefined;
  581. this.fnScopeId = undefined;
  582. this.key = data && data.key;
  583. this.componentOptions = componentOptions;
  584. this.componentInstance = undefined;
  585. this.parent = undefined;
  586. this.raw = false;
  587. this.isStatic = false;
  588. this.isRootInsert = true;
  589. this.isComment = false;
  590. this.isCloned = false;
  591. this.isOnce = false;
  592. this.asyncFactory = asyncFactory;
  593. this.asyncMeta = undefined;
  594. this.isAsyncPlaceholder = false;
  595. }
  596. Object.defineProperty(VNode.prototype, "child", {
  597. // DEPRECATED: alias for componentInstance for backwards compat.
  598. /* istanbul ignore next */
  599. get: function () {
  600. return this.componentInstance;
  601. },
  602. enumerable: false,
  603. configurable: true
  604. });
  605. return VNode;
  606. }());
  607. var createEmptyVNode = function (text) {
  608. if (text === void 0) { text = ''; }
  609. var node = new VNode();
  610. node.text = text;
  611. node.isComment = true;
  612. return node;
  613. };
  614. function createTextVNode(val) {
  615. return new VNode(undefined, undefined, undefined, String(val));
  616. }
  617. // optimized shallow clone
  618. // used for static nodes and slot nodes because they may be reused across
  619. // multiple renders, cloning them avoids errors when DOM manipulations rely
  620. // on their elm reference.
  621. function cloneVNode(vnode) {
  622. var cloned = new VNode(vnode.tag, vnode.data,
  623. // #7975
  624. // clone children array to avoid mutating original in case of cloning
  625. // a child.
  626. vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
  627. cloned.ns = vnode.ns;
  628. cloned.isStatic = vnode.isStatic;
  629. cloned.key = vnode.key;
  630. cloned.isComment = vnode.isComment;
  631. cloned.fnContext = vnode.fnContext;
  632. cloned.fnOptions = vnode.fnOptions;
  633. cloned.fnScopeId = vnode.fnScopeId;
  634. cloned.asyncMeta = vnode.asyncMeta;
  635. cloned.isCloned = true;
  636. return cloned;
  637. }
  638. /* not type checking this file because flow doesn't play well with Proxy */
  639. var initProxy;
  640. if (process.env.NODE_ENV !== 'production') {
  641. var allowedGlobals_1 = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
  642. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  643. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
  644. 'require' // for Webpack/Browserify
  645. );
  646. var warnNonPresent_1 = function (target, key) {
  647. warn$2("Property or method \"".concat(key, "\" is not defined on the instance but ") +
  648. 'referenced during render. Make sure that this property is reactive, ' +
  649. 'either in the data option, or for class-based components, by ' +
  650. 'initializing the property. ' +
  651. 'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
  652. };
  653. var warnReservedPrefix_1 = function (target, key) {
  654. warn$2("Property \"".concat(key, "\" must be accessed with \"$data.").concat(key, "\" because ") +
  655. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  656. 'prevent conflicts with Vue internals. ' +
  657. 'See: https://v2.vuejs.org/v2/api/#data', target);
  658. };
  659. var hasProxy_1 = typeof Proxy !== 'undefined' && isNative(Proxy);
  660. if (hasProxy_1) {
  661. var isBuiltInModifier_1 = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  662. config.keyCodes = new Proxy(config.keyCodes, {
  663. set: function (target, key, value) {
  664. if (isBuiltInModifier_1(key)) {
  665. warn$2("Avoid overwriting built-in modifier in config.keyCodes: .".concat(key));
  666. return false;
  667. }
  668. else {
  669. target[key] = value;
  670. return true;
  671. }
  672. }
  673. });
  674. }
  675. var hasHandler_1 = {
  676. has: function (target, key) {
  677. var has = key in target;
  678. var isAllowed = allowedGlobals_1(key) ||
  679. (typeof key === 'string' &&
  680. key.charAt(0) === '_' &&
  681. !(key in target.$data));
  682. if (!has && !isAllowed) {
  683. if (key in target.$data)
  684. warnReservedPrefix_1(target, key);
  685. else
  686. warnNonPresent_1(target, key);
  687. }
  688. return has || !isAllowed;
  689. }
  690. };
  691. var getHandler_1 = {
  692. get: function (target, key) {
  693. if (typeof key === 'string' && !(key in target)) {
  694. if (key in target.$data)
  695. warnReservedPrefix_1(target, key);
  696. else
  697. warnNonPresent_1(target, key);
  698. }
  699. return target[key];
  700. }
  701. };
  702. initProxy = function initProxy(vm) {
  703. if (hasProxy_1) {
  704. // determine which proxy handler to use
  705. var options = vm.$options;
  706. var handlers = options.render && options.render._withStripped ? getHandler_1 : hasHandler_1;
  707. vm._renderProxy = new Proxy(vm, handlers);
  708. }
  709. else {
  710. vm._renderProxy = vm;
  711. }
  712. };
  713. }
  714. /******************************************************************************
  715. Copyright (c) Microsoft Corporation.
  716. Permission to use, copy, modify, and/or distribute this software for any
  717. purpose with or without fee is hereby granted.
  718. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  719. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  720. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  721. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  722. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  723. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  724. PERFORMANCE OF THIS SOFTWARE.
  725. ***************************************************************************** */
  726. var __assign = function() {
  727. __assign = Object.assign || function __assign(t) {
  728. for (var s, i = 1, n = arguments.length; i < n; i++) {
  729. s = arguments[i];
  730. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  731. }
  732. return t;
  733. };
  734. return __assign.apply(this, arguments);
  735. };
  736. var uid$2 = 0;
  737. var pendingCleanupDeps = [];
  738. var cleanupDeps = function () {
  739. for (var i = 0; i < pendingCleanupDeps.length; i++) {
  740. var dep = pendingCleanupDeps[i];
  741. dep.subs = dep.subs.filter(function (s) { return s; });
  742. dep._pending = false;
  743. }
  744. pendingCleanupDeps.length = 0;
  745. };
  746. /**
  747. * A dep is an observable that can have multiple
  748. * directives subscribing to it.
  749. * @internal
  750. */
  751. var Dep = /** @class */ (function () {
  752. function Dep() {
  753. // pending subs cleanup
  754. this._pending = false;
  755. this.id = uid$2++;
  756. this.subs = [];
  757. }
  758. Dep.prototype.addSub = function (sub) {
  759. this.subs.push(sub);
  760. };
  761. Dep.prototype.removeSub = function (sub) {
  762. // #12696 deps with massive amount of subscribers are extremely slow to
  763. // clean up in Chromium
  764. // to workaround this, we unset the sub for now, and clear them on
  765. // next scheduler flush.
  766. this.subs[this.subs.indexOf(sub)] = null;
  767. if (!this._pending) {
  768. this._pending = true;
  769. pendingCleanupDeps.push(this);
  770. }
  771. };
  772. Dep.prototype.depend = function (info) {
  773. if (Dep.target) {
  774. Dep.target.addDep(this);
  775. if (process.env.NODE_ENV !== 'production' && info && Dep.target.onTrack) {
  776. Dep.target.onTrack(__assign({ effect: Dep.target }, info));
  777. }
  778. }
  779. };
  780. Dep.prototype.notify = function (info) {
  781. // stabilize the subscriber list first
  782. var subs = this.subs.filter(function (s) { return s; });
  783. if (process.env.NODE_ENV !== 'production' && !config.async) {
  784. // subs aren't sorted in scheduler if not running async
  785. // we need to sort them now to make sure they fire in correct
  786. // order
  787. subs.sort(function (a, b) { return a.id - b.id; });
  788. }
  789. for (var i = 0, l = subs.length; i < l; i++) {
  790. var sub = subs[i];
  791. if (process.env.NODE_ENV !== 'production' && info) {
  792. sub.onTrigger &&
  793. sub.onTrigger(__assign({ effect: subs[i] }, info));
  794. }
  795. sub.update();
  796. }
  797. };
  798. return Dep;
  799. }());
  800. // The current target watcher being evaluated.
  801. // This is globally unique because only one watcher
  802. // can be evaluated at a time.
  803. Dep.target = null;
  804. var targetStack = [];
  805. function pushTarget(target) {
  806. targetStack.push(target);
  807. Dep.target = target;
  808. }
  809. function popTarget() {
  810. targetStack.pop();
  811. Dep.target = targetStack[targetStack.length - 1];
  812. }
  813. /*
  814. * not type checking this file because flow doesn't play well with
  815. * dynamically accessing methods on Array prototype
  816. */
  817. var arrayProto = Array.prototype;
  818. var arrayMethods = Object.create(arrayProto);
  819. var methodsToPatch = [
  820. 'push',
  821. 'pop',
  822. 'shift',
  823. 'unshift',
  824. 'splice',
  825. 'sort',
  826. 'reverse'
  827. ];
  828. /**
  829. * Intercept mutating methods and emit events
  830. */
  831. methodsToPatch.forEach(function (method) {
  832. // cache original method
  833. var original = arrayProto[method];
  834. def(arrayMethods, method, function mutator() {
  835. var args = [];
  836. for (var _i = 0; _i < arguments.length; _i++) {
  837. args[_i] = arguments[_i];
  838. }
  839. var result = original.apply(this, args);
  840. var ob = this.__ob__;
  841. var inserted;
  842. switch (method) {
  843. case 'push':
  844. case 'unshift':
  845. inserted = args;
  846. break;
  847. case 'splice':
  848. inserted = args.slice(2);
  849. break;
  850. }
  851. if (inserted)
  852. ob.observeArray(inserted);
  853. // notify change
  854. if (process.env.NODE_ENV !== 'production') {
  855. ob.dep.notify({
  856. type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */,
  857. target: this,
  858. key: method
  859. });
  860. }
  861. else {
  862. ob.dep.notify();
  863. }
  864. return result;
  865. });
  866. });
  867. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  868. var NO_INIITIAL_VALUE = {};
  869. /**
  870. * In some cases we may want to disable observation inside a component's
  871. * update computation.
  872. */
  873. var shouldObserve = true;
  874. function toggleObserving(value) {
  875. shouldObserve = value;
  876. }
  877. // ssr mock dep
  878. var mockDep = {
  879. notify: noop,
  880. depend: noop,
  881. addSub: noop,
  882. removeSub: noop
  883. };
  884. /**
  885. * Observer class that is attached to each observed
  886. * object. Once attached, the observer converts the target
  887. * object's property keys into getter/setters that
  888. * collect dependencies and dispatch updates.
  889. */
  890. var Observer = /** @class */ (function () {
  891. function Observer(value, shallow, mock) {
  892. if (shallow === void 0) { shallow = false; }
  893. if (mock === void 0) { mock = false; }
  894. this.value = value;
  895. this.shallow = shallow;
  896. this.mock = mock;
  897. // this.value = value
  898. this.dep = mock ? mockDep : new Dep();
  899. this.vmCount = 0;
  900. def(value, '__ob__', this);
  901. if (isArray(value)) {
  902. if (!mock) {
  903. if (hasProto) {
  904. value.__proto__ = arrayMethods;
  905. /* eslint-enable no-proto */
  906. }
  907. else {
  908. for (var i = 0, l = arrayKeys.length; i < l; i++) {
  909. var key = arrayKeys[i];
  910. def(value, key, arrayMethods[key]);
  911. }
  912. }
  913. }
  914. if (!shallow) {
  915. this.observeArray(value);
  916. }
  917. }
  918. else {
  919. /**
  920. * Walk through all properties and convert them into
  921. * getter/setters. This method should only be called when
  922. * value type is Object.
  923. */
  924. var keys = Object.keys(value);
  925. for (var i = 0; i < keys.length; i++) {
  926. var key = keys[i];
  927. defineReactive(value, key, NO_INIITIAL_VALUE, undefined, shallow, mock);
  928. }
  929. }
  930. }
  931. /**
  932. * Observe a list of Array items.
  933. */
  934. Observer.prototype.observeArray = function (value) {
  935. for (var i = 0, l = value.length; i < l; i++) {
  936. observe(value[i], false, this.mock);
  937. }
  938. };
  939. return Observer;
  940. }());
  941. // helpers
  942. /**
  943. * Attempt to create an observer instance for a value,
  944. * returns the new observer if successfully observed,
  945. * or the existing observer if the value already has one.
  946. */
  947. function observe(value, shallow, ssrMockReactivity) {
  948. if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  949. return value.__ob__;
  950. }
  951. if (shouldObserve &&
  952. (ssrMockReactivity || !isServerRendering()) &&
  953. (isArray(value) || isPlainObject(value)) &&
  954. Object.isExtensible(value) &&
  955. !value.__v_skip /* ReactiveFlags.SKIP */ &&
  956. !isRef(value) &&
  957. !(value instanceof VNode)) {
  958. return new Observer(value, shallow, ssrMockReactivity);
  959. }
  960. }
  961. /**
  962. * Define a reactive property on an Object.
  963. */
  964. function defineReactive(obj, key, val, customSetter, shallow, mock) {
  965. var dep = new Dep();
  966. var property = Object.getOwnPropertyDescriptor(obj, key);
  967. if (property && property.configurable === false) {
  968. return;
  969. }
  970. // cater for pre-defined getter/setters
  971. var getter = property && property.get;
  972. var setter = property && property.set;
  973. if ((!getter || setter) &&
  974. (val === NO_INIITIAL_VALUE || arguments.length === 2)) {
  975. val = obj[key];
  976. }
  977. var childOb = !shallow && observe(val, false, mock);
  978. Object.defineProperty(obj, key, {
  979. enumerable: true,
  980. configurable: true,
  981. get: function reactiveGetter() {
  982. var value = getter ? getter.call(obj) : val;
  983. if (Dep.target) {
  984. if (process.env.NODE_ENV !== 'production') {
  985. dep.depend({
  986. target: obj,
  987. type: "get" /* TrackOpTypes.GET */,
  988. key: key
  989. });
  990. }
  991. else {
  992. dep.depend();
  993. }
  994. if (childOb) {
  995. childOb.dep.depend();
  996. if (isArray(value)) {
  997. dependArray(value);
  998. }
  999. }
  1000. }
  1001. return isRef(value) && !shallow ? value.value : value;
  1002. },
  1003. set: function reactiveSetter(newVal) {
  1004. var value = getter ? getter.call(obj) : val;
  1005. if (!hasChanged(value, newVal)) {
  1006. return;
  1007. }
  1008. if (process.env.NODE_ENV !== 'production' && customSetter) {
  1009. customSetter();
  1010. }
  1011. if (setter) {
  1012. setter.call(obj, newVal);
  1013. }
  1014. else if (getter) {
  1015. // #7981: for accessor properties without setter
  1016. return;
  1017. }
  1018. else if (!shallow && isRef(value) && !isRef(newVal)) {
  1019. value.value = newVal;
  1020. return;
  1021. }
  1022. else {
  1023. val = newVal;
  1024. }
  1025. childOb = !shallow && observe(newVal, false, mock);
  1026. if (process.env.NODE_ENV !== 'production') {
  1027. dep.notify({
  1028. type: "set" /* TriggerOpTypes.SET */,
  1029. target: obj,
  1030. key: key,
  1031. newValue: newVal,
  1032. oldValue: value
  1033. });
  1034. }
  1035. else {
  1036. dep.notify();
  1037. }
  1038. }
  1039. });
  1040. return dep;
  1041. }
  1042. function set(target, key, val) {
  1043. if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {
  1044. warn$2("Cannot set reactive property on undefined, null, or primitive value: ".concat(target));
  1045. }
  1046. if (isReadonly(target)) {
  1047. process.env.NODE_ENV !== 'production' && warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
  1048. return;
  1049. }
  1050. var ob = target.__ob__;
  1051. if (isArray(target) && isValidArrayIndex(key)) {
  1052. target.length = Math.max(target.length, key);
  1053. target.splice(key, 1, val);
  1054. // when mocking for SSR, array methods are not hijacked
  1055. if (ob && !ob.shallow && ob.mock) {
  1056. observe(val, false, true);
  1057. }
  1058. return val;
  1059. }
  1060. if (key in target && !(key in Object.prototype)) {
  1061. target[key] = val;
  1062. return val;
  1063. }
  1064. if (target._isVue || (ob && ob.vmCount)) {
  1065. process.env.NODE_ENV !== 'production' &&
  1066. warn$2('Avoid adding reactive properties to a Vue instance or its root $data ' +
  1067. 'at runtime - declare it upfront in the data option.');
  1068. return val;
  1069. }
  1070. if (!ob) {
  1071. target[key] = val;
  1072. return val;
  1073. }
  1074. defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);
  1075. if (process.env.NODE_ENV !== 'production') {
  1076. ob.dep.notify({
  1077. type: "add" /* TriggerOpTypes.ADD */,
  1078. target: target,
  1079. key: key,
  1080. newValue: val,
  1081. oldValue: undefined
  1082. });
  1083. }
  1084. else {
  1085. ob.dep.notify();
  1086. }
  1087. return val;
  1088. }
  1089. function del(target, key) {
  1090. if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {
  1091. warn$2("Cannot delete reactive property on undefined, null, or primitive value: ".concat(target));
  1092. }
  1093. if (isArray(target) && isValidArrayIndex(key)) {
  1094. target.splice(key, 1);
  1095. return;
  1096. }
  1097. var ob = target.__ob__;
  1098. if (target._isVue || (ob && ob.vmCount)) {
  1099. process.env.NODE_ENV !== 'production' &&
  1100. warn$2('Avoid deleting properties on a Vue instance or its root $data ' +
  1101. '- just set it to null.');
  1102. return;
  1103. }
  1104. if (isReadonly(target)) {
  1105. process.env.NODE_ENV !== 'production' &&
  1106. warn$2("Delete operation on key \"".concat(key, "\" failed: target is readonly."));
  1107. return;
  1108. }
  1109. if (!hasOwn(target, key)) {
  1110. return;
  1111. }
  1112. delete target[key];
  1113. if (!ob) {
  1114. return;
  1115. }
  1116. if (process.env.NODE_ENV !== 'production') {
  1117. ob.dep.notify({
  1118. type: "delete" /* TriggerOpTypes.DELETE */,
  1119. target: target,
  1120. key: key
  1121. });
  1122. }
  1123. else {
  1124. ob.dep.notify();
  1125. }
  1126. }
  1127. /**
  1128. * Collect dependencies on array elements when the array is touched, since
  1129. * we cannot intercept array element access like property getters.
  1130. */
  1131. function dependArray(value) {
  1132. for (var e = void 0, i = 0, l = value.length; i < l; i++) {
  1133. e = value[i];
  1134. if (e && e.__ob__) {
  1135. e.__ob__.dep.depend();
  1136. }
  1137. if (isArray(e)) {
  1138. dependArray(e);
  1139. }
  1140. }
  1141. }
  1142. function reactive(target) {
  1143. makeReactive(target, false);
  1144. return target;
  1145. }
  1146. /**
  1147. * Return a shallowly-reactive copy of the original object, where only the root
  1148. * level properties are reactive. It also does not auto-unwrap refs (even at the
  1149. * root level).
  1150. */
  1151. function shallowReactive(target) {
  1152. makeReactive(target, true);
  1153. def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
  1154. return target;
  1155. }
  1156. function makeReactive(target, shallow) {
  1157. // if trying to observe a readonly proxy, return the readonly version.
  1158. if (!isReadonly(target)) {
  1159. if (process.env.NODE_ENV !== 'production') {
  1160. if (isArray(target)) {
  1161. warn$2("Avoid using Array as root value for ".concat(shallow ? "shallowReactive()" : "reactive()", " as it cannot be tracked in watch() or watchEffect(). Use ").concat(shallow ? "shallowRef()" : "ref()", " instead. This is a Vue-2-only limitation."));
  1162. }
  1163. var existingOb = target && target.__ob__;
  1164. if (existingOb && existingOb.shallow !== shallow) {
  1165. warn$2("Target is already a ".concat(existingOb.shallow ? "" : "non-", "shallow reactive object, and cannot be converted to ").concat(shallow ? "" : "non-", "shallow."));
  1166. }
  1167. }
  1168. var ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
  1169. if (process.env.NODE_ENV !== 'production' && !ob) {
  1170. if (target == null || isPrimitive(target)) {
  1171. warn$2("value cannot be made reactive: ".concat(String(target)));
  1172. }
  1173. if (isCollectionType(target)) {
  1174. warn$2("Vue 2 does not support reactive collection types such as Map or Set.");
  1175. }
  1176. }
  1177. }
  1178. }
  1179. function isReactive(value) {
  1180. if (isReadonly(value)) {
  1181. return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
  1182. }
  1183. return !!(value && value.__ob__);
  1184. }
  1185. function isShallow(value) {
  1186. return !!(value && value.__v_isShallow);
  1187. }
  1188. function isReadonly(value) {
  1189. return !!(value && value.__v_isReadonly);
  1190. }
  1191. function isProxy(value) {
  1192. return isReactive(value) || isReadonly(value);
  1193. }
  1194. function toRaw(observed) {
  1195. var raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
  1196. return raw ? toRaw(raw) : observed;
  1197. }
  1198. function markRaw(value) {
  1199. // non-extensible objects won't be observed anyway
  1200. if (Object.isExtensible(value)) {
  1201. def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
  1202. }
  1203. return value;
  1204. }
  1205. /**
  1206. * @internal
  1207. */
  1208. function isCollectionType(value) {
  1209. var type = toRawType(value);
  1210. return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
  1211. }
  1212. /**
  1213. * @internal
  1214. */
  1215. var RefFlag = "__v_isRef";
  1216. function isRef(r) {
  1217. return !!(r && r.__v_isRef === true);
  1218. }
  1219. function ref$1(value) {
  1220. return createRef(value, false);
  1221. }
  1222. function shallowRef(value) {
  1223. return createRef(value, true);
  1224. }
  1225. function createRef(rawValue, shallow) {
  1226. if (isRef(rawValue)) {
  1227. return rawValue;
  1228. }
  1229. var ref = {};
  1230. def(ref, RefFlag, true);
  1231. def(ref, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, shallow);
  1232. def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering()));
  1233. return ref;
  1234. }
  1235. function triggerRef(ref) {
  1236. if (process.env.NODE_ENV !== 'production' && !ref.dep) {
  1237. warn$2("received object is not a triggerable ref.");
  1238. }
  1239. if (process.env.NODE_ENV !== 'production') {
  1240. ref.dep &&
  1241. ref.dep.notify({
  1242. type: "set" /* TriggerOpTypes.SET */,
  1243. target: ref,
  1244. key: 'value'
  1245. });
  1246. }
  1247. else {
  1248. ref.dep && ref.dep.notify();
  1249. }
  1250. }
  1251. function unref(ref) {
  1252. return isRef(ref) ? ref.value : ref;
  1253. }
  1254. function proxyRefs(objectWithRefs) {
  1255. if (isReactive(objectWithRefs)) {
  1256. return objectWithRefs;
  1257. }
  1258. var proxy = {};
  1259. var keys = Object.keys(objectWithRefs);
  1260. for (var i = 0; i < keys.length; i++) {
  1261. proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);
  1262. }
  1263. return proxy;
  1264. }
  1265. function proxyWithRefUnwrap(target, source, key) {
  1266. Object.defineProperty(target, key, {
  1267. enumerable: true,
  1268. configurable: true,
  1269. get: function () {
  1270. var val = source[key];
  1271. if (isRef(val)) {
  1272. return val.value;
  1273. }
  1274. else {
  1275. var ob = val && val.__ob__;
  1276. if (ob)
  1277. ob.dep.depend();
  1278. return val;
  1279. }
  1280. },
  1281. set: function (value) {
  1282. var oldValue = source[key];
  1283. if (isRef(oldValue) && !isRef(value)) {
  1284. oldValue.value = value;
  1285. }
  1286. else {
  1287. source[key] = value;
  1288. }
  1289. }
  1290. });
  1291. }
  1292. function customRef(factory) {
  1293. var dep = new Dep();
  1294. var _a = factory(function () {
  1295. if (process.env.NODE_ENV !== 'production') {
  1296. dep.depend({
  1297. target: ref,
  1298. type: "get" /* TrackOpTypes.GET */,
  1299. key: 'value'
  1300. });
  1301. }
  1302. else {
  1303. dep.depend();
  1304. }
  1305. }, function () {
  1306. if (process.env.NODE_ENV !== 'production') {
  1307. dep.notify({
  1308. target: ref,
  1309. type: "set" /* TriggerOpTypes.SET */,
  1310. key: 'value'
  1311. });
  1312. }
  1313. else {
  1314. dep.notify();
  1315. }
  1316. }), get = _a.get, set = _a.set;
  1317. var ref = {
  1318. get value() {
  1319. return get();
  1320. },
  1321. set value(newVal) {
  1322. set(newVal);
  1323. }
  1324. };
  1325. def(ref, RefFlag, true);
  1326. return ref;
  1327. }
  1328. function toRefs(object) {
  1329. if (process.env.NODE_ENV !== 'production' && !isReactive(object)) {
  1330. warn$2("toRefs() expects a reactive object but received a plain one.");
  1331. }
  1332. var ret = isArray(object) ? new Array(object.length) : {};
  1333. for (var key in object) {
  1334. ret[key] = toRef(object, key);
  1335. }
  1336. return ret;
  1337. }
  1338. function toRef(object, key, defaultValue) {
  1339. var val = object[key];
  1340. if (isRef(val)) {
  1341. return val;
  1342. }
  1343. var ref = {
  1344. get value() {
  1345. var val = object[key];
  1346. return val === undefined ? defaultValue : val;
  1347. },
  1348. set value(newVal) {
  1349. object[key] = newVal;
  1350. }
  1351. };
  1352. def(ref, RefFlag, true);
  1353. return ref;
  1354. }
  1355. var rawToReadonlyFlag = "__v_rawToReadonly";
  1356. var rawToShallowReadonlyFlag = "__v_rawToShallowReadonly";
  1357. function readonly(target) {
  1358. return createReadonly(target, false);
  1359. }
  1360. function createReadonly(target, shallow) {
  1361. if (!isPlainObject(target)) {
  1362. if (process.env.NODE_ENV !== 'production') {
  1363. if (isArray(target)) {
  1364. warn$2("Vue 2 does not support readonly arrays.");
  1365. }
  1366. else if (isCollectionType(target)) {
  1367. warn$2("Vue 2 does not support readonly collection types such as Map or Set.");
  1368. }
  1369. else {
  1370. warn$2("value cannot be made readonly: ".concat(typeof target));
  1371. }
  1372. }
  1373. return target;
  1374. }
  1375. if (process.env.NODE_ENV !== 'production' && !Object.isExtensible(target)) {
  1376. warn$2("Vue 2 does not support creating readonly proxy for non-extensible object.");
  1377. }
  1378. // already a readonly object
  1379. if (isReadonly(target)) {
  1380. return target;
  1381. }
  1382. // already has a readonly proxy
  1383. var existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
  1384. var existingProxy = target[existingFlag];
  1385. if (existingProxy) {
  1386. return existingProxy;
  1387. }
  1388. var proxy = Object.create(Object.getPrototypeOf(target));
  1389. def(target, existingFlag, proxy);
  1390. def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true);
  1391. def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target);
  1392. if (isRef(target)) {
  1393. def(proxy, RefFlag, true);
  1394. }
  1395. if (shallow || isShallow(target)) {
  1396. def(proxy, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
  1397. }
  1398. var keys = Object.keys(target);
  1399. for (var i = 0; i < keys.length; i++) {
  1400. defineReadonlyProperty(proxy, target, keys[i], shallow);
  1401. }
  1402. return proxy;
  1403. }
  1404. function defineReadonlyProperty(proxy, target, key, shallow) {
  1405. Object.defineProperty(proxy, key, {
  1406. enumerable: true,
  1407. configurable: true,
  1408. get: function () {
  1409. var val = target[key];
  1410. return shallow || !isPlainObject(val) ? val : readonly(val);
  1411. },
  1412. set: function () {
  1413. process.env.NODE_ENV !== 'production' &&
  1414. warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
  1415. }
  1416. });
  1417. }
  1418. /**
  1419. * Returns a reactive-copy of the original object, where only the root level
  1420. * properties are readonly, and does NOT unwrap refs nor recursively convert
  1421. * returned properties.
  1422. * This is used for creating the props proxy object for stateful components.
  1423. */
  1424. function shallowReadonly(target) {
  1425. return createReadonly(target, true);
  1426. }
  1427. function computed(getterOrOptions, debugOptions) {
  1428. var getter;
  1429. var setter;
  1430. var onlyGetter = isFunction(getterOrOptions);
  1431. if (onlyGetter) {
  1432. getter = getterOrOptions;
  1433. setter = process.env.NODE_ENV !== 'production'
  1434. ? function () {
  1435. warn$2('Write operation failed: computed value is readonly');
  1436. }
  1437. : noop;
  1438. }
  1439. else {
  1440. getter = getterOrOptions.get;
  1441. setter = getterOrOptions.set;
  1442. }
  1443. var watcher = isServerRendering()
  1444. ? null
  1445. : new Watcher(currentInstance, getter, noop, { lazy: true });
  1446. if (process.env.NODE_ENV !== 'production' && watcher && debugOptions) {
  1447. watcher.onTrack = debugOptions.onTrack;
  1448. watcher.onTrigger = debugOptions.onTrigger;
  1449. }
  1450. var ref = {
  1451. // some libs rely on the presence effect for checking computed refs
  1452. // from normal refs, but the implementation doesn't matter
  1453. effect: watcher,
  1454. get value() {
  1455. if (watcher) {
  1456. if (watcher.dirty) {
  1457. watcher.evaluate();
  1458. }
  1459. if (Dep.target) {
  1460. if (process.env.NODE_ENV !== 'production' && Dep.target.onTrack) {
  1461. Dep.target.onTrack({
  1462. effect: Dep.target,
  1463. target: ref,
  1464. type: "get" /* TrackOpTypes.GET */,
  1465. key: 'value'
  1466. });
  1467. }
  1468. watcher.depend();
  1469. }
  1470. return watcher.value;
  1471. }
  1472. else {
  1473. return getter();
  1474. }
  1475. },
  1476. set value(newVal) {
  1477. setter(newVal);
  1478. }
  1479. };
  1480. def(ref, RefFlag, true);
  1481. def(ref, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, onlyGetter);
  1482. return ref;
  1483. }
  1484. var mark;
  1485. var measure;
  1486. if (process.env.NODE_ENV !== 'production') {
  1487. var perf_1 = inBrowser && window.performance;
  1488. /* istanbul ignore if */
  1489. if (perf_1 &&
  1490. // @ts-ignore
  1491. perf_1.mark &&
  1492. // @ts-ignore
  1493. perf_1.measure &&
  1494. // @ts-ignore
  1495. perf_1.clearMarks &&
  1496. // @ts-ignore
  1497. perf_1.clearMeasures) {
  1498. mark = function (tag) { return perf_1.mark(tag); };
  1499. measure = function (name, startTag, endTag) {
  1500. perf_1.measure(name, startTag, endTag);
  1501. perf_1.clearMarks(startTag);
  1502. perf_1.clearMarks(endTag);
  1503. // perf.clearMeasures(name)
  1504. };
  1505. }
  1506. }
  1507. var normalizeEvent = cached(function (name) {
  1508. var passive = name.charAt(0) === '&';
  1509. name = passive ? name.slice(1) : name;
  1510. var once = name.charAt(0) === '~'; // Prefixed last, checked first
  1511. name = once ? name.slice(1) : name;
  1512. var capture = name.charAt(0) === '!';
  1513. name = capture ? name.slice(1) : name;
  1514. return {
  1515. name: name,
  1516. once: once,
  1517. capture: capture,
  1518. passive: passive
  1519. };
  1520. });
  1521. function createFnInvoker(fns, vm) {
  1522. function invoker() {
  1523. var fns = invoker.fns;
  1524. if (isArray(fns)) {
  1525. var cloned = fns.slice();
  1526. for (var i = 0; i < cloned.length; i++) {
  1527. invokeWithErrorHandling(cloned[i], null, arguments, vm, "v-on handler");
  1528. }
  1529. }
  1530. else {
  1531. // return handler return value for single handlers
  1532. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler");
  1533. }
  1534. }
  1535. invoker.fns = fns;
  1536. return invoker;
  1537. }
  1538. function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
  1539. var name, cur, old, event;
  1540. for (name in on) {
  1541. cur = on[name];
  1542. old = oldOn[name];
  1543. event = normalizeEvent(name);
  1544. if (isUndef(cur)) {
  1545. process.env.NODE_ENV !== 'production' &&
  1546. warn$2("Invalid handler for event \"".concat(event.name, "\": got ") + String(cur), vm);
  1547. }
  1548. else if (isUndef(old)) {
  1549. if (isUndef(cur.fns)) {
  1550. cur = on[name] = createFnInvoker(cur, vm);
  1551. }
  1552. if (isTrue(event.once)) {
  1553. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  1554. }
  1555. add(event.name, cur, event.capture, event.passive, event.params);
  1556. }
  1557. else if (cur !== old) {
  1558. old.fns = cur;
  1559. on[name] = old;
  1560. }
  1561. }
  1562. for (name in oldOn) {
  1563. if (isUndef(on[name])) {
  1564. event = normalizeEvent(name);
  1565. remove(event.name, oldOn[name], event.capture);
  1566. }
  1567. }
  1568. }
  1569. function mergeVNodeHook(def, hookKey, hook) {
  1570. if (def instanceof VNode) {
  1571. def = def.data.hook || (def.data.hook = {});
  1572. }
  1573. var invoker;
  1574. var oldHook = def[hookKey];
  1575. function wrappedHook() {
  1576. hook.apply(this, arguments);
  1577. // important: remove merged hook to ensure it's called only once
  1578. // and prevent memory leak
  1579. remove$2(invoker.fns, wrappedHook);
  1580. }
  1581. if (isUndef(oldHook)) {
  1582. // no existing hook
  1583. invoker = createFnInvoker([wrappedHook]);
  1584. }
  1585. else {
  1586. /* istanbul ignore if */
  1587. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  1588. // already a merged invoker
  1589. invoker = oldHook;
  1590. invoker.fns.push(wrappedHook);
  1591. }
  1592. else {
  1593. // existing plain hook
  1594. invoker = createFnInvoker([oldHook, wrappedHook]);
  1595. }
  1596. }
  1597. invoker.merged = true;
  1598. def[hookKey] = invoker;
  1599. }
  1600. function extractPropsFromVNodeData(data, Ctor, tag) {
  1601. // we are only extracting raw values here.
  1602. // validation and default values are handled in the child
  1603. // component itself.
  1604. var propOptions = Ctor.options.props;
  1605. if (isUndef(propOptions)) {
  1606. return;
  1607. }
  1608. var res = {};
  1609. var attrs = data.attrs, props = data.props;
  1610. if (isDef(attrs) || isDef(props)) {
  1611. for (var key in propOptions) {
  1612. var altKey = hyphenate(key);
  1613. if (process.env.NODE_ENV !== 'production') {
  1614. var keyInLowerCase = key.toLowerCase();
  1615. if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {
  1616. tip("Prop \"".concat(keyInLowerCase, "\" is passed to component ") +
  1617. "".concat(formatComponentName(
  1618. // @ts-expect-error tag is string
  1619. tag || Ctor), ", but the declared prop name is") +
  1620. " \"".concat(key, "\". ") +
  1621. "Note that HTML attributes are case-insensitive and camelCased " +
  1622. "props need to use their kebab-case equivalents when using in-DOM " +
  1623. "templates. You should probably use \"".concat(altKey, "\" instead of \"").concat(key, "\"."));
  1624. }
  1625. }
  1626. checkProp(res, props, key, altKey, true) ||
  1627. checkProp(res, attrs, key, altKey, false);
  1628. }
  1629. }
  1630. return res;
  1631. }
  1632. function checkProp(res, hash, key, altKey, preserve) {
  1633. if (isDef(hash)) {
  1634. if (hasOwn(hash, key)) {
  1635. res[key] = hash[key];
  1636. if (!preserve) {
  1637. delete hash[key];
  1638. }
  1639. return true;
  1640. }
  1641. else if (hasOwn(hash, altKey)) {
  1642. res[key] = hash[altKey];
  1643. if (!preserve) {
  1644. delete hash[altKey];
  1645. }
  1646. return true;
  1647. }
  1648. }
  1649. return false;
  1650. }
  1651. // The template compiler attempts to minimize the need for normalization by
  1652. // statically analyzing the template at compile time.
  1653. //
  1654. // For plain HTML markup, normalization can be completely skipped because the
  1655. // generated render function is guaranteed to return Array<VNode>. There are
  1656. // two cases where extra normalization is needed:
  1657. // 1. When the children contains components - because a functional component
  1658. // may return an Array instead of a single root. In this case, just a simple
  1659. // normalization is needed - if any child is an Array, we flatten the whole
  1660. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  1661. // because functional components already normalize their own children.
  1662. function simpleNormalizeChildren(children) {
  1663. for (var i = 0; i < children.length; i++) {
  1664. if (isArray(children[i])) {
  1665. return Array.prototype.concat.apply([], children);
  1666. }
  1667. }
  1668. return children;
  1669. }
  1670. // 2. When the children contains constructs that always generated nested Arrays,
  1671. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  1672. // with hand-written render functions / JSX. In such cases a full normalization
  1673. // is needed to cater to all possible types of children values.
  1674. function normalizeChildren(children) {
  1675. return isPrimitive(children)
  1676. ? [createTextVNode(children)]
  1677. : isArray(children)
  1678. ? normalizeArrayChildren(children)
  1679. : undefined;
  1680. }
  1681. function isTextNode(node) {
  1682. return isDef(node) && isDef(node.text) && isFalse(node.isComment);
  1683. }
  1684. function normalizeArrayChildren(children, nestedIndex) {
  1685. var res = [];
  1686. var i, c, lastIndex, last;
  1687. for (i = 0; i < children.length; i++) {
  1688. c = children[i];
  1689. if (isUndef(c) || typeof c === 'boolean')
  1690. continue;
  1691. lastIndex = res.length - 1;
  1692. last = res[lastIndex];
  1693. // nested
  1694. if (isArray(c)) {
  1695. if (c.length > 0) {
  1696. c = normalizeArrayChildren(c, "".concat(nestedIndex || '', "_").concat(i));
  1697. // merge adjacent text nodes
  1698. if (isTextNode(c[0]) && isTextNode(last)) {
  1699. res[lastIndex] = createTextVNode(last.text + c[0].text);
  1700. c.shift();
  1701. }
  1702. res.push.apply(res, c);
  1703. }
  1704. }
  1705. else if (isPrimitive(c)) {
  1706. if (isTextNode(last)) {
  1707. // merge adjacent text nodes
  1708. // this is necessary for SSR hydration because text nodes are
  1709. // essentially merged when rendered to HTML strings
  1710. res[lastIndex] = createTextVNode(last.text + c);
  1711. }
  1712. else if (c !== '') {
  1713. // convert primitive to vnode
  1714. res.push(createTextVNode(c));
  1715. }
  1716. }
  1717. else {
  1718. if (isTextNode(c) && isTextNode(last)) {
  1719. // merge adjacent text nodes
  1720. res[lastIndex] = createTextVNode(last.text + c.text);
  1721. }
  1722. else {
  1723. // default key for nested array children (likely generated by v-for)
  1724. if (isTrue(children._isVList) &&
  1725. isDef(c.tag) &&
  1726. isUndef(c.key) &&
  1727. isDef(nestedIndex)) {
  1728. c.key = "__vlist".concat(nestedIndex, "_").concat(i, "__");
  1729. }
  1730. res.push(c);
  1731. }
  1732. }
  1733. }
  1734. return res;
  1735. }
  1736. var SIMPLE_NORMALIZE = 1;
  1737. var ALWAYS_NORMALIZE = 2;
  1738. // wrapper function for providing a more flexible interface
  1739. // without getting yelled at by flow
  1740. function createElement$1(context, tag, data, children, normalizationType, alwaysNormalize) {
  1741. if (isArray(data) || isPrimitive(data)) {
  1742. normalizationType = children;
  1743. children = data;
  1744. data = undefined;
  1745. }
  1746. if (isTrue(alwaysNormalize)) {
  1747. normalizationType = ALWAYS_NORMALIZE;
  1748. }
  1749. return _createElement(context, tag, data, children, normalizationType);
  1750. }
  1751. function _createElement(context, tag, data, children, normalizationType) {
  1752. if (isDef(data) && isDef(data.__ob__)) {
  1753. process.env.NODE_ENV !== 'production' &&
  1754. warn$2("Avoid using observed data object as vnode data: ".concat(JSON.stringify(data), "\n") + 'Always create fresh vnode data objects in each render!', context);
  1755. return createEmptyVNode();
  1756. }
  1757. // object syntax in v-bind
  1758. if (isDef(data) && isDef(data.is)) {
  1759. tag = data.is;
  1760. }
  1761. if (!tag) {
  1762. // in case of component :is set to falsy value
  1763. return createEmptyVNode();
  1764. }
  1765. // warn against non-primitive key
  1766. if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
  1767. warn$2('Avoid using non-primitive value as key, ' +
  1768. 'use string/number value instead.', context);
  1769. }
  1770. // support single function children as default scoped slot
  1771. if (isArray(children) && isFunction(children[0])) {
  1772. data = data || {};
  1773. data.scopedSlots = { default: children[0] };
  1774. children.length = 0;
  1775. }
  1776. if (normalizationType === ALWAYS_NORMALIZE) {
  1777. children = normalizeChildren(children);
  1778. }
  1779. else if (normalizationType === SIMPLE_NORMALIZE) {
  1780. children = simpleNormalizeChildren(children);
  1781. }
  1782. var vnode, ns;
  1783. if (typeof tag === 'string') {
  1784. var Ctor = void 0;
  1785. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  1786. if (config.isReservedTag(tag)) {
  1787. // platform built-in elements
  1788. if (process.env.NODE_ENV !== 'production' &&
  1789. isDef(data) &&
  1790. isDef(data.nativeOn) &&
  1791. data.tag !== 'component') {
  1792. warn$2("The .native modifier for v-on is only valid on components but it was used on <".concat(tag, ">."), context);
  1793. }
  1794. vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);
  1795. }
  1796. else if ((!data || !data.pre) &&
  1797. isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
  1798. // component
  1799. vnode = createComponent(Ctor, data, context, children, tag);
  1800. }
  1801. else {
  1802. // unknown or unlisted namespaced elements
  1803. // check at runtime because it may get assigned a namespace when its
  1804. // parent normalizes children
  1805. vnode = new VNode(tag, data, children, undefined, undefined, context);
  1806. }
  1807. }
  1808. else {
  1809. // direct component options / constructor
  1810. vnode = createComponent(tag, data, context, children);
  1811. }
  1812. if (isArray(vnode)) {
  1813. return vnode;
  1814. }
  1815. else if (isDef(vnode)) {
  1816. if (isDef(ns))
  1817. applyNS(vnode, ns);
  1818. if (isDef(data))
  1819. registerDeepBindings(data);
  1820. return vnode;
  1821. }
  1822. else {
  1823. return createEmptyVNode();
  1824. }
  1825. }
  1826. function applyNS(vnode, ns, force) {
  1827. vnode.ns = ns;
  1828. if (vnode.tag === 'foreignObject') {
  1829. // use default namespace inside foreignObject
  1830. ns = undefined;
  1831. force = true;
  1832. }
  1833. if (isDef(vnode.children)) {
  1834. for (var i = 0, l = vnode.children.length; i < l; i++) {
  1835. var child = vnode.children[i];
  1836. if (isDef(child.tag) &&
  1837. (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  1838. applyNS(child, ns, force);
  1839. }
  1840. }
  1841. }
  1842. }
  1843. // ref #5318
  1844. // necessary to ensure parent re-render when deep bindings like :style and
  1845. // :class are used on slot nodes
  1846. function registerDeepBindings(data) {
  1847. if (isObject(data.style)) {
  1848. traverse(data.style);
  1849. }
  1850. if (isObject(data.class)) {
  1851. traverse(data.class);
  1852. }
  1853. }
  1854. /**
  1855. * Runtime helper for rendering v-for lists.
  1856. */
  1857. function renderList(val, render) {
  1858. var ret = null, i, l, keys, key;
  1859. if (isArray(val) || typeof val === 'string') {
  1860. ret = new Array(val.length);
  1861. for (i = 0, l = val.length; i < l; i++) {
  1862. ret[i] = render(val[i], i);
  1863. }
  1864. }
  1865. else if (typeof val === 'number') {
  1866. ret = new Array(val);
  1867. for (i = 0; i < val; i++) {
  1868. ret[i] = render(i + 1, i);
  1869. }
  1870. }
  1871. else if (isObject(val)) {
  1872. if (hasSymbol && val[Symbol.iterator]) {
  1873. ret = [];
  1874. var iterator = val[Symbol.iterator]();
  1875. var result = iterator.next();
  1876. while (!result.done) {
  1877. ret.push(render(result.value, ret.length));
  1878. result = iterator.next();
  1879. }
  1880. }
  1881. else {
  1882. keys = Object.keys(val);
  1883. ret = new Array(keys.length);
  1884. for (i = 0, l = keys.length; i < l; i++) {
  1885. key = keys[i];
  1886. ret[i] = render(val[key], key, i);
  1887. }
  1888. }
  1889. }
  1890. if (!isDef(ret)) {
  1891. ret = [];
  1892. }
  1893. ret._isVList = true;
  1894. return ret;
  1895. }
  1896. /**
  1897. * Runtime helper for rendering <slot>
  1898. */
  1899. function renderSlot(name, fallbackRender, props, bindObject) {
  1900. var scopedSlotFn = this.$scopedSlots[name];
  1901. var nodes;
  1902. if (scopedSlotFn) {
  1903. // scoped slot
  1904. props = props || {};
  1905. if (bindObject) {
  1906. if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
  1907. warn$2('slot v-bind without argument expects an Object', this);
  1908. }
  1909. props = extend(extend({}, bindObject), props);
  1910. }
  1911. nodes =
  1912. scopedSlotFn(props) ||
  1913. (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
  1914. }
  1915. else {
  1916. nodes =
  1917. this.$slots[name] ||
  1918. (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
  1919. }
  1920. var target = props && props.slot;
  1921. if (target) {
  1922. return this.$createElement('template', { slot: target }, nodes);
  1923. }
  1924. else {
  1925. return nodes;
  1926. }
  1927. }
  1928. /**
  1929. * Runtime helper for resolving filters
  1930. */
  1931. function resolveFilter(id) {
  1932. return resolveAsset(this.$options, 'filters', id, true) || identity;
  1933. }
  1934. function isKeyNotMatch(expect, actual) {
  1935. if (isArray(expect)) {
  1936. return expect.indexOf(actual) === -1;
  1937. }
  1938. else {
  1939. return expect !== actual;
  1940. }
  1941. }
  1942. /**
  1943. * Runtime helper for checking keyCodes from config.
  1944. * exposed as Vue.prototype._k
  1945. * passing in eventKeyName as last argument separately for backwards compat
  1946. */
  1947. function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
  1948. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  1949. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  1950. return isKeyNotMatch(builtInKeyName, eventKeyName);
  1951. }
  1952. else if (mappedKeyCode) {
  1953. return isKeyNotMatch(mappedKeyCode, eventKeyCode);
  1954. }
  1955. else if (eventKeyName) {
  1956. return hyphenate(eventKeyName) !== key;
  1957. }
  1958. return eventKeyCode === undefined;
  1959. }
  1960. /**
  1961. * Runtime helper for merging v-bind="object" into a VNode's data.
  1962. */
  1963. function bindObjectProps(data, tag, value, asProp, isSync) {
  1964. if (value) {
  1965. if (!isObject(value)) {
  1966. process.env.NODE_ENV !== 'production' &&
  1967. warn$2('v-bind without argument expects an Object or Array value', this);
  1968. }
  1969. else {
  1970. if (isArray(value)) {
  1971. value = toObject(value);
  1972. }
  1973. var hash = void 0;
  1974. var _loop_1 = function (key) {
  1975. if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
  1976. hash = data;
  1977. }
  1978. else {
  1979. var type = data.attrs && data.attrs.type;
  1980. hash =
  1981. asProp || config.mustUseProp(tag, type, key)
  1982. ? data.domProps || (data.domProps = {})
  1983. : data.attrs || (data.attrs = {});
  1984. }
  1985. var camelizedKey = camelize(key);
  1986. var hyphenatedKey = hyphenate(key);
  1987. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  1988. hash[key] = value[key];
  1989. if (isSync) {
  1990. var on = data.on || (data.on = {});
  1991. on["update:".concat(key)] = function ($event) {
  1992. value[key] = $event;
  1993. };
  1994. }
  1995. }
  1996. };
  1997. for (var key in value) {
  1998. _loop_1(key);
  1999. }
  2000. }
  2001. }
  2002. return data;
  2003. }
  2004. /**
  2005. * Runtime helper for rendering static trees.
  2006. */
  2007. function renderStatic(index, isInFor) {
  2008. var cached = this._staticTrees || (this._staticTrees = []);
  2009. var tree = cached[index];
  2010. // if has already-rendered static tree and not inside v-for,
  2011. // we can reuse the same tree.
  2012. if (tree && !isInFor) {
  2013. return tree;
  2014. }
  2015. // otherwise, render a fresh tree.
  2016. tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
  2017. );
  2018. markStatic$1(tree, "__static__".concat(index), false);
  2019. return tree;
  2020. }
  2021. /**
  2022. * Runtime helper for v-once.
  2023. * Effectively it means marking the node as static with a unique key.
  2024. */
  2025. function markOnce(tree, index, key) {
  2026. markStatic$1(tree, "__once__".concat(index).concat(key ? "_".concat(key) : ""), true);
  2027. return tree;
  2028. }
  2029. function markStatic$1(tree, key, isOnce) {
  2030. if (isArray(tree)) {
  2031. for (var i = 0; i < tree.length; i++) {
  2032. if (tree[i] && typeof tree[i] !== 'string') {
  2033. markStaticNode(tree[i], "".concat(key, "_").concat(i), isOnce);
  2034. }
  2035. }
  2036. }
  2037. else {
  2038. markStaticNode(tree, key, isOnce);
  2039. }
  2040. }
  2041. function markStaticNode(node, key, isOnce) {
  2042. node.isStatic = true;
  2043. node.key = key;
  2044. node.isOnce = isOnce;
  2045. }
  2046. function bindObjectListeners(data, value) {
  2047. if (value) {
  2048. if (!isPlainObject(value)) {
  2049. process.env.NODE_ENV !== 'production' && warn$2('v-on without argument expects an Object value', this);
  2050. }
  2051. else {
  2052. var on = (data.on = data.on ? extend({}, data.on) : {});
  2053. for (var key in value) {
  2054. var existing = on[key];
  2055. var ours = value[key];
  2056. on[key] = existing ? [].concat(existing, ours) : ours;
  2057. }
  2058. }
  2059. }
  2060. return data;
  2061. }
  2062. function resolveScopedSlots(fns, res,
  2063. // the following are added in 2.6
  2064. hasDynamicKeys, contentHashKey) {
  2065. res = res || { $stable: !hasDynamicKeys };
  2066. for (var i = 0; i < fns.length; i++) {
  2067. var slot = fns[i];
  2068. if (isArray(slot)) {
  2069. resolveScopedSlots(slot, res, hasDynamicKeys);
  2070. }
  2071. else if (slot) {
  2072. // marker for reverse proxying v-slot without scope on this.$slots
  2073. // @ts-expect-error
  2074. if (slot.proxy) {
  2075. // @ts-expect-error
  2076. slot.fn.proxy = true;
  2077. }
  2078. res[slot.key] = slot.fn;
  2079. }
  2080. }
  2081. if (contentHashKey) {
  2082. res.$key = contentHashKey;
  2083. }
  2084. return res;
  2085. }
  2086. // helper to process dynamic keys for dynamic arguments in v-bind and v-on.
  2087. function bindDynamicKeys(baseObj, values) {
  2088. for (var i = 0; i < values.length; i += 2) {
  2089. var key = values[i];
  2090. if (typeof key === 'string' && key) {
  2091. baseObj[values[i]] = values[i + 1];
  2092. }
  2093. else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
  2094. // null is a special value for explicitly removing a binding
  2095. warn$2("Invalid value for dynamic directive argument (expected string or null): ".concat(key), this);
  2096. }
  2097. }
  2098. return baseObj;
  2099. }
  2100. // helper to dynamically append modifier runtime markers to event names.
  2101. // ensure only append when value is already string, otherwise it will be cast
  2102. // to string and cause the type check to miss.
  2103. function prependModifier(value, symbol) {
  2104. return typeof value === 'string' ? symbol + value : value;
  2105. }
  2106. function installRenderHelpers(target) {
  2107. target._o = markOnce;
  2108. target._n = toNumber;
  2109. target._s = toString;
  2110. target._l = renderList;
  2111. target._t = renderSlot;
  2112. target._q = looseEqual;
  2113. target._i = looseIndexOf;
  2114. target._m = renderStatic;
  2115. target._f = resolveFilter;
  2116. target._k = checkKeyCodes;
  2117. target._b = bindObjectProps;
  2118. target._v = createTextVNode;
  2119. target._e = createEmptyVNode;
  2120. target._u = resolveScopedSlots;
  2121. target._g = bindObjectListeners;
  2122. target._d = bindDynamicKeys;
  2123. target._p = prependModifier;
  2124. }
  2125. /**
  2126. * Runtime helper for resolving raw children VNodes into a slot object.
  2127. */
  2128. function resolveSlots(children, context) {
  2129. if (!children || !children.length) {
  2130. return {};
  2131. }
  2132. var slots = {};
  2133. for (var i = 0, l = children.length; i < l; i++) {
  2134. var child = children[i];
  2135. var data = child.data;
  2136. // remove slot attribute if the node is resolved as a Vue slot node
  2137. if (data && data.attrs && data.attrs.slot) {
  2138. delete data.attrs.slot;
  2139. }
  2140. // named slots should only be respected if the vnode was rendered in the
  2141. // same context.
  2142. if ((child.context === context || child.fnContext === context) &&
  2143. data &&
  2144. data.slot != null) {
  2145. var name_1 = data.slot;
  2146. var slot = slots[name_1] || (slots[name_1] = []);
  2147. if (child.tag === 'template') {
  2148. slot.push.apply(slot, child.children || []);
  2149. }
  2150. else {
  2151. slot.push(child);
  2152. }
  2153. }
  2154. else {
  2155. (slots.default || (slots.default = [])).push(child);
  2156. }
  2157. }
  2158. // ignore slots that contains only whitespace
  2159. for (var name_2 in slots) {
  2160. if (slots[name_2].every(isWhitespace)) {
  2161. delete slots[name_2];
  2162. }
  2163. }
  2164. return slots;
  2165. }
  2166. function isWhitespace(node) {
  2167. return (node.isComment && !node.asyncFactory) || node.text === ' ';
  2168. }
  2169. function isAsyncPlaceholder(node) {
  2170. // @ts-expect-error not really boolean type
  2171. return node.isComment && node.asyncFactory;
  2172. }
  2173. function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
  2174. var res;
  2175. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2176. var isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
  2177. var key = scopedSlots && scopedSlots.$key;
  2178. if (!scopedSlots) {
  2179. res = {};
  2180. }
  2181. else if (scopedSlots._normalized) {
  2182. // fast path 1: child component re-render only, parent did not change
  2183. return scopedSlots._normalized;
  2184. }
  2185. else if (isStable &&
  2186. prevScopedSlots &&
  2187. prevScopedSlots !== emptyObject &&
  2188. key === prevScopedSlots.$key &&
  2189. !hasNormalSlots &&
  2190. !prevScopedSlots.$hasNormal) {
  2191. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2192. // only need to normalize once
  2193. return prevScopedSlots;
  2194. }
  2195. else {
  2196. res = {};
  2197. for (var key_1 in scopedSlots) {
  2198. if (scopedSlots[key_1] && key_1[0] !== '$') {
  2199. res[key_1] = normalizeScopedSlot(ownerVm, normalSlots, key_1, scopedSlots[key_1]);
  2200. }
  2201. }
  2202. }
  2203. // expose normal slots on scopedSlots
  2204. for (var key_2 in normalSlots) {
  2205. if (!(key_2 in res)) {
  2206. res[key_2] = proxyNormalSlot(normalSlots, key_2);
  2207. }
  2208. }
  2209. // avoriaz seems to mock a non-extensible $scopedSlots object
  2210. // and when that is passed down this would cause an error
  2211. if (scopedSlots && Object.isExtensible(scopedSlots)) {
  2212. scopedSlots._normalized = res;
  2213. }
  2214. def(res, '$stable', isStable);
  2215. def(res, '$key', key);
  2216. def(res, '$hasNormal', hasNormalSlots);
  2217. return res;
  2218. }
  2219. function normalizeScopedSlot(vm, normalSlots, key, fn) {
  2220. var normalized = function () {
  2221. var cur = currentInstance;
  2222. setCurrentInstance(vm);
  2223. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2224. res =
  2225. res && typeof res === 'object' && !isArray(res)
  2226. ? [res] // single vnode
  2227. : normalizeChildren(res);
  2228. var vnode = res && res[0];
  2229. setCurrentInstance(cur);
  2230. return res &&
  2231. (!vnode ||
  2232. (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
  2233. ? undefined
  2234. : res;
  2235. };
  2236. // this is a slot using the new v-slot syntax without scope. although it is
  2237. // compiled as a scoped slot, render fn users would expect it to be present
  2238. // on this.$slots because the usage is semantically a normal slot.
  2239. if (fn.proxy) {
  2240. Object.defineProperty(normalSlots, key, {
  2241. get: normalized,
  2242. enumerable: true,
  2243. configurable: true
  2244. });
  2245. }
  2246. return normalized;
  2247. }
  2248. function proxyNormalSlot(slots, key) {
  2249. return function () { return slots[key]; };
  2250. }
  2251. function initSetup(vm) {
  2252. var options = vm.$options;
  2253. var setup = options.setup;
  2254. if (setup) {
  2255. var ctx = (vm._setupContext = createSetupContext(vm));
  2256. setCurrentInstance(vm);
  2257. pushTarget();
  2258. var setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, "setup");
  2259. popTarget();
  2260. setCurrentInstance();
  2261. if (isFunction(setupResult)) {
  2262. // render function
  2263. // @ts-ignore
  2264. options.render = setupResult;
  2265. }
  2266. else if (isObject(setupResult)) {
  2267. // bindings
  2268. if (process.env.NODE_ENV !== 'production' && setupResult instanceof VNode) {
  2269. warn$2("setup() should not return VNodes directly - " +
  2270. "return a render function instead.");
  2271. }
  2272. vm._setupState = setupResult;
  2273. // __sfc indicates compiled bindings from <script setup>
  2274. if (!setupResult.__sfc) {
  2275. for (var key in setupResult) {
  2276. if (!isReserved(key)) {
  2277. proxyWithRefUnwrap(vm, setupResult, key);
  2278. }
  2279. else if (process.env.NODE_ENV !== 'production') {
  2280. warn$2("Avoid using variables that start with _ or $ in setup().");
  2281. }
  2282. }
  2283. }
  2284. else {
  2285. // exposed for compiled render fn
  2286. var proxy = (vm._setupProxy = {});
  2287. for (var key in setupResult) {
  2288. if (key !== '__sfc') {
  2289. proxyWithRefUnwrap(proxy, setupResult, key);
  2290. }
  2291. }
  2292. }
  2293. }
  2294. else if (process.env.NODE_ENV !== 'production' && setupResult !== undefined) {
  2295. warn$2("setup() should return an object. Received: ".concat(setupResult === null ? 'null' : typeof setupResult));
  2296. }
  2297. }
  2298. }
  2299. function createSetupContext(vm) {
  2300. var exposeCalled = false;
  2301. return {
  2302. get attrs() {
  2303. if (!vm._attrsProxy) {
  2304. var proxy = (vm._attrsProxy = {});
  2305. def(proxy, '_v_attr_proxy', true);
  2306. syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
  2307. }
  2308. return vm._attrsProxy;
  2309. },
  2310. get listeners() {
  2311. if (!vm._listenersProxy) {
  2312. var proxy = (vm._listenersProxy = {});
  2313. syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
  2314. }
  2315. return vm._listenersProxy;
  2316. },
  2317. get slots() {
  2318. return initSlotsProxy(vm);
  2319. },
  2320. emit: bind$1(vm.$emit, vm),
  2321. expose: function (exposed) {
  2322. if (process.env.NODE_ENV !== 'production') {
  2323. if (exposeCalled) {
  2324. warn$2("expose() should be called only once per setup().", vm);
  2325. }
  2326. exposeCalled = true;
  2327. }
  2328. if (exposed) {
  2329. Object.keys(exposed).forEach(function (key) {
  2330. return proxyWithRefUnwrap(vm, exposed, key);
  2331. });
  2332. }
  2333. }
  2334. };
  2335. }
  2336. function syncSetupProxy(to, from, prev, instance, type) {
  2337. var changed = false;
  2338. for (var key in from) {
  2339. if (!(key in to)) {
  2340. changed = true;
  2341. defineProxyAttr(to, key, instance, type);
  2342. }
  2343. else if (from[key] !== prev[key]) {
  2344. changed = true;
  2345. }
  2346. }
  2347. for (var key in to) {
  2348. if (!(key in from)) {
  2349. changed = true;
  2350. delete to[key];
  2351. }
  2352. }
  2353. return changed;
  2354. }
  2355. function defineProxyAttr(proxy, key, instance, type) {
  2356. Object.defineProperty(proxy, key, {
  2357. enumerable: true,
  2358. configurable: true,
  2359. get: function () {
  2360. return instance[type][key];
  2361. }
  2362. });
  2363. }
  2364. function initSlotsProxy(vm) {
  2365. if (!vm._slotsProxy) {
  2366. syncSetupSlots((vm._slotsProxy = {}), vm.$scopedSlots);
  2367. }
  2368. return vm._slotsProxy;
  2369. }
  2370. function syncSetupSlots(to, from) {
  2371. for (var key in from) {
  2372. to[key] = from[key];
  2373. }
  2374. for (var key in to) {
  2375. if (!(key in from)) {
  2376. delete to[key];
  2377. }
  2378. }
  2379. }
  2380. /**
  2381. * @internal use manual type def because public setup context type relies on
  2382. * legacy VNode types
  2383. */
  2384. function useSlots() {
  2385. return getContext().slots;
  2386. }
  2387. /**
  2388. * @internal use manual type def because public setup context type relies on
  2389. * legacy VNode types
  2390. */
  2391. function useAttrs() {
  2392. return getContext().attrs;
  2393. }
  2394. /**
  2395. * Vue 2 only
  2396. * @internal use manual type def because public setup context type relies on
  2397. * legacy VNode types
  2398. */
  2399. function useListeners() {
  2400. return getContext().listeners;
  2401. }
  2402. function getContext() {
  2403. if (process.env.NODE_ENV !== 'production' && !currentInstance) {
  2404. warn$2("useContext() called without active instance.");
  2405. }
  2406. var vm = currentInstance;
  2407. return vm._setupContext || (vm._setupContext = createSetupContext(vm));
  2408. }
  2409. /**
  2410. * Runtime helper for merging default declarations. Imported by compiled code
  2411. * only.
  2412. * @internal
  2413. */
  2414. function mergeDefaults(raw, defaults) {
  2415. var props = isArray(raw)
  2416. ? raw.reduce(function (normalized, p) { return ((normalized[p] = {}), normalized); }, {})
  2417. : raw;
  2418. for (var key in defaults) {
  2419. var opt = props[key];
  2420. if (opt) {
  2421. if (isArray(opt) || isFunction(opt)) {
  2422. props[key] = { type: opt, default: defaults[key] };
  2423. }
  2424. else {
  2425. opt.default = defaults[key];
  2426. }
  2427. }
  2428. else if (opt === null) {
  2429. props[key] = { default: defaults[key] };
  2430. }
  2431. else if (process.env.NODE_ENV !== 'production') {
  2432. warn$2("props default key \"".concat(key, "\" has no corresponding declaration."));
  2433. }
  2434. }
  2435. return props;
  2436. }
  2437. function initRender(vm) {
  2438. vm._vnode = null; // the root of the child tree
  2439. vm._staticTrees = null; // v-once cached trees
  2440. var options = vm.$options;
  2441. var parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
  2442. var renderContext = parentVnode && parentVnode.context;
  2443. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  2444. vm.$scopedSlots = parentVnode
  2445. ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
  2446. : emptyObject;
  2447. // bind the createElement fn to this instance
  2448. // so that we get proper render context inside it.
  2449. // args order: tag, data, children, normalizationType, alwaysNormalize
  2450. // internal version is used by render functions compiled from templates
  2451. // @ts-expect-error
  2452. vm._c = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, false); };
  2453. // normalization is always applied for the public version, used in
  2454. // user-written render functions.
  2455. // @ts-expect-error
  2456. vm.$createElement = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, true); };
  2457. // $attrs & $listeners are exposed for easier HOC creation.
  2458. // they need to be reactive so that HOCs using them are always updated
  2459. var parentData = parentVnode && parentVnode.data;
  2460. /* istanbul ignore else */
  2461. if (process.env.NODE_ENV !== 'production') {
  2462. defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, function () {
  2463. !isUpdatingChildComponent && warn$2("$attrs is readonly.", vm);
  2464. }, true);
  2465. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  2466. !isUpdatingChildComponent && warn$2("$listeners is readonly.", vm);
  2467. }, true);
  2468. }
  2469. else {
  2470. defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, null, true);
  2471. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  2472. }
  2473. }
  2474. var currentRenderingInstance = null;
  2475. function renderMixin(Vue) {
  2476. // install runtime convenience helpers
  2477. installRenderHelpers(Vue.prototype);
  2478. Vue.prototype.$nextTick = function (fn) {
  2479. return nextTick(fn, this);
  2480. };
  2481. Vue.prototype._render = function () {
  2482. var vm = this;
  2483. var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
  2484. if (_parentVnode && vm._isMounted) {
  2485. vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
  2486. if (vm._slotsProxy) {
  2487. syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
  2488. }
  2489. }
  2490. // set parent vnode. this allows render functions to have access
  2491. // to the data on the placeholder node.
  2492. vm.$vnode = _parentVnode;
  2493. // render self
  2494. var vnode;
  2495. try {
  2496. // There's no need to maintain a stack because all render fns are called
  2497. // separately from one another. Nested component's render fns are called
  2498. // when parent component is patched.
  2499. setCurrentInstance(vm);
  2500. currentRenderingInstance = vm;
  2501. vnode = render.call(vm._renderProxy, vm.$createElement);
  2502. }
  2503. catch (e) {
  2504. handleError(e, vm, "render");
  2505. // return error render result,
  2506. // or previous vnode to prevent render error causing blank component
  2507. /* istanbul ignore else */
  2508. if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
  2509. try {
  2510. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  2511. }
  2512. catch (e) {
  2513. handleError(e, vm, "renderError");
  2514. vnode = vm._vnode;
  2515. }
  2516. }
  2517. else {
  2518. vnode = vm._vnode;
  2519. }
  2520. }
  2521. finally {
  2522. currentRenderingInstance = null;
  2523. setCurrentInstance();
  2524. }
  2525. // if the returned array contains only a single node, allow it
  2526. if (isArray(vnode) && vnode.length === 1) {
  2527. vnode = vnode[0];
  2528. }
  2529. // return empty vnode in case the render function errored out
  2530. if (!(vnode instanceof VNode)) {
  2531. if (process.env.NODE_ENV !== 'production' && isArray(vnode)) {
  2532. warn$2('Multiple root nodes returned from render function. Render function ' +
  2533. 'should return a single root node.', vm);
  2534. }
  2535. vnode = createEmptyVNode();
  2536. }
  2537. // set parent
  2538. vnode.parent = _parentVnode;
  2539. return vnode;
  2540. };
  2541. }
  2542. function ensureCtor(comp, base) {
  2543. if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
  2544. comp = comp.default;
  2545. }
  2546. return isObject(comp) ? base.extend(comp) : comp;
  2547. }
  2548. function createAsyncPlaceholder(factory, data, context, children, tag) {
  2549. var node = createEmptyVNode();
  2550. node.asyncFactory = factory;
  2551. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  2552. return node;
  2553. }
  2554. function resolveAsyncComponent(factory, baseCtor) {
  2555. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  2556. return factory.errorComp;
  2557. }
  2558. if (isDef(factory.resolved)) {
  2559. return factory.resolved;
  2560. }
  2561. var owner = currentRenderingInstance;
  2562. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  2563. // already pending
  2564. factory.owners.push(owner);
  2565. }
  2566. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  2567. return factory.loadingComp;
  2568. }
  2569. if (owner && !isDef(factory.owners)) {
  2570. var owners_1 = (factory.owners = [owner]);
  2571. var sync_1 = true;
  2572. var timerLoading_1 = null;
  2573. var timerTimeout_1 = null;
  2574. owner.$on('hook:destroyed', function () { return remove$2(owners_1, owner); });
  2575. var forceRender_1 = function (renderCompleted) {
  2576. for (var i = 0, l = owners_1.length; i < l; i++) {
  2577. owners_1[i].$forceUpdate();
  2578. }
  2579. if (renderCompleted) {
  2580. owners_1.length = 0;
  2581. if (timerLoading_1 !== null) {
  2582. clearTimeout(timerLoading_1);
  2583. timerLoading_1 = null;
  2584. }
  2585. if (timerTimeout_1 !== null) {
  2586. clearTimeout(timerTimeout_1);
  2587. timerTimeout_1 = null;
  2588. }
  2589. }
  2590. };
  2591. var resolve = once(function (res) {
  2592. // cache resolved
  2593. factory.resolved = ensureCtor(res, baseCtor);
  2594. // invoke callbacks only if this is not a synchronous resolve
  2595. // (async resolves are shimmed as synchronous during SSR)
  2596. if (!sync_1) {
  2597. forceRender_1(true);
  2598. }
  2599. else {
  2600. owners_1.length = 0;
  2601. }
  2602. });
  2603. var reject_1 = once(function (reason) {
  2604. process.env.NODE_ENV !== 'production' &&
  2605. warn$2("Failed to resolve async component: ".concat(String(factory)) +
  2606. (reason ? "\nReason: ".concat(reason) : ''));
  2607. if (isDef(factory.errorComp)) {
  2608. factory.error = true;
  2609. forceRender_1(true);
  2610. }
  2611. });
  2612. var res_1 = factory(resolve, reject_1);
  2613. if (isObject(res_1)) {
  2614. if (isPromise(res_1)) {
  2615. // () => Promise
  2616. if (isUndef(factory.resolved)) {
  2617. res_1.then(resolve, reject_1);
  2618. }
  2619. }
  2620. else if (isPromise(res_1.component)) {
  2621. res_1.component.then(resolve, reject_1);
  2622. if (isDef(res_1.error)) {
  2623. factory.errorComp = ensureCtor(res_1.error, baseCtor);
  2624. }
  2625. if (isDef(res_1.loading)) {
  2626. factory.loadingComp = ensureCtor(res_1.loading, baseCtor);
  2627. if (res_1.delay === 0) {
  2628. factory.loading = true;
  2629. }
  2630. else {
  2631. // @ts-expect-error NodeJS timeout type
  2632. timerLoading_1 = setTimeout(function () {
  2633. timerLoading_1 = null;
  2634. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2635. factory.loading = true;
  2636. forceRender_1(false);
  2637. }
  2638. }, res_1.delay || 200);
  2639. }
  2640. }
  2641. if (isDef(res_1.timeout)) {
  2642. // @ts-expect-error NodeJS timeout type
  2643. timerTimeout_1 = setTimeout(function () {
  2644. timerTimeout_1 = null;
  2645. if (isUndef(factory.resolved)) {
  2646. reject_1(process.env.NODE_ENV !== 'production' ? "timeout (".concat(res_1.timeout, "ms)") : null);
  2647. }
  2648. }, res_1.timeout);
  2649. }
  2650. }
  2651. }
  2652. sync_1 = false;
  2653. // return in case resolved synchronously
  2654. return factory.loading ? factory.loadingComp : factory.resolved;
  2655. }
  2656. }
  2657. function getFirstComponentChild(children) {
  2658. if (isArray(children)) {
  2659. for (var i = 0; i < children.length; i++) {
  2660. var c = children[i];
  2661. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2662. return c;
  2663. }
  2664. }
  2665. }
  2666. }
  2667. function initEvents(vm) {
  2668. vm._events = Object.create(null);
  2669. vm._hasHookEvent = false;
  2670. // init parent attached events
  2671. var listeners = vm.$options._parentListeners;
  2672. if (listeners) {
  2673. updateComponentListeners(vm, listeners);
  2674. }
  2675. }
  2676. var target$1;
  2677. function add$1(event, fn) {
  2678. target$1.$on(event, fn);
  2679. }
  2680. function remove$1(event, fn) {
  2681. target$1.$off(event, fn);
  2682. }
  2683. function createOnceHandler$1(event, fn) {
  2684. var _target = target$1;
  2685. return function onceHandler() {
  2686. var res = fn.apply(null, arguments);
  2687. if (res !== null) {
  2688. _target.$off(event, onceHandler);
  2689. }
  2690. };
  2691. }
  2692. function updateComponentListeners(vm, listeners, oldListeners) {
  2693. target$1 = vm;
  2694. updateListeners(listeners, oldListeners || {}, add$1, remove$1, createOnceHandler$1, vm);
  2695. target$1 = undefined;
  2696. }
  2697. function eventsMixin(Vue) {
  2698. var hookRE = /^hook:/;
  2699. Vue.prototype.$on = function (event, fn) {
  2700. var vm = this;
  2701. if (isArray(event)) {
  2702. for (var i = 0, l = event.length; i < l; i++) {
  2703. vm.$on(event[i], fn);
  2704. }
  2705. }
  2706. else {
  2707. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2708. // optimize hook:event cost by using a boolean flag marked at registration
  2709. // instead of a hash lookup
  2710. if (hookRE.test(event)) {
  2711. vm._hasHookEvent = true;
  2712. }
  2713. }
  2714. return vm;
  2715. };
  2716. Vue.prototype.$once = function (event, fn) {
  2717. var vm = this;
  2718. function on() {
  2719. vm.$off(event, on);
  2720. fn.apply(vm, arguments);
  2721. }
  2722. on.fn = fn;
  2723. vm.$on(event, on);
  2724. return vm;
  2725. };
  2726. Vue.prototype.$off = function (event, fn) {
  2727. var vm = this;
  2728. // all
  2729. if (!arguments.length) {
  2730. vm._events = Object.create(null);
  2731. return vm;
  2732. }
  2733. // array of events
  2734. if (isArray(event)) {
  2735. for (var i_1 = 0, l = event.length; i_1 < l; i_1++) {
  2736. vm.$off(event[i_1], fn);
  2737. }
  2738. return vm;
  2739. }
  2740. // specific event
  2741. var cbs = vm._events[event];
  2742. if (!cbs) {
  2743. return vm;
  2744. }
  2745. if (!fn) {
  2746. vm._events[event] = null;
  2747. return vm;
  2748. }
  2749. // specific handler
  2750. var cb;
  2751. var i = cbs.length;
  2752. while (i--) {
  2753. cb = cbs[i];
  2754. if (cb === fn || cb.fn === fn) {
  2755. cbs.splice(i, 1);
  2756. break;
  2757. }
  2758. }
  2759. return vm;
  2760. };
  2761. Vue.prototype.$emit = function (event) {
  2762. var vm = this;
  2763. if (process.env.NODE_ENV !== 'production') {
  2764. var lowerCaseEvent = event.toLowerCase();
  2765. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  2766. tip("Event \"".concat(lowerCaseEvent, "\" is emitted in component ") +
  2767. "".concat(formatComponentName(vm), " but the handler is registered for \"").concat(event, "\". ") +
  2768. "Note that HTML attributes are case-insensitive and you cannot use " +
  2769. "v-on to listen to camelCase events when using in-DOM templates. " +
  2770. "You should probably use \"".concat(hyphenate(event), "\" instead of \"").concat(event, "\"."));
  2771. }
  2772. }
  2773. var cbs = vm._events[event];
  2774. if (cbs) {
  2775. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2776. var args = toArray(arguments, 1);
  2777. var info = "event handler for \"".concat(event, "\"");
  2778. for (var i = 0, l = cbs.length; i < l; i++) {
  2779. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  2780. }
  2781. }
  2782. return vm;
  2783. };
  2784. }
  2785. var activeInstance = null;
  2786. var isUpdatingChildComponent = false;
  2787. function setActiveInstance(vm) {
  2788. var prevActiveInstance = activeInstance;
  2789. activeInstance = vm;
  2790. return function () {
  2791. activeInstance = prevActiveInstance;
  2792. };
  2793. }
  2794. function initLifecycle(vm) {
  2795. var options = vm.$options;
  2796. // locate first non-abstract parent
  2797. var parent = options.parent;
  2798. if (parent && !options.abstract) {
  2799. while (parent.$options.abstract && parent.$parent) {
  2800. parent = parent.$parent;
  2801. }
  2802. parent.$children.push(vm);
  2803. }
  2804. vm.$parent = parent;
  2805. vm.$root = parent ? parent.$root : vm;
  2806. vm.$children = [];
  2807. vm.$refs = {};
  2808. vm._provided = parent ? parent._provided : Object.create(null);
  2809. vm._watcher = null;
  2810. vm._inactive = null;
  2811. vm._directInactive = false;
  2812. vm._isMounted = false;
  2813. vm._isDestroyed = false;
  2814. vm._isBeingDestroyed = false;
  2815. }
  2816. function lifecycleMixin(Vue) {
  2817. Vue.prototype._update = function (vnode, hydrating) {
  2818. var vm = this;
  2819. var prevEl = vm.$el;
  2820. var prevVnode = vm._vnode;
  2821. var restoreActiveInstance = setActiveInstance(vm);
  2822. vm._vnode = vnode;
  2823. // Vue.prototype.__patch__ is injected in entry points
  2824. // based on the rendering backend used.
  2825. if (!prevVnode) {
  2826. // initial render
  2827. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  2828. }
  2829. else {
  2830. // updates
  2831. vm.$el = vm.__patch__(prevVnode, vnode);
  2832. }
  2833. restoreActiveInstance();
  2834. // update __vue__ reference
  2835. if (prevEl) {
  2836. prevEl.__vue__ = null;
  2837. }
  2838. if (vm.$el) {
  2839. vm.$el.__vue__ = vm;
  2840. }
  2841. // if parent is an HOC, update its $el as well
  2842. var wrapper = vm;
  2843. while (wrapper &&
  2844. wrapper.$vnode &&
  2845. wrapper.$parent &&
  2846. wrapper.$vnode === wrapper.$parent._vnode) {
  2847. wrapper.$parent.$el = wrapper.$el;
  2848. wrapper = wrapper.$parent;
  2849. }
  2850. // updated hook is called by the scheduler to ensure that children are
  2851. // updated in a parent's updated hook.
  2852. };
  2853. Vue.prototype.$forceUpdate = function () {
  2854. var vm = this;
  2855. if (vm._watcher) {
  2856. vm._watcher.update();
  2857. }
  2858. };
  2859. Vue.prototype.$destroy = function () {
  2860. var vm = this;
  2861. if (vm._isBeingDestroyed) {
  2862. return;
  2863. }
  2864. callHook$1(vm, 'beforeDestroy');
  2865. vm._isBeingDestroyed = true;
  2866. // remove self from parent
  2867. var parent = vm.$parent;
  2868. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2869. remove$2(parent.$children, vm);
  2870. }
  2871. // teardown scope. this includes both the render watcher and other
  2872. // watchers created
  2873. vm._scope.stop();
  2874. // remove reference from data ob
  2875. // frozen object may not have observer.
  2876. if (vm._data.__ob__) {
  2877. vm._data.__ob__.vmCount--;
  2878. }
  2879. // call the last hook...
  2880. vm._isDestroyed = true;
  2881. // invoke destroy hooks on current rendered tree
  2882. vm.__patch__(vm._vnode, null);
  2883. // fire destroyed hook
  2884. callHook$1(vm, 'destroyed');
  2885. // turn off all instance listeners.
  2886. vm.$off();
  2887. // remove __vue__ reference
  2888. if (vm.$el) {
  2889. vm.$el.__vue__ = null;
  2890. }
  2891. // release circular reference (#6759)
  2892. if (vm.$vnode) {
  2893. vm.$vnode.parent = null;
  2894. }
  2895. };
  2896. }
  2897. function mountComponent(vm, el, hydrating) {
  2898. vm.$el = el;
  2899. if (!vm.$options.render) {
  2900. // @ts-expect-error invalid type
  2901. vm.$options.render = createEmptyVNode;
  2902. if (process.env.NODE_ENV !== 'production') {
  2903. /* istanbul ignore if */
  2904. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  2905. vm.$options.el ||
  2906. el) {
  2907. warn$2('You are using the runtime-only build of Vue where the template ' +
  2908. 'compiler is not available. Either pre-compile the templates into ' +
  2909. 'render functions, or use the compiler-included build.', vm);
  2910. }
  2911. else {
  2912. warn$2('Failed to mount component: template or render function not defined.', vm);
  2913. }
  2914. }
  2915. }
  2916. callHook$1(vm, 'beforeMount');
  2917. var updateComponent;
  2918. /* istanbul ignore if */
  2919. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  2920. updateComponent = function () {
  2921. var name = vm._name;
  2922. var id = vm._uid;
  2923. var startTag = "vue-perf-start:".concat(id);
  2924. var endTag = "vue-perf-end:".concat(id);
  2925. mark(startTag);
  2926. var vnode = vm._render();
  2927. mark(endTag);
  2928. measure("vue ".concat(name, " render"), startTag, endTag);
  2929. mark(startTag);
  2930. vm._update(vnode, hydrating);
  2931. mark(endTag);
  2932. measure("vue ".concat(name, " patch"), startTag, endTag);
  2933. };
  2934. }
  2935. else {
  2936. updateComponent = function () {
  2937. vm._update(vm._render(), hydrating);
  2938. };
  2939. }
  2940. var watcherOptions = {
  2941. before: function () {
  2942. if (vm._isMounted && !vm._isDestroyed) {
  2943. callHook$1(vm, 'beforeUpdate');
  2944. }
  2945. }
  2946. };
  2947. if (process.env.NODE_ENV !== 'production') {
  2948. watcherOptions.onTrack = function (e) { return callHook$1(vm, 'renderTracked', [e]); };
  2949. watcherOptions.onTrigger = function (e) { return callHook$1(vm, 'renderTriggered', [e]); };
  2950. }
  2951. // we set this to vm._watcher inside the watcher's constructor
  2952. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  2953. // component's mounted hook), which relies on vm._watcher being already defined
  2954. new Watcher(vm, updateComponent, noop, watcherOptions, true /* isRenderWatcher */);
  2955. hydrating = false;
  2956. // flush buffer for flush: "pre" watchers queued in setup()
  2957. var preWatchers = vm._preWatchers;
  2958. if (preWatchers) {
  2959. for (var i = 0; i < preWatchers.length; i++) {
  2960. preWatchers[i].run();
  2961. }
  2962. }
  2963. // manually mounted instance, call mounted on self
  2964. // mounted is called for render-created child components in its inserted hook
  2965. if (vm.$vnode == null) {
  2966. vm._isMounted = true;
  2967. callHook$1(vm, 'mounted');
  2968. }
  2969. return vm;
  2970. }
  2971. function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
  2972. if (process.env.NODE_ENV !== 'production') {
  2973. isUpdatingChildComponent = true;
  2974. }
  2975. // determine whether component has slot children
  2976. // we need to do this before overwriting $options._renderChildren.
  2977. // check if there are dynamic scopedSlots (hand-written or compiled but with
  2978. // dynamic slot names). Static scoped slots compiled from template has the
  2979. // "$stable" marker.
  2980. var newScopedSlots = parentVnode.data.scopedSlots;
  2981. var oldScopedSlots = vm.$scopedSlots;
  2982. var hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) ||
  2983. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  2984. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
  2985. (!newScopedSlots && vm.$scopedSlots.$key));
  2986. // Any static slot children from the parent may have changed during parent's
  2987. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  2988. // update is necessary to ensure correctness.
  2989. var needsForceUpdate = !!(renderChildren || // has new static slots
  2990. vm.$options._renderChildren || // has old static slots
  2991. hasDynamicScopedSlot);
  2992. var prevVNode = vm.$vnode;
  2993. vm.$options._parentVnode = parentVnode;
  2994. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  2995. if (vm._vnode) {
  2996. // update child tree's parent
  2997. vm._vnode.parent = parentVnode;
  2998. }
  2999. vm.$options._renderChildren = renderChildren;
  3000. // update $attrs and $listeners hash
  3001. // these are also reactive so they may trigger child update if the child
  3002. // used them during render
  3003. var attrs = parentVnode.data.attrs || emptyObject;
  3004. if (vm._attrsProxy) {
  3005. // force update if attrs are accessed and has changed since it may be
  3006. // passed to a child component.
  3007. if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
  3008. needsForceUpdate = true;
  3009. }
  3010. }
  3011. vm.$attrs = attrs;
  3012. // update listeners
  3013. listeners = listeners || emptyObject;
  3014. var prevListeners = vm.$options._parentListeners;
  3015. if (vm._listenersProxy) {
  3016. syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
  3017. }
  3018. vm.$listeners = vm.$options._parentListeners = listeners;
  3019. updateComponentListeners(vm, listeners, prevListeners);
  3020. // update props
  3021. if (propsData && vm.$options.props) {
  3022. toggleObserving(false);
  3023. var props = vm._props;
  3024. var propKeys = vm.$options._propKeys || [];
  3025. for (var i = 0; i < propKeys.length; i++) {
  3026. var key = propKeys[i];
  3027. var propOptions = vm.$options.props; // wtf flow?
  3028. props[key] = validateProp(key, propOptions, propsData, vm);
  3029. }
  3030. toggleObserving(true);
  3031. // keep a copy of raw propsData
  3032. vm.$options.propsData = propsData;
  3033. }
  3034. // resolve slots + force update if has children
  3035. if (needsForceUpdate) {
  3036. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3037. vm.$forceUpdate();
  3038. }
  3039. if (process.env.NODE_ENV !== 'production') {
  3040. isUpdatingChildComponent = false;
  3041. }
  3042. }
  3043. function isInInactiveTree(vm) {
  3044. while (vm && (vm = vm.$parent)) {
  3045. if (vm._inactive)
  3046. return true;
  3047. }
  3048. return false;
  3049. }
  3050. function activateChildComponent(vm, direct) {
  3051. if (direct) {
  3052. vm._directInactive = false;
  3053. if (isInInactiveTree(vm)) {
  3054. return;
  3055. }
  3056. }
  3057. else if (vm._directInactive) {
  3058. return;
  3059. }
  3060. if (vm._inactive || vm._inactive === null) {
  3061. vm._inactive = false;
  3062. for (var i = 0; i < vm.$children.length; i++) {
  3063. activateChildComponent(vm.$children[i]);
  3064. }
  3065. callHook$1(vm, 'activated');
  3066. }
  3067. }
  3068. function deactivateChildComponent(vm, direct) {
  3069. if (direct) {
  3070. vm._directInactive = true;
  3071. if (isInInactiveTree(vm)) {
  3072. return;
  3073. }
  3074. }
  3075. if (!vm._inactive) {
  3076. vm._inactive = true;
  3077. for (var i = 0; i < vm.$children.length; i++) {
  3078. deactivateChildComponent(vm.$children[i]);
  3079. }
  3080. callHook$1(vm, 'deactivated');
  3081. }
  3082. }
  3083. function callHook$1(vm, hook, args, setContext) {
  3084. if (setContext === void 0) { setContext = true; }
  3085. // #7573 disable dep collection when invoking lifecycle hooks
  3086. pushTarget();
  3087. var prev = currentInstance;
  3088. setContext && setCurrentInstance(vm);
  3089. var handlers = vm.$options[hook];
  3090. var info = "".concat(hook, " hook");
  3091. if (handlers) {
  3092. for (var i = 0, j = handlers.length; i < j; i++) {
  3093. invokeWithErrorHandling(handlers[i], vm, args || null, vm, info);
  3094. }
  3095. }
  3096. if (vm._hasHookEvent) {
  3097. vm.$emit('hook:' + hook);
  3098. }
  3099. setContext && setCurrentInstance(prev);
  3100. popTarget();
  3101. }
  3102. var MAX_UPDATE_COUNT = 100;
  3103. var queue = [];
  3104. var activatedChildren = [];
  3105. var has = {};
  3106. var circular = {};
  3107. var waiting = false;
  3108. var flushing = false;
  3109. var index$1 = 0;
  3110. /**
  3111. * Reset the scheduler's state.
  3112. */
  3113. function resetSchedulerState() {
  3114. index$1 = queue.length = activatedChildren.length = 0;
  3115. has = {};
  3116. if (process.env.NODE_ENV !== 'production') {
  3117. circular = {};
  3118. }
  3119. waiting = flushing = false;
  3120. }
  3121. // Async edge case #6566 requires saving the timestamp when event listeners are
  3122. // attached. However, calling performance.now() has a perf overhead especially
  3123. // if the page has thousands of event listeners. Instead, we take a timestamp
  3124. // every time the scheduler flushes and use that for all event listeners
  3125. // attached during that flush.
  3126. var currentFlushTimestamp = 0;
  3127. // Async edge case fix requires storing an event listener's attach timestamp.
  3128. var getNow = Date.now;
  3129. // Determine what event timestamp the browser is using. Annoyingly, the
  3130. // timestamp can either be hi-res (relative to page load) or low-res
  3131. // (relative to UNIX epoch), so in order to compare time we have to use the
  3132. // same timestamp type when saving the flush timestamp.
  3133. // All IE versions use low-res event timestamps, and have problematic clock
  3134. // implementations (#9632)
  3135. if (inBrowser && !isIE) {
  3136. var performance_1 = window.performance;
  3137. if (performance_1 &&
  3138. typeof performance_1.now === 'function' &&
  3139. getNow() > document.createEvent('Event').timeStamp) {
  3140. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3141. // smaller than it, it means the event is using a hi-res timestamp,
  3142. // and we need to use the hi-res version for event listener timestamps as
  3143. // well.
  3144. getNow = function () { return performance_1.now(); };
  3145. }
  3146. }
  3147. var sortCompareFn = function (a, b) {
  3148. if (a.post) {
  3149. if (!b.post)
  3150. return 1;
  3151. }
  3152. else if (b.post) {
  3153. return -1;
  3154. }
  3155. return a.id - b.id;
  3156. };
  3157. /**
  3158. * Flush both queues and run the watchers.
  3159. */
  3160. function flushSchedulerQueue() {
  3161. currentFlushTimestamp = getNow();
  3162. flushing = true;
  3163. var watcher, id;
  3164. // Sort queue before flush.
  3165. // This ensures that:
  3166. // 1. Components are updated from parent to child. (because parent is always
  3167. // created before the child)
  3168. // 2. A component's user watchers are run before its render watcher (because
  3169. // user watchers are created before the render watcher)
  3170. // 3. If a component is destroyed during a parent component's watcher run,
  3171. // its watchers can be skipped.
  3172. queue.sort(sortCompareFn);
  3173. // do not cache length because more watchers might be pushed
  3174. // as we run existing watchers
  3175. for (index$1 = 0; index$1 < queue.length; index$1++) {
  3176. watcher = queue[index$1];
  3177. if (watcher.before) {
  3178. watcher.before();
  3179. }
  3180. id = watcher.id;
  3181. has[id] = null;
  3182. watcher.run();
  3183. // in dev build, check and stop circular updates.
  3184. if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  3185. circular[id] = (circular[id] || 0) + 1;
  3186. if (circular[id] > MAX_UPDATE_COUNT) {
  3187. warn$2('You may have an infinite update loop ' +
  3188. (watcher.user
  3189. ? "in watcher with expression \"".concat(watcher.expression, "\"")
  3190. : "in a component render function."), watcher.vm);
  3191. break;
  3192. }
  3193. }
  3194. }
  3195. // keep copies of post queues before resetting state
  3196. var activatedQueue = activatedChildren.slice();
  3197. var updatedQueue = queue.slice();
  3198. resetSchedulerState();
  3199. // call component updated and activated hooks
  3200. callActivatedHooks(activatedQueue);
  3201. callUpdatedHooks(updatedQueue);
  3202. cleanupDeps();
  3203. // devtool hook
  3204. /* istanbul ignore if */
  3205. if (devtools && config.devtools) {
  3206. devtools.emit('flush');
  3207. }
  3208. }
  3209. function callUpdatedHooks(queue) {
  3210. var i = queue.length;
  3211. while (i--) {
  3212. var watcher = queue[i];
  3213. var vm = watcher.vm;
  3214. if (vm && vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3215. callHook$1(vm, 'updated');
  3216. }
  3217. }
  3218. }
  3219. /**
  3220. * Queue a kept-alive component that was activated during patch.
  3221. * The queue will be processed after the entire tree has been patched.
  3222. */
  3223. function queueActivatedComponent(vm) {
  3224. // setting _inactive to false here so that a render function can
  3225. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3226. vm._inactive = false;
  3227. activatedChildren.push(vm);
  3228. }
  3229. function callActivatedHooks(queue) {
  3230. for (var i = 0; i < queue.length; i++) {
  3231. queue[i]._inactive = true;
  3232. activateChildComponent(queue[i], true /* true */);
  3233. }
  3234. }
  3235. /**
  3236. * Push a watcher into the watcher queue.
  3237. * Jobs with duplicate IDs will be skipped unless it's
  3238. * pushed when the queue is being flushed.
  3239. */
  3240. function queueWatcher(watcher) {
  3241. var id = watcher.id;
  3242. if (has[id] != null) {
  3243. return;
  3244. }
  3245. if (watcher === Dep.target && watcher.noRecurse) {
  3246. return;
  3247. }
  3248. has[id] = true;
  3249. if (!flushing) {
  3250. queue.push(watcher);
  3251. }
  3252. else {
  3253. // if already flushing, splice the watcher based on its id
  3254. // if already past its id, it will be run next immediately.
  3255. var i = queue.length - 1;
  3256. while (i > index$1 && queue[i].id > watcher.id) {
  3257. i--;
  3258. }
  3259. queue.splice(i + 1, 0, watcher);
  3260. }
  3261. // queue the flush
  3262. if (!waiting) {
  3263. waiting = true;
  3264. if (process.env.NODE_ENV !== 'production' && !config.async) {
  3265. flushSchedulerQueue();
  3266. return;
  3267. }
  3268. nextTick(flushSchedulerQueue);
  3269. }
  3270. }
  3271. var WATCHER = "watcher";
  3272. var WATCHER_CB = "".concat(WATCHER, " callback");
  3273. var WATCHER_GETTER = "".concat(WATCHER, " getter");
  3274. var WATCHER_CLEANUP = "".concat(WATCHER, " cleanup");
  3275. // Simple effect.
  3276. function watchEffect(effect, options) {
  3277. return doWatch(effect, null, options);
  3278. }
  3279. function watchPostEffect(effect, options) {
  3280. return doWatch(effect, null, (process.env.NODE_ENV !== 'production'
  3281. ? __assign(__assign({}, options), { flush: 'post' }) : { flush: 'post' }));
  3282. }
  3283. function watchSyncEffect(effect, options) {
  3284. return doWatch(effect, null, (process.env.NODE_ENV !== 'production'
  3285. ? __assign(__assign({}, options), { flush: 'sync' }) : { flush: 'sync' }));
  3286. }
  3287. // initial value for watchers to trigger on undefined initial values
  3288. var INITIAL_WATCHER_VALUE = {};
  3289. // implementation
  3290. function watch(source, cb, options) {
  3291. if (process.env.NODE_ENV !== 'production' && typeof cb !== 'function') {
  3292. warn$2("`watch(fn, options?)` signature has been moved to a separate API. " +
  3293. "Use `watchEffect(fn, options?)` instead. `watch` now only " +
  3294. "supports `watch(source, cb, options?) signature.");
  3295. }
  3296. return doWatch(source, cb, options);
  3297. }
  3298. function doWatch(source, cb, _a) {
  3299. var _b = _a === void 0 ? emptyObject : _a, immediate = _b.immediate, deep = _b.deep, _c = _b.flush, flush = _c === void 0 ? 'pre' : _c, onTrack = _b.onTrack, onTrigger = _b.onTrigger;
  3300. if (process.env.NODE_ENV !== 'production' && !cb) {
  3301. if (immediate !== undefined) {
  3302. warn$2("watch() \"immediate\" option is only respected when using the " +
  3303. "watch(source, callback, options?) signature.");
  3304. }
  3305. if (deep !== undefined) {
  3306. warn$2("watch() \"deep\" option is only respected when using the " +
  3307. "watch(source, callback, options?) signature.");
  3308. }
  3309. }
  3310. var warnInvalidSource = function (s) {
  3311. warn$2("Invalid watch source: ".concat(s, ". A watch source can only be a getter/effect ") +
  3312. "function, a ref, a reactive object, or an array of these types.");
  3313. };
  3314. var instance = currentInstance;
  3315. var call = function (fn, type, args) {
  3316. if (args === void 0) { args = null; }
  3317. return invokeWithErrorHandling(fn, null, args, instance, type);
  3318. };
  3319. var getter;
  3320. var forceTrigger = false;
  3321. var isMultiSource = false;
  3322. if (isRef(source)) {
  3323. getter = function () { return source.value; };
  3324. forceTrigger = isShallow(source);
  3325. }
  3326. else if (isReactive(source)) {
  3327. getter = function () {
  3328. source.__ob__.dep.depend();
  3329. return source;
  3330. };
  3331. deep = true;
  3332. }
  3333. else if (isArray(source)) {
  3334. isMultiSource = true;
  3335. forceTrigger = source.some(function (s) { return isReactive(s) || isShallow(s); });
  3336. getter = function () {
  3337. return source.map(function (s) {
  3338. if (isRef(s)) {
  3339. return s.value;
  3340. }
  3341. else if (isReactive(s)) {
  3342. return traverse(s);
  3343. }
  3344. else if (isFunction(s)) {
  3345. return call(s, WATCHER_GETTER);
  3346. }
  3347. else {
  3348. process.env.NODE_ENV !== 'production' && warnInvalidSource(s);
  3349. }
  3350. });
  3351. };
  3352. }
  3353. else if (isFunction(source)) {
  3354. if (cb) {
  3355. // getter with cb
  3356. getter = function () { return call(source, WATCHER_GETTER); };
  3357. }
  3358. else {
  3359. // no cb -> simple effect
  3360. getter = function () {
  3361. if (instance && instance._isDestroyed) {
  3362. return;
  3363. }
  3364. if (cleanup) {
  3365. cleanup();
  3366. }
  3367. return call(source, WATCHER, [onCleanup]);
  3368. };
  3369. }
  3370. }
  3371. else {
  3372. getter = noop;
  3373. process.env.NODE_ENV !== 'production' && warnInvalidSource(source);
  3374. }
  3375. if (cb && deep) {
  3376. var baseGetter_1 = getter;
  3377. getter = function () { return traverse(baseGetter_1()); };
  3378. }
  3379. var cleanup;
  3380. var onCleanup = function (fn) {
  3381. cleanup = watcher.onStop = function () {
  3382. call(fn, WATCHER_CLEANUP);
  3383. };
  3384. };
  3385. // in SSR there is no need to setup an actual effect, and it should be noop
  3386. // unless it's eager
  3387. if (isServerRendering()) {
  3388. // we will also not call the invalidate callback (+ runner is not set up)
  3389. onCleanup = noop;
  3390. if (!cb) {
  3391. getter();
  3392. }
  3393. else if (immediate) {
  3394. call(cb, WATCHER_CB, [
  3395. getter(),
  3396. isMultiSource ? [] : undefined,
  3397. onCleanup
  3398. ]);
  3399. }
  3400. return noop;
  3401. }
  3402. var watcher = new Watcher(currentInstance, getter, noop, {
  3403. lazy: true
  3404. });
  3405. watcher.noRecurse = !cb;
  3406. var oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
  3407. // overwrite default run
  3408. watcher.run = function () {
  3409. if (!watcher.active) {
  3410. return;
  3411. }
  3412. if (cb) {
  3413. // watch(source, cb)
  3414. var newValue = watcher.get();
  3415. if (deep ||
  3416. forceTrigger ||
  3417. (isMultiSource
  3418. ? newValue.some(function (v, i) {
  3419. return hasChanged(v, oldValue[i]);
  3420. })
  3421. : hasChanged(newValue, oldValue))) {
  3422. // cleanup before running cb again
  3423. if (cleanup) {
  3424. cleanup();
  3425. }
  3426. call(cb, WATCHER_CB, [
  3427. newValue,
  3428. // pass undefined as the old value when it's changed for the first time
  3429. oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
  3430. onCleanup
  3431. ]);
  3432. oldValue = newValue;
  3433. }
  3434. }
  3435. else {
  3436. // watchEffect
  3437. watcher.get();
  3438. }
  3439. };
  3440. if (flush === 'sync') {
  3441. watcher.update = watcher.run;
  3442. }
  3443. else if (flush === 'post') {
  3444. watcher.post = true;
  3445. watcher.update = function () { return queueWatcher(watcher); };
  3446. }
  3447. else {
  3448. // pre
  3449. watcher.update = function () {
  3450. if (instance && instance === currentInstance && !instance._isMounted) {
  3451. // pre-watcher triggered before
  3452. var buffer = instance._preWatchers || (instance._preWatchers = []);
  3453. if (buffer.indexOf(watcher) < 0)
  3454. buffer.push(watcher);
  3455. }
  3456. else {
  3457. queueWatcher(watcher);
  3458. }
  3459. };
  3460. }
  3461. if (process.env.NODE_ENV !== 'production') {
  3462. watcher.onTrack = onTrack;
  3463. watcher.onTrigger = onTrigger;
  3464. }
  3465. // initial run
  3466. if (cb) {
  3467. if (immediate) {
  3468. watcher.run();
  3469. }
  3470. else {
  3471. oldValue = watcher.get();
  3472. }
  3473. }
  3474. else if (flush === 'post' && instance) {
  3475. instance.$once('hook:mounted', function () { return watcher.get(); });
  3476. }
  3477. else {
  3478. watcher.get();
  3479. }
  3480. return function () {
  3481. watcher.teardown();
  3482. };
  3483. }
  3484. var activeEffectScope;
  3485. var EffectScope = /** @class */ (function () {
  3486. function EffectScope(detached) {
  3487. if (detached === void 0) { detached = false; }
  3488. this.detached = detached;
  3489. /**
  3490. * @internal
  3491. */
  3492. this.active = true;
  3493. /**
  3494. * @internal
  3495. */
  3496. this.effects = [];
  3497. /**
  3498. * @internal
  3499. */
  3500. this.cleanups = [];
  3501. this.parent = activeEffectScope;
  3502. if (!detached && activeEffectScope) {
  3503. this.index =
  3504. (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
  3505. }
  3506. }
  3507. EffectScope.prototype.run = function (fn) {
  3508. if (this.active) {
  3509. var currentEffectScope = activeEffectScope;
  3510. try {
  3511. activeEffectScope = this;
  3512. return fn();
  3513. }
  3514. finally {
  3515. activeEffectScope = currentEffectScope;
  3516. }
  3517. }
  3518. else if (process.env.NODE_ENV !== 'production') {
  3519. warn$2("cannot run an inactive effect scope.");
  3520. }
  3521. };
  3522. /**
  3523. * This should only be called on non-detached scopes
  3524. * @internal
  3525. */
  3526. EffectScope.prototype.on = function () {
  3527. activeEffectScope = this;
  3528. };
  3529. /**
  3530. * This should only be called on non-detached scopes
  3531. * @internal
  3532. */
  3533. EffectScope.prototype.off = function () {
  3534. activeEffectScope = this.parent;
  3535. };
  3536. EffectScope.prototype.stop = function (fromParent) {
  3537. if (this.active) {
  3538. var i = void 0, l = void 0;
  3539. for (i = 0, l = this.effects.length; i < l; i++) {
  3540. this.effects[i].teardown();
  3541. }
  3542. for (i = 0, l = this.cleanups.length; i < l; i++) {
  3543. this.cleanups[i]();
  3544. }
  3545. if (this.scopes) {
  3546. for (i = 0, l = this.scopes.length; i < l; i++) {
  3547. this.scopes[i].stop(true);
  3548. }
  3549. }
  3550. // nested scope, dereference from parent to avoid memory leaks
  3551. if (!this.detached && this.parent && !fromParent) {
  3552. // optimized O(1) removal
  3553. var last = this.parent.scopes.pop();
  3554. if (last && last !== this) {
  3555. this.parent.scopes[this.index] = last;
  3556. last.index = this.index;
  3557. }
  3558. }
  3559. this.parent = undefined;
  3560. this.active = false;
  3561. }
  3562. };
  3563. return EffectScope;
  3564. }());
  3565. function effectScope(detached) {
  3566. return new EffectScope(detached);
  3567. }
  3568. /**
  3569. * @internal
  3570. */
  3571. function recordEffectScope(effect, scope) {
  3572. if (scope === void 0) { scope = activeEffectScope; }
  3573. if (scope && scope.active) {
  3574. scope.effects.push(effect);
  3575. }
  3576. }
  3577. function getCurrentScope() {
  3578. return activeEffectScope;
  3579. }
  3580. function onScopeDispose(fn) {
  3581. if (activeEffectScope) {
  3582. activeEffectScope.cleanups.push(fn);
  3583. }
  3584. else if (process.env.NODE_ENV !== 'production') {
  3585. warn$2("onScopeDispose() is called when there is no active effect scope" +
  3586. " to be associated with.");
  3587. }
  3588. }
  3589. function provide(key, value) {
  3590. if (!currentInstance) {
  3591. if (process.env.NODE_ENV !== 'production') {
  3592. warn$2("provide() can only be used inside setup().");
  3593. }
  3594. }
  3595. else {
  3596. // TS doesn't allow symbol as index type
  3597. resolveProvided(currentInstance)[key] = value;
  3598. }
  3599. }
  3600. function resolveProvided(vm) {
  3601. // by default an instance inherits its parent's provides object
  3602. // but when it needs to provide values of its own, it creates its
  3603. // own provides object using parent provides object as prototype.
  3604. // this way in `inject` we can simply look up injections from direct
  3605. // parent and let the prototype chain do the work.
  3606. var existing = vm._provided;
  3607. var parentProvides = vm.$parent && vm.$parent._provided;
  3608. if (parentProvides === existing) {
  3609. return (vm._provided = Object.create(parentProvides));
  3610. }
  3611. else {
  3612. return existing;
  3613. }
  3614. }
  3615. function inject(key, defaultValue, treatDefaultAsFactory) {
  3616. if (treatDefaultAsFactory === void 0) { treatDefaultAsFactory = false; }
  3617. // fallback to `currentRenderingInstance` so that this can be called in
  3618. // a functional component
  3619. var instance = currentInstance;
  3620. if (instance) {
  3621. // #2400
  3622. // to support `app.use` plugins,
  3623. // fallback to appContext's `provides` if the instance is at root
  3624. var provides = instance.$parent && instance.$parent._provided;
  3625. if (provides && key in provides) {
  3626. // TS doesn't allow symbol as index type
  3627. return provides[key];
  3628. }
  3629. else if (arguments.length > 1) {
  3630. return treatDefaultAsFactory && isFunction(defaultValue)
  3631. ? defaultValue.call(instance)
  3632. : defaultValue;
  3633. }
  3634. else if (process.env.NODE_ENV !== 'production') {
  3635. warn$2("injection \"".concat(String(key), "\" not found."));
  3636. }
  3637. }
  3638. else if (process.env.NODE_ENV !== 'production') {
  3639. warn$2("inject() can only be used inside setup() or functional components.");
  3640. }
  3641. }
  3642. /**
  3643. * @internal this function needs manual public type declaration because it relies
  3644. * on previously manually authored types from Vue 2
  3645. */
  3646. function h(type, props, children) {
  3647. if (!currentInstance) {
  3648. process.env.NODE_ENV !== 'production' &&
  3649. warn$2("globally imported h() can only be invoked when there is an active " +
  3650. "component instance, e.g. synchronously in a component's render or setup function.");
  3651. }
  3652. return createElement$1(currentInstance, type, props, children, 2, true);
  3653. }
  3654. function handleError(err, vm, info) {
  3655. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  3656. // See: https://github.com/vuejs/vuex/issues/1505
  3657. pushTarget();
  3658. try {
  3659. if (vm) {
  3660. var cur = vm;
  3661. while ((cur = cur.$parent)) {
  3662. var hooks = cur.$options.errorCaptured;
  3663. if (hooks) {
  3664. for (var i = 0; i < hooks.length; i++) {
  3665. try {
  3666. var capture = hooks[i].call(cur, err, vm, info) === false;
  3667. if (capture)
  3668. return;
  3669. }
  3670. catch (e) {
  3671. globalHandleError(e, cur, 'errorCaptured hook');
  3672. }
  3673. }
  3674. }
  3675. }
  3676. }
  3677. globalHandleError(err, vm, info);
  3678. }
  3679. finally {
  3680. popTarget();
  3681. }
  3682. }
  3683. function invokeWithErrorHandling(handler, context, args, vm, info) {
  3684. var res;
  3685. try {
  3686. res = args ? handler.apply(context, args) : handler.call(context);
  3687. if (res && !res._isVue && isPromise(res) && !res._handled) {
  3688. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  3689. res._handled = true;
  3690. }
  3691. }
  3692. catch (e) {
  3693. handleError(e, vm, info);
  3694. }
  3695. return res;
  3696. }
  3697. function globalHandleError(err, vm, info) {
  3698. if (config.errorHandler) {
  3699. try {
  3700. return config.errorHandler.call(null, err, vm, info);
  3701. }
  3702. catch (e) {
  3703. // if the user intentionally throws the original error in the handler,
  3704. // do not log it twice
  3705. if (e !== err) {
  3706. logError(e, null, 'config.errorHandler');
  3707. }
  3708. }
  3709. }
  3710. logError(err, vm, info);
  3711. }
  3712. function logError(err, vm, info) {
  3713. if (process.env.NODE_ENV !== 'production') {
  3714. warn$2("Error in ".concat(info, ": \"").concat(err.toString(), "\""), vm);
  3715. }
  3716. /* istanbul ignore else */
  3717. if (inBrowser && typeof console !== 'undefined') {
  3718. console.error(err);
  3719. }
  3720. else {
  3721. throw err;
  3722. }
  3723. }
  3724. /* globals MutationObserver */
  3725. var isUsingMicroTask = false;
  3726. var callbacks = [];
  3727. var pending = false;
  3728. function flushCallbacks() {
  3729. pending = false;
  3730. var copies = callbacks.slice(0);
  3731. callbacks.length = 0;
  3732. for (var i = 0; i < copies.length; i++) {
  3733. copies[i]();
  3734. }
  3735. }
  3736. // Here we have async deferring wrappers using microtasks.
  3737. // In 2.5 we used (macro) tasks (in combination with microtasks).
  3738. // However, it has subtle problems when state is changed right before repaint
  3739. // (e.g. #6813, out-in transitions).
  3740. // Also, using (macro) tasks in event handler would cause some weird behaviors
  3741. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  3742. // So we now use microtasks everywhere, again.
  3743. // A major drawback of this tradeoff is that there are some scenarios
  3744. // where microtasks have too high a priority and fire in between supposedly
  3745. // sequential events (e.g. #4521, #6690, which have workarounds)
  3746. // or even between bubbling of the same event (#6566).
  3747. var timerFunc;
  3748. // The nextTick behavior leverages the microtask queue, which can be accessed
  3749. // via either native Promise.then or MutationObserver.
  3750. // MutationObserver has wider support, however it is seriously bugged in
  3751. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  3752. // completely stops working after triggering a few times... so, if native
  3753. // Promise is available, we will use it:
  3754. /* istanbul ignore next, $flow-disable-line */
  3755. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3756. var p_1 = Promise.resolve();
  3757. timerFunc = function () {
  3758. p_1.then(flushCallbacks);
  3759. // In problematic UIWebViews, Promise.then doesn't completely break, but
  3760. // it can get stuck in a weird state where callbacks are pushed into the
  3761. // microtask queue but the queue isn't being flushed, until the browser
  3762. // needs to do some other work, e.g. handle a timer. Therefore we can
  3763. // "force" the microtask queue to be flushed by adding an empty timer.
  3764. if (isIOS)
  3765. setTimeout(noop);
  3766. };
  3767. isUsingMicroTask = true;
  3768. }
  3769. else if (!isIE &&
  3770. typeof MutationObserver !== 'undefined' &&
  3771. (isNative(MutationObserver) ||
  3772. // PhantomJS and iOS 7.x
  3773. MutationObserver.toString() === '[object MutationObserverConstructor]')) {
  3774. // Use MutationObserver where native Promise is not available,
  3775. // e.g. PhantomJS, iOS7, Android 4.4
  3776. // (#6466 MutationObserver is unreliable in IE11)
  3777. var counter_1 = 1;
  3778. var observer = new MutationObserver(flushCallbacks);
  3779. var textNode_1 = document.createTextNode(String(counter_1));
  3780. observer.observe(textNode_1, {
  3781. characterData: true
  3782. });
  3783. timerFunc = function () {
  3784. counter_1 = (counter_1 + 1) % 2;
  3785. textNode_1.data = String(counter_1);
  3786. };
  3787. isUsingMicroTask = true;
  3788. }
  3789. else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3790. // Fallback to setImmediate.
  3791. // Technically it leverages the (macro) task queue,
  3792. // but it is still a better choice than setTimeout.
  3793. timerFunc = function () {
  3794. setImmediate(flushCallbacks);
  3795. };
  3796. }
  3797. else {
  3798. // Fallback to setTimeout.
  3799. timerFunc = function () {
  3800. setTimeout(flushCallbacks, 0);
  3801. };
  3802. }
  3803. /**
  3804. * @internal
  3805. */
  3806. function nextTick(cb, ctx) {
  3807. var _resolve;
  3808. callbacks.push(function () {
  3809. if (cb) {
  3810. try {
  3811. cb.call(ctx);
  3812. }
  3813. catch (e) {
  3814. handleError(e, ctx, 'nextTick');
  3815. }
  3816. }
  3817. else if (_resolve) {
  3818. _resolve(ctx);
  3819. }
  3820. });
  3821. if (!pending) {
  3822. pending = true;
  3823. timerFunc();
  3824. }
  3825. // $flow-disable-line
  3826. if (!cb && typeof Promise !== 'undefined') {
  3827. return new Promise(function (resolve) {
  3828. _resolve = resolve;
  3829. });
  3830. }
  3831. }
  3832. function useCssModule(name) {
  3833. if (name === void 0) { name = '$style'; }
  3834. /* istanbul ignore else */
  3835. {
  3836. if (!currentInstance) {
  3837. process.env.NODE_ENV !== 'production' && warn$2("useCssModule must be called inside setup()");
  3838. return emptyObject;
  3839. }
  3840. var mod = currentInstance[name];
  3841. if (!mod) {
  3842. process.env.NODE_ENV !== 'production' &&
  3843. warn$2("Current instance does not have CSS module named \"".concat(name, "\"."));
  3844. return emptyObject;
  3845. }
  3846. return mod;
  3847. }
  3848. }
  3849. /**
  3850. * Runtime helper for SFC's CSS variable injection feature.
  3851. * @private
  3852. */
  3853. function useCssVars(getter) {
  3854. if (!inBrowser && !false)
  3855. return;
  3856. var instance = currentInstance;
  3857. if (!instance) {
  3858. process.env.NODE_ENV !== 'production' &&
  3859. warn$2("useCssVars is called without current active component instance.");
  3860. return;
  3861. }
  3862. watchPostEffect(function () {
  3863. var el = instance.$el;
  3864. var vars = getter(instance, instance._setupProxy);
  3865. if (el && el.nodeType === 1) {
  3866. var style = el.style;
  3867. for (var key in vars) {
  3868. style.setProperty("--".concat(key), vars[key]);
  3869. }
  3870. }
  3871. });
  3872. }
  3873. /**
  3874. * v3-compatible async component API.
  3875. * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
  3876. * because it relies on existing manual types
  3877. */
  3878. function defineAsyncComponent(source) {
  3879. if (isFunction(source)) {
  3880. source = { loader: source };
  3881. }
  3882. var loader = source.loader, loadingComponent = source.loadingComponent, errorComponent = source.errorComponent, _a = source.delay, delay = _a === void 0 ? 200 : _a, timeout = source.timeout, // undefined = never times out
  3883. _b = source.suspensible, // undefined = never times out
  3884. suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true
  3885. userOnError = source.onError;
  3886. if (process.env.NODE_ENV !== 'production' && suspensible) {
  3887. warn$2("The suspensiblbe option for async components is not supported in Vue2. It is ignored.");
  3888. }
  3889. var pendingRequest = null;
  3890. var retries = 0;
  3891. var retry = function () {
  3892. retries++;
  3893. pendingRequest = null;
  3894. return load();
  3895. };
  3896. var load = function () {
  3897. var thisRequest;
  3898. return (pendingRequest ||
  3899. (thisRequest = pendingRequest =
  3900. loader()
  3901. .catch(function (err) {
  3902. err = err instanceof Error ? err : new Error(String(err));
  3903. if (userOnError) {
  3904. return new Promise(function (resolve, reject) {
  3905. var userRetry = function () { return resolve(retry()); };
  3906. var userFail = function () { return reject(err); };
  3907. userOnError(err, userRetry, userFail, retries + 1);
  3908. });
  3909. }
  3910. else {
  3911. throw err;
  3912. }
  3913. })
  3914. .then(function (comp) {
  3915. if (thisRequest !== pendingRequest && pendingRequest) {
  3916. return pendingRequest;
  3917. }
  3918. if (process.env.NODE_ENV !== 'production' && !comp) {
  3919. warn$2("Async component loader resolved to undefined. " +
  3920. "If you are using retry(), make sure to return its return value.");
  3921. }
  3922. // interop module default
  3923. if (comp &&
  3924. (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
  3925. comp = comp.default;
  3926. }
  3927. if (process.env.NODE_ENV !== 'production' && comp && !isObject(comp) && !isFunction(comp)) {
  3928. throw new Error("Invalid async component load result: ".concat(comp));
  3929. }
  3930. return comp;
  3931. })));
  3932. };
  3933. return function () {
  3934. var component = load();
  3935. return {
  3936. component: component,
  3937. delay: delay,
  3938. timeout: timeout,
  3939. error: errorComponent,
  3940. loading: loadingComponent
  3941. };
  3942. };
  3943. }
  3944. function createLifeCycle(hookName) {
  3945. return function (fn, target) {
  3946. if (target === void 0) { target = currentInstance; }
  3947. if (!target) {
  3948. process.env.NODE_ENV !== 'production' &&
  3949. warn$2("".concat(formatName(hookName), " is called when there is no active component instance to be ") +
  3950. "associated with. " +
  3951. "Lifecycle injection APIs can only be used during execution of setup().");
  3952. return;
  3953. }
  3954. return injectHook(target, hookName, fn);
  3955. };
  3956. }
  3957. function formatName(name) {
  3958. if (name === 'beforeDestroy') {
  3959. name = 'beforeUnmount';
  3960. }
  3961. else if (name === 'destroyed') {
  3962. name = 'unmounted';
  3963. }
  3964. return "on".concat(name[0].toUpperCase() + name.slice(1));
  3965. }
  3966. function injectHook(instance, hookName, fn) {
  3967. var options = instance.$options;
  3968. options[hookName] = mergeLifecycleHook(options[hookName], fn);
  3969. }
  3970. var onBeforeMount = createLifeCycle('beforeMount');
  3971. var onMounted = createLifeCycle('mounted');
  3972. var onBeforeUpdate = createLifeCycle('beforeUpdate');
  3973. var onUpdated = createLifeCycle('updated');
  3974. var onBeforeUnmount = createLifeCycle('beforeDestroy');
  3975. var onUnmounted = createLifeCycle('destroyed');
  3976. var onActivated = createLifeCycle('activated');
  3977. var onDeactivated = createLifeCycle('deactivated');
  3978. var onServerPrefetch = createLifeCycle('serverPrefetch');
  3979. var onRenderTracked = createLifeCycle('renderTracked');
  3980. var onRenderTriggered = createLifeCycle('renderTriggered');
  3981. var injectErrorCapturedHook = createLifeCycle('errorCaptured');
  3982. function onErrorCaptured(hook, target) {
  3983. if (target === void 0) { target = currentInstance; }
  3984. injectErrorCapturedHook(hook, target);
  3985. }
  3986. /**
  3987. * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
  3988. */
  3989. var version = '2.7.14';
  3990. /**
  3991. * @internal type is manually declared in <root>/types/v3-define-component.d.ts
  3992. */
  3993. function defineComponent(options) {
  3994. return options;
  3995. }
  3996. var seenObjects = new _Set();
  3997. /**
  3998. * Recursively traverse an object to evoke all converted
  3999. * getters, so that every nested property inside the object
  4000. * is collected as a "deep" dependency.
  4001. */
  4002. function traverse(val) {
  4003. _traverse(val, seenObjects);
  4004. seenObjects.clear();
  4005. return val;
  4006. }
  4007. function _traverse(val, seen) {
  4008. var i, keys;
  4009. var isA = isArray(val);
  4010. if ((!isA && !isObject(val)) ||
  4011. val.__v_skip /* ReactiveFlags.SKIP */ ||
  4012. Object.isFrozen(val) ||
  4013. val instanceof VNode) {
  4014. return;
  4015. }
  4016. if (val.__ob__) {
  4017. var depId = val.__ob__.dep.id;
  4018. if (seen.has(depId)) {
  4019. return;
  4020. }
  4021. seen.add(depId);
  4022. }
  4023. if (isA) {
  4024. i = val.length;
  4025. while (i--)
  4026. _traverse(val[i], seen);
  4027. }
  4028. else if (isRef(val)) {
  4029. _traverse(val.value, seen);
  4030. }
  4031. else {
  4032. keys = Object.keys(val);
  4033. i = keys.length;
  4034. while (i--)
  4035. _traverse(val[keys[i]], seen);
  4036. }
  4037. }
  4038. var uid$1 = 0;
  4039. /**
  4040. * A watcher parses an expression, collects dependencies,
  4041. * and fires callback when the expression value changes.
  4042. * This is used for both the $watch() api and directives.
  4043. * @internal
  4044. */
  4045. var Watcher = /** @class */ (function () {
  4046. function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
  4047. recordEffectScope(this,
  4048. // if the active effect scope is manually created (not a component scope),
  4049. // prioritize it
  4050. activeEffectScope && !activeEffectScope._vm
  4051. ? activeEffectScope
  4052. : vm
  4053. ? vm._scope
  4054. : undefined);
  4055. if ((this.vm = vm) && isRenderWatcher) {
  4056. vm._watcher = this;
  4057. }
  4058. // options
  4059. if (options) {
  4060. this.deep = !!options.deep;
  4061. this.user = !!options.user;
  4062. this.lazy = !!options.lazy;
  4063. this.sync = !!options.sync;
  4064. this.before = options.before;
  4065. if (process.env.NODE_ENV !== 'production') {
  4066. this.onTrack = options.onTrack;
  4067. this.onTrigger = options.onTrigger;
  4068. }
  4069. }
  4070. else {
  4071. this.deep = this.user = this.lazy = this.sync = false;
  4072. }
  4073. this.cb = cb;
  4074. this.id = ++uid$1; // uid for batching
  4075. this.active = true;
  4076. this.post = false;
  4077. this.dirty = this.lazy; // for lazy watchers
  4078. this.deps = [];
  4079. this.newDeps = [];
  4080. this.depIds = new _Set();
  4081. this.newDepIds = new _Set();
  4082. this.expression = process.env.NODE_ENV !== 'production' ? expOrFn.toString() : '';
  4083. // parse expression for getter
  4084. if (isFunction(expOrFn)) {
  4085. this.getter = expOrFn;
  4086. }
  4087. else {
  4088. this.getter = parsePath(expOrFn);
  4089. if (!this.getter) {
  4090. this.getter = noop;
  4091. process.env.NODE_ENV !== 'production' &&
  4092. warn$2("Failed watching path: \"".concat(expOrFn, "\" ") +
  4093. 'Watcher only accepts simple dot-delimited paths. ' +
  4094. 'For full control, use a function instead.', vm);
  4095. }
  4096. }
  4097. this.value = this.lazy ? undefined : this.get();
  4098. }
  4099. /**
  4100. * Evaluate the getter, and re-collect dependencies.
  4101. */
  4102. Watcher.prototype.get = function () {
  4103. pushTarget(this);
  4104. var value;
  4105. var vm = this.vm;
  4106. try {
  4107. value = this.getter.call(vm, vm);
  4108. }
  4109. catch (e) {
  4110. if (this.user) {
  4111. handleError(e, vm, "getter for watcher \"".concat(this.expression, "\""));
  4112. }
  4113. else {
  4114. throw e;
  4115. }
  4116. }
  4117. finally {
  4118. // "touch" every property so they are all tracked as
  4119. // dependencies for deep watching
  4120. if (this.deep) {
  4121. traverse(value);
  4122. }
  4123. popTarget();
  4124. this.cleanupDeps();
  4125. }
  4126. return value;
  4127. };
  4128. /**
  4129. * Add a dependency to this directive.
  4130. */
  4131. Watcher.prototype.addDep = function (dep) {
  4132. var id = dep.id;
  4133. if (!this.newDepIds.has(id)) {
  4134. this.newDepIds.add(id);
  4135. this.newDeps.push(dep);
  4136. if (!this.depIds.has(id)) {
  4137. dep.addSub(this);
  4138. }
  4139. }
  4140. };
  4141. /**
  4142. * Clean up for dependency collection.
  4143. */
  4144. Watcher.prototype.cleanupDeps = function () {
  4145. var i = this.deps.length;
  4146. while (i--) {
  4147. var dep = this.deps[i];
  4148. if (!this.newDepIds.has(dep.id)) {
  4149. dep.removeSub(this);
  4150. }
  4151. }
  4152. var tmp = this.depIds;
  4153. this.depIds = this.newDepIds;
  4154. this.newDepIds = tmp;
  4155. this.newDepIds.clear();
  4156. tmp = this.deps;
  4157. this.deps = this.newDeps;
  4158. this.newDeps = tmp;
  4159. this.newDeps.length = 0;
  4160. };
  4161. /**
  4162. * Subscriber interface.
  4163. * Will be called when a dependency changes.
  4164. */
  4165. Watcher.prototype.update = function () {
  4166. /* istanbul ignore else */
  4167. if (this.lazy) {
  4168. this.dirty = true;
  4169. }
  4170. else if (this.sync) {
  4171. this.run();
  4172. }
  4173. else {
  4174. queueWatcher(this);
  4175. }
  4176. };
  4177. /**
  4178. * Scheduler job interface.
  4179. * Will be called by the scheduler.
  4180. */
  4181. Watcher.prototype.run = function () {
  4182. if (this.active) {
  4183. var value = this.get();
  4184. if (value !== this.value ||
  4185. // Deep watchers and watchers on Object/Arrays should fire even
  4186. // when the value is the same, because the value may
  4187. // have mutated.
  4188. isObject(value) ||
  4189. this.deep) {
  4190. // set new value
  4191. var oldValue = this.value;
  4192. this.value = value;
  4193. if (this.user) {
  4194. var info = "callback for watcher \"".concat(this.expression, "\"");
  4195. invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
  4196. }
  4197. else {
  4198. this.cb.call(this.vm, value, oldValue);
  4199. }
  4200. }
  4201. }
  4202. };
  4203. /**
  4204. * Evaluate the value of the watcher.
  4205. * This only gets called for lazy watchers.
  4206. */
  4207. Watcher.prototype.evaluate = function () {
  4208. this.value = this.get();
  4209. this.dirty = false;
  4210. };
  4211. /**
  4212. * Depend on all deps collected by this watcher.
  4213. */
  4214. Watcher.prototype.depend = function () {
  4215. var i = this.deps.length;
  4216. while (i--) {
  4217. this.deps[i].depend();
  4218. }
  4219. };
  4220. /**
  4221. * Remove self from all dependencies' subscriber list.
  4222. */
  4223. Watcher.prototype.teardown = function () {
  4224. if (this.vm && !this.vm._isBeingDestroyed) {
  4225. remove$2(this.vm._scope.effects, this);
  4226. }
  4227. if (this.active) {
  4228. var i = this.deps.length;
  4229. while (i--) {
  4230. this.deps[i].removeSub(this);
  4231. }
  4232. this.active = false;
  4233. if (this.onStop) {
  4234. this.onStop();
  4235. }
  4236. }
  4237. };
  4238. return Watcher;
  4239. }());
  4240. var sharedPropertyDefinition = {
  4241. enumerable: true,
  4242. configurable: true,
  4243. get: noop,
  4244. set: noop
  4245. };
  4246. function proxy(target, sourceKey, key) {
  4247. sharedPropertyDefinition.get = function proxyGetter() {
  4248. return this[sourceKey][key];
  4249. };
  4250. sharedPropertyDefinition.set = function proxySetter(val) {
  4251. this[sourceKey][key] = val;
  4252. };
  4253. Object.defineProperty(target, key, sharedPropertyDefinition);
  4254. }
  4255. function initState(vm) {
  4256. var opts = vm.$options;
  4257. if (opts.props)
  4258. initProps$1(vm, opts.props);
  4259. // Composition API
  4260. initSetup(vm);
  4261. if (opts.methods)
  4262. initMethods(vm, opts.methods);
  4263. if (opts.data) {
  4264. initData(vm);
  4265. }
  4266. else {
  4267. var ob = observe((vm._data = {}));
  4268. ob && ob.vmCount++;
  4269. }
  4270. if (opts.computed)
  4271. initComputed$1(vm, opts.computed);
  4272. if (opts.watch && opts.watch !== nativeWatch) {
  4273. initWatch(vm, opts.watch);
  4274. }
  4275. }
  4276. function initProps$1(vm, propsOptions) {
  4277. var propsData = vm.$options.propsData || {};
  4278. var props = (vm._props = shallowReactive({}));
  4279. // cache prop keys so that future props updates can iterate using Array
  4280. // instead of dynamic object key enumeration.
  4281. var keys = (vm.$options._propKeys = []);
  4282. var isRoot = !vm.$parent;
  4283. // root instance props should be converted
  4284. if (!isRoot) {
  4285. toggleObserving(false);
  4286. }
  4287. var _loop_1 = function (key) {
  4288. keys.push(key);
  4289. var value = validateProp(key, propsOptions, propsData, vm);
  4290. /* istanbul ignore else */
  4291. if (process.env.NODE_ENV !== 'production') {
  4292. var hyphenatedKey = hyphenate(key);
  4293. if (isReservedAttribute(hyphenatedKey) ||
  4294. config.isReservedAttr(hyphenatedKey)) {
  4295. warn$2("\"".concat(hyphenatedKey, "\" is a reserved attribute and cannot be used as component prop."), vm);
  4296. }
  4297. defineReactive(props, key, value, function () {
  4298. if (!isRoot && !isUpdatingChildComponent) {
  4299. warn$2("Avoid mutating a prop directly since the value will be " +
  4300. "overwritten whenever the parent component re-renders. " +
  4301. "Instead, use a data or computed property based on the prop's " +
  4302. "value. Prop being mutated: \"".concat(key, "\""), vm);
  4303. }
  4304. });
  4305. }
  4306. else {
  4307. defineReactive(props, key, value);
  4308. }
  4309. // static props are already proxied on the component's prototype
  4310. // during Vue.extend(). We only need to proxy props defined at
  4311. // instantiation here.
  4312. if (!(key in vm)) {
  4313. proxy(vm, "_props", key);
  4314. }
  4315. };
  4316. for (var key in propsOptions) {
  4317. _loop_1(key);
  4318. }
  4319. toggleObserving(true);
  4320. }
  4321. function initData(vm) {
  4322. var data = vm.$options.data;
  4323. data = vm._data = isFunction(data) ? getData(data, vm) : data || {};
  4324. if (!isPlainObject(data)) {
  4325. data = {};
  4326. process.env.NODE_ENV !== 'production' &&
  4327. warn$2('data functions should return an object:\n' +
  4328. 'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
  4329. }
  4330. // proxy data on instance
  4331. var keys = Object.keys(data);
  4332. var props = vm.$options.props;
  4333. var methods = vm.$options.methods;
  4334. var i = keys.length;
  4335. while (i--) {
  4336. var key = keys[i];
  4337. if (process.env.NODE_ENV !== 'production') {
  4338. if (methods && hasOwn(methods, key)) {
  4339. warn$2("Method \"".concat(key, "\" has already been defined as a data property."), vm);
  4340. }
  4341. }
  4342. if (props && hasOwn(props, key)) {
  4343. process.env.NODE_ENV !== 'production' &&
  4344. warn$2("The data property \"".concat(key, "\" is already declared as a prop. ") +
  4345. "Use prop default value instead.", vm);
  4346. }
  4347. else if (!isReserved(key)) {
  4348. proxy(vm, "_data", key);
  4349. }
  4350. }
  4351. // observe data
  4352. var ob = observe(data);
  4353. ob && ob.vmCount++;
  4354. }
  4355. function getData(data, vm) {
  4356. // #7573 disable dep collection when invoking data getters
  4357. pushTarget();
  4358. try {
  4359. return data.call(vm, vm);
  4360. }
  4361. catch (e) {
  4362. handleError(e, vm, "data()");
  4363. return {};
  4364. }
  4365. finally {
  4366. popTarget();
  4367. }
  4368. }
  4369. var computedWatcherOptions = { lazy: true };
  4370. function initComputed$1(vm, computed) {
  4371. // $flow-disable-line
  4372. var watchers = (vm._computedWatchers = Object.create(null));
  4373. // computed properties are just getters during SSR
  4374. var isSSR = isServerRendering();
  4375. for (var key in computed) {
  4376. var userDef = computed[key];
  4377. var getter = isFunction(userDef) ? userDef : userDef.get;
  4378. if (process.env.NODE_ENV !== 'production' && getter == null) {
  4379. warn$2("Getter is missing for computed property \"".concat(key, "\"."), vm);
  4380. }
  4381. if (!isSSR) {
  4382. // create internal watcher for the computed property.
  4383. watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
  4384. }
  4385. // component-defined computed properties are already defined on the
  4386. // component prototype. We only need to define computed properties defined
  4387. // at instantiation here.
  4388. if (!(key in vm)) {
  4389. defineComputed(vm, key, userDef);
  4390. }
  4391. else if (process.env.NODE_ENV !== 'production') {
  4392. if (key in vm.$data) {
  4393. warn$2("The computed property \"".concat(key, "\" is already defined in data."), vm);
  4394. }
  4395. else if (vm.$options.props && key in vm.$options.props) {
  4396. warn$2("The computed property \"".concat(key, "\" is already defined as a prop."), vm);
  4397. }
  4398. else if (vm.$options.methods && key in vm.$options.methods) {
  4399. warn$2("The computed property \"".concat(key, "\" is already defined as a method."), vm);
  4400. }
  4401. }
  4402. }
  4403. }
  4404. function defineComputed(target, key, userDef) {
  4405. var shouldCache = !isServerRendering();
  4406. if (isFunction(userDef)) {
  4407. sharedPropertyDefinition.get = shouldCache
  4408. ? createComputedGetter(key)
  4409. : createGetterInvoker(userDef);
  4410. sharedPropertyDefinition.set = noop;
  4411. }
  4412. else {
  4413. sharedPropertyDefinition.get = userDef.get
  4414. ? shouldCache && userDef.cache !== false
  4415. ? createComputedGetter(key)
  4416. : createGetterInvoker(userDef.get)
  4417. : noop;
  4418. sharedPropertyDefinition.set = userDef.set || noop;
  4419. }
  4420. if (process.env.NODE_ENV !== 'production' && sharedPropertyDefinition.set === noop) {
  4421. sharedPropertyDefinition.set = function () {
  4422. warn$2("Computed property \"".concat(key, "\" was assigned to but it has no setter."), this);
  4423. };
  4424. }
  4425. Object.defineProperty(target, key, sharedPropertyDefinition);
  4426. }
  4427. function createComputedGetter(key) {
  4428. return function computedGetter() {
  4429. var watcher = this._computedWatchers && this._computedWatchers[key];
  4430. if (watcher) {
  4431. if (watcher.dirty) {
  4432. watcher.evaluate();
  4433. }
  4434. if (Dep.target) {
  4435. if (process.env.NODE_ENV !== 'production' && Dep.target.onTrack) {
  4436. Dep.target.onTrack({
  4437. effect: Dep.target,
  4438. target: this,
  4439. type: "get" /* TrackOpTypes.GET */,
  4440. key: key
  4441. });
  4442. }
  4443. watcher.depend();
  4444. }
  4445. return watcher.value;
  4446. }
  4447. };
  4448. }
  4449. function createGetterInvoker(fn) {
  4450. return function computedGetter() {
  4451. return fn.call(this, this);
  4452. };
  4453. }
  4454. function initMethods(vm, methods) {
  4455. var props = vm.$options.props;
  4456. for (var key in methods) {
  4457. if (process.env.NODE_ENV !== 'production') {
  4458. if (typeof methods[key] !== 'function') {
  4459. warn$2("Method \"".concat(key, "\" has type \"").concat(typeof methods[key], "\" in the component definition. ") +
  4460. "Did you reference the function correctly?", vm);
  4461. }
  4462. if (props && hasOwn(props, key)) {
  4463. warn$2("Method \"".concat(key, "\" has already been defined as a prop."), vm);
  4464. }
  4465. if (key in vm && isReserved(key)) {
  4466. warn$2("Method \"".concat(key, "\" conflicts with an existing Vue instance method. ") +
  4467. "Avoid defining component methods that start with _ or $.");
  4468. }
  4469. }
  4470. vm[key] = typeof methods[key] !== 'function' ? noop : bind$1(methods[key], vm);
  4471. }
  4472. }
  4473. function initWatch(vm, watch) {
  4474. for (var key in watch) {
  4475. var handler = watch[key];
  4476. if (isArray(handler)) {
  4477. for (var i = 0; i < handler.length; i++) {
  4478. createWatcher(vm, key, handler[i]);
  4479. }
  4480. }
  4481. else {
  4482. createWatcher(vm, key, handler);
  4483. }
  4484. }
  4485. }
  4486. function createWatcher(vm, expOrFn, handler, options) {
  4487. if (isPlainObject(handler)) {
  4488. options = handler;
  4489. handler = handler.handler;
  4490. }
  4491. if (typeof handler === 'string') {
  4492. handler = vm[handler];
  4493. }
  4494. return vm.$watch(expOrFn, handler, options);
  4495. }
  4496. function stateMixin(Vue) {
  4497. // flow somehow has problems with directly declared definition object
  4498. // when using Object.defineProperty, so we have to procedurally build up
  4499. // the object here.
  4500. var dataDef = {};
  4501. dataDef.get = function () {
  4502. return this._data;
  4503. };
  4504. var propsDef = {};
  4505. propsDef.get = function () {
  4506. return this._props;
  4507. };
  4508. if (process.env.NODE_ENV !== 'production') {
  4509. dataDef.set = function () {
  4510. warn$2('Avoid replacing instance root $data. ' +
  4511. 'Use nested data properties instead.', this);
  4512. };
  4513. propsDef.set = function () {
  4514. warn$2("$props is readonly.", this);
  4515. };
  4516. }
  4517. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4518. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4519. Vue.prototype.$set = set;
  4520. Vue.prototype.$delete = del;
  4521. Vue.prototype.$watch = function (expOrFn, cb, options) {
  4522. var vm = this;
  4523. if (isPlainObject(cb)) {
  4524. return createWatcher(vm, expOrFn, cb, options);
  4525. }
  4526. options = options || {};
  4527. options.user = true;
  4528. var watcher = new Watcher(vm, expOrFn, cb, options);
  4529. if (options.immediate) {
  4530. var info = "callback for immediate watcher \"".concat(watcher.expression, "\"");
  4531. pushTarget();
  4532. invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
  4533. popTarget();
  4534. }
  4535. return function unwatchFn() {
  4536. watcher.teardown();
  4537. };
  4538. };
  4539. }
  4540. function initProvide(vm) {
  4541. var provideOption = vm.$options.provide;
  4542. if (provideOption) {
  4543. var provided = isFunction(provideOption)
  4544. ? provideOption.call(vm)
  4545. : provideOption;
  4546. if (!isObject(provided)) {
  4547. return;
  4548. }
  4549. var source = resolveProvided(vm);
  4550. // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
  4551. // iterate the keys ourselves.
  4552. var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
  4553. for (var i = 0; i < keys.length; i++) {
  4554. var key = keys[i];
  4555. Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
  4556. }
  4557. }
  4558. }
  4559. function initInjections(vm) {
  4560. var result = resolveInject(vm.$options.inject, vm);
  4561. if (result) {
  4562. toggleObserving(false);
  4563. Object.keys(result).forEach(function (key) {
  4564. /* istanbul ignore else */
  4565. if (process.env.NODE_ENV !== 'production') {
  4566. defineReactive(vm, key, result[key], function () {
  4567. warn$2("Avoid mutating an injected value directly since the changes will be " +
  4568. "overwritten whenever the provided component re-renders. " +
  4569. "injection being mutated: \"".concat(key, "\""), vm);
  4570. });
  4571. }
  4572. else {
  4573. defineReactive(vm, key, result[key]);
  4574. }
  4575. });
  4576. toggleObserving(true);
  4577. }
  4578. }
  4579. function resolveInject(inject, vm) {
  4580. if (inject) {
  4581. // inject is :any because flow is not smart enough to figure out cached
  4582. var result = Object.create(null);
  4583. var keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
  4584. for (var i = 0; i < keys.length; i++) {
  4585. var key = keys[i];
  4586. // #6574 in case the inject object is observed...
  4587. if (key === '__ob__')
  4588. continue;
  4589. var provideKey = inject[key].from;
  4590. if (provideKey in vm._provided) {
  4591. result[key] = vm._provided[provideKey];
  4592. }
  4593. else if ('default' in inject[key]) {
  4594. var provideDefault = inject[key].default;
  4595. result[key] = isFunction(provideDefault)
  4596. ? provideDefault.call(vm)
  4597. : provideDefault;
  4598. }
  4599. else if (process.env.NODE_ENV !== 'production') {
  4600. warn$2("Injection \"".concat(key, "\" not found"), vm);
  4601. }
  4602. }
  4603. return result;
  4604. }
  4605. }
  4606. var uid = 0;
  4607. function initMixin$1(Vue) {
  4608. Vue.prototype._init = function (options) {
  4609. var vm = this;
  4610. // a uid
  4611. vm._uid = uid++;
  4612. var startTag, endTag;
  4613. /* istanbul ignore if */
  4614. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4615. startTag = "vue-perf-start:".concat(vm._uid);
  4616. endTag = "vue-perf-end:".concat(vm._uid);
  4617. mark(startTag);
  4618. }
  4619. // a flag to mark this as a Vue instance without having to do instanceof
  4620. // check
  4621. vm._isVue = true;
  4622. // avoid instances from being observed
  4623. vm.__v_skip = true;
  4624. // effect scope
  4625. vm._scope = new EffectScope(true /* detached */);
  4626. vm._scope._vm = true;
  4627. // merge options
  4628. if (options && options._isComponent) {
  4629. // optimize internal component instantiation
  4630. // since dynamic options merging is pretty slow, and none of the
  4631. // internal component options needs special treatment.
  4632. initInternalComponent(vm, options);
  4633. }
  4634. else {
  4635. vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);
  4636. }
  4637. /* istanbul ignore else */
  4638. if (process.env.NODE_ENV !== 'production') {
  4639. initProxy(vm);
  4640. }
  4641. else {
  4642. vm._renderProxy = vm;
  4643. }
  4644. // expose real self
  4645. vm._self = vm;
  4646. initLifecycle(vm);
  4647. initEvents(vm);
  4648. initRender(vm);
  4649. callHook$1(vm, 'beforeCreate', undefined, false /* setContext */);
  4650. initInjections(vm); // resolve injections before data/props
  4651. initState(vm);
  4652. initProvide(vm); // resolve provide after data/props
  4653. callHook$1(vm, 'created');
  4654. /* istanbul ignore if */
  4655. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4656. vm._name = formatComponentName(vm, false);
  4657. mark(endTag);
  4658. measure("vue ".concat(vm._name, " init"), startTag, endTag);
  4659. }
  4660. if (vm.$options.el) {
  4661. vm.$mount(vm.$options.el);
  4662. }
  4663. };
  4664. }
  4665. function initInternalComponent(vm, options) {
  4666. var opts = (vm.$options = Object.create(vm.constructor.options));
  4667. // doing this because it's faster than dynamic enumeration.
  4668. var parentVnode = options._parentVnode;
  4669. opts.parent = options.parent;
  4670. opts._parentVnode = parentVnode;
  4671. var vnodeComponentOptions = parentVnode.componentOptions;
  4672. opts.propsData = vnodeComponentOptions.propsData;
  4673. opts._parentListeners = vnodeComponentOptions.listeners;
  4674. opts._renderChildren = vnodeComponentOptions.children;
  4675. opts._componentTag = vnodeComponentOptions.tag;
  4676. if (options.render) {
  4677. opts.render = options.render;
  4678. opts.staticRenderFns = options.staticRenderFns;
  4679. }
  4680. }
  4681. function resolveConstructorOptions(Ctor) {
  4682. var options = Ctor.options;
  4683. if (Ctor.super) {
  4684. var superOptions = resolveConstructorOptions(Ctor.super);
  4685. var cachedSuperOptions = Ctor.superOptions;
  4686. if (superOptions !== cachedSuperOptions) {
  4687. // super option changed,
  4688. // need to resolve new options.
  4689. Ctor.superOptions = superOptions;
  4690. // check if there are any late-modified/attached options (#4976)
  4691. var modifiedOptions = resolveModifiedOptions(Ctor);
  4692. // update base extend options
  4693. if (modifiedOptions) {
  4694. extend(Ctor.extendOptions, modifiedOptions);
  4695. }
  4696. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4697. if (options.name) {
  4698. options.components[options.name] = Ctor;
  4699. }
  4700. }
  4701. }
  4702. return options;
  4703. }
  4704. function resolveModifiedOptions(Ctor) {
  4705. var modified;
  4706. var latest = Ctor.options;
  4707. var sealed = Ctor.sealedOptions;
  4708. for (var key in latest) {
  4709. if (latest[key] !== sealed[key]) {
  4710. if (!modified)
  4711. modified = {};
  4712. modified[key] = latest[key];
  4713. }
  4714. }
  4715. return modified;
  4716. }
  4717. function FunctionalRenderContext(data, props, children, parent, Ctor) {
  4718. var _this = this;
  4719. var options = Ctor.options;
  4720. // ensure the createElement function in functional components
  4721. // gets a unique context - this is necessary for correct named slot check
  4722. var contextVm;
  4723. if (hasOwn(parent, '_uid')) {
  4724. contextVm = Object.create(parent);
  4725. contextVm._original = parent;
  4726. }
  4727. else {
  4728. // the context vm passed in is a functional context as well.
  4729. // in this case we want to make sure we are able to get a hold to the
  4730. // real context instance.
  4731. contextVm = parent;
  4732. // @ts-ignore
  4733. parent = parent._original;
  4734. }
  4735. var isCompiled = isTrue(options._compiled);
  4736. var needNormalization = !isCompiled;
  4737. this.data = data;
  4738. this.props = props;
  4739. this.children = children;
  4740. this.parent = parent;
  4741. this.listeners = data.on || emptyObject;
  4742. this.injections = resolveInject(options.inject, parent);
  4743. this.slots = function () {
  4744. if (!_this.$slots) {
  4745. normalizeScopedSlots(parent, data.scopedSlots, (_this.$slots = resolveSlots(children, parent)));
  4746. }
  4747. return _this.$slots;
  4748. };
  4749. Object.defineProperty(this, 'scopedSlots', {
  4750. enumerable: true,
  4751. get: function () {
  4752. return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
  4753. }
  4754. });
  4755. // support for compiled functional template
  4756. if (isCompiled) {
  4757. // exposing $options for renderStatic()
  4758. this.$options = options;
  4759. // pre-resolve slots for renderSlot()
  4760. this.$slots = this.slots();
  4761. this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots);
  4762. }
  4763. if (options._scopeId) {
  4764. this._c = function (a, b, c, d) {
  4765. var vnode = createElement$1(contextVm, a, b, c, d, needNormalization);
  4766. if (vnode && !isArray(vnode)) {
  4767. vnode.fnScopeId = options._scopeId;
  4768. vnode.fnContext = parent;
  4769. }
  4770. return vnode;
  4771. };
  4772. }
  4773. else {
  4774. this._c = function (a, b, c, d) {
  4775. return createElement$1(contextVm, a, b, c, d, needNormalization);
  4776. };
  4777. }
  4778. }
  4779. installRenderHelpers(FunctionalRenderContext.prototype);
  4780. function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
  4781. var options = Ctor.options;
  4782. var props = {};
  4783. var propOptions = options.props;
  4784. if (isDef(propOptions)) {
  4785. for (var key in propOptions) {
  4786. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4787. }
  4788. }
  4789. else {
  4790. if (isDef(data.attrs))
  4791. mergeProps(props, data.attrs);
  4792. if (isDef(data.props))
  4793. mergeProps(props, data.props);
  4794. }
  4795. var renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
  4796. var vnode = options.render.call(null, renderContext._c, renderContext);
  4797. if (vnode instanceof VNode) {
  4798. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
  4799. }
  4800. else if (isArray(vnode)) {
  4801. var vnodes = normalizeChildren(vnode) || [];
  4802. var res = new Array(vnodes.length);
  4803. for (var i = 0; i < vnodes.length; i++) {
  4804. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4805. }
  4806. return res;
  4807. }
  4808. }
  4809. function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
  4810. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4811. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4812. // that should not be matched to match.
  4813. var clone = cloneVNode(vnode);
  4814. clone.fnContext = contextVm;
  4815. clone.fnOptions = options;
  4816. if (process.env.NODE_ENV !== 'production') {
  4817. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
  4818. renderContext;
  4819. }
  4820. if (data.slot) {
  4821. (clone.data || (clone.data = {})).slot = data.slot;
  4822. }
  4823. return clone;
  4824. }
  4825. function mergeProps(to, from) {
  4826. for (var key in from) {
  4827. to[camelize(key)] = from[key];
  4828. }
  4829. }
  4830. function getComponentName(options) {
  4831. return options.name || options.__name || options._componentTag;
  4832. }
  4833. // inline hooks to be invoked on component VNodes during patch
  4834. var componentVNodeHooks = {
  4835. init: function (vnode, hydrating) {
  4836. if (vnode.componentInstance &&
  4837. !vnode.componentInstance._isDestroyed &&
  4838. vnode.data.keepAlive) {
  4839. // kept-alive components, treat as a patch
  4840. var mountedNode = vnode; // work around flow
  4841. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4842. }
  4843. else {
  4844. var child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance));
  4845. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4846. }
  4847. },
  4848. prepatch: function (oldVnode, vnode) {
  4849. var options = vnode.componentOptions;
  4850. var child = (vnode.componentInstance = oldVnode.componentInstance);
  4851. updateChildComponent(child, options.propsData, // updated props
  4852. options.listeners, // updated listeners
  4853. vnode, // new parent vnode
  4854. options.children // new children
  4855. );
  4856. },
  4857. insert: function (vnode) {
  4858. var context = vnode.context, componentInstance = vnode.componentInstance;
  4859. if (!componentInstance._isMounted) {
  4860. componentInstance._isMounted = true;
  4861. callHook$1(componentInstance, 'mounted');
  4862. }
  4863. if (vnode.data.keepAlive) {
  4864. if (context._isMounted) {
  4865. // vue-router#1212
  4866. // During updates, a kept-alive component's child components may
  4867. // change, so directly walking the tree here may call activated hooks
  4868. // on incorrect children. Instead we push them into a queue which will
  4869. // be processed after the whole patch process ended.
  4870. queueActivatedComponent(componentInstance);
  4871. }
  4872. else {
  4873. activateChildComponent(componentInstance, true /* direct */);
  4874. }
  4875. }
  4876. },
  4877. destroy: function (vnode) {
  4878. var componentInstance = vnode.componentInstance;
  4879. if (!componentInstance._isDestroyed) {
  4880. if (!vnode.data.keepAlive) {
  4881. componentInstance.$destroy();
  4882. }
  4883. else {
  4884. deactivateChildComponent(componentInstance, true /* direct */);
  4885. }
  4886. }
  4887. }
  4888. };
  4889. var hooksToMerge = Object.keys(componentVNodeHooks);
  4890. function createComponent(Ctor, data, context, children, tag) {
  4891. if (isUndef(Ctor)) {
  4892. return;
  4893. }
  4894. var baseCtor = context.$options._base;
  4895. // plain options object: turn it into a constructor
  4896. if (isObject(Ctor)) {
  4897. Ctor = baseCtor.extend(Ctor);
  4898. }
  4899. // if at this stage it's not a constructor or an async component factory,
  4900. // reject.
  4901. if (typeof Ctor !== 'function') {
  4902. if (process.env.NODE_ENV !== 'production') {
  4903. warn$2("Invalid Component definition: ".concat(String(Ctor)), context);
  4904. }
  4905. return;
  4906. }
  4907. // async component
  4908. var asyncFactory;
  4909. // @ts-expect-error
  4910. if (isUndef(Ctor.cid)) {
  4911. asyncFactory = Ctor;
  4912. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  4913. if (Ctor === undefined) {
  4914. // return a placeholder node for async component, which is rendered
  4915. // as a comment node but preserves all the raw information for the node.
  4916. // the information will be used for async server-rendering and hydration.
  4917. return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
  4918. }
  4919. }
  4920. data = data || {};
  4921. // resolve constructor options in case global mixins are applied after
  4922. // component constructor creation
  4923. resolveConstructorOptions(Ctor);
  4924. // transform component v-model data into props & events
  4925. if (isDef(data.model)) {
  4926. // @ts-expect-error
  4927. transformModel(Ctor.options, data);
  4928. }
  4929. // extract props
  4930. // @ts-expect-error
  4931. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  4932. // functional component
  4933. // @ts-expect-error
  4934. if (isTrue(Ctor.options.functional)) {
  4935. return createFunctionalComponent(Ctor, propsData, data, context, children);
  4936. }
  4937. // extract listeners, since these needs to be treated as
  4938. // child component listeners instead of DOM listeners
  4939. var listeners = data.on;
  4940. // replace with listeners with .native modifier
  4941. // so it gets processed during parent component patch.
  4942. data.on = data.nativeOn;
  4943. // @ts-expect-error
  4944. if (isTrue(Ctor.options.abstract)) {
  4945. // abstract components do not keep anything
  4946. // other than props & listeners & slot
  4947. // work around flow
  4948. var slot = data.slot;
  4949. data = {};
  4950. if (slot) {
  4951. data.slot = slot;
  4952. }
  4953. }
  4954. // install component management hooks onto the placeholder node
  4955. installComponentHooks(data);
  4956. // return a placeholder vnode
  4957. // @ts-expect-error
  4958. var name = getComponentName(Ctor.options) || tag;
  4959. var vnode = new VNode(
  4960. // @ts-expect-error
  4961. "vue-component-".concat(Ctor.cid).concat(name ? "-".concat(name) : ''), data, undefined, undefined, undefined, context,
  4962. // @ts-expect-error
  4963. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, asyncFactory);
  4964. return vnode;
  4965. }
  4966. function createComponentInstanceForVnode(
  4967. // we know it's MountedComponentVNode but flow doesn't
  4968. vnode,
  4969. // activeInstance in lifecycle state
  4970. parent) {
  4971. var options = {
  4972. _isComponent: true,
  4973. _parentVnode: vnode,
  4974. parent: parent
  4975. };
  4976. // check inline-template render functions
  4977. var inlineTemplate = vnode.data.inlineTemplate;
  4978. if (isDef(inlineTemplate)) {
  4979. options.render = inlineTemplate.render;
  4980. options.staticRenderFns = inlineTemplate.staticRenderFns;
  4981. }
  4982. return new vnode.componentOptions.Ctor(options);
  4983. }
  4984. function installComponentHooks(data) {
  4985. var hooks = data.hook || (data.hook = {});
  4986. for (var i = 0; i < hooksToMerge.length; i++) {
  4987. var key = hooksToMerge[i];
  4988. var existing = hooks[key];
  4989. var toMerge = componentVNodeHooks[key];
  4990. // @ts-expect-error
  4991. if (existing !== toMerge && !(existing && existing._merged)) {
  4992. hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge;
  4993. }
  4994. }
  4995. }
  4996. function mergeHook(f1, f2) {
  4997. var merged = function (a, b) {
  4998. // flow complains about extra args which is why we use any
  4999. f1(a, b);
  5000. f2(a, b);
  5001. };
  5002. merged._merged = true;
  5003. return merged;
  5004. }
  5005. // transform component v-model info (value and callback) into
  5006. // prop and event handler respectively.
  5007. function transformModel(options, data) {
  5008. var prop = (options.model && options.model.prop) || 'value';
  5009. var event = (options.model && options.model.event) || 'input';
  5010. (data.attrs || (data.attrs = {}))[prop] = data.model.value;
  5011. var on = data.on || (data.on = {});
  5012. var existing = on[event];
  5013. var callback = data.model.callback;
  5014. if (isDef(existing)) {
  5015. if (isArray(existing)
  5016. ? existing.indexOf(callback) === -1
  5017. : existing !== callback) {
  5018. on[event] = [callback].concat(existing);
  5019. }
  5020. }
  5021. else {
  5022. on[event] = callback;
  5023. }
  5024. }
  5025. var warn$2 = noop;
  5026. var tip = noop;
  5027. var generateComponentTrace; // work around flow check
  5028. var formatComponentName;
  5029. if (process.env.NODE_ENV !== 'production') {
  5030. var hasConsole_1 = typeof console !== 'undefined';
  5031. var classifyRE_1 = /(?:^|[-_])(\w)/g;
  5032. var classify_1 = function (str) {
  5033. return str.replace(classifyRE_1, function (c) { return c.toUpperCase(); }).replace(/[-_]/g, '');
  5034. };
  5035. warn$2 = function (msg, vm) {
  5036. if (vm === void 0) { vm = currentInstance; }
  5037. var trace = vm ? generateComponentTrace(vm) : '';
  5038. if (config.warnHandler) {
  5039. config.warnHandler.call(null, msg, vm, trace);
  5040. }
  5041. else if (hasConsole_1 && !config.silent) {
  5042. console.error("[Vue warn]: ".concat(msg).concat(trace));
  5043. }
  5044. };
  5045. tip = function (msg, vm) {
  5046. if (hasConsole_1 && !config.silent) {
  5047. console.warn("[Vue tip]: ".concat(msg) + (vm ? generateComponentTrace(vm) : ''));
  5048. }
  5049. };
  5050. formatComponentName = function (vm, includeFile) {
  5051. if (vm.$root === vm) {
  5052. return '<Root>';
  5053. }
  5054. var options = isFunction(vm) && vm.cid != null
  5055. ? vm.options
  5056. : vm._isVue
  5057. ? vm.$options || vm.constructor.options
  5058. : vm;
  5059. var name = getComponentName(options);
  5060. var file = options.__file;
  5061. if (!name && file) {
  5062. var match = file.match(/([^/\\]+)\.vue$/);
  5063. name = match && match[1];
  5064. }
  5065. return ((name ? "<".concat(classify_1(name), ">") : "<Anonymous>") +
  5066. (file && includeFile !== false ? " at ".concat(file) : ''));
  5067. };
  5068. var repeat_1 = function (str, n) {
  5069. var res = '';
  5070. while (n) {
  5071. if (n % 2 === 1)
  5072. res += str;
  5073. if (n > 1)
  5074. str += str;
  5075. n >>= 1;
  5076. }
  5077. return res;
  5078. };
  5079. generateComponentTrace = function (vm) {
  5080. if (vm._isVue && vm.$parent) {
  5081. var tree = [];
  5082. var currentRecursiveSequence = 0;
  5083. while (vm) {
  5084. if (tree.length > 0) {
  5085. var last = tree[tree.length - 1];
  5086. if (last.constructor === vm.constructor) {
  5087. currentRecursiveSequence++;
  5088. vm = vm.$parent;
  5089. continue;
  5090. }
  5091. else if (currentRecursiveSequence > 0) {
  5092. tree[tree.length - 1] = [last, currentRecursiveSequence];
  5093. currentRecursiveSequence = 0;
  5094. }
  5095. }
  5096. tree.push(vm);
  5097. vm = vm.$parent;
  5098. }
  5099. return ('\n\nfound in\n\n' +
  5100. tree
  5101. .map(function (vm, i) {
  5102. return "".concat(i === 0 ? '---> ' : repeat_1(' ', 5 + i * 2)).concat(isArray(vm)
  5103. ? "".concat(formatComponentName(vm[0]), "... (").concat(vm[1], " recursive calls)")
  5104. : formatComponentName(vm));
  5105. })
  5106. .join('\n'));
  5107. }
  5108. else {
  5109. return "\n\n(found in ".concat(formatComponentName(vm), ")");
  5110. }
  5111. };
  5112. }
  5113. /**
  5114. * Option overwriting strategies are functions that handle
  5115. * how to merge a parent option value and a child option
  5116. * value into the final value.
  5117. */
  5118. var strats = config.optionMergeStrategies;
  5119. /**
  5120. * Options with restrictions
  5121. */
  5122. if (process.env.NODE_ENV !== 'production') {
  5123. strats.el = strats.propsData = function (parent, child, vm, key) {
  5124. if (!vm) {
  5125. warn$2("option \"".concat(key, "\" can only be used during instance ") +
  5126. 'creation with the `new` keyword.');
  5127. }
  5128. return defaultStrat(parent, child);
  5129. };
  5130. }
  5131. /**
  5132. * Helper that recursively merges two data objects together.
  5133. */
  5134. function mergeData(to, from, recursive) {
  5135. if (recursive === void 0) { recursive = true; }
  5136. if (!from)
  5137. return to;
  5138. var key, toVal, fromVal;
  5139. var keys = hasSymbol
  5140. ? Reflect.ownKeys(from)
  5141. : Object.keys(from);
  5142. for (var i = 0; i < keys.length; i++) {
  5143. key = keys[i];
  5144. // in case the object is already observed...
  5145. if (key === '__ob__')
  5146. continue;
  5147. toVal = to[key];
  5148. fromVal = from[key];
  5149. if (!recursive || !hasOwn(to, key)) {
  5150. set(to, key, fromVal);
  5151. }
  5152. else if (toVal !== fromVal &&
  5153. isPlainObject(toVal) &&
  5154. isPlainObject(fromVal)) {
  5155. mergeData(toVal, fromVal);
  5156. }
  5157. }
  5158. return to;
  5159. }
  5160. /**
  5161. * Data
  5162. */
  5163. function mergeDataOrFn(parentVal, childVal, vm) {
  5164. if (!vm) {
  5165. // in a Vue.extend merge, both should be functions
  5166. if (!childVal) {
  5167. return parentVal;
  5168. }
  5169. if (!parentVal) {
  5170. return childVal;
  5171. }
  5172. // when parentVal & childVal are both present,
  5173. // we need to return a function that returns the
  5174. // merged result of both functions... no need to
  5175. // check if parentVal is a function here because
  5176. // it has to be a function to pass previous merges.
  5177. return function mergedDataFn() {
  5178. return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal);
  5179. };
  5180. }
  5181. else {
  5182. return function mergedInstanceDataFn() {
  5183. // instance merge
  5184. var instanceData = isFunction(childVal)
  5185. ? childVal.call(vm, vm)
  5186. : childVal;
  5187. var defaultData = isFunction(parentVal)
  5188. ? parentVal.call(vm, vm)
  5189. : parentVal;
  5190. if (instanceData) {
  5191. return mergeData(instanceData, defaultData);
  5192. }
  5193. else {
  5194. return defaultData;
  5195. }
  5196. };
  5197. }
  5198. }
  5199. strats.data = function (parentVal, childVal, vm) {
  5200. if (!vm) {
  5201. if (childVal && typeof childVal !== 'function') {
  5202. process.env.NODE_ENV !== 'production' &&
  5203. warn$2('The "data" option should be a function ' +
  5204. 'that returns a per-instance value in component ' +
  5205. 'definitions.', vm);
  5206. return parentVal;
  5207. }
  5208. return mergeDataOrFn(parentVal, childVal);
  5209. }
  5210. return mergeDataOrFn(parentVal, childVal, vm);
  5211. };
  5212. /**
  5213. * Hooks and props are merged as arrays.
  5214. */
  5215. function mergeLifecycleHook(parentVal, childVal) {
  5216. var res = childVal
  5217. ? parentVal
  5218. ? parentVal.concat(childVal)
  5219. : isArray(childVal)
  5220. ? childVal
  5221. : [childVal]
  5222. : parentVal;
  5223. return res ? dedupeHooks(res) : res;
  5224. }
  5225. function dedupeHooks(hooks) {
  5226. var res = [];
  5227. for (var i = 0; i < hooks.length; i++) {
  5228. if (res.indexOf(hooks[i]) === -1) {
  5229. res.push(hooks[i]);
  5230. }
  5231. }
  5232. return res;
  5233. }
  5234. LIFECYCLE_HOOKS.forEach(function (hook) {
  5235. strats[hook] = mergeLifecycleHook;
  5236. });
  5237. /**
  5238. * Assets
  5239. *
  5240. * When a vm is present (instance creation), we need to do
  5241. * a three-way merge between constructor options, instance
  5242. * options and parent options.
  5243. */
  5244. function mergeAssets(parentVal, childVal, vm, key) {
  5245. var res = Object.create(parentVal || null);
  5246. if (childVal) {
  5247. process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
  5248. return extend(res, childVal);
  5249. }
  5250. else {
  5251. return res;
  5252. }
  5253. }
  5254. ASSET_TYPES.forEach(function (type) {
  5255. strats[type + 's'] = mergeAssets;
  5256. });
  5257. /**
  5258. * Watchers.
  5259. *
  5260. * Watchers hashes should not overwrite one
  5261. * another, so we merge them as arrays.
  5262. */
  5263. strats.watch = function (parentVal, childVal, vm, key) {
  5264. // work around Firefox's Object.prototype.watch...
  5265. //@ts-expect-error work around
  5266. if (parentVal === nativeWatch)
  5267. parentVal = undefined;
  5268. //@ts-expect-error work around
  5269. if (childVal === nativeWatch)
  5270. childVal = undefined;
  5271. /* istanbul ignore if */
  5272. if (!childVal)
  5273. return Object.create(parentVal || null);
  5274. if (process.env.NODE_ENV !== 'production') {
  5275. assertObjectType(key, childVal, vm);
  5276. }
  5277. if (!parentVal)
  5278. return childVal;
  5279. var ret = {};
  5280. extend(ret, parentVal);
  5281. for (var key_1 in childVal) {
  5282. var parent_1 = ret[key_1];
  5283. var child = childVal[key_1];
  5284. if (parent_1 && !isArray(parent_1)) {
  5285. parent_1 = [parent_1];
  5286. }
  5287. ret[key_1] = parent_1 ? parent_1.concat(child) : isArray(child) ? child : [child];
  5288. }
  5289. return ret;
  5290. };
  5291. /**
  5292. * Other object hashes.
  5293. */
  5294. strats.props =
  5295. strats.methods =
  5296. strats.inject =
  5297. strats.computed =
  5298. function (parentVal, childVal, vm, key) {
  5299. if (childVal && process.env.NODE_ENV !== 'production') {
  5300. assertObjectType(key, childVal, vm);
  5301. }
  5302. if (!parentVal)
  5303. return childVal;
  5304. var ret = Object.create(null);
  5305. extend(ret, parentVal);
  5306. if (childVal)
  5307. extend(ret, childVal);
  5308. return ret;
  5309. };
  5310. strats.provide = function (parentVal, childVal) {
  5311. if (!parentVal)
  5312. return childVal;
  5313. return function () {
  5314. var ret = Object.create(null);
  5315. mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
  5316. if (childVal) {
  5317. mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive
  5318. );
  5319. }
  5320. return ret;
  5321. };
  5322. };
  5323. /**
  5324. * Default strategy.
  5325. */
  5326. var defaultStrat = function (parentVal, childVal) {
  5327. return childVal === undefined ? parentVal : childVal;
  5328. };
  5329. /**
  5330. * Validate component names
  5331. */
  5332. function checkComponents(options) {
  5333. for (var key in options.components) {
  5334. validateComponentName(key);
  5335. }
  5336. }
  5337. function validateComponentName(name) {
  5338. if (!new RegExp("^[a-zA-Z][\\-\\.0-9_".concat(unicodeRegExp.source, "]*$")).test(name)) {
  5339. warn$2('Invalid component name: "' +
  5340. name +
  5341. '". Component names ' +
  5342. 'should conform to valid custom element name in html5 specification.');
  5343. }
  5344. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  5345. warn$2('Do not use built-in or reserved HTML elements as component ' +
  5346. 'id: ' +
  5347. name);
  5348. }
  5349. }
  5350. /**
  5351. * Ensure all props option syntax are normalized into the
  5352. * Object-based format.
  5353. */
  5354. function normalizeProps(options, vm) {
  5355. var props = options.props;
  5356. if (!props)
  5357. return;
  5358. var res = {};
  5359. var i, val, name;
  5360. if (isArray(props)) {
  5361. i = props.length;
  5362. while (i--) {
  5363. val = props[i];
  5364. if (typeof val === 'string') {
  5365. name = camelize(val);
  5366. res[name] = { type: null };
  5367. }
  5368. else if (process.env.NODE_ENV !== 'production') {
  5369. warn$2('props must be strings when using array syntax.');
  5370. }
  5371. }
  5372. }
  5373. else if (isPlainObject(props)) {
  5374. for (var key in props) {
  5375. val = props[key];
  5376. name = camelize(key);
  5377. res[name] = isPlainObject(val) ? val : { type: val };
  5378. }
  5379. }
  5380. else if (process.env.NODE_ENV !== 'production') {
  5381. warn$2("Invalid value for option \"props\": expected an Array or an Object, " +
  5382. "but got ".concat(toRawType(props), "."), vm);
  5383. }
  5384. options.props = res;
  5385. }
  5386. /**
  5387. * Normalize all injections into Object-based format
  5388. */
  5389. function normalizeInject(options, vm) {
  5390. var inject = options.inject;
  5391. if (!inject)
  5392. return;
  5393. var normalized = (options.inject = {});
  5394. if (isArray(inject)) {
  5395. for (var i = 0; i < inject.length; i++) {
  5396. normalized[inject[i]] = { from: inject[i] };
  5397. }
  5398. }
  5399. else if (isPlainObject(inject)) {
  5400. for (var key in inject) {
  5401. var val = inject[key];
  5402. normalized[key] = isPlainObject(val)
  5403. ? extend({ from: key }, val)
  5404. : { from: val };
  5405. }
  5406. }
  5407. else if (process.env.NODE_ENV !== 'production') {
  5408. warn$2("Invalid value for option \"inject\": expected an Array or an Object, " +
  5409. "but got ".concat(toRawType(inject), "."), vm);
  5410. }
  5411. }
  5412. /**
  5413. * Normalize raw function directives into object format.
  5414. */
  5415. function normalizeDirectives$1(options) {
  5416. var dirs = options.directives;
  5417. if (dirs) {
  5418. for (var key in dirs) {
  5419. var def = dirs[key];
  5420. if (isFunction(def)) {
  5421. dirs[key] = { bind: def, update: def };
  5422. }
  5423. }
  5424. }
  5425. }
  5426. function assertObjectType(name, value, vm) {
  5427. if (!isPlainObject(value)) {
  5428. warn$2("Invalid value for option \"".concat(name, "\": expected an Object, ") +
  5429. "but got ".concat(toRawType(value), "."), vm);
  5430. }
  5431. }
  5432. /**
  5433. * Merge two option objects into a new one.
  5434. * Core utility used in both instantiation and inheritance.
  5435. */
  5436. function mergeOptions(parent, child, vm) {
  5437. if (process.env.NODE_ENV !== 'production') {
  5438. checkComponents(child);
  5439. }
  5440. if (isFunction(child)) {
  5441. // @ts-expect-error
  5442. child = child.options;
  5443. }
  5444. normalizeProps(child, vm);
  5445. normalizeInject(child, vm);
  5446. normalizeDirectives$1(child);
  5447. // Apply extends and mixins on the child options,
  5448. // but only if it is a raw options object that isn't
  5449. // the result of another mergeOptions call.
  5450. // Only merged options has the _base property.
  5451. if (!child._base) {
  5452. if (child.extends) {
  5453. parent = mergeOptions(parent, child.extends, vm);
  5454. }
  5455. if (child.mixins) {
  5456. for (var i = 0, l = child.mixins.length; i < l; i++) {
  5457. parent = mergeOptions(parent, child.mixins[i], vm);
  5458. }
  5459. }
  5460. }
  5461. var options = {};
  5462. var key;
  5463. for (key in parent) {
  5464. mergeField(key);
  5465. }
  5466. for (key in child) {
  5467. if (!hasOwn(parent, key)) {
  5468. mergeField(key);
  5469. }
  5470. }
  5471. function mergeField(key) {
  5472. var strat = strats[key] || defaultStrat;
  5473. options[key] = strat(parent[key], child[key], vm, key);
  5474. }
  5475. return options;
  5476. }
  5477. /**
  5478. * Resolve an asset.
  5479. * This function is used because child instances need access
  5480. * to assets defined in its ancestor chain.
  5481. */
  5482. function resolveAsset(options, type, id, warnMissing) {
  5483. /* istanbul ignore if */
  5484. if (typeof id !== 'string') {
  5485. return;
  5486. }
  5487. var assets = options[type];
  5488. // check local registration variations first
  5489. if (hasOwn(assets, id))
  5490. return assets[id];
  5491. var camelizedId = camelize(id);
  5492. if (hasOwn(assets, camelizedId))
  5493. return assets[camelizedId];
  5494. var PascalCaseId = capitalize(camelizedId);
  5495. if (hasOwn(assets, PascalCaseId))
  5496. return assets[PascalCaseId];
  5497. // fallback to prototype chain
  5498. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  5499. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  5500. warn$2('Failed to resolve ' + type.slice(0, -1) + ': ' + id);
  5501. }
  5502. return res;
  5503. }
  5504. function validateProp(key, propOptions, propsData, vm) {
  5505. var prop = propOptions[key];
  5506. var absent = !hasOwn(propsData, key);
  5507. var value = propsData[key];
  5508. // boolean casting
  5509. var booleanIndex = getTypeIndex(Boolean, prop.type);
  5510. if (booleanIndex > -1) {
  5511. if (absent && !hasOwn(prop, 'default')) {
  5512. value = false;
  5513. }
  5514. else if (value === '' || value === hyphenate(key)) {
  5515. // only cast empty string / same name to boolean if
  5516. // boolean has higher priority
  5517. var stringIndex = getTypeIndex(String, prop.type);
  5518. if (stringIndex < 0 || booleanIndex < stringIndex) {
  5519. value = true;
  5520. }
  5521. }
  5522. }
  5523. // check default value
  5524. if (value === undefined) {
  5525. value = getPropDefaultValue(vm, prop, key);
  5526. // since the default value is a fresh copy,
  5527. // make sure to observe it.
  5528. var prevShouldObserve = shouldObserve;
  5529. toggleObserving(true);
  5530. observe(value);
  5531. toggleObserving(prevShouldObserve);
  5532. }
  5533. if (process.env.NODE_ENV !== 'production') {
  5534. assertProp(prop, key, value, vm, absent);
  5535. }
  5536. return value;
  5537. }
  5538. /**
  5539. * Get the default value of a prop.
  5540. */
  5541. function getPropDefaultValue(vm, prop, key) {
  5542. // no default, return undefined
  5543. if (!hasOwn(prop, 'default')) {
  5544. return undefined;
  5545. }
  5546. var def = prop.default;
  5547. // warn against non-factory defaults for Object & Array
  5548. if (process.env.NODE_ENV !== 'production' && isObject(def)) {
  5549. warn$2('Invalid default value for prop "' +
  5550. key +
  5551. '": ' +
  5552. 'Props with type Object/Array must use a factory function ' +
  5553. 'to return the default value.', vm);
  5554. }
  5555. // the raw prop value was also undefined from previous render,
  5556. // return previous default value to avoid unnecessary watcher trigger
  5557. if (vm &&
  5558. vm.$options.propsData &&
  5559. vm.$options.propsData[key] === undefined &&
  5560. vm._props[key] !== undefined) {
  5561. return vm._props[key];
  5562. }
  5563. // call factory function for non-Function types
  5564. // a value is Function if its prototype is function even across different execution context
  5565. return isFunction(def) && getType(prop.type) !== 'Function'
  5566. ? def.call(vm)
  5567. : def;
  5568. }
  5569. /**
  5570. * Assert whether a prop is valid.
  5571. */
  5572. function assertProp(prop, name, value, vm, absent) {
  5573. if (prop.required && absent) {
  5574. warn$2('Missing required prop: "' + name + '"', vm);
  5575. return;
  5576. }
  5577. if (value == null && !prop.required) {
  5578. return;
  5579. }
  5580. var type = prop.type;
  5581. var valid = !type || type === true;
  5582. var expectedTypes = [];
  5583. if (type) {
  5584. if (!isArray(type)) {
  5585. type = [type];
  5586. }
  5587. for (var i = 0; i < type.length && !valid; i++) {
  5588. var assertedType = assertType(value, type[i], vm);
  5589. expectedTypes.push(assertedType.expectedType || '');
  5590. valid = assertedType.valid;
  5591. }
  5592. }
  5593. var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
  5594. if (!valid && haveExpectedTypes) {
  5595. warn$2(getInvalidTypeMessage(name, value, expectedTypes), vm);
  5596. return;
  5597. }
  5598. var validator = prop.validator;
  5599. if (validator) {
  5600. if (!validator(value)) {
  5601. warn$2('Invalid prop: custom validator check failed for prop "' + name + '".', vm);
  5602. }
  5603. }
  5604. }
  5605. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
  5606. function assertType(value, type, vm) {
  5607. var valid;
  5608. var expectedType = getType(type);
  5609. if (simpleCheckRE.test(expectedType)) {
  5610. var t = typeof value;
  5611. valid = t === expectedType.toLowerCase();
  5612. // for primitive wrapper objects
  5613. if (!valid && t === 'object') {
  5614. valid = value instanceof type;
  5615. }
  5616. }
  5617. else if (expectedType === 'Object') {
  5618. valid = isPlainObject(value);
  5619. }
  5620. else if (expectedType === 'Array') {
  5621. valid = isArray(value);
  5622. }
  5623. else {
  5624. try {
  5625. valid = value instanceof type;
  5626. }
  5627. catch (e) {
  5628. warn$2('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
  5629. valid = false;
  5630. }
  5631. }
  5632. return {
  5633. valid: valid,
  5634. expectedType: expectedType
  5635. };
  5636. }
  5637. var functionTypeCheckRE = /^\s*function (\w+)/;
  5638. /**
  5639. * Use function string name to check built-in types,
  5640. * because a simple equality check will fail when running
  5641. * across different vms / iframes.
  5642. */
  5643. function getType(fn) {
  5644. var match = fn && fn.toString().match(functionTypeCheckRE);
  5645. return match ? match[1] : '';
  5646. }
  5647. function isSameType(a, b) {
  5648. return getType(a) === getType(b);
  5649. }
  5650. function getTypeIndex(type, expectedTypes) {
  5651. if (!isArray(expectedTypes)) {
  5652. return isSameType(expectedTypes, type) ? 0 : -1;
  5653. }
  5654. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  5655. if (isSameType(expectedTypes[i], type)) {
  5656. return i;
  5657. }
  5658. }
  5659. return -1;
  5660. }
  5661. function getInvalidTypeMessage(name, value, expectedTypes) {
  5662. var message = "Invalid prop: type check failed for prop \"".concat(name, "\".") +
  5663. " Expected ".concat(expectedTypes.map(capitalize).join(', '));
  5664. var expectedType = expectedTypes[0];
  5665. var receivedType = toRawType(value);
  5666. // check if we need to specify expected value
  5667. if (expectedTypes.length === 1 &&
  5668. isExplicable(expectedType) &&
  5669. isExplicable(typeof value) &&
  5670. !isBoolean(expectedType, receivedType)) {
  5671. message += " with value ".concat(styleValue(value, expectedType));
  5672. }
  5673. message += ", got ".concat(receivedType, " ");
  5674. // check if we need to specify received value
  5675. if (isExplicable(receivedType)) {
  5676. message += "with value ".concat(styleValue(value, receivedType), ".");
  5677. }
  5678. return message;
  5679. }
  5680. function styleValue(value, type) {
  5681. if (type === 'String') {
  5682. return "\"".concat(value, "\"");
  5683. }
  5684. else if (type === 'Number') {
  5685. return "".concat(Number(value));
  5686. }
  5687. else {
  5688. return "".concat(value);
  5689. }
  5690. }
  5691. var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
  5692. function isExplicable(value) {
  5693. return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; });
  5694. }
  5695. function isBoolean() {
  5696. var args = [];
  5697. for (var _i = 0; _i < arguments.length; _i++) {
  5698. args[_i] = arguments[_i];
  5699. }
  5700. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; });
  5701. }
  5702. function Vue(options) {
  5703. if (process.env.NODE_ENV !== 'production' && !(this instanceof Vue)) {
  5704. warn$2('Vue is a constructor and should be called with the `new` keyword');
  5705. }
  5706. this._init(options);
  5707. }
  5708. //@ts-expect-error Vue has function type
  5709. initMixin$1(Vue);
  5710. //@ts-expect-error Vue has function type
  5711. stateMixin(Vue);
  5712. //@ts-expect-error Vue has function type
  5713. eventsMixin(Vue);
  5714. //@ts-expect-error Vue has function type
  5715. lifecycleMixin(Vue);
  5716. //@ts-expect-error Vue has function type
  5717. renderMixin(Vue);
  5718. function initUse(Vue) {
  5719. Vue.use = function (plugin) {
  5720. var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
  5721. if (installedPlugins.indexOf(plugin) > -1) {
  5722. return this;
  5723. }
  5724. // additional parameters
  5725. var args = toArray(arguments, 1);
  5726. args.unshift(this);
  5727. if (isFunction(plugin.install)) {
  5728. plugin.install.apply(plugin, args);
  5729. }
  5730. else if (isFunction(plugin)) {
  5731. plugin.apply(null, args);
  5732. }
  5733. installedPlugins.push(plugin);
  5734. return this;
  5735. };
  5736. }
  5737. function initMixin(Vue) {
  5738. Vue.mixin = function (mixin) {
  5739. this.options = mergeOptions(this.options, mixin);
  5740. return this;
  5741. };
  5742. }
  5743. function initExtend(Vue) {
  5744. /**
  5745. * Each instance constructor, including Vue, has a unique
  5746. * cid. This enables us to create wrapped "child
  5747. * constructors" for prototypal inheritance and cache them.
  5748. */
  5749. Vue.cid = 0;
  5750. var cid = 1;
  5751. /**
  5752. * Class inheritance
  5753. */
  5754. Vue.extend = function (extendOptions) {
  5755. extendOptions = extendOptions || {};
  5756. var Super = this;
  5757. var SuperId = Super.cid;
  5758. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  5759. if (cachedCtors[SuperId]) {
  5760. return cachedCtors[SuperId];
  5761. }
  5762. var name = getComponentName(extendOptions) || getComponentName(Super.options);
  5763. if (process.env.NODE_ENV !== 'production' && name) {
  5764. validateComponentName(name);
  5765. }
  5766. var Sub = function VueComponent(options) {
  5767. this._init(options);
  5768. };
  5769. Sub.prototype = Object.create(Super.prototype);
  5770. Sub.prototype.constructor = Sub;
  5771. Sub.cid = cid++;
  5772. Sub.options = mergeOptions(Super.options, extendOptions);
  5773. Sub['super'] = Super;
  5774. // For props and computed properties, we define the proxy getters on
  5775. // the Vue instances at extension time, on the extended prototype. This
  5776. // avoids Object.defineProperty calls for each instance created.
  5777. if (Sub.options.props) {
  5778. initProps(Sub);
  5779. }
  5780. if (Sub.options.computed) {
  5781. initComputed(Sub);
  5782. }
  5783. // allow further extension/mixin/plugin usage
  5784. Sub.extend = Super.extend;
  5785. Sub.mixin = Super.mixin;
  5786. Sub.use = Super.use;
  5787. // create asset registers, so extended classes
  5788. // can have their private assets too.
  5789. ASSET_TYPES.forEach(function (type) {
  5790. Sub[type] = Super[type];
  5791. });
  5792. // enable recursive self-lookup
  5793. if (name) {
  5794. Sub.options.components[name] = Sub;
  5795. }
  5796. // keep a reference to the super options at extension time.
  5797. // later at instantiation we can check if Super's options have
  5798. // been updated.
  5799. Sub.superOptions = Super.options;
  5800. Sub.extendOptions = extendOptions;
  5801. Sub.sealedOptions = extend({}, Sub.options);
  5802. // cache constructor
  5803. cachedCtors[SuperId] = Sub;
  5804. return Sub;
  5805. };
  5806. }
  5807. function initProps(Comp) {
  5808. var props = Comp.options.props;
  5809. for (var key in props) {
  5810. proxy(Comp.prototype, "_props", key);
  5811. }
  5812. }
  5813. function initComputed(Comp) {
  5814. var computed = Comp.options.computed;
  5815. for (var key in computed) {
  5816. defineComputed(Comp.prototype, key, computed[key]);
  5817. }
  5818. }
  5819. function initAssetRegisters(Vue) {
  5820. /**
  5821. * Create asset registration methods.
  5822. */
  5823. ASSET_TYPES.forEach(function (type) {
  5824. // @ts-expect-error function is not exact same type
  5825. Vue[type] = function (id, definition) {
  5826. if (!definition) {
  5827. return this.options[type + 's'][id];
  5828. }
  5829. else {
  5830. /* istanbul ignore if */
  5831. if (process.env.NODE_ENV !== 'production' && type === 'component') {
  5832. validateComponentName(id);
  5833. }
  5834. if (type === 'component' && isPlainObject(definition)) {
  5835. // @ts-expect-error
  5836. definition.name = definition.name || id;
  5837. definition = this.options._base.extend(definition);
  5838. }
  5839. if (type === 'directive' && isFunction(definition)) {
  5840. definition = { bind: definition, update: definition };
  5841. }
  5842. this.options[type + 's'][id] = definition;
  5843. return definition;
  5844. }
  5845. };
  5846. });
  5847. }
  5848. function _getComponentName(opts) {
  5849. return opts && (getComponentName(opts.Ctor.options) || opts.tag);
  5850. }
  5851. function matches(pattern, name) {
  5852. if (isArray(pattern)) {
  5853. return pattern.indexOf(name) > -1;
  5854. }
  5855. else if (typeof pattern === 'string') {
  5856. return pattern.split(',').indexOf(name) > -1;
  5857. }
  5858. else if (isRegExp(pattern)) {
  5859. return pattern.test(name);
  5860. }
  5861. /* istanbul ignore next */
  5862. return false;
  5863. }
  5864. function pruneCache(keepAliveInstance, filter) {
  5865. var cache = keepAliveInstance.cache, keys = keepAliveInstance.keys, _vnode = keepAliveInstance._vnode;
  5866. for (var key in cache) {
  5867. var entry = cache[key];
  5868. if (entry) {
  5869. var name_1 = entry.name;
  5870. if (name_1 && !filter(name_1)) {
  5871. pruneCacheEntry(cache, key, keys, _vnode);
  5872. }
  5873. }
  5874. }
  5875. }
  5876. function pruneCacheEntry(cache, key, keys, current) {
  5877. var entry = cache[key];
  5878. if (entry && (!current || entry.tag !== current.tag)) {
  5879. // @ts-expect-error can be undefined
  5880. entry.componentInstance.$destroy();
  5881. }
  5882. cache[key] = null;
  5883. remove$2(keys, key);
  5884. }
  5885. var patternTypes = [String, RegExp, Array];
  5886. // TODO defineComponent
  5887. var KeepAlive = {
  5888. name: 'keep-alive',
  5889. abstract: true,
  5890. props: {
  5891. include: patternTypes,
  5892. exclude: patternTypes,
  5893. max: [String, Number]
  5894. },
  5895. methods: {
  5896. cacheVNode: function () {
  5897. var _a = this, cache = _a.cache, keys = _a.keys, vnodeToCache = _a.vnodeToCache, keyToCache = _a.keyToCache;
  5898. if (vnodeToCache) {
  5899. var tag = vnodeToCache.tag, componentInstance = vnodeToCache.componentInstance, componentOptions = vnodeToCache.componentOptions;
  5900. cache[keyToCache] = {
  5901. name: _getComponentName(componentOptions),
  5902. tag: tag,
  5903. componentInstance: componentInstance
  5904. };
  5905. keys.push(keyToCache);
  5906. // prune oldest entry
  5907. if (this.max && keys.length > parseInt(this.max)) {
  5908. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  5909. }
  5910. this.vnodeToCache = null;
  5911. }
  5912. }
  5913. },
  5914. created: function () {
  5915. this.cache = Object.create(null);
  5916. this.keys = [];
  5917. },
  5918. destroyed: function () {
  5919. for (var key in this.cache) {
  5920. pruneCacheEntry(this.cache, key, this.keys);
  5921. }
  5922. },
  5923. mounted: function () {
  5924. var _this = this;
  5925. this.cacheVNode();
  5926. this.$watch('include', function (val) {
  5927. pruneCache(_this, function (name) { return matches(val, name); });
  5928. });
  5929. this.$watch('exclude', function (val) {
  5930. pruneCache(_this, function (name) { return !matches(val, name); });
  5931. });
  5932. },
  5933. updated: function () {
  5934. this.cacheVNode();
  5935. },
  5936. render: function () {
  5937. var slot = this.$slots.default;
  5938. var vnode = getFirstComponentChild(slot);
  5939. var componentOptions = vnode && vnode.componentOptions;
  5940. if (componentOptions) {
  5941. // check pattern
  5942. var name_2 = _getComponentName(componentOptions);
  5943. var _a = this, include = _a.include, exclude = _a.exclude;
  5944. if (
  5945. // not included
  5946. (include && (!name_2 || !matches(include, name_2))) ||
  5947. // excluded
  5948. (exclude && name_2 && matches(exclude, name_2))) {
  5949. return vnode;
  5950. }
  5951. var _b = this, cache = _b.cache, keys = _b.keys;
  5952. var key = vnode.key == null
  5953. ? // same constructor may get registered as different local components
  5954. // so cid alone is not enough (#3269)
  5955. componentOptions.Ctor.cid +
  5956. (componentOptions.tag ? "::".concat(componentOptions.tag) : '')
  5957. : vnode.key;
  5958. if (cache[key]) {
  5959. vnode.componentInstance = cache[key].componentInstance;
  5960. // make current key freshest
  5961. remove$2(keys, key);
  5962. keys.push(key);
  5963. }
  5964. else {
  5965. // delay setting the cache until update
  5966. this.vnodeToCache = vnode;
  5967. this.keyToCache = key;
  5968. }
  5969. // @ts-expect-error can vnode.data can be undefined
  5970. vnode.data.keepAlive = true;
  5971. }
  5972. return vnode || (slot && slot[0]);
  5973. }
  5974. };
  5975. var builtInComponents = {
  5976. KeepAlive: KeepAlive
  5977. };
  5978. function initGlobalAPI(Vue) {
  5979. // config
  5980. var configDef = {};
  5981. configDef.get = function () { return config; };
  5982. if (process.env.NODE_ENV !== 'production') {
  5983. configDef.set = function () {
  5984. warn$2('Do not replace the Vue.config object, set individual fields instead.');
  5985. };
  5986. }
  5987. Object.defineProperty(Vue, 'config', configDef);
  5988. // exposed util methods.
  5989. // NOTE: these are not considered part of the public API - avoid relying on
  5990. // them unless you are aware of the risk.
  5991. Vue.util = {
  5992. warn: warn$2,
  5993. extend: extend,
  5994. mergeOptions: mergeOptions,
  5995. defineReactive: defineReactive
  5996. };
  5997. Vue.set = set;
  5998. Vue.delete = del;
  5999. Vue.nextTick = nextTick;
  6000. // 2.6 explicit observable API
  6001. Vue.observable = function (obj) {
  6002. observe(obj);
  6003. return obj;
  6004. };
  6005. Vue.options = Object.create(null);
  6006. ASSET_TYPES.forEach(function (type) {
  6007. Vue.options[type + 's'] = Object.create(null);
  6008. });
  6009. // this is used to identify the "base" constructor to extend all plain-object
  6010. // components with in Weex's multi-instance scenarios.
  6011. Vue.options._base = Vue;
  6012. extend(Vue.options.components, builtInComponents);
  6013. initUse(Vue);
  6014. initMixin(Vue);
  6015. initExtend(Vue);
  6016. initAssetRegisters(Vue);
  6017. }
  6018. initGlobalAPI(Vue);
  6019. Object.defineProperty(Vue.prototype, '$isServer', {
  6020. get: isServerRendering
  6021. });
  6022. Object.defineProperty(Vue.prototype, '$ssrContext', {
  6023. get: function () {
  6024. /* istanbul ignore next */
  6025. return this.$vnode && this.$vnode.ssrContext;
  6026. }
  6027. });
  6028. // expose FunctionalRenderContext for ssr runtime helper installation
  6029. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  6030. value: FunctionalRenderContext
  6031. });
  6032. Vue.version = version;
  6033. // these are reserved for web because they are directly compiled away
  6034. // during template compilation
  6035. var isReservedAttr = makeMap('style,class');
  6036. // attributes that should be using props for binding
  6037. var acceptValue = makeMap('input,textarea,option,select,progress');
  6038. var mustUseProp = function (tag, type, attr) {
  6039. return ((attr === 'value' && acceptValue(tag) && type !== 'button') ||
  6040. (attr === 'selected' && tag === 'option') ||
  6041. (attr === 'checked' && tag === 'input') ||
  6042. (attr === 'muted' && tag === 'video'));
  6043. };
  6044. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  6045. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  6046. var convertEnumeratedValue = function (key, value) {
  6047. return isFalsyAttrValue(value) || value === 'false'
  6048. ? 'false'
  6049. : // allow arbitrary string value for contenteditable
  6050. key === 'contenteditable' && isValidContentEditableValue(value)
  6051. ? value
  6052. : 'true';
  6053. };
  6054. var isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  6055. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  6056. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  6057. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  6058. 'required,reversed,scoped,seamless,selected,sortable,' +
  6059. 'truespeed,typemustmatch,visible');
  6060. var xlinkNS = 'http://www.w3.org/1999/xlink';
  6061. var isXlink = function (name) {
  6062. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';
  6063. };
  6064. var getXlinkProp = function (name) {
  6065. return isXlink(name) ? name.slice(6, name.length) : '';
  6066. };
  6067. var isFalsyAttrValue = function (val) {
  6068. return val == null || val === false;
  6069. };
  6070. function genClassForVnode(vnode) {
  6071. var data = vnode.data;
  6072. var parentNode = vnode;
  6073. var childNode = vnode;
  6074. while (isDef(childNode.componentInstance)) {
  6075. childNode = childNode.componentInstance._vnode;
  6076. if (childNode && childNode.data) {
  6077. data = mergeClassData(childNode.data, data);
  6078. }
  6079. }
  6080. // @ts-expect-error parentNode.parent not VNodeWithData
  6081. while (isDef((parentNode = parentNode.parent))) {
  6082. if (parentNode && parentNode.data) {
  6083. data = mergeClassData(data, parentNode.data);
  6084. }
  6085. }
  6086. return renderClass(data.staticClass, data.class);
  6087. }
  6088. function mergeClassData(child, parent) {
  6089. return {
  6090. staticClass: concat(child.staticClass, parent.staticClass),
  6091. class: isDef(child.class) ? [child.class, parent.class] : parent.class
  6092. };
  6093. }
  6094. function renderClass(staticClass, dynamicClass) {
  6095. if (isDef(staticClass) || isDef(dynamicClass)) {
  6096. return concat(staticClass, stringifyClass(dynamicClass));
  6097. }
  6098. /* istanbul ignore next */
  6099. return '';
  6100. }
  6101. function concat(a, b) {
  6102. return a ? (b ? a + ' ' + b : a) : b || '';
  6103. }
  6104. function stringifyClass(value) {
  6105. if (Array.isArray(value)) {
  6106. return stringifyArray(value);
  6107. }
  6108. if (isObject(value)) {
  6109. return stringifyObject(value);
  6110. }
  6111. if (typeof value === 'string') {
  6112. return value;
  6113. }
  6114. /* istanbul ignore next */
  6115. return '';
  6116. }
  6117. function stringifyArray(value) {
  6118. var res = '';
  6119. var stringified;
  6120. for (var i = 0, l = value.length; i < l; i++) {
  6121. if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') {
  6122. if (res)
  6123. res += ' ';
  6124. res += stringified;
  6125. }
  6126. }
  6127. return res;
  6128. }
  6129. function stringifyObject(value) {
  6130. var res = '';
  6131. for (var key in value) {
  6132. if (value[key]) {
  6133. if (res)
  6134. res += ' ';
  6135. res += key;
  6136. }
  6137. }
  6138. return res;
  6139. }
  6140. var namespaceMap = {
  6141. svg: 'http://www.w3.org/2000/svg',
  6142. math: 'http://www.w3.org/1998/Math/MathML'
  6143. };
  6144. var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
  6145. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  6146. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  6147. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  6148. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  6149. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  6150. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  6151. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  6152. 'output,progress,select,textarea,' +
  6153. 'details,dialog,menu,menuitem,summary,' +
  6154. 'content,element,shadow,template,blockquote,iframe,tfoot');
  6155. // this map is intentionally selective, only covering SVG elements that may
  6156. // contain child elements.
  6157. var isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  6158. 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  6159. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
  6160. var isPreTag = function (tag) { return tag === 'pre'; };
  6161. var isReservedTag = function (tag) {
  6162. return isHTMLTag(tag) || isSVG(tag);
  6163. };
  6164. function getTagNamespace(tag) {
  6165. if (isSVG(tag)) {
  6166. return 'svg';
  6167. }
  6168. // basic support for MathML
  6169. // note it doesn't support other MathML elements being component roots
  6170. if (tag === 'math') {
  6171. return 'math';
  6172. }
  6173. }
  6174. var unknownElementCache = Object.create(null);
  6175. function isUnknownElement(tag) {
  6176. /* istanbul ignore if */
  6177. if (!inBrowser) {
  6178. return true;
  6179. }
  6180. if (isReservedTag(tag)) {
  6181. return false;
  6182. }
  6183. tag = tag.toLowerCase();
  6184. /* istanbul ignore if */
  6185. if (unknownElementCache[tag] != null) {
  6186. return unknownElementCache[tag];
  6187. }
  6188. var el = document.createElement(tag);
  6189. if (tag.indexOf('-') > -1) {
  6190. // http://stackoverflow.com/a/28210364/1070244
  6191. return (unknownElementCache[tag] =
  6192. el.constructor === window.HTMLUnknownElement ||
  6193. el.constructor === window.HTMLElement);
  6194. }
  6195. else {
  6196. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()));
  6197. }
  6198. }
  6199. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  6200. /**
  6201. * Query an element selector if it's not an element already.
  6202. */
  6203. function query(el) {
  6204. if (typeof el === 'string') {
  6205. var selected = document.querySelector(el);
  6206. if (!selected) {
  6207. process.env.NODE_ENV !== 'production' && warn$2('Cannot find element: ' + el);
  6208. return document.createElement('div');
  6209. }
  6210. return selected;
  6211. }
  6212. else {
  6213. return el;
  6214. }
  6215. }
  6216. function createElement(tagName, vnode) {
  6217. var elm = document.createElement(tagName);
  6218. if (tagName !== 'select') {
  6219. return elm;
  6220. }
  6221. // false or null will remove the attribute but undefined will not
  6222. if (vnode.data &&
  6223. vnode.data.attrs &&
  6224. vnode.data.attrs.multiple !== undefined) {
  6225. elm.setAttribute('multiple', 'multiple');
  6226. }
  6227. return elm;
  6228. }
  6229. function createElementNS(namespace, tagName) {
  6230. return document.createElementNS(namespaceMap[namespace], tagName);
  6231. }
  6232. function createTextNode(text) {
  6233. return document.createTextNode(text);
  6234. }
  6235. function createComment(text) {
  6236. return document.createComment(text);
  6237. }
  6238. function insertBefore(parentNode, newNode, referenceNode) {
  6239. parentNode.insertBefore(newNode, referenceNode);
  6240. }
  6241. function removeChild(node, child) {
  6242. node.removeChild(child);
  6243. }
  6244. function appendChild(node, child) {
  6245. node.appendChild(child);
  6246. }
  6247. function parentNode(node) {
  6248. return node.parentNode;
  6249. }
  6250. function nextSibling(node) {
  6251. return node.nextSibling;
  6252. }
  6253. function tagName(node) {
  6254. return node.tagName;
  6255. }
  6256. function setTextContent(node, text) {
  6257. node.textContent = text;
  6258. }
  6259. function setStyleScope(node, scopeId) {
  6260. node.setAttribute(scopeId, '');
  6261. }
  6262. var nodeOps = /*#__PURE__*/Object.freeze({
  6263. __proto__: null,
  6264. createElement: createElement,
  6265. createElementNS: createElementNS,
  6266. createTextNode: createTextNode,
  6267. createComment: createComment,
  6268. insertBefore: insertBefore,
  6269. removeChild: removeChild,
  6270. appendChild: appendChild,
  6271. parentNode: parentNode,
  6272. nextSibling: nextSibling,
  6273. tagName: tagName,
  6274. setTextContent: setTextContent,
  6275. setStyleScope: setStyleScope
  6276. });
  6277. var ref = {
  6278. create: function (_, vnode) {
  6279. registerRef(vnode);
  6280. },
  6281. update: function (oldVnode, vnode) {
  6282. if (oldVnode.data.ref !== vnode.data.ref) {
  6283. registerRef(oldVnode, true);
  6284. registerRef(vnode);
  6285. }
  6286. },
  6287. destroy: function (vnode) {
  6288. registerRef(vnode, true);
  6289. }
  6290. };
  6291. function registerRef(vnode, isRemoval) {
  6292. var ref = vnode.data.ref;
  6293. if (!isDef(ref))
  6294. return;
  6295. var vm = vnode.context;
  6296. var refValue = vnode.componentInstance || vnode.elm;
  6297. var value = isRemoval ? null : refValue;
  6298. var $refsValue = isRemoval ? undefined : refValue;
  6299. if (isFunction(ref)) {
  6300. invokeWithErrorHandling(ref, vm, [value], vm, "template ref function");
  6301. return;
  6302. }
  6303. var isFor = vnode.data.refInFor;
  6304. var _isString = typeof ref === 'string' || typeof ref === 'number';
  6305. var _isRef = isRef(ref);
  6306. var refs = vm.$refs;
  6307. if (_isString || _isRef) {
  6308. if (isFor) {
  6309. var existing = _isString ? refs[ref] : ref.value;
  6310. if (isRemoval) {
  6311. isArray(existing) && remove$2(existing, refValue);
  6312. }
  6313. else {
  6314. if (!isArray(existing)) {
  6315. if (_isString) {
  6316. refs[ref] = [refValue];
  6317. setSetupRef(vm, ref, refs[ref]);
  6318. }
  6319. else {
  6320. ref.value = [refValue];
  6321. }
  6322. }
  6323. else if (!existing.includes(refValue)) {
  6324. existing.push(refValue);
  6325. }
  6326. }
  6327. }
  6328. else if (_isString) {
  6329. if (isRemoval && refs[ref] !== refValue) {
  6330. return;
  6331. }
  6332. refs[ref] = $refsValue;
  6333. setSetupRef(vm, ref, value);
  6334. }
  6335. else if (_isRef) {
  6336. if (isRemoval && ref.value !== refValue) {
  6337. return;
  6338. }
  6339. ref.value = value;
  6340. }
  6341. else if (process.env.NODE_ENV !== 'production') {
  6342. warn$2("Invalid template ref type: ".concat(typeof ref));
  6343. }
  6344. }
  6345. }
  6346. function setSetupRef(_a, key, val) {
  6347. var _setupState = _a._setupState;
  6348. if (_setupState && hasOwn(_setupState, key)) {
  6349. if (isRef(_setupState[key])) {
  6350. _setupState[key].value = val;
  6351. }
  6352. else {
  6353. _setupState[key] = val;
  6354. }
  6355. }
  6356. }
  6357. /**
  6358. * Virtual DOM patching algorithm based on Snabbdom by
  6359. * Simon Friis Vindum (@paldepind)
  6360. * Licensed under the MIT License
  6361. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  6362. *
  6363. * modified by Evan You (@yyx990803)
  6364. *
  6365. * Not type-checking this because this file is perf-critical and the cost
  6366. * of making flow understand it is not worth it.
  6367. */
  6368. var emptyNode = new VNode('', {}, []);
  6369. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  6370. function sameVnode(a, b) {
  6371. return (a.key === b.key &&
  6372. a.asyncFactory === b.asyncFactory &&
  6373. ((a.tag === b.tag &&
  6374. a.isComment === b.isComment &&
  6375. isDef(a.data) === isDef(b.data) &&
  6376. sameInputType(a, b)) ||
  6377. (isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error))));
  6378. }
  6379. function sameInputType(a, b) {
  6380. if (a.tag !== 'input')
  6381. return true;
  6382. var i;
  6383. var typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type;
  6384. var typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type;
  6385. return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB));
  6386. }
  6387. function createKeyToOldIdx(children, beginIdx, endIdx) {
  6388. var i, key;
  6389. var map = {};
  6390. for (i = beginIdx; i <= endIdx; ++i) {
  6391. key = children[i].key;
  6392. if (isDef(key))
  6393. map[key] = i;
  6394. }
  6395. return map;
  6396. }
  6397. function createPatchFunction(backend) {
  6398. var i, j;
  6399. var cbs = {};
  6400. var modules = backend.modules, nodeOps = backend.nodeOps;
  6401. for (i = 0; i < hooks.length; ++i) {
  6402. cbs[hooks[i]] = [];
  6403. for (j = 0; j < modules.length; ++j) {
  6404. if (isDef(modules[j][hooks[i]])) {
  6405. cbs[hooks[i]].push(modules[j][hooks[i]]);
  6406. }
  6407. }
  6408. }
  6409. function emptyNodeAt(elm) {
  6410. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);
  6411. }
  6412. function createRmCb(childElm, listeners) {
  6413. function remove() {
  6414. if (--remove.listeners === 0) {
  6415. removeNode(childElm);
  6416. }
  6417. }
  6418. remove.listeners = listeners;
  6419. return remove;
  6420. }
  6421. function removeNode(el) {
  6422. var parent = nodeOps.parentNode(el);
  6423. // element may have already been removed due to v-html / v-text
  6424. if (isDef(parent)) {
  6425. nodeOps.removeChild(parent, el);
  6426. }
  6427. }
  6428. function isUnknownElement(vnode, inVPre) {
  6429. return (!inVPre &&
  6430. !vnode.ns &&
  6431. !(config.ignoredElements.length &&
  6432. config.ignoredElements.some(function (ignore) {
  6433. return isRegExp(ignore)
  6434. ? ignore.test(vnode.tag)
  6435. : ignore === vnode.tag;
  6436. })) &&
  6437. config.isUnknownElement(vnode.tag));
  6438. }
  6439. var creatingElmInVPre = 0;
  6440. function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {
  6441. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6442. // This vnode was used in a previous render!
  6443. // now it's used as a new node, overwriting its elm would cause
  6444. // potential patch errors down the road when it's used as an insertion
  6445. // reference node. Instead, we clone the node on-demand before creating
  6446. // associated DOM element for it.
  6447. vnode = ownerArray[index] = cloneVNode(vnode);
  6448. }
  6449. vnode.isRootInsert = !nested; // for transition enter check
  6450. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  6451. return;
  6452. }
  6453. var data = vnode.data;
  6454. var children = vnode.children;
  6455. var tag = vnode.tag;
  6456. if (isDef(tag)) {
  6457. if (process.env.NODE_ENV !== 'production') {
  6458. if (data && data.pre) {
  6459. creatingElmInVPre++;
  6460. }
  6461. if (isUnknownElement(vnode, creatingElmInVPre)) {
  6462. warn$2('Unknown custom element: <' +
  6463. tag +
  6464. '> - did you ' +
  6465. 'register the component correctly? For recursive components, ' +
  6466. 'make sure to provide the "name" option.', vnode.context);
  6467. }
  6468. }
  6469. vnode.elm = vnode.ns
  6470. ? nodeOps.createElementNS(vnode.ns, tag)
  6471. : nodeOps.createElement(tag, vnode);
  6472. setScope(vnode);
  6473. createChildren(vnode, children, insertedVnodeQueue);
  6474. if (isDef(data)) {
  6475. invokeCreateHooks(vnode, insertedVnodeQueue);
  6476. }
  6477. insert(parentElm, vnode.elm, refElm);
  6478. if (process.env.NODE_ENV !== 'production' && data && data.pre) {
  6479. creatingElmInVPre--;
  6480. }
  6481. }
  6482. else if (isTrue(vnode.isComment)) {
  6483. vnode.elm = nodeOps.createComment(vnode.text);
  6484. insert(parentElm, vnode.elm, refElm);
  6485. }
  6486. else {
  6487. vnode.elm = nodeOps.createTextNode(vnode.text);
  6488. insert(parentElm, vnode.elm, refElm);
  6489. }
  6490. }
  6491. function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
  6492. var i = vnode.data;
  6493. if (isDef(i)) {
  6494. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  6495. if (isDef((i = i.hook)) && isDef((i = i.init))) {
  6496. i(vnode, false /* hydrating */);
  6497. }
  6498. // after calling the init hook, if the vnode is a child component
  6499. // it should've created a child instance and mounted it. the child
  6500. // component also has set the placeholder vnode's elm.
  6501. // in that case we can just return the element and be done.
  6502. if (isDef(vnode.componentInstance)) {
  6503. initComponent(vnode, insertedVnodeQueue);
  6504. insert(parentElm, vnode.elm, refElm);
  6505. if (isTrue(isReactivated)) {
  6506. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  6507. }
  6508. return true;
  6509. }
  6510. }
  6511. }
  6512. function initComponent(vnode, insertedVnodeQueue) {
  6513. if (isDef(vnode.data.pendingInsert)) {
  6514. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  6515. vnode.data.pendingInsert = null;
  6516. }
  6517. vnode.elm = vnode.componentInstance.$el;
  6518. if (isPatchable(vnode)) {
  6519. invokeCreateHooks(vnode, insertedVnodeQueue);
  6520. setScope(vnode);
  6521. }
  6522. else {
  6523. // empty component root.
  6524. // skip all element-related modules except for ref (#3455)
  6525. registerRef(vnode);
  6526. // make sure to invoke the insert hook
  6527. insertedVnodeQueue.push(vnode);
  6528. }
  6529. }
  6530. function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
  6531. var i;
  6532. // hack for #4339: a reactivated component with inner transition
  6533. // does not trigger because the inner node's created hooks are not called
  6534. // again. It's not ideal to involve module-specific logic in here but
  6535. // there doesn't seem to be a better way to do it.
  6536. var innerNode = vnode;
  6537. while (innerNode.componentInstance) {
  6538. innerNode = innerNode.componentInstance._vnode;
  6539. if (isDef((i = innerNode.data)) && isDef((i = i.transition))) {
  6540. for (i = 0; i < cbs.activate.length; ++i) {
  6541. cbs.activate[i](emptyNode, innerNode);
  6542. }
  6543. insertedVnodeQueue.push(innerNode);
  6544. break;
  6545. }
  6546. }
  6547. // unlike a newly created component,
  6548. // a reactivated keep-alive component doesn't insert itself
  6549. insert(parentElm, vnode.elm, refElm);
  6550. }
  6551. function insert(parent, elm, ref) {
  6552. if (isDef(parent)) {
  6553. if (isDef(ref)) {
  6554. if (nodeOps.parentNode(ref) === parent) {
  6555. nodeOps.insertBefore(parent, elm, ref);
  6556. }
  6557. }
  6558. else {
  6559. nodeOps.appendChild(parent, elm);
  6560. }
  6561. }
  6562. }
  6563. function createChildren(vnode, children, insertedVnodeQueue) {
  6564. if (isArray(children)) {
  6565. if (process.env.NODE_ENV !== 'production') {
  6566. checkDuplicateKeys(children);
  6567. }
  6568. for (var i_1 = 0; i_1 < children.length; ++i_1) {
  6569. createElm(children[i_1], insertedVnodeQueue, vnode.elm, null, true, children, i_1);
  6570. }
  6571. }
  6572. else if (isPrimitive(vnode.text)) {
  6573. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  6574. }
  6575. }
  6576. function isPatchable(vnode) {
  6577. while (vnode.componentInstance) {
  6578. vnode = vnode.componentInstance._vnode;
  6579. }
  6580. return isDef(vnode.tag);
  6581. }
  6582. function invokeCreateHooks(vnode, insertedVnodeQueue) {
  6583. for (var i_2 = 0; i_2 < cbs.create.length; ++i_2) {
  6584. cbs.create[i_2](emptyNode, vnode);
  6585. }
  6586. i = vnode.data.hook; // Reuse variable
  6587. if (isDef(i)) {
  6588. if (isDef(i.create))
  6589. i.create(emptyNode, vnode);
  6590. if (isDef(i.insert))
  6591. insertedVnodeQueue.push(vnode);
  6592. }
  6593. }
  6594. // set scope id attribute for scoped CSS.
  6595. // this is implemented as a special case to avoid the overhead
  6596. // of going through the normal attribute patching process.
  6597. function setScope(vnode) {
  6598. var i;
  6599. if (isDef((i = vnode.fnScopeId))) {
  6600. nodeOps.setStyleScope(vnode.elm, i);
  6601. }
  6602. else {
  6603. var ancestor = vnode;
  6604. while (ancestor) {
  6605. if (isDef((i = ancestor.context)) && isDef((i = i.$options._scopeId))) {
  6606. nodeOps.setStyleScope(vnode.elm, i);
  6607. }
  6608. ancestor = ancestor.parent;
  6609. }
  6610. }
  6611. // for slot content they should also get the scopeId from the host instance.
  6612. if (isDef((i = activeInstance)) &&
  6613. i !== vnode.context &&
  6614. i !== vnode.fnContext &&
  6615. isDef((i = i.$options._scopeId))) {
  6616. nodeOps.setStyleScope(vnode.elm, i);
  6617. }
  6618. }
  6619. function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  6620. for (; startIdx <= endIdx; ++startIdx) {
  6621. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  6622. }
  6623. }
  6624. function invokeDestroyHook(vnode) {
  6625. var i, j;
  6626. var data = vnode.data;
  6627. if (isDef(data)) {
  6628. if (isDef((i = data.hook)) && isDef((i = i.destroy)))
  6629. i(vnode);
  6630. for (i = 0; i < cbs.destroy.length; ++i)
  6631. cbs.destroy[i](vnode);
  6632. }
  6633. if (isDef((i = vnode.children))) {
  6634. for (j = 0; j < vnode.children.length; ++j) {
  6635. invokeDestroyHook(vnode.children[j]);
  6636. }
  6637. }
  6638. }
  6639. function removeVnodes(vnodes, startIdx, endIdx) {
  6640. for (; startIdx <= endIdx; ++startIdx) {
  6641. var ch = vnodes[startIdx];
  6642. if (isDef(ch)) {
  6643. if (isDef(ch.tag)) {
  6644. removeAndInvokeRemoveHook(ch);
  6645. invokeDestroyHook(ch);
  6646. }
  6647. else {
  6648. // Text node
  6649. removeNode(ch.elm);
  6650. }
  6651. }
  6652. }
  6653. }
  6654. function removeAndInvokeRemoveHook(vnode, rm) {
  6655. if (isDef(rm) || isDef(vnode.data)) {
  6656. var i_3;
  6657. var listeners = cbs.remove.length + 1;
  6658. if (isDef(rm)) {
  6659. // we have a recursively passed down rm callback
  6660. // increase the listeners count
  6661. rm.listeners += listeners;
  6662. }
  6663. else {
  6664. // directly removing
  6665. rm = createRmCb(vnode.elm, listeners);
  6666. }
  6667. // recursively invoke hooks on child component root node
  6668. if (isDef((i_3 = vnode.componentInstance)) &&
  6669. isDef((i_3 = i_3._vnode)) &&
  6670. isDef(i_3.data)) {
  6671. removeAndInvokeRemoveHook(i_3, rm);
  6672. }
  6673. for (i_3 = 0; i_3 < cbs.remove.length; ++i_3) {
  6674. cbs.remove[i_3](vnode, rm);
  6675. }
  6676. if (isDef((i_3 = vnode.data.hook)) && isDef((i_3 = i_3.remove))) {
  6677. i_3(vnode, rm);
  6678. }
  6679. else {
  6680. rm();
  6681. }
  6682. }
  6683. else {
  6684. removeNode(vnode.elm);
  6685. }
  6686. }
  6687. function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  6688. var oldStartIdx = 0;
  6689. var newStartIdx = 0;
  6690. var oldEndIdx = oldCh.length - 1;
  6691. var oldStartVnode = oldCh[0];
  6692. var oldEndVnode = oldCh[oldEndIdx];
  6693. var newEndIdx = newCh.length - 1;
  6694. var newStartVnode = newCh[0];
  6695. var newEndVnode = newCh[newEndIdx];
  6696. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  6697. // removeOnly is a special flag used only by <transition-group>
  6698. // to ensure removed elements stay in correct relative positions
  6699. // during leaving transitions
  6700. var canMove = !removeOnly;
  6701. if (process.env.NODE_ENV !== 'production') {
  6702. checkDuplicateKeys(newCh);
  6703. }
  6704. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  6705. if (isUndef(oldStartVnode)) {
  6706. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  6707. }
  6708. else if (isUndef(oldEndVnode)) {
  6709. oldEndVnode = oldCh[--oldEndIdx];
  6710. }
  6711. else if (sameVnode(oldStartVnode, newStartVnode)) {
  6712. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6713. oldStartVnode = oldCh[++oldStartIdx];
  6714. newStartVnode = newCh[++newStartIdx];
  6715. }
  6716. else if (sameVnode(oldEndVnode, newEndVnode)) {
  6717. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6718. oldEndVnode = oldCh[--oldEndIdx];
  6719. newEndVnode = newCh[--newEndIdx];
  6720. }
  6721. else if (sameVnode(oldStartVnode, newEndVnode)) {
  6722. // Vnode moved right
  6723. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6724. canMove &&
  6725. nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  6726. oldStartVnode = oldCh[++oldStartIdx];
  6727. newEndVnode = newCh[--newEndIdx];
  6728. }
  6729. else if (sameVnode(oldEndVnode, newStartVnode)) {
  6730. // Vnode moved left
  6731. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6732. canMove &&
  6733. nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  6734. oldEndVnode = oldCh[--oldEndIdx];
  6735. newStartVnode = newCh[++newStartIdx];
  6736. }
  6737. else {
  6738. if (isUndef(oldKeyToIdx))
  6739. oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
  6740. idxInOld = isDef(newStartVnode.key)
  6741. ? oldKeyToIdx[newStartVnode.key]
  6742. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  6743. if (isUndef(idxInOld)) {
  6744. // New element
  6745. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6746. }
  6747. else {
  6748. vnodeToMove = oldCh[idxInOld];
  6749. if (sameVnode(vnodeToMove, newStartVnode)) {
  6750. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6751. oldCh[idxInOld] = undefined;
  6752. canMove &&
  6753. nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  6754. }
  6755. else {
  6756. // same key but different element. treat as new element
  6757. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6758. }
  6759. }
  6760. newStartVnode = newCh[++newStartIdx];
  6761. }
  6762. }
  6763. if (oldStartIdx > oldEndIdx) {
  6764. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  6765. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  6766. }
  6767. else if (newStartIdx > newEndIdx) {
  6768. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  6769. }
  6770. }
  6771. function checkDuplicateKeys(children) {
  6772. var seenKeys = {};
  6773. for (var i_4 = 0; i_4 < children.length; i_4++) {
  6774. var vnode = children[i_4];
  6775. var key = vnode.key;
  6776. if (isDef(key)) {
  6777. if (seenKeys[key]) {
  6778. warn$2("Duplicate keys detected: '".concat(key, "'. This may cause an update error."), vnode.context);
  6779. }
  6780. else {
  6781. seenKeys[key] = true;
  6782. }
  6783. }
  6784. }
  6785. }
  6786. function findIdxInOld(node, oldCh, start, end) {
  6787. for (var i_5 = start; i_5 < end; i_5++) {
  6788. var c = oldCh[i_5];
  6789. if (isDef(c) && sameVnode(node, c))
  6790. return i_5;
  6791. }
  6792. }
  6793. function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {
  6794. if (oldVnode === vnode) {
  6795. return;
  6796. }
  6797. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6798. // clone reused vnode
  6799. vnode = ownerArray[index] = cloneVNode(vnode);
  6800. }
  6801. var elm = (vnode.elm = oldVnode.elm);
  6802. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  6803. if (isDef(vnode.asyncFactory.resolved)) {
  6804. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  6805. }
  6806. else {
  6807. vnode.isAsyncPlaceholder = true;
  6808. }
  6809. return;
  6810. }
  6811. // reuse element for static trees.
  6812. // note we only do this if the vnode is cloned -
  6813. // if the new node is not cloned it means the render functions have been
  6814. // reset by the hot-reload-api and we need to do a proper re-render.
  6815. if (isTrue(vnode.isStatic) &&
  6816. isTrue(oldVnode.isStatic) &&
  6817. vnode.key === oldVnode.key &&
  6818. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
  6819. vnode.componentInstance = oldVnode.componentInstance;
  6820. return;
  6821. }
  6822. var i;
  6823. var data = vnode.data;
  6824. if (isDef(data) && isDef((i = data.hook)) && isDef((i = i.prepatch))) {
  6825. i(oldVnode, vnode);
  6826. }
  6827. var oldCh = oldVnode.children;
  6828. var ch = vnode.children;
  6829. if (isDef(data) && isPatchable(vnode)) {
  6830. for (i = 0; i < cbs.update.length; ++i)
  6831. cbs.update[i](oldVnode, vnode);
  6832. if (isDef((i = data.hook)) && isDef((i = i.update)))
  6833. i(oldVnode, vnode);
  6834. }
  6835. if (isUndef(vnode.text)) {
  6836. if (isDef(oldCh) && isDef(ch)) {
  6837. if (oldCh !== ch)
  6838. updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
  6839. }
  6840. else if (isDef(ch)) {
  6841. if (process.env.NODE_ENV !== 'production') {
  6842. checkDuplicateKeys(ch);
  6843. }
  6844. if (isDef(oldVnode.text))
  6845. nodeOps.setTextContent(elm, '');
  6846. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  6847. }
  6848. else if (isDef(oldCh)) {
  6849. removeVnodes(oldCh, 0, oldCh.length - 1);
  6850. }
  6851. else if (isDef(oldVnode.text)) {
  6852. nodeOps.setTextContent(elm, '');
  6853. }
  6854. }
  6855. else if (oldVnode.text !== vnode.text) {
  6856. nodeOps.setTextContent(elm, vnode.text);
  6857. }
  6858. if (isDef(data)) {
  6859. if (isDef((i = data.hook)) && isDef((i = i.postpatch)))
  6860. i(oldVnode, vnode);
  6861. }
  6862. }
  6863. function invokeInsertHook(vnode, queue, initial) {
  6864. // delay insert hooks for component root nodes, invoke them after the
  6865. // element is really inserted
  6866. if (isTrue(initial) && isDef(vnode.parent)) {
  6867. vnode.parent.data.pendingInsert = queue;
  6868. }
  6869. else {
  6870. for (var i_6 = 0; i_6 < queue.length; ++i_6) {
  6871. queue[i_6].data.hook.insert(queue[i_6]);
  6872. }
  6873. }
  6874. }
  6875. var hydrationBailed = false;
  6876. // list of modules that can skip create hook during hydration because they
  6877. // are already rendered on the client or has no need for initialization
  6878. // Note: style is excluded because it relies on initial clone for future
  6879. // deep updates (#7063).
  6880. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  6881. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  6882. function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
  6883. var i;
  6884. var tag = vnode.tag, data = vnode.data, children = vnode.children;
  6885. inVPre = inVPre || (data && data.pre);
  6886. vnode.elm = elm;
  6887. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  6888. vnode.isAsyncPlaceholder = true;
  6889. return true;
  6890. }
  6891. // assert node match
  6892. if (process.env.NODE_ENV !== 'production') {
  6893. if (!assertNodeMatch(elm, vnode, inVPre)) {
  6894. return false;
  6895. }
  6896. }
  6897. if (isDef(data)) {
  6898. if (isDef((i = data.hook)) && isDef((i = i.init)))
  6899. i(vnode, true /* hydrating */);
  6900. if (isDef((i = vnode.componentInstance))) {
  6901. // child component. it should have hydrated its own tree.
  6902. initComponent(vnode, insertedVnodeQueue);
  6903. return true;
  6904. }
  6905. }
  6906. if (isDef(tag)) {
  6907. if (isDef(children)) {
  6908. // empty element, allow client to pick up and populate children
  6909. if (!elm.hasChildNodes()) {
  6910. createChildren(vnode, children, insertedVnodeQueue);
  6911. }
  6912. else {
  6913. // v-html and domProps: innerHTML
  6914. if (isDef((i = data)) &&
  6915. isDef((i = i.domProps)) &&
  6916. isDef((i = i.innerHTML))) {
  6917. if (i !== elm.innerHTML) {
  6918. /* istanbul ignore if */
  6919. if (process.env.NODE_ENV !== 'production' &&
  6920. typeof console !== 'undefined' &&
  6921. !hydrationBailed) {
  6922. hydrationBailed = true;
  6923. console.warn('Parent: ', elm);
  6924. console.warn('server innerHTML: ', i);
  6925. console.warn('client innerHTML: ', elm.innerHTML);
  6926. }
  6927. return false;
  6928. }
  6929. }
  6930. else {
  6931. // iterate and compare children lists
  6932. var childrenMatch = true;
  6933. var childNode = elm.firstChild;
  6934. for (var i_7 = 0; i_7 < children.length; i_7++) {
  6935. if (!childNode ||
  6936. !hydrate(childNode, children[i_7], insertedVnodeQueue, inVPre)) {
  6937. childrenMatch = false;
  6938. break;
  6939. }
  6940. childNode = childNode.nextSibling;
  6941. }
  6942. // if childNode is not null, it means the actual childNodes list is
  6943. // longer than the virtual children list.
  6944. if (!childrenMatch || childNode) {
  6945. /* istanbul ignore if */
  6946. if (process.env.NODE_ENV !== 'production' &&
  6947. typeof console !== 'undefined' &&
  6948. !hydrationBailed) {
  6949. hydrationBailed = true;
  6950. console.warn('Parent: ', elm);
  6951. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  6952. }
  6953. return false;
  6954. }
  6955. }
  6956. }
  6957. }
  6958. if (isDef(data)) {
  6959. var fullInvoke = false;
  6960. for (var key in data) {
  6961. if (!isRenderedModule(key)) {
  6962. fullInvoke = true;
  6963. invokeCreateHooks(vnode, insertedVnodeQueue);
  6964. break;
  6965. }
  6966. }
  6967. if (!fullInvoke && data['class']) {
  6968. // ensure collecting deps for deep class bindings for future updates
  6969. traverse(data['class']);
  6970. }
  6971. }
  6972. }
  6973. else if (elm.data !== vnode.text) {
  6974. elm.data = vnode.text;
  6975. }
  6976. return true;
  6977. }
  6978. function assertNodeMatch(node, vnode, inVPre) {
  6979. if (isDef(vnode.tag)) {
  6980. return (vnode.tag.indexOf('vue-component') === 0 ||
  6981. (!isUnknownElement(vnode, inVPre) &&
  6982. vnode.tag.toLowerCase() ===
  6983. (node.tagName && node.tagName.toLowerCase())));
  6984. }
  6985. else {
  6986. return node.nodeType === (vnode.isComment ? 8 : 3);
  6987. }
  6988. }
  6989. return function patch(oldVnode, vnode, hydrating, removeOnly) {
  6990. if (isUndef(vnode)) {
  6991. if (isDef(oldVnode))
  6992. invokeDestroyHook(oldVnode);
  6993. return;
  6994. }
  6995. var isInitialPatch = false;
  6996. var insertedVnodeQueue = [];
  6997. if (isUndef(oldVnode)) {
  6998. // empty mount (likely as component), create new root element
  6999. isInitialPatch = true;
  7000. createElm(vnode, insertedVnodeQueue);
  7001. }
  7002. else {
  7003. var isRealElement = isDef(oldVnode.nodeType);
  7004. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  7005. // patch existing root node
  7006. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  7007. }
  7008. else {
  7009. if (isRealElement) {
  7010. // mounting to a real element
  7011. // check if this is server-rendered content and if we can perform
  7012. // a successful hydration.
  7013. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  7014. oldVnode.removeAttribute(SSR_ATTR);
  7015. hydrating = true;
  7016. }
  7017. if (isTrue(hydrating)) {
  7018. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  7019. invokeInsertHook(vnode, insertedVnodeQueue, true);
  7020. return oldVnode;
  7021. }
  7022. else if (process.env.NODE_ENV !== 'production') {
  7023. warn$2('The client-side rendered virtual DOM tree is not matching ' +
  7024. 'server-rendered content. This is likely caused by incorrect ' +
  7025. 'HTML markup, for example nesting block-level elements inside ' +
  7026. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  7027. 'full client-side render.');
  7028. }
  7029. }
  7030. // either not server-rendered, or hydration failed.
  7031. // create an empty node and replace it
  7032. oldVnode = emptyNodeAt(oldVnode);
  7033. }
  7034. // replacing existing element
  7035. var oldElm = oldVnode.elm;
  7036. var parentElm = nodeOps.parentNode(oldElm);
  7037. // create new node
  7038. createElm(vnode, insertedVnodeQueue,
  7039. // extremely rare edge case: do not insert if old element is in a
  7040. // leaving transition. Only happens when combining transition +
  7041. // keep-alive + HOCs. (#4590)
  7042. oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm));
  7043. // update parent placeholder node element, recursively
  7044. if (isDef(vnode.parent)) {
  7045. var ancestor = vnode.parent;
  7046. var patchable = isPatchable(vnode);
  7047. while (ancestor) {
  7048. for (var i_8 = 0; i_8 < cbs.destroy.length; ++i_8) {
  7049. cbs.destroy[i_8](ancestor);
  7050. }
  7051. ancestor.elm = vnode.elm;
  7052. if (patchable) {
  7053. for (var i_9 = 0; i_9 < cbs.create.length; ++i_9) {
  7054. cbs.create[i_9](emptyNode, ancestor);
  7055. }
  7056. // #6513
  7057. // invoke insert hooks that may have been merged by create hooks.
  7058. // e.g. for directives that uses the "inserted" hook.
  7059. var insert_1 = ancestor.data.hook.insert;
  7060. if (insert_1.merged) {
  7061. // start at index 1 to avoid re-invoking component mounted hook
  7062. for (var i_10 = 1; i_10 < insert_1.fns.length; i_10++) {
  7063. insert_1.fns[i_10]();
  7064. }
  7065. }
  7066. }
  7067. else {
  7068. registerRef(ancestor);
  7069. }
  7070. ancestor = ancestor.parent;
  7071. }
  7072. }
  7073. // destroy old node
  7074. if (isDef(parentElm)) {
  7075. removeVnodes([oldVnode], 0, 0);
  7076. }
  7077. else if (isDef(oldVnode.tag)) {
  7078. invokeDestroyHook(oldVnode);
  7079. }
  7080. }
  7081. }
  7082. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  7083. return vnode.elm;
  7084. };
  7085. }
  7086. var directives$1 = {
  7087. create: updateDirectives,
  7088. update: updateDirectives,
  7089. destroy: function unbindDirectives(vnode) {
  7090. // @ts-expect-error emptyNode is not VNodeWithData
  7091. updateDirectives(vnode, emptyNode);
  7092. }
  7093. };
  7094. function updateDirectives(oldVnode, vnode) {
  7095. if (oldVnode.data.directives || vnode.data.directives) {
  7096. _update(oldVnode, vnode);
  7097. }
  7098. }
  7099. function _update(oldVnode, vnode) {
  7100. var isCreate = oldVnode === emptyNode;
  7101. var isDestroy = vnode === emptyNode;
  7102. var oldDirs = normalizeDirectives(oldVnode.data.directives, oldVnode.context);
  7103. var newDirs = normalizeDirectives(vnode.data.directives, vnode.context);
  7104. var dirsWithInsert = [];
  7105. var dirsWithPostpatch = [];
  7106. var key, oldDir, dir;
  7107. for (key in newDirs) {
  7108. oldDir = oldDirs[key];
  7109. dir = newDirs[key];
  7110. if (!oldDir) {
  7111. // new directive, bind
  7112. callHook(dir, 'bind', vnode, oldVnode);
  7113. if (dir.def && dir.def.inserted) {
  7114. dirsWithInsert.push(dir);
  7115. }
  7116. }
  7117. else {
  7118. // existing directive, update
  7119. dir.oldValue = oldDir.value;
  7120. dir.oldArg = oldDir.arg;
  7121. callHook(dir, 'update', vnode, oldVnode);
  7122. if (dir.def && dir.def.componentUpdated) {
  7123. dirsWithPostpatch.push(dir);
  7124. }
  7125. }
  7126. }
  7127. if (dirsWithInsert.length) {
  7128. var callInsert = function () {
  7129. for (var i = 0; i < dirsWithInsert.length; i++) {
  7130. callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  7131. }
  7132. };
  7133. if (isCreate) {
  7134. mergeVNodeHook(vnode, 'insert', callInsert);
  7135. }
  7136. else {
  7137. callInsert();
  7138. }
  7139. }
  7140. if (dirsWithPostpatch.length) {
  7141. mergeVNodeHook(vnode, 'postpatch', function () {
  7142. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  7143. callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  7144. }
  7145. });
  7146. }
  7147. if (!isCreate) {
  7148. for (key in oldDirs) {
  7149. if (!newDirs[key]) {
  7150. // no longer present, unbind
  7151. callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  7152. }
  7153. }
  7154. }
  7155. }
  7156. var emptyModifiers = Object.create(null);
  7157. function normalizeDirectives(dirs, vm) {
  7158. var res = Object.create(null);
  7159. if (!dirs) {
  7160. // $flow-disable-line
  7161. return res;
  7162. }
  7163. var i, dir;
  7164. for (i = 0; i < dirs.length; i++) {
  7165. dir = dirs[i];
  7166. if (!dir.modifiers) {
  7167. // $flow-disable-line
  7168. dir.modifiers = emptyModifiers;
  7169. }
  7170. res[getRawDirName(dir)] = dir;
  7171. if (vm._setupState && vm._setupState.__sfc) {
  7172. var setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
  7173. if (typeof setupDef === 'function') {
  7174. dir.def = {
  7175. bind: setupDef,
  7176. update: setupDef,
  7177. };
  7178. }
  7179. else {
  7180. dir.def = setupDef;
  7181. }
  7182. }
  7183. dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
  7184. }
  7185. // $flow-disable-line
  7186. return res;
  7187. }
  7188. function getRawDirName(dir) {
  7189. return (dir.rawName || "".concat(dir.name, ".").concat(Object.keys(dir.modifiers || {}).join('.')));
  7190. }
  7191. function callHook(dir, hook, vnode, oldVnode, isDestroy) {
  7192. var fn = dir.def && dir.def[hook];
  7193. if (fn) {
  7194. try {
  7195. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  7196. }
  7197. catch (e) {
  7198. handleError(e, vnode.context, "directive ".concat(dir.name, " ").concat(hook, " hook"));
  7199. }
  7200. }
  7201. }
  7202. var baseModules = [ref, directives$1];
  7203. function updateAttrs(oldVnode, vnode) {
  7204. var opts = vnode.componentOptions;
  7205. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  7206. return;
  7207. }
  7208. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  7209. return;
  7210. }
  7211. var key, cur, old;
  7212. var elm = vnode.elm;
  7213. var oldAttrs = oldVnode.data.attrs || {};
  7214. var attrs = vnode.data.attrs || {};
  7215. // clone observed objects, as the user probably wants to mutate it
  7216. if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) {
  7217. attrs = vnode.data.attrs = extend({}, attrs);
  7218. }
  7219. for (key in attrs) {
  7220. cur = attrs[key];
  7221. old = oldAttrs[key];
  7222. if (old !== cur) {
  7223. setAttr(elm, key, cur, vnode.data.pre);
  7224. }
  7225. }
  7226. // #4391: in IE9, setting type can reset value for input[type=radio]
  7227. // #6666: IE/Edge forces progress value down to 1 before setting a max
  7228. /* istanbul ignore if */
  7229. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  7230. setAttr(elm, 'value', attrs.value);
  7231. }
  7232. for (key in oldAttrs) {
  7233. if (isUndef(attrs[key])) {
  7234. if (isXlink(key)) {
  7235. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  7236. }
  7237. else if (!isEnumeratedAttr(key)) {
  7238. elm.removeAttribute(key);
  7239. }
  7240. }
  7241. }
  7242. }
  7243. function setAttr(el, key, value, isInPre) {
  7244. if (isInPre || el.tagName.indexOf('-') > -1) {
  7245. baseSetAttr(el, key, value);
  7246. }
  7247. else if (isBooleanAttr(key)) {
  7248. // set attribute for blank value
  7249. // e.g. <option disabled>Select one</option>
  7250. if (isFalsyAttrValue(value)) {
  7251. el.removeAttribute(key);
  7252. }
  7253. else {
  7254. // technically allowfullscreen is a boolean attribute for <iframe>,
  7255. // but Flash expects a value of "true" when used on <embed> tag
  7256. value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key;
  7257. el.setAttribute(key, value);
  7258. }
  7259. }
  7260. else if (isEnumeratedAttr(key)) {
  7261. el.setAttribute(key, convertEnumeratedValue(key, value));
  7262. }
  7263. else if (isXlink(key)) {
  7264. if (isFalsyAttrValue(value)) {
  7265. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  7266. }
  7267. else {
  7268. el.setAttributeNS(xlinkNS, key, value);
  7269. }
  7270. }
  7271. else {
  7272. baseSetAttr(el, key, value);
  7273. }
  7274. }
  7275. function baseSetAttr(el, key, value) {
  7276. if (isFalsyAttrValue(value)) {
  7277. el.removeAttribute(key);
  7278. }
  7279. else {
  7280. // #7138: IE10 & 11 fires input event when setting placeholder on
  7281. // <textarea>... block the first input event and remove the blocker
  7282. // immediately.
  7283. /* istanbul ignore if */
  7284. if (isIE &&
  7285. !isIE9 &&
  7286. el.tagName === 'TEXTAREA' &&
  7287. key === 'placeholder' &&
  7288. value !== '' &&
  7289. !el.__ieph) {
  7290. var blocker_1 = function (e) {
  7291. e.stopImmediatePropagation();
  7292. el.removeEventListener('input', blocker_1);
  7293. };
  7294. el.addEventListener('input', blocker_1);
  7295. // $flow-disable-line
  7296. el.__ieph = true; /* IE placeholder patched */
  7297. }
  7298. el.setAttribute(key, value);
  7299. }
  7300. }
  7301. var attrs = {
  7302. create: updateAttrs,
  7303. update: updateAttrs
  7304. };
  7305. function updateClass(oldVnode, vnode) {
  7306. var el = vnode.elm;
  7307. var data = vnode.data;
  7308. var oldData = oldVnode.data;
  7309. if (isUndef(data.staticClass) &&
  7310. isUndef(data.class) &&
  7311. (isUndef(oldData) ||
  7312. (isUndef(oldData.staticClass) && isUndef(oldData.class)))) {
  7313. return;
  7314. }
  7315. var cls = genClassForVnode(vnode);
  7316. // handle transition classes
  7317. var transitionClass = el._transitionClasses;
  7318. if (isDef(transitionClass)) {
  7319. cls = concat(cls, stringifyClass(transitionClass));
  7320. }
  7321. // set the class
  7322. if (cls !== el._prevClass) {
  7323. el.setAttribute('class', cls);
  7324. el._prevClass = cls;
  7325. }
  7326. }
  7327. var klass$1 = {
  7328. create: updateClass,
  7329. update: updateClass
  7330. };
  7331. var validDivisionCharRE = /[\w).+\-_$\]]/;
  7332. function parseFilters(exp) {
  7333. var inSingle = false;
  7334. var inDouble = false;
  7335. var inTemplateString = false;
  7336. var inRegex = false;
  7337. var curly = 0;
  7338. var square = 0;
  7339. var paren = 0;
  7340. var lastFilterIndex = 0;
  7341. var c, prev, i, expression, filters;
  7342. for (i = 0; i < exp.length; i++) {
  7343. prev = c;
  7344. c = exp.charCodeAt(i);
  7345. if (inSingle) {
  7346. if (c === 0x27 && prev !== 0x5c)
  7347. inSingle = false;
  7348. }
  7349. else if (inDouble) {
  7350. if (c === 0x22 && prev !== 0x5c)
  7351. inDouble = false;
  7352. }
  7353. else if (inTemplateString) {
  7354. if (c === 0x60 && prev !== 0x5c)
  7355. inTemplateString = false;
  7356. }
  7357. else if (inRegex) {
  7358. if (c === 0x2f && prev !== 0x5c)
  7359. inRegex = false;
  7360. }
  7361. else if (c === 0x7c && // pipe
  7362. exp.charCodeAt(i + 1) !== 0x7c &&
  7363. exp.charCodeAt(i - 1) !== 0x7c &&
  7364. !curly &&
  7365. !square &&
  7366. !paren) {
  7367. if (expression === undefined) {
  7368. // first filter, end of expression
  7369. lastFilterIndex = i + 1;
  7370. expression = exp.slice(0, i).trim();
  7371. }
  7372. else {
  7373. pushFilter();
  7374. }
  7375. }
  7376. else {
  7377. switch (c) {
  7378. case 0x22:
  7379. inDouble = true;
  7380. break; // "
  7381. case 0x27:
  7382. inSingle = true;
  7383. break; // '
  7384. case 0x60:
  7385. inTemplateString = true;
  7386. break; // `
  7387. case 0x28:
  7388. paren++;
  7389. break; // (
  7390. case 0x29:
  7391. paren--;
  7392. break; // )
  7393. case 0x5b:
  7394. square++;
  7395. break; // [
  7396. case 0x5d:
  7397. square--;
  7398. break; // ]
  7399. case 0x7b:
  7400. curly++;
  7401. break; // {
  7402. case 0x7d:
  7403. curly--;
  7404. break; // }
  7405. }
  7406. if (c === 0x2f) {
  7407. // /
  7408. var j = i - 1;
  7409. var p
  7410. // find first non-whitespace prev char
  7411. = void 0;
  7412. // find first non-whitespace prev char
  7413. for (; j >= 0; j--) {
  7414. p = exp.charAt(j);
  7415. if (p !== ' ')
  7416. break;
  7417. }
  7418. if (!p || !validDivisionCharRE.test(p)) {
  7419. inRegex = true;
  7420. }
  7421. }
  7422. }
  7423. }
  7424. if (expression === undefined) {
  7425. expression = exp.slice(0, i).trim();
  7426. }
  7427. else if (lastFilterIndex !== 0) {
  7428. pushFilter();
  7429. }
  7430. function pushFilter() {
  7431. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  7432. lastFilterIndex = i + 1;
  7433. }
  7434. if (filters) {
  7435. for (i = 0; i < filters.length; i++) {
  7436. expression = wrapFilter(expression, filters[i]);
  7437. }
  7438. }
  7439. return expression;
  7440. }
  7441. function wrapFilter(exp, filter) {
  7442. var i = filter.indexOf('(');
  7443. if (i < 0) {
  7444. // _f: resolveFilter
  7445. return "_f(\"".concat(filter, "\")(").concat(exp, ")");
  7446. }
  7447. else {
  7448. var name_1 = filter.slice(0, i);
  7449. var args = filter.slice(i + 1);
  7450. return "_f(\"".concat(name_1, "\")(").concat(exp).concat(args !== ')' ? ',' + args : args);
  7451. }
  7452. }
  7453. /* eslint-disable no-unused-vars */
  7454. function baseWarn(msg, range) {
  7455. console.error("[Vue compiler]: ".concat(msg));
  7456. }
  7457. /* eslint-enable no-unused-vars */
  7458. function pluckModuleFunction(modules, key) {
  7459. return modules ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; }) : [];
  7460. }
  7461. function addProp(el, name, value, range, dynamic) {
  7462. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  7463. el.plain = false;
  7464. }
  7465. function addAttr(el, name, value, range, dynamic) {
  7466. var attrs = dynamic
  7467. ? el.dynamicAttrs || (el.dynamicAttrs = [])
  7468. : el.attrs || (el.attrs = []);
  7469. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  7470. el.plain = false;
  7471. }
  7472. // add a raw attr (use this in preTransforms)
  7473. function addRawAttr(el, name, value, range) {
  7474. el.attrsMap[name] = value;
  7475. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  7476. }
  7477. function addDirective(el, name, rawName, value, arg, isDynamicArg, modifiers, range) {
  7478. (el.directives || (el.directives = [])).push(rangeSetItem({
  7479. name: name,
  7480. rawName: rawName,
  7481. value: value,
  7482. arg: arg,
  7483. isDynamicArg: isDynamicArg,
  7484. modifiers: modifiers
  7485. }, range));
  7486. el.plain = false;
  7487. }
  7488. function prependModifierMarker(symbol, name, dynamic) {
  7489. return dynamic ? "_p(".concat(name, ",\"").concat(symbol, "\")") : symbol + name; // mark the event as captured
  7490. }
  7491. function addHandler(el, name, value, modifiers, important, warn, range, dynamic) {
  7492. modifiers = modifiers || emptyObject;
  7493. // warn prevent and passive modifier
  7494. /* istanbul ignore if */
  7495. if (process.env.NODE_ENV !== 'production' && warn && modifiers.prevent && modifiers.passive) {
  7496. warn("passive and prevent can't be used together. " +
  7497. "Passive handler can't prevent default event.", range);
  7498. }
  7499. // normalize click.right and click.middle since they don't actually fire
  7500. // this is technically browser-specific, but at least for now browsers are
  7501. // the only target envs that have right/middle clicks.
  7502. if (modifiers.right) {
  7503. if (dynamic) {
  7504. name = "(".concat(name, ")==='click'?'contextmenu':(").concat(name, ")");
  7505. }
  7506. else if (name === 'click') {
  7507. name = 'contextmenu';
  7508. delete modifiers.right;
  7509. }
  7510. }
  7511. else if (modifiers.middle) {
  7512. if (dynamic) {
  7513. name = "(".concat(name, ")==='click'?'mouseup':(").concat(name, ")");
  7514. }
  7515. else if (name === 'click') {
  7516. name = 'mouseup';
  7517. }
  7518. }
  7519. // check capture modifier
  7520. if (modifiers.capture) {
  7521. delete modifiers.capture;
  7522. name = prependModifierMarker('!', name, dynamic);
  7523. }
  7524. if (modifiers.once) {
  7525. delete modifiers.once;
  7526. name = prependModifierMarker('~', name, dynamic);
  7527. }
  7528. /* istanbul ignore if */
  7529. if (modifiers.passive) {
  7530. delete modifiers.passive;
  7531. name = prependModifierMarker('&', name, dynamic);
  7532. }
  7533. var events;
  7534. if (modifiers.native) {
  7535. delete modifiers.native;
  7536. events = el.nativeEvents || (el.nativeEvents = {});
  7537. }
  7538. else {
  7539. events = el.events || (el.events = {});
  7540. }
  7541. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  7542. if (modifiers !== emptyObject) {
  7543. newHandler.modifiers = modifiers;
  7544. }
  7545. var handlers = events[name];
  7546. /* istanbul ignore if */
  7547. if (Array.isArray(handlers)) {
  7548. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  7549. }
  7550. else if (handlers) {
  7551. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  7552. }
  7553. else {
  7554. events[name] = newHandler;
  7555. }
  7556. el.plain = false;
  7557. }
  7558. function getRawBindingAttr(el, name) {
  7559. return (el.rawAttrsMap[':' + name] ||
  7560. el.rawAttrsMap['v-bind:' + name] ||
  7561. el.rawAttrsMap[name]);
  7562. }
  7563. function getBindingAttr(el, name, getStatic) {
  7564. var dynamicValue = getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name);
  7565. if (dynamicValue != null) {
  7566. return parseFilters(dynamicValue);
  7567. }
  7568. else if (getStatic !== false) {
  7569. var staticValue = getAndRemoveAttr(el, name);
  7570. if (staticValue != null) {
  7571. return JSON.stringify(staticValue);
  7572. }
  7573. }
  7574. }
  7575. // note: this only removes the attr from the Array (attrsList) so that it
  7576. // doesn't get processed by processAttrs.
  7577. // By default it does NOT remove it from the map (attrsMap) because the map is
  7578. // needed during codegen.
  7579. function getAndRemoveAttr(el, name, removeFromMap) {
  7580. var val;
  7581. if ((val = el.attrsMap[name]) != null) {
  7582. var list = el.attrsList;
  7583. for (var i = 0, l = list.length; i < l; i++) {
  7584. if (list[i].name === name) {
  7585. list.splice(i, 1);
  7586. break;
  7587. }
  7588. }
  7589. }
  7590. if (removeFromMap) {
  7591. delete el.attrsMap[name];
  7592. }
  7593. return val;
  7594. }
  7595. function getAndRemoveAttrByRegex(el, name) {
  7596. var list = el.attrsList;
  7597. for (var i = 0, l = list.length; i < l; i++) {
  7598. var attr = list[i];
  7599. if (name.test(attr.name)) {
  7600. list.splice(i, 1);
  7601. return attr;
  7602. }
  7603. }
  7604. }
  7605. function rangeSetItem(item, range) {
  7606. if (range) {
  7607. if (range.start != null) {
  7608. item.start = range.start;
  7609. }
  7610. if (range.end != null) {
  7611. item.end = range.end;
  7612. }
  7613. }
  7614. return item;
  7615. }
  7616. /**
  7617. * Cross-platform code generation for component v-model
  7618. */
  7619. function genComponentModel(el, value, modifiers) {
  7620. var _a = modifiers || {}, number = _a.number, trim = _a.trim;
  7621. var baseValueExpression = '$$v';
  7622. var valueExpression = baseValueExpression;
  7623. if (trim) {
  7624. valueExpression =
  7625. "(typeof ".concat(baseValueExpression, " === 'string'") +
  7626. "? ".concat(baseValueExpression, ".trim()") +
  7627. ": ".concat(baseValueExpression, ")");
  7628. }
  7629. if (number) {
  7630. valueExpression = "_n(".concat(valueExpression, ")");
  7631. }
  7632. var assignment = genAssignmentCode(value, valueExpression);
  7633. el.model = {
  7634. value: "(".concat(value, ")"),
  7635. expression: JSON.stringify(value),
  7636. callback: "function (".concat(baseValueExpression, ") {").concat(assignment, "}")
  7637. };
  7638. }
  7639. /**
  7640. * Cross-platform codegen helper for generating v-model value assignment code.
  7641. */
  7642. function genAssignmentCode(value, assignment) {
  7643. var res = parseModel(value);
  7644. if (res.key === null) {
  7645. return "".concat(value, "=").concat(assignment);
  7646. }
  7647. else {
  7648. return "$set(".concat(res.exp, ", ").concat(res.key, ", ").concat(assignment, ")");
  7649. }
  7650. }
  7651. /**
  7652. * Parse a v-model expression into a base path and a final key segment.
  7653. * Handles both dot-path and possible square brackets.
  7654. *
  7655. * Possible cases:
  7656. *
  7657. * - test
  7658. * - test[key]
  7659. * - test[test1[key]]
  7660. * - test["a"][key]
  7661. * - xxx.test[a[a].test1[key]]
  7662. * - test.xxx.a["asa"][test1[key]]
  7663. *
  7664. */
  7665. var len, str, chr, index, expressionPos, expressionEndPos;
  7666. function parseModel(val) {
  7667. // Fix https://github.com/vuejs/vue/pull/7730
  7668. // allow v-model="obj.val " (trailing whitespace)
  7669. val = val.trim();
  7670. len = val.length;
  7671. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  7672. index = val.lastIndexOf('.');
  7673. if (index > -1) {
  7674. return {
  7675. exp: val.slice(0, index),
  7676. key: '"' + val.slice(index + 1) + '"'
  7677. };
  7678. }
  7679. else {
  7680. return {
  7681. exp: val,
  7682. key: null
  7683. };
  7684. }
  7685. }
  7686. str = val;
  7687. index = expressionPos = expressionEndPos = 0;
  7688. while (!eof()) {
  7689. chr = next();
  7690. /* istanbul ignore if */
  7691. if (isStringStart(chr)) {
  7692. parseString(chr);
  7693. }
  7694. else if (chr === 0x5b) {
  7695. parseBracket(chr);
  7696. }
  7697. }
  7698. return {
  7699. exp: val.slice(0, expressionPos),
  7700. key: val.slice(expressionPos + 1, expressionEndPos)
  7701. };
  7702. }
  7703. function next() {
  7704. return str.charCodeAt(++index);
  7705. }
  7706. function eof() {
  7707. return index >= len;
  7708. }
  7709. function isStringStart(chr) {
  7710. return chr === 0x22 || chr === 0x27;
  7711. }
  7712. function parseBracket(chr) {
  7713. var inBracket = 1;
  7714. expressionPos = index;
  7715. while (!eof()) {
  7716. chr = next();
  7717. if (isStringStart(chr)) {
  7718. parseString(chr);
  7719. continue;
  7720. }
  7721. if (chr === 0x5b)
  7722. inBracket++;
  7723. if (chr === 0x5d)
  7724. inBracket--;
  7725. if (inBracket === 0) {
  7726. expressionEndPos = index;
  7727. break;
  7728. }
  7729. }
  7730. }
  7731. function parseString(chr) {
  7732. var stringQuote = chr;
  7733. while (!eof()) {
  7734. chr = next();
  7735. if (chr === stringQuote) {
  7736. break;
  7737. }
  7738. }
  7739. }
  7740. var warn$1;
  7741. // in some cases, the event used has to be determined at runtime
  7742. // so we used some reserved tokens during compile.
  7743. var RANGE_TOKEN = '__r';
  7744. var CHECKBOX_RADIO_TOKEN = '__c';
  7745. function model$1(el, dir, _warn) {
  7746. warn$1 = _warn;
  7747. var value = dir.value;
  7748. var modifiers = dir.modifiers;
  7749. var tag = el.tag;
  7750. var type = el.attrsMap.type;
  7751. if (process.env.NODE_ENV !== 'production') {
  7752. // inputs with type="file" are read only and setting the input's
  7753. // value will throw an error.
  7754. if (tag === 'input' && type === 'file') {
  7755. warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\" type=\"file\">:\n") +
  7756. "File inputs are read only. Use a v-on:change listener instead.", el.rawAttrsMap['v-model']);
  7757. }
  7758. }
  7759. if (el.component) {
  7760. genComponentModel(el, value, modifiers);
  7761. // component v-model doesn't need extra runtime
  7762. return false;
  7763. }
  7764. else if (tag === 'select') {
  7765. genSelect(el, value, modifiers);
  7766. }
  7767. else if (tag === 'input' && type === 'checkbox') {
  7768. genCheckboxModel(el, value, modifiers);
  7769. }
  7770. else if (tag === 'input' && type === 'radio') {
  7771. genRadioModel(el, value, modifiers);
  7772. }
  7773. else if (tag === 'input' || tag === 'textarea') {
  7774. genDefaultModel(el, value, modifiers);
  7775. }
  7776. else if (!config.isReservedTag(tag)) {
  7777. genComponentModel(el, value, modifiers);
  7778. // component v-model doesn't need extra runtime
  7779. return false;
  7780. }
  7781. else if (process.env.NODE_ENV !== 'production') {
  7782. warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
  7783. "v-model is not supported on this element type. " +
  7784. "If you are working with contenteditable, it's recommended to " +
  7785. 'wrap a library dedicated for that purpose inside a custom component.', el.rawAttrsMap['v-model']);
  7786. }
  7787. // ensure runtime directive metadata
  7788. return true;
  7789. }
  7790. function genCheckboxModel(el, value, modifiers) {
  7791. var number = modifiers && modifiers.number;
  7792. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7793. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  7794. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  7795. addProp(el, 'checked', "Array.isArray(".concat(value, ")") +
  7796. "?_i(".concat(value, ",").concat(valueBinding, ")>-1") +
  7797. (trueValueBinding === 'true'
  7798. ? ":(".concat(value, ")")
  7799. : ":_q(".concat(value, ",").concat(trueValueBinding, ")")));
  7800. addHandler(el, 'change', "var $$a=".concat(value, ",") +
  7801. '$$el=$event.target,' +
  7802. "$$c=$$el.checked?(".concat(trueValueBinding, "):(").concat(falseValueBinding, ");") +
  7803. 'if(Array.isArray($$a)){' +
  7804. "var $$v=".concat(number ? '_n(' + valueBinding + ')' : valueBinding, ",") +
  7805. '$$i=_i($$a,$$v);' +
  7806. "if($$el.checked){$$i<0&&(".concat(genAssignmentCode(value, '$$a.concat([$$v])'), ")}") +
  7807. "else{$$i>-1&&(".concat(genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))'), ")}") +
  7808. "}else{".concat(genAssignmentCode(value, '$$c'), "}"), null, true);
  7809. }
  7810. function genRadioModel(el, value, modifiers) {
  7811. var number = modifiers && modifiers.number;
  7812. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7813. valueBinding = number ? "_n(".concat(valueBinding, ")") : valueBinding;
  7814. addProp(el, 'checked', "_q(".concat(value, ",").concat(valueBinding, ")"));
  7815. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  7816. }
  7817. function genSelect(el, value, modifiers) {
  7818. var number = modifiers && modifiers.number;
  7819. var selectedVal = "Array.prototype.filter" +
  7820. ".call($event.target.options,function(o){return o.selected})" +
  7821. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  7822. "return ".concat(number ? '_n(val)' : 'val', "})");
  7823. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  7824. var code = "var $$selectedVal = ".concat(selectedVal, ";");
  7825. code = "".concat(code, " ").concat(genAssignmentCode(value, assignment));
  7826. addHandler(el, 'change', code, null, true);
  7827. }
  7828. function genDefaultModel(el, value, modifiers) {
  7829. var type = el.attrsMap.type;
  7830. // warn if v-bind:value conflicts with v-model
  7831. // except for inputs with v-bind:type
  7832. if (process.env.NODE_ENV !== 'production') {
  7833. var value_1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  7834. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  7835. if (value_1 && !typeBinding) {
  7836. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  7837. warn$1("".concat(binding, "=\"").concat(value_1, "\" conflicts with v-model on the same element ") +
  7838. 'because the latter already expands to a value binding internally', el.rawAttrsMap[binding]);
  7839. }
  7840. }
  7841. var _a = modifiers || {}, lazy = _a.lazy, number = _a.number, trim = _a.trim;
  7842. var needCompositionGuard = !lazy && type !== 'range';
  7843. var event = lazy ? 'change' : type === 'range' ? RANGE_TOKEN : 'input';
  7844. var valueExpression = '$event.target.value';
  7845. if (trim) {
  7846. valueExpression = "$event.target.value.trim()";
  7847. }
  7848. if (number) {
  7849. valueExpression = "_n(".concat(valueExpression, ")");
  7850. }
  7851. var code = genAssignmentCode(value, valueExpression);
  7852. if (needCompositionGuard) {
  7853. code = "if($event.target.composing)return;".concat(code);
  7854. }
  7855. addProp(el, 'value', "(".concat(value, ")"));
  7856. addHandler(el, event, code, null, true);
  7857. if (trim || number) {
  7858. addHandler(el, 'blur', '$forceUpdate()');
  7859. }
  7860. }
  7861. // normalize v-model event tokens that can only be determined at runtime.
  7862. // it's important to place the event as the first in the array because
  7863. // the whole point is ensuring the v-model callback gets called before
  7864. // user-attached handlers.
  7865. function normalizeEvents(on) {
  7866. /* istanbul ignore if */
  7867. if (isDef(on[RANGE_TOKEN])) {
  7868. // IE input[type=range] only supports `change` event
  7869. var event_1 = isIE ? 'change' : 'input';
  7870. on[event_1] = [].concat(on[RANGE_TOKEN], on[event_1] || []);
  7871. delete on[RANGE_TOKEN];
  7872. }
  7873. // This was originally intended to fix #4521 but no longer necessary
  7874. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  7875. /* istanbul ignore if */
  7876. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  7877. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  7878. delete on[CHECKBOX_RADIO_TOKEN];
  7879. }
  7880. }
  7881. var target;
  7882. function createOnceHandler(event, handler, capture) {
  7883. var _target = target; // save current target element in closure
  7884. return function onceHandler() {
  7885. var res = handler.apply(null, arguments);
  7886. if (res !== null) {
  7887. remove(event, onceHandler, capture, _target);
  7888. }
  7889. };
  7890. }
  7891. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  7892. // implementation and does not fire microtasks in between event propagation, so
  7893. // safe to exclude.
  7894. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  7895. function add(name, handler, capture, passive) {
  7896. // async edge case #6566: inner click event triggers patch, event handler
  7897. // attached to outer element during patch, and triggered again. This
  7898. // happens because browsers fire microtask ticks between event propagation.
  7899. // the solution is simple: we save the timestamp when a handler is attached,
  7900. // and the handler would only fire if the event passed to it was fired
  7901. // AFTER it was attached.
  7902. if (useMicrotaskFix) {
  7903. var attachedTimestamp_1 = currentFlushTimestamp;
  7904. var original_1 = handler;
  7905. //@ts-expect-error
  7906. handler = original_1._wrapper = function (e) {
  7907. if (
  7908. // no bubbling, should always fire.
  7909. // this is just a safety net in case event.timeStamp is unreliable in
  7910. // certain weird environments...
  7911. e.target === e.currentTarget ||
  7912. // event is fired after handler attachment
  7913. e.timeStamp >= attachedTimestamp_1 ||
  7914. // bail for environments that have buggy event.timeStamp implementations
  7915. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  7916. // #9681 QtWebEngine event.timeStamp is negative value
  7917. e.timeStamp <= 0 ||
  7918. // #9448 bail if event is fired in another document in a multi-page
  7919. // electron/nw.js app, since event.timeStamp will be using a different
  7920. // starting reference
  7921. e.target.ownerDocument !== document) {
  7922. return original_1.apply(this, arguments);
  7923. }
  7924. };
  7925. }
  7926. target.addEventListener(name, handler, supportsPassive ? { capture: capture, passive: passive } : capture);
  7927. }
  7928. function remove(name, handler, capture, _target) {
  7929. (_target || target).removeEventListener(name,
  7930. //@ts-expect-error
  7931. handler._wrapper || handler, capture);
  7932. }
  7933. function updateDOMListeners(oldVnode, vnode) {
  7934. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  7935. return;
  7936. }
  7937. var on = vnode.data.on || {};
  7938. var oldOn = oldVnode.data.on || {};
  7939. // vnode is empty when removing all listeners,
  7940. // and use old vnode dom element
  7941. target = vnode.elm || oldVnode.elm;
  7942. normalizeEvents(on);
  7943. updateListeners(on, oldOn, add, remove, createOnceHandler, vnode.context);
  7944. target = undefined;
  7945. }
  7946. var events = {
  7947. create: updateDOMListeners,
  7948. update: updateDOMListeners,
  7949. // @ts-expect-error emptyNode has actually data
  7950. destroy: function (vnode) { return updateDOMListeners(vnode, emptyNode); }
  7951. };
  7952. var svgContainer;
  7953. function updateDOMProps(oldVnode, vnode) {
  7954. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  7955. return;
  7956. }
  7957. var key, cur;
  7958. var elm = vnode.elm;
  7959. var oldProps = oldVnode.data.domProps || {};
  7960. var props = vnode.data.domProps || {};
  7961. // clone observed objects, as the user probably wants to mutate it
  7962. if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) {
  7963. props = vnode.data.domProps = extend({}, props);
  7964. }
  7965. for (key in oldProps) {
  7966. if (!(key in props)) {
  7967. elm[key] = '';
  7968. }
  7969. }
  7970. for (key in props) {
  7971. cur = props[key];
  7972. // ignore children if the node has textContent or innerHTML,
  7973. // as these will throw away existing DOM nodes and cause removal errors
  7974. // on subsequent patches (#3360)
  7975. if (key === 'textContent' || key === 'innerHTML') {
  7976. if (vnode.children)
  7977. vnode.children.length = 0;
  7978. if (cur === oldProps[key])
  7979. continue;
  7980. // #6601 work around Chrome version <= 55 bug where single textNode
  7981. // replaced by innerHTML/textContent retains its parentNode property
  7982. if (elm.childNodes.length === 1) {
  7983. elm.removeChild(elm.childNodes[0]);
  7984. }
  7985. }
  7986. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  7987. // store value as _value as well since
  7988. // non-string values will be stringified
  7989. elm._value = cur;
  7990. // avoid resetting cursor position when value is the same
  7991. var strCur = isUndef(cur) ? '' : String(cur);
  7992. if (shouldUpdateValue(elm, strCur)) {
  7993. elm.value = strCur;
  7994. }
  7995. }
  7996. else if (key === 'innerHTML' &&
  7997. isSVG(elm.tagName) &&
  7998. isUndef(elm.innerHTML)) {
  7999. // IE doesn't support innerHTML for SVG elements
  8000. svgContainer = svgContainer || document.createElement('div');
  8001. svgContainer.innerHTML = "<svg>".concat(cur, "</svg>");
  8002. var svg = svgContainer.firstChild;
  8003. while (elm.firstChild) {
  8004. elm.removeChild(elm.firstChild);
  8005. }
  8006. while (svg.firstChild) {
  8007. elm.appendChild(svg.firstChild);
  8008. }
  8009. }
  8010. else if (
  8011. // skip the update if old and new VDOM state is the same.
  8012. // `value` is handled separately because the DOM value may be temporarily
  8013. // out of sync with VDOM state due to focus, composition and modifiers.
  8014. // This #4521 by skipping the unnecessary `checked` update.
  8015. cur !== oldProps[key]) {
  8016. // some property updates can throw
  8017. // e.g. `value` on <progress> w/ non-finite value
  8018. try {
  8019. elm[key] = cur;
  8020. }
  8021. catch (e) { }
  8022. }
  8023. }
  8024. }
  8025. function shouldUpdateValue(elm, checkVal) {
  8026. return (
  8027. //@ts-expect-error
  8028. !elm.composing &&
  8029. (elm.tagName === 'OPTION' ||
  8030. isNotInFocusAndDirty(elm, checkVal) ||
  8031. isDirtyWithModifiers(elm, checkVal)));
  8032. }
  8033. function isNotInFocusAndDirty(elm, checkVal) {
  8034. // return true when textbox (.number and .trim) loses focus and its value is
  8035. // not equal to the updated value
  8036. var notInFocus = true;
  8037. // #6157
  8038. // work around IE bug when accessing document.activeElement in an iframe
  8039. try {
  8040. notInFocus = document.activeElement !== elm;
  8041. }
  8042. catch (e) { }
  8043. return notInFocus && elm.value !== checkVal;
  8044. }
  8045. function isDirtyWithModifiers(elm, newVal) {
  8046. var value = elm.value;
  8047. var modifiers = elm._vModifiers; // injected by v-model runtime
  8048. if (isDef(modifiers)) {
  8049. if (modifiers.number) {
  8050. return toNumber(value) !== toNumber(newVal);
  8051. }
  8052. if (modifiers.trim) {
  8053. return value.trim() !== newVal.trim();
  8054. }
  8055. }
  8056. return value !== newVal;
  8057. }
  8058. var domProps = {
  8059. create: updateDOMProps,
  8060. update: updateDOMProps
  8061. };
  8062. var parseStyleText = cached(function (cssText) {
  8063. var res = {};
  8064. var listDelimiter = /;(?![^(]*\))/g;
  8065. var propertyDelimiter = /:(.+)/;
  8066. cssText.split(listDelimiter).forEach(function (item) {
  8067. if (item) {
  8068. var tmp = item.split(propertyDelimiter);
  8069. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  8070. }
  8071. });
  8072. return res;
  8073. });
  8074. // merge static and dynamic style data on the same vnode
  8075. function normalizeStyleData(data) {
  8076. var style = normalizeStyleBinding(data.style);
  8077. // static style is pre-processed into an object during compilation
  8078. // and is always a fresh object, so it's safe to merge into it
  8079. return data.staticStyle ? extend(data.staticStyle, style) : style;
  8080. }
  8081. // normalize possible array / string values into Object
  8082. function normalizeStyleBinding(bindingStyle) {
  8083. if (Array.isArray(bindingStyle)) {
  8084. return toObject(bindingStyle);
  8085. }
  8086. if (typeof bindingStyle === 'string') {
  8087. return parseStyleText(bindingStyle);
  8088. }
  8089. return bindingStyle;
  8090. }
  8091. /**
  8092. * parent component style should be after child's
  8093. * so that parent component's style could override it
  8094. */
  8095. function getStyle(vnode, checkChild) {
  8096. var res = {};
  8097. var styleData;
  8098. if (checkChild) {
  8099. var childNode = vnode;
  8100. while (childNode.componentInstance) {
  8101. childNode = childNode.componentInstance._vnode;
  8102. if (childNode &&
  8103. childNode.data &&
  8104. (styleData = normalizeStyleData(childNode.data))) {
  8105. extend(res, styleData);
  8106. }
  8107. }
  8108. }
  8109. if ((styleData = normalizeStyleData(vnode.data))) {
  8110. extend(res, styleData);
  8111. }
  8112. var parentNode = vnode;
  8113. // @ts-expect-error parentNode.parent not VNodeWithData
  8114. while ((parentNode = parentNode.parent)) {
  8115. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  8116. extend(res, styleData);
  8117. }
  8118. }
  8119. return res;
  8120. }
  8121. var cssVarRE = /^--/;
  8122. var importantRE = /\s*!important$/;
  8123. var setProp = function (el, name, val) {
  8124. /* istanbul ignore if */
  8125. if (cssVarRE.test(name)) {
  8126. el.style.setProperty(name, val);
  8127. }
  8128. else if (importantRE.test(val)) {
  8129. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  8130. }
  8131. else {
  8132. var normalizedName = normalize(name);
  8133. if (Array.isArray(val)) {
  8134. // Support values array created by autoprefixer, e.g.
  8135. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  8136. // Set them one by one, and the browser will only set those it can recognize
  8137. for (var i = 0, len = val.length; i < len; i++) {
  8138. el.style[normalizedName] = val[i];
  8139. }
  8140. }
  8141. else {
  8142. el.style[normalizedName] = val;
  8143. }
  8144. }
  8145. };
  8146. var vendorNames = ['Webkit', 'Moz', 'ms'];
  8147. var emptyStyle;
  8148. var normalize = cached(function (prop) {
  8149. emptyStyle = emptyStyle || document.createElement('div').style;
  8150. prop = camelize(prop);
  8151. if (prop !== 'filter' && prop in emptyStyle) {
  8152. return prop;
  8153. }
  8154. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  8155. for (var i = 0; i < vendorNames.length; i++) {
  8156. var name_1 = vendorNames[i] + capName;
  8157. if (name_1 in emptyStyle) {
  8158. return name_1;
  8159. }
  8160. }
  8161. });
  8162. function updateStyle(oldVnode, vnode) {
  8163. var data = vnode.data;
  8164. var oldData = oldVnode.data;
  8165. if (isUndef(data.staticStyle) &&
  8166. isUndef(data.style) &&
  8167. isUndef(oldData.staticStyle) &&
  8168. isUndef(oldData.style)) {
  8169. return;
  8170. }
  8171. var cur, name;
  8172. var el = vnode.elm;
  8173. var oldStaticStyle = oldData.staticStyle;
  8174. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  8175. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  8176. var oldStyle = oldStaticStyle || oldStyleBinding;
  8177. var style = normalizeStyleBinding(vnode.data.style) || {};
  8178. // store normalized style under a different key for next diff
  8179. // make sure to clone it if it's reactive, since the user likely wants
  8180. // to mutate it.
  8181. vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style;
  8182. var newStyle = getStyle(vnode, true);
  8183. for (name in oldStyle) {
  8184. if (isUndef(newStyle[name])) {
  8185. setProp(el, name, '');
  8186. }
  8187. }
  8188. for (name in newStyle) {
  8189. cur = newStyle[name];
  8190. if (cur !== oldStyle[name]) {
  8191. // ie9 setting to null has no effect, must use empty string
  8192. setProp(el, name, cur == null ? '' : cur);
  8193. }
  8194. }
  8195. }
  8196. var style$1 = {
  8197. create: updateStyle,
  8198. update: updateStyle
  8199. };
  8200. var whitespaceRE$1 = /\s+/;
  8201. /**
  8202. * Add class with compatibility for SVG since classList is not supported on
  8203. * SVG elements in IE
  8204. */
  8205. function addClass(el, cls) {
  8206. /* istanbul ignore if */
  8207. if (!cls || !(cls = cls.trim())) {
  8208. return;
  8209. }
  8210. /* istanbul ignore else */
  8211. if (el.classList) {
  8212. if (cls.indexOf(' ') > -1) {
  8213. cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.add(c); });
  8214. }
  8215. else {
  8216. el.classList.add(cls);
  8217. }
  8218. }
  8219. else {
  8220. var cur = " ".concat(el.getAttribute('class') || '', " ");
  8221. if (cur.indexOf(' ' + cls + ' ') < 0) {
  8222. el.setAttribute('class', (cur + cls).trim());
  8223. }
  8224. }
  8225. }
  8226. /**
  8227. * Remove class with compatibility for SVG since classList is not supported on
  8228. * SVG elements in IE
  8229. */
  8230. function removeClass(el, cls) {
  8231. /* istanbul ignore if */
  8232. if (!cls || !(cls = cls.trim())) {
  8233. return;
  8234. }
  8235. /* istanbul ignore else */
  8236. if (el.classList) {
  8237. if (cls.indexOf(' ') > -1) {
  8238. cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.remove(c); });
  8239. }
  8240. else {
  8241. el.classList.remove(cls);
  8242. }
  8243. if (!el.classList.length) {
  8244. el.removeAttribute('class');
  8245. }
  8246. }
  8247. else {
  8248. var cur = " ".concat(el.getAttribute('class') || '', " ");
  8249. var tar = ' ' + cls + ' ';
  8250. while (cur.indexOf(tar) >= 0) {
  8251. cur = cur.replace(tar, ' ');
  8252. }
  8253. cur = cur.trim();
  8254. if (cur) {
  8255. el.setAttribute('class', cur);
  8256. }
  8257. else {
  8258. el.removeAttribute('class');
  8259. }
  8260. }
  8261. }
  8262. function resolveTransition(def) {
  8263. if (!def) {
  8264. return;
  8265. }
  8266. /* istanbul ignore else */
  8267. if (typeof def === 'object') {
  8268. var res = {};
  8269. if (def.css !== false) {
  8270. extend(res, autoCssTransition(def.name || 'v'));
  8271. }
  8272. extend(res, def);
  8273. return res;
  8274. }
  8275. else if (typeof def === 'string') {
  8276. return autoCssTransition(def);
  8277. }
  8278. }
  8279. var autoCssTransition = cached(function (name) {
  8280. return {
  8281. enterClass: "".concat(name, "-enter"),
  8282. enterToClass: "".concat(name, "-enter-to"),
  8283. enterActiveClass: "".concat(name, "-enter-active"),
  8284. leaveClass: "".concat(name, "-leave"),
  8285. leaveToClass: "".concat(name, "-leave-to"),
  8286. leaveActiveClass: "".concat(name, "-leave-active")
  8287. };
  8288. });
  8289. var hasTransition = inBrowser && !isIE9;
  8290. var TRANSITION = 'transition';
  8291. var ANIMATION = 'animation';
  8292. // Transition property/event sniffing
  8293. var transitionProp = 'transition';
  8294. var transitionEndEvent = 'transitionend';
  8295. var animationProp = 'animation';
  8296. var animationEndEvent = 'animationend';
  8297. if (hasTransition) {
  8298. /* istanbul ignore if */
  8299. if (window.ontransitionend === undefined &&
  8300. window.onwebkittransitionend !== undefined) {
  8301. transitionProp = 'WebkitTransition';
  8302. transitionEndEvent = 'webkitTransitionEnd';
  8303. }
  8304. if (window.onanimationend === undefined &&
  8305. window.onwebkitanimationend !== undefined) {
  8306. animationProp = 'WebkitAnimation';
  8307. animationEndEvent = 'webkitAnimationEnd';
  8308. }
  8309. }
  8310. // binding to window is necessary to make hot reload work in IE in strict mode
  8311. var raf = inBrowser
  8312. ? window.requestAnimationFrame
  8313. ? window.requestAnimationFrame.bind(window)
  8314. : setTimeout
  8315. : /* istanbul ignore next */ function (/* istanbul ignore next */ fn) { return fn(); };
  8316. function nextFrame(fn) {
  8317. raf(function () {
  8318. // @ts-expect-error
  8319. raf(fn);
  8320. });
  8321. }
  8322. function addTransitionClass(el, cls) {
  8323. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  8324. if (transitionClasses.indexOf(cls) < 0) {
  8325. transitionClasses.push(cls);
  8326. addClass(el, cls);
  8327. }
  8328. }
  8329. function removeTransitionClass(el, cls) {
  8330. if (el._transitionClasses) {
  8331. remove$2(el._transitionClasses, cls);
  8332. }
  8333. removeClass(el, cls);
  8334. }
  8335. function whenTransitionEnds(el, expectedType, cb) {
  8336. var _a = getTransitionInfo(el, expectedType), type = _a.type, timeout = _a.timeout, propCount = _a.propCount;
  8337. if (!type)
  8338. return cb();
  8339. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  8340. var ended = 0;
  8341. var end = function () {
  8342. el.removeEventListener(event, onEnd);
  8343. cb();
  8344. };
  8345. var onEnd = function (e) {
  8346. if (e.target === el) {
  8347. if (++ended >= propCount) {
  8348. end();
  8349. }
  8350. }
  8351. };
  8352. setTimeout(function () {
  8353. if (ended < propCount) {
  8354. end();
  8355. }
  8356. }, timeout + 1);
  8357. el.addEventListener(event, onEnd);
  8358. }
  8359. var transformRE = /\b(transform|all)(,|$)/;
  8360. function getTransitionInfo(el, expectedType) {
  8361. var styles = window.getComputedStyle(el);
  8362. // JSDOM may return undefined for transition properties
  8363. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  8364. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  8365. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  8366. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  8367. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  8368. var animationTimeout = getTimeout(animationDelays, animationDurations);
  8369. var type;
  8370. var timeout = 0;
  8371. var propCount = 0;
  8372. /* istanbul ignore if */
  8373. if (expectedType === TRANSITION) {
  8374. if (transitionTimeout > 0) {
  8375. type = TRANSITION;
  8376. timeout = transitionTimeout;
  8377. propCount = transitionDurations.length;
  8378. }
  8379. }
  8380. else if (expectedType === ANIMATION) {
  8381. if (animationTimeout > 0) {
  8382. type = ANIMATION;
  8383. timeout = animationTimeout;
  8384. propCount = animationDurations.length;
  8385. }
  8386. }
  8387. else {
  8388. timeout = Math.max(transitionTimeout, animationTimeout);
  8389. type =
  8390. timeout > 0
  8391. ? transitionTimeout > animationTimeout
  8392. ? TRANSITION
  8393. : ANIMATION
  8394. : null;
  8395. propCount = type
  8396. ? type === TRANSITION
  8397. ? transitionDurations.length
  8398. : animationDurations.length
  8399. : 0;
  8400. }
  8401. var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
  8402. return {
  8403. type: type,
  8404. timeout: timeout,
  8405. propCount: propCount,
  8406. hasTransform: hasTransform
  8407. };
  8408. }
  8409. function getTimeout(delays, durations) {
  8410. /* istanbul ignore next */
  8411. while (delays.length < durations.length) {
  8412. delays = delays.concat(delays);
  8413. }
  8414. return Math.max.apply(null, durations.map(function (d, i) {
  8415. return toMs(d) + toMs(delays[i]);
  8416. }));
  8417. }
  8418. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  8419. // in a locale-dependent way, using a comma instead of a dot.
  8420. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  8421. // as a floor function) causing unexpected behaviors
  8422. function toMs(s) {
  8423. return Number(s.slice(0, -1).replace(',', '.')) * 1000;
  8424. }
  8425. function enter(vnode, toggleDisplay) {
  8426. var el = vnode.elm;
  8427. // call leave callback now
  8428. if (isDef(el._leaveCb)) {
  8429. el._leaveCb.cancelled = true;
  8430. el._leaveCb();
  8431. }
  8432. var data = resolveTransition(vnode.data.transition);
  8433. if (isUndef(data)) {
  8434. return;
  8435. }
  8436. /* istanbul ignore if */
  8437. if (isDef(el._enterCb) || el.nodeType !== 1) {
  8438. return;
  8439. }
  8440. var css = data.css, type = data.type, enterClass = data.enterClass, enterToClass = data.enterToClass, enterActiveClass = data.enterActiveClass, appearClass = data.appearClass, appearToClass = data.appearToClass, appearActiveClass = data.appearActiveClass, beforeEnter = data.beforeEnter, enter = data.enter, afterEnter = data.afterEnter, enterCancelled = data.enterCancelled, beforeAppear = data.beforeAppear, appear = data.appear, afterAppear = data.afterAppear, appearCancelled = data.appearCancelled, duration = data.duration;
  8441. // activeInstance will always be the <transition> component managing this
  8442. // transition. One edge case to check is when the <transition> is placed
  8443. // as the root node of a child component. In that case we need to check
  8444. // <transition>'s parent for appear check.
  8445. var context = activeInstance;
  8446. var transitionNode = activeInstance.$vnode;
  8447. while (transitionNode && transitionNode.parent) {
  8448. context = transitionNode.context;
  8449. transitionNode = transitionNode.parent;
  8450. }
  8451. var isAppear = !context._isMounted || !vnode.isRootInsert;
  8452. if (isAppear && !appear && appear !== '') {
  8453. return;
  8454. }
  8455. var startClass = isAppear && appearClass ? appearClass : enterClass;
  8456. var activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass;
  8457. var toClass = isAppear && appearToClass ? appearToClass : enterToClass;
  8458. var beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter;
  8459. var enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter;
  8460. var afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter;
  8461. var enterCancelledHook = isAppear
  8462. ? appearCancelled || enterCancelled
  8463. : enterCancelled;
  8464. var explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration);
  8465. if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
  8466. checkDuration(explicitEnterDuration, 'enter', vnode);
  8467. }
  8468. var expectsCSS = css !== false && !isIE9;
  8469. var userWantsControl = getHookArgumentsLength(enterHook);
  8470. var cb = (el._enterCb = once(function () {
  8471. if (expectsCSS) {
  8472. removeTransitionClass(el, toClass);
  8473. removeTransitionClass(el, activeClass);
  8474. }
  8475. // @ts-expect-error
  8476. if (cb.cancelled) {
  8477. if (expectsCSS) {
  8478. removeTransitionClass(el, startClass);
  8479. }
  8480. enterCancelledHook && enterCancelledHook(el);
  8481. }
  8482. else {
  8483. afterEnterHook && afterEnterHook(el);
  8484. }
  8485. el._enterCb = null;
  8486. }));
  8487. if (!vnode.data.show) {
  8488. // remove pending leave element on enter by injecting an insert hook
  8489. mergeVNodeHook(vnode, 'insert', function () {
  8490. var parent = el.parentNode;
  8491. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  8492. if (pendingNode &&
  8493. pendingNode.tag === vnode.tag &&
  8494. pendingNode.elm._leaveCb) {
  8495. pendingNode.elm._leaveCb();
  8496. }
  8497. enterHook && enterHook(el, cb);
  8498. });
  8499. }
  8500. // start enter transition
  8501. beforeEnterHook && beforeEnterHook(el);
  8502. if (expectsCSS) {
  8503. addTransitionClass(el, startClass);
  8504. addTransitionClass(el, activeClass);
  8505. nextFrame(function () {
  8506. removeTransitionClass(el, startClass);
  8507. // @ts-expect-error
  8508. if (!cb.cancelled) {
  8509. addTransitionClass(el, toClass);
  8510. if (!userWantsControl) {
  8511. if (isValidDuration(explicitEnterDuration)) {
  8512. setTimeout(cb, explicitEnterDuration);
  8513. }
  8514. else {
  8515. whenTransitionEnds(el, type, cb);
  8516. }
  8517. }
  8518. }
  8519. });
  8520. }
  8521. if (vnode.data.show) {
  8522. toggleDisplay && toggleDisplay();
  8523. enterHook && enterHook(el, cb);
  8524. }
  8525. if (!expectsCSS && !userWantsControl) {
  8526. cb();
  8527. }
  8528. }
  8529. function leave(vnode, rm) {
  8530. var el = vnode.elm;
  8531. // call enter callback now
  8532. if (isDef(el._enterCb)) {
  8533. el._enterCb.cancelled = true;
  8534. el._enterCb();
  8535. }
  8536. var data = resolveTransition(vnode.data.transition);
  8537. if (isUndef(data) || el.nodeType !== 1) {
  8538. return rm();
  8539. }
  8540. /* istanbul ignore if */
  8541. if (isDef(el._leaveCb)) {
  8542. return;
  8543. }
  8544. var css = data.css, type = data.type, leaveClass = data.leaveClass, leaveToClass = data.leaveToClass, leaveActiveClass = data.leaveActiveClass, beforeLeave = data.beforeLeave, leave = data.leave, afterLeave = data.afterLeave, leaveCancelled = data.leaveCancelled, delayLeave = data.delayLeave, duration = data.duration;
  8545. var expectsCSS = css !== false && !isIE9;
  8546. var userWantsControl = getHookArgumentsLength(leave);
  8547. var explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration);
  8548. if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
  8549. checkDuration(explicitLeaveDuration, 'leave', vnode);
  8550. }
  8551. var cb = (el._leaveCb = once(function () {
  8552. if (el.parentNode && el.parentNode._pending) {
  8553. el.parentNode._pending[vnode.key] = null;
  8554. }
  8555. if (expectsCSS) {
  8556. removeTransitionClass(el, leaveToClass);
  8557. removeTransitionClass(el, leaveActiveClass);
  8558. }
  8559. // @ts-expect-error
  8560. if (cb.cancelled) {
  8561. if (expectsCSS) {
  8562. removeTransitionClass(el, leaveClass);
  8563. }
  8564. leaveCancelled && leaveCancelled(el);
  8565. }
  8566. else {
  8567. rm();
  8568. afterLeave && afterLeave(el);
  8569. }
  8570. el._leaveCb = null;
  8571. }));
  8572. if (delayLeave) {
  8573. delayLeave(performLeave);
  8574. }
  8575. else {
  8576. performLeave();
  8577. }
  8578. function performLeave() {
  8579. // the delayed leave may have already been cancelled
  8580. // @ts-expect-error
  8581. if (cb.cancelled) {
  8582. return;
  8583. }
  8584. // record leaving element
  8585. if (!vnode.data.show && el.parentNode) {
  8586. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] =
  8587. vnode;
  8588. }
  8589. beforeLeave && beforeLeave(el);
  8590. if (expectsCSS) {
  8591. addTransitionClass(el, leaveClass);
  8592. addTransitionClass(el, leaveActiveClass);
  8593. nextFrame(function () {
  8594. removeTransitionClass(el, leaveClass);
  8595. // @ts-expect-error
  8596. if (!cb.cancelled) {
  8597. addTransitionClass(el, leaveToClass);
  8598. if (!userWantsControl) {
  8599. if (isValidDuration(explicitLeaveDuration)) {
  8600. setTimeout(cb, explicitLeaveDuration);
  8601. }
  8602. else {
  8603. whenTransitionEnds(el, type, cb);
  8604. }
  8605. }
  8606. }
  8607. });
  8608. }
  8609. leave && leave(el, cb);
  8610. if (!expectsCSS && !userWantsControl) {
  8611. cb();
  8612. }
  8613. }
  8614. }
  8615. // only used in dev mode
  8616. function checkDuration(val, name, vnode) {
  8617. if (typeof val !== 'number') {
  8618. warn$2("<transition> explicit ".concat(name, " duration is not a valid number - ") +
  8619. "got ".concat(JSON.stringify(val), "."), vnode.context);
  8620. }
  8621. else if (isNaN(val)) {
  8622. warn$2("<transition> explicit ".concat(name, " duration is NaN - ") +
  8623. 'the duration expression might be incorrect.', vnode.context);
  8624. }
  8625. }
  8626. function isValidDuration(val) {
  8627. return typeof val === 'number' && !isNaN(val);
  8628. }
  8629. /**
  8630. * Normalize a transition hook's argument length. The hook may be:
  8631. * - a merged hook (invoker) with the original in .fns
  8632. * - a wrapped component method (check ._length)
  8633. * - a plain function (.length)
  8634. */
  8635. function getHookArgumentsLength(fn) {
  8636. if (isUndef(fn)) {
  8637. return false;
  8638. }
  8639. // @ts-expect-error
  8640. var invokerFns = fn.fns;
  8641. if (isDef(invokerFns)) {
  8642. // invoker
  8643. return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns);
  8644. }
  8645. else {
  8646. // @ts-expect-error
  8647. return (fn._length || fn.length) > 1;
  8648. }
  8649. }
  8650. function _enter(_, vnode) {
  8651. if (vnode.data.show !== true) {
  8652. enter(vnode);
  8653. }
  8654. }
  8655. var transition = inBrowser
  8656. ? {
  8657. create: _enter,
  8658. activate: _enter,
  8659. remove: function (vnode, rm) {
  8660. /* istanbul ignore else */
  8661. if (vnode.data.show !== true) {
  8662. // @ts-expect-error
  8663. leave(vnode, rm);
  8664. }
  8665. else {
  8666. rm();
  8667. }
  8668. }
  8669. }
  8670. : {};
  8671. var platformModules = [attrs, klass$1, events, domProps, style$1, transition];
  8672. // the directive module should be applied last, after all
  8673. // built-in modules have been applied.
  8674. var modules$1 = platformModules.concat(baseModules);
  8675. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules$1 });
  8676. /**
  8677. * Not type checking this file because flow doesn't like attaching
  8678. * properties to Elements.
  8679. */
  8680. /* istanbul ignore if */
  8681. if (isIE9) {
  8682. // http://www.matts411.com/post/internet-explorer-9-oninput/
  8683. document.addEventListener('selectionchange', function () {
  8684. var el = document.activeElement;
  8685. // @ts-expect-error
  8686. if (el && el.vmodel) {
  8687. trigger(el, 'input');
  8688. }
  8689. });
  8690. }
  8691. var directive = {
  8692. inserted: function (el, binding, vnode, oldVnode) {
  8693. if (vnode.tag === 'select') {
  8694. // #6903
  8695. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  8696. mergeVNodeHook(vnode, 'postpatch', function () {
  8697. directive.componentUpdated(el, binding, vnode);
  8698. });
  8699. }
  8700. else {
  8701. setSelected(el, binding, vnode.context);
  8702. }
  8703. el._vOptions = [].map.call(el.options, getValue);
  8704. }
  8705. else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  8706. el._vModifiers = binding.modifiers;
  8707. if (!binding.modifiers.lazy) {
  8708. el.addEventListener('compositionstart', onCompositionStart);
  8709. el.addEventListener('compositionend', onCompositionEnd);
  8710. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  8711. // switching focus before confirming composition choice
  8712. // this also fixes the issue where some browsers e.g. iOS Chrome
  8713. // fires "change" instead of "input" on autocomplete.
  8714. el.addEventListener('change', onCompositionEnd);
  8715. /* istanbul ignore if */
  8716. if (isIE9) {
  8717. el.vmodel = true;
  8718. }
  8719. }
  8720. }
  8721. },
  8722. componentUpdated: function (el, binding, vnode) {
  8723. if (vnode.tag === 'select') {
  8724. setSelected(el, binding, vnode.context);
  8725. // in case the options rendered by v-for have changed,
  8726. // it's possible that the value is out-of-sync with the rendered options.
  8727. // detect such cases and filter out values that no longer has a matching
  8728. // option in the DOM.
  8729. var prevOptions_1 = el._vOptions;
  8730. var curOptions_1 = (el._vOptions = [].map.call(el.options, getValue));
  8731. if (curOptions_1.some(function (o, i) { return !looseEqual(o, prevOptions_1[i]); })) {
  8732. // trigger change event if
  8733. // no matching option found for at least one value
  8734. var needReset = el.multiple
  8735. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions_1); })
  8736. : binding.value !== binding.oldValue &&
  8737. hasNoMatchingOption(binding.value, curOptions_1);
  8738. if (needReset) {
  8739. trigger(el, 'change');
  8740. }
  8741. }
  8742. }
  8743. }
  8744. };
  8745. function setSelected(el, binding, vm) {
  8746. actuallySetSelected(el, binding, vm);
  8747. /* istanbul ignore if */
  8748. if (isIE || isEdge) {
  8749. setTimeout(function () {
  8750. actuallySetSelected(el, binding, vm);
  8751. }, 0);
  8752. }
  8753. }
  8754. function actuallySetSelected(el, binding, vm) {
  8755. var value = binding.value;
  8756. var isMultiple = el.multiple;
  8757. if (isMultiple && !Array.isArray(value)) {
  8758. process.env.NODE_ENV !== 'production' &&
  8759. warn$2("<select multiple v-model=\"".concat(binding.expression, "\"> ") +
  8760. "expects an Array value for its binding, but got ".concat(Object.prototype.toString
  8761. .call(value)
  8762. .slice(8, -1)), vm);
  8763. return;
  8764. }
  8765. var selected, option;
  8766. for (var i = 0, l = el.options.length; i < l; i++) {
  8767. option = el.options[i];
  8768. if (isMultiple) {
  8769. selected = looseIndexOf(value, getValue(option)) > -1;
  8770. if (option.selected !== selected) {
  8771. option.selected = selected;
  8772. }
  8773. }
  8774. else {
  8775. if (looseEqual(getValue(option), value)) {
  8776. if (el.selectedIndex !== i) {
  8777. el.selectedIndex = i;
  8778. }
  8779. return;
  8780. }
  8781. }
  8782. }
  8783. if (!isMultiple) {
  8784. el.selectedIndex = -1;
  8785. }
  8786. }
  8787. function hasNoMatchingOption(value, options) {
  8788. return options.every(function (o) { return !looseEqual(o, value); });
  8789. }
  8790. function getValue(option) {
  8791. return '_value' in option ? option._value : option.value;
  8792. }
  8793. function onCompositionStart(e) {
  8794. e.target.composing = true;
  8795. }
  8796. function onCompositionEnd(e) {
  8797. // prevent triggering an input event for no reason
  8798. if (!e.target.composing)
  8799. return;
  8800. e.target.composing = false;
  8801. trigger(e.target, 'input');
  8802. }
  8803. function trigger(el, type) {
  8804. var e = document.createEvent('HTMLEvents');
  8805. e.initEvent(type, true, true);
  8806. el.dispatchEvent(e);
  8807. }
  8808. // recursively search for possible transition defined inside the component root
  8809. function locateNode(vnode) {
  8810. // @ts-expect-error
  8811. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  8812. ? locateNode(vnode.componentInstance._vnode)
  8813. : vnode;
  8814. }
  8815. var show = {
  8816. bind: function (el, _a, vnode) {
  8817. var value = _a.value;
  8818. vnode = locateNode(vnode);
  8819. var transition = vnode.data && vnode.data.transition;
  8820. var originalDisplay = (el.__vOriginalDisplay =
  8821. el.style.display === 'none' ? '' : el.style.display);
  8822. if (value && transition) {
  8823. vnode.data.show = true;
  8824. enter(vnode, function () {
  8825. el.style.display = originalDisplay;
  8826. });
  8827. }
  8828. else {
  8829. el.style.display = value ? originalDisplay : 'none';
  8830. }
  8831. },
  8832. update: function (el, _a, vnode) {
  8833. var value = _a.value, oldValue = _a.oldValue;
  8834. /* istanbul ignore if */
  8835. if (!value === !oldValue)
  8836. return;
  8837. vnode = locateNode(vnode);
  8838. var transition = vnode.data && vnode.data.transition;
  8839. if (transition) {
  8840. vnode.data.show = true;
  8841. if (value) {
  8842. enter(vnode, function () {
  8843. el.style.display = el.__vOriginalDisplay;
  8844. });
  8845. }
  8846. else {
  8847. leave(vnode, function () {
  8848. el.style.display = 'none';
  8849. });
  8850. }
  8851. }
  8852. else {
  8853. el.style.display = value ? el.__vOriginalDisplay : 'none';
  8854. }
  8855. },
  8856. unbind: function (el, binding, vnode, oldVnode, isDestroy) {
  8857. if (!isDestroy) {
  8858. el.style.display = el.__vOriginalDisplay;
  8859. }
  8860. }
  8861. };
  8862. var platformDirectives = {
  8863. model: directive,
  8864. show: show
  8865. };
  8866. // Provides transition support for a single element/component.
  8867. var transitionProps = {
  8868. name: String,
  8869. appear: Boolean,
  8870. css: Boolean,
  8871. mode: String,
  8872. type: String,
  8873. enterClass: String,
  8874. leaveClass: String,
  8875. enterToClass: String,
  8876. leaveToClass: String,
  8877. enterActiveClass: String,
  8878. leaveActiveClass: String,
  8879. appearClass: String,
  8880. appearActiveClass: String,
  8881. appearToClass: String,
  8882. duration: [Number, String, Object]
  8883. };
  8884. // in case the child is also an abstract component, e.g. <keep-alive>
  8885. // we want to recursively retrieve the real component to be rendered
  8886. function getRealChild(vnode) {
  8887. var compOptions = vnode && vnode.componentOptions;
  8888. if (compOptions && compOptions.Ctor.options.abstract) {
  8889. return getRealChild(getFirstComponentChild(compOptions.children));
  8890. }
  8891. else {
  8892. return vnode;
  8893. }
  8894. }
  8895. function extractTransitionData(comp) {
  8896. var data = {};
  8897. var options = comp.$options;
  8898. // props
  8899. for (var key in options.propsData) {
  8900. data[key] = comp[key];
  8901. }
  8902. // events.
  8903. // extract listeners and pass them directly to the transition methods
  8904. var listeners = options._parentListeners;
  8905. for (var key in listeners) {
  8906. data[camelize(key)] = listeners[key];
  8907. }
  8908. return data;
  8909. }
  8910. function placeholder(h, rawChild) {
  8911. // @ts-expect-error
  8912. if (/\d-keep-alive$/.test(rawChild.tag)) {
  8913. return h('keep-alive', {
  8914. props: rawChild.componentOptions.propsData
  8915. });
  8916. }
  8917. }
  8918. function hasParentTransition(vnode) {
  8919. while ((vnode = vnode.parent)) {
  8920. if (vnode.data.transition) {
  8921. return true;
  8922. }
  8923. }
  8924. }
  8925. function isSameChild(child, oldChild) {
  8926. return oldChild.key === child.key && oldChild.tag === child.tag;
  8927. }
  8928. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  8929. var isVShowDirective = function (d) { return d.name === 'show'; };
  8930. var Transition = {
  8931. name: 'transition',
  8932. props: transitionProps,
  8933. abstract: true,
  8934. render: function (h) {
  8935. var _this = this;
  8936. var children = this.$slots.default;
  8937. if (!children) {
  8938. return;
  8939. }
  8940. // filter out text nodes (possible whitespaces)
  8941. children = children.filter(isNotTextNode);
  8942. /* istanbul ignore if */
  8943. if (!children.length) {
  8944. return;
  8945. }
  8946. // warn multiple elements
  8947. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  8948. warn$2('<transition> can only be used on a single element. Use ' +
  8949. '<transition-group> for lists.', this.$parent);
  8950. }
  8951. var mode = this.mode;
  8952. // warn invalid mode
  8953. if (process.env.NODE_ENV !== 'production' && mode && mode !== 'in-out' && mode !== 'out-in') {
  8954. warn$2('invalid <transition> mode: ' + mode, this.$parent);
  8955. }
  8956. var rawChild = children[0];
  8957. // if this is a component root node and the component's
  8958. // parent container node also has transition, skip.
  8959. if (hasParentTransition(this.$vnode)) {
  8960. return rawChild;
  8961. }
  8962. // apply transition data to child
  8963. // use getRealChild() to ignore abstract components e.g. keep-alive
  8964. var child = getRealChild(rawChild);
  8965. /* istanbul ignore if */
  8966. if (!child) {
  8967. return rawChild;
  8968. }
  8969. if (this._leaving) {
  8970. return placeholder(h, rawChild);
  8971. }
  8972. // ensure a key that is unique to the vnode type and to this transition
  8973. // component instance. This key will be used to remove pending leaving nodes
  8974. // during entering.
  8975. var id = "__transition-".concat(this._uid, "-");
  8976. child.key =
  8977. child.key == null
  8978. ? child.isComment
  8979. ? id + 'comment'
  8980. : id + child.tag
  8981. : isPrimitive(child.key)
  8982. ? String(child.key).indexOf(id) === 0
  8983. ? child.key
  8984. : id + child.key
  8985. : child.key;
  8986. var data = ((child.data || (child.data = {})).transition =
  8987. extractTransitionData(this));
  8988. var oldRawChild = this._vnode;
  8989. var oldChild = getRealChild(oldRawChild);
  8990. // mark v-show
  8991. // so that the transition module can hand over the control to the directive
  8992. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  8993. child.data.show = true;
  8994. }
  8995. if (oldChild &&
  8996. oldChild.data &&
  8997. !isSameChild(child, oldChild) &&
  8998. !isAsyncPlaceholder(oldChild) &&
  8999. // #6687 component root is a comment node
  9000. !(oldChild.componentInstance &&
  9001. oldChild.componentInstance._vnode.isComment)) {
  9002. // replace old child transition data with fresh one
  9003. // important for dynamic transitions!
  9004. var oldData = (oldChild.data.transition = extend({}, data));
  9005. // handle transition mode
  9006. if (mode === 'out-in') {
  9007. // return placeholder node and queue update when leave finishes
  9008. this._leaving = true;
  9009. mergeVNodeHook(oldData, 'afterLeave', function () {
  9010. _this._leaving = false;
  9011. _this.$forceUpdate();
  9012. });
  9013. return placeholder(h, rawChild);
  9014. }
  9015. else if (mode === 'in-out') {
  9016. if (isAsyncPlaceholder(child)) {
  9017. return oldRawChild;
  9018. }
  9019. var delayedLeave_1;
  9020. var performLeave = function () {
  9021. delayedLeave_1();
  9022. };
  9023. mergeVNodeHook(data, 'afterEnter', performLeave);
  9024. mergeVNodeHook(data, 'enterCancelled', performLeave);
  9025. mergeVNodeHook(oldData, 'delayLeave', function (leave) {
  9026. delayedLeave_1 = leave;
  9027. });
  9028. }
  9029. }
  9030. return rawChild;
  9031. }
  9032. };
  9033. // Provides transition support for list items.
  9034. var props = extend({
  9035. tag: String,
  9036. moveClass: String
  9037. }, transitionProps);
  9038. delete props.mode;
  9039. var TransitionGroup = {
  9040. props: props,
  9041. beforeMount: function () {
  9042. var _this = this;
  9043. var update = this._update;
  9044. this._update = function (vnode, hydrating) {
  9045. var restoreActiveInstance = setActiveInstance(_this);
  9046. // force removing pass
  9047. _this.__patch__(_this._vnode, _this.kept, false, // hydrating
  9048. true // removeOnly (!important, avoids unnecessary moves)
  9049. );
  9050. _this._vnode = _this.kept;
  9051. restoreActiveInstance();
  9052. update.call(_this, vnode, hydrating);
  9053. };
  9054. },
  9055. render: function (h) {
  9056. var tag = this.tag || this.$vnode.data.tag || 'span';
  9057. var map = Object.create(null);
  9058. var prevChildren = (this.prevChildren = this.children);
  9059. var rawChildren = this.$slots.default || [];
  9060. var children = (this.children = []);
  9061. var transitionData = extractTransitionData(this);
  9062. for (var i = 0; i < rawChildren.length; i++) {
  9063. var c = rawChildren[i];
  9064. if (c.tag) {
  9065. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  9066. children.push(c);
  9067. map[c.key] = c;
  9068. (c.data || (c.data = {})).transition = transitionData;
  9069. }
  9070. else if (process.env.NODE_ENV !== 'production') {
  9071. var opts = c.componentOptions;
  9072. var name_1 = opts
  9073. ? getComponentName(opts.Ctor.options) || opts.tag || ''
  9074. : c.tag;
  9075. warn$2("<transition-group> children must be keyed: <".concat(name_1, ">"));
  9076. }
  9077. }
  9078. }
  9079. if (prevChildren) {
  9080. var kept = [];
  9081. var removed = [];
  9082. for (var i = 0; i < prevChildren.length; i++) {
  9083. var c = prevChildren[i];
  9084. c.data.transition = transitionData;
  9085. // @ts-expect-error .getBoundingClientRect is not typed in Node
  9086. c.data.pos = c.elm.getBoundingClientRect();
  9087. if (map[c.key]) {
  9088. kept.push(c);
  9089. }
  9090. else {
  9091. removed.push(c);
  9092. }
  9093. }
  9094. this.kept = h(tag, null, kept);
  9095. this.removed = removed;
  9096. }
  9097. return h(tag, null, children);
  9098. },
  9099. updated: function () {
  9100. var children = this.prevChildren;
  9101. var moveClass = this.moveClass || (this.name || 'v') + '-move';
  9102. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  9103. return;
  9104. }
  9105. // we divide the work into three loops to avoid mixing DOM reads and writes
  9106. // in each iteration - which helps prevent layout thrashing.
  9107. children.forEach(callPendingCbs);
  9108. children.forEach(recordPosition);
  9109. children.forEach(applyTranslation);
  9110. // force reflow to put everything in position
  9111. // assign to this to avoid being removed in tree-shaking
  9112. // $flow-disable-line
  9113. this._reflow = document.body.offsetHeight;
  9114. children.forEach(function (c) {
  9115. if (c.data.moved) {
  9116. var el_1 = c.elm;
  9117. var s = el_1.style;
  9118. addTransitionClass(el_1, moveClass);
  9119. s.transform = s.WebkitTransform = s.transitionDuration = '';
  9120. el_1.addEventListener(transitionEndEvent, (el_1._moveCb = function cb(e) {
  9121. if (e && e.target !== el_1) {
  9122. return;
  9123. }
  9124. if (!e || /transform$/.test(e.propertyName)) {
  9125. el_1.removeEventListener(transitionEndEvent, cb);
  9126. el_1._moveCb = null;
  9127. removeTransitionClass(el_1, moveClass);
  9128. }
  9129. }));
  9130. }
  9131. });
  9132. },
  9133. methods: {
  9134. hasMove: function (el, moveClass) {
  9135. /* istanbul ignore if */
  9136. if (!hasTransition) {
  9137. return false;
  9138. }
  9139. /* istanbul ignore if */
  9140. if (this._hasMove) {
  9141. return this._hasMove;
  9142. }
  9143. // Detect whether an element with the move class applied has
  9144. // CSS transitions. Since the element may be inside an entering
  9145. // transition at this very moment, we make a clone of it and remove
  9146. // all other transition classes applied to ensure only the move class
  9147. // is applied.
  9148. var clone = el.cloneNode();
  9149. if (el._transitionClasses) {
  9150. el._transitionClasses.forEach(function (cls) {
  9151. removeClass(clone, cls);
  9152. });
  9153. }
  9154. addClass(clone, moveClass);
  9155. clone.style.display = 'none';
  9156. this.$el.appendChild(clone);
  9157. var info = getTransitionInfo(clone);
  9158. this.$el.removeChild(clone);
  9159. return (this._hasMove = info.hasTransform);
  9160. }
  9161. }
  9162. };
  9163. function callPendingCbs(c) {
  9164. /* istanbul ignore if */
  9165. if (c.elm._moveCb) {
  9166. c.elm._moveCb();
  9167. }
  9168. /* istanbul ignore if */
  9169. if (c.elm._enterCb) {
  9170. c.elm._enterCb();
  9171. }
  9172. }
  9173. function recordPosition(c) {
  9174. c.data.newPos = c.elm.getBoundingClientRect();
  9175. }
  9176. function applyTranslation(c) {
  9177. var oldPos = c.data.pos;
  9178. var newPos = c.data.newPos;
  9179. var dx = oldPos.left - newPos.left;
  9180. var dy = oldPos.top - newPos.top;
  9181. if (dx || dy) {
  9182. c.data.moved = true;
  9183. var s = c.elm.style;
  9184. s.transform = s.WebkitTransform = "translate(".concat(dx, "px,").concat(dy, "px)");
  9185. s.transitionDuration = '0s';
  9186. }
  9187. }
  9188. var platformComponents = {
  9189. Transition: Transition,
  9190. TransitionGroup: TransitionGroup
  9191. };
  9192. // install platform specific utils
  9193. Vue.config.mustUseProp = mustUseProp;
  9194. Vue.config.isReservedTag = isReservedTag;
  9195. Vue.config.isReservedAttr = isReservedAttr;
  9196. Vue.config.getTagNamespace = getTagNamespace;
  9197. Vue.config.isUnknownElement = isUnknownElement;
  9198. // install platform runtime directives & components
  9199. extend(Vue.options.directives, platformDirectives);
  9200. extend(Vue.options.components, platformComponents);
  9201. // install platform patch function
  9202. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  9203. // public mount method
  9204. Vue.prototype.$mount = function (el, hydrating) {
  9205. el = el && inBrowser ? query(el) : undefined;
  9206. return mountComponent(this, el, hydrating);
  9207. };
  9208. // devtools global hook
  9209. /* istanbul ignore next */
  9210. if (inBrowser) {
  9211. setTimeout(function () {
  9212. if (config.devtools) {
  9213. if (devtools) {
  9214. devtools.emit('init', Vue);
  9215. }
  9216. else if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
  9217. // @ts-expect-error
  9218. console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' +
  9219. 'https://github.com/vuejs/vue-devtools');
  9220. }
  9221. }
  9222. if (process.env.NODE_ENV !== 'production' &&
  9223. process.env.NODE_ENV !== 'test' &&
  9224. config.productionTip !== false &&
  9225. typeof console !== 'undefined') {
  9226. // @ts-expect-error
  9227. console[console.info ? 'info' : 'log']("You are running Vue in development mode.\n" +
  9228. "Make sure to turn on production mode when deploying for production.\n" +
  9229. "See more tips at https://vuejs.org/guide/deployment.html");
  9230. }
  9231. }, 0);
  9232. }
  9233. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  9234. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  9235. var buildRegex = cached(function (delimiters) {
  9236. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  9237. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  9238. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g');
  9239. });
  9240. function parseText(text, delimiters) {
  9241. //@ts-expect-error
  9242. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  9243. if (!tagRE.test(text)) {
  9244. return;
  9245. }
  9246. var tokens = [];
  9247. var rawTokens = [];
  9248. var lastIndex = (tagRE.lastIndex = 0);
  9249. var match, index, tokenValue;
  9250. while ((match = tagRE.exec(text))) {
  9251. index = match.index;
  9252. // push text token
  9253. if (index > lastIndex) {
  9254. rawTokens.push((tokenValue = text.slice(lastIndex, index)));
  9255. tokens.push(JSON.stringify(tokenValue));
  9256. }
  9257. // tag token
  9258. var exp = parseFilters(match[1].trim());
  9259. tokens.push("_s(".concat(exp, ")"));
  9260. rawTokens.push({ '@binding': exp });
  9261. lastIndex = index + match[0].length;
  9262. }
  9263. if (lastIndex < text.length) {
  9264. rawTokens.push((tokenValue = text.slice(lastIndex)));
  9265. tokens.push(JSON.stringify(tokenValue));
  9266. }
  9267. return {
  9268. expression: tokens.join('+'),
  9269. tokens: rawTokens
  9270. };
  9271. }
  9272. function transformNode$1(el, options) {
  9273. var warn = options.warn || baseWarn;
  9274. var staticClass = getAndRemoveAttr(el, 'class');
  9275. if (process.env.NODE_ENV !== 'production' && staticClass) {
  9276. var res = parseText(staticClass, options.delimiters);
  9277. if (res) {
  9278. warn("class=\"".concat(staticClass, "\": ") +
  9279. 'Interpolation inside attributes has been removed. ' +
  9280. 'Use v-bind or the colon shorthand instead. For example, ' +
  9281. 'instead of <div class="{{ val }}">, use <div :class="val">.', el.rawAttrsMap['class']);
  9282. }
  9283. }
  9284. if (staticClass) {
  9285. el.staticClass = JSON.stringify(staticClass.replace(/\s+/g, ' ').trim());
  9286. }
  9287. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  9288. if (classBinding) {
  9289. el.classBinding = classBinding;
  9290. }
  9291. }
  9292. function genData$2(el) {
  9293. var data = '';
  9294. if (el.staticClass) {
  9295. data += "staticClass:".concat(el.staticClass, ",");
  9296. }
  9297. if (el.classBinding) {
  9298. data += "class:".concat(el.classBinding, ",");
  9299. }
  9300. return data;
  9301. }
  9302. var klass = {
  9303. staticKeys: ['staticClass'],
  9304. transformNode: transformNode$1,
  9305. genData: genData$2
  9306. };
  9307. function transformNode(el, options) {
  9308. var warn = options.warn || baseWarn;
  9309. var staticStyle = getAndRemoveAttr(el, 'style');
  9310. if (staticStyle) {
  9311. /* istanbul ignore if */
  9312. if (process.env.NODE_ENV !== 'production') {
  9313. var res = parseText(staticStyle, options.delimiters);
  9314. if (res) {
  9315. warn("style=\"".concat(staticStyle, "\": ") +
  9316. 'Interpolation inside attributes has been removed. ' +
  9317. 'Use v-bind or the colon shorthand instead. For example, ' +
  9318. 'instead of <div style="{{ val }}">, use <div :style="val">.', el.rawAttrsMap['style']);
  9319. }
  9320. }
  9321. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  9322. }
  9323. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  9324. if (styleBinding) {
  9325. el.styleBinding = styleBinding;
  9326. }
  9327. }
  9328. function genData$1(el) {
  9329. var data = '';
  9330. if (el.staticStyle) {
  9331. data += "staticStyle:".concat(el.staticStyle, ",");
  9332. }
  9333. if (el.styleBinding) {
  9334. data += "style:(".concat(el.styleBinding, "),");
  9335. }
  9336. return data;
  9337. }
  9338. var style = {
  9339. staticKeys: ['staticStyle'],
  9340. transformNode: transformNode,
  9341. genData: genData$1
  9342. };
  9343. var decoder;
  9344. var he = {
  9345. decode: function (html) {
  9346. decoder = decoder || document.createElement('div');
  9347. decoder.innerHTML = html;
  9348. return decoder.textContent;
  9349. }
  9350. };
  9351. var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  9352. 'link,meta,param,source,track,wbr');
  9353. // Elements that you can, intentionally, leave open
  9354. // (and which close themselves)
  9355. var canBeLeftOpenTag = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source');
  9356. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  9357. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  9358. var isNonPhrasingTag = makeMap('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  9359. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  9360. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  9361. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  9362. 'title,tr,track');
  9363. /**
  9364. * Not type-checking this file because it's mostly vendor code.
  9365. */
  9366. // Regular Expressions for parsing tags and attributes
  9367. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9368. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9369. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z".concat(unicodeRegExp.source, "]*");
  9370. var qnameCapture = "((?:".concat(ncname, "\\:)?").concat(ncname, ")");
  9371. var startTagOpen = new RegExp("^<".concat(qnameCapture));
  9372. var startTagClose = /^\s*(\/?)>/;
  9373. var endTag = new RegExp("^<\\/".concat(qnameCapture, "[^>]*>"));
  9374. var doctype = /^<!DOCTYPE [^>]+>/i;
  9375. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  9376. var comment = /^<!\--/;
  9377. var conditionalComment = /^<!\[/;
  9378. // Special Elements (can contain anything)
  9379. var isPlainTextElement = makeMap('script,style,textarea', true);
  9380. var reCache = {};
  9381. var decodingMap = {
  9382. '&lt;': '<',
  9383. '&gt;': '>',
  9384. '&quot;': '"',
  9385. '&amp;': '&',
  9386. '&#10;': '\n',
  9387. '&#9;': '\t',
  9388. '&#39;': "'"
  9389. };
  9390. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  9391. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  9392. // #5992
  9393. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  9394. var shouldIgnoreFirstNewline = function (tag, html) {
  9395. return tag && isIgnoreNewlineTag(tag) && html[0] === '\n';
  9396. };
  9397. function decodeAttr(value, shouldDecodeNewlines) {
  9398. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  9399. return value.replace(re, function (match) { return decodingMap[match]; });
  9400. }
  9401. function parseHTML(html, options) {
  9402. var stack = [];
  9403. var expectHTML = options.expectHTML;
  9404. var isUnaryTag = options.isUnaryTag || no;
  9405. var canBeLeftOpenTag = options.canBeLeftOpenTag || no;
  9406. var index = 0;
  9407. var last, lastTag;
  9408. var _loop_1 = function () {
  9409. last = html;
  9410. // Make sure we're not in a plaintext content element like script/style
  9411. if (!lastTag || !isPlainTextElement(lastTag)) {
  9412. var textEnd = html.indexOf('<');
  9413. if (textEnd === 0) {
  9414. // Comment:
  9415. if (comment.test(html)) {
  9416. var commentEnd = html.indexOf('-->');
  9417. if (commentEnd >= 0) {
  9418. if (options.shouldKeepComment && options.comment) {
  9419. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  9420. }
  9421. advance(commentEnd + 3);
  9422. return "continue";
  9423. }
  9424. }
  9425. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  9426. if (conditionalComment.test(html)) {
  9427. var conditionalEnd = html.indexOf(']>');
  9428. if (conditionalEnd >= 0) {
  9429. advance(conditionalEnd + 2);
  9430. return "continue";
  9431. }
  9432. }
  9433. // Doctype:
  9434. var doctypeMatch = html.match(doctype);
  9435. if (doctypeMatch) {
  9436. advance(doctypeMatch[0].length);
  9437. return "continue";
  9438. }
  9439. // End tag:
  9440. var endTagMatch = html.match(endTag);
  9441. if (endTagMatch) {
  9442. var curIndex = index;
  9443. advance(endTagMatch[0].length);
  9444. parseEndTag(endTagMatch[1], curIndex, index);
  9445. return "continue";
  9446. }
  9447. // Start tag:
  9448. var startTagMatch = parseStartTag();
  9449. if (startTagMatch) {
  9450. handleStartTag(startTagMatch);
  9451. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  9452. advance(1);
  9453. }
  9454. return "continue";
  9455. }
  9456. }
  9457. var text = void 0, rest = void 0, next = void 0;
  9458. if (textEnd >= 0) {
  9459. rest = html.slice(textEnd);
  9460. while (!endTag.test(rest) &&
  9461. !startTagOpen.test(rest) &&
  9462. !comment.test(rest) &&
  9463. !conditionalComment.test(rest)) {
  9464. // < in plain text, be forgiving and treat it as text
  9465. next = rest.indexOf('<', 1);
  9466. if (next < 0)
  9467. break;
  9468. textEnd += next;
  9469. rest = html.slice(textEnd);
  9470. }
  9471. text = html.substring(0, textEnd);
  9472. }
  9473. if (textEnd < 0) {
  9474. text = html;
  9475. }
  9476. if (text) {
  9477. advance(text.length);
  9478. }
  9479. if (options.chars && text) {
  9480. options.chars(text, index - text.length, index);
  9481. }
  9482. }
  9483. else {
  9484. var endTagLength_1 = 0;
  9485. var stackedTag_1 = lastTag.toLowerCase();
  9486. var reStackedTag = reCache[stackedTag_1] ||
  9487. (reCache[stackedTag_1] = new RegExp('([\\s\\S]*?)(</' + stackedTag_1 + '[^>]*>)', 'i'));
  9488. var rest = html.replace(reStackedTag, function (all, text, endTag) {
  9489. endTagLength_1 = endTag.length;
  9490. if (!isPlainTextElement(stackedTag_1) && stackedTag_1 !== 'noscript') {
  9491. text = text
  9492. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  9493. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  9494. }
  9495. if (shouldIgnoreFirstNewline(stackedTag_1, text)) {
  9496. text = text.slice(1);
  9497. }
  9498. if (options.chars) {
  9499. options.chars(text);
  9500. }
  9501. return '';
  9502. });
  9503. index += html.length - rest.length;
  9504. html = rest;
  9505. parseEndTag(stackedTag_1, index - endTagLength_1, index);
  9506. }
  9507. if (html === last) {
  9508. options.chars && options.chars(html);
  9509. if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
  9510. options.warn("Mal-formatted tag at end of template: \"".concat(html, "\""), {
  9511. start: index + html.length
  9512. });
  9513. }
  9514. return "break";
  9515. }
  9516. };
  9517. while (html) {
  9518. var state_1 = _loop_1();
  9519. if (state_1 === "break")
  9520. break;
  9521. }
  9522. // Clean up any remaining tags
  9523. parseEndTag();
  9524. function advance(n) {
  9525. index += n;
  9526. html = html.substring(n);
  9527. }
  9528. function parseStartTag() {
  9529. var start = html.match(startTagOpen);
  9530. if (start) {
  9531. var match = {
  9532. tagName: start[1],
  9533. attrs: [],
  9534. start: index
  9535. };
  9536. advance(start[0].length);
  9537. var end = void 0, attr = void 0;
  9538. while (!(end = html.match(startTagClose)) &&
  9539. (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  9540. attr.start = index;
  9541. advance(attr[0].length);
  9542. attr.end = index;
  9543. match.attrs.push(attr);
  9544. }
  9545. if (end) {
  9546. match.unarySlash = end[1];
  9547. advance(end[0].length);
  9548. match.end = index;
  9549. return match;
  9550. }
  9551. }
  9552. }
  9553. function handleStartTag(match) {
  9554. var tagName = match.tagName;
  9555. var unarySlash = match.unarySlash;
  9556. if (expectHTML) {
  9557. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  9558. parseEndTag(lastTag);
  9559. }
  9560. if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
  9561. parseEndTag(tagName);
  9562. }
  9563. }
  9564. var unary = isUnaryTag(tagName) || !!unarySlash;
  9565. var l = match.attrs.length;
  9566. var attrs = new Array(l);
  9567. for (var i = 0; i < l; i++) {
  9568. var args = match.attrs[i];
  9569. var value = args[3] || args[4] || args[5] || '';
  9570. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  9571. ? options.shouldDecodeNewlinesForHref
  9572. : options.shouldDecodeNewlines;
  9573. attrs[i] = {
  9574. name: args[1],
  9575. value: decodeAttr(value, shouldDecodeNewlines)
  9576. };
  9577. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  9578. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  9579. attrs[i].end = args.end;
  9580. }
  9581. }
  9582. if (!unary) {
  9583. stack.push({
  9584. tag: tagName,
  9585. lowerCasedTag: tagName.toLowerCase(),
  9586. attrs: attrs,
  9587. start: match.start,
  9588. end: match.end
  9589. });
  9590. lastTag = tagName;
  9591. }
  9592. if (options.start) {
  9593. options.start(tagName, attrs, unary, match.start, match.end);
  9594. }
  9595. }
  9596. function parseEndTag(tagName, start, end) {
  9597. var pos, lowerCasedTagName;
  9598. if (start == null)
  9599. start = index;
  9600. if (end == null)
  9601. end = index;
  9602. // Find the closest opened tag of the same type
  9603. if (tagName) {
  9604. lowerCasedTagName = tagName.toLowerCase();
  9605. for (pos = stack.length - 1; pos >= 0; pos--) {
  9606. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  9607. break;
  9608. }
  9609. }
  9610. }
  9611. else {
  9612. // If no tag name is provided, clean shop
  9613. pos = 0;
  9614. }
  9615. if (pos >= 0) {
  9616. // Close all the open elements, up the stack
  9617. for (var i = stack.length - 1; i >= pos; i--) {
  9618. if (process.env.NODE_ENV !== 'production' && (i > pos || !tagName) && options.warn) {
  9619. options.warn("tag <".concat(stack[i].tag, "> has no matching end tag."), {
  9620. start: stack[i].start,
  9621. end: stack[i].end
  9622. });
  9623. }
  9624. if (options.end) {
  9625. options.end(stack[i].tag, start, end);
  9626. }
  9627. }
  9628. // Remove the open elements from the stack
  9629. stack.length = pos;
  9630. lastTag = pos && stack[pos - 1].tag;
  9631. }
  9632. else if (lowerCasedTagName === 'br') {
  9633. if (options.start) {
  9634. options.start(tagName, [], true, start, end);
  9635. }
  9636. }
  9637. else if (lowerCasedTagName === 'p') {
  9638. if (options.start) {
  9639. options.start(tagName, [], false, start, end);
  9640. }
  9641. if (options.end) {
  9642. options.end(tagName, start, end);
  9643. }
  9644. }
  9645. }
  9646. }
  9647. var onRE = /^@|^v-on:/;
  9648. var dirRE = /^v-|^@|^:|^#/;
  9649. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  9650. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  9651. var stripParensRE = /^\(|\)$/g;
  9652. var dynamicArgRE = /^\[.*\]$/;
  9653. var argRE = /:(.*)$/;
  9654. var bindRE = /^:|^\.|^v-bind:/;
  9655. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  9656. var slotRE = /^v-slot(:|$)|^#/;
  9657. var lineBreakRE = /[\r\n]/;
  9658. var whitespaceRE = /[ \f\t\r\n]+/g;
  9659. var invalidAttributeRE = /[\s"'<>\/=]/;
  9660. var decodeHTMLCached = cached(he.decode);
  9661. var emptySlotScopeToken = "_empty_";
  9662. // configurable state
  9663. var warn;
  9664. var delimiters;
  9665. var transforms;
  9666. var preTransforms;
  9667. var postTransforms;
  9668. var platformIsPreTag;
  9669. var platformMustUseProp;
  9670. var platformGetTagNamespace;
  9671. var maybeComponent;
  9672. function createASTElement(tag, attrs, parent) {
  9673. return {
  9674. type: 1,
  9675. tag: tag,
  9676. attrsList: attrs,
  9677. attrsMap: makeAttrsMap(attrs),
  9678. rawAttrsMap: {},
  9679. parent: parent,
  9680. children: []
  9681. };
  9682. }
  9683. /**
  9684. * Convert HTML string to AST.
  9685. */
  9686. function parse(template, options) {
  9687. warn = options.warn || baseWarn;
  9688. platformIsPreTag = options.isPreTag || no;
  9689. platformMustUseProp = options.mustUseProp || no;
  9690. platformGetTagNamespace = options.getTagNamespace || no;
  9691. var isReservedTag = options.isReservedTag || no;
  9692. maybeComponent = function (el) {
  9693. return !!(el.component ||
  9694. el.attrsMap[':is'] ||
  9695. el.attrsMap['v-bind:is'] ||
  9696. !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)));
  9697. };
  9698. transforms = pluckModuleFunction(options.modules, 'transformNode');
  9699. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  9700. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  9701. delimiters = options.delimiters;
  9702. var stack = [];
  9703. var preserveWhitespace = options.preserveWhitespace !== false;
  9704. var whitespaceOption = options.whitespace;
  9705. var root;
  9706. var currentParent;
  9707. var inVPre = false;
  9708. var inPre = false;
  9709. var warned = false;
  9710. function warnOnce(msg, range) {
  9711. if (!warned) {
  9712. warned = true;
  9713. warn(msg, range);
  9714. }
  9715. }
  9716. function closeElement(element) {
  9717. trimEndingWhitespace(element);
  9718. if (!inVPre && !element.processed) {
  9719. element = processElement(element, options);
  9720. }
  9721. // tree management
  9722. if (!stack.length && element !== root) {
  9723. // allow root elements with v-if, v-else-if and v-else
  9724. if (root.if && (element.elseif || element.else)) {
  9725. if (process.env.NODE_ENV !== 'production') {
  9726. checkRootConstraints(element);
  9727. }
  9728. addIfCondition(root, {
  9729. exp: element.elseif,
  9730. block: element
  9731. });
  9732. }
  9733. else if (process.env.NODE_ENV !== 'production') {
  9734. warnOnce("Component template should contain exactly one root element. " +
  9735. "If you are using v-if on multiple elements, " +
  9736. "use v-else-if to chain them instead.", { start: element.start });
  9737. }
  9738. }
  9739. if (currentParent && !element.forbidden) {
  9740. if (element.elseif || element.else) {
  9741. processIfConditions(element, currentParent);
  9742. }
  9743. else {
  9744. if (element.slotScope) {
  9745. // scoped slot
  9746. // keep it in the children list so that v-else(-if) conditions can
  9747. // find it as the prev node.
  9748. var name_1 = element.slotTarget || '"default"';
  9749. (currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name_1] = element;
  9750. }
  9751. currentParent.children.push(element);
  9752. element.parent = currentParent;
  9753. }
  9754. }
  9755. // final children cleanup
  9756. // filter out scoped slots
  9757. element.children = element.children.filter(function (c) { return !c.slotScope; });
  9758. // remove trailing whitespace node again
  9759. trimEndingWhitespace(element);
  9760. // check pre state
  9761. if (element.pre) {
  9762. inVPre = false;
  9763. }
  9764. if (platformIsPreTag(element.tag)) {
  9765. inPre = false;
  9766. }
  9767. // apply post-transforms
  9768. for (var i = 0; i < postTransforms.length; i++) {
  9769. postTransforms[i](element, options);
  9770. }
  9771. }
  9772. function trimEndingWhitespace(el) {
  9773. // remove trailing whitespace node
  9774. if (!inPre) {
  9775. var lastNode = void 0;
  9776. while ((lastNode = el.children[el.children.length - 1]) &&
  9777. lastNode.type === 3 &&
  9778. lastNode.text === ' ') {
  9779. el.children.pop();
  9780. }
  9781. }
  9782. }
  9783. function checkRootConstraints(el) {
  9784. if (el.tag === 'slot' || el.tag === 'template') {
  9785. warnOnce("Cannot use <".concat(el.tag, "> as component root element because it may ") +
  9786. 'contain multiple nodes.', { start: el.start });
  9787. }
  9788. if (el.attrsMap.hasOwnProperty('v-for')) {
  9789. warnOnce('Cannot use v-for on stateful component root element because ' +
  9790. 'it renders multiple elements.', el.rawAttrsMap['v-for']);
  9791. }
  9792. }
  9793. parseHTML(template, {
  9794. warn: warn,
  9795. expectHTML: options.expectHTML,
  9796. isUnaryTag: options.isUnaryTag,
  9797. canBeLeftOpenTag: options.canBeLeftOpenTag,
  9798. shouldDecodeNewlines: options.shouldDecodeNewlines,
  9799. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  9800. shouldKeepComment: options.comments,
  9801. outputSourceRange: options.outputSourceRange,
  9802. start: function (tag, attrs, unary, start, end) {
  9803. // check namespace.
  9804. // inherit parent ns if there is one
  9805. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  9806. // handle IE svg bug
  9807. /* istanbul ignore if */
  9808. if (isIE && ns === 'svg') {
  9809. attrs = guardIESVGBug(attrs);
  9810. }
  9811. var element = createASTElement(tag, attrs, currentParent);
  9812. if (ns) {
  9813. element.ns = ns;
  9814. }
  9815. if (process.env.NODE_ENV !== 'production') {
  9816. if (options.outputSourceRange) {
  9817. element.start = start;
  9818. element.end = end;
  9819. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  9820. cumulated[attr.name] = attr;
  9821. return cumulated;
  9822. }, {});
  9823. }
  9824. attrs.forEach(function (attr) {
  9825. if (invalidAttributeRE.test(attr.name)) {
  9826. warn("Invalid dynamic argument expression: attribute names cannot contain " +
  9827. "spaces, quotes, <, >, / or =.", options.outputSourceRange
  9828. ? {
  9829. start: attr.start + attr.name.indexOf("["),
  9830. end: attr.start + attr.name.length
  9831. }
  9832. : undefined);
  9833. }
  9834. });
  9835. }
  9836. if (isForbiddenTag(element) && !isServerRendering()) {
  9837. element.forbidden = true;
  9838. process.env.NODE_ENV !== 'production' &&
  9839. warn('Templates should only be responsible for mapping the state to the ' +
  9840. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  9841. "<".concat(tag, ">") +
  9842. ', as they will not be parsed.', { start: element.start });
  9843. }
  9844. // apply pre-transforms
  9845. for (var i = 0; i < preTransforms.length; i++) {
  9846. element = preTransforms[i](element, options) || element;
  9847. }
  9848. if (!inVPre) {
  9849. processPre(element);
  9850. if (element.pre) {
  9851. inVPre = true;
  9852. }
  9853. }
  9854. if (platformIsPreTag(element.tag)) {
  9855. inPre = true;
  9856. }
  9857. if (inVPre) {
  9858. processRawAttrs(element);
  9859. }
  9860. else if (!element.processed) {
  9861. // structural directives
  9862. processFor(element);
  9863. processIf(element);
  9864. processOnce(element);
  9865. }
  9866. if (!root) {
  9867. root = element;
  9868. if (process.env.NODE_ENV !== 'production') {
  9869. checkRootConstraints(root);
  9870. }
  9871. }
  9872. if (!unary) {
  9873. currentParent = element;
  9874. stack.push(element);
  9875. }
  9876. else {
  9877. closeElement(element);
  9878. }
  9879. },
  9880. end: function (tag, start, end) {
  9881. var element = stack[stack.length - 1];
  9882. // pop stack
  9883. stack.length -= 1;
  9884. currentParent = stack[stack.length - 1];
  9885. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  9886. element.end = end;
  9887. }
  9888. closeElement(element);
  9889. },
  9890. chars: function (text, start, end) {
  9891. if (!currentParent) {
  9892. if (process.env.NODE_ENV !== 'production') {
  9893. if (text === template) {
  9894. warnOnce('Component template requires a root element, rather than just text.', { start: start });
  9895. }
  9896. else if ((text = text.trim())) {
  9897. warnOnce("text \"".concat(text, "\" outside root element will be ignored."), {
  9898. start: start
  9899. });
  9900. }
  9901. }
  9902. return;
  9903. }
  9904. // IE textarea placeholder bug
  9905. /* istanbul ignore if */
  9906. if (isIE &&
  9907. currentParent.tag === 'textarea' &&
  9908. currentParent.attrsMap.placeholder === text) {
  9909. return;
  9910. }
  9911. var children = currentParent.children;
  9912. if (inPre || text.trim()) {
  9913. text = isTextTag(currentParent)
  9914. ? text
  9915. : decodeHTMLCached(text);
  9916. }
  9917. else if (!children.length) {
  9918. // remove the whitespace-only node right after an opening tag
  9919. text = '';
  9920. }
  9921. else if (whitespaceOption) {
  9922. if (whitespaceOption === 'condense') {
  9923. // in condense mode, remove the whitespace node if it contains
  9924. // line break, otherwise condense to a single space
  9925. text = lineBreakRE.test(text) ? '' : ' ';
  9926. }
  9927. else {
  9928. text = ' ';
  9929. }
  9930. }
  9931. else {
  9932. text = preserveWhitespace ? ' ' : '';
  9933. }
  9934. if (text) {
  9935. if (!inPre && whitespaceOption === 'condense') {
  9936. // condense consecutive whitespaces into single space
  9937. text = text.replace(whitespaceRE, ' ');
  9938. }
  9939. var res = void 0;
  9940. var child = void 0;
  9941. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  9942. child = {
  9943. type: 2,
  9944. expression: res.expression,
  9945. tokens: res.tokens,
  9946. text: text
  9947. };
  9948. }
  9949. else if (text !== ' ' ||
  9950. !children.length ||
  9951. children[children.length - 1].text !== ' ') {
  9952. child = {
  9953. type: 3,
  9954. text: text
  9955. };
  9956. }
  9957. if (child) {
  9958. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  9959. child.start = start;
  9960. child.end = end;
  9961. }
  9962. children.push(child);
  9963. }
  9964. }
  9965. },
  9966. comment: function (text, start, end) {
  9967. // adding anything as a sibling to the root node is forbidden
  9968. // comments should still be allowed, but ignored
  9969. if (currentParent) {
  9970. var child = {
  9971. type: 3,
  9972. text: text,
  9973. isComment: true
  9974. };
  9975. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  9976. child.start = start;
  9977. child.end = end;
  9978. }
  9979. currentParent.children.push(child);
  9980. }
  9981. }
  9982. });
  9983. return root;
  9984. }
  9985. function processPre(el) {
  9986. if (getAndRemoveAttr(el, 'v-pre') != null) {
  9987. el.pre = true;
  9988. }
  9989. }
  9990. function processRawAttrs(el) {
  9991. var list = el.attrsList;
  9992. var len = list.length;
  9993. if (len) {
  9994. var attrs = (el.attrs = new Array(len));
  9995. for (var i = 0; i < len; i++) {
  9996. attrs[i] = {
  9997. name: list[i].name,
  9998. value: JSON.stringify(list[i].value)
  9999. };
  10000. if (list[i].start != null) {
  10001. attrs[i].start = list[i].start;
  10002. attrs[i].end = list[i].end;
  10003. }
  10004. }
  10005. }
  10006. else if (!el.pre) {
  10007. // non root node in pre blocks with no attributes
  10008. el.plain = true;
  10009. }
  10010. }
  10011. function processElement(element, options) {
  10012. processKey(element);
  10013. // determine whether this is a plain element after
  10014. // removing structural attributes
  10015. element.plain =
  10016. !element.key && !element.scopedSlots && !element.attrsList.length;
  10017. processRef(element);
  10018. processSlotContent(element);
  10019. processSlotOutlet(element);
  10020. processComponent(element);
  10021. for (var i = 0; i < transforms.length; i++) {
  10022. element = transforms[i](element, options) || element;
  10023. }
  10024. processAttrs(element);
  10025. return element;
  10026. }
  10027. function processKey(el) {
  10028. var exp = getBindingAttr(el, 'key');
  10029. if (exp) {
  10030. if (process.env.NODE_ENV !== 'production') {
  10031. if (el.tag === 'template') {
  10032. warn("<template> cannot be keyed. Place the key on real elements instead.", getRawBindingAttr(el, 'key'));
  10033. }
  10034. if (el.for) {
  10035. var iterator = el.iterator2 || el.iterator1;
  10036. var parent_1 = el.parent;
  10037. if (iterator &&
  10038. iterator === exp &&
  10039. parent_1 &&
  10040. parent_1.tag === 'transition-group') {
  10041. warn("Do not use v-for index as key on <transition-group> children, " +
  10042. "this is the same as not using keys.", getRawBindingAttr(el, 'key'), true /* tip */);
  10043. }
  10044. }
  10045. }
  10046. el.key = exp;
  10047. }
  10048. }
  10049. function processRef(el) {
  10050. var ref = getBindingAttr(el, 'ref');
  10051. if (ref) {
  10052. el.ref = ref;
  10053. el.refInFor = checkInFor(el);
  10054. }
  10055. }
  10056. function processFor(el) {
  10057. var exp;
  10058. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  10059. var res = parseFor(exp);
  10060. if (res) {
  10061. extend(el, res);
  10062. }
  10063. else if (process.env.NODE_ENV !== 'production') {
  10064. warn("Invalid v-for expression: ".concat(exp), el.rawAttrsMap['v-for']);
  10065. }
  10066. }
  10067. }
  10068. function parseFor(exp) {
  10069. var inMatch = exp.match(forAliasRE);
  10070. if (!inMatch)
  10071. return;
  10072. var res = {};
  10073. res.for = inMatch[2].trim();
  10074. var alias = inMatch[1].trim().replace(stripParensRE, '');
  10075. var iteratorMatch = alias.match(forIteratorRE);
  10076. if (iteratorMatch) {
  10077. res.alias = alias.replace(forIteratorRE, '').trim();
  10078. res.iterator1 = iteratorMatch[1].trim();
  10079. if (iteratorMatch[2]) {
  10080. res.iterator2 = iteratorMatch[2].trim();
  10081. }
  10082. }
  10083. else {
  10084. res.alias = alias;
  10085. }
  10086. return res;
  10087. }
  10088. function processIf(el) {
  10089. var exp = getAndRemoveAttr(el, 'v-if');
  10090. if (exp) {
  10091. el.if = exp;
  10092. addIfCondition(el, {
  10093. exp: exp,
  10094. block: el
  10095. });
  10096. }
  10097. else {
  10098. if (getAndRemoveAttr(el, 'v-else') != null) {
  10099. el.else = true;
  10100. }
  10101. var elseif = getAndRemoveAttr(el, 'v-else-if');
  10102. if (elseif) {
  10103. el.elseif = elseif;
  10104. }
  10105. }
  10106. }
  10107. function processIfConditions(el, parent) {
  10108. var prev = findPrevElement(parent.children);
  10109. if (prev && prev.if) {
  10110. addIfCondition(prev, {
  10111. exp: el.elseif,
  10112. block: el
  10113. });
  10114. }
  10115. else if (process.env.NODE_ENV !== 'production') {
  10116. warn("v-".concat(el.elseif ? 'else-if="' + el.elseif + '"' : 'else', " ") +
  10117. "used on element <".concat(el.tag, "> without corresponding v-if."), el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']);
  10118. }
  10119. }
  10120. function findPrevElement(children) {
  10121. var i = children.length;
  10122. while (i--) {
  10123. if (children[i].type === 1) {
  10124. return children[i];
  10125. }
  10126. else {
  10127. if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
  10128. warn("text \"".concat(children[i].text.trim(), "\" between v-if and v-else(-if) ") +
  10129. "will be ignored.", children[i]);
  10130. }
  10131. children.pop();
  10132. }
  10133. }
  10134. }
  10135. function addIfCondition(el, condition) {
  10136. if (!el.ifConditions) {
  10137. el.ifConditions = [];
  10138. }
  10139. el.ifConditions.push(condition);
  10140. }
  10141. function processOnce(el) {
  10142. var once = getAndRemoveAttr(el, 'v-once');
  10143. if (once != null) {
  10144. el.once = true;
  10145. }
  10146. }
  10147. // handle content being passed to a component as slot,
  10148. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  10149. function processSlotContent(el) {
  10150. var slotScope;
  10151. if (el.tag === 'template') {
  10152. slotScope = getAndRemoveAttr(el, 'scope');
  10153. /* istanbul ignore if */
  10154. if (process.env.NODE_ENV !== 'production' && slotScope) {
  10155. warn("the \"scope\" attribute for scoped slots have been deprecated and " +
  10156. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  10157. "can also be used on plain elements in addition to <template> to " +
  10158. "denote scoped slots.", el.rawAttrsMap['scope'], true);
  10159. }
  10160. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  10161. }
  10162. else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  10163. /* istanbul ignore if */
  10164. if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
  10165. warn("Ambiguous combined usage of slot-scope and v-for on <".concat(el.tag, "> ") +
  10166. "(v-for takes higher priority). Use a wrapper <template> for the " +
  10167. "scoped slot to make it clearer.", el.rawAttrsMap['slot-scope'], true);
  10168. }
  10169. el.slotScope = slotScope;
  10170. }
  10171. // slot="xxx"
  10172. var slotTarget = getBindingAttr(el, 'slot');
  10173. if (slotTarget) {
  10174. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  10175. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  10176. // preserve slot as an attribute for native shadow DOM compat
  10177. // only for non-scoped slots.
  10178. if (el.tag !== 'template' && !el.slotScope) {
  10179. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  10180. }
  10181. }
  10182. // 2.6 v-slot syntax
  10183. {
  10184. if (el.tag === 'template') {
  10185. // v-slot on <template>
  10186. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  10187. if (slotBinding) {
  10188. if (process.env.NODE_ENV !== 'production') {
  10189. if (el.slotTarget || el.slotScope) {
  10190. warn("Unexpected mixed usage of different slot syntaxes.", el);
  10191. }
  10192. if (el.parent && !maybeComponent(el.parent)) {
  10193. warn("<template v-slot> can only appear at the root level inside " +
  10194. "the receiving component", el);
  10195. }
  10196. }
  10197. var _a = getSlotName(slotBinding), name_2 = _a.name, dynamic = _a.dynamic;
  10198. el.slotTarget = name_2;
  10199. el.slotTargetDynamic = dynamic;
  10200. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  10201. }
  10202. }
  10203. else {
  10204. // v-slot on component, denotes default slot
  10205. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  10206. if (slotBinding) {
  10207. if (process.env.NODE_ENV !== 'production') {
  10208. if (!maybeComponent(el)) {
  10209. warn("v-slot can only be used on components or <template>.", slotBinding);
  10210. }
  10211. if (el.slotScope || el.slotTarget) {
  10212. warn("Unexpected mixed usage of different slot syntaxes.", el);
  10213. }
  10214. if (el.scopedSlots) {
  10215. warn("To avoid scope ambiguity, the default slot should also use " +
  10216. "<template> syntax when there are other named slots.", slotBinding);
  10217. }
  10218. }
  10219. // add the component's children to its default slot
  10220. var slots = el.scopedSlots || (el.scopedSlots = {});
  10221. var _b = getSlotName(slotBinding), name_3 = _b.name, dynamic = _b.dynamic;
  10222. var slotContainer_1 = (slots[name_3] = createASTElement('template', [], el));
  10223. slotContainer_1.slotTarget = name_3;
  10224. slotContainer_1.slotTargetDynamic = dynamic;
  10225. slotContainer_1.children = el.children.filter(function (c) {
  10226. if (!c.slotScope) {
  10227. c.parent = slotContainer_1;
  10228. return true;
  10229. }
  10230. });
  10231. slotContainer_1.slotScope = slotBinding.value || emptySlotScopeToken;
  10232. // remove children as they are returned from scopedSlots now
  10233. el.children = [];
  10234. // mark el non-plain so data gets generated
  10235. el.plain = false;
  10236. }
  10237. }
  10238. }
  10239. }
  10240. function getSlotName(binding) {
  10241. var name = binding.name.replace(slotRE, '');
  10242. if (!name) {
  10243. if (binding.name[0] !== '#') {
  10244. name = 'default';
  10245. }
  10246. else if (process.env.NODE_ENV !== 'production') {
  10247. warn("v-slot shorthand syntax requires a slot name.", binding);
  10248. }
  10249. }
  10250. return dynamicArgRE.test(name)
  10251. ? // dynamic [name]
  10252. { name: name.slice(1, -1), dynamic: true }
  10253. : // static name
  10254. { name: "\"".concat(name, "\""), dynamic: false };
  10255. }
  10256. // handle <slot/> outlets
  10257. function processSlotOutlet(el) {
  10258. if (el.tag === 'slot') {
  10259. el.slotName = getBindingAttr(el, 'name');
  10260. if (process.env.NODE_ENV !== 'production' && el.key) {
  10261. warn("`key` does not work on <slot> because slots are abstract outlets " +
  10262. "and can possibly expand into multiple elements. " +
  10263. "Use the key on a wrapping element instead.", getRawBindingAttr(el, 'key'));
  10264. }
  10265. }
  10266. }
  10267. function processComponent(el) {
  10268. var binding;
  10269. if ((binding = getBindingAttr(el, 'is'))) {
  10270. el.component = binding;
  10271. }
  10272. if (getAndRemoveAttr(el, 'inline-template') != null) {
  10273. el.inlineTemplate = true;
  10274. }
  10275. }
  10276. function processAttrs(el) {
  10277. var list = el.attrsList;
  10278. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  10279. for (i = 0, l = list.length; i < l; i++) {
  10280. name = rawName = list[i].name;
  10281. value = list[i].value;
  10282. if (dirRE.test(name)) {
  10283. // mark element as dynamic
  10284. el.hasBindings = true;
  10285. // modifiers
  10286. modifiers = parseModifiers(name.replace(dirRE, ''));
  10287. // support .foo shorthand syntax for the .prop modifier
  10288. if (modifiers) {
  10289. name = name.replace(modifierRE, '');
  10290. }
  10291. if (bindRE.test(name)) {
  10292. // v-bind
  10293. name = name.replace(bindRE, '');
  10294. value = parseFilters(value);
  10295. isDynamic = dynamicArgRE.test(name);
  10296. if (isDynamic) {
  10297. name = name.slice(1, -1);
  10298. }
  10299. if (process.env.NODE_ENV !== 'production' && value.trim().length === 0) {
  10300. warn("The value for a v-bind expression cannot be empty. Found in \"v-bind:".concat(name, "\""));
  10301. }
  10302. if (modifiers) {
  10303. if (modifiers.prop && !isDynamic) {
  10304. name = camelize(name);
  10305. if (name === 'innerHtml')
  10306. name = 'innerHTML';
  10307. }
  10308. if (modifiers.camel && !isDynamic) {
  10309. name = camelize(name);
  10310. }
  10311. if (modifiers.sync) {
  10312. syncGen = genAssignmentCode(value, "$event");
  10313. if (!isDynamic) {
  10314. addHandler(el, "update:".concat(camelize(name)), syncGen, null, false, warn, list[i]);
  10315. if (hyphenate(name) !== camelize(name)) {
  10316. addHandler(el, "update:".concat(hyphenate(name)), syncGen, null, false, warn, list[i]);
  10317. }
  10318. }
  10319. else {
  10320. // handler w/ dynamic event name
  10321. addHandler(el, "\"update:\"+(".concat(name, ")"), syncGen, null, false, warn, list[i], true // dynamic
  10322. );
  10323. }
  10324. }
  10325. }
  10326. if ((modifiers && modifiers.prop) ||
  10327. (!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name))) {
  10328. addProp(el, name, value, list[i], isDynamic);
  10329. }
  10330. else {
  10331. addAttr(el, name, value, list[i], isDynamic);
  10332. }
  10333. }
  10334. else if (onRE.test(name)) {
  10335. // v-on
  10336. name = name.replace(onRE, '');
  10337. isDynamic = dynamicArgRE.test(name);
  10338. if (isDynamic) {
  10339. name = name.slice(1, -1);
  10340. }
  10341. addHandler(el, name, value, modifiers, false, warn, list[i], isDynamic);
  10342. }
  10343. else {
  10344. // normal directives
  10345. name = name.replace(dirRE, '');
  10346. // parse arg
  10347. var argMatch = name.match(argRE);
  10348. var arg = argMatch && argMatch[1];
  10349. isDynamic = false;
  10350. if (arg) {
  10351. name = name.slice(0, -(arg.length + 1));
  10352. if (dynamicArgRE.test(arg)) {
  10353. arg = arg.slice(1, -1);
  10354. isDynamic = true;
  10355. }
  10356. }
  10357. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  10358. if (process.env.NODE_ENV !== 'production' && name === 'model') {
  10359. checkForAliasModel(el, value);
  10360. }
  10361. }
  10362. }
  10363. else {
  10364. // literal attribute
  10365. if (process.env.NODE_ENV !== 'production') {
  10366. var res = parseText(value, delimiters);
  10367. if (res) {
  10368. warn("".concat(name, "=\"").concat(value, "\": ") +
  10369. 'Interpolation inside attributes has been removed. ' +
  10370. 'Use v-bind or the colon shorthand instead. For example, ' +
  10371. 'instead of <div id="{{ val }}">, use <div :id="val">.', list[i]);
  10372. }
  10373. }
  10374. addAttr(el, name, JSON.stringify(value), list[i]);
  10375. // #6887 firefox doesn't update muted state if set via attribute
  10376. // even immediately after element creation
  10377. if (!el.component &&
  10378. name === 'muted' &&
  10379. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  10380. addProp(el, name, 'true', list[i]);
  10381. }
  10382. }
  10383. }
  10384. }
  10385. function checkInFor(el) {
  10386. var parent = el;
  10387. while (parent) {
  10388. if (parent.for !== undefined) {
  10389. return true;
  10390. }
  10391. parent = parent.parent;
  10392. }
  10393. return false;
  10394. }
  10395. function parseModifiers(name) {
  10396. var match = name.match(modifierRE);
  10397. if (match) {
  10398. var ret_1 = {};
  10399. match.forEach(function (m) {
  10400. ret_1[m.slice(1)] = true;
  10401. });
  10402. return ret_1;
  10403. }
  10404. }
  10405. function makeAttrsMap(attrs) {
  10406. var map = {};
  10407. for (var i = 0, l = attrs.length; i < l; i++) {
  10408. if (process.env.NODE_ENV !== 'production' && map[attrs[i].name] && !isIE && !isEdge) {
  10409. warn('duplicate attribute: ' + attrs[i].name, attrs[i]);
  10410. }
  10411. map[attrs[i].name] = attrs[i].value;
  10412. }
  10413. return map;
  10414. }
  10415. // for script (e.g. type="x/template") or style, do not decode content
  10416. function isTextTag(el) {
  10417. return el.tag === 'script' || el.tag === 'style';
  10418. }
  10419. function isForbiddenTag(el) {
  10420. return (el.tag === 'style' ||
  10421. (el.tag === 'script' &&
  10422. (!el.attrsMap.type || el.attrsMap.type === 'text/javascript')));
  10423. }
  10424. var ieNSBug = /^xmlns:NS\d+/;
  10425. var ieNSPrefix = /^NS\d+:/;
  10426. /* istanbul ignore next */
  10427. function guardIESVGBug(attrs) {
  10428. var res = [];
  10429. for (var i = 0; i < attrs.length; i++) {
  10430. var attr = attrs[i];
  10431. if (!ieNSBug.test(attr.name)) {
  10432. attr.name = attr.name.replace(ieNSPrefix, '');
  10433. res.push(attr);
  10434. }
  10435. }
  10436. return res;
  10437. }
  10438. function checkForAliasModel(el, value) {
  10439. var _el = el;
  10440. while (_el) {
  10441. if (_el.for && _el.alias === value) {
  10442. warn("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
  10443. "You are binding v-model directly to a v-for iteration alias. " +
  10444. "This will not be able to modify the v-for source array because " +
  10445. "writing to the alias is like modifying a function local variable. " +
  10446. "Consider using an array of objects and use v-model on an object property instead.", el.rawAttrsMap['v-model']);
  10447. }
  10448. _el = _el.parent;
  10449. }
  10450. }
  10451. /**
  10452. * Expand input[v-model] with dynamic type bindings into v-if-else chains
  10453. * Turn this:
  10454. * <input v-model="data[type]" :type="type">
  10455. * into this:
  10456. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  10457. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  10458. * <input v-else :type="type" v-model="data[type]">
  10459. */
  10460. function preTransformNode(el, options) {
  10461. if (el.tag === 'input') {
  10462. var map = el.attrsMap;
  10463. if (!map['v-model']) {
  10464. return;
  10465. }
  10466. var typeBinding = void 0;
  10467. if (map[':type'] || map['v-bind:type']) {
  10468. typeBinding = getBindingAttr(el, 'type');
  10469. }
  10470. if (!map.type && !typeBinding && map['v-bind']) {
  10471. typeBinding = "(".concat(map['v-bind'], ").type");
  10472. }
  10473. if (typeBinding) {
  10474. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  10475. var ifConditionExtra = ifCondition ? "&&(".concat(ifCondition, ")") : "";
  10476. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  10477. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  10478. // 1. checkbox
  10479. var branch0 = cloneASTElement(el);
  10480. // process for on the main node
  10481. processFor(branch0);
  10482. addRawAttr(branch0, 'type', 'checkbox');
  10483. processElement(branch0, options);
  10484. branch0.processed = true; // prevent it from double-processed
  10485. branch0.if = "(".concat(typeBinding, ")==='checkbox'") + ifConditionExtra;
  10486. addIfCondition(branch0, {
  10487. exp: branch0.if,
  10488. block: branch0
  10489. });
  10490. // 2. add radio else-if condition
  10491. var branch1 = cloneASTElement(el);
  10492. getAndRemoveAttr(branch1, 'v-for', true);
  10493. addRawAttr(branch1, 'type', 'radio');
  10494. processElement(branch1, options);
  10495. addIfCondition(branch0, {
  10496. exp: "(".concat(typeBinding, ")==='radio'") + ifConditionExtra,
  10497. block: branch1
  10498. });
  10499. // 3. other
  10500. var branch2 = cloneASTElement(el);
  10501. getAndRemoveAttr(branch2, 'v-for', true);
  10502. addRawAttr(branch2, ':type', typeBinding);
  10503. processElement(branch2, options);
  10504. addIfCondition(branch0, {
  10505. exp: ifCondition,
  10506. block: branch2
  10507. });
  10508. if (hasElse) {
  10509. branch0.else = true;
  10510. }
  10511. else if (elseIfCondition) {
  10512. branch0.elseif = elseIfCondition;
  10513. }
  10514. return branch0;
  10515. }
  10516. }
  10517. }
  10518. function cloneASTElement(el) {
  10519. return createASTElement(el.tag, el.attrsList.slice(), el.parent);
  10520. }
  10521. var model = {
  10522. preTransformNode: preTransformNode
  10523. };
  10524. var modules = [klass, style, model];
  10525. function text(el, dir) {
  10526. if (dir.value) {
  10527. addProp(el, 'textContent', "_s(".concat(dir.value, ")"), dir);
  10528. }
  10529. }
  10530. function html(el, dir) {
  10531. if (dir.value) {
  10532. addProp(el, 'innerHTML', "_s(".concat(dir.value, ")"), dir);
  10533. }
  10534. }
  10535. var directives = {
  10536. model: model$1,
  10537. text: text,
  10538. html: html
  10539. };
  10540. var baseOptions = {
  10541. expectHTML: true,
  10542. modules: modules,
  10543. directives: directives,
  10544. isPreTag: isPreTag,
  10545. isUnaryTag: isUnaryTag,
  10546. mustUseProp: mustUseProp,
  10547. canBeLeftOpenTag: canBeLeftOpenTag,
  10548. isReservedTag: isReservedTag,
  10549. getTagNamespace: getTagNamespace,
  10550. staticKeys: genStaticKeys$1(modules)
  10551. };
  10552. var isStaticKey;
  10553. var isPlatformReservedTag;
  10554. var genStaticKeysCached = cached(genStaticKeys);
  10555. /**
  10556. * Goal of the optimizer: walk the generated template AST tree
  10557. * and detect sub-trees that are purely static, i.e. parts of
  10558. * the DOM that never needs to change.
  10559. *
  10560. * Once we detect these sub-trees, we can:
  10561. *
  10562. * 1. Hoist them into constants, so that we no longer need to
  10563. * create fresh nodes for them on each re-render;
  10564. * 2. Completely skip them in the patching process.
  10565. */
  10566. function optimize(root, options) {
  10567. if (!root)
  10568. return;
  10569. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  10570. isPlatformReservedTag = options.isReservedTag || no;
  10571. // first pass: mark all non-static nodes.
  10572. markStatic(root);
  10573. // second pass: mark static roots.
  10574. markStaticRoots(root, false);
  10575. }
  10576. function genStaticKeys(keys) {
  10577. return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  10578. (keys ? ',' + keys : ''));
  10579. }
  10580. function markStatic(node) {
  10581. node.static = isStatic(node);
  10582. if (node.type === 1) {
  10583. // do not make component slot content static. this avoids
  10584. // 1. components not able to mutate slot nodes
  10585. // 2. static slot content fails for hot-reloading
  10586. if (!isPlatformReservedTag(node.tag) &&
  10587. node.tag !== 'slot' &&
  10588. node.attrsMap['inline-template'] == null) {
  10589. return;
  10590. }
  10591. for (var i = 0, l = node.children.length; i < l; i++) {
  10592. var child = node.children[i];
  10593. markStatic(child);
  10594. if (!child.static) {
  10595. node.static = false;
  10596. }
  10597. }
  10598. if (node.ifConditions) {
  10599. for (var i = 1, l = node.ifConditions.length; i < l; i++) {
  10600. var block = node.ifConditions[i].block;
  10601. markStatic(block);
  10602. if (!block.static) {
  10603. node.static = false;
  10604. }
  10605. }
  10606. }
  10607. }
  10608. }
  10609. function markStaticRoots(node, isInFor) {
  10610. if (node.type === 1) {
  10611. if (node.static || node.once) {
  10612. node.staticInFor = isInFor;
  10613. }
  10614. // For a node to qualify as a static root, it should have children that
  10615. // are not just static text. Otherwise the cost of hoisting out will
  10616. // outweigh the benefits and it's better off to just always render it fresh.
  10617. if (node.static &&
  10618. node.children.length &&
  10619. !(node.children.length === 1 && node.children[0].type === 3)) {
  10620. node.staticRoot = true;
  10621. return;
  10622. }
  10623. else {
  10624. node.staticRoot = false;
  10625. }
  10626. if (node.children) {
  10627. for (var i = 0, l = node.children.length; i < l; i++) {
  10628. markStaticRoots(node.children[i], isInFor || !!node.for);
  10629. }
  10630. }
  10631. if (node.ifConditions) {
  10632. for (var i = 1, l = node.ifConditions.length; i < l; i++) {
  10633. markStaticRoots(node.ifConditions[i].block, isInFor);
  10634. }
  10635. }
  10636. }
  10637. }
  10638. function isStatic(node) {
  10639. if (node.type === 2) {
  10640. // expression
  10641. return false;
  10642. }
  10643. if (node.type === 3) {
  10644. // text
  10645. return true;
  10646. }
  10647. return !!(node.pre ||
  10648. (!node.hasBindings && // no dynamic bindings
  10649. !node.if &&
  10650. !node.for && // not v-if or v-for or v-else
  10651. !isBuiltInTag(node.tag) && // not a built-in
  10652. isPlatformReservedTag(node.tag) && // not a component
  10653. !isDirectChildOfTemplateFor(node) &&
  10654. Object.keys(node).every(isStaticKey)));
  10655. }
  10656. function isDirectChildOfTemplateFor(node) {
  10657. while (node.parent) {
  10658. node = node.parent;
  10659. if (node.tag !== 'template') {
  10660. return false;
  10661. }
  10662. if (node.for) {
  10663. return true;
  10664. }
  10665. }
  10666. return false;
  10667. }
  10668. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  10669. var fnInvokeRE = /\([^)]*?\);*$/;
  10670. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  10671. // KeyboardEvent.keyCode aliases
  10672. var keyCodes = {
  10673. esc: 27,
  10674. tab: 9,
  10675. enter: 13,
  10676. space: 32,
  10677. up: 38,
  10678. left: 37,
  10679. right: 39,
  10680. down: 40,
  10681. delete: [8, 46]
  10682. };
  10683. // KeyboardEvent.key aliases
  10684. var keyNames = {
  10685. // #7880: IE11 and Edge use `Esc` for Escape key name.
  10686. esc: ['Esc', 'Escape'],
  10687. tab: 'Tab',
  10688. enter: 'Enter',
  10689. // #9112: IE11 uses `Spacebar` for Space key name.
  10690. space: [' ', 'Spacebar'],
  10691. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  10692. up: ['Up', 'ArrowUp'],
  10693. left: ['Left', 'ArrowLeft'],
  10694. right: ['Right', 'ArrowRight'],
  10695. down: ['Down', 'ArrowDown'],
  10696. // #9112: IE11 uses `Del` for Delete key name.
  10697. delete: ['Backspace', 'Delete', 'Del']
  10698. };
  10699. // #4868: modifiers that prevent the execution of the listener
  10700. // need to explicitly return null so that we can determine whether to remove
  10701. // the listener for .once
  10702. var genGuard = function (condition) { return "if(".concat(condition, ")return null;"); };
  10703. var modifierCode = {
  10704. stop: '$event.stopPropagation();',
  10705. prevent: '$event.preventDefault();',
  10706. self: genGuard("$event.target !== $event.currentTarget"),
  10707. ctrl: genGuard("!$event.ctrlKey"),
  10708. shift: genGuard("!$event.shiftKey"),
  10709. alt: genGuard("!$event.altKey"),
  10710. meta: genGuard("!$event.metaKey"),
  10711. left: genGuard("'button' in $event && $event.button !== 0"),
  10712. middle: genGuard("'button' in $event && $event.button !== 1"),
  10713. right: genGuard("'button' in $event && $event.button !== 2")
  10714. };
  10715. function genHandlers(events, isNative) {
  10716. var prefix = isNative ? 'nativeOn:' : 'on:';
  10717. var staticHandlers = "";
  10718. var dynamicHandlers = "";
  10719. for (var name_1 in events) {
  10720. var handlerCode = genHandler(events[name_1]);
  10721. //@ts-expect-error
  10722. if (events[name_1] && events[name_1].dynamic) {
  10723. dynamicHandlers += "".concat(name_1, ",").concat(handlerCode, ",");
  10724. }
  10725. else {
  10726. staticHandlers += "\"".concat(name_1, "\":").concat(handlerCode, ",");
  10727. }
  10728. }
  10729. staticHandlers = "{".concat(staticHandlers.slice(0, -1), "}");
  10730. if (dynamicHandlers) {
  10731. return prefix + "_d(".concat(staticHandlers, ",[").concat(dynamicHandlers.slice(0, -1), "])");
  10732. }
  10733. else {
  10734. return prefix + staticHandlers;
  10735. }
  10736. }
  10737. function genHandler(handler) {
  10738. if (!handler) {
  10739. return 'function(){}';
  10740. }
  10741. if (Array.isArray(handler)) {
  10742. return "[".concat(handler.map(function (handler) { return genHandler(handler); }).join(','), "]");
  10743. }
  10744. var isMethodPath = simplePathRE.test(handler.value);
  10745. var isFunctionExpression = fnExpRE.test(handler.value);
  10746. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  10747. if (!handler.modifiers) {
  10748. if (isMethodPath || isFunctionExpression) {
  10749. return handler.value;
  10750. }
  10751. return "function($event){".concat(isFunctionInvocation ? "return ".concat(handler.value) : handler.value, "}"); // inline statement
  10752. }
  10753. else {
  10754. var code = '';
  10755. var genModifierCode = '';
  10756. var keys = [];
  10757. var _loop_1 = function (key) {
  10758. if (modifierCode[key]) {
  10759. genModifierCode += modifierCode[key];
  10760. // left/right
  10761. if (keyCodes[key]) {
  10762. keys.push(key);
  10763. }
  10764. }
  10765. else if (key === 'exact') {
  10766. var modifiers_1 = handler.modifiers;
  10767. genModifierCode += genGuard(['ctrl', 'shift', 'alt', 'meta']
  10768. .filter(function (keyModifier) { return !modifiers_1[keyModifier]; })
  10769. .map(function (keyModifier) { return "$event.".concat(keyModifier, "Key"); })
  10770. .join('||'));
  10771. }
  10772. else {
  10773. keys.push(key);
  10774. }
  10775. };
  10776. for (var key in handler.modifiers) {
  10777. _loop_1(key);
  10778. }
  10779. if (keys.length) {
  10780. code += genKeyFilter(keys);
  10781. }
  10782. // Make sure modifiers like prevent and stop get executed after key filtering
  10783. if (genModifierCode) {
  10784. code += genModifierCode;
  10785. }
  10786. var handlerCode = isMethodPath
  10787. ? "return ".concat(handler.value, ".apply(null, arguments)")
  10788. : isFunctionExpression
  10789. ? "return (".concat(handler.value, ").apply(null, arguments)")
  10790. : isFunctionInvocation
  10791. ? "return ".concat(handler.value)
  10792. : handler.value;
  10793. return "function($event){".concat(code).concat(handlerCode, "}");
  10794. }
  10795. }
  10796. function genKeyFilter(keys) {
  10797. return (
  10798. // make sure the key filters only apply to KeyboardEvents
  10799. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  10800. // key events that do not have keyCode property...
  10801. "if(!$event.type.indexOf('key')&&" +
  10802. "".concat(keys.map(genFilterCode).join('&&'), ")return null;"));
  10803. }
  10804. function genFilterCode(key) {
  10805. var keyVal = parseInt(key, 10);
  10806. if (keyVal) {
  10807. return "$event.keyCode!==".concat(keyVal);
  10808. }
  10809. var keyCode = keyCodes[key];
  10810. var keyName = keyNames[key];
  10811. return ("_k($event.keyCode," +
  10812. "".concat(JSON.stringify(key), ",") +
  10813. "".concat(JSON.stringify(keyCode), ",") +
  10814. "$event.key," +
  10815. "".concat(JSON.stringify(keyName)) +
  10816. ")");
  10817. }
  10818. function on(el, dir) {
  10819. if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
  10820. warn$2("v-on without argument does not support modifiers.");
  10821. }
  10822. el.wrapListeners = function (code) { return "_g(".concat(code, ",").concat(dir.value, ")"); };
  10823. }
  10824. function bind(el, dir) {
  10825. el.wrapData = function (code) {
  10826. return "_b(".concat(code, ",'").concat(el.tag, "',").concat(dir.value, ",").concat(dir.modifiers && dir.modifiers.prop ? 'true' : 'false').concat(dir.modifiers && dir.modifiers.sync ? ',true' : '', ")");
  10827. };
  10828. }
  10829. var baseDirectives = {
  10830. on: on,
  10831. bind: bind,
  10832. cloak: noop
  10833. };
  10834. var CodegenState = /** @class */ (function () {
  10835. function CodegenState(options) {
  10836. this.options = options;
  10837. this.warn = options.warn || baseWarn;
  10838. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  10839. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  10840. this.directives = extend(extend({}, baseDirectives), options.directives);
  10841. var isReservedTag = options.isReservedTag || no;
  10842. this.maybeComponent = function (el) {
  10843. return !!el.component || !isReservedTag(el.tag);
  10844. };
  10845. this.onceId = 0;
  10846. this.staticRenderFns = [];
  10847. this.pre = false;
  10848. }
  10849. return CodegenState;
  10850. }());
  10851. function generate(ast, options) {
  10852. var state = new CodegenState(options);
  10853. // fix #11483, Root level <script> tags should not be rendered.
  10854. var code = ast
  10855. ? ast.tag === 'script'
  10856. ? 'null'
  10857. : genElement(ast, state)
  10858. : '_c("div")';
  10859. return {
  10860. render: "with(this){return ".concat(code, "}"),
  10861. staticRenderFns: state.staticRenderFns
  10862. };
  10863. }
  10864. function genElement(el, state) {
  10865. if (el.parent) {
  10866. el.pre = el.pre || el.parent.pre;
  10867. }
  10868. if (el.staticRoot && !el.staticProcessed) {
  10869. return genStatic(el, state);
  10870. }
  10871. else if (el.once && !el.onceProcessed) {
  10872. return genOnce(el, state);
  10873. }
  10874. else if (el.for && !el.forProcessed) {
  10875. return genFor(el, state);
  10876. }
  10877. else if (el.if && !el.ifProcessed) {
  10878. return genIf(el, state);
  10879. }
  10880. else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  10881. return genChildren(el, state) || 'void 0';
  10882. }
  10883. else if (el.tag === 'slot') {
  10884. return genSlot(el, state);
  10885. }
  10886. else {
  10887. // component or element
  10888. var code = void 0;
  10889. if (el.component) {
  10890. code = genComponent(el.component, el, state);
  10891. }
  10892. else {
  10893. var data = void 0;
  10894. var maybeComponent = state.maybeComponent(el);
  10895. if (!el.plain || (el.pre && maybeComponent)) {
  10896. data = genData(el, state);
  10897. }
  10898. var tag
  10899. // check if this is a component in <script setup>
  10900. = void 0;
  10901. // check if this is a component in <script setup>
  10902. var bindings = state.options.bindings;
  10903. if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
  10904. tag = checkBindingType(bindings, el.tag);
  10905. }
  10906. if (!tag)
  10907. tag = "'".concat(el.tag, "'");
  10908. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10909. code = "_c(".concat(tag).concat(data ? ",".concat(data) : '' // data
  10910. ).concat(children ? ",".concat(children) : '' // children
  10911. , ")");
  10912. }
  10913. // module transforms
  10914. for (var i = 0; i < state.transforms.length; i++) {
  10915. code = state.transforms[i](el, code);
  10916. }
  10917. return code;
  10918. }
  10919. }
  10920. function checkBindingType(bindings, key) {
  10921. var camelName = camelize(key);
  10922. var PascalName = capitalize(camelName);
  10923. var checkType = function (type) {
  10924. if (bindings[key] === type) {
  10925. return key;
  10926. }
  10927. if (bindings[camelName] === type) {
  10928. return camelName;
  10929. }
  10930. if (bindings[PascalName] === type) {
  10931. return PascalName;
  10932. }
  10933. };
  10934. var fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
  10935. checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
  10936. if (fromConst) {
  10937. return fromConst;
  10938. }
  10939. var fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
  10940. checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
  10941. checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
  10942. if (fromMaybeRef) {
  10943. return fromMaybeRef;
  10944. }
  10945. }
  10946. // hoist static sub-trees out
  10947. function genStatic(el, state) {
  10948. el.staticProcessed = true;
  10949. // Some elements (templates) need to behave differently inside of a v-pre
  10950. // node. All pre nodes are static roots, so we can use this as a location to
  10951. // wrap a state change and reset it upon exiting the pre node.
  10952. var originalPreState = state.pre;
  10953. if (el.pre) {
  10954. state.pre = el.pre;
  10955. }
  10956. state.staticRenderFns.push("with(this){return ".concat(genElement(el, state), "}"));
  10957. state.pre = originalPreState;
  10958. return "_m(".concat(state.staticRenderFns.length - 1).concat(el.staticInFor ? ',true' : '', ")");
  10959. }
  10960. // v-once
  10961. function genOnce(el, state) {
  10962. el.onceProcessed = true;
  10963. if (el.if && !el.ifProcessed) {
  10964. return genIf(el, state);
  10965. }
  10966. else if (el.staticInFor) {
  10967. var key = '';
  10968. var parent_1 = el.parent;
  10969. while (parent_1) {
  10970. if (parent_1.for) {
  10971. key = parent_1.key;
  10972. break;
  10973. }
  10974. parent_1 = parent_1.parent;
  10975. }
  10976. if (!key) {
  10977. process.env.NODE_ENV !== 'production' &&
  10978. state.warn("v-once can only be used inside v-for that is keyed. ", el.rawAttrsMap['v-once']);
  10979. return genElement(el, state);
  10980. }
  10981. return "_o(".concat(genElement(el, state), ",").concat(state.onceId++, ",").concat(key, ")");
  10982. }
  10983. else {
  10984. return genStatic(el, state);
  10985. }
  10986. }
  10987. function genIf(el, state, altGen, altEmpty) {
  10988. el.ifProcessed = true; // avoid recursion
  10989. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty);
  10990. }
  10991. function genIfConditions(conditions, state, altGen, altEmpty) {
  10992. if (!conditions.length) {
  10993. return altEmpty || '_e()';
  10994. }
  10995. var condition = conditions.shift();
  10996. if (condition.exp) {
  10997. return "(".concat(condition.exp, ")?").concat(genTernaryExp(condition.block), ":").concat(genIfConditions(conditions, state, altGen, altEmpty));
  10998. }
  10999. else {
  11000. return "".concat(genTernaryExp(condition.block));
  11001. }
  11002. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  11003. function genTernaryExp(el) {
  11004. return altGen
  11005. ? altGen(el, state)
  11006. : el.once
  11007. ? genOnce(el, state)
  11008. : genElement(el, state);
  11009. }
  11010. }
  11011. function genFor(el, state, altGen, altHelper) {
  11012. var exp = el.for;
  11013. var alias = el.alias;
  11014. var iterator1 = el.iterator1 ? ",".concat(el.iterator1) : '';
  11015. var iterator2 = el.iterator2 ? ",".concat(el.iterator2) : '';
  11016. if (process.env.NODE_ENV !== 'production' &&
  11017. state.maybeComponent(el) &&
  11018. el.tag !== 'slot' &&
  11019. el.tag !== 'template' &&
  11020. !el.key) {
  11021. state.warn("<".concat(el.tag, " v-for=\"").concat(alias, " in ").concat(exp, "\">: component lists rendered with ") +
  11022. "v-for should have explicit keys. " +
  11023. "See https://v2.vuejs.org/v2/guide/list.html#key for more info.", el.rawAttrsMap['v-for'], true /* tip */);
  11024. }
  11025. el.forProcessed = true; // avoid recursion
  11026. return ("".concat(altHelper || '_l', "((").concat(exp, "),") +
  11027. "function(".concat(alias).concat(iterator1).concat(iterator2, "){") +
  11028. "return ".concat((altGen || genElement)(el, state)) +
  11029. '})');
  11030. }
  11031. function genData(el, state) {
  11032. var data = '{';
  11033. // directives first.
  11034. // directives may mutate the el's other properties before they are generated.
  11035. var dirs = genDirectives(el, state);
  11036. if (dirs)
  11037. data += dirs + ',';
  11038. // key
  11039. if (el.key) {
  11040. data += "key:".concat(el.key, ",");
  11041. }
  11042. // ref
  11043. if (el.ref) {
  11044. data += "ref:".concat(el.ref, ",");
  11045. }
  11046. if (el.refInFor) {
  11047. data += "refInFor:true,";
  11048. }
  11049. // pre
  11050. if (el.pre) {
  11051. data += "pre:true,";
  11052. }
  11053. // record original tag name for components using "is" attribute
  11054. if (el.component) {
  11055. data += "tag:\"".concat(el.tag, "\",");
  11056. }
  11057. // module data generation functions
  11058. for (var i = 0; i < state.dataGenFns.length; i++) {
  11059. data += state.dataGenFns[i](el);
  11060. }
  11061. // attributes
  11062. if (el.attrs) {
  11063. data += "attrs:".concat(genProps(el.attrs), ",");
  11064. }
  11065. // DOM props
  11066. if (el.props) {
  11067. data += "domProps:".concat(genProps(el.props), ",");
  11068. }
  11069. // event handlers
  11070. if (el.events) {
  11071. data += "".concat(genHandlers(el.events, false), ",");
  11072. }
  11073. if (el.nativeEvents) {
  11074. data += "".concat(genHandlers(el.nativeEvents, true), ",");
  11075. }
  11076. // slot target
  11077. // only for non-scoped slots
  11078. if (el.slotTarget && !el.slotScope) {
  11079. data += "slot:".concat(el.slotTarget, ",");
  11080. }
  11081. // scoped slots
  11082. if (el.scopedSlots) {
  11083. data += "".concat(genScopedSlots(el, el.scopedSlots, state), ",");
  11084. }
  11085. // component v-model
  11086. if (el.model) {
  11087. data += "model:{value:".concat(el.model.value, ",callback:").concat(el.model.callback, ",expression:").concat(el.model.expression, "},");
  11088. }
  11089. // inline-template
  11090. if (el.inlineTemplate) {
  11091. var inlineTemplate = genInlineTemplate(el, state);
  11092. if (inlineTemplate) {
  11093. data += "".concat(inlineTemplate, ",");
  11094. }
  11095. }
  11096. data = data.replace(/,$/, '') + '}';
  11097. // v-bind dynamic argument wrap
  11098. // v-bind with dynamic arguments must be applied using the same v-bind object
  11099. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  11100. if (el.dynamicAttrs) {
  11101. data = "_b(".concat(data, ",\"").concat(el.tag, "\",").concat(genProps(el.dynamicAttrs), ")");
  11102. }
  11103. // v-bind data wrap
  11104. if (el.wrapData) {
  11105. data = el.wrapData(data);
  11106. }
  11107. // v-on data wrap
  11108. if (el.wrapListeners) {
  11109. data = el.wrapListeners(data);
  11110. }
  11111. return data;
  11112. }
  11113. function genDirectives(el, state) {
  11114. var dirs = el.directives;
  11115. if (!dirs)
  11116. return;
  11117. var res = 'directives:[';
  11118. var hasRuntime = false;
  11119. var i, l, dir, needRuntime;
  11120. for (i = 0, l = dirs.length; i < l; i++) {
  11121. dir = dirs[i];
  11122. needRuntime = true;
  11123. var gen = state.directives[dir.name];
  11124. if (gen) {
  11125. // compile-time directive that manipulates AST.
  11126. // returns true if it also needs a runtime counterpart.
  11127. needRuntime = !!gen(el, dir, state.warn);
  11128. }
  11129. if (needRuntime) {
  11130. hasRuntime = true;
  11131. res += "{name:\"".concat(dir.name, "\",rawName:\"").concat(dir.rawName, "\"").concat(dir.value
  11132. ? ",value:(".concat(dir.value, "),expression:").concat(JSON.stringify(dir.value))
  11133. : '').concat(dir.arg ? ",arg:".concat(dir.isDynamicArg ? dir.arg : "\"".concat(dir.arg, "\"")) : '').concat(dir.modifiers ? ",modifiers:".concat(JSON.stringify(dir.modifiers)) : '', "},");
  11134. }
  11135. }
  11136. if (hasRuntime) {
  11137. return res.slice(0, -1) + ']';
  11138. }
  11139. }
  11140. function genInlineTemplate(el, state) {
  11141. var ast = el.children[0];
  11142. if (process.env.NODE_ENV !== 'production' && (el.children.length !== 1 || ast.type !== 1)) {
  11143. state.warn('Inline-template components must have exactly one child element.', { start: el.start });
  11144. }
  11145. if (ast && ast.type === 1) {
  11146. var inlineRenderFns = generate(ast, state.options);
  11147. return "inlineTemplate:{render:function(){".concat(inlineRenderFns.render, "},staticRenderFns:[").concat(inlineRenderFns.staticRenderFns
  11148. .map(function (code) { return "function(){".concat(code, "}"); })
  11149. .join(','), "]}");
  11150. }
  11151. }
  11152. function genScopedSlots(el, slots, state) {
  11153. // by default scoped slots are considered "stable", this allows child
  11154. // components with only scoped slots to skip forced updates from parent.
  11155. // but in some cases we have to bail-out of this optimization
  11156. // for example if the slot contains dynamic names, has v-if or v-for on them...
  11157. var needsForceUpdate = el.for ||
  11158. Object.keys(slots).some(function (key) {
  11159. var slot = slots[key];
  11160. return (slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  11161. );
  11162. });
  11163. // #9534: if a component with scoped slots is inside a conditional branch,
  11164. // it's possible for the same component to be reused but with different
  11165. // compiled slot content. To avoid that, we generate a unique key based on
  11166. // the generated code of all the slot contents.
  11167. var needsKey = !!el.if;
  11168. // OR when it is inside another scoped slot or v-for (the reactivity may be
  11169. // disconnected due to the intermediate scope variable)
  11170. // #9438, #9506
  11171. // TODO: this can be further optimized by properly analyzing in-scope bindings
  11172. // and skip force updating ones that do not actually use scope variables.
  11173. if (!needsForceUpdate) {
  11174. var parent_2 = el.parent;
  11175. while (parent_2) {
  11176. if ((parent_2.slotScope && parent_2.slotScope !== emptySlotScopeToken) ||
  11177. parent_2.for) {
  11178. needsForceUpdate = true;
  11179. break;
  11180. }
  11181. if (parent_2.if) {
  11182. needsKey = true;
  11183. }
  11184. parent_2 = parent_2.parent;
  11185. }
  11186. }
  11187. var generatedSlots = Object.keys(slots)
  11188. .map(function (key) { return genScopedSlot(slots[key], state); })
  11189. .join(',');
  11190. return "scopedSlots:_u([".concat(generatedSlots, "]").concat(needsForceUpdate ? ",null,true" : "").concat(!needsForceUpdate && needsKey ? ",null,false,".concat(hash(generatedSlots)) : "", ")");
  11191. }
  11192. function hash(str) {
  11193. var hash = 5381;
  11194. var i = str.length;
  11195. while (i) {
  11196. hash = (hash * 33) ^ str.charCodeAt(--i);
  11197. }
  11198. return hash >>> 0;
  11199. }
  11200. function containsSlotChild(el) {
  11201. if (el.type === 1) {
  11202. if (el.tag === 'slot') {
  11203. return true;
  11204. }
  11205. return el.children.some(containsSlotChild);
  11206. }
  11207. return false;
  11208. }
  11209. function genScopedSlot(el, state) {
  11210. var isLegacySyntax = el.attrsMap['slot-scope'];
  11211. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  11212. return genIf(el, state, genScopedSlot, "null");
  11213. }
  11214. if (el.for && !el.forProcessed) {
  11215. return genFor(el, state, genScopedSlot);
  11216. }
  11217. var slotScope = el.slotScope === emptySlotScopeToken ? "" : String(el.slotScope);
  11218. var fn = "function(".concat(slotScope, "){") +
  11219. "return ".concat(el.tag === 'template'
  11220. ? el.if && isLegacySyntax
  11221. ? "(".concat(el.if, ")?").concat(genChildren(el, state) || 'undefined', ":undefined")
  11222. : genChildren(el, state) || 'undefined'
  11223. : genElement(el, state), "}");
  11224. // reverse proxy v-slot without scope on this.$slots
  11225. var reverseProxy = slotScope ? "" : ",proxy:true";
  11226. return "{key:".concat(el.slotTarget || "\"default\"", ",fn:").concat(fn).concat(reverseProxy, "}");
  11227. }
  11228. function genChildren(el, state, checkSkip, altGenElement, altGenNode) {
  11229. var children = el.children;
  11230. if (children.length) {
  11231. var el_1 = children[0];
  11232. // optimize single v-for
  11233. if (children.length === 1 &&
  11234. el_1.for &&
  11235. el_1.tag !== 'template' &&
  11236. el_1.tag !== 'slot') {
  11237. var normalizationType_1 = checkSkip
  11238. ? state.maybeComponent(el_1)
  11239. ? ",1"
  11240. : ",0"
  11241. : "";
  11242. return "".concat((altGenElement || genElement)(el_1, state)).concat(normalizationType_1);
  11243. }
  11244. var normalizationType = checkSkip
  11245. ? getNormalizationType(children, state.maybeComponent)
  11246. : 0;
  11247. var gen_1 = altGenNode || genNode;
  11248. return "[".concat(children.map(function (c) { return gen_1(c, state); }).join(','), "]").concat(normalizationType ? ",".concat(normalizationType) : '');
  11249. }
  11250. }
  11251. // determine the normalization needed for the children array.
  11252. // 0: no normalization needed
  11253. // 1: simple normalization needed (possible 1-level deep nested array)
  11254. // 2: full normalization needed
  11255. function getNormalizationType(children, maybeComponent) {
  11256. var res = 0;
  11257. for (var i = 0; i < children.length; i++) {
  11258. var el = children[i];
  11259. if (el.type !== 1) {
  11260. continue;
  11261. }
  11262. if (needsNormalization(el) ||
  11263. (el.ifConditions &&
  11264. el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  11265. res = 2;
  11266. break;
  11267. }
  11268. if (maybeComponent(el) ||
  11269. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  11270. res = 1;
  11271. }
  11272. }
  11273. return res;
  11274. }
  11275. function needsNormalization(el) {
  11276. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot';
  11277. }
  11278. function genNode(node, state) {
  11279. if (node.type === 1) {
  11280. return genElement(node, state);
  11281. }
  11282. else if (node.type === 3 && node.isComment) {
  11283. return genComment(node);
  11284. }
  11285. else {
  11286. return genText(node);
  11287. }
  11288. }
  11289. function genText(text) {
  11290. return "_v(".concat(text.type === 2
  11291. ? text.expression // no need for () because already wrapped in _s()
  11292. : transformSpecialNewlines(JSON.stringify(text.text)), ")");
  11293. }
  11294. function genComment(comment) {
  11295. return "_e(".concat(JSON.stringify(comment.text), ")");
  11296. }
  11297. function genSlot(el, state) {
  11298. var slotName = el.slotName || '"default"';
  11299. var children = genChildren(el, state);
  11300. var res = "_t(".concat(slotName).concat(children ? ",function(){return ".concat(children, "}") : '');
  11301. var attrs = el.attrs || el.dynamicAttrs
  11302. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  11303. // slot props are camelized
  11304. name: camelize(attr.name),
  11305. value: attr.value,
  11306. dynamic: attr.dynamic
  11307. }); }))
  11308. : null;
  11309. var bind = el.attrsMap['v-bind'];
  11310. if ((attrs || bind) && !children) {
  11311. res += ",null";
  11312. }
  11313. if (attrs) {
  11314. res += ",".concat(attrs);
  11315. }
  11316. if (bind) {
  11317. res += "".concat(attrs ? '' : ',null', ",").concat(bind);
  11318. }
  11319. return res + ')';
  11320. }
  11321. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  11322. function genComponent(componentName, el, state) {
  11323. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  11324. return "_c(".concat(componentName, ",").concat(genData(el, state)).concat(children ? ",".concat(children) : '', ")");
  11325. }
  11326. function genProps(props) {
  11327. var staticProps = "";
  11328. var dynamicProps = "";
  11329. for (var i = 0; i < props.length; i++) {
  11330. var prop = props[i];
  11331. var value = transformSpecialNewlines(prop.value);
  11332. if (prop.dynamic) {
  11333. dynamicProps += "".concat(prop.name, ",").concat(value, ",");
  11334. }
  11335. else {
  11336. staticProps += "\"".concat(prop.name, "\":").concat(value, ",");
  11337. }
  11338. }
  11339. staticProps = "{".concat(staticProps.slice(0, -1), "}");
  11340. if (dynamicProps) {
  11341. return "_d(".concat(staticProps, ",[").concat(dynamicProps.slice(0, -1), "])");
  11342. }
  11343. else {
  11344. return staticProps;
  11345. }
  11346. }
  11347. // #3895, #4268
  11348. function transformSpecialNewlines(text) {
  11349. return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
  11350. }
  11351. // these keywords should not appear inside expressions, but operators like
  11352. // typeof, instanceof and in are allowed
  11353. var prohibitedKeywordRE = new RegExp('\\b' +
  11354. ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  11355. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  11356. 'extends,finally,continue,debugger,function,arguments')
  11357. .split(',')
  11358. .join('\\b|\\b') +
  11359. '\\b');
  11360. // these unary operators should not be used as property/method names
  11361. var unaryOperatorsRE = new RegExp('\\b' +
  11362. 'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') +
  11363. '\\s*\\([^\\)]*\\)');
  11364. // strip strings in expressions
  11365. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  11366. // detect problematic expressions in a template
  11367. function detectErrors(ast, warn) {
  11368. if (ast) {
  11369. checkNode(ast, warn);
  11370. }
  11371. }
  11372. function checkNode(node, warn) {
  11373. if (node.type === 1) {
  11374. for (var name_1 in node.attrsMap) {
  11375. if (dirRE.test(name_1)) {
  11376. var value = node.attrsMap[name_1];
  11377. if (value) {
  11378. var range = node.rawAttrsMap[name_1];
  11379. if (name_1 === 'v-for') {
  11380. checkFor(node, "v-for=\"".concat(value, "\""), warn, range);
  11381. }
  11382. else if (name_1 === 'v-slot' || name_1[0] === '#') {
  11383. checkFunctionParameterExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11384. }
  11385. else if (onRE.test(name_1)) {
  11386. checkEvent(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11387. }
  11388. else {
  11389. checkExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11390. }
  11391. }
  11392. }
  11393. }
  11394. if (node.children) {
  11395. for (var i = 0; i < node.children.length; i++) {
  11396. checkNode(node.children[i], warn);
  11397. }
  11398. }
  11399. }
  11400. else if (node.type === 2) {
  11401. checkExpression(node.expression, node.text, warn, node);
  11402. }
  11403. }
  11404. function checkEvent(exp, text, warn, range) {
  11405. var stripped = exp.replace(stripStringRE, '');
  11406. var keywordMatch = stripped.match(unaryOperatorsRE);
  11407. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  11408. warn("avoid using JavaScript unary operator as property name: " +
  11409. "\"".concat(keywordMatch[0], "\" in expression ").concat(text.trim()), range);
  11410. }
  11411. checkExpression(exp, text, warn, range);
  11412. }
  11413. function checkFor(node, text, warn, range) {
  11414. checkExpression(node.for || '', text, warn, range);
  11415. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  11416. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  11417. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  11418. }
  11419. function checkIdentifier(ident, type, text, warn, range) {
  11420. if (typeof ident === 'string') {
  11421. try {
  11422. new Function("var ".concat(ident, "=_"));
  11423. }
  11424. catch (e) {
  11425. warn("invalid ".concat(type, " \"").concat(ident, "\" in expression: ").concat(text.trim()), range);
  11426. }
  11427. }
  11428. }
  11429. function checkExpression(exp, text, warn, range) {
  11430. try {
  11431. new Function("return ".concat(exp));
  11432. }
  11433. catch (e) {
  11434. var keywordMatch = exp
  11435. .replace(stripStringRE, '')
  11436. .match(prohibitedKeywordRE);
  11437. if (keywordMatch) {
  11438. warn("avoid using JavaScript keyword as property name: " +
  11439. "\"".concat(keywordMatch[0], "\"\n Raw expression: ").concat(text.trim()), range);
  11440. }
  11441. else {
  11442. warn("invalid expression: ".concat(e.message, " in\n\n") +
  11443. " ".concat(exp, "\n\n") +
  11444. " Raw expression: ".concat(text.trim(), "\n"), range);
  11445. }
  11446. }
  11447. }
  11448. function checkFunctionParameterExpression(exp, text, warn, range) {
  11449. try {
  11450. new Function(exp, '');
  11451. }
  11452. catch (e) {
  11453. warn("invalid function parameter expression: ".concat(e.message, " in\n\n") +
  11454. " ".concat(exp, "\n\n") +
  11455. " Raw expression: ".concat(text.trim(), "\n"), range);
  11456. }
  11457. }
  11458. var range = 2;
  11459. function generateCodeFrame(source, start, end) {
  11460. if (start === void 0) { start = 0; }
  11461. if (end === void 0) { end = source.length; }
  11462. var lines = source.split(/\r?\n/);
  11463. var count = 0;
  11464. var res = [];
  11465. for (var i = 0; i < lines.length; i++) {
  11466. count += lines[i].length + 1;
  11467. if (count >= start) {
  11468. for (var j = i - range; j <= i + range || end > count; j++) {
  11469. if (j < 0 || j >= lines.length)
  11470. continue;
  11471. res.push("".concat(j + 1).concat(repeat(" ", 3 - String(j + 1).length), "| ").concat(lines[j]));
  11472. var lineLength = lines[j].length;
  11473. if (j === i) {
  11474. // push underline
  11475. var pad = start - (count - lineLength) + 1;
  11476. var length_1 = end > count ? lineLength - pad : end - start;
  11477. res.push(" | " + repeat(" ", pad) + repeat("^", length_1));
  11478. }
  11479. else if (j > i) {
  11480. if (end > count) {
  11481. var length_2 = Math.min(end - count, lineLength);
  11482. res.push(" | " + repeat("^", length_2));
  11483. }
  11484. count += lineLength + 1;
  11485. }
  11486. }
  11487. break;
  11488. }
  11489. }
  11490. return res.join('\n');
  11491. }
  11492. function repeat(str, n) {
  11493. var result = '';
  11494. if (n > 0) {
  11495. // eslint-disable-next-line no-constant-condition
  11496. while (true) {
  11497. // eslint-disable-line
  11498. if (n & 1)
  11499. result += str;
  11500. n >>>= 1;
  11501. if (n <= 0)
  11502. break;
  11503. str += str;
  11504. }
  11505. }
  11506. return result;
  11507. }
  11508. function createFunction(code, errors) {
  11509. try {
  11510. return new Function(code);
  11511. }
  11512. catch (err) {
  11513. errors.push({ err: err, code: code });
  11514. return noop;
  11515. }
  11516. }
  11517. function createCompileToFunctionFn(compile) {
  11518. var cache = Object.create(null);
  11519. return function compileToFunctions(template, options, vm) {
  11520. options = extend({}, options);
  11521. var warn = options.warn || warn$2;
  11522. delete options.warn;
  11523. /* istanbul ignore if */
  11524. if (process.env.NODE_ENV !== 'production') {
  11525. // detect possible CSP restriction
  11526. try {
  11527. new Function('return 1');
  11528. }
  11529. catch (e) {
  11530. if (e.toString().match(/unsafe-eval|CSP/)) {
  11531. warn('It seems you are using the standalone build of Vue.js in an ' +
  11532. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  11533. 'The template compiler cannot work in this environment. Consider ' +
  11534. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  11535. 'templates into render functions.');
  11536. }
  11537. }
  11538. }
  11539. // check cache
  11540. var key = options.delimiters
  11541. ? String(options.delimiters) + template
  11542. : template;
  11543. if (cache[key]) {
  11544. return cache[key];
  11545. }
  11546. // compile
  11547. var compiled = compile(template, options);
  11548. // check compilation errors/tips
  11549. if (process.env.NODE_ENV !== 'production') {
  11550. if (compiled.errors && compiled.errors.length) {
  11551. if (options.outputSourceRange) {
  11552. compiled.errors.forEach(function (e) {
  11553. warn("Error compiling template:\n\n".concat(e.msg, "\n\n") +
  11554. generateCodeFrame(template, e.start, e.end), vm);
  11555. });
  11556. }
  11557. else {
  11558. warn("Error compiling template:\n\n".concat(template, "\n\n") +
  11559. compiled.errors.map(function (e) { return "- ".concat(e); }).join('\n') +
  11560. '\n', vm);
  11561. }
  11562. }
  11563. if (compiled.tips && compiled.tips.length) {
  11564. if (options.outputSourceRange) {
  11565. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  11566. }
  11567. else {
  11568. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  11569. }
  11570. }
  11571. }
  11572. // turn code into functions
  11573. var res = {};
  11574. var fnGenErrors = [];
  11575. res.render = createFunction(compiled.render, fnGenErrors);
  11576. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  11577. return createFunction(code, fnGenErrors);
  11578. });
  11579. // check function generation errors.
  11580. // this should only happen if there is a bug in the compiler itself.
  11581. // mostly for codegen development use
  11582. /* istanbul ignore if */
  11583. if (process.env.NODE_ENV !== 'production') {
  11584. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  11585. warn("Failed to generate render function:\n\n" +
  11586. fnGenErrors
  11587. .map(function (_a) {
  11588. var err = _a.err, code = _a.code;
  11589. return "".concat(err.toString(), " in\n\n").concat(code, "\n");
  11590. })
  11591. .join('\n'), vm);
  11592. }
  11593. }
  11594. return (cache[key] = res);
  11595. };
  11596. }
  11597. function createCompilerCreator(baseCompile) {
  11598. return function createCompiler(baseOptions) {
  11599. function compile(template, options) {
  11600. var finalOptions = Object.create(baseOptions);
  11601. var errors = [];
  11602. var tips = [];
  11603. var warn = function (msg, range, tip) {
  11604. (tip ? tips : errors).push(msg);
  11605. };
  11606. if (options) {
  11607. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  11608. // $flow-disable-line
  11609. var leadingSpaceLength_1 = template.match(/^\s*/)[0].length;
  11610. warn = function (msg, range, tip) {
  11611. var data = typeof msg === 'string' ? { msg: msg } : msg;
  11612. if (range) {
  11613. if (range.start != null) {
  11614. data.start = range.start + leadingSpaceLength_1;
  11615. }
  11616. if (range.end != null) {
  11617. data.end = range.end + leadingSpaceLength_1;
  11618. }
  11619. }
  11620. (tip ? tips : errors).push(data);
  11621. };
  11622. }
  11623. // merge custom modules
  11624. if (options.modules) {
  11625. finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
  11626. }
  11627. // merge custom directives
  11628. if (options.directives) {
  11629. finalOptions.directives = extend(Object.create(baseOptions.directives || null), options.directives);
  11630. }
  11631. // copy other options
  11632. for (var key in options) {
  11633. if (key !== 'modules' && key !== 'directives') {
  11634. finalOptions[key] = options[key];
  11635. }
  11636. }
  11637. }
  11638. finalOptions.warn = warn;
  11639. var compiled = baseCompile(template.trim(), finalOptions);
  11640. if (process.env.NODE_ENV !== 'production') {
  11641. detectErrors(compiled.ast, warn);
  11642. }
  11643. compiled.errors = errors;
  11644. compiled.tips = tips;
  11645. return compiled;
  11646. }
  11647. return {
  11648. compile: compile,
  11649. compileToFunctions: createCompileToFunctionFn(compile)
  11650. };
  11651. };
  11652. }
  11653. // `createCompilerCreator` allows creating compilers that use alternative
  11654. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  11655. // Here we just export a default compiler using the default parts.
  11656. var createCompiler = createCompilerCreator(function baseCompile(template, options) {
  11657. var ast = parse(template.trim(), options);
  11658. if (options.optimize !== false) {
  11659. optimize(ast, options);
  11660. }
  11661. var code = generate(ast, options);
  11662. return {
  11663. ast: ast,
  11664. render: code.render,
  11665. staticRenderFns: code.staticRenderFns
  11666. };
  11667. });
  11668. var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
  11669. // check whether current browser encodes a char inside attribute values
  11670. var div;
  11671. function getShouldDecode(href) {
  11672. div = div || document.createElement('div');
  11673. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  11674. return div.innerHTML.indexOf('&#10;') > 0;
  11675. }
  11676. // #3663: IE encodes newlines inside attribute values while other browsers don't
  11677. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  11678. // #6828: chrome encodes content in a[href]
  11679. var shouldDecodeNewlinesForHref = inBrowser
  11680. ? getShouldDecode(true)
  11681. : false;
  11682. var idToTemplate = cached(function (id) {
  11683. var el = query(id);
  11684. return el && el.innerHTML;
  11685. });
  11686. var mount = Vue.prototype.$mount;
  11687. Vue.prototype.$mount = function (el, hydrating) {
  11688. el = el && query(el);
  11689. /* istanbul ignore if */
  11690. if (el === document.body || el === document.documentElement) {
  11691. process.env.NODE_ENV !== 'production' &&
  11692. warn$2("Do not mount Vue to <html> or <body> - mount to normal elements instead.");
  11693. return this;
  11694. }
  11695. var options = this.$options;
  11696. // resolve template/el and convert to render function
  11697. if (!options.render) {
  11698. var template = options.template;
  11699. if (template) {
  11700. if (typeof template === 'string') {
  11701. if (template.charAt(0) === '#') {
  11702. template = idToTemplate(template);
  11703. /* istanbul ignore if */
  11704. if (process.env.NODE_ENV !== 'production' && !template) {
  11705. warn$2("Template element not found or is empty: ".concat(options.template), this);
  11706. }
  11707. }
  11708. }
  11709. else if (template.nodeType) {
  11710. template = template.innerHTML;
  11711. }
  11712. else {
  11713. if (process.env.NODE_ENV !== 'production') {
  11714. warn$2('invalid template option:' + template, this);
  11715. }
  11716. return this;
  11717. }
  11718. }
  11719. else if (el) {
  11720. // @ts-expect-error
  11721. template = getOuterHTML(el);
  11722. }
  11723. if (template) {
  11724. /* istanbul ignore if */
  11725. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  11726. mark('compile');
  11727. }
  11728. var _a = compileToFunctions(template, {
  11729. outputSourceRange: process.env.NODE_ENV !== 'production',
  11730. shouldDecodeNewlines: shouldDecodeNewlines,
  11731. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  11732. delimiters: options.delimiters,
  11733. comments: options.comments
  11734. }, this), render = _a.render, staticRenderFns = _a.staticRenderFns;
  11735. options.render = render;
  11736. options.staticRenderFns = staticRenderFns;
  11737. /* istanbul ignore if */
  11738. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  11739. mark('compile end');
  11740. measure("vue ".concat(this._name, " compile"), 'compile', 'compile end');
  11741. }
  11742. }
  11743. }
  11744. return mount.call(this, el, hydrating);
  11745. };
  11746. /**
  11747. * Get outerHTML of elements, taking care
  11748. * of SVG elements in IE as well.
  11749. */
  11750. function getOuterHTML(el) {
  11751. if (el.outerHTML) {
  11752. return el.outerHTML;
  11753. }
  11754. else {
  11755. var container = document.createElement('div');
  11756. container.appendChild(el.cloneNode(true));
  11757. return container.innerHTML;
  11758. }
  11759. }
  11760. Vue.compile = compileToFunctions;
  11761. export { EffectScope, computed, customRef, Vue as default, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, h, inject, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, mergeDefaults, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref$1 as ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useListeners, useSlots, version, watch, watchEffect, watchPostEffect, watchSyncEffect };