1
0

vue.runtime.js 309 KB

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