runtime-core.cjs.js 247 KB

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