runtime-core.cjs.prod.js 174 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var reactivity = require('@vue/reactivity');
  4. var shared = require('@vue/shared');
  5. function warn$1(msg, ...args) {
  6. return;
  7. }
  8. function assertNumber(val, type) {
  9. return;
  10. }
  11. function callWithErrorHandling(fn, instance, type, args) {
  12. let res;
  13. try {
  14. res = args ? fn(...args) : fn();
  15. } catch (err) {
  16. handleError(err, instance, type);
  17. }
  18. return res;
  19. }
  20. function callWithAsyncErrorHandling(fn, instance, type, args) {
  21. if (shared.isFunction(fn)) {
  22. const res = callWithErrorHandling(fn, instance, type, args);
  23. if (res && shared.isPromise(res)) {
  24. res.catch((err) => {
  25. handleError(err, instance, type);
  26. });
  27. }
  28. return res;
  29. }
  30. const values = [];
  31. for (let i = 0; i < fn.length; i++) {
  32. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  33. }
  34. return values;
  35. }
  36. function handleError(err, instance, type, throwInDev = true) {
  37. const contextVNode = instance ? instance.vnode : null;
  38. if (instance) {
  39. let cur = instance.parent;
  40. const exposedInstance = instance.proxy;
  41. const errorInfo = type;
  42. while (cur) {
  43. const errorCapturedHooks = cur.ec;
  44. if (errorCapturedHooks) {
  45. for (let i = 0; i < errorCapturedHooks.length; i++) {
  46. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  47. return;
  48. }
  49. }
  50. }
  51. cur = cur.parent;
  52. }
  53. const appErrorHandler = instance.appContext.config.errorHandler;
  54. if (appErrorHandler) {
  55. callWithErrorHandling(
  56. appErrorHandler,
  57. null,
  58. 10,
  59. [err, exposedInstance, errorInfo]
  60. );
  61. return;
  62. }
  63. }
  64. logError(err, type, contextVNode, throwInDev);
  65. }
  66. function logError(err, type, contextVNode, throwInDev = true) {
  67. {
  68. console.error(err);
  69. }
  70. }
  71. let isFlushing = false;
  72. let isFlushPending = false;
  73. const queue = [];
  74. let flushIndex = 0;
  75. const pendingPostFlushCbs = [];
  76. let activePostFlushCbs = null;
  77. let postFlushIndex = 0;
  78. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  79. let currentFlushPromise = null;
  80. function nextTick(fn) {
  81. const p = currentFlushPromise || resolvedPromise;
  82. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  83. }
  84. function findInsertionIndex(id) {
  85. let start = flushIndex + 1;
  86. let end = queue.length;
  87. while (start < end) {
  88. const middle = start + end >>> 1;
  89. const middleJobId = getId(queue[middle]);
  90. middleJobId < id ? start = middle + 1 : end = middle;
  91. }
  92. return start;
  93. }
  94. function queueJob(job) {
  95. if (!queue.length || !queue.includes(
  96. job,
  97. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  98. )) {
  99. if (job.id == null) {
  100. queue.push(job);
  101. } else {
  102. queue.splice(findInsertionIndex(job.id), 0, job);
  103. }
  104. queueFlush();
  105. }
  106. }
  107. function queueFlush() {
  108. if (!isFlushing && !isFlushPending) {
  109. isFlushPending = true;
  110. currentFlushPromise = resolvedPromise.then(flushJobs);
  111. }
  112. }
  113. function invalidateJob(job) {
  114. const i = queue.indexOf(job);
  115. if (i > flushIndex) {
  116. queue.splice(i, 1);
  117. }
  118. }
  119. function queuePostFlushCb(cb) {
  120. if (!shared.isArray(cb)) {
  121. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  122. cb,
  123. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  124. )) {
  125. pendingPostFlushCbs.push(cb);
  126. }
  127. } else {
  128. pendingPostFlushCbs.push(...cb);
  129. }
  130. queueFlush();
  131. }
  132. function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
  133. for (; i < queue.length; i++) {
  134. const cb = queue[i];
  135. if (cb && cb.pre) {
  136. queue.splice(i, 1);
  137. i--;
  138. cb();
  139. }
  140. }
  141. }
  142. function flushPostFlushCbs(seen) {
  143. if (pendingPostFlushCbs.length) {
  144. const deduped = [...new Set(pendingPostFlushCbs)];
  145. pendingPostFlushCbs.length = 0;
  146. if (activePostFlushCbs) {
  147. activePostFlushCbs.push(...deduped);
  148. return;
  149. }
  150. activePostFlushCbs = deduped;
  151. activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
  152. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  153. activePostFlushCbs[postFlushIndex]();
  154. }
  155. activePostFlushCbs = null;
  156. postFlushIndex = 0;
  157. }
  158. }
  159. const getId = (job) => job.id == null ? Infinity : job.id;
  160. const comparator = (a, b) => {
  161. const diff = getId(a) - getId(b);
  162. if (diff === 0) {
  163. if (a.pre && !b.pre)
  164. return -1;
  165. if (b.pre && !a.pre)
  166. return 1;
  167. }
  168. return diff;
  169. };
  170. function flushJobs(seen) {
  171. isFlushPending = false;
  172. isFlushing = true;
  173. queue.sort(comparator);
  174. try {
  175. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  176. const job = queue[flushIndex];
  177. if (job && job.active !== false) {
  178. if (false) ;
  179. callWithErrorHandling(job, null, 14);
  180. }
  181. }
  182. } finally {
  183. flushIndex = 0;
  184. queue.length = 0;
  185. flushPostFlushCbs();
  186. isFlushing = false;
  187. currentFlushPromise = null;
  188. if (queue.length || pendingPostFlushCbs.length) {
  189. flushJobs();
  190. }
  191. }
  192. }
  193. exports.devtools = void 0;
  194. let buffer = [];
  195. function setDevtoolsHook(hook, target) {
  196. var _a, _b;
  197. exports.devtools = hook;
  198. if (exports.devtools) {
  199. exports.devtools.enabled = true;
  200. buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
  201. buffer = [];
  202. } else if (
  203. // handle late devtools injection - only do this if we are in an actual
  204. // browser environment to avoid the timer handle stalling test runner exit
  205. // (#4815)
  206. typeof window !== "undefined" && // some envs mock window but not fully
  207. window.HTMLElement && // also exclude jsdom
  208. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  209. ) {
  210. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  211. replay.push((newHook) => {
  212. setDevtoolsHook(newHook, target);
  213. });
  214. setTimeout(() => {
  215. if (!exports.devtools) {
  216. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  217. buffer = [];
  218. }
  219. }, 3e3);
  220. } else {
  221. buffer = [];
  222. }
  223. }
  224. function emit(instance, event, ...rawArgs) {
  225. if (instance.isUnmounted)
  226. return;
  227. const props = instance.vnode.props || shared.EMPTY_OBJ;
  228. let args = rawArgs;
  229. const isModelListener = event.startsWith("update:");
  230. const modelArg = isModelListener && event.slice(7);
  231. if (modelArg && modelArg in props) {
  232. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  233. const { number, trim } = props[modifiersKey] || shared.EMPTY_OBJ;
  234. if (trim) {
  235. args = rawArgs.map((a) => shared.isString(a) ? a.trim() : a);
  236. }
  237. if (number) {
  238. args = rawArgs.map(shared.looseToNumber);
  239. }
  240. }
  241. let handlerName;
  242. let handler = props[handlerName = shared.toHandlerKey(event)] || // also try camelCase event handler (#2249)
  243. props[handlerName = shared.toHandlerKey(shared.camelize(event))];
  244. if (!handler && isModelListener) {
  245. handler = props[handlerName = shared.toHandlerKey(shared.hyphenate(event))];
  246. }
  247. if (handler) {
  248. callWithAsyncErrorHandling(
  249. handler,
  250. instance,
  251. 6,
  252. args
  253. );
  254. }
  255. const onceHandler = props[handlerName + `Once`];
  256. if (onceHandler) {
  257. if (!instance.emitted) {
  258. instance.emitted = {};
  259. } else if (instance.emitted[handlerName]) {
  260. return;
  261. }
  262. instance.emitted[handlerName] = true;
  263. callWithAsyncErrorHandling(
  264. onceHandler,
  265. instance,
  266. 6,
  267. args
  268. );
  269. }
  270. }
  271. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  272. const cache = appContext.emitsCache;
  273. const cached = cache.get(comp);
  274. if (cached !== void 0) {
  275. return cached;
  276. }
  277. const raw = comp.emits;
  278. let normalized = {};
  279. let hasExtends = false;
  280. if (!shared.isFunction(comp)) {
  281. const extendEmits = (raw2) => {
  282. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  283. if (normalizedFromExtend) {
  284. hasExtends = true;
  285. shared.extend(normalized, normalizedFromExtend);
  286. }
  287. };
  288. if (!asMixin && appContext.mixins.length) {
  289. appContext.mixins.forEach(extendEmits);
  290. }
  291. if (comp.extends) {
  292. extendEmits(comp.extends);
  293. }
  294. if (comp.mixins) {
  295. comp.mixins.forEach(extendEmits);
  296. }
  297. }
  298. if (!raw && !hasExtends) {
  299. if (shared.isObject(comp)) {
  300. cache.set(comp, null);
  301. }
  302. return null;
  303. }
  304. if (shared.isArray(raw)) {
  305. raw.forEach((key) => normalized[key] = null);
  306. } else {
  307. shared.extend(normalized, raw);
  308. }
  309. if (shared.isObject(comp)) {
  310. cache.set(comp, normalized);
  311. }
  312. return normalized;
  313. }
  314. function isEmitListener(options, key) {
  315. if (!options || !shared.isOn(key)) {
  316. return false;
  317. }
  318. key = key.slice(2).replace(/Once$/, "");
  319. return shared.hasOwn(options, key[0].toLowerCase() + key.slice(1)) || shared.hasOwn(options, shared.hyphenate(key)) || shared.hasOwn(options, key);
  320. }
  321. let currentRenderingInstance = null;
  322. let currentScopeId = null;
  323. function setCurrentRenderingInstance(instance) {
  324. const prev = currentRenderingInstance;
  325. currentRenderingInstance = instance;
  326. currentScopeId = instance && instance.type.__scopeId || null;
  327. return prev;
  328. }
  329. function pushScopeId(id) {
  330. currentScopeId = id;
  331. }
  332. function popScopeId() {
  333. currentScopeId = null;
  334. }
  335. const withScopeId = (_id) => withCtx;
  336. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  337. if (!ctx)
  338. return fn;
  339. if (fn._n) {
  340. return fn;
  341. }
  342. const renderFnWithContext = (...args) => {
  343. if (renderFnWithContext._d) {
  344. setBlockTracking(-1);
  345. }
  346. const prevInstance = setCurrentRenderingInstance(ctx);
  347. let res;
  348. try {
  349. res = fn(...args);
  350. } finally {
  351. setCurrentRenderingInstance(prevInstance);
  352. if (renderFnWithContext._d) {
  353. setBlockTracking(1);
  354. }
  355. }
  356. return res;
  357. };
  358. renderFnWithContext._n = true;
  359. renderFnWithContext._c = true;
  360. renderFnWithContext._d = true;
  361. return renderFnWithContext;
  362. }
  363. function markAttrsAccessed() {
  364. }
  365. function renderComponentRoot(instance) {
  366. const {
  367. type: Component,
  368. vnode,
  369. proxy,
  370. withProxy,
  371. props,
  372. propsOptions: [propsOptions],
  373. slots,
  374. attrs,
  375. emit,
  376. render,
  377. renderCache,
  378. data,
  379. setupState,
  380. ctx,
  381. inheritAttrs
  382. } = instance;
  383. let result;
  384. let fallthroughAttrs;
  385. const prev = setCurrentRenderingInstance(instance);
  386. try {
  387. if (vnode.shapeFlag & 4) {
  388. const proxyToUse = withProxy || proxy;
  389. result = normalizeVNode(
  390. render.call(
  391. proxyToUse,
  392. proxyToUse,
  393. renderCache,
  394. props,
  395. setupState,
  396. data,
  397. ctx
  398. )
  399. );
  400. fallthroughAttrs = attrs;
  401. } else {
  402. const render2 = Component;
  403. if (false) ;
  404. result = normalizeVNode(
  405. render2.length > 1 ? render2(
  406. props,
  407. false ? {
  408. get attrs() {
  409. markAttrsAccessed();
  410. return attrs;
  411. },
  412. slots,
  413. emit
  414. } : { attrs, slots, emit }
  415. ) : render2(
  416. props,
  417. null
  418. /* we know it doesn't need it */
  419. )
  420. );
  421. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  422. }
  423. } catch (err) {
  424. blockStack.length = 0;
  425. handleError(err, instance, 1);
  426. result = createVNode(Comment);
  427. }
  428. let root = result;
  429. if (fallthroughAttrs && inheritAttrs !== false) {
  430. const keys = Object.keys(fallthroughAttrs);
  431. const { shapeFlag } = root;
  432. if (keys.length) {
  433. if (shapeFlag & (1 | 6)) {
  434. if (propsOptions && keys.some(shared.isModelListener)) {
  435. fallthroughAttrs = filterModelListeners(
  436. fallthroughAttrs,
  437. propsOptions
  438. );
  439. }
  440. root = cloneVNode(root, fallthroughAttrs);
  441. }
  442. }
  443. }
  444. if (vnode.dirs) {
  445. root = cloneVNode(root);
  446. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  447. }
  448. if (vnode.transition) {
  449. root.transition = vnode.transition;
  450. }
  451. {
  452. result = root;
  453. }
  454. setCurrentRenderingInstance(prev);
  455. return result;
  456. }
  457. function filterSingleRoot(children) {
  458. let singleRoot;
  459. for (let i = 0; i < children.length; i++) {
  460. const child = children[i];
  461. if (isVNode(child)) {
  462. if (child.type !== Comment || child.children === "v-if") {
  463. if (singleRoot) {
  464. return;
  465. } else {
  466. singleRoot = child;
  467. }
  468. }
  469. } else {
  470. return;
  471. }
  472. }
  473. return singleRoot;
  474. }
  475. const getFunctionalFallthrough = (attrs) => {
  476. let res;
  477. for (const key in attrs) {
  478. if (key === "class" || key === "style" || shared.isOn(key)) {
  479. (res || (res = {}))[key] = attrs[key];
  480. }
  481. }
  482. return res;
  483. };
  484. const filterModelListeners = (attrs, props) => {
  485. const res = {};
  486. for (const key in attrs) {
  487. if (!shared.isModelListener(key) || !(key.slice(9) in props)) {
  488. res[key] = attrs[key];
  489. }
  490. }
  491. return res;
  492. };
  493. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  494. const { props: prevProps, children: prevChildren, component } = prevVNode;
  495. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  496. const emits = component.emitsOptions;
  497. if (nextVNode.dirs || nextVNode.transition) {
  498. return true;
  499. }
  500. if (optimized && patchFlag >= 0) {
  501. if (patchFlag & 1024) {
  502. return true;
  503. }
  504. if (patchFlag & 16) {
  505. if (!prevProps) {
  506. return !!nextProps;
  507. }
  508. return hasPropsChanged(prevProps, nextProps, emits);
  509. } else if (patchFlag & 8) {
  510. const dynamicProps = nextVNode.dynamicProps;
  511. for (let i = 0; i < dynamicProps.length; i++) {
  512. const key = dynamicProps[i];
  513. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  514. return true;
  515. }
  516. }
  517. }
  518. } else {
  519. if (prevChildren || nextChildren) {
  520. if (!nextChildren || !nextChildren.$stable) {
  521. return true;
  522. }
  523. }
  524. if (prevProps === nextProps) {
  525. return false;
  526. }
  527. if (!prevProps) {
  528. return !!nextProps;
  529. }
  530. if (!nextProps) {
  531. return true;
  532. }
  533. return hasPropsChanged(prevProps, nextProps, emits);
  534. }
  535. return false;
  536. }
  537. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  538. const nextKeys = Object.keys(nextProps);
  539. if (nextKeys.length !== Object.keys(prevProps).length) {
  540. return true;
  541. }
  542. for (let i = 0; i < nextKeys.length; i++) {
  543. const key = nextKeys[i];
  544. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  545. return true;
  546. }
  547. }
  548. return false;
  549. }
  550. function updateHOCHostEl({ vnode, parent }, el) {
  551. while (parent && parent.subTree === vnode) {
  552. (vnode = parent.vnode).el = el;
  553. parent = parent.parent;
  554. }
  555. }
  556. const isSuspense = (type) => type.__isSuspense;
  557. const SuspenseImpl = {
  558. name: "Suspense",
  559. // In order to make Suspense tree-shakable, we need to avoid importing it
  560. // directly in the renderer. The renderer checks for the __isSuspense flag
  561. // on a vnode's type and calls the `process` method, passing in renderer
  562. // internals.
  563. __isSuspense: true,
  564. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  565. if (n1 == null) {
  566. mountSuspense(
  567. n2,
  568. container,
  569. anchor,
  570. parentComponent,
  571. parentSuspense,
  572. isSVG,
  573. slotScopeIds,
  574. optimized,
  575. rendererInternals
  576. );
  577. } else {
  578. patchSuspense(
  579. n1,
  580. n2,
  581. container,
  582. anchor,
  583. parentComponent,
  584. isSVG,
  585. slotScopeIds,
  586. optimized,
  587. rendererInternals
  588. );
  589. }
  590. },
  591. hydrate: hydrateSuspense,
  592. create: createSuspenseBoundary,
  593. normalize: normalizeSuspenseChildren
  594. };
  595. const Suspense = SuspenseImpl ;
  596. function triggerEvent(vnode, name) {
  597. const eventListener = vnode.props && vnode.props[name];
  598. if (shared.isFunction(eventListener)) {
  599. eventListener();
  600. }
  601. }
  602. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  603. const {
  604. p: patch,
  605. o: { createElement }
  606. } = rendererInternals;
  607. const hiddenContainer = createElement("div");
  608. const suspense = vnode.suspense = createSuspenseBoundary(
  609. vnode,
  610. parentSuspense,
  611. parentComponent,
  612. container,
  613. hiddenContainer,
  614. anchor,
  615. isSVG,
  616. slotScopeIds,
  617. optimized,
  618. rendererInternals
  619. );
  620. patch(
  621. null,
  622. suspense.pendingBranch = vnode.ssContent,
  623. hiddenContainer,
  624. null,
  625. parentComponent,
  626. suspense,
  627. isSVG,
  628. slotScopeIds
  629. );
  630. if (suspense.deps > 0) {
  631. triggerEvent(vnode, "onPending");
  632. triggerEvent(vnode, "onFallback");
  633. patch(
  634. null,
  635. vnode.ssFallback,
  636. container,
  637. anchor,
  638. parentComponent,
  639. null,
  640. // fallback tree will not have suspense context
  641. isSVG,
  642. slotScopeIds
  643. );
  644. setActiveBranch(suspense, vnode.ssFallback);
  645. } else {
  646. suspense.resolve(false, true);
  647. }
  648. }
  649. function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  650. const suspense = n2.suspense = n1.suspense;
  651. suspense.vnode = n2;
  652. n2.el = n1.el;
  653. const newBranch = n2.ssContent;
  654. const newFallback = n2.ssFallback;
  655. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  656. if (pendingBranch) {
  657. suspense.pendingBranch = newBranch;
  658. if (isSameVNodeType(newBranch, pendingBranch)) {
  659. patch(
  660. pendingBranch,
  661. newBranch,
  662. suspense.hiddenContainer,
  663. null,
  664. parentComponent,
  665. suspense,
  666. isSVG,
  667. slotScopeIds,
  668. optimized
  669. );
  670. if (suspense.deps <= 0) {
  671. suspense.resolve();
  672. } else if (isInFallback) {
  673. patch(
  674. activeBranch,
  675. newFallback,
  676. container,
  677. anchor,
  678. parentComponent,
  679. null,
  680. // fallback tree will not have suspense context
  681. isSVG,
  682. slotScopeIds,
  683. optimized
  684. );
  685. setActiveBranch(suspense, newFallback);
  686. }
  687. } else {
  688. suspense.pendingId++;
  689. if (isHydrating) {
  690. suspense.isHydrating = false;
  691. suspense.activeBranch = pendingBranch;
  692. } else {
  693. unmount(pendingBranch, parentComponent, suspense);
  694. }
  695. suspense.deps = 0;
  696. suspense.effects.length = 0;
  697. suspense.hiddenContainer = createElement("div");
  698. if (isInFallback) {
  699. patch(
  700. null,
  701. newBranch,
  702. suspense.hiddenContainer,
  703. null,
  704. parentComponent,
  705. suspense,
  706. isSVG,
  707. slotScopeIds,
  708. optimized
  709. );
  710. if (suspense.deps <= 0) {
  711. suspense.resolve();
  712. } else {
  713. patch(
  714. activeBranch,
  715. newFallback,
  716. container,
  717. anchor,
  718. parentComponent,
  719. null,
  720. // fallback tree will not have suspense context
  721. isSVG,
  722. slotScopeIds,
  723. optimized
  724. );
  725. setActiveBranch(suspense, newFallback);
  726. }
  727. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  728. patch(
  729. activeBranch,
  730. newBranch,
  731. container,
  732. anchor,
  733. parentComponent,
  734. suspense,
  735. isSVG,
  736. slotScopeIds,
  737. optimized
  738. );
  739. suspense.resolve(true);
  740. } else {
  741. patch(
  742. null,
  743. newBranch,
  744. suspense.hiddenContainer,
  745. null,
  746. parentComponent,
  747. suspense,
  748. isSVG,
  749. slotScopeIds,
  750. optimized
  751. );
  752. if (suspense.deps <= 0) {
  753. suspense.resolve();
  754. }
  755. }
  756. }
  757. } else {
  758. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  759. patch(
  760. activeBranch,
  761. newBranch,
  762. container,
  763. anchor,
  764. parentComponent,
  765. suspense,
  766. isSVG,
  767. slotScopeIds,
  768. optimized
  769. );
  770. setActiveBranch(suspense, newBranch);
  771. } else {
  772. triggerEvent(n2, "onPending");
  773. suspense.pendingBranch = newBranch;
  774. suspense.pendingId++;
  775. patch(
  776. null,
  777. newBranch,
  778. suspense.hiddenContainer,
  779. null,
  780. parentComponent,
  781. suspense,
  782. isSVG,
  783. slotScopeIds,
  784. optimized
  785. );
  786. if (suspense.deps <= 0) {
  787. suspense.resolve();
  788. } else {
  789. const { timeout, pendingId } = suspense;
  790. if (timeout > 0) {
  791. setTimeout(() => {
  792. if (suspense.pendingId === pendingId) {
  793. suspense.fallback(newFallback);
  794. }
  795. }, timeout);
  796. } else if (timeout === 0) {
  797. suspense.fallback(newFallback);
  798. }
  799. }
  800. }
  801. }
  802. }
  803. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  804. const {
  805. p: patch,
  806. m: move,
  807. um: unmount,
  808. n: next,
  809. o: { parentNode, remove }
  810. } = rendererInternals;
  811. let parentSuspenseId;
  812. const isSuspensible = isVNodeSuspensible(vnode);
  813. if (isSuspensible) {
  814. if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
  815. parentSuspenseId = parentSuspense.pendingId;
  816. parentSuspense.deps++;
  817. }
  818. }
  819. const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : void 0;
  820. const suspense = {
  821. vnode,
  822. parent: parentSuspense,
  823. parentComponent,
  824. isSVG,
  825. container,
  826. hiddenContainer,
  827. anchor,
  828. deps: 0,
  829. pendingId: 0,
  830. timeout: typeof timeout === "number" ? timeout : -1,
  831. activeBranch: null,
  832. pendingBranch: null,
  833. isInFallback: true,
  834. isHydrating,
  835. isUnmounted: false,
  836. effects: [],
  837. resolve(resume = false, sync = false) {
  838. const {
  839. vnode: vnode2,
  840. activeBranch,
  841. pendingBranch,
  842. pendingId,
  843. effects,
  844. parentComponent: parentComponent2,
  845. container: container2
  846. } = suspense;
  847. if (suspense.isHydrating) {
  848. suspense.isHydrating = false;
  849. } else if (!resume) {
  850. const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  851. if (delayEnter) {
  852. activeBranch.transition.afterLeave = () => {
  853. if (pendingId === suspense.pendingId) {
  854. move(pendingBranch, container2, anchor2, 0);
  855. }
  856. };
  857. }
  858. let { anchor: anchor2 } = suspense;
  859. if (activeBranch) {
  860. anchor2 = next(activeBranch);
  861. unmount(activeBranch, parentComponent2, suspense, true);
  862. }
  863. if (!delayEnter) {
  864. move(pendingBranch, container2, anchor2, 0);
  865. }
  866. }
  867. setActiveBranch(suspense, pendingBranch);
  868. suspense.pendingBranch = null;
  869. suspense.isInFallback = false;
  870. let parent = suspense.parent;
  871. let hasUnresolvedAncestor = false;
  872. while (parent) {
  873. if (parent.pendingBranch) {
  874. parent.effects.push(...effects);
  875. hasUnresolvedAncestor = true;
  876. break;
  877. }
  878. parent = parent.parent;
  879. }
  880. if (!hasUnresolvedAncestor) {
  881. queuePostFlushCb(effects);
  882. }
  883. suspense.effects = [];
  884. if (isSuspensible) {
  885. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  886. parentSuspense.deps--;
  887. if (parentSuspense.deps === 0 && !sync) {
  888. parentSuspense.resolve();
  889. }
  890. }
  891. }
  892. triggerEvent(vnode2, "onResolve");
  893. },
  894. fallback(fallbackVNode) {
  895. if (!suspense.pendingBranch) {
  896. return;
  897. }
  898. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
  899. triggerEvent(vnode2, "onFallback");
  900. const anchor2 = next(activeBranch);
  901. const mountFallback = () => {
  902. if (!suspense.isInFallback) {
  903. return;
  904. }
  905. patch(
  906. null,
  907. fallbackVNode,
  908. container2,
  909. anchor2,
  910. parentComponent2,
  911. null,
  912. // fallback tree will not have suspense context
  913. isSVG2,
  914. slotScopeIds,
  915. optimized
  916. );
  917. setActiveBranch(suspense, fallbackVNode);
  918. };
  919. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  920. if (delayEnter) {
  921. activeBranch.transition.afterLeave = mountFallback;
  922. }
  923. suspense.isInFallback = true;
  924. unmount(
  925. activeBranch,
  926. parentComponent2,
  927. null,
  928. // no suspense so unmount hooks fire now
  929. true
  930. // shouldRemove
  931. );
  932. if (!delayEnter) {
  933. mountFallback();
  934. }
  935. },
  936. move(container2, anchor2, type) {
  937. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  938. suspense.container = container2;
  939. },
  940. next() {
  941. return suspense.activeBranch && next(suspense.activeBranch);
  942. },
  943. registerDep(instance, setupRenderEffect) {
  944. const isInPendingSuspense = !!suspense.pendingBranch;
  945. if (isInPendingSuspense) {
  946. suspense.deps++;
  947. }
  948. const hydratedEl = instance.vnode.el;
  949. instance.asyncDep.catch((err) => {
  950. handleError(err, instance, 0);
  951. }).then((asyncSetupResult) => {
  952. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  953. return;
  954. }
  955. instance.asyncResolved = true;
  956. const { vnode: vnode2 } = instance;
  957. handleSetupResult(instance, asyncSetupResult, false);
  958. if (hydratedEl) {
  959. vnode2.el = hydratedEl;
  960. }
  961. const placeholder = !hydratedEl && instance.subTree.el;
  962. setupRenderEffect(
  963. instance,
  964. vnode2,
  965. // component may have been moved before resolve.
  966. // if this is not a hydration, instance.subTree will be the comment
  967. // placeholder.
  968. parentNode(hydratedEl || instance.subTree.el),
  969. // anchor will not be used if this is hydration, so only need to
  970. // consider the comment placeholder case.
  971. hydratedEl ? null : next(instance.subTree),
  972. suspense,
  973. isSVG,
  974. optimized
  975. );
  976. if (placeholder) {
  977. remove(placeholder);
  978. }
  979. updateHOCHostEl(instance, vnode2.el);
  980. if (isInPendingSuspense && --suspense.deps === 0) {
  981. suspense.resolve();
  982. }
  983. });
  984. },
  985. unmount(parentSuspense2, doRemove) {
  986. suspense.isUnmounted = true;
  987. if (suspense.activeBranch) {
  988. unmount(
  989. suspense.activeBranch,
  990. parentComponent,
  991. parentSuspense2,
  992. doRemove
  993. );
  994. }
  995. if (suspense.pendingBranch) {
  996. unmount(
  997. suspense.pendingBranch,
  998. parentComponent,
  999. parentSuspense2,
  1000. doRemove
  1001. );
  1002. }
  1003. }
  1004. };
  1005. return suspense;
  1006. }
  1007. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  1008. const suspense = vnode.suspense = createSuspenseBoundary(
  1009. vnode,
  1010. parentSuspense,
  1011. parentComponent,
  1012. node.parentNode,
  1013. document.createElement("div"),
  1014. null,
  1015. isSVG,
  1016. slotScopeIds,
  1017. optimized,
  1018. rendererInternals,
  1019. true
  1020. /* hydrating */
  1021. );
  1022. const result = hydrateNode(
  1023. node,
  1024. suspense.pendingBranch = vnode.ssContent,
  1025. parentComponent,
  1026. suspense,
  1027. slotScopeIds,
  1028. optimized
  1029. );
  1030. if (suspense.deps === 0) {
  1031. suspense.resolve(false, true);
  1032. }
  1033. return result;
  1034. }
  1035. function normalizeSuspenseChildren(vnode) {
  1036. const { shapeFlag, children } = vnode;
  1037. const isSlotChildren = shapeFlag & 32;
  1038. vnode.ssContent = normalizeSuspenseSlot(
  1039. isSlotChildren ? children.default : children
  1040. );
  1041. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  1042. }
  1043. function normalizeSuspenseSlot(s) {
  1044. let block;
  1045. if (shared.isFunction(s)) {
  1046. const trackBlock = isBlockTreeEnabled && s._c;
  1047. if (trackBlock) {
  1048. s._d = false;
  1049. openBlock();
  1050. }
  1051. s = s();
  1052. if (trackBlock) {
  1053. s._d = true;
  1054. block = currentBlock;
  1055. closeBlock();
  1056. }
  1057. }
  1058. if (shared.isArray(s)) {
  1059. const singleChild = filterSingleRoot(s);
  1060. s = singleChild;
  1061. }
  1062. s = normalizeVNode(s);
  1063. if (block && !s.dynamicChildren) {
  1064. s.dynamicChildren = block.filter((c) => c !== s);
  1065. }
  1066. return s;
  1067. }
  1068. function queueEffectWithSuspense(fn, suspense) {
  1069. if (suspense && suspense.pendingBranch) {
  1070. if (shared.isArray(fn)) {
  1071. suspense.effects.push(...fn);
  1072. } else {
  1073. suspense.effects.push(fn);
  1074. }
  1075. } else {
  1076. queuePostFlushCb(fn);
  1077. }
  1078. }
  1079. function setActiveBranch(suspense, branch) {
  1080. suspense.activeBranch = branch;
  1081. const { vnode, parentComponent } = suspense;
  1082. const el = vnode.el = branch.el;
  1083. if (parentComponent && parentComponent.subTree === vnode) {
  1084. parentComponent.vnode.el = el;
  1085. updateHOCHostEl(parentComponent, el);
  1086. }
  1087. }
  1088. function isVNodeSuspensible(vnode) {
  1089. var _a;
  1090. return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
  1091. }
  1092. function watchEffect(effect, options) {
  1093. return doWatch(effect, null, options);
  1094. }
  1095. function watchPostEffect(effect, options) {
  1096. return doWatch(
  1097. effect,
  1098. null,
  1099. { flush: "post" }
  1100. );
  1101. }
  1102. function watchSyncEffect(effect, options) {
  1103. return doWatch(
  1104. effect,
  1105. null,
  1106. { flush: "sync" }
  1107. );
  1108. }
  1109. const INITIAL_WATCHER_VALUE = {};
  1110. function watch(source, cb, options) {
  1111. return doWatch(source, cb, options);
  1112. }
  1113. function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = shared.EMPTY_OBJ) {
  1114. var _a;
  1115. const instance = reactivity.getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
  1116. let getter;
  1117. let forceTrigger = false;
  1118. let isMultiSource = false;
  1119. if (reactivity.isRef(source)) {
  1120. getter = () => source.value;
  1121. forceTrigger = reactivity.isShallow(source);
  1122. } else if (reactivity.isReactive(source)) {
  1123. getter = () => source;
  1124. deep = true;
  1125. } else if (shared.isArray(source)) {
  1126. isMultiSource = true;
  1127. forceTrigger = source.some((s) => reactivity.isReactive(s) || reactivity.isShallow(s));
  1128. getter = () => source.map((s) => {
  1129. if (reactivity.isRef(s)) {
  1130. return s.value;
  1131. } else if (reactivity.isReactive(s)) {
  1132. return traverse(s);
  1133. } else if (shared.isFunction(s)) {
  1134. return callWithErrorHandling(s, instance, 2);
  1135. } else ;
  1136. });
  1137. } else if (shared.isFunction(source)) {
  1138. if (cb) {
  1139. getter = () => callWithErrorHandling(source, instance, 2);
  1140. } else {
  1141. getter = () => {
  1142. if (instance && instance.isUnmounted) {
  1143. return;
  1144. }
  1145. if (cleanup) {
  1146. cleanup();
  1147. }
  1148. return callWithAsyncErrorHandling(
  1149. source,
  1150. instance,
  1151. 3,
  1152. [onCleanup]
  1153. );
  1154. };
  1155. }
  1156. } else {
  1157. getter = shared.NOOP;
  1158. }
  1159. if (cb && deep) {
  1160. const baseGetter = getter;
  1161. getter = () => traverse(baseGetter());
  1162. }
  1163. let cleanup;
  1164. let onCleanup = (fn) => {
  1165. cleanup = effect.onStop = () => {
  1166. callWithErrorHandling(fn, instance, 4);
  1167. };
  1168. };
  1169. let ssrCleanup;
  1170. if (isInSSRComponentSetup) {
  1171. onCleanup = shared.NOOP;
  1172. if (!cb) {
  1173. getter();
  1174. } else if (immediate) {
  1175. callWithAsyncErrorHandling(cb, instance, 3, [
  1176. getter(),
  1177. isMultiSource ? [] : void 0,
  1178. onCleanup
  1179. ]);
  1180. }
  1181. if (flush === "sync") {
  1182. const ctx = useSSRContext();
  1183. ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
  1184. } else {
  1185. return shared.NOOP;
  1186. }
  1187. }
  1188. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  1189. const job = () => {
  1190. if (!effect.active) {
  1191. return;
  1192. }
  1193. if (cb) {
  1194. const newValue = effect.run();
  1195. if (deep || forceTrigger || (isMultiSource ? newValue.some(
  1196. (v, i) => shared.hasChanged(v, oldValue[i])
  1197. ) : shared.hasChanged(newValue, oldValue)) || false) {
  1198. if (cleanup) {
  1199. cleanup();
  1200. }
  1201. callWithAsyncErrorHandling(cb, instance, 3, [
  1202. newValue,
  1203. // pass undefined as the old value when it's changed for the first time
  1204. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  1205. onCleanup
  1206. ]);
  1207. oldValue = newValue;
  1208. }
  1209. } else {
  1210. effect.run();
  1211. }
  1212. };
  1213. job.allowRecurse = !!cb;
  1214. let scheduler;
  1215. if (flush === "sync") {
  1216. scheduler = job;
  1217. } else if (flush === "post") {
  1218. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  1219. } else {
  1220. job.pre = true;
  1221. if (instance)
  1222. job.id = instance.uid;
  1223. scheduler = () => queueJob(job);
  1224. }
  1225. const effect = new reactivity.ReactiveEffect(getter, scheduler);
  1226. if (cb) {
  1227. if (immediate) {
  1228. job();
  1229. } else {
  1230. oldValue = effect.run();
  1231. }
  1232. } else if (flush === "post") {
  1233. queuePostRenderEffect(
  1234. effect.run.bind(effect),
  1235. instance && instance.suspense
  1236. );
  1237. } else {
  1238. effect.run();
  1239. }
  1240. const unwatch = () => {
  1241. effect.stop();
  1242. if (instance && instance.scope) {
  1243. shared.remove(instance.scope.effects, effect);
  1244. }
  1245. };
  1246. if (ssrCleanup)
  1247. ssrCleanup.push(unwatch);
  1248. return unwatch;
  1249. }
  1250. function instanceWatch(source, value, options) {
  1251. const publicThis = this.proxy;
  1252. const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  1253. let cb;
  1254. if (shared.isFunction(value)) {
  1255. cb = value;
  1256. } else {
  1257. cb = value.handler;
  1258. options = value;
  1259. }
  1260. const cur = currentInstance;
  1261. setCurrentInstance(this);
  1262. const res = doWatch(getter, cb.bind(publicThis), options);
  1263. if (cur) {
  1264. setCurrentInstance(cur);
  1265. } else {
  1266. unsetCurrentInstance();
  1267. }
  1268. return res;
  1269. }
  1270. function createPathGetter(ctx, path) {
  1271. const segments = path.split(".");
  1272. return () => {
  1273. let cur = ctx;
  1274. for (let i = 0; i < segments.length && cur; i++) {
  1275. cur = cur[segments[i]];
  1276. }
  1277. return cur;
  1278. };
  1279. }
  1280. function traverse(value, seen) {
  1281. if (!shared.isObject(value) || value["__v_skip"]) {
  1282. return value;
  1283. }
  1284. seen = seen || /* @__PURE__ */ new Set();
  1285. if (seen.has(value)) {
  1286. return value;
  1287. }
  1288. seen.add(value);
  1289. if (reactivity.isRef(value)) {
  1290. traverse(value.value, seen);
  1291. } else if (shared.isArray(value)) {
  1292. for (let i = 0; i < value.length; i++) {
  1293. traverse(value[i], seen);
  1294. }
  1295. } else if (shared.isSet(value) || shared.isMap(value)) {
  1296. value.forEach((v) => {
  1297. traverse(v, seen);
  1298. });
  1299. } else if (shared.isPlainObject(value)) {
  1300. for (const key in value) {
  1301. traverse(value[key], seen);
  1302. }
  1303. }
  1304. return value;
  1305. }
  1306. function withDirectives(vnode, directives) {
  1307. const internalInstance = currentRenderingInstance;
  1308. if (internalInstance === null) {
  1309. return vnode;
  1310. }
  1311. const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
  1312. const bindings = vnode.dirs || (vnode.dirs = []);
  1313. for (let i = 0; i < directives.length; i++) {
  1314. let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
  1315. if (dir) {
  1316. if (shared.isFunction(dir)) {
  1317. dir = {
  1318. mounted: dir,
  1319. updated: dir
  1320. };
  1321. }
  1322. if (dir.deep) {
  1323. traverse(value);
  1324. }
  1325. bindings.push({
  1326. dir,
  1327. instance,
  1328. value,
  1329. oldValue: void 0,
  1330. arg,
  1331. modifiers
  1332. });
  1333. }
  1334. }
  1335. return vnode;
  1336. }
  1337. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  1338. const bindings = vnode.dirs;
  1339. const oldBindings = prevVNode && prevVNode.dirs;
  1340. for (let i = 0; i < bindings.length; i++) {
  1341. const binding = bindings[i];
  1342. if (oldBindings) {
  1343. binding.oldValue = oldBindings[i].value;
  1344. }
  1345. let hook = binding.dir[name];
  1346. if (hook) {
  1347. reactivity.pauseTracking();
  1348. callWithAsyncErrorHandling(hook, instance, 8, [
  1349. vnode.el,
  1350. binding,
  1351. vnode,
  1352. prevVNode
  1353. ]);
  1354. reactivity.resetTracking();
  1355. }
  1356. }
  1357. }
  1358. function useTransitionState() {
  1359. const state = {
  1360. isMounted: false,
  1361. isLeaving: false,
  1362. isUnmounting: false,
  1363. leavingVNodes: /* @__PURE__ */ new Map()
  1364. };
  1365. onMounted(() => {
  1366. state.isMounted = true;
  1367. });
  1368. onBeforeUnmount(() => {
  1369. state.isUnmounting = true;
  1370. });
  1371. return state;
  1372. }
  1373. const TransitionHookValidator = [Function, Array];
  1374. const BaseTransitionPropsValidators = {
  1375. mode: String,
  1376. appear: Boolean,
  1377. persisted: Boolean,
  1378. // enter
  1379. onBeforeEnter: TransitionHookValidator,
  1380. onEnter: TransitionHookValidator,
  1381. onAfterEnter: TransitionHookValidator,
  1382. onEnterCancelled: TransitionHookValidator,
  1383. // leave
  1384. onBeforeLeave: TransitionHookValidator,
  1385. onLeave: TransitionHookValidator,
  1386. onAfterLeave: TransitionHookValidator,
  1387. onLeaveCancelled: TransitionHookValidator,
  1388. // appear
  1389. onBeforeAppear: TransitionHookValidator,
  1390. onAppear: TransitionHookValidator,
  1391. onAfterAppear: TransitionHookValidator,
  1392. onAppearCancelled: TransitionHookValidator
  1393. };
  1394. const BaseTransitionImpl = {
  1395. name: `BaseTransition`,
  1396. props: BaseTransitionPropsValidators,
  1397. setup(props, { slots }) {
  1398. const instance = getCurrentInstance();
  1399. const state = useTransitionState();
  1400. let prevTransitionKey;
  1401. return () => {
  1402. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  1403. if (!children || !children.length) {
  1404. return;
  1405. }
  1406. let child = children[0];
  1407. if (children.length > 1) {
  1408. for (const c of children) {
  1409. if (c.type !== Comment) {
  1410. child = c;
  1411. break;
  1412. }
  1413. }
  1414. }
  1415. const rawProps = reactivity.toRaw(props);
  1416. const { mode } = rawProps;
  1417. if (state.isLeaving) {
  1418. return emptyPlaceholder(child);
  1419. }
  1420. const innerChild = getKeepAliveChild(child);
  1421. if (!innerChild) {
  1422. return emptyPlaceholder(child);
  1423. }
  1424. const enterHooks = resolveTransitionHooks(
  1425. innerChild,
  1426. rawProps,
  1427. state,
  1428. instance
  1429. );
  1430. setTransitionHooks(innerChild, enterHooks);
  1431. const oldChild = instance.subTree;
  1432. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  1433. let transitionKeyChanged = false;
  1434. const { getTransitionKey } = innerChild.type;
  1435. if (getTransitionKey) {
  1436. const key = getTransitionKey();
  1437. if (prevTransitionKey === void 0) {
  1438. prevTransitionKey = key;
  1439. } else if (key !== prevTransitionKey) {
  1440. prevTransitionKey = key;
  1441. transitionKeyChanged = true;
  1442. }
  1443. }
  1444. if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
  1445. const leavingHooks = resolveTransitionHooks(
  1446. oldInnerChild,
  1447. rawProps,
  1448. state,
  1449. instance
  1450. );
  1451. setTransitionHooks(oldInnerChild, leavingHooks);
  1452. if (mode === "out-in") {
  1453. state.isLeaving = true;
  1454. leavingHooks.afterLeave = () => {
  1455. state.isLeaving = false;
  1456. if (instance.update.active !== false) {
  1457. instance.update();
  1458. }
  1459. };
  1460. return emptyPlaceholder(child);
  1461. } else if (mode === "in-out" && innerChild.type !== Comment) {
  1462. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  1463. const leavingVNodesCache = getLeavingNodesForType(
  1464. state,
  1465. oldInnerChild
  1466. );
  1467. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  1468. el._leaveCb = () => {
  1469. earlyRemove();
  1470. el._leaveCb = void 0;
  1471. delete enterHooks.delayedLeave;
  1472. };
  1473. enterHooks.delayedLeave = delayedLeave;
  1474. };
  1475. }
  1476. }
  1477. return child;
  1478. };
  1479. }
  1480. };
  1481. const BaseTransition = BaseTransitionImpl;
  1482. function getLeavingNodesForType(state, vnode) {
  1483. const { leavingVNodes } = state;
  1484. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  1485. if (!leavingVNodesCache) {
  1486. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  1487. leavingVNodes.set(vnode.type, leavingVNodesCache);
  1488. }
  1489. return leavingVNodesCache;
  1490. }
  1491. function resolveTransitionHooks(vnode, props, state, instance) {
  1492. const {
  1493. appear,
  1494. mode,
  1495. persisted = false,
  1496. onBeforeEnter,
  1497. onEnter,
  1498. onAfterEnter,
  1499. onEnterCancelled,
  1500. onBeforeLeave,
  1501. onLeave,
  1502. onAfterLeave,
  1503. onLeaveCancelled,
  1504. onBeforeAppear,
  1505. onAppear,
  1506. onAfterAppear,
  1507. onAppearCancelled
  1508. } = props;
  1509. const key = String(vnode.key);
  1510. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  1511. const callHook = (hook, args) => {
  1512. hook && callWithAsyncErrorHandling(
  1513. hook,
  1514. instance,
  1515. 9,
  1516. args
  1517. );
  1518. };
  1519. const callAsyncHook = (hook, args) => {
  1520. const done = args[1];
  1521. callHook(hook, args);
  1522. if (shared.isArray(hook)) {
  1523. if (hook.every((hook2) => hook2.length <= 1))
  1524. done();
  1525. } else if (hook.length <= 1) {
  1526. done();
  1527. }
  1528. };
  1529. const hooks = {
  1530. mode,
  1531. persisted,
  1532. beforeEnter(el) {
  1533. let hook = onBeforeEnter;
  1534. if (!state.isMounted) {
  1535. if (appear) {
  1536. hook = onBeforeAppear || onBeforeEnter;
  1537. } else {
  1538. return;
  1539. }
  1540. }
  1541. if (el._leaveCb) {
  1542. el._leaveCb(
  1543. true
  1544. /* cancelled */
  1545. );
  1546. }
  1547. const leavingVNode = leavingVNodesCache[key];
  1548. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) {
  1549. leavingVNode.el._leaveCb();
  1550. }
  1551. callHook(hook, [el]);
  1552. },
  1553. enter(el) {
  1554. let hook = onEnter;
  1555. let afterHook = onAfterEnter;
  1556. let cancelHook = onEnterCancelled;
  1557. if (!state.isMounted) {
  1558. if (appear) {
  1559. hook = onAppear || onEnter;
  1560. afterHook = onAfterAppear || onAfterEnter;
  1561. cancelHook = onAppearCancelled || onEnterCancelled;
  1562. } else {
  1563. return;
  1564. }
  1565. }
  1566. let called = false;
  1567. const done = el._enterCb = (cancelled) => {
  1568. if (called)
  1569. return;
  1570. called = true;
  1571. if (cancelled) {
  1572. callHook(cancelHook, [el]);
  1573. } else {
  1574. callHook(afterHook, [el]);
  1575. }
  1576. if (hooks.delayedLeave) {
  1577. hooks.delayedLeave();
  1578. }
  1579. el._enterCb = void 0;
  1580. };
  1581. if (hook) {
  1582. callAsyncHook(hook, [el, done]);
  1583. } else {
  1584. done();
  1585. }
  1586. },
  1587. leave(el, remove) {
  1588. const key2 = String(vnode.key);
  1589. if (el._enterCb) {
  1590. el._enterCb(
  1591. true
  1592. /* cancelled */
  1593. );
  1594. }
  1595. if (state.isUnmounting) {
  1596. return remove();
  1597. }
  1598. callHook(onBeforeLeave, [el]);
  1599. let called = false;
  1600. const done = el._leaveCb = (cancelled) => {
  1601. if (called)
  1602. return;
  1603. called = true;
  1604. remove();
  1605. if (cancelled) {
  1606. callHook(onLeaveCancelled, [el]);
  1607. } else {
  1608. callHook(onAfterLeave, [el]);
  1609. }
  1610. el._leaveCb = void 0;
  1611. if (leavingVNodesCache[key2] === vnode) {
  1612. delete leavingVNodesCache[key2];
  1613. }
  1614. };
  1615. leavingVNodesCache[key2] = vnode;
  1616. if (onLeave) {
  1617. callAsyncHook(onLeave, [el, done]);
  1618. } else {
  1619. done();
  1620. }
  1621. },
  1622. clone(vnode2) {
  1623. return resolveTransitionHooks(vnode2, props, state, instance);
  1624. }
  1625. };
  1626. return hooks;
  1627. }
  1628. function emptyPlaceholder(vnode) {
  1629. if (isKeepAlive(vnode)) {
  1630. vnode = cloneVNode(vnode);
  1631. vnode.children = null;
  1632. return vnode;
  1633. }
  1634. }
  1635. function getKeepAliveChild(vnode) {
  1636. return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
  1637. }
  1638. function setTransitionHooks(vnode, hooks) {
  1639. if (vnode.shapeFlag & 6 && vnode.component) {
  1640. setTransitionHooks(vnode.component.subTree, hooks);
  1641. } else if (vnode.shapeFlag & 128) {
  1642. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  1643. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  1644. } else {
  1645. vnode.transition = hooks;
  1646. }
  1647. }
  1648. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  1649. let ret = [];
  1650. let keyedFragmentCount = 0;
  1651. for (let i = 0; i < children.length; i++) {
  1652. let child = children[i];
  1653. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  1654. if (child.type === Fragment) {
  1655. if (child.patchFlag & 128)
  1656. keyedFragmentCount++;
  1657. ret = ret.concat(
  1658. getTransitionRawChildren(child.children, keepComment, key)
  1659. );
  1660. } else if (keepComment || child.type !== Comment) {
  1661. ret.push(key != null ? cloneVNode(child, { key }) : child);
  1662. }
  1663. }
  1664. if (keyedFragmentCount > 1) {
  1665. for (let i = 0; i < ret.length; i++) {
  1666. ret[i].patchFlag = -2;
  1667. }
  1668. }
  1669. return ret;
  1670. }
  1671. function defineComponent(options, extraOptions) {
  1672. return shared.isFunction(options) ? (
  1673. // #8326: extend call and options.name access are considered side-effects
  1674. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  1675. /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
  1676. ) : options;
  1677. }
  1678. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  1679. function defineAsyncComponent(source) {
  1680. if (shared.isFunction(source)) {
  1681. source = { loader: source };
  1682. }
  1683. const {
  1684. loader,
  1685. loadingComponent,
  1686. errorComponent,
  1687. delay = 200,
  1688. timeout,
  1689. // undefined = never times out
  1690. suspensible = true,
  1691. onError: userOnError
  1692. } = source;
  1693. let pendingRequest = null;
  1694. let resolvedComp;
  1695. let retries = 0;
  1696. const retry = () => {
  1697. retries++;
  1698. pendingRequest = null;
  1699. return load();
  1700. };
  1701. const load = () => {
  1702. let thisRequest;
  1703. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  1704. err = err instanceof Error ? err : new Error(String(err));
  1705. if (userOnError) {
  1706. return new Promise((resolve, reject) => {
  1707. const userRetry = () => resolve(retry());
  1708. const userFail = () => reject(err);
  1709. userOnError(err, userRetry, userFail, retries + 1);
  1710. });
  1711. } else {
  1712. throw err;
  1713. }
  1714. }).then((comp) => {
  1715. if (thisRequest !== pendingRequest && pendingRequest) {
  1716. return pendingRequest;
  1717. }
  1718. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  1719. comp = comp.default;
  1720. }
  1721. resolvedComp = comp;
  1722. return comp;
  1723. }));
  1724. };
  1725. return defineComponent({
  1726. name: "AsyncComponentWrapper",
  1727. __asyncLoader: load,
  1728. get __asyncResolved() {
  1729. return resolvedComp;
  1730. },
  1731. setup() {
  1732. const instance = currentInstance;
  1733. if (resolvedComp) {
  1734. return () => createInnerComp(resolvedComp, instance);
  1735. }
  1736. const onError = (err) => {
  1737. pendingRequest = null;
  1738. handleError(
  1739. err,
  1740. instance,
  1741. 13,
  1742. !errorComponent
  1743. /* do not throw in dev if user provided error component */
  1744. );
  1745. };
  1746. if (suspensible && instance.suspense || isInSSRComponentSetup) {
  1747. return load().then((comp) => {
  1748. return () => createInnerComp(comp, instance);
  1749. }).catch((err) => {
  1750. onError(err);
  1751. return () => errorComponent ? createVNode(errorComponent, {
  1752. error: err
  1753. }) : null;
  1754. });
  1755. }
  1756. const loaded = reactivity.ref(false);
  1757. const error = reactivity.ref();
  1758. const delayed = reactivity.ref(!!delay);
  1759. if (delay) {
  1760. setTimeout(() => {
  1761. delayed.value = false;
  1762. }, delay);
  1763. }
  1764. if (timeout != null) {
  1765. setTimeout(() => {
  1766. if (!loaded.value && !error.value) {
  1767. const err = new Error(
  1768. `Async component timed out after ${timeout}ms.`
  1769. );
  1770. onError(err);
  1771. error.value = err;
  1772. }
  1773. }, timeout);
  1774. }
  1775. load().then(() => {
  1776. loaded.value = true;
  1777. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  1778. queueJob(instance.parent.update);
  1779. }
  1780. }).catch((err) => {
  1781. onError(err);
  1782. error.value = err;
  1783. });
  1784. return () => {
  1785. if (loaded.value && resolvedComp) {
  1786. return createInnerComp(resolvedComp, instance);
  1787. } else if (error.value && errorComponent) {
  1788. return createVNode(errorComponent, {
  1789. error: error.value
  1790. });
  1791. } else if (loadingComponent && !delayed.value) {
  1792. return createVNode(loadingComponent);
  1793. }
  1794. };
  1795. }
  1796. });
  1797. }
  1798. function createInnerComp(comp, parent) {
  1799. const { ref: ref2, props, children, ce } = parent.vnode;
  1800. const vnode = createVNode(comp, props, children);
  1801. vnode.ref = ref2;
  1802. vnode.ce = ce;
  1803. delete parent.vnode.ce;
  1804. return vnode;
  1805. }
  1806. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  1807. const KeepAliveImpl = {
  1808. name: `KeepAlive`,
  1809. // Marker for special handling inside the renderer. We are not using a ===
  1810. // check directly on KeepAlive in the renderer, because importing it directly
  1811. // would prevent it from being tree-shaken.
  1812. __isKeepAlive: true,
  1813. props: {
  1814. include: [String, RegExp, Array],
  1815. exclude: [String, RegExp, Array],
  1816. max: [String, Number]
  1817. },
  1818. setup(props, { slots }) {
  1819. const instance = getCurrentInstance();
  1820. const sharedContext = instance.ctx;
  1821. if (!sharedContext.renderer) {
  1822. return () => {
  1823. const children = slots.default && slots.default();
  1824. return children && children.length === 1 ? children[0] : children;
  1825. };
  1826. }
  1827. const cache = /* @__PURE__ */ new Map();
  1828. const keys = /* @__PURE__ */ new Set();
  1829. let current = null;
  1830. const parentSuspense = instance.suspense;
  1831. const {
  1832. renderer: {
  1833. p: patch,
  1834. m: move,
  1835. um: _unmount,
  1836. o: { createElement }
  1837. }
  1838. } = sharedContext;
  1839. const storageContainer = createElement("div");
  1840. sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
  1841. const instance2 = vnode.component;
  1842. move(vnode, container, anchor, 0, parentSuspense);
  1843. patch(
  1844. instance2.vnode,
  1845. vnode,
  1846. container,
  1847. anchor,
  1848. instance2,
  1849. parentSuspense,
  1850. isSVG,
  1851. vnode.slotScopeIds,
  1852. optimized
  1853. );
  1854. queuePostRenderEffect(() => {
  1855. instance2.isDeactivated = false;
  1856. if (instance2.a) {
  1857. shared.invokeArrayFns(instance2.a);
  1858. }
  1859. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  1860. if (vnodeHook) {
  1861. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  1862. }
  1863. }, parentSuspense);
  1864. };
  1865. sharedContext.deactivate = (vnode) => {
  1866. const instance2 = vnode.component;
  1867. move(vnode, storageContainer, null, 1, parentSuspense);
  1868. queuePostRenderEffect(() => {
  1869. if (instance2.da) {
  1870. shared.invokeArrayFns(instance2.da);
  1871. }
  1872. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  1873. if (vnodeHook) {
  1874. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  1875. }
  1876. instance2.isDeactivated = true;
  1877. }, parentSuspense);
  1878. };
  1879. function unmount(vnode) {
  1880. resetShapeFlag(vnode);
  1881. _unmount(vnode, instance, parentSuspense, true);
  1882. }
  1883. function pruneCache(filter) {
  1884. cache.forEach((vnode, key) => {
  1885. const name = getComponentName(vnode.type);
  1886. if (name && (!filter || !filter(name))) {
  1887. pruneCacheEntry(key);
  1888. }
  1889. });
  1890. }
  1891. function pruneCacheEntry(key) {
  1892. const cached = cache.get(key);
  1893. if (!current || !isSameVNodeType(cached, current)) {
  1894. unmount(cached);
  1895. } else if (current) {
  1896. resetShapeFlag(current);
  1897. }
  1898. cache.delete(key);
  1899. keys.delete(key);
  1900. }
  1901. watch(
  1902. () => [props.include, props.exclude],
  1903. ([include, exclude]) => {
  1904. include && pruneCache((name) => matches(include, name));
  1905. exclude && pruneCache((name) => !matches(exclude, name));
  1906. },
  1907. // prune post-render after `current` has been updated
  1908. { flush: "post", deep: true }
  1909. );
  1910. let pendingCacheKey = null;
  1911. const cacheSubtree = () => {
  1912. if (pendingCacheKey != null) {
  1913. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  1914. }
  1915. };
  1916. onMounted(cacheSubtree);
  1917. onUpdated(cacheSubtree);
  1918. onBeforeUnmount(() => {
  1919. cache.forEach((cached) => {
  1920. const { subTree, suspense } = instance;
  1921. const vnode = getInnerChild(subTree);
  1922. if (cached.type === vnode.type && cached.key === vnode.key) {
  1923. resetShapeFlag(vnode);
  1924. const da = vnode.component.da;
  1925. da && queuePostRenderEffect(da, suspense);
  1926. return;
  1927. }
  1928. unmount(cached);
  1929. });
  1930. });
  1931. return () => {
  1932. pendingCacheKey = null;
  1933. if (!slots.default) {
  1934. return null;
  1935. }
  1936. const children = slots.default();
  1937. const rawVNode = children[0];
  1938. if (children.length > 1) {
  1939. current = null;
  1940. return children;
  1941. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  1942. current = null;
  1943. return rawVNode;
  1944. }
  1945. let vnode = getInnerChild(rawVNode);
  1946. const comp = vnode.type;
  1947. const name = getComponentName(
  1948. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  1949. );
  1950. const { include, exclude, max } = props;
  1951. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  1952. current = vnode;
  1953. return rawVNode;
  1954. }
  1955. const key = vnode.key == null ? comp : vnode.key;
  1956. const cachedVNode = cache.get(key);
  1957. if (vnode.el) {
  1958. vnode = cloneVNode(vnode);
  1959. if (rawVNode.shapeFlag & 128) {
  1960. rawVNode.ssContent = vnode;
  1961. }
  1962. }
  1963. pendingCacheKey = key;
  1964. if (cachedVNode) {
  1965. vnode.el = cachedVNode.el;
  1966. vnode.component = cachedVNode.component;
  1967. if (vnode.transition) {
  1968. setTransitionHooks(vnode, vnode.transition);
  1969. }
  1970. vnode.shapeFlag |= 512;
  1971. keys.delete(key);
  1972. keys.add(key);
  1973. } else {
  1974. keys.add(key);
  1975. if (max && keys.size > parseInt(max, 10)) {
  1976. pruneCacheEntry(keys.values().next().value);
  1977. }
  1978. }
  1979. vnode.shapeFlag |= 256;
  1980. current = vnode;
  1981. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  1982. };
  1983. }
  1984. };
  1985. const KeepAlive = KeepAliveImpl;
  1986. function matches(pattern, name) {
  1987. if (shared.isArray(pattern)) {
  1988. return pattern.some((p) => matches(p, name));
  1989. } else if (shared.isString(pattern)) {
  1990. return pattern.split(",").includes(name);
  1991. } else if (shared.isRegExp(pattern)) {
  1992. return pattern.test(name);
  1993. }
  1994. return false;
  1995. }
  1996. function onActivated(hook, target) {
  1997. registerKeepAliveHook(hook, "a", target);
  1998. }
  1999. function onDeactivated(hook, target) {
  2000. registerKeepAliveHook(hook, "da", target);
  2001. }
  2002. function registerKeepAliveHook(hook, type, target = currentInstance) {
  2003. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  2004. let current = target;
  2005. while (current) {
  2006. if (current.isDeactivated) {
  2007. return;
  2008. }
  2009. current = current.parent;
  2010. }
  2011. return hook();
  2012. });
  2013. injectHook(type, wrappedHook, target);
  2014. if (target) {
  2015. let current = target.parent;
  2016. while (current && current.parent) {
  2017. if (isKeepAlive(current.parent.vnode)) {
  2018. injectToKeepAliveRoot(wrappedHook, type, target, current);
  2019. }
  2020. current = current.parent;
  2021. }
  2022. }
  2023. }
  2024. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  2025. const injected = injectHook(
  2026. type,
  2027. hook,
  2028. keepAliveRoot,
  2029. true
  2030. /* prepend */
  2031. );
  2032. onUnmounted(() => {
  2033. shared.remove(keepAliveRoot[type], injected);
  2034. }, target);
  2035. }
  2036. function resetShapeFlag(vnode) {
  2037. vnode.shapeFlag &= ~256;
  2038. vnode.shapeFlag &= ~512;
  2039. }
  2040. function getInnerChild(vnode) {
  2041. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  2042. }
  2043. function injectHook(type, hook, target = currentInstance, prepend = false) {
  2044. if (target) {
  2045. const hooks = target[type] || (target[type] = []);
  2046. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  2047. if (target.isUnmounted) {
  2048. return;
  2049. }
  2050. reactivity.pauseTracking();
  2051. setCurrentInstance(target);
  2052. const res = callWithAsyncErrorHandling(hook, target, type, args);
  2053. unsetCurrentInstance();
  2054. reactivity.resetTracking();
  2055. return res;
  2056. });
  2057. if (prepend) {
  2058. hooks.unshift(wrappedHook);
  2059. } else {
  2060. hooks.push(wrappedHook);
  2061. }
  2062. return wrappedHook;
  2063. }
  2064. }
  2065. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  2066. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  2067. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  2068. );
  2069. const onBeforeMount = createHook("bm");
  2070. const onMounted = createHook("m");
  2071. const onBeforeUpdate = createHook("bu");
  2072. const onUpdated = createHook("u");
  2073. const onBeforeUnmount = createHook("bum");
  2074. const onUnmounted = createHook("um");
  2075. const onServerPrefetch = createHook("sp");
  2076. const onRenderTriggered = createHook(
  2077. "rtg"
  2078. );
  2079. const onRenderTracked = createHook(
  2080. "rtc"
  2081. );
  2082. function onErrorCaptured(hook, target = currentInstance) {
  2083. injectHook("ec", hook, target);
  2084. }
  2085. const COMPONENTS = "components";
  2086. const DIRECTIVES = "directives";
  2087. function resolveComponent(name, maybeSelfReference) {
  2088. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  2089. }
  2090. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  2091. function resolveDynamicComponent(component) {
  2092. if (shared.isString(component)) {
  2093. return resolveAsset(COMPONENTS, component, false) || component;
  2094. } else {
  2095. return component || NULL_DYNAMIC_COMPONENT;
  2096. }
  2097. }
  2098. function resolveDirective(name) {
  2099. return resolveAsset(DIRECTIVES, name);
  2100. }
  2101. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  2102. const instance = currentRenderingInstance || currentInstance;
  2103. if (instance) {
  2104. const Component = instance.type;
  2105. if (type === COMPONENTS) {
  2106. const selfName = getComponentName(
  2107. Component,
  2108. false
  2109. /* do not include inferred name to avoid breaking existing code */
  2110. );
  2111. if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
  2112. return Component;
  2113. }
  2114. }
  2115. const res = (
  2116. // local registration
  2117. // check instance[type] first which is resolved for options API
  2118. resolve(instance[type] || Component[type], name) || // global registration
  2119. resolve(instance.appContext[type], name)
  2120. );
  2121. if (!res && maybeSelfReference) {
  2122. return Component;
  2123. }
  2124. return res;
  2125. }
  2126. }
  2127. function resolve(registry, name) {
  2128. return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
  2129. }
  2130. function renderList(source, renderItem, cache, index) {
  2131. let ret;
  2132. const cached = cache && cache[index];
  2133. if (shared.isArray(source) || shared.isString(source)) {
  2134. ret = new Array(source.length);
  2135. for (let i = 0, l = source.length; i < l; i++) {
  2136. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  2137. }
  2138. } else if (typeof source === "number") {
  2139. ret = new Array(source);
  2140. for (let i = 0; i < source; i++) {
  2141. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  2142. }
  2143. } else if (shared.isObject(source)) {
  2144. if (source[Symbol.iterator]) {
  2145. ret = Array.from(
  2146. source,
  2147. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  2148. );
  2149. } else {
  2150. const keys = Object.keys(source);
  2151. ret = new Array(keys.length);
  2152. for (let i = 0, l = keys.length; i < l; i++) {
  2153. const key = keys[i];
  2154. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  2155. }
  2156. }
  2157. } else {
  2158. ret = [];
  2159. }
  2160. if (cache) {
  2161. cache[index] = ret;
  2162. }
  2163. return ret;
  2164. }
  2165. function createSlots(slots, dynamicSlots) {
  2166. for (let i = 0; i < dynamicSlots.length; i++) {
  2167. const slot = dynamicSlots[i];
  2168. if (shared.isArray(slot)) {
  2169. for (let j = 0; j < slot.length; j++) {
  2170. slots[slot[j].name] = slot[j].fn;
  2171. }
  2172. } else if (slot) {
  2173. slots[slot.name] = slot.key ? (...args) => {
  2174. const res = slot.fn(...args);
  2175. if (res)
  2176. res.key = slot.key;
  2177. return res;
  2178. } : slot.fn;
  2179. }
  2180. }
  2181. return slots;
  2182. }
  2183. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  2184. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  2185. if (name !== "default")
  2186. props.name = name;
  2187. return createVNode("slot", props, fallback && fallback());
  2188. }
  2189. let slot = slots[name];
  2190. if (slot && slot._c) {
  2191. slot._d = false;
  2192. }
  2193. openBlock();
  2194. const validSlotContent = slot && ensureValidVNode(slot(props));
  2195. const rendered = createBlock(
  2196. Fragment,
  2197. {
  2198. key: props.key || // slot content array of a dynamic conditional slot may have a branch
  2199. // key attached in the `createSlots` helper, respect that
  2200. validSlotContent && validSlotContent.key || `_${name}`
  2201. },
  2202. validSlotContent || (fallback ? fallback() : []),
  2203. validSlotContent && slots._ === 1 ? 64 : -2
  2204. );
  2205. if (!noSlotted && rendered.scopeId) {
  2206. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  2207. }
  2208. if (slot && slot._c) {
  2209. slot._d = true;
  2210. }
  2211. return rendered;
  2212. }
  2213. function ensureValidVNode(vnodes) {
  2214. return vnodes.some((child) => {
  2215. if (!isVNode(child))
  2216. return true;
  2217. if (child.type === Comment)
  2218. return false;
  2219. if (child.type === Fragment && !ensureValidVNode(child.children))
  2220. return false;
  2221. return true;
  2222. }) ? vnodes : null;
  2223. }
  2224. function toHandlers(obj, preserveCaseIfNecessary) {
  2225. const ret = {};
  2226. for (const key in obj) {
  2227. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : shared.toHandlerKey(key)] = obj[key];
  2228. }
  2229. return ret;
  2230. }
  2231. const getPublicInstance = (i) => {
  2232. if (!i)
  2233. return null;
  2234. if (isStatefulComponent(i))
  2235. return getExposeProxy(i) || i.proxy;
  2236. return getPublicInstance(i.parent);
  2237. };
  2238. const publicPropertiesMap = (
  2239. // Move PURE marker to new line to workaround compiler discarding it
  2240. // due to type annotation
  2241. /* @__PURE__ */ shared.extend(/* @__PURE__ */ Object.create(null), {
  2242. $: (i) => i,
  2243. $el: (i) => i.vnode.el,
  2244. $data: (i) => i.data,
  2245. $props: (i) => i.props,
  2246. $attrs: (i) => i.attrs,
  2247. $slots: (i) => i.slots,
  2248. $refs: (i) => i.refs,
  2249. $parent: (i) => getPublicInstance(i.parent),
  2250. $root: (i) => getPublicInstance(i.root),
  2251. $emit: (i) => i.emit,
  2252. $options: (i) => resolveMergedOptions(i) ,
  2253. $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
  2254. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  2255. $watch: (i) => instanceWatch.bind(i)
  2256. })
  2257. );
  2258. const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
  2259. const PublicInstanceProxyHandlers = {
  2260. get({ _: instance }, key) {
  2261. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  2262. let normalizedProps;
  2263. if (key[0] !== "$") {
  2264. const n = accessCache[key];
  2265. if (n !== void 0) {
  2266. switch (n) {
  2267. case 1 /* SETUP */:
  2268. return setupState[key];
  2269. case 2 /* DATA */:
  2270. return data[key];
  2271. case 4 /* CONTEXT */:
  2272. return ctx[key];
  2273. case 3 /* PROPS */:
  2274. return props[key];
  2275. }
  2276. } else if (hasSetupBinding(setupState, key)) {
  2277. accessCache[key] = 1 /* SETUP */;
  2278. return setupState[key];
  2279. } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
  2280. accessCache[key] = 2 /* DATA */;
  2281. return data[key];
  2282. } else if (
  2283. // only cache other properties when instance has declared (thus stable)
  2284. // props
  2285. (normalizedProps = instance.propsOptions[0]) && shared.hasOwn(normalizedProps, key)
  2286. ) {
  2287. accessCache[key] = 3 /* PROPS */;
  2288. return props[key];
  2289. } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
  2290. accessCache[key] = 4 /* CONTEXT */;
  2291. return ctx[key];
  2292. } else if (shouldCacheAccess) {
  2293. accessCache[key] = 0 /* OTHER */;
  2294. }
  2295. }
  2296. const publicGetter = publicPropertiesMap[key];
  2297. let cssModule, globalProperties;
  2298. if (publicGetter) {
  2299. if (key === "$attrs") {
  2300. reactivity.track(instance, "get", key);
  2301. }
  2302. return publicGetter(instance);
  2303. } else if (
  2304. // css module (injected by vue-loader)
  2305. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  2306. ) {
  2307. return cssModule;
  2308. } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
  2309. accessCache[key] = 4 /* CONTEXT */;
  2310. return ctx[key];
  2311. } else if (
  2312. // global properties
  2313. globalProperties = appContext.config.globalProperties, shared.hasOwn(globalProperties, key)
  2314. ) {
  2315. {
  2316. return globalProperties[key];
  2317. }
  2318. } else ;
  2319. },
  2320. set({ _: instance }, key, value) {
  2321. const { data, setupState, ctx } = instance;
  2322. if (hasSetupBinding(setupState, key)) {
  2323. setupState[key] = value;
  2324. return true;
  2325. } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
  2326. data[key] = value;
  2327. return true;
  2328. } else if (shared.hasOwn(instance.props, key)) {
  2329. return false;
  2330. }
  2331. if (key[0] === "$" && key.slice(1) in instance) {
  2332. return false;
  2333. } else {
  2334. {
  2335. ctx[key] = value;
  2336. }
  2337. }
  2338. return true;
  2339. },
  2340. has({
  2341. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  2342. }, key) {
  2343. let normalizedProps;
  2344. return !!accessCache[key] || data !== shared.EMPTY_OBJ && shared.hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key) || shared.hasOwn(ctx, key) || shared.hasOwn(publicPropertiesMap, key) || shared.hasOwn(appContext.config.globalProperties, key);
  2345. },
  2346. defineProperty(target, key, descriptor) {
  2347. if (descriptor.get != null) {
  2348. target._.accessCache[key] = 0;
  2349. } else if (shared.hasOwn(descriptor, "value")) {
  2350. this.set(target, key, descriptor.value, null);
  2351. }
  2352. return Reflect.defineProperty(target, key, descriptor);
  2353. }
  2354. };
  2355. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ shared.extend(
  2356. {},
  2357. PublicInstanceProxyHandlers,
  2358. {
  2359. get(target, key) {
  2360. if (key === Symbol.unscopables) {
  2361. return;
  2362. }
  2363. return PublicInstanceProxyHandlers.get(target, key, target);
  2364. },
  2365. has(_, key) {
  2366. const has = key[0] !== "_" && !shared.isGloballyWhitelisted(key);
  2367. return has;
  2368. }
  2369. }
  2370. );
  2371. function defineProps() {
  2372. return null;
  2373. }
  2374. function defineEmits() {
  2375. return null;
  2376. }
  2377. function defineExpose(exposed) {
  2378. }
  2379. function defineOptions(options) {
  2380. }
  2381. function defineSlots() {
  2382. return null;
  2383. }
  2384. function defineModel() {
  2385. }
  2386. function withDefaults(props, defaults) {
  2387. return null;
  2388. }
  2389. function useSlots() {
  2390. return getContext().slots;
  2391. }
  2392. function useAttrs() {
  2393. return getContext().attrs;
  2394. }
  2395. function useModel(props, name, options) {
  2396. const i = getCurrentInstance();
  2397. if (options && options.local) {
  2398. const proxy = reactivity.ref(props[name]);
  2399. watch(
  2400. () => props[name],
  2401. (v) => proxy.value = v
  2402. );
  2403. watch(proxy, (value) => {
  2404. if (value !== props[name]) {
  2405. i.emit(`update:${name}`, value);
  2406. }
  2407. });
  2408. return proxy;
  2409. } else {
  2410. return {
  2411. __v_isRef: true,
  2412. get value() {
  2413. return props[name];
  2414. },
  2415. set value(value) {
  2416. i.emit(`update:${name}`, value);
  2417. }
  2418. };
  2419. }
  2420. }
  2421. function getContext() {
  2422. const i = getCurrentInstance();
  2423. return i.setupContext || (i.setupContext = createSetupContext(i));
  2424. }
  2425. function normalizePropsOrEmits(props) {
  2426. return shared.isArray(props) ? props.reduce(
  2427. (normalized, p) => (normalized[p] = null, normalized),
  2428. {}
  2429. ) : props;
  2430. }
  2431. function mergeDefaults(raw, defaults) {
  2432. const props = normalizePropsOrEmits(raw);
  2433. for (const key in defaults) {
  2434. if (key.startsWith("__skip"))
  2435. continue;
  2436. let opt = props[key];
  2437. if (opt) {
  2438. if (shared.isArray(opt) || shared.isFunction(opt)) {
  2439. opt = props[key] = { type: opt, default: defaults[key] };
  2440. } else {
  2441. opt.default = defaults[key];
  2442. }
  2443. } else if (opt === null) {
  2444. opt = props[key] = { default: defaults[key] };
  2445. } else ;
  2446. if (opt && defaults[`__skip_${key}`]) {
  2447. opt.skipFactory = true;
  2448. }
  2449. }
  2450. return props;
  2451. }
  2452. function mergeModels(a, b) {
  2453. if (!a || !b)
  2454. return a || b;
  2455. if (shared.isArray(a) && shared.isArray(b))
  2456. return a.concat(b);
  2457. return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  2458. }
  2459. function createPropsRestProxy(props, excludedKeys) {
  2460. const ret = {};
  2461. for (const key in props) {
  2462. if (!excludedKeys.includes(key)) {
  2463. Object.defineProperty(ret, key, {
  2464. enumerable: true,
  2465. get: () => props[key]
  2466. });
  2467. }
  2468. }
  2469. return ret;
  2470. }
  2471. function withAsyncContext(getAwaitable) {
  2472. const ctx = getCurrentInstance();
  2473. let awaitable = getAwaitable();
  2474. unsetCurrentInstance();
  2475. if (shared.isPromise(awaitable)) {
  2476. awaitable = awaitable.catch((e) => {
  2477. setCurrentInstance(ctx);
  2478. throw e;
  2479. });
  2480. }
  2481. return [awaitable, () => setCurrentInstance(ctx)];
  2482. }
  2483. let shouldCacheAccess = true;
  2484. function applyOptions(instance) {
  2485. const options = resolveMergedOptions(instance);
  2486. const publicThis = instance.proxy;
  2487. const ctx = instance.ctx;
  2488. shouldCacheAccess = false;
  2489. if (options.beforeCreate) {
  2490. callHook(options.beforeCreate, instance, "bc");
  2491. }
  2492. const {
  2493. // state
  2494. data: dataOptions,
  2495. computed: computedOptions,
  2496. methods,
  2497. watch: watchOptions,
  2498. provide: provideOptions,
  2499. inject: injectOptions,
  2500. // lifecycle
  2501. created,
  2502. beforeMount,
  2503. mounted,
  2504. beforeUpdate,
  2505. updated,
  2506. activated,
  2507. deactivated,
  2508. beforeDestroy,
  2509. beforeUnmount,
  2510. destroyed,
  2511. unmounted,
  2512. render,
  2513. renderTracked,
  2514. renderTriggered,
  2515. errorCaptured,
  2516. serverPrefetch,
  2517. // public API
  2518. expose,
  2519. inheritAttrs,
  2520. // assets
  2521. components,
  2522. directives,
  2523. filters
  2524. } = options;
  2525. const checkDuplicateProperties = null;
  2526. if (injectOptions) {
  2527. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  2528. }
  2529. if (methods) {
  2530. for (const key in methods) {
  2531. const methodHandler = methods[key];
  2532. if (shared.isFunction(methodHandler)) {
  2533. {
  2534. ctx[key] = methodHandler.bind(publicThis);
  2535. }
  2536. }
  2537. }
  2538. }
  2539. if (dataOptions) {
  2540. const data = dataOptions.call(publicThis, publicThis);
  2541. if (!shared.isObject(data)) ; else {
  2542. instance.data = reactivity.reactive(data);
  2543. }
  2544. }
  2545. shouldCacheAccess = true;
  2546. if (computedOptions) {
  2547. for (const key in computedOptions) {
  2548. const opt = computedOptions[key];
  2549. const get = shared.isFunction(opt) ? opt.bind(publicThis, publicThis) : shared.isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : shared.NOOP;
  2550. const set = !shared.isFunction(opt) && shared.isFunction(opt.set) ? opt.set.bind(publicThis) : shared.NOOP;
  2551. const c = computed({
  2552. get,
  2553. set
  2554. });
  2555. Object.defineProperty(ctx, key, {
  2556. enumerable: true,
  2557. configurable: true,
  2558. get: () => c.value,
  2559. set: (v) => c.value = v
  2560. });
  2561. }
  2562. }
  2563. if (watchOptions) {
  2564. for (const key in watchOptions) {
  2565. createWatcher(watchOptions[key], ctx, publicThis, key);
  2566. }
  2567. }
  2568. if (provideOptions) {
  2569. const provides = shared.isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  2570. Reflect.ownKeys(provides).forEach((key) => {
  2571. provide(key, provides[key]);
  2572. });
  2573. }
  2574. if (created) {
  2575. callHook(created, instance, "c");
  2576. }
  2577. function registerLifecycleHook(register, hook) {
  2578. if (shared.isArray(hook)) {
  2579. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  2580. } else if (hook) {
  2581. register(hook.bind(publicThis));
  2582. }
  2583. }
  2584. registerLifecycleHook(onBeforeMount, beforeMount);
  2585. registerLifecycleHook(onMounted, mounted);
  2586. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  2587. registerLifecycleHook(onUpdated, updated);
  2588. registerLifecycleHook(onActivated, activated);
  2589. registerLifecycleHook(onDeactivated, deactivated);
  2590. registerLifecycleHook(onErrorCaptured, errorCaptured);
  2591. registerLifecycleHook(onRenderTracked, renderTracked);
  2592. registerLifecycleHook(onRenderTriggered, renderTriggered);
  2593. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  2594. registerLifecycleHook(onUnmounted, unmounted);
  2595. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  2596. if (shared.isArray(expose)) {
  2597. if (expose.length) {
  2598. const exposed = instance.exposed || (instance.exposed = {});
  2599. expose.forEach((key) => {
  2600. Object.defineProperty(exposed, key, {
  2601. get: () => publicThis[key],
  2602. set: (val) => publicThis[key] = val
  2603. });
  2604. });
  2605. } else if (!instance.exposed) {
  2606. instance.exposed = {};
  2607. }
  2608. }
  2609. if (render && instance.render === shared.NOOP) {
  2610. instance.render = render;
  2611. }
  2612. if (inheritAttrs != null) {
  2613. instance.inheritAttrs = inheritAttrs;
  2614. }
  2615. if (components)
  2616. instance.components = components;
  2617. if (directives)
  2618. instance.directives = directives;
  2619. }
  2620. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
  2621. if (shared.isArray(injectOptions)) {
  2622. injectOptions = normalizeInject(injectOptions);
  2623. }
  2624. for (const key in injectOptions) {
  2625. const opt = injectOptions[key];
  2626. let injected;
  2627. if (shared.isObject(opt)) {
  2628. if ("default" in opt) {
  2629. injected = inject(
  2630. opt.from || key,
  2631. opt.default,
  2632. true
  2633. /* treat default function as factory */
  2634. );
  2635. } else {
  2636. injected = inject(opt.from || key);
  2637. }
  2638. } else {
  2639. injected = inject(opt);
  2640. }
  2641. if (reactivity.isRef(injected)) {
  2642. Object.defineProperty(ctx, key, {
  2643. enumerable: true,
  2644. configurable: true,
  2645. get: () => injected.value,
  2646. set: (v) => injected.value = v
  2647. });
  2648. } else {
  2649. ctx[key] = injected;
  2650. }
  2651. }
  2652. }
  2653. function callHook(hook, instance, type) {
  2654. callWithAsyncErrorHandling(
  2655. shared.isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  2656. instance,
  2657. type
  2658. );
  2659. }
  2660. function createWatcher(raw, ctx, publicThis, key) {
  2661. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  2662. if (shared.isString(raw)) {
  2663. const handler = ctx[raw];
  2664. if (shared.isFunction(handler)) {
  2665. watch(getter, handler);
  2666. }
  2667. } else if (shared.isFunction(raw)) {
  2668. watch(getter, raw.bind(publicThis));
  2669. } else if (shared.isObject(raw)) {
  2670. if (shared.isArray(raw)) {
  2671. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  2672. } else {
  2673. const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  2674. if (shared.isFunction(handler)) {
  2675. watch(getter, handler, raw);
  2676. }
  2677. }
  2678. } else ;
  2679. }
  2680. function resolveMergedOptions(instance) {
  2681. const base = instance.type;
  2682. const { mixins, extends: extendsOptions } = base;
  2683. const {
  2684. mixins: globalMixins,
  2685. optionsCache: cache,
  2686. config: { optionMergeStrategies }
  2687. } = instance.appContext;
  2688. const cached = cache.get(base);
  2689. let resolved;
  2690. if (cached) {
  2691. resolved = cached;
  2692. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  2693. {
  2694. resolved = base;
  2695. }
  2696. } else {
  2697. resolved = {};
  2698. if (globalMixins.length) {
  2699. globalMixins.forEach(
  2700. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  2701. );
  2702. }
  2703. mergeOptions(resolved, base, optionMergeStrategies);
  2704. }
  2705. if (shared.isObject(base)) {
  2706. cache.set(base, resolved);
  2707. }
  2708. return resolved;
  2709. }
  2710. function mergeOptions(to, from, strats, asMixin = false) {
  2711. const { mixins, extends: extendsOptions } = from;
  2712. if (extendsOptions) {
  2713. mergeOptions(to, extendsOptions, strats, true);
  2714. }
  2715. if (mixins) {
  2716. mixins.forEach(
  2717. (m) => mergeOptions(to, m, strats, true)
  2718. );
  2719. }
  2720. for (const key in from) {
  2721. if (asMixin && key === "expose") ; else {
  2722. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  2723. to[key] = strat ? strat(to[key], from[key]) : from[key];
  2724. }
  2725. }
  2726. return to;
  2727. }
  2728. const internalOptionMergeStrats = {
  2729. data: mergeDataFn,
  2730. props: mergeEmitsOrPropsOptions,
  2731. emits: mergeEmitsOrPropsOptions,
  2732. // objects
  2733. methods: mergeObjectOptions,
  2734. computed: mergeObjectOptions,
  2735. // lifecycle
  2736. beforeCreate: mergeAsArray,
  2737. created: mergeAsArray,
  2738. beforeMount: mergeAsArray,
  2739. mounted: mergeAsArray,
  2740. beforeUpdate: mergeAsArray,
  2741. updated: mergeAsArray,
  2742. beforeDestroy: mergeAsArray,
  2743. beforeUnmount: mergeAsArray,
  2744. destroyed: mergeAsArray,
  2745. unmounted: mergeAsArray,
  2746. activated: mergeAsArray,
  2747. deactivated: mergeAsArray,
  2748. errorCaptured: mergeAsArray,
  2749. serverPrefetch: mergeAsArray,
  2750. // assets
  2751. components: mergeObjectOptions,
  2752. directives: mergeObjectOptions,
  2753. // watch
  2754. watch: mergeWatchOptions,
  2755. // provide / inject
  2756. provide: mergeDataFn,
  2757. inject: mergeInject
  2758. };
  2759. function mergeDataFn(to, from) {
  2760. if (!from) {
  2761. return to;
  2762. }
  2763. if (!to) {
  2764. return from;
  2765. }
  2766. return function mergedDataFn() {
  2767. return (shared.extend)(
  2768. shared.isFunction(to) ? to.call(this, this) : to,
  2769. shared.isFunction(from) ? from.call(this, this) : from
  2770. );
  2771. };
  2772. }
  2773. function mergeInject(to, from) {
  2774. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  2775. }
  2776. function normalizeInject(raw) {
  2777. if (shared.isArray(raw)) {
  2778. const res = {};
  2779. for (let i = 0; i < raw.length; i++) {
  2780. res[raw[i]] = raw[i];
  2781. }
  2782. return res;
  2783. }
  2784. return raw;
  2785. }
  2786. function mergeAsArray(to, from) {
  2787. return to ? [...new Set([].concat(to, from))] : from;
  2788. }
  2789. function mergeObjectOptions(to, from) {
  2790. return to ? shared.extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  2791. }
  2792. function mergeEmitsOrPropsOptions(to, from) {
  2793. if (to) {
  2794. if (shared.isArray(to) && shared.isArray(from)) {
  2795. return [.../* @__PURE__ */ new Set([...to, ...from])];
  2796. }
  2797. return shared.extend(
  2798. /* @__PURE__ */ Object.create(null),
  2799. normalizePropsOrEmits(to),
  2800. normalizePropsOrEmits(from != null ? from : {})
  2801. );
  2802. } else {
  2803. return from;
  2804. }
  2805. }
  2806. function mergeWatchOptions(to, from) {
  2807. if (!to)
  2808. return from;
  2809. if (!from)
  2810. return to;
  2811. const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
  2812. for (const key in from) {
  2813. merged[key] = mergeAsArray(to[key], from[key]);
  2814. }
  2815. return merged;
  2816. }
  2817. function createAppContext() {
  2818. return {
  2819. app: null,
  2820. config: {
  2821. isNativeTag: shared.NO,
  2822. performance: false,
  2823. globalProperties: {},
  2824. optionMergeStrategies: {},
  2825. errorHandler: void 0,
  2826. warnHandler: void 0,
  2827. compilerOptions: {}
  2828. },
  2829. mixins: [],
  2830. components: {},
  2831. directives: {},
  2832. provides: /* @__PURE__ */ Object.create(null),
  2833. optionsCache: /* @__PURE__ */ new WeakMap(),
  2834. propsCache: /* @__PURE__ */ new WeakMap(),
  2835. emitsCache: /* @__PURE__ */ new WeakMap()
  2836. };
  2837. }
  2838. let uid$1 = 0;
  2839. function createAppAPI(render, hydrate) {
  2840. return function createApp(rootComponent, rootProps = null) {
  2841. if (!shared.isFunction(rootComponent)) {
  2842. rootComponent = shared.extend({}, rootComponent);
  2843. }
  2844. if (rootProps != null && !shared.isObject(rootProps)) {
  2845. rootProps = null;
  2846. }
  2847. const context = createAppContext();
  2848. const installedPlugins = /* @__PURE__ */ new Set();
  2849. let isMounted = false;
  2850. const app = context.app = {
  2851. _uid: uid$1++,
  2852. _component: rootComponent,
  2853. _props: rootProps,
  2854. _container: null,
  2855. _context: context,
  2856. _instance: null,
  2857. version,
  2858. get config() {
  2859. return context.config;
  2860. },
  2861. set config(v) {
  2862. },
  2863. use(plugin, ...options) {
  2864. if (installedPlugins.has(plugin)) ; else if (plugin && shared.isFunction(plugin.install)) {
  2865. installedPlugins.add(plugin);
  2866. plugin.install(app, ...options);
  2867. } else if (shared.isFunction(plugin)) {
  2868. installedPlugins.add(plugin);
  2869. plugin(app, ...options);
  2870. } else ;
  2871. return app;
  2872. },
  2873. mixin(mixin) {
  2874. {
  2875. if (!context.mixins.includes(mixin)) {
  2876. context.mixins.push(mixin);
  2877. }
  2878. }
  2879. return app;
  2880. },
  2881. component(name, component) {
  2882. if (!component) {
  2883. return context.components[name];
  2884. }
  2885. context.components[name] = component;
  2886. return app;
  2887. },
  2888. directive(name, directive) {
  2889. if (!directive) {
  2890. return context.directives[name];
  2891. }
  2892. context.directives[name] = directive;
  2893. return app;
  2894. },
  2895. mount(rootContainer, isHydrate, isSVG) {
  2896. if (!isMounted) {
  2897. const vnode = createVNode(
  2898. rootComponent,
  2899. rootProps
  2900. );
  2901. vnode.appContext = context;
  2902. if (isHydrate && hydrate) {
  2903. hydrate(vnode, rootContainer);
  2904. } else {
  2905. render(vnode, rootContainer, isSVG);
  2906. }
  2907. isMounted = true;
  2908. app._container = rootContainer;
  2909. rootContainer.__vue_app__ = app;
  2910. return getExposeProxy(vnode.component) || vnode.component.proxy;
  2911. }
  2912. },
  2913. unmount() {
  2914. if (isMounted) {
  2915. render(null, app._container);
  2916. delete app._container.__vue_app__;
  2917. }
  2918. },
  2919. provide(key, value) {
  2920. context.provides[key] = value;
  2921. return app;
  2922. },
  2923. runWithContext(fn) {
  2924. currentApp = app;
  2925. try {
  2926. return fn();
  2927. } finally {
  2928. currentApp = null;
  2929. }
  2930. }
  2931. };
  2932. return app;
  2933. };
  2934. }
  2935. let currentApp = null;
  2936. function provide(key, value) {
  2937. if (!currentInstance) ; else {
  2938. let provides = currentInstance.provides;
  2939. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  2940. if (parentProvides === provides) {
  2941. provides = currentInstance.provides = Object.create(parentProvides);
  2942. }
  2943. provides[key] = value;
  2944. }
  2945. }
  2946. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  2947. const instance = currentInstance || currentRenderingInstance;
  2948. if (instance || currentApp) {
  2949. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  2950. if (provides && key in provides) {
  2951. return provides[key];
  2952. } else if (arguments.length > 1) {
  2953. return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  2954. } else ;
  2955. }
  2956. }
  2957. function hasInjectionContext() {
  2958. return !!(currentInstance || currentRenderingInstance || currentApp);
  2959. }
  2960. function initProps(instance, rawProps, isStateful, isSSR = false) {
  2961. const props = {};
  2962. const attrs = {};
  2963. shared.def(attrs, InternalObjectKey, 1);
  2964. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  2965. setFullProps(instance, rawProps, props, attrs);
  2966. for (const key in instance.propsOptions[0]) {
  2967. if (!(key in props)) {
  2968. props[key] = void 0;
  2969. }
  2970. }
  2971. if (isStateful) {
  2972. instance.props = isSSR ? props : reactivity.shallowReactive(props);
  2973. } else {
  2974. if (!instance.type.props) {
  2975. instance.props = attrs;
  2976. } else {
  2977. instance.props = props;
  2978. }
  2979. }
  2980. instance.attrs = attrs;
  2981. }
  2982. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  2983. const {
  2984. props,
  2985. attrs,
  2986. vnode: { patchFlag }
  2987. } = instance;
  2988. const rawCurrentProps = reactivity.toRaw(props);
  2989. const [options] = instance.propsOptions;
  2990. let hasAttrsChanged = false;
  2991. if (
  2992. // always force full diff in dev
  2993. // - #1942 if hmr is enabled with sfc component
  2994. // - vite#872 non-sfc component used by sfc component
  2995. (optimized || patchFlag > 0) && !(patchFlag & 16)
  2996. ) {
  2997. if (patchFlag & 8) {
  2998. const propsToUpdate = instance.vnode.dynamicProps;
  2999. for (let i = 0; i < propsToUpdate.length; i++) {
  3000. let key = propsToUpdate[i];
  3001. if (isEmitListener(instance.emitsOptions, key)) {
  3002. continue;
  3003. }
  3004. const value = rawProps[key];
  3005. if (options) {
  3006. if (shared.hasOwn(attrs, key)) {
  3007. if (value !== attrs[key]) {
  3008. attrs[key] = value;
  3009. hasAttrsChanged = true;
  3010. }
  3011. } else {
  3012. const camelizedKey = shared.camelize(key);
  3013. props[camelizedKey] = resolvePropValue(
  3014. options,
  3015. rawCurrentProps,
  3016. camelizedKey,
  3017. value,
  3018. instance,
  3019. false
  3020. /* isAbsent */
  3021. );
  3022. }
  3023. } else {
  3024. if (value !== attrs[key]) {
  3025. attrs[key] = value;
  3026. hasAttrsChanged = true;
  3027. }
  3028. }
  3029. }
  3030. }
  3031. } else {
  3032. if (setFullProps(instance, rawProps, props, attrs)) {
  3033. hasAttrsChanged = true;
  3034. }
  3035. let kebabKey;
  3036. for (const key in rawCurrentProps) {
  3037. if (!rawProps || // for camelCase
  3038. !shared.hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  3039. // and converted to camelCase (#955)
  3040. ((kebabKey = shared.hyphenate(key)) === key || !shared.hasOwn(rawProps, kebabKey))) {
  3041. if (options) {
  3042. if (rawPrevProps && // for camelCase
  3043. (rawPrevProps[key] !== void 0 || // for kebab-case
  3044. rawPrevProps[kebabKey] !== void 0)) {
  3045. props[key] = resolvePropValue(
  3046. options,
  3047. rawCurrentProps,
  3048. key,
  3049. void 0,
  3050. instance,
  3051. true
  3052. /* isAbsent */
  3053. );
  3054. }
  3055. } else {
  3056. delete props[key];
  3057. }
  3058. }
  3059. }
  3060. if (attrs !== rawCurrentProps) {
  3061. for (const key in attrs) {
  3062. if (!rawProps || !shared.hasOwn(rawProps, key) && true) {
  3063. delete attrs[key];
  3064. hasAttrsChanged = true;
  3065. }
  3066. }
  3067. }
  3068. }
  3069. if (hasAttrsChanged) {
  3070. reactivity.trigger(instance, "set", "$attrs");
  3071. }
  3072. }
  3073. function setFullProps(instance, rawProps, props, attrs) {
  3074. const [options, needCastKeys] = instance.propsOptions;
  3075. let hasAttrsChanged = false;
  3076. let rawCastValues;
  3077. if (rawProps) {
  3078. for (let key in rawProps) {
  3079. if (shared.isReservedProp(key)) {
  3080. continue;
  3081. }
  3082. const value = rawProps[key];
  3083. let camelKey;
  3084. if (options && shared.hasOwn(options, camelKey = shared.camelize(key))) {
  3085. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  3086. props[camelKey] = value;
  3087. } else {
  3088. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  3089. }
  3090. } else if (!isEmitListener(instance.emitsOptions, key)) {
  3091. if (!(key in attrs) || value !== attrs[key]) {
  3092. attrs[key] = value;
  3093. hasAttrsChanged = true;
  3094. }
  3095. }
  3096. }
  3097. }
  3098. if (needCastKeys) {
  3099. const rawCurrentProps = reactivity.toRaw(props);
  3100. const castValues = rawCastValues || shared.EMPTY_OBJ;
  3101. for (let i = 0; i < needCastKeys.length; i++) {
  3102. const key = needCastKeys[i];
  3103. props[key] = resolvePropValue(
  3104. options,
  3105. rawCurrentProps,
  3106. key,
  3107. castValues[key],
  3108. instance,
  3109. !shared.hasOwn(castValues, key)
  3110. );
  3111. }
  3112. }
  3113. return hasAttrsChanged;
  3114. }
  3115. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  3116. const opt = options[key];
  3117. if (opt != null) {
  3118. const hasDefault = shared.hasOwn(opt, "default");
  3119. if (hasDefault && value === void 0) {
  3120. const defaultValue = opt.default;
  3121. if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
  3122. const { propsDefaults } = instance;
  3123. if (key in propsDefaults) {
  3124. value = propsDefaults[key];
  3125. } else {
  3126. setCurrentInstance(instance);
  3127. value = propsDefaults[key] = defaultValue.call(
  3128. null,
  3129. props
  3130. );
  3131. unsetCurrentInstance();
  3132. }
  3133. } else {
  3134. value = defaultValue;
  3135. }
  3136. }
  3137. if (opt[0 /* shouldCast */]) {
  3138. if (isAbsent && !hasDefault) {
  3139. value = false;
  3140. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === shared.hyphenate(key))) {
  3141. value = true;
  3142. }
  3143. }
  3144. }
  3145. return value;
  3146. }
  3147. function normalizePropsOptions(comp, appContext, asMixin = false) {
  3148. const cache = appContext.propsCache;
  3149. const cached = cache.get(comp);
  3150. if (cached) {
  3151. return cached;
  3152. }
  3153. const raw = comp.props;
  3154. const normalized = {};
  3155. const needCastKeys = [];
  3156. let hasExtends = false;
  3157. if (!shared.isFunction(comp)) {
  3158. const extendProps = (raw2) => {
  3159. hasExtends = true;
  3160. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  3161. shared.extend(normalized, props);
  3162. if (keys)
  3163. needCastKeys.push(...keys);
  3164. };
  3165. if (!asMixin && appContext.mixins.length) {
  3166. appContext.mixins.forEach(extendProps);
  3167. }
  3168. if (comp.extends) {
  3169. extendProps(comp.extends);
  3170. }
  3171. if (comp.mixins) {
  3172. comp.mixins.forEach(extendProps);
  3173. }
  3174. }
  3175. if (!raw && !hasExtends) {
  3176. if (shared.isObject(comp)) {
  3177. cache.set(comp, shared.EMPTY_ARR);
  3178. }
  3179. return shared.EMPTY_ARR;
  3180. }
  3181. if (shared.isArray(raw)) {
  3182. for (let i = 0; i < raw.length; i++) {
  3183. const normalizedKey = shared.camelize(raw[i]);
  3184. if (validatePropName(normalizedKey)) {
  3185. normalized[normalizedKey] = shared.EMPTY_OBJ;
  3186. }
  3187. }
  3188. } else if (raw) {
  3189. for (const key in raw) {
  3190. const normalizedKey = shared.camelize(key);
  3191. if (validatePropName(normalizedKey)) {
  3192. const opt = raw[key];
  3193. const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
  3194. if (prop) {
  3195. const booleanIndex = getTypeIndex(Boolean, prop.type);
  3196. const stringIndex = getTypeIndex(String, prop.type);
  3197. prop[0 /* shouldCast */] = booleanIndex > -1;
  3198. prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  3199. if (booleanIndex > -1 || shared.hasOwn(prop, "default")) {
  3200. needCastKeys.push(normalizedKey);
  3201. }
  3202. }
  3203. }
  3204. }
  3205. }
  3206. const res = [normalized, needCastKeys];
  3207. if (shared.isObject(comp)) {
  3208. cache.set(comp, res);
  3209. }
  3210. return res;
  3211. }
  3212. function validatePropName(key) {
  3213. if (key[0] !== "$") {
  3214. return true;
  3215. }
  3216. return false;
  3217. }
  3218. function getType(ctor) {
  3219. const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  3220. return match ? match[2] : ctor === null ? "null" : "";
  3221. }
  3222. function isSameType(a, b) {
  3223. return getType(a) === getType(b);
  3224. }
  3225. function getTypeIndex(type, expectedTypes) {
  3226. if (shared.isArray(expectedTypes)) {
  3227. return expectedTypes.findIndex((t) => isSameType(t, type));
  3228. } else if (shared.isFunction(expectedTypes)) {
  3229. return isSameType(expectedTypes, type) ? 0 : -1;
  3230. }
  3231. return -1;
  3232. }
  3233. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  3234. const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  3235. const normalizeSlot = (key, rawSlot, ctx) => {
  3236. if (rawSlot._n) {
  3237. return rawSlot;
  3238. }
  3239. const normalized = withCtx((...args) => {
  3240. if (false) ;
  3241. return normalizeSlotValue(rawSlot(...args));
  3242. }, ctx);
  3243. normalized._c = false;
  3244. return normalized;
  3245. };
  3246. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  3247. const ctx = rawSlots._ctx;
  3248. for (const key in rawSlots) {
  3249. if (isInternalKey(key))
  3250. continue;
  3251. const value = rawSlots[key];
  3252. if (shared.isFunction(value)) {
  3253. slots[key] = normalizeSlot(key, value, ctx);
  3254. } else if (value != null) {
  3255. const normalized = normalizeSlotValue(value);
  3256. slots[key] = () => normalized;
  3257. }
  3258. }
  3259. };
  3260. const normalizeVNodeSlots = (instance, children) => {
  3261. const normalized = normalizeSlotValue(children);
  3262. instance.slots.default = () => normalized;
  3263. };
  3264. const initSlots = (instance, children) => {
  3265. if (instance.vnode.shapeFlag & 32) {
  3266. const type = children._;
  3267. if (type) {
  3268. instance.slots = reactivity.toRaw(children);
  3269. shared.def(children, "_", type);
  3270. } else {
  3271. normalizeObjectSlots(
  3272. children,
  3273. instance.slots = {});
  3274. }
  3275. } else {
  3276. instance.slots = {};
  3277. if (children) {
  3278. normalizeVNodeSlots(instance, children);
  3279. }
  3280. }
  3281. shared.def(instance.slots, InternalObjectKey, 1);
  3282. };
  3283. const updateSlots = (instance, children, optimized) => {
  3284. const { vnode, slots } = instance;
  3285. let needDeletionCheck = true;
  3286. let deletionComparisonTarget = shared.EMPTY_OBJ;
  3287. if (vnode.shapeFlag & 32) {
  3288. const type = children._;
  3289. if (type) {
  3290. if (optimized && type === 1) {
  3291. needDeletionCheck = false;
  3292. } else {
  3293. shared.extend(slots, children);
  3294. if (!optimized && type === 1) {
  3295. delete slots._;
  3296. }
  3297. }
  3298. } else {
  3299. needDeletionCheck = !children.$stable;
  3300. normalizeObjectSlots(children, slots);
  3301. }
  3302. deletionComparisonTarget = children;
  3303. } else if (children) {
  3304. normalizeVNodeSlots(instance, children);
  3305. deletionComparisonTarget = { default: 1 };
  3306. }
  3307. if (needDeletionCheck) {
  3308. for (const key in slots) {
  3309. if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
  3310. delete slots[key];
  3311. }
  3312. }
  3313. }
  3314. };
  3315. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  3316. if (shared.isArray(rawRef)) {
  3317. rawRef.forEach(
  3318. (r, i) => setRef(
  3319. r,
  3320. oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  3321. parentSuspense,
  3322. vnode,
  3323. isUnmount
  3324. )
  3325. );
  3326. return;
  3327. }
  3328. if (isAsyncWrapper(vnode) && !isUnmount) {
  3329. return;
  3330. }
  3331. const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  3332. const value = isUnmount ? null : refValue;
  3333. const { i: owner, r: ref } = rawRef;
  3334. const oldRef = oldRawRef && oldRawRef.r;
  3335. const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
  3336. const setupState = owner.setupState;
  3337. if (oldRef != null && oldRef !== ref) {
  3338. if (shared.isString(oldRef)) {
  3339. refs[oldRef] = null;
  3340. if (shared.hasOwn(setupState, oldRef)) {
  3341. setupState[oldRef] = null;
  3342. }
  3343. } else if (reactivity.isRef(oldRef)) {
  3344. oldRef.value = null;
  3345. }
  3346. }
  3347. if (shared.isFunction(ref)) {
  3348. callWithErrorHandling(ref, owner, 12, [value, refs]);
  3349. } else {
  3350. const _isString = shared.isString(ref);
  3351. const _isRef = reactivity.isRef(ref);
  3352. if (_isString || _isRef) {
  3353. const doSet = () => {
  3354. if (rawRef.f) {
  3355. const existing = _isString ? shared.hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  3356. if (isUnmount) {
  3357. shared.isArray(existing) && shared.remove(existing, refValue);
  3358. } else {
  3359. if (!shared.isArray(existing)) {
  3360. if (_isString) {
  3361. refs[ref] = [refValue];
  3362. if (shared.hasOwn(setupState, ref)) {
  3363. setupState[ref] = refs[ref];
  3364. }
  3365. } else {
  3366. ref.value = [refValue];
  3367. if (rawRef.k)
  3368. refs[rawRef.k] = ref.value;
  3369. }
  3370. } else if (!existing.includes(refValue)) {
  3371. existing.push(refValue);
  3372. }
  3373. }
  3374. } else if (_isString) {
  3375. refs[ref] = value;
  3376. if (shared.hasOwn(setupState, ref)) {
  3377. setupState[ref] = value;
  3378. }
  3379. } else if (_isRef) {
  3380. ref.value = value;
  3381. if (rawRef.k)
  3382. refs[rawRef.k] = value;
  3383. } else ;
  3384. };
  3385. if (value) {
  3386. doSet.id = -1;
  3387. queuePostRenderEffect(doSet, parentSuspense);
  3388. } else {
  3389. doSet();
  3390. }
  3391. }
  3392. }
  3393. }
  3394. let hasMismatch = false;
  3395. const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject";
  3396. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  3397. function createHydrationFunctions(rendererInternals) {
  3398. const {
  3399. mt: mountComponent,
  3400. p: patch,
  3401. o: {
  3402. patchProp,
  3403. createText,
  3404. nextSibling,
  3405. parentNode,
  3406. remove,
  3407. insert,
  3408. createComment
  3409. }
  3410. } = rendererInternals;
  3411. const hydrate = (vnode, container) => {
  3412. if (!container.hasChildNodes()) {
  3413. patch(null, vnode, container);
  3414. flushPostFlushCbs();
  3415. container._vnode = vnode;
  3416. return;
  3417. }
  3418. hasMismatch = false;
  3419. hydrateNode(container.firstChild, vnode, null, null, null);
  3420. flushPostFlushCbs();
  3421. container._vnode = vnode;
  3422. if (hasMismatch && true) {
  3423. console.error(`Hydration completed but contains mismatches.`);
  3424. }
  3425. };
  3426. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  3427. const isFragmentStart = isComment(node) && node.data === "[";
  3428. const onMismatch = () => handleMismatch(
  3429. node,
  3430. vnode,
  3431. parentComponent,
  3432. parentSuspense,
  3433. slotScopeIds,
  3434. isFragmentStart
  3435. );
  3436. const { type, ref, shapeFlag, patchFlag } = vnode;
  3437. let domType = node.nodeType;
  3438. vnode.el = node;
  3439. if (patchFlag === -2) {
  3440. optimized = false;
  3441. vnode.dynamicChildren = null;
  3442. }
  3443. let nextNode = null;
  3444. switch (type) {
  3445. case Text:
  3446. if (domType !== 3 /* TEXT */) {
  3447. if (vnode.children === "") {
  3448. insert(vnode.el = createText(""), parentNode(node), node);
  3449. nextNode = node;
  3450. } else {
  3451. nextNode = onMismatch();
  3452. }
  3453. } else {
  3454. if (node.data !== vnode.children) {
  3455. hasMismatch = true;
  3456. node.data = vnode.children;
  3457. }
  3458. nextNode = nextSibling(node);
  3459. }
  3460. break;
  3461. case Comment:
  3462. if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  3463. nextNode = onMismatch();
  3464. } else {
  3465. nextNode = nextSibling(node);
  3466. }
  3467. break;
  3468. case Static:
  3469. if (isFragmentStart) {
  3470. node = nextSibling(node);
  3471. domType = node.nodeType;
  3472. }
  3473. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  3474. nextNode = node;
  3475. const needToAdoptContent = !vnode.children.length;
  3476. for (let i = 0; i < vnode.staticCount; i++) {
  3477. if (needToAdoptContent)
  3478. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  3479. if (i === vnode.staticCount - 1) {
  3480. vnode.anchor = nextNode;
  3481. }
  3482. nextNode = nextSibling(nextNode);
  3483. }
  3484. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  3485. } else {
  3486. onMismatch();
  3487. }
  3488. break;
  3489. case Fragment:
  3490. if (!isFragmentStart) {
  3491. nextNode = onMismatch();
  3492. } else {
  3493. nextNode = hydrateFragment(
  3494. node,
  3495. vnode,
  3496. parentComponent,
  3497. parentSuspense,
  3498. slotScopeIds,
  3499. optimized
  3500. );
  3501. }
  3502. break;
  3503. default:
  3504. if (shapeFlag & 1) {
  3505. if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
  3506. nextNode = onMismatch();
  3507. } else {
  3508. nextNode = hydrateElement(
  3509. node,
  3510. vnode,
  3511. parentComponent,
  3512. parentSuspense,
  3513. slotScopeIds,
  3514. optimized
  3515. );
  3516. }
  3517. } else if (shapeFlag & 6) {
  3518. vnode.slotScopeIds = slotScopeIds;
  3519. const container = parentNode(node);
  3520. mountComponent(
  3521. vnode,
  3522. container,
  3523. null,
  3524. parentComponent,
  3525. parentSuspense,
  3526. isSVGContainer(container),
  3527. optimized
  3528. );
  3529. nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
  3530. if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
  3531. nextNode = nextSibling(nextNode);
  3532. }
  3533. if (isAsyncWrapper(vnode)) {
  3534. let subTree;
  3535. if (isFragmentStart) {
  3536. subTree = createVNode(Fragment);
  3537. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  3538. } else {
  3539. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  3540. }
  3541. subTree.el = node;
  3542. vnode.component.subTree = subTree;
  3543. }
  3544. } else if (shapeFlag & 64) {
  3545. if (domType !== 8 /* COMMENT */) {
  3546. nextNode = onMismatch();
  3547. } else {
  3548. nextNode = vnode.type.hydrate(
  3549. node,
  3550. vnode,
  3551. parentComponent,
  3552. parentSuspense,
  3553. slotScopeIds,
  3554. optimized,
  3555. rendererInternals,
  3556. hydrateChildren
  3557. );
  3558. }
  3559. } else if (shapeFlag & 128) {
  3560. nextNode = vnode.type.hydrate(
  3561. node,
  3562. vnode,
  3563. parentComponent,
  3564. parentSuspense,
  3565. isSVGContainer(parentNode(node)),
  3566. slotScopeIds,
  3567. optimized,
  3568. rendererInternals,
  3569. hydrateNode
  3570. );
  3571. } else ;
  3572. }
  3573. if (ref != null) {
  3574. setRef(ref, null, parentSuspense, vnode);
  3575. }
  3576. return nextNode;
  3577. };
  3578. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  3579. optimized = optimized || !!vnode.dynamicChildren;
  3580. const { type, props, patchFlag, shapeFlag, dirs } = vnode;
  3581. const forcePatchValue = type === "input" && dirs || type === "option";
  3582. if (forcePatchValue || patchFlag !== -1) {
  3583. if (dirs) {
  3584. invokeDirectiveHook(vnode, null, parentComponent, "created");
  3585. }
  3586. if (props) {
  3587. if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
  3588. for (const key in props) {
  3589. if (forcePatchValue && key.endsWith("value") || shared.isOn(key) && !shared.isReservedProp(key)) {
  3590. patchProp(
  3591. el,
  3592. key,
  3593. null,
  3594. props[key],
  3595. false,
  3596. void 0,
  3597. parentComponent
  3598. );
  3599. }
  3600. }
  3601. } else if (props.onClick) {
  3602. patchProp(
  3603. el,
  3604. "onClick",
  3605. null,
  3606. props.onClick,
  3607. false,
  3608. void 0,
  3609. parentComponent
  3610. );
  3611. }
  3612. }
  3613. let vnodeHooks;
  3614. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  3615. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  3616. }
  3617. if (dirs) {
  3618. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  3619. }
  3620. if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
  3621. queueEffectWithSuspense(() => {
  3622. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  3623. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  3624. }, parentSuspense);
  3625. }
  3626. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  3627. !(props && (props.innerHTML || props.textContent))) {
  3628. let next = hydrateChildren(
  3629. el.firstChild,
  3630. vnode,
  3631. el,
  3632. parentComponent,
  3633. parentSuspense,
  3634. slotScopeIds,
  3635. optimized
  3636. );
  3637. while (next) {
  3638. hasMismatch = true;
  3639. const cur = next;
  3640. next = next.nextSibling;
  3641. remove(cur);
  3642. }
  3643. } else if (shapeFlag & 8) {
  3644. if (el.textContent !== vnode.children) {
  3645. hasMismatch = true;
  3646. el.textContent = vnode.children;
  3647. }
  3648. }
  3649. }
  3650. return el.nextSibling;
  3651. };
  3652. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  3653. optimized = optimized || !!parentVNode.dynamicChildren;
  3654. const children = parentVNode.children;
  3655. const l = children.length;
  3656. for (let i = 0; i < l; i++) {
  3657. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  3658. if (node) {
  3659. node = hydrateNode(
  3660. node,
  3661. vnode,
  3662. parentComponent,
  3663. parentSuspense,
  3664. slotScopeIds,
  3665. optimized
  3666. );
  3667. } else if (vnode.type === Text && !vnode.children) {
  3668. continue;
  3669. } else {
  3670. hasMismatch = true;
  3671. patch(
  3672. null,
  3673. vnode,
  3674. container,
  3675. null,
  3676. parentComponent,
  3677. parentSuspense,
  3678. isSVGContainer(container),
  3679. slotScopeIds
  3680. );
  3681. }
  3682. }
  3683. return node;
  3684. };
  3685. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  3686. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  3687. if (fragmentSlotScopeIds) {
  3688. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  3689. }
  3690. const container = parentNode(node);
  3691. const next = hydrateChildren(
  3692. nextSibling(node),
  3693. vnode,
  3694. container,
  3695. parentComponent,
  3696. parentSuspense,
  3697. slotScopeIds,
  3698. optimized
  3699. );
  3700. if (next && isComment(next) && next.data === "]") {
  3701. return nextSibling(vnode.anchor = next);
  3702. } else {
  3703. hasMismatch = true;
  3704. insert(vnode.anchor = createComment(`]`), container, next);
  3705. return next;
  3706. }
  3707. };
  3708. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  3709. hasMismatch = true;
  3710. vnode.el = null;
  3711. if (isFragment) {
  3712. const end = locateClosingAsyncAnchor(node);
  3713. while (true) {
  3714. const next2 = nextSibling(node);
  3715. if (next2 && next2 !== end) {
  3716. remove(next2);
  3717. } else {
  3718. break;
  3719. }
  3720. }
  3721. }
  3722. const next = nextSibling(node);
  3723. const container = parentNode(node);
  3724. remove(node);
  3725. patch(
  3726. null,
  3727. vnode,
  3728. container,
  3729. next,
  3730. parentComponent,
  3731. parentSuspense,
  3732. isSVGContainer(container),
  3733. slotScopeIds
  3734. );
  3735. return next;
  3736. };
  3737. const locateClosingAsyncAnchor = (node) => {
  3738. let match = 0;
  3739. while (node) {
  3740. node = nextSibling(node);
  3741. if (node && isComment(node)) {
  3742. if (node.data === "[")
  3743. match++;
  3744. if (node.data === "]") {
  3745. if (match === 0) {
  3746. return nextSibling(node);
  3747. } else {
  3748. match--;
  3749. }
  3750. }
  3751. }
  3752. }
  3753. return node;
  3754. };
  3755. return [hydrate, hydrateNode];
  3756. }
  3757. const queuePostRenderEffect = queueEffectWithSuspense ;
  3758. function createRenderer(options) {
  3759. return baseCreateRenderer(options);
  3760. }
  3761. function createHydrationRenderer(options) {
  3762. return baseCreateRenderer(options, createHydrationFunctions);
  3763. }
  3764. function baseCreateRenderer(options, createHydrationFns) {
  3765. const target = shared.getGlobalThis();
  3766. target.__VUE__ = true;
  3767. const {
  3768. insert: hostInsert,
  3769. remove: hostRemove,
  3770. patchProp: hostPatchProp,
  3771. createElement: hostCreateElement,
  3772. createText: hostCreateText,
  3773. createComment: hostCreateComment,
  3774. setText: hostSetText,
  3775. setElementText: hostSetElementText,
  3776. parentNode: hostParentNode,
  3777. nextSibling: hostNextSibling,
  3778. setScopeId: hostSetScopeId = shared.NOOP,
  3779. insertStaticContent: hostInsertStaticContent
  3780. } = options;
  3781. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = !!n2.dynamicChildren) => {
  3782. if (n1 === n2) {
  3783. return;
  3784. }
  3785. if (n1 && !isSameVNodeType(n1, n2)) {
  3786. anchor = getNextHostNode(n1);
  3787. unmount(n1, parentComponent, parentSuspense, true);
  3788. n1 = null;
  3789. }
  3790. if (n2.patchFlag === -2) {
  3791. optimized = false;
  3792. n2.dynamicChildren = null;
  3793. }
  3794. const { type, ref, shapeFlag } = n2;
  3795. switch (type) {
  3796. case Text:
  3797. processText(n1, n2, container, anchor);
  3798. break;
  3799. case Comment:
  3800. processCommentNode(n1, n2, container, anchor);
  3801. break;
  3802. case Static:
  3803. if (n1 == null) {
  3804. mountStaticNode(n2, container, anchor, isSVG);
  3805. }
  3806. break;
  3807. case Fragment:
  3808. processFragment(
  3809. n1,
  3810. n2,
  3811. container,
  3812. anchor,
  3813. parentComponent,
  3814. parentSuspense,
  3815. isSVG,
  3816. slotScopeIds,
  3817. optimized
  3818. );
  3819. break;
  3820. default:
  3821. if (shapeFlag & 1) {
  3822. processElement(
  3823. n1,
  3824. n2,
  3825. container,
  3826. anchor,
  3827. parentComponent,
  3828. parentSuspense,
  3829. isSVG,
  3830. slotScopeIds,
  3831. optimized
  3832. );
  3833. } else if (shapeFlag & 6) {
  3834. processComponent(
  3835. n1,
  3836. n2,
  3837. container,
  3838. anchor,
  3839. parentComponent,
  3840. parentSuspense,
  3841. isSVG,
  3842. slotScopeIds,
  3843. optimized
  3844. );
  3845. } else if (shapeFlag & 64) {
  3846. type.process(
  3847. n1,
  3848. n2,
  3849. container,
  3850. anchor,
  3851. parentComponent,
  3852. parentSuspense,
  3853. isSVG,
  3854. slotScopeIds,
  3855. optimized,
  3856. internals
  3857. );
  3858. } else if (shapeFlag & 128) {
  3859. type.process(
  3860. n1,
  3861. n2,
  3862. container,
  3863. anchor,
  3864. parentComponent,
  3865. parentSuspense,
  3866. isSVG,
  3867. slotScopeIds,
  3868. optimized,
  3869. internals
  3870. );
  3871. } else ;
  3872. }
  3873. if (ref != null && parentComponent) {
  3874. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  3875. }
  3876. };
  3877. const processText = (n1, n2, container, anchor) => {
  3878. if (n1 == null) {
  3879. hostInsert(
  3880. n2.el = hostCreateText(n2.children),
  3881. container,
  3882. anchor
  3883. );
  3884. } else {
  3885. const el = n2.el = n1.el;
  3886. if (n2.children !== n1.children) {
  3887. hostSetText(el, n2.children);
  3888. }
  3889. }
  3890. };
  3891. const processCommentNode = (n1, n2, container, anchor) => {
  3892. if (n1 == null) {
  3893. hostInsert(
  3894. n2.el = hostCreateComment(n2.children || ""),
  3895. container,
  3896. anchor
  3897. );
  3898. } else {
  3899. n2.el = n1.el;
  3900. }
  3901. };
  3902. const mountStaticNode = (n2, container, anchor, isSVG) => {
  3903. [n2.el, n2.anchor] = hostInsertStaticContent(
  3904. n2.children,
  3905. container,
  3906. anchor,
  3907. isSVG,
  3908. n2.el,
  3909. n2.anchor
  3910. );
  3911. };
  3912. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  3913. let next;
  3914. while (el && el !== anchor) {
  3915. next = hostNextSibling(el);
  3916. hostInsert(el, container, nextSibling);
  3917. el = next;
  3918. }
  3919. hostInsert(anchor, container, nextSibling);
  3920. };
  3921. const removeStaticNode = ({ el, anchor }) => {
  3922. let next;
  3923. while (el && el !== anchor) {
  3924. next = hostNextSibling(el);
  3925. hostRemove(el);
  3926. el = next;
  3927. }
  3928. hostRemove(anchor);
  3929. };
  3930. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  3931. isSVG = isSVG || n2.type === "svg";
  3932. if (n1 == null) {
  3933. mountElement(
  3934. n2,
  3935. container,
  3936. anchor,
  3937. parentComponent,
  3938. parentSuspense,
  3939. isSVG,
  3940. slotScopeIds,
  3941. optimized
  3942. );
  3943. } else {
  3944. patchElement(
  3945. n1,
  3946. n2,
  3947. parentComponent,
  3948. parentSuspense,
  3949. isSVG,
  3950. slotScopeIds,
  3951. optimized
  3952. );
  3953. }
  3954. };
  3955. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  3956. let el;
  3957. let vnodeHook;
  3958. const { type, props, shapeFlag, transition, dirs } = vnode;
  3959. el = vnode.el = hostCreateElement(
  3960. vnode.type,
  3961. isSVG,
  3962. props && props.is,
  3963. props
  3964. );
  3965. if (shapeFlag & 8) {
  3966. hostSetElementText(el, vnode.children);
  3967. } else if (shapeFlag & 16) {
  3968. mountChildren(
  3969. vnode.children,
  3970. el,
  3971. null,
  3972. parentComponent,
  3973. parentSuspense,
  3974. isSVG && type !== "foreignObject",
  3975. slotScopeIds,
  3976. optimized
  3977. );
  3978. }
  3979. if (dirs) {
  3980. invokeDirectiveHook(vnode, null, parentComponent, "created");
  3981. }
  3982. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  3983. if (props) {
  3984. for (const key in props) {
  3985. if (key !== "value" && !shared.isReservedProp(key)) {
  3986. hostPatchProp(
  3987. el,
  3988. key,
  3989. null,
  3990. props[key],
  3991. isSVG,
  3992. vnode.children,
  3993. parentComponent,
  3994. parentSuspense,
  3995. unmountChildren
  3996. );
  3997. }
  3998. }
  3999. if ("value" in props) {
  4000. hostPatchProp(el, "value", null, props.value);
  4001. }
  4002. if (vnodeHook = props.onVnodeBeforeMount) {
  4003. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4004. }
  4005. }
  4006. if (dirs) {
  4007. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4008. }
  4009. const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  4010. if (needCallTransitionHooks) {
  4011. transition.beforeEnter(el);
  4012. }
  4013. hostInsert(el, container, anchor);
  4014. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  4015. queuePostRenderEffect(() => {
  4016. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4017. needCallTransitionHooks && transition.enter(el);
  4018. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4019. }, parentSuspense);
  4020. }
  4021. };
  4022. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  4023. if (scopeId) {
  4024. hostSetScopeId(el, scopeId);
  4025. }
  4026. if (slotScopeIds) {
  4027. for (let i = 0; i < slotScopeIds.length; i++) {
  4028. hostSetScopeId(el, slotScopeIds[i]);
  4029. }
  4030. }
  4031. if (parentComponent) {
  4032. let subTree = parentComponent.subTree;
  4033. if (vnode === subTree) {
  4034. const parentVNode = parentComponent.vnode;
  4035. setScopeId(
  4036. el,
  4037. parentVNode,
  4038. parentVNode.scopeId,
  4039. parentVNode.slotScopeIds,
  4040. parentComponent.parent
  4041. );
  4042. }
  4043. }
  4044. };
  4045. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
  4046. for (let i = start; i < children.length; i++) {
  4047. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  4048. patch(
  4049. null,
  4050. child,
  4051. container,
  4052. anchor,
  4053. parentComponent,
  4054. parentSuspense,
  4055. isSVG,
  4056. slotScopeIds,
  4057. optimized
  4058. );
  4059. }
  4060. };
  4061. const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4062. const el = n2.el = n1.el;
  4063. let { patchFlag, dynamicChildren, dirs } = n2;
  4064. patchFlag |= n1.patchFlag & 16;
  4065. const oldProps = n1.props || shared.EMPTY_OBJ;
  4066. const newProps = n2.props || shared.EMPTY_OBJ;
  4067. let vnodeHook;
  4068. parentComponent && toggleRecurse(parentComponent, false);
  4069. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  4070. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  4071. }
  4072. if (dirs) {
  4073. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  4074. }
  4075. parentComponent && toggleRecurse(parentComponent, true);
  4076. const areChildrenSVG = isSVG && n2.type !== "foreignObject";
  4077. if (dynamicChildren) {
  4078. patchBlockChildren(
  4079. n1.dynamicChildren,
  4080. dynamicChildren,
  4081. el,
  4082. parentComponent,
  4083. parentSuspense,
  4084. areChildrenSVG,
  4085. slotScopeIds
  4086. );
  4087. } else if (!optimized) {
  4088. patchChildren(
  4089. n1,
  4090. n2,
  4091. el,
  4092. null,
  4093. parentComponent,
  4094. parentSuspense,
  4095. areChildrenSVG,
  4096. slotScopeIds,
  4097. false
  4098. );
  4099. }
  4100. if (patchFlag > 0) {
  4101. if (patchFlag & 16) {
  4102. patchProps(
  4103. el,
  4104. n2,
  4105. oldProps,
  4106. newProps,
  4107. parentComponent,
  4108. parentSuspense,
  4109. isSVG
  4110. );
  4111. } else {
  4112. if (patchFlag & 2) {
  4113. if (oldProps.class !== newProps.class) {
  4114. hostPatchProp(el, "class", null, newProps.class, isSVG);
  4115. }
  4116. }
  4117. if (patchFlag & 4) {
  4118. hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
  4119. }
  4120. if (patchFlag & 8) {
  4121. const propsToUpdate = n2.dynamicProps;
  4122. for (let i = 0; i < propsToUpdate.length; i++) {
  4123. const key = propsToUpdate[i];
  4124. const prev = oldProps[key];
  4125. const next = newProps[key];
  4126. if (next !== prev || key === "value") {
  4127. hostPatchProp(
  4128. el,
  4129. key,
  4130. prev,
  4131. next,
  4132. isSVG,
  4133. n1.children,
  4134. parentComponent,
  4135. parentSuspense,
  4136. unmountChildren
  4137. );
  4138. }
  4139. }
  4140. }
  4141. }
  4142. if (patchFlag & 1) {
  4143. if (n1.children !== n2.children) {
  4144. hostSetElementText(el, n2.children);
  4145. }
  4146. }
  4147. } else if (!optimized && dynamicChildren == null) {
  4148. patchProps(
  4149. el,
  4150. n2,
  4151. oldProps,
  4152. newProps,
  4153. parentComponent,
  4154. parentSuspense,
  4155. isSVG
  4156. );
  4157. }
  4158. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  4159. queuePostRenderEffect(() => {
  4160. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  4161. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  4162. }, parentSuspense);
  4163. }
  4164. };
  4165. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
  4166. for (let i = 0; i < newChildren.length; i++) {
  4167. const oldVNode = oldChildren[i];
  4168. const newVNode = newChildren[i];
  4169. const container = (
  4170. // oldVNode may be an errored async setup() component inside Suspense
  4171. // which will not have a mounted element
  4172. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  4173. // of the Fragment itself so it can move its children.
  4174. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  4175. // which also requires the correct parent container
  4176. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  4177. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  4178. // In other cases, the parent container is not actually used so we
  4179. // just pass the block element here to avoid a DOM parentNode call.
  4180. fallbackContainer
  4181. )
  4182. );
  4183. patch(
  4184. oldVNode,
  4185. newVNode,
  4186. container,
  4187. null,
  4188. parentComponent,
  4189. parentSuspense,
  4190. isSVG,
  4191. slotScopeIds,
  4192. true
  4193. );
  4194. }
  4195. };
  4196. const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
  4197. if (oldProps !== newProps) {
  4198. if (oldProps !== shared.EMPTY_OBJ) {
  4199. for (const key in oldProps) {
  4200. if (!shared.isReservedProp(key) && !(key in newProps)) {
  4201. hostPatchProp(
  4202. el,
  4203. key,
  4204. oldProps[key],
  4205. null,
  4206. isSVG,
  4207. vnode.children,
  4208. parentComponent,
  4209. parentSuspense,
  4210. unmountChildren
  4211. );
  4212. }
  4213. }
  4214. }
  4215. for (const key in newProps) {
  4216. if (shared.isReservedProp(key))
  4217. continue;
  4218. const next = newProps[key];
  4219. const prev = oldProps[key];
  4220. if (next !== prev && key !== "value") {
  4221. hostPatchProp(
  4222. el,
  4223. key,
  4224. prev,
  4225. next,
  4226. isSVG,
  4227. vnode.children,
  4228. parentComponent,
  4229. parentSuspense,
  4230. unmountChildren
  4231. );
  4232. }
  4233. }
  4234. if ("value" in newProps) {
  4235. hostPatchProp(el, "value", oldProps.value, newProps.value);
  4236. }
  4237. }
  4238. };
  4239. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4240. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  4241. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  4242. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  4243. if (fragmentSlotScopeIds) {
  4244. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4245. }
  4246. if (n1 == null) {
  4247. hostInsert(fragmentStartAnchor, container, anchor);
  4248. hostInsert(fragmentEndAnchor, container, anchor);
  4249. mountChildren(
  4250. n2.children,
  4251. container,
  4252. fragmentEndAnchor,
  4253. parentComponent,
  4254. parentSuspense,
  4255. isSVG,
  4256. slotScopeIds,
  4257. optimized
  4258. );
  4259. } else {
  4260. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  4261. // of renderSlot() with no valid children
  4262. n1.dynamicChildren) {
  4263. patchBlockChildren(
  4264. n1.dynamicChildren,
  4265. dynamicChildren,
  4266. container,
  4267. parentComponent,
  4268. parentSuspense,
  4269. isSVG,
  4270. slotScopeIds
  4271. );
  4272. if (
  4273. // #2080 if the stable fragment has a key, it's a <template v-for> that may
  4274. // get moved around. Make sure all root level vnodes inherit el.
  4275. // #2134 or if it's a component root, it may also get moved around
  4276. // as the component is being moved.
  4277. n2.key != null || parentComponent && n2 === parentComponent.subTree
  4278. ) {
  4279. traverseStaticChildren(
  4280. n1,
  4281. n2,
  4282. true
  4283. /* shallow */
  4284. );
  4285. }
  4286. } else {
  4287. patchChildren(
  4288. n1,
  4289. n2,
  4290. container,
  4291. fragmentEndAnchor,
  4292. parentComponent,
  4293. parentSuspense,
  4294. isSVG,
  4295. slotScopeIds,
  4296. optimized
  4297. );
  4298. }
  4299. }
  4300. };
  4301. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4302. n2.slotScopeIds = slotScopeIds;
  4303. if (n1 == null) {
  4304. if (n2.shapeFlag & 512) {
  4305. parentComponent.ctx.activate(
  4306. n2,
  4307. container,
  4308. anchor,
  4309. isSVG,
  4310. optimized
  4311. );
  4312. } else {
  4313. mountComponent(
  4314. n2,
  4315. container,
  4316. anchor,
  4317. parentComponent,
  4318. parentSuspense,
  4319. isSVG,
  4320. optimized
  4321. );
  4322. }
  4323. } else {
  4324. updateComponent(n1, n2, optimized);
  4325. }
  4326. };
  4327. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
  4328. const instance = (initialVNode.component = createComponentInstance(
  4329. initialVNode,
  4330. parentComponent,
  4331. parentSuspense
  4332. ));
  4333. if (isKeepAlive(initialVNode)) {
  4334. instance.ctx.renderer = internals;
  4335. }
  4336. {
  4337. setupComponent(instance);
  4338. }
  4339. if (instance.asyncDep) {
  4340. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  4341. if (!initialVNode.el) {
  4342. const placeholder = instance.subTree = createVNode(Comment);
  4343. processCommentNode(null, placeholder, container, anchor);
  4344. }
  4345. return;
  4346. }
  4347. setupRenderEffect(
  4348. instance,
  4349. initialVNode,
  4350. container,
  4351. anchor,
  4352. parentSuspense,
  4353. isSVG,
  4354. optimized
  4355. );
  4356. };
  4357. const updateComponent = (n1, n2, optimized) => {
  4358. const instance = n2.component = n1.component;
  4359. if (shouldUpdateComponent(n1, n2, optimized)) {
  4360. if (instance.asyncDep && !instance.asyncResolved) {
  4361. updateComponentPreRender(instance, n2, optimized);
  4362. return;
  4363. } else {
  4364. instance.next = n2;
  4365. invalidateJob(instance.update);
  4366. instance.update();
  4367. }
  4368. } else {
  4369. n2.el = n1.el;
  4370. instance.vnode = n2;
  4371. }
  4372. };
  4373. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
  4374. const componentUpdateFn = () => {
  4375. if (!instance.isMounted) {
  4376. let vnodeHook;
  4377. const { el, props } = initialVNode;
  4378. const { bm, m, parent } = instance;
  4379. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  4380. toggleRecurse(instance, false);
  4381. if (bm) {
  4382. shared.invokeArrayFns(bm);
  4383. }
  4384. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  4385. invokeVNodeHook(vnodeHook, parent, initialVNode);
  4386. }
  4387. toggleRecurse(instance, true);
  4388. if (el && hydrateNode) {
  4389. const hydrateSubTree = () => {
  4390. instance.subTree = renderComponentRoot(instance);
  4391. hydrateNode(
  4392. el,
  4393. instance.subTree,
  4394. instance,
  4395. parentSuspense,
  4396. null
  4397. );
  4398. };
  4399. if (isAsyncWrapperVNode) {
  4400. initialVNode.type.__asyncLoader().then(
  4401. // note: we are moving the render call into an async callback,
  4402. // which means it won't track dependencies - but it's ok because
  4403. // a server-rendered async wrapper is already in resolved state
  4404. // and it will never need to change.
  4405. () => !instance.isUnmounted && hydrateSubTree()
  4406. );
  4407. } else {
  4408. hydrateSubTree();
  4409. }
  4410. } else {
  4411. const subTree = instance.subTree = renderComponentRoot(instance);
  4412. patch(
  4413. null,
  4414. subTree,
  4415. container,
  4416. anchor,
  4417. instance,
  4418. parentSuspense,
  4419. isSVG
  4420. );
  4421. initialVNode.el = subTree.el;
  4422. }
  4423. if (m) {
  4424. queuePostRenderEffect(m, parentSuspense);
  4425. }
  4426. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  4427. const scopedInitialVNode = initialVNode;
  4428. queuePostRenderEffect(
  4429. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  4430. parentSuspense
  4431. );
  4432. }
  4433. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  4434. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  4435. }
  4436. instance.isMounted = true;
  4437. initialVNode = container = anchor = null;
  4438. } else {
  4439. let { next, bu, u, parent, vnode } = instance;
  4440. let originNext = next;
  4441. let vnodeHook;
  4442. toggleRecurse(instance, false);
  4443. if (next) {
  4444. next.el = vnode.el;
  4445. updateComponentPreRender(instance, next, optimized);
  4446. } else {
  4447. next = vnode;
  4448. }
  4449. if (bu) {
  4450. shared.invokeArrayFns(bu);
  4451. }
  4452. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  4453. invokeVNodeHook(vnodeHook, parent, next, vnode);
  4454. }
  4455. toggleRecurse(instance, true);
  4456. const nextTree = renderComponentRoot(instance);
  4457. const prevTree = instance.subTree;
  4458. instance.subTree = nextTree;
  4459. patch(
  4460. prevTree,
  4461. nextTree,
  4462. // parent may have changed if it's in a teleport
  4463. hostParentNode(prevTree.el),
  4464. // anchor may have changed if it's in a fragment
  4465. getNextHostNode(prevTree),
  4466. instance,
  4467. parentSuspense,
  4468. isSVG
  4469. );
  4470. next.el = nextTree.el;
  4471. if (originNext === null) {
  4472. updateHOCHostEl(instance, nextTree.el);
  4473. }
  4474. if (u) {
  4475. queuePostRenderEffect(u, parentSuspense);
  4476. }
  4477. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  4478. queuePostRenderEffect(
  4479. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  4480. parentSuspense
  4481. );
  4482. }
  4483. }
  4484. };
  4485. const effect = instance.effect = new reactivity.ReactiveEffect(
  4486. componentUpdateFn,
  4487. () => queueJob(update),
  4488. instance.scope
  4489. // track it in component's effect scope
  4490. );
  4491. const update = instance.update = () => effect.run();
  4492. update.id = instance.uid;
  4493. toggleRecurse(instance, true);
  4494. update();
  4495. };
  4496. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  4497. nextVNode.component = instance;
  4498. const prevProps = instance.vnode.props;
  4499. instance.vnode = nextVNode;
  4500. instance.next = null;
  4501. updateProps(instance, nextVNode.props, prevProps, optimized);
  4502. updateSlots(instance, nextVNode.children, optimized);
  4503. reactivity.pauseTracking();
  4504. flushPreFlushCbs();
  4505. reactivity.resetTracking();
  4506. };
  4507. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
  4508. const c1 = n1 && n1.children;
  4509. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  4510. const c2 = n2.children;
  4511. const { patchFlag, shapeFlag } = n2;
  4512. if (patchFlag > 0) {
  4513. if (patchFlag & 128) {
  4514. patchKeyedChildren(
  4515. c1,
  4516. c2,
  4517. container,
  4518. anchor,
  4519. parentComponent,
  4520. parentSuspense,
  4521. isSVG,
  4522. slotScopeIds,
  4523. optimized
  4524. );
  4525. return;
  4526. } else if (patchFlag & 256) {
  4527. patchUnkeyedChildren(
  4528. c1,
  4529. c2,
  4530. container,
  4531. anchor,
  4532. parentComponent,
  4533. parentSuspense,
  4534. isSVG,
  4535. slotScopeIds,
  4536. optimized
  4537. );
  4538. return;
  4539. }
  4540. }
  4541. if (shapeFlag & 8) {
  4542. if (prevShapeFlag & 16) {
  4543. unmountChildren(c1, parentComponent, parentSuspense);
  4544. }
  4545. if (c2 !== c1) {
  4546. hostSetElementText(container, c2);
  4547. }
  4548. } else {
  4549. if (prevShapeFlag & 16) {
  4550. if (shapeFlag & 16) {
  4551. patchKeyedChildren(
  4552. c1,
  4553. c2,
  4554. container,
  4555. anchor,
  4556. parentComponent,
  4557. parentSuspense,
  4558. isSVG,
  4559. slotScopeIds,
  4560. optimized
  4561. );
  4562. } else {
  4563. unmountChildren(c1, parentComponent, parentSuspense, true);
  4564. }
  4565. } else {
  4566. if (prevShapeFlag & 8) {
  4567. hostSetElementText(container, "");
  4568. }
  4569. if (shapeFlag & 16) {
  4570. mountChildren(
  4571. c2,
  4572. container,
  4573. anchor,
  4574. parentComponent,
  4575. parentSuspense,
  4576. isSVG,
  4577. slotScopeIds,
  4578. optimized
  4579. );
  4580. }
  4581. }
  4582. }
  4583. };
  4584. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4585. c1 = c1 || shared.EMPTY_ARR;
  4586. c2 = c2 || shared.EMPTY_ARR;
  4587. const oldLength = c1.length;
  4588. const newLength = c2.length;
  4589. const commonLength = Math.min(oldLength, newLength);
  4590. let i;
  4591. for (i = 0; i < commonLength; i++) {
  4592. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  4593. patch(
  4594. c1[i],
  4595. nextChild,
  4596. container,
  4597. null,
  4598. parentComponent,
  4599. parentSuspense,
  4600. isSVG,
  4601. slotScopeIds,
  4602. optimized
  4603. );
  4604. }
  4605. if (oldLength > newLength) {
  4606. unmountChildren(
  4607. c1,
  4608. parentComponent,
  4609. parentSuspense,
  4610. true,
  4611. false,
  4612. commonLength
  4613. );
  4614. } else {
  4615. mountChildren(
  4616. c2,
  4617. container,
  4618. anchor,
  4619. parentComponent,
  4620. parentSuspense,
  4621. isSVG,
  4622. slotScopeIds,
  4623. optimized,
  4624. commonLength
  4625. );
  4626. }
  4627. };
  4628. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4629. let i = 0;
  4630. const l2 = c2.length;
  4631. let e1 = c1.length - 1;
  4632. let e2 = l2 - 1;
  4633. while (i <= e1 && i <= e2) {
  4634. const n1 = c1[i];
  4635. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  4636. if (isSameVNodeType(n1, n2)) {
  4637. patch(
  4638. n1,
  4639. n2,
  4640. container,
  4641. null,
  4642. parentComponent,
  4643. parentSuspense,
  4644. isSVG,
  4645. slotScopeIds,
  4646. optimized
  4647. );
  4648. } else {
  4649. break;
  4650. }
  4651. i++;
  4652. }
  4653. while (i <= e1 && i <= e2) {
  4654. const n1 = c1[e1];
  4655. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  4656. if (isSameVNodeType(n1, n2)) {
  4657. patch(
  4658. n1,
  4659. n2,
  4660. container,
  4661. null,
  4662. parentComponent,
  4663. parentSuspense,
  4664. isSVG,
  4665. slotScopeIds,
  4666. optimized
  4667. );
  4668. } else {
  4669. break;
  4670. }
  4671. e1--;
  4672. e2--;
  4673. }
  4674. if (i > e1) {
  4675. if (i <= e2) {
  4676. const nextPos = e2 + 1;
  4677. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  4678. while (i <= e2) {
  4679. patch(
  4680. null,
  4681. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  4682. container,
  4683. anchor,
  4684. parentComponent,
  4685. parentSuspense,
  4686. isSVG,
  4687. slotScopeIds,
  4688. optimized
  4689. );
  4690. i++;
  4691. }
  4692. }
  4693. } else if (i > e2) {
  4694. while (i <= e1) {
  4695. unmount(c1[i], parentComponent, parentSuspense, true);
  4696. i++;
  4697. }
  4698. } else {
  4699. const s1 = i;
  4700. const s2 = i;
  4701. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  4702. for (i = s2; i <= e2; i++) {
  4703. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  4704. if (nextChild.key != null) {
  4705. keyToNewIndexMap.set(nextChild.key, i);
  4706. }
  4707. }
  4708. let j;
  4709. let patched = 0;
  4710. const toBePatched = e2 - s2 + 1;
  4711. let moved = false;
  4712. let maxNewIndexSoFar = 0;
  4713. const newIndexToOldIndexMap = new Array(toBePatched);
  4714. for (i = 0; i < toBePatched; i++)
  4715. newIndexToOldIndexMap[i] = 0;
  4716. for (i = s1; i <= e1; i++) {
  4717. const prevChild = c1[i];
  4718. if (patched >= toBePatched) {
  4719. unmount(prevChild, parentComponent, parentSuspense, true);
  4720. continue;
  4721. }
  4722. let newIndex;
  4723. if (prevChild.key != null) {
  4724. newIndex = keyToNewIndexMap.get(prevChild.key);
  4725. } else {
  4726. for (j = s2; j <= e2; j++) {
  4727. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  4728. newIndex = j;
  4729. break;
  4730. }
  4731. }
  4732. }
  4733. if (newIndex === void 0) {
  4734. unmount(prevChild, parentComponent, parentSuspense, true);
  4735. } else {
  4736. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  4737. if (newIndex >= maxNewIndexSoFar) {
  4738. maxNewIndexSoFar = newIndex;
  4739. } else {
  4740. moved = true;
  4741. }
  4742. patch(
  4743. prevChild,
  4744. c2[newIndex],
  4745. container,
  4746. null,
  4747. parentComponent,
  4748. parentSuspense,
  4749. isSVG,
  4750. slotScopeIds,
  4751. optimized
  4752. );
  4753. patched++;
  4754. }
  4755. }
  4756. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
  4757. j = increasingNewIndexSequence.length - 1;
  4758. for (i = toBePatched - 1; i >= 0; i--) {
  4759. const nextIndex = s2 + i;
  4760. const nextChild = c2[nextIndex];
  4761. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  4762. if (newIndexToOldIndexMap[i] === 0) {
  4763. patch(
  4764. null,
  4765. nextChild,
  4766. container,
  4767. anchor,
  4768. parentComponent,
  4769. parentSuspense,
  4770. isSVG,
  4771. slotScopeIds,
  4772. optimized
  4773. );
  4774. } else if (moved) {
  4775. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  4776. move(nextChild, container, anchor, 2);
  4777. } else {
  4778. j--;
  4779. }
  4780. }
  4781. }
  4782. }
  4783. };
  4784. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  4785. const { el, type, transition, children, shapeFlag } = vnode;
  4786. if (shapeFlag & 6) {
  4787. move(vnode.component.subTree, container, anchor, moveType);
  4788. return;
  4789. }
  4790. if (shapeFlag & 128) {
  4791. vnode.suspense.move(container, anchor, moveType);
  4792. return;
  4793. }
  4794. if (shapeFlag & 64) {
  4795. type.move(vnode, container, anchor, internals);
  4796. return;
  4797. }
  4798. if (type === Fragment) {
  4799. hostInsert(el, container, anchor);
  4800. for (let i = 0; i < children.length; i++) {
  4801. move(children[i], container, anchor, moveType);
  4802. }
  4803. hostInsert(vnode.anchor, container, anchor);
  4804. return;
  4805. }
  4806. if (type === Static) {
  4807. moveStaticNode(vnode, container, anchor);
  4808. return;
  4809. }
  4810. const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
  4811. if (needTransition) {
  4812. if (moveType === 0) {
  4813. transition.beforeEnter(el);
  4814. hostInsert(el, container, anchor);
  4815. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  4816. } else {
  4817. const { leave, delayLeave, afterLeave } = transition;
  4818. const remove2 = () => hostInsert(el, container, anchor);
  4819. const performLeave = () => {
  4820. leave(el, () => {
  4821. remove2();
  4822. afterLeave && afterLeave();
  4823. });
  4824. };
  4825. if (delayLeave) {
  4826. delayLeave(el, remove2, performLeave);
  4827. } else {
  4828. performLeave();
  4829. }
  4830. }
  4831. } else {
  4832. hostInsert(el, container, anchor);
  4833. }
  4834. };
  4835. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  4836. const {
  4837. type,
  4838. props,
  4839. ref,
  4840. children,
  4841. dynamicChildren,
  4842. shapeFlag,
  4843. patchFlag,
  4844. dirs
  4845. } = vnode;
  4846. if (ref != null) {
  4847. setRef(ref, null, parentSuspense, vnode, true);
  4848. }
  4849. if (shapeFlag & 256) {
  4850. parentComponent.ctx.deactivate(vnode);
  4851. return;
  4852. }
  4853. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  4854. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  4855. let vnodeHook;
  4856. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  4857. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4858. }
  4859. if (shapeFlag & 6) {
  4860. unmountComponent(vnode.component, parentSuspense, doRemove);
  4861. } else {
  4862. if (shapeFlag & 128) {
  4863. vnode.suspense.unmount(parentSuspense, doRemove);
  4864. return;
  4865. }
  4866. if (shouldInvokeDirs) {
  4867. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  4868. }
  4869. if (shapeFlag & 64) {
  4870. vnode.type.remove(
  4871. vnode,
  4872. parentComponent,
  4873. parentSuspense,
  4874. optimized,
  4875. internals,
  4876. doRemove
  4877. );
  4878. } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
  4879. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  4880. unmountChildren(
  4881. dynamicChildren,
  4882. parentComponent,
  4883. parentSuspense,
  4884. false,
  4885. true
  4886. );
  4887. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  4888. unmountChildren(children, parentComponent, parentSuspense);
  4889. }
  4890. if (doRemove) {
  4891. remove(vnode);
  4892. }
  4893. }
  4894. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  4895. queuePostRenderEffect(() => {
  4896. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4897. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  4898. }, parentSuspense);
  4899. }
  4900. };
  4901. const remove = (vnode) => {
  4902. const { type, el, anchor, transition } = vnode;
  4903. if (type === Fragment) {
  4904. {
  4905. removeFragment(el, anchor);
  4906. }
  4907. return;
  4908. }
  4909. if (type === Static) {
  4910. removeStaticNode(vnode);
  4911. return;
  4912. }
  4913. const performRemove = () => {
  4914. hostRemove(el);
  4915. if (transition && !transition.persisted && transition.afterLeave) {
  4916. transition.afterLeave();
  4917. }
  4918. };
  4919. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  4920. const { leave, delayLeave } = transition;
  4921. const performLeave = () => leave(el, performRemove);
  4922. if (delayLeave) {
  4923. delayLeave(vnode.el, performRemove, performLeave);
  4924. } else {
  4925. performLeave();
  4926. }
  4927. } else {
  4928. performRemove();
  4929. }
  4930. };
  4931. const removeFragment = (cur, end) => {
  4932. let next;
  4933. while (cur !== end) {
  4934. next = hostNextSibling(cur);
  4935. hostRemove(cur);
  4936. cur = next;
  4937. }
  4938. hostRemove(end);
  4939. };
  4940. const unmountComponent = (instance, parentSuspense, doRemove) => {
  4941. const { bum, scope, update, subTree, um } = instance;
  4942. if (bum) {
  4943. shared.invokeArrayFns(bum);
  4944. }
  4945. scope.stop();
  4946. if (update) {
  4947. update.active = false;
  4948. unmount(subTree, instance, parentSuspense, doRemove);
  4949. }
  4950. if (um) {
  4951. queuePostRenderEffect(um, parentSuspense);
  4952. }
  4953. queuePostRenderEffect(() => {
  4954. instance.isUnmounted = true;
  4955. }, parentSuspense);
  4956. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  4957. parentSuspense.deps--;
  4958. if (parentSuspense.deps === 0) {
  4959. parentSuspense.resolve();
  4960. }
  4961. }
  4962. };
  4963. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  4964. for (let i = start; i < children.length; i++) {
  4965. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  4966. }
  4967. };
  4968. const getNextHostNode = (vnode) => {
  4969. if (vnode.shapeFlag & 6) {
  4970. return getNextHostNode(vnode.component.subTree);
  4971. }
  4972. if (vnode.shapeFlag & 128) {
  4973. return vnode.suspense.next();
  4974. }
  4975. return hostNextSibling(vnode.anchor || vnode.el);
  4976. };
  4977. const render = (vnode, container, isSVG) => {
  4978. if (vnode == null) {
  4979. if (container._vnode) {
  4980. unmount(container._vnode, null, null, true);
  4981. }
  4982. } else {
  4983. patch(container._vnode || null, vnode, container, null, null, null, isSVG);
  4984. }
  4985. flushPreFlushCbs();
  4986. flushPostFlushCbs();
  4987. container._vnode = vnode;
  4988. };
  4989. const internals = {
  4990. p: patch,
  4991. um: unmount,
  4992. m: move,
  4993. r: remove,
  4994. mt: mountComponent,
  4995. mc: mountChildren,
  4996. pc: patchChildren,
  4997. pbc: patchBlockChildren,
  4998. n: getNextHostNode,
  4999. o: options
  5000. };
  5001. let hydrate;
  5002. let hydrateNode;
  5003. if (createHydrationFns) {
  5004. [hydrate, hydrateNode] = createHydrationFns(
  5005. internals
  5006. );
  5007. }
  5008. return {
  5009. render,
  5010. hydrate,
  5011. createApp: createAppAPI(render, hydrate)
  5012. };
  5013. }
  5014. function toggleRecurse({ effect, update }, allowed) {
  5015. effect.allowRecurse = update.allowRecurse = allowed;
  5016. }
  5017. function traverseStaticChildren(n1, n2, shallow = false) {
  5018. const ch1 = n1.children;
  5019. const ch2 = n2.children;
  5020. if (shared.isArray(ch1) && shared.isArray(ch2)) {
  5021. for (let i = 0; i < ch1.length; i++) {
  5022. const c1 = ch1[i];
  5023. let c2 = ch2[i];
  5024. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  5025. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  5026. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  5027. c2.el = c1.el;
  5028. }
  5029. if (!shallow)
  5030. traverseStaticChildren(c1, c2);
  5031. }
  5032. if (c2.type === Text) {
  5033. c2.el = c1.el;
  5034. }
  5035. }
  5036. }
  5037. }
  5038. function getSequence(arr) {
  5039. const p = arr.slice();
  5040. const result = [0];
  5041. let i, j, u, v, c;
  5042. const len = arr.length;
  5043. for (i = 0; i < len; i++) {
  5044. const arrI = arr[i];
  5045. if (arrI !== 0) {
  5046. j = result[result.length - 1];
  5047. if (arr[j] < arrI) {
  5048. p[i] = j;
  5049. result.push(i);
  5050. continue;
  5051. }
  5052. u = 0;
  5053. v = result.length - 1;
  5054. while (u < v) {
  5055. c = u + v >> 1;
  5056. if (arr[result[c]] < arrI) {
  5057. u = c + 1;
  5058. } else {
  5059. v = c;
  5060. }
  5061. }
  5062. if (arrI < arr[result[u]]) {
  5063. if (u > 0) {
  5064. p[i] = result[u - 1];
  5065. }
  5066. result[u] = i;
  5067. }
  5068. }
  5069. }
  5070. u = result.length;
  5071. v = result[u - 1];
  5072. while (u-- > 0) {
  5073. result[u] = v;
  5074. v = p[v];
  5075. }
  5076. return result;
  5077. }
  5078. const isTeleport = (type) => type.__isTeleport;
  5079. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  5080. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  5081. const resolveTarget = (props, select) => {
  5082. const targetSelector = props && props.to;
  5083. if (shared.isString(targetSelector)) {
  5084. if (!select) {
  5085. return null;
  5086. } else {
  5087. const target = select(targetSelector);
  5088. return target;
  5089. }
  5090. } else {
  5091. return targetSelector;
  5092. }
  5093. };
  5094. const TeleportImpl = {
  5095. __isTeleport: true,
  5096. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
  5097. const {
  5098. mc: mountChildren,
  5099. pc: patchChildren,
  5100. pbc: patchBlockChildren,
  5101. o: { insert, querySelector, createText, createComment }
  5102. } = internals;
  5103. const disabled = isTeleportDisabled(n2.props);
  5104. let { shapeFlag, children, dynamicChildren } = n2;
  5105. if (n1 == null) {
  5106. const placeholder = n2.el = createText("");
  5107. const mainAnchor = n2.anchor = createText("");
  5108. insert(placeholder, container, anchor);
  5109. insert(mainAnchor, container, anchor);
  5110. const target = n2.target = resolveTarget(n2.props, querySelector);
  5111. const targetAnchor = n2.targetAnchor = createText("");
  5112. if (target) {
  5113. insert(targetAnchor, target);
  5114. isSVG = isSVG || isTargetSVG(target);
  5115. }
  5116. const mount = (container2, anchor2) => {
  5117. if (shapeFlag & 16) {
  5118. mountChildren(
  5119. children,
  5120. container2,
  5121. anchor2,
  5122. parentComponent,
  5123. parentSuspense,
  5124. isSVG,
  5125. slotScopeIds,
  5126. optimized
  5127. );
  5128. }
  5129. };
  5130. if (disabled) {
  5131. mount(container, mainAnchor);
  5132. } else if (target) {
  5133. mount(target, targetAnchor);
  5134. }
  5135. } else {
  5136. n2.el = n1.el;
  5137. const mainAnchor = n2.anchor = n1.anchor;
  5138. const target = n2.target = n1.target;
  5139. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  5140. const wasDisabled = isTeleportDisabled(n1.props);
  5141. const currentContainer = wasDisabled ? container : target;
  5142. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  5143. isSVG = isSVG || isTargetSVG(target);
  5144. if (dynamicChildren) {
  5145. patchBlockChildren(
  5146. n1.dynamicChildren,
  5147. dynamicChildren,
  5148. currentContainer,
  5149. parentComponent,
  5150. parentSuspense,
  5151. isSVG,
  5152. slotScopeIds
  5153. );
  5154. traverseStaticChildren(n1, n2, true);
  5155. } else if (!optimized) {
  5156. patchChildren(
  5157. n1,
  5158. n2,
  5159. currentContainer,
  5160. currentAnchor,
  5161. parentComponent,
  5162. parentSuspense,
  5163. isSVG,
  5164. slotScopeIds,
  5165. false
  5166. );
  5167. }
  5168. if (disabled) {
  5169. if (!wasDisabled) {
  5170. moveTeleport(
  5171. n2,
  5172. container,
  5173. mainAnchor,
  5174. internals,
  5175. 1
  5176. );
  5177. }
  5178. } else {
  5179. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  5180. const nextTarget = n2.target = resolveTarget(
  5181. n2.props,
  5182. querySelector
  5183. );
  5184. if (nextTarget) {
  5185. moveTeleport(
  5186. n2,
  5187. nextTarget,
  5188. null,
  5189. internals,
  5190. 0
  5191. );
  5192. }
  5193. } else if (wasDisabled) {
  5194. moveTeleport(
  5195. n2,
  5196. target,
  5197. targetAnchor,
  5198. internals,
  5199. 1
  5200. );
  5201. }
  5202. }
  5203. }
  5204. updateCssVars(n2);
  5205. },
  5206. remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  5207. const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
  5208. if (target) {
  5209. hostRemove(targetAnchor);
  5210. }
  5211. if (doRemove || !isTeleportDisabled(props)) {
  5212. hostRemove(anchor);
  5213. if (shapeFlag & 16) {
  5214. for (let i = 0; i < children.length; i++) {
  5215. const child = children[i];
  5216. unmount(
  5217. child,
  5218. parentComponent,
  5219. parentSuspense,
  5220. true,
  5221. !!child.dynamicChildren
  5222. );
  5223. }
  5224. }
  5225. }
  5226. },
  5227. move: moveTeleport,
  5228. hydrate: hydrateTeleport
  5229. };
  5230. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  5231. if (moveType === 0) {
  5232. insert(vnode.targetAnchor, container, parentAnchor);
  5233. }
  5234. const { el, anchor, shapeFlag, children, props } = vnode;
  5235. const isReorder = moveType === 2;
  5236. if (isReorder) {
  5237. insert(el, container, parentAnchor);
  5238. }
  5239. if (!isReorder || isTeleportDisabled(props)) {
  5240. if (shapeFlag & 16) {
  5241. for (let i = 0; i < children.length; i++) {
  5242. move(
  5243. children[i],
  5244. container,
  5245. parentAnchor,
  5246. 2
  5247. );
  5248. }
  5249. }
  5250. }
  5251. if (isReorder) {
  5252. insert(anchor, container, parentAnchor);
  5253. }
  5254. }
  5255. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  5256. o: { nextSibling, parentNode, querySelector }
  5257. }, hydrateChildren) {
  5258. const target = vnode.target = resolveTarget(
  5259. vnode.props,
  5260. querySelector
  5261. );
  5262. if (target) {
  5263. const targetNode = target._lpa || target.firstChild;
  5264. if (vnode.shapeFlag & 16) {
  5265. if (isTeleportDisabled(vnode.props)) {
  5266. vnode.anchor = hydrateChildren(
  5267. nextSibling(node),
  5268. vnode,
  5269. parentNode(node),
  5270. parentComponent,
  5271. parentSuspense,
  5272. slotScopeIds,
  5273. optimized
  5274. );
  5275. vnode.targetAnchor = targetNode;
  5276. } else {
  5277. vnode.anchor = nextSibling(node);
  5278. let targetAnchor = targetNode;
  5279. while (targetAnchor) {
  5280. targetAnchor = nextSibling(targetAnchor);
  5281. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
  5282. vnode.targetAnchor = targetAnchor;
  5283. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  5284. break;
  5285. }
  5286. }
  5287. hydrateChildren(
  5288. targetNode,
  5289. vnode,
  5290. target,
  5291. parentComponent,
  5292. parentSuspense,
  5293. slotScopeIds,
  5294. optimized
  5295. );
  5296. }
  5297. }
  5298. updateCssVars(vnode);
  5299. }
  5300. return vnode.anchor && nextSibling(vnode.anchor);
  5301. }
  5302. const Teleport = TeleportImpl;
  5303. function updateCssVars(vnode) {
  5304. const ctx = vnode.ctx;
  5305. if (ctx && ctx.ut) {
  5306. let node = vnode.children[0].el;
  5307. while (node !== vnode.targetAnchor) {
  5308. if (node.nodeType === 1)
  5309. node.setAttribute("data-v-owner", ctx.uid);
  5310. node = node.nextSibling;
  5311. }
  5312. ctx.ut();
  5313. }
  5314. }
  5315. const Fragment = Symbol.for("v-fgt");
  5316. const Text = Symbol.for("v-txt");
  5317. const Comment = Symbol.for("v-cmt");
  5318. const Static = Symbol.for("v-stc");
  5319. const blockStack = [];
  5320. let currentBlock = null;
  5321. function openBlock(disableTracking = false) {
  5322. blockStack.push(currentBlock = disableTracking ? null : []);
  5323. }
  5324. function closeBlock() {
  5325. blockStack.pop();
  5326. currentBlock = blockStack[blockStack.length - 1] || null;
  5327. }
  5328. let isBlockTreeEnabled = 1;
  5329. function setBlockTracking(value) {
  5330. isBlockTreeEnabled += value;
  5331. }
  5332. function setupBlock(vnode) {
  5333. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || shared.EMPTY_ARR : null;
  5334. closeBlock();
  5335. if (isBlockTreeEnabled > 0 && currentBlock) {
  5336. currentBlock.push(vnode);
  5337. }
  5338. return vnode;
  5339. }
  5340. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  5341. return setupBlock(
  5342. createBaseVNode(
  5343. type,
  5344. props,
  5345. children,
  5346. patchFlag,
  5347. dynamicProps,
  5348. shapeFlag,
  5349. true
  5350. /* isBlock */
  5351. )
  5352. );
  5353. }
  5354. function createBlock(type, props, children, patchFlag, dynamicProps) {
  5355. return setupBlock(
  5356. createVNode(
  5357. type,
  5358. props,
  5359. children,
  5360. patchFlag,
  5361. dynamicProps,
  5362. true
  5363. /* isBlock: prevent a block from tracking itself */
  5364. )
  5365. );
  5366. }
  5367. function isVNode(value) {
  5368. return value ? value.__v_isVNode === true : false;
  5369. }
  5370. function isSameVNodeType(n1, n2) {
  5371. return n1.type === n2.type && n1.key === n2.key;
  5372. }
  5373. function transformVNodeArgs(transformer) {
  5374. }
  5375. const InternalObjectKey = `__vInternal`;
  5376. const normalizeKey = ({ key }) => key != null ? key : null;
  5377. const normalizeRef = ({
  5378. ref,
  5379. ref_key,
  5380. ref_for
  5381. }) => {
  5382. if (typeof ref === "number") {
  5383. ref = "" + ref;
  5384. }
  5385. return ref != null ? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  5386. };
  5387. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  5388. const vnode = {
  5389. __v_isVNode: true,
  5390. __v_skip: true,
  5391. type,
  5392. props,
  5393. key: props && normalizeKey(props),
  5394. ref: props && normalizeRef(props),
  5395. scopeId: currentScopeId,
  5396. slotScopeIds: null,
  5397. children,
  5398. component: null,
  5399. suspense: null,
  5400. ssContent: null,
  5401. ssFallback: null,
  5402. dirs: null,
  5403. transition: null,
  5404. el: null,
  5405. anchor: null,
  5406. target: null,
  5407. targetAnchor: null,
  5408. staticCount: 0,
  5409. shapeFlag,
  5410. patchFlag,
  5411. dynamicProps,
  5412. dynamicChildren: null,
  5413. appContext: null,
  5414. ctx: currentRenderingInstance
  5415. };
  5416. if (needFullChildrenNormalization) {
  5417. normalizeChildren(vnode, children);
  5418. if (shapeFlag & 128) {
  5419. type.normalize(vnode);
  5420. }
  5421. } else if (children) {
  5422. vnode.shapeFlag |= shared.isString(children) ? 8 : 16;
  5423. }
  5424. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  5425. !isBlockNode && // has current parent block
  5426. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  5427. // component nodes also should always be patched, because even if the
  5428. // component doesn't need to update, it needs to persist the instance on to
  5429. // the next vnode so that it can be properly unmounted later.
  5430. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  5431. // vnode should not be considered dynamic due to handler caching.
  5432. vnode.patchFlag !== 32) {
  5433. currentBlock.push(vnode);
  5434. }
  5435. return vnode;
  5436. }
  5437. const createVNode = _createVNode;
  5438. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  5439. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  5440. type = Comment;
  5441. }
  5442. if (isVNode(type)) {
  5443. const cloned = cloneVNode(
  5444. type,
  5445. props,
  5446. true
  5447. /* mergeRef: true */
  5448. );
  5449. if (children) {
  5450. normalizeChildren(cloned, children);
  5451. }
  5452. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  5453. if (cloned.shapeFlag & 6) {
  5454. currentBlock[currentBlock.indexOf(type)] = cloned;
  5455. } else {
  5456. currentBlock.push(cloned);
  5457. }
  5458. }
  5459. cloned.patchFlag |= -2;
  5460. return cloned;
  5461. }
  5462. if (isClassComponent(type)) {
  5463. type = type.__vccOpts;
  5464. }
  5465. if (props) {
  5466. props = guardReactiveProps(props);
  5467. let { class: klass, style } = props;
  5468. if (klass && !shared.isString(klass)) {
  5469. props.class = shared.normalizeClass(klass);
  5470. }
  5471. if (shared.isObject(style)) {
  5472. if (reactivity.isProxy(style) && !shared.isArray(style)) {
  5473. style = shared.extend({}, style);
  5474. }
  5475. props.style = shared.normalizeStyle(style);
  5476. }
  5477. }
  5478. const shapeFlag = shared.isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : shared.isObject(type) ? 4 : shared.isFunction(type) ? 2 : 0;
  5479. return createBaseVNode(
  5480. type,
  5481. props,
  5482. children,
  5483. patchFlag,
  5484. dynamicProps,
  5485. shapeFlag,
  5486. isBlockNode,
  5487. true
  5488. );
  5489. }
  5490. function guardReactiveProps(props) {
  5491. if (!props)
  5492. return null;
  5493. return reactivity.isProxy(props) || InternalObjectKey in props ? shared.extend({}, props) : props;
  5494. }
  5495. function cloneVNode(vnode, extraProps, mergeRef = false) {
  5496. const { props, ref, patchFlag, children } = vnode;
  5497. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  5498. const cloned = {
  5499. __v_isVNode: true,
  5500. __v_skip: true,
  5501. type: vnode.type,
  5502. props: mergedProps,
  5503. key: mergedProps && normalizeKey(mergedProps),
  5504. ref: extraProps && extraProps.ref ? (
  5505. // #2078 in the case of <component :is="vnode" ref="extra"/>
  5506. // if the vnode itself already has a ref, cloneVNode will need to merge
  5507. // the refs so the single vnode can be set on multiple refs
  5508. mergeRef && ref ? shared.isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  5509. ) : ref,
  5510. scopeId: vnode.scopeId,
  5511. slotScopeIds: vnode.slotScopeIds,
  5512. children: children,
  5513. target: vnode.target,
  5514. targetAnchor: vnode.targetAnchor,
  5515. staticCount: vnode.staticCount,
  5516. shapeFlag: vnode.shapeFlag,
  5517. // if the vnode is cloned with extra props, we can no longer assume its
  5518. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  5519. // note: preserve flag for fragments since they use the flag for children
  5520. // fast paths only.
  5521. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  5522. dynamicProps: vnode.dynamicProps,
  5523. dynamicChildren: vnode.dynamicChildren,
  5524. appContext: vnode.appContext,
  5525. dirs: vnode.dirs,
  5526. transition: vnode.transition,
  5527. // These should technically only be non-null on mounted VNodes. However,
  5528. // they *should* be copied for kept-alive vnodes. So we just always copy
  5529. // them since them being non-null during a mount doesn't affect the logic as
  5530. // they will simply be overwritten.
  5531. component: vnode.component,
  5532. suspense: vnode.suspense,
  5533. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  5534. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  5535. el: vnode.el,
  5536. anchor: vnode.anchor,
  5537. ctx: vnode.ctx,
  5538. ce: vnode.ce
  5539. };
  5540. return cloned;
  5541. }
  5542. function createTextVNode(text = " ", flag = 0) {
  5543. return createVNode(Text, null, text, flag);
  5544. }
  5545. function createStaticVNode(content, numberOfNodes) {
  5546. const vnode = createVNode(Static, null, content);
  5547. vnode.staticCount = numberOfNodes;
  5548. return vnode;
  5549. }
  5550. function createCommentVNode(text = "", asBlock = false) {
  5551. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  5552. }
  5553. function normalizeVNode(child) {
  5554. if (child == null || typeof child === "boolean") {
  5555. return createVNode(Comment);
  5556. } else if (shared.isArray(child)) {
  5557. return createVNode(
  5558. Fragment,
  5559. null,
  5560. // #3666, avoid reference pollution when reusing vnode
  5561. child.slice()
  5562. );
  5563. } else if (typeof child === "object") {
  5564. return cloneIfMounted(child);
  5565. } else {
  5566. return createVNode(Text, null, String(child));
  5567. }
  5568. }
  5569. function cloneIfMounted(child) {
  5570. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  5571. }
  5572. function normalizeChildren(vnode, children) {
  5573. let type = 0;
  5574. const { shapeFlag } = vnode;
  5575. if (children == null) {
  5576. children = null;
  5577. } else if (shared.isArray(children)) {
  5578. type = 16;
  5579. } else if (typeof children === "object") {
  5580. if (shapeFlag & (1 | 64)) {
  5581. const slot = children.default;
  5582. if (slot) {
  5583. slot._c && (slot._d = false);
  5584. normalizeChildren(vnode, slot());
  5585. slot._c && (slot._d = true);
  5586. }
  5587. return;
  5588. } else {
  5589. type = 32;
  5590. const slotFlag = children._;
  5591. if (!slotFlag && !(InternalObjectKey in children)) {
  5592. children._ctx = currentRenderingInstance;
  5593. } else if (slotFlag === 3 && currentRenderingInstance) {
  5594. if (currentRenderingInstance.slots._ === 1) {
  5595. children._ = 1;
  5596. } else {
  5597. children._ = 2;
  5598. vnode.patchFlag |= 1024;
  5599. }
  5600. }
  5601. }
  5602. } else if (shared.isFunction(children)) {
  5603. children = { default: children, _ctx: currentRenderingInstance };
  5604. type = 32;
  5605. } else {
  5606. children = String(children);
  5607. if (shapeFlag & 64) {
  5608. type = 16;
  5609. children = [createTextVNode(children)];
  5610. } else {
  5611. type = 8;
  5612. }
  5613. }
  5614. vnode.children = children;
  5615. vnode.shapeFlag |= type;
  5616. }
  5617. function mergeProps(...args) {
  5618. const ret = {};
  5619. for (let i = 0; i < args.length; i++) {
  5620. const toMerge = args[i];
  5621. for (const key in toMerge) {
  5622. if (key === "class") {
  5623. if (ret.class !== toMerge.class) {
  5624. ret.class = shared.normalizeClass([ret.class, toMerge.class]);
  5625. }
  5626. } else if (key === "style") {
  5627. ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
  5628. } else if (shared.isOn(key)) {
  5629. const existing = ret[key];
  5630. const incoming = toMerge[key];
  5631. if (incoming && existing !== incoming && !(shared.isArray(existing) && existing.includes(incoming))) {
  5632. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  5633. }
  5634. } else if (key !== "") {
  5635. ret[key] = toMerge[key];
  5636. }
  5637. }
  5638. }
  5639. return ret;
  5640. }
  5641. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  5642. callWithAsyncErrorHandling(hook, instance, 7, [
  5643. vnode,
  5644. prevVNode
  5645. ]);
  5646. }
  5647. const emptyAppContext = createAppContext();
  5648. let uid = 0;
  5649. function createComponentInstance(vnode, parent, suspense) {
  5650. const type = vnode.type;
  5651. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  5652. const instance = {
  5653. uid: uid++,
  5654. vnode,
  5655. type,
  5656. parent,
  5657. appContext,
  5658. root: null,
  5659. // to be immediately set
  5660. next: null,
  5661. subTree: null,
  5662. // will be set synchronously right after creation
  5663. effect: null,
  5664. update: null,
  5665. // will be set synchronously right after creation
  5666. scope: new reactivity.EffectScope(
  5667. true
  5668. /* detached */
  5669. ),
  5670. render: null,
  5671. proxy: null,
  5672. exposed: null,
  5673. exposeProxy: null,
  5674. withProxy: null,
  5675. provides: parent ? parent.provides : Object.create(appContext.provides),
  5676. accessCache: null,
  5677. renderCache: [],
  5678. // local resolved assets
  5679. components: null,
  5680. directives: null,
  5681. // resolved props and emits options
  5682. propsOptions: normalizePropsOptions(type, appContext),
  5683. emitsOptions: normalizeEmitsOptions(type, appContext),
  5684. // emit
  5685. emit: null,
  5686. // to be set immediately
  5687. emitted: null,
  5688. // props default value
  5689. propsDefaults: shared.EMPTY_OBJ,
  5690. // inheritAttrs
  5691. inheritAttrs: type.inheritAttrs,
  5692. // state
  5693. ctx: shared.EMPTY_OBJ,
  5694. data: shared.EMPTY_OBJ,
  5695. props: shared.EMPTY_OBJ,
  5696. attrs: shared.EMPTY_OBJ,
  5697. slots: shared.EMPTY_OBJ,
  5698. refs: shared.EMPTY_OBJ,
  5699. setupState: shared.EMPTY_OBJ,
  5700. setupContext: null,
  5701. attrsProxy: null,
  5702. slotsProxy: null,
  5703. // suspense related
  5704. suspense,
  5705. suspenseId: suspense ? suspense.pendingId : 0,
  5706. asyncDep: null,
  5707. asyncResolved: false,
  5708. // lifecycle hooks
  5709. // not using enums here because it results in computed properties
  5710. isMounted: false,
  5711. isUnmounted: false,
  5712. isDeactivated: false,
  5713. bc: null,
  5714. c: null,
  5715. bm: null,
  5716. m: null,
  5717. bu: null,
  5718. u: null,
  5719. um: null,
  5720. bum: null,
  5721. da: null,
  5722. a: null,
  5723. rtg: null,
  5724. rtc: null,
  5725. ec: null,
  5726. sp: null
  5727. };
  5728. {
  5729. instance.ctx = { _: instance };
  5730. }
  5731. instance.root = parent ? parent.root : instance;
  5732. instance.emit = emit.bind(null, instance);
  5733. if (vnode.ce) {
  5734. vnode.ce(instance);
  5735. }
  5736. return instance;
  5737. }
  5738. let currentInstance = null;
  5739. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  5740. let internalSetCurrentInstance;
  5741. let globalCurrentInstanceSetters;
  5742. let settersKey = "__VUE_INSTANCE_SETTERS__";
  5743. {
  5744. if (!(globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey])) {
  5745. globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey] = [];
  5746. }
  5747. globalCurrentInstanceSetters.push((i) => currentInstance = i);
  5748. internalSetCurrentInstance = (instance) => {
  5749. if (globalCurrentInstanceSetters.length > 1) {
  5750. globalCurrentInstanceSetters.forEach((s) => s(instance));
  5751. } else {
  5752. globalCurrentInstanceSetters[0](instance);
  5753. }
  5754. };
  5755. }
  5756. const setCurrentInstance = (instance) => {
  5757. internalSetCurrentInstance(instance);
  5758. instance.scope.on();
  5759. };
  5760. const unsetCurrentInstance = () => {
  5761. currentInstance && currentInstance.scope.off();
  5762. internalSetCurrentInstance(null);
  5763. };
  5764. function isStatefulComponent(instance) {
  5765. return instance.vnode.shapeFlag & 4;
  5766. }
  5767. let isInSSRComponentSetup = false;
  5768. function setupComponent(instance, isSSR = false) {
  5769. isInSSRComponentSetup = isSSR;
  5770. const { props, children } = instance.vnode;
  5771. const isStateful = isStatefulComponent(instance);
  5772. initProps(instance, props, isStateful, isSSR);
  5773. initSlots(instance, children);
  5774. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  5775. isInSSRComponentSetup = false;
  5776. return setupResult;
  5777. }
  5778. function setupStatefulComponent(instance, isSSR) {
  5779. const Component = instance.type;
  5780. instance.accessCache = /* @__PURE__ */ Object.create(null);
  5781. instance.proxy = reactivity.markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  5782. const { setup } = Component;
  5783. if (setup) {
  5784. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  5785. setCurrentInstance(instance);
  5786. reactivity.pauseTracking();
  5787. const setupResult = callWithErrorHandling(
  5788. setup,
  5789. instance,
  5790. 0,
  5791. [instance.props, setupContext]
  5792. );
  5793. reactivity.resetTracking();
  5794. unsetCurrentInstance();
  5795. if (shared.isPromise(setupResult)) {
  5796. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  5797. if (isSSR) {
  5798. return setupResult.then((resolvedResult) => {
  5799. handleSetupResult(instance, resolvedResult, isSSR);
  5800. }).catch((e) => {
  5801. handleError(e, instance, 0);
  5802. });
  5803. } else {
  5804. instance.asyncDep = setupResult;
  5805. }
  5806. } else {
  5807. handleSetupResult(instance, setupResult, isSSR);
  5808. }
  5809. } else {
  5810. finishComponentSetup(instance, isSSR);
  5811. }
  5812. }
  5813. function handleSetupResult(instance, setupResult, isSSR) {
  5814. if (shared.isFunction(setupResult)) {
  5815. if (instance.type.__ssrInlineRender) {
  5816. instance.ssrRender = setupResult;
  5817. } else {
  5818. instance.render = setupResult;
  5819. }
  5820. } else if (shared.isObject(setupResult)) {
  5821. instance.setupState = reactivity.proxyRefs(setupResult);
  5822. } else ;
  5823. finishComponentSetup(instance, isSSR);
  5824. }
  5825. let compile;
  5826. let installWithProxy;
  5827. function registerRuntimeCompiler(_compile) {
  5828. compile = _compile;
  5829. installWithProxy = (i) => {
  5830. if (i.render._rc) {
  5831. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  5832. }
  5833. };
  5834. }
  5835. const isRuntimeOnly = () => !compile;
  5836. function finishComponentSetup(instance, isSSR, skipOptions) {
  5837. const Component = instance.type;
  5838. if (!instance.render) {
  5839. if (!isSSR && compile && !Component.render) {
  5840. const template = Component.template || resolveMergedOptions(instance).template;
  5841. if (template) {
  5842. const { isCustomElement, compilerOptions } = instance.appContext.config;
  5843. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  5844. const finalCompilerOptions = shared.extend(
  5845. shared.extend(
  5846. {
  5847. isCustomElement,
  5848. delimiters
  5849. },
  5850. compilerOptions
  5851. ),
  5852. componentCompilerOptions
  5853. );
  5854. Component.render = compile(template, finalCompilerOptions);
  5855. }
  5856. }
  5857. instance.render = Component.render || shared.NOOP;
  5858. if (installWithProxy) {
  5859. installWithProxy(instance);
  5860. }
  5861. }
  5862. {
  5863. setCurrentInstance(instance);
  5864. reactivity.pauseTracking();
  5865. applyOptions(instance);
  5866. reactivity.resetTracking();
  5867. unsetCurrentInstance();
  5868. }
  5869. }
  5870. function getAttrsProxy(instance) {
  5871. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  5872. instance.attrs,
  5873. {
  5874. get(target, key) {
  5875. reactivity.track(instance, "get", "$attrs");
  5876. return target[key];
  5877. }
  5878. }
  5879. ));
  5880. }
  5881. function createSetupContext(instance) {
  5882. const expose = (exposed) => {
  5883. instance.exposed = exposed || {};
  5884. };
  5885. {
  5886. return {
  5887. get attrs() {
  5888. return getAttrsProxy(instance);
  5889. },
  5890. slots: instance.slots,
  5891. emit: instance.emit,
  5892. expose
  5893. };
  5894. }
  5895. }
  5896. function getExposeProxy(instance) {
  5897. if (instance.exposed) {
  5898. return instance.exposeProxy || (instance.exposeProxy = new Proxy(reactivity.proxyRefs(reactivity.markRaw(instance.exposed)), {
  5899. get(target, key) {
  5900. if (key in target) {
  5901. return target[key];
  5902. } else if (key in publicPropertiesMap) {
  5903. return publicPropertiesMap[key](instance);
  5904. }
  5905. },
  5906. has(target, key) {
  5907. return key in target || key in publicPropertiesMap;
  5908. }
  5909. }));
  5910. }
  5911. }
  5912. function getComponentName(Component, includeInferred = true) {
  5913. return shared.isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  5914. }
  5915. function isClassComponent(value) {
  5916. return shared.isFunction(value) && "__vccOpts" in value;
  5917. }
  5918. const computed = (getterOrOptions, debugOptions) => {
  5919. return reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
  5920. };
  5921. function h(type, propsOrChildren, children) {
  5922. const l = arguments.length;
  5923. if (l === 2) {
  5924. if (shared.isObject(propsOrChildren) && !shared.isArray(propsOrChildren)) {
  5925. if (isVNode(propsOrChildren)) {
  5926. return createVNode(type, null, [propsOrChildren]);
  5927. }
  5928. return createVNode(type, propsOrChildren);
  5929. } else {
  5930. return createVNode(type, null, propsOrChildren);
  5931. }
  5932. } else {
  5933. if (l > 3) {
  5934. children = Array.prototype.slice.call(arguments, 2);
  5935. } else if (l === 3 && isVNode(children)) {
  5936. children = [children];
  5937. }
  5938. return createVNode(type, propsOrChildren, children);
  5939. }
  5940. }
  5941. const ssrContextKey = Symbol.for("v-scx");
  5942. const useSSRContext = () => {
  5943. {
  5944. const ctx = inject(ssrContextKey);
  5945. return ctx;
  5946. }
  5947. };
  5948. function initCustomFormatter() {
  5949. {
  5950. return;
  5951. }
  5952. }
  5953. function withMemo(memo, render, cache, index) {
  5954. const cached = cache[index];
  5955. if (cached && isMemoSame(cached, memo)) {
  5956. return cached;
  5957. }
  5958. const ret = render();
  5959. ret.memo = memo.slice();
  5960. return cache[index] = ret;
  5961. }
  5962. function isMemoSame(cached, memo) {
  5963. const prev = cached.memo;
  5964. if (prev.length != memo.length) {
  5965. return false;
  5966. }
  5967. for (let i = 0; i < prev.length; i++) {
  5968. if (shared.hasChanged(prev[i], memo[i])) {
  5969. return false;
  5970. }
  5971. }
  5972. if (isBlockTreeEnabled > 0 && currentBlock) {
  5973. currentBlock.push(cached);
  5974. }
  5975. return true;
  5976. }
  5977. const version = "3.3.4";
  5978. const _ssrUtils = {
  5979. createComponentInstance,
  5980. setupComponent,
  5981. renderComponentRoot,
  5982. setCurrentRenderingInstance,
  5983. isVNode: isVNode,
  5984. normalizeVNode
  5985. };
  5986. const ssrUtils = _ssrUtils ;
  5987. const resolveFilter = null;
  5988. const compatUtils = null;
  5989. exports.EffectScope = reactivity.EffectScope;
  5990. exports.ReactiveEffect = reactivity.ReactiveEffect;
  5991. exports.customRef = reactivity.customRef;
  5992. exports.effect = reactivity.effect;
  5993. exports.effectScope = reactivity.effectScope;
  5994. exports.getCurrentScope = reactivity.getCurrentScope;
  5995. exports.isProxy = reactivity.isProxy;
  5996. exports.isReactive = reactivity.isReactive;
  5997. exports.isReadonly = reactivity.isReadonly;
  5998. exports.isRef = reactivity.isRef;
  5999. exports.isShallow = reactivity.isShallow;
  6000. exports.markRaw = reactivity.markRaw;
  6001. exports.onScopeDispose = reactivity.onScopeDispose;
  6002. exports.proxyRefs = reactivity.proxyRefs;
  6003. exports.reactive = reactivity.reactive;
  6004. exports.readonly = reactivity.readonly;
  6005. exports.ref = reactivity.ref;
  6006. exports.shallowReactive = reactivity.shallowReactive;
  6007. exports.shallowReadonly = reactivity.shallowReadonly;
  6008. exports.shallowRef = reactivity.shallowRef;
  6009. exports.stop = reactivity.stop;
  6010. exports.toRaw = reactivity.toRaw;
  6011. exports.toRef = reactivity.toRef;
  6012. exports.toRefs = reactivity.toRefs;
  6013. exports.toValue = reactivity.toValue;
  6014. exports.triggerRef = reactivity.triggerRef;
  6015. exports.unref = reactivity.unref;
  6016. exports.camelize = shared.camelize;
  6017. exports.capitalize = shared.capitalize;
  6018. exports.normalizeClass = shared.normalizeClass;
  6019. exports.normalizeProps = shared.normalizeProps;
  6020. exports.normalizeStyle = shared.normalizeStyle;
  6021. exports.toDisplayString = shared.toDisplayString;
  6022. exports.toHandlerKey = shared.toHandlerKey;
  6023. exports.BaseTransition = BaseTransition;
  6024. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  6025. exports.Comment = Comment;
  6026. exports.Fragment = Fragment;
  6027. exports.KeepAlive = KeepAlive;
  6028. exports.Static = Static;
  6029. exports.Suspense = Suspense;
  6030. exports.Teleport = Teleport;
  6031. exports.Text = Text;
  6032. exports.assertNumber = assertNumber;
  6033. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  6034. exports.callWithErrorHandling = callWithErrorHandling;
  6035. exports.cloneVNode = cloneVNode;
  6036. exports.compatUtils = compatUtils;
  6037. exports.computed = computed;
  6038. exports.createBlock = createBlock;
  6039. exports.createCommentVNode = createCommentVNode;
  6040. exports.createElementBlock = createElementBlock;
  6041. exports.createElementVNode = createBaseVNode;
  6042. exports.createHydrationRenderer = createHydrationRenderer;
  6043. exports.createPropsRestProxy = createPropsRestProxy;
  6044. exports.createRenderer = createRenderer;
  6045. exports.createSlots = createSlots;
  6046. exports.createStaticVNode = createStaticVNode;
  6047. exports.createTextVNode = createTextVNode;
  6048. exports.createVNode = createVNode;
  6049. exports.defineAsyncComponent = defineAsyncComponent;
  6050. exports.defineComponent = defineComponent;
  6051. exports.defineEmits = defineEmits;
  6052. exports.defineExpose = defineExpose;
  6053. exports.defineModel = defineModel;
  6054. exports.defineOptions = defineOptions;
  6055. exports.defineProps = defineProps;
  6056. exports.defineSlots = defineSlots;
  6057. exports.getCurrentInstance = getCurrentInstance;
  6058. exports.getTransitionRawChildren = getTransitionRawChildren;
  6059. exports.guardReactiveProps = guardReactiveProps;
  6060. exports.h = h;
  6061. exports.handleError = handleError;
  6062. exports.hasInjectionContext = hasInjectionContext;
  6063. exports.initCustomFormatter = initCustomFormatter;
  6064. exports.inject = inject;
  6065. exports.isMemoSame = isMemoSame;
  6066. exports.isRuntimeOnly = isRuntimeOnly;
  6067. exports.isVNode = isVNode;
  6068. exports.mergeDefaults = mergeDefaults;
  6069. exports.mergeModels = mergeModels;
  6070. exports.mergeProps = mergeProps;
  6071. exports.nextTick = nextTick;
  6072. exports.onActivated = onActivated;
  6073. exports.onBeforeMount = onBeforeMount;
  6074. exports.onBeforeUnmount = onBeforeUnmount;
  6075. exports.onBeforeUpdate = onBeforeUpdate;
  6076. exports.onDeactivated = onDeactivated;
  6077. exports.onErrorCaptured = onErrorCaptured;
  6078. exports.onMounted = onMounted;
  6079. exports.onRenderTracked = onRenderTracked;
  6080. exports.onRenderTriggered = onRenderTriggered;
  6081. exports.onServerPrefetch = onServerPrefetch;
  6082. exports.onUnmounted = onUnmounted;
  6083. exports.onUpdated = onUpdated;
  6084. exports.openBlock = openBlock;
  6085. exports.popScopeId = popScopeId;
  6086. exports.provide = provide;
  6087. exports.pushScopeId = pushScopeId;
  6088. exports.queuePostFlushCb = queuePostFlushCb;
  6089. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  6090. exports.renderList = renderList;
  6091. exports.renderSlot = renderSlot;
  6092. exports.resolveComponent = resolveComponent;
  6093. exports.resolveDirective = resolveDirective;
  6094. exports.resolveDynamicComponent = resolveDynamicComponent;
  6095. exports.resolveFilter = resolveFilter;
  6096. exports.resolveTransitionHooks = resolveTransitionHooks;
  6097. exports.setBlockTracking = setBlockTracking;
  6098. exports.setDevtoolsHook = setDevtoolsHook;
  6099. exports.setTransitionHooks = setTransitionHooks;
  6100. exports.ssrContextKey = ssrContextKey;
  6101. exports.ssrUtils = ssrUtils;
  6102. exports.toHandlers = toHandlers;
  6103. exports.transformVNodeArgs = transformVNodeArgs;
  6104. exports.useAttrs = useAttrs;
  6105. exports.useModel = useModel;
  6106. exports.useSSRContext = useSSRContext;
  6107. exports.useSlots = useSlots;
  6108. exports.useTransitionState = useTransitionState;
  6109. exports.version = version;
  6110. exports.warn = warn$1;
  6111. exports.watch = watch;
  6112. exports.watchEffect = watchEffect;
  6113. exports.watchPostEffect = watchPostEffect;
  6114. exports.watchSyncEffect = watchSyncEffect;
  6115. exports.withAsyncContext = withAsyncContext;
  6116. exports.withCtx = withCtx;
  6117. exports.withDefaults = withDefaults;
  6118. exports.withDirectives = withDirectives;
  6119. exports.withMemo = withMemo;
  6120. exports.withScopeId = withScopeId;