9e8612bdc0626ac1c2fcb94cf7ce430cf7176006b223ffdffe470d7dc853afd39149737ac9dddb7e68f2e02ab040462e92fd24211d6bb98afc55854c2ada94 194 KB

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