runtime-core.cjs.js 224 KB

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