runtime-core.cjs.prod.js 191 KB

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