vue.global.js 550 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096
  1. /**
  2. * vue v3.5.13
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. var Vue = (function (exports) {
  7. 'use strict';
  8. /*! #__NO_SIDE_EFFECTS__ */
  9. // @__NO_SIDE_EFFECTS__
  10. function makeMap(str) {
  11. const map = /* @__PURE__ */ Object.create(null);
  12. for (const key of str.split(",")) map[key] = 1;
  13. return (val) => val in map;
  14. }
  15. const EMPTY_OBJ = Object.freeze({}) ;
  16. const EMPTY_ARR = Object.freeze([]) ;
  17. const NOOP = () => {
  18. };
  19. const NO = () => false;
  20. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  21. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  22. const isModelListener = (key) => key.startsWith("onUpdate:");
  23. const extend = Object.assign;
  24. const remove = (arr, el) => {
  25. const i = arr.indexOf(el);
  26. if (i > -1) {
  27. arr.splice(i, 1);
  28. }
  29. };
  30. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  31. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  32. const isArray = Array.isArray;
  33. const isMap = (val) => toTypeString(val) === "[object Map]";
  34. const isSet = (val) => toTypeString(val) === "[object Set]";
  35. const isDate = (val) => toTypeString(val) === "[object Date]";
  36. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  37. const isFunction = (val) => typeof val === "function";
  38. const isString = (val) => typeof val === "string";
  39. const isSymbol = (val) => typeof val === "symbol";
  40. const isObject = (val) => val !== null && typeof val === "object";
  41. const isPromise = (val) => {
  42. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  43. };
  44. const objectToString = Object.prototype.toString;
  45. const toTypeString = (value) => objectToString.call(value);
  46. const toRawType = (value) => {
  47. return toTypeString(value).slice(8, -1);
  48. };
  49. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  50. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  51. const isReservedProp = /* @__PURE__ */ makeMap(
  52. // the leading comma is intentional so empty string "" is also included
  53. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  54. );
  55. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  56. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  57. );
  58. const cacheStringFunction = (fn) => {
  59. const cache = /* @__PURE__ */ Object.create(null);
  60. return (str) => {
  61. const hit = cache[str];
  62. return hit || (cache[str] = fn(str));
  63. };
  64. };
  65. const camelizeRE = /-(\w)/g;
  66. const camelize = cacheStringFunction(
  67. (str) => {
  68. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  69. }
  70. );
  71. const hyphenateRE = /\B([A-Z])/g;
  72. const hyphenate = cacheStringFunction(
  73. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  74. );
  75. const capitalize = cacheStringFunction((str) => {
  76. return str.charAt(0).toUpperCase() + str.slice(1);
  77. });
  78. const toHandlerKey = cacheStringFunction(
  79. (str) => {
  80. const s = str ? `on${capitalize(str)}` : ``;
  81. return s;
  82. }
  83. );
  84. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  85. const invokeArrayFns = (fns, ...arg) => {
  86. for (let i = 0; i < fns.length; i++) {
  87. fns[i](...arg);
  88. }
  89. };
  90. const def = (obj, key, value, writable = false) => {
  91. Object.defineProperty(obj, key, {
  92. configurable: true,
  93. enumerable: false,
  94. writable,
  95. value
  96. });
  97. };
  98. const looseToNumber = (val) => {
  99. const n = parseFloat(val);
  100. return isNaN(n) ? val : n;
  101. };
  102. const toNumber = (val) => {
  103. const n = isString(val) ? Number(val) : NaN;
  104. return isNaN(n) ? val : n;
  105. };
  106. let _globalThis;
  107. const getGlobalThis = () => {
  108. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  109. };
  110. function genCacheKey(source, options) {
  111. return source + JSON.stringify(
  112. options,
  113. (_, val) => typeof val === "function" ? val.toString() : val
  114. );
  115. }
  116. const PatchFlagNames = {
  117. [1]: `TEXT`,
  118. [2]: `CLASS`,
  119. [4]: `STYLE`,
  120. [8]: `PROPS`,
  121. [16]: `FULL_PROPS`,
  122. [32]: `NEED_HYDRATION`,
  123. [64]: `STABLE_FRAGMENT`,
  124. [128]: `KEYED_FRAGMENT`,
  125. [256]: `UNKEYED_FRAGMENT`,
  126. [512]: `NEED_PATCH`,
  127. [1024]: `DYNAMIC_SLOTS`,
  128. [2048]: `DEV_ROOT_FRAGMENT`,
  129. [-1]: `HOISTED`,
  130. [-2]: `BAIL`
  131. };
  132. const slotFlagsText = {
  133. [1]: "STABLE",
  134. [2]: "DYNAMIC",
  135. [3]: "FORWARDED"
  136. };
  137. const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
  138. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  139. const range = 2;
  140. function generateCodeFrame(source, start = 0, end = source.length) {
  141. start = Math.max(0, Math.min(start, source.length));
  142. end = Math.max(0, Math.min(end, source.length));
  143. if (start > end) return "";
  144. let lines = source.split(/(\r?\n)/);
  145. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  146. lines = lines.filter((_, idx) => idx % 2 === 0);
  147. let count = 0;
  148. const res = [];
  149. for (let i = 0; i < lines.length; i++) {
  150. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  151. if (count >= start) {
  152. for (let j = i - range; j <= i + range || end > count; j++) {
  153. if (j < 0 || j >= lines.length) continue;
  154. const line = j + 1;
  155. res.push(
  156. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  157. );
  158. const lineLength = lines[j].length;
  159. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  160. if (j === i) {
  161. const pad = start - (count - (lineLength + newLineSeqLength));
  162. const length = Math.max(
  163. 1,
  164. end > count ? lineLength - pad : end - start
  165. );
  166. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  167. } else if (j > i) {
  168. if (end > count) {
  169. const length = Math.max(Math.min(end - count, lineLength), 1);
  170. res.push(` | ` + "^".repeat(length));
  171. }
  172. count += lineLength + newLineSeqLength;
  173. }
  174. }
  175. break;
  176. }
  177. }
  178. return res.join("\n");
  179. }
  180. function normalizeStyle(value) {
  181. if (isArray(value)) {
  182. const res = {};
  183. for (let i = 0; i < value.length; i++) {
  184. const item = value[i];
  185. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  186. if (normalized) {
  187. for (const key in normalized) {
  188. res[key] = normalized[key];
  189. }
  190. }
  191. }
  192. return res;
  193. } else if (isString(value) || isObject(value)) {
  194. return value;
  195. }
  196. }
  197. const listDelimiterRE = /;(?![^(]*\))/g;
  198. const propertyDelimiterRE = /:([^]+)/;
  199. const styleCommentRE = /\/\*[^]*?\*\//g;
  200. function parseStringStyle(cssText) {
  201. const ret = {};
  202. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  203. if (item) {
  204. const tmp = item.split(propertyDelimiterRE);
  205. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  206. }
  207. });
  208. return ret;
  209. }
  210. function stringifyStyle(styles) {
  211. if (!styles) return "";
  212. if (isString(styles)) return styles;
  213. let ret = "";
  214. for (const key in styles) {
  215. const value = styles[key];
  216. if (isString(value) || typeof value === "number") {
  217. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  218. ret += `${normalizedKey}:${value};`;
  219. }
  220. }
  221. return ret;
  222. }
  223. function normalizeClass(value) {
  224. let res = "";
  225. if (isString(value)) {
  226. res = value;
  227. } else if (isArray(value)) {
  228. for (let i = 0; i < value.length; i++) {
  229. const normalized = normalizeClass(value[i]);
  230. if (normalized) {
  231. res += normalized + " ";
  232. }
  233. }
  234. } else if (isObject(value)) {
  235. for (const name in value) {
  236. if (value[name]) {
  237. res += name + " ";
  238. }
  239. }
  240. }
  241. return res.trim();
  242. }
  243. function normalizeProps(props) {
  244. if (!props) return null;
  245. let { class: klass, style } = props;
  246. if (klass && !isString(klass)) {
  247. props.class = normalizeClass(klass);
  248. }
  249. if (style) {
  250. props.style = normalizeStyle(style);
  251. }
  252. return props;
  253. }
  254. const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
  255. const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
  256. const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
  257. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  258. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  259. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  260. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  261. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  262. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  263. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  264. const isBooleanAttr = /* @__PURE__ */ makeMap(
  265. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  266. );
  267. function includeBooleanAttr(value) {
  268. return !!value || value === "";
  269. }
  270. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  271. `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
  272. );
  273. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  274. `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
  275. );
  276. function isRenderableAttrValue(value) {
  277. if (value == null) {
  278. return false;
  279. }
  280. const type = typeof value;
  281. return type === "string" || type === "number" || type === "boolean";
  282. }
  283. const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
  284. function getEscapedCssVarName(key, doubleEscape) {
  285. return key.replace(
  286. cssVarNameEscapeSymbolsRE,
  287. (s) => `\\${s}`
  288. );
  289. }
  290. function looseCompareArrays(a, b) {
  291. if (a.length !== b.length) return false;
  292. let equal = true;
  293. for (let i = 0; equal && i < a.length; i++) {
  294. equal = looseEqual(a[i], b[i]);
  295. }
  296. return equal;
  297. }
  298. function looseEqual(a, b) {
  299. if (a === b) return true;
  300. let aValidType = isDate(a);
  301. let bValidType = isDate(b);
  302. if (aValidType || bValidType) {
  303. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  304. }
  305. aValidType = isSymbol(a);
  306. bValidType = isSymbol(b);
  307. if (aValidType || bValidType) {
  308. return a === b;
  309. }
  310. aValidType = isArray(a);
  311. bValidType = isArray(b);
  312. if (aValidType || bValidType) {
  313. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  314. }
  315. aValidType = isObject(a);
  316. bValidType = isObject(b);
  317. if (aValidType || bValidType) {
  318. if (!aValidType || !bValidType) {
  319. return false;
  320. }
  321. const aKeysCount = Object.keys(a).length;
  322. const bKeysCount = Object.keys(b).length;
  323. if (aKeysCount !== bKeysCount) {
  324. return false;
  325. }
  326. for (const key in a) {
  327. const aHasKey = a.hasOwnProperty(key);
  328. const bHasKey = b.hasOwnProperty(key);
  329. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  330. return false;
  331. }
  332. }
  333. }
  334. return String(a) === String(b);
  335. }
  336. function looseIndexOf(arr, val) {
  337. return arr.findIndex((item) => looseEqual(item, val));
  338. }
  339. const isRef$1 = (val) => {
  340. return !!(val && val["__v_isRef"] === true);
  341. };
  342. const toDisplayString = (val) => {
  343. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
  344. };
  345. const replacer = (_key, val) => {
  346. if (isRef$1(val)) {
  347. return replacer(_key, val.value);
  348. } else if (isMap(val)) {
  349. return {
  350. [`Map(${val.size})`]: [...val.entries()].reduce(
  351. (entries, [key, val2], i) => {
  352. entries[stringifySymbol(key, i) + " =>"] = val2;
  353. return entries;
  354. },
  355. {}
  356. )
  357. };
  358. } else if (isSet(val)) {
  359. return {
  360. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  361. };
  362. } else if (isSymbol(val)) {
  363. return stringifySymbol(val);
  364. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  365. return String(val);
  366. }
  367. return val;
  368. };
  369. const stringifySymbol = (v, i = "") => {
  370. var _a;
  371. return (
  372. // Symbol.description in es2019+ so we need to cast here to pass
  373. // the lib: es2016 check
  374. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  375. );
  376. };
  377. function warn$2(msg, ...args) {
  378. console.warn(`[Vue warn] ${msg}`, ...args);
  379. }
  380. let activeEffectScope;
  381. class EffectScope {
  382. constructor(detached = false) {
  383. this.detached = detached;
  384. /**
  385. * @internal
  386. */
  387. this._active = true;
  388. /**
  389. * @internal
  390. */
  391. this.effects = [];
  392. /**
  393. * @internal
  394. */
  395. this.cleanups = [];
  396. this._isPaused = false;
  397. this.parent = activeEffectScope;
  398. if (!detached && activeEffectScope) {
  399. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  400. this
  401. ) - 1;
  402. }
  403. }
  404. get active() {
  405. return this._active;
  406. }
  407. pause() {
  408. if (this._active) {
  409. this._isPaused = true;
  410. let i, l;
  411. if (this.scopes) {
  412. for (i = 0, l = this.scopes.length; i < l; i++) {
  413. this.scopes[i].pause();
  414. }
  415. }
  416. for (i = 0, l = this.effects.length; i < l; i++) {
  417. this.effects[i].pause();
  418. }
  419. }
  420. }
  421. /**
  422. * Resumes the effect scope, including all child scopes and effects.
  423. */
  424. resume() {
  425. if (this._active) {
  426. if (this._isPaused) {
  427. this._isPaused = false;
  428. let i, l;
  429. if (this.scopes) {
  430. for (i = 0, l = this.scopes.length; i < l; i++) {
  431. this.scopes[i].resume();
  432. }
  433. }
  434. for (i = 0, l = this.effects.length; i < l; i++) {
  435. this.effects[i].resume();
  436. }
  437. }
  438. }
  439. }
  440. run(fn) {
  441. if (this._active) {
  442. const currentEffectScope = activeEffectScope;
  443. try {
  444. activeEffectScope = this;
  445. return fn();
  446. } finally {
  447. activeEffectScope = currentEffectScope;
  448. }
  449. } else {
  450. warn$2(`cannot run an inactive effect scope.`);
  451. }
  452. }
  453. /**
  454. * This should only be called on non-detached scopes
  455. * @internal
  456. */
  457. on() {
  458. activeEffectScope = this;
  459. }
  460. /**
  461. * This should only be called on non-detached scopes
  462. * @internal
  463. */
  464. off() {
  465. activeEffectScope = this.parent;
  466. }
  467. stop(fromParent) {
  468. if (this._active) {
  469. this._active = false;
  470. let i, l;
  471. for (i = 0, l = this.effects.length; i < l; i++) {
  472. this.effects[i].stop();
  473. }
  474. this.effects.length = 0;
  475. for (i = 0, l = this.cleanups.length; i < l; i++) {
  476. this.cleanups[i]();
  477. }
  478. this.cleanups.length = 0;
  479. if (this.scopes) {
  480. for (i = 0, l = this.scopes.length; i < l; i++) {
  481. this.scopes[i].stop(true);
  482. }
  483. this.scopes.length = 0;
  484. }
  485. if (!this.detached && this.parent && !fromParent) {
  486. const last = this.parent.scopes.pop();
  487. if (last && last !== this) {
  488. this.parent.scopes[this.index] = last;
  489. last.index = this.index;
  490. }
  491. }
  492. this.parent = void 0;
  493. }
  494. }
  495. }
  496. function effectScope(detached) {
  497. return new EffectScope(detached);
  498. }
  499. function getCurrentScope() {
  500. return activeEffectScope;
  501. }
  502. function onScopeDispose(fn, failSilently = false) {
  503. if (activeEffectScope) {
  504. activeEffectScope.cleanups.push(fn);
  505. } else if (!failSilently) {
  506. warn$2(
  507. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  508. );
  509. }
  510. }
  511. let activeSub;
  512. const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
  513. class ReactiveEffect {
  514. constructor(fn) {
  515. this.fn = fn;
  516. /**
  517. * @internal
  518. */
  519. this.deps = void 0;
  520. /**
  521. * @internal
  522. */
  523. this.depsTail = void 0;
  524. /**
  525. * @internal
  526. */
  527. this.flags = 1 | 4;
  528. /**
  529. * @internal
  530. */
  531. this.next = void 0;
  532. /**
  533. * @internal
  534. */
  535. this.cleanup = void 0;
  536. this.scheduler = void 0;
  537. if (activeEffectScope && activeEffectScope.active) {
  538. activeEffectScope.effects.push(this);
  539. }
  540. }
  541. pause() {
  542. this.flags |= 64;
  543. }
  544. resume() {
  545. if (this.flags & 64) {
  546. this.flags &= ~64;
  547. if (pausedQueueEffects.has(this)) {
  548. pausedQueueEffects.delete(this);
  549. this.trigger();
  550. }
  551. }
  552. }
  553. /**
  554. * @internal
  555. */
  556. notify() {
  557. if (this.flags & 2 && !(this.flags & 32)) {
  558. return;
  559. }
  560. if (!(this.flags & 8)) {
  561. batch(this);
  562. }
  563. }
  564. run() {
  565. if (!(this.flags & 1)) {
  566. return this.fn();
  567. }
  568. this.flags |= 2;
  569. cleanupEffect(this);
  570. prepareDeps(this);
  571. const prevEffect = activeSub;
  572. const prevShouldTrack = shouldTrack;
  573. activeSub = this;
  574. shouldTrack = true;
  575. try {
  576. return this.fn();
  577. } finally {
  578. if (activeSub !== this) {
  579. warn$2(
  580. "Active effect was not restored correctly - this is likely a Vue internal bug."
  581. );
  582. }
  583. cleanupDeps(this);
  584. activeSub = prevEffect;
  585. shouldTrack = prevShouldTrack;
  586. this.flags &= ~2;
  587. }
  588. }
  589. stop() {
  590. if (this.flags & 1) {
  591. for (let link = this.deps; link; link = link.nextDep) {
  592. removeSub(link);
  593. }
  594. this.deps = this.depsTail = void 0;
  595. cleanupEffect(this);
  596. this.onStop && this.onStop();
  597. this.flags &= ~1;
  598. }
  599. }
  600. trigger() {
  601. if (this.flags & 64) {
  602. pausedQueueEffects.add(this);
  603. } else if (this.scheduler) {
  604. this.scheduler();
  605. } else {
  606. this.runIfDirty();
  607. }
  608. }
  609. /**
  610. * @internal
  611. */
  612. runIfDirty() {
  613. if (isDirty(this)) {
  614. this.run();
  615. }
  616. }
  617. get dirty() {
  618. return isDirty(this);
  619. }
  620. }
  621. let batchDepth = 0;
  622. let batchedSub;
  623. let batchedComputed;
  624. function batch(sub, isComputed = false) {
  625. sub.flags |= 8;
  626. if (isComputed) {
  627. sub.next = batchedComputed;
  628. batchedComputed = sub;
  629. return;
  630. }
  631. sub.next = batchedSub;
  632. batchedSub = sub;
  633. }
  634. function startBatch() {
  635. batchDepth++;
  636. }
  637. function endBatch() {
  638. if (--batchDepth > 0) {
  639. return;
  640. }
  641. if (batchedComputed) {
  642. let e = batchedComputed;
  643. batchedComputed = void 0;
  644. while (e) {
  645. const next = e.next;
  646. e.next = void 0;
  647. e.flags &= ~8;
  648. e = next;
  649. }
  650. }
  651. let error;
  652. while (batchedSub) {
  653. let e = batchedSub;
  654. batchedSub = void 0;
  655. while (e) {
  656. const next = e.next;
  657. e.next = void 0;
  658. e.flags &= ~8;
  659. if (e.flags & 1) {
  660. try {
  661. ;
  662. e.trigger();
  663. } catch (err) {
  664. if (!error) error = err;
  665. }
  666. }
  667. e = next;
  668. }
  669. }
  670. if (error) throw error;
  671. }
  672. function prepareDeps(sub) {
  673. for (let link = sub.deps; link; link = link.nextDep) {
  674. link.version = -1;
  675. link.prevActiveLink = link.dep.activeLink;
  676. link.dep.activeLink = link;
  677. }
  678. }
  679. function cleanupDeps(sub) {
  680. let head;
  681. let tail = sub.depsTail;
  682. let link = tail;
  683. while (link) {
  684. const prev = link.prevDep;
  685. if (link.version === -1) {
  686. if (link === tail) tail = prev;
  687. removeSub(link);
  688. removeDep(link);
  689. } else {
  690. head = link;
  691. }
  692. link.dep.activeLink = link.prevActiveLink;
  693. link.prevActiveLink = void 0;
  694. link = prev;
  695. }
  696. sub.deps = head;
  697. sub.depsTail = tail;
  698. }
  699. function isDirty(sub) {
  700. for (let link = sub.deps; link; link = link.nextDep) {
  701. if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
  702. return true;
  703. }
  704. }
  705. if (sub._dirty) {
  706. return true;
  707. }
  708. return false;
  709. }
  710. function refreshComputed(computed) {
  711. if (computed.flags & 4 && !(computed.flags & 16)) {
  712. return;
  713. }
  714. computed.flags &= ~16;
  715. if (computed.globalVersion === globalVersion) {
  716. return;
  717. }
  718. computed.globalVersion = globalVersion;
  719. const dep = computed.dep;
  720. computed.flags |= 2;
  721. if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
  722. computed.flags &= ~2;
  723. return;
  724. }
  725. const prevSub = activeSub;
  726. const prevShouldTrack = shouldTrack;
  727. activeSub = computed;
  728. shouldTrack = true;
  729. try {
  730. prepareDeps(computed);
  731. const value = computed.fn(computed._value);
  732. if (dep.version === 0 || hasChanged(value, computed._value)) {
  733. computed._value = value;
  734. dep.version++;
  735. }
  736. } catch (err) {
  737. dep.version++;
  738. throw err;
  739. } finally {
  740. activeSub = prevSub;
  741. shouldTrack = prevShouldTrack;
  742. cleanupDeps(computed);
  743. computed.flags &= ~2;
  744. }
  745. }
  746. function removeSub(link, soft = false) {
  747. const { dep, prevSub, nextSub } = link;
  748. if (prevSub) {
  749. prevSub.nextSub = nextSub;
  750. link.prevSub = void 0;
  751. }
  752. if (nextSub) {
  753. nextSub.prevSub = prevSub;
  754. link.nextSub = void 0;
  755. }
  756. if (dep.subsHead === link) {
  757. dep.subsHead = nextSub;
  758. }
  759. if (dep.subs === link) {
  760. dep.subs = prevSub;
  761. if (!prevSub && dep.computed) {
  762. dep.computed.flags &= ~4;
  763. for (let l = dep.computed.deps; l; l = l.nextDep) {
  764. removeSub(l, true);
  765. }
  766. }
  767. }
  768. if (!soft && !--dep.sc && dep.map) {
  769. dep.map.delete(dep.key);
  770. }
  771. }
  772. function removeDep(link) {
  773. const { prevDep, nextDep } = link;
  774. if (prevDep) {
  775. prevDep.nextDep = nextDep;
  776. link.prevDep = void 0;
  777. }
  778. if (nextDep) {
  779. nextDep.prevDep = prevDep;
  780. link.nextDep = void 0;
  781. }
  782. }
  783. function effect(fn, options) {
  784. if (fn.effect instanceof ReactiveEffect) {
  785. fn = fn.effect.fn;
  786. }
  787. const e = new ReactiveEffect(fn);
  788. if (options) {
  789. extend(e, options);
  790. }
  791. try {
  792. e.run();
  793. } catch (err) {
  794. e.stop();
  795. throw err;
  796. }
  797. const runner = e.run.bind(e);
  798. runner.effect = e;
  799. return runner;
  800. }
  801. function stop(runner) {
  802. runner.effect.stop();
  803. }
  804. let shouldTrack = true;
  805. const trackStack = [];
  806. function pauseTracking() {
  807. trackStack.push(shouldTrack);
  808. shouldTrack = false;
  809. }
  810. function resetTracking() {
  811. const last = trackStack.pop();
  812. shouldTrack = last === void 0 ? true : last;
  813. }
  814. function cleanupEffect(e) {
  815. const { cleanup } = e;
  816. e.cleanup = void 0;
  817. if (cleanup) {
  818. const prevSub = activeSub;
  819. activeSub = void 0;
  820. try {
  821. cleanup();
  822. } finally {
  823. activeSub = prevSub;
  824. }
  825. }
  826. }
  827. let globalVersion = 0;
  828. class Link {
  829. constructor(sub, dep) {
  830. this.sub = sub;
  831. this.dep = dep;
  832. this.version = dep.version;
  833. this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
  834. }
  835. }
  836. class Dep {
  837. constructor(computed) {
  838. this.computed = computed;
  839. this.version = 0;
  840. /**
  841. * Link between this dep and the current active effect
  842. */
  843. this.activeLink = void 0;
  844. /**
  845. * Doubly linked list representing the subscribing effects (tail)
  846. */
  847. this.subs = void 0;
  848. /**
  849. * For object property deps cleanup
  850. */
  851. this.map = void 0;
  852. this.key = void 0;
  853. /**
  854. * Subscriber counter
  855. */
  856. this.sc = 0;
  857. {
  858. this.subsHead = void 0;
  859. }
  860. }
  861. track(debugInfo) {
  862. if (!activeSub || !shouldTrack || activeSub === this.computed) {
  863. return;
  864. }
  865. let link = this.activeLink;
  866. if (link === void 0 || link.sub !== activeSub) {
  867. link = this.activeLink = new Link(activeSub, this);
  868. if (!activeSub.deps) {
  869. activeSub.deps = activeSub.depsTail = link;
  870. } else {
  871. link.prevDep = activeSub.depsTail;
  872. activeSub.depsTail.nextDep = link;
  873. activeSub.depsTail = link;
  874. }
  875. addSub(link);
  876. } else if (link.version === -1) {
  877. link.version = this.version;
  878. if (link.nextDep) {
  879. const next = link.nextDep;
  880. next.prevDep = link.prevDep;
  881. if (link.prevDep) {
  882. link.prevDep.nextDep = next;
  883. }
  884. link.prevDep = activeSub.depsTail;
  885. link.nextDep = void 0;
  886. activeSub.depsTail.nextDep = link;
  887. activeSub.depsTail = link;
  888. if (activeSub.deps === link) {
  889. activeSub.deps = next;
  890. }
  891. }
  892. }
  893. if (activeSub.onTrack) {
  894. activeSub.onTrack(
  895. extend(
  896. {
  897. effect: activeSub
  898. },
  899. debugInfo
  900. )
  901. );
  902. }
  903. return link;
  904. }
  905. trigger(debugInfo) {
  906. this.version++;
  907. globalVersion++;
  908. this.notify(debugInfo);
  909. }
  910. notify(debugInfo) {
  911. startBatch();
  912. try {
  913. if (true) {
  914. for (let head = this.subsHead; head; head = head.nextSub) {
  915. if (head.sub.onTrigger && !(head.sub.flags & 8)) {
  916. head.sub.onTrigger(
  917. extend(
  918. {
  919. effect: head.sub
  920. },
  921. debugInfo
  922. )
  923. );
  924. }
  925. }
  926. }
  927. for (let link = this.subs; link; link = link.prevSub) {
  928. if (link.sub.notify()) {
  929. ;
  930. link.sub.dep.notify();
  931. }
  932. }
  933. } finally {
  934. endBatch();
  935. }
  936. }
  937. }
  938. function addSub(link) {
  939. link.dep.sc++;
  940. if (link.sub.flags & 4) {
  941. const computed = link.dep.computed;
  942. if (computed && !link.dep.subs) {
  943. computed.flags |= 4 | 16;
  944. for (let l = computed.deps; l; l = l.nextDep) {
  945. addSub(l);
  946. }
  947. }
  948. const currentTail = link.dep.subs;
  949. if (currentTail !== link) {
  950. link.prevSub = currentTail;
  951. if (currentTail) currentTail.nextSub = link;
  952. }
  953. if (link.dep.subsHead === void 0) {
  954. link.dep.subsHead = link;
  955. }
  956. link.dep.subs = link;
  957. }
  958. }
  959. const targetMap = /* @__PURE__ */ new WeakMap();
  960. const ITERATE_KEY = Symbol(
  961. "Object iterate"
  962. );
  963. const MAP_KEY_ITERATE_KEY = Symbol(
  964. "Map keys iterate"
  965. );
  966. const ARRAY_ITERATE_KEY = Symbol(
  967. "Array iterate"
  968. );
  969. function track(target, type, key) {
  970. if (shouldTrack && activeSub) {
  971. let depsMap = targetMap.get(target);
  972. if (!depsMap) {
  973. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  974. }
  975. let dep = depsMap.get(key);
  976. if (!dep) {
  977. depsMap.set(key, dep = new Dep());
  978. dep.map = depsMap;
  979. dep.key = key;
  980. }
  981. {
  982. dep.track({
  983. target,
  984. type,
  985. key
  986. });
  987. }
  988. }
  989. }
  990. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  991. const depsMap = targetMap.get(target);
  992. if (!depsMap) {
  993. globalVersion++;
  994. return;
  995. }
  996. const run = (dep) => {
  997. if (dep) {
  998. {
  999. dep.trigger({
  1000. target,
  1001. type,
  1002. key,
  1003. newValue,
  1004. oldValue,
  1005. oldTarget
  1006. });
  1007. }
  1008. }
  1009. };
  1010. startBatch();
  1011. if (type === "clear") {
  1012. depsMap.forEach(run);
  1013. } else {
  1014. const targetIsArray = isArray(target);
  1015. const isArrayIndex = targetIsArray && isIntegerKey(key);
  1016. if (targetIsArray && key === "length") {
  1017. const newLength = Number(newValue);
  1018. depsMap.forEach((dep, key2) => {
  1019. if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
  1020. run(dep);
  1021. }
  1022. });
  1023. } else {
  1024. if (key !== void 0 || depsMap.has(void 0)) {
  1025. run(depsMap.get(key));
  1026. }
  1027. if (isArrayIndex) {
  1028. run(depsMap.get(ARRAY_ITERATE_KEY));
  1029. }
  1030. switch (type) {
  1031. case "add":
  1032. if (!targetIsArray) {
  1033. run(depsMap.get(ITERATE_KEY));
  1034. if (isMap(target)) {
  1035. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1036. }
  1037. } else if (isArrayIndex) {
  1038. run(depsMap.get("length"));
  1039. }
  1040. break;
  1041. case "delete":
  1042. if (!targetIsArray) {
  1043. run(depsMap.get(ITERATE_KEY));
  1044. if (isMap(target)) {
  1045. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1046. }
  1047. }
  1048. break;
  1049. case "set":
  1050. if (isMap(target)) {
  1051. run(depsMap.get(ITERATE_KEY));
  1052. }
  1053. break;
  1054. }
  1055. }
  1056. }
  1057. endBatch();
  1058. }
  1059. function getDepFromReactive(object, key) {
  1060. const depMap = targetMap.get(object);
  1061. return depMap && depMap.get(key);
  1062. }
  1063. function reactiveReadArray(array) {
  1064. const raw = toRaw(array);
  1065. if (raw === array) return raw;
  1066. track(raw, "iterate", ARRAY_ITERATE_KEY);
  1067. return isShallow(array) ? raw : raw.map(toReactive);
  1068. }
  1069. function shallowReadArray(arr) {
  1070. track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
  1071. return arr;
  1072. }
  1073. const arrayInstrumentations = {
  1074. __proto__: null,
  1075. [Symbol.iterator]() {
  1076. return iterator(this, Symbol.iterator, toReactive);
  1077. },
  1078. concat(...args) {
  1079. return reactiveReadArray(this).concat(
  1080. ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
  1081. );
  1082. },
  1083. entries() {
  1084. return iterator(this, "entries", (value) => {
  1085. value[1] = toReactive(value[1]);
  1086. return value;
  1087. });
  1088. },
  1089. every(fn, thisArg) {
  1090. return apply(this, "every", fn, thisArg, void 0, arguments);
  1091. },
  1092. filter(fn, thisArg) {
  1093. return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
  1094. },
  1095. find(fn, thisArg) {
  1096. return apply(this, "find", fn, thisArg, toReactive, arguments);
  1097. },
  1098. findIndex(fn, thisArg) {
  1099. return apply(this, "findIndex", fn, thisArg, void 0, arguments);
  1100. },
  1101. findLast(fn, thisArg) {
  1102. return apply(this, "findLast", fn, thisArg, toReactive, arguments);
  1103. },
  1104. findLastIndex(fn, thisArg) {
  1105. return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
  1106. },
  1107. // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
  1108. forEach(fn, thisArg) {
  1109. return apply(this, "forEach", fn, thisArg, void 0, arguments);
  1110. },
  1111. includes(...args) {
  1112. return searchProxy(this, "includes", args);
  1113. },
  1114. indexOf(...args) {
  1115. return searchProxy(this, "indexOf", args);
  1116. },
  1117. join(separator) {
  1118. return reactiveReadArray(this).join(separator);
  1119. },
  1120. // keys() iterator only reads `length`, no optimisation required
  1121. lastIndexOf(...args) {
  1122. return searchProxy(this, "lastIndexOf", args);
  1123. },
  1124. map(fn, thisArg) {
  1125. return apply(this, "map", fn, thisArg, void 0, arguments);
  1126. },
  1127. pop() {
  1128. return noTracking(this, "pop");
  1129. },
  1130. push(...args) {
  1131. return noTracking(this, "push", args);
  1132. },
  1133. reduce(fn, ...args) {
  1134. return reduce(this, "reduce", fn, args);
  1135. },
  1136. reduceRight(fn, ...args) {
  1137. return reduce(this, "reduceRight", fn, args);
  1138. },
  1139. shift() {
  1140. return noTracking(this, "shift");
  1141. },
  1142. // slice could use ARRAY_ITERATE but also seems to beg for range tracking
  1143. some(fn, thisArg) {
  1144. return apply(this, "some", fn, thisArg, void 0, arguments);
  1145. },
  1146. splice(...args) {
  1147. return noTracking(this, "splice", args);
  1148. },
  1149. toReversed() {
  1150. return reactiveReadArray(this).toReversed();
  1151. },
  1152. toSorted(comparer) {
  1153. return reactiveReadArray(this).toSorted(comparer);
  1154. },
  1155. toSpliced(...args) {
  1156. return reactiveReadArray(this).toSpliced(...args);
  1157. },
  1158. unshift(...args) {
  1159. return noTracking(this, "unshift", args);
  1160. },
  1161. values() {
  1162. return iterator(this, "values", toReactive);
  1163. }
  1164. };
  1165. function iterator(self, method, wrapValue) {
  1166. const arr = shallowReadArray(self);
  1167. const iter = arr[method]();
  1168. if (arr !== self && !isShallow(self)) {
  1169. iter._next = iter.next;
  1170. iter.next = () => {
  1171. const result = iter._next();
  1172. if (result.value) {
  1173. result.value = wrapValue(result.value);
  1174. }
  1175. return result;
  1176. };
  1177. }
  1178. return iter;
  1179. }
  1180. const arrayProto = Array.prototype;
  1181. function apply(self, method, fn, thisArg, wrappedRetFn, args) {
  1182. const arr = shallowReadArray(self);
  1183. const needsWrap = arr !== self && !isShallow(self);
  1184. const methodFn = arr[method];
  1185. if (methodFn !== arrayProto[method]) {
  1186. const result2 = methodFn.apply(self, args);
  1187. return needsWrap ? toReactive(result2) : result2;
  1188. }
  1189. let wrappedFn = fn;
  1190. if (arr !== self) {
  1191. if (needsWrap) {
  1192. wrappedFn = function(item, index) {
  1193. return fn.call(this, toReactive(item), index, self);
  1194. };
  1195. } else if (fn.length > 2) {
  1196. wrappedFn = function(item, index) {
  1197. return fn.call(this, item, index, self);
  1198. };
  1199. }
  1200. }
  1201. const result = methodFn.call(arr, wrappedFn, thisArg);
  1202. return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
  1203. }
  1204. function reduce(self, method, fn, args) {
  1205. const arr = shallowReadArray(self);
  1206. let wrappedFn = fn;
  1207. if (arr !== self) {
  1208. if (!isShallow(self)) {
  1209. wrappedFn = function(acc, item, index) {
  1210. return fn.call(this, acc, toReactive(item), index, self);
  1211. };
  1212. } else if (fn.length > 3) {
  1213. wrappedFn = function(acc, item, index) {
  1214. return fn.call(this, acc, item, index, self);
  1215. };
  1216. }
  1217. }
  1218. return arr[method](wrappedFn, ...args);
  1219. }
  1220. function searchProxy(self, method, args) {
  1221. const arr = toRaw(self);
  1222. track(arr, "iterate", ARRAY_ITERATE_KEY);
  1223. const res = arr[method](...args);
  1224. if ((res === -1 || res === false) && isProxy(args[0])) {
  1225. args[0] = toRaw(args[0]);
  1226. return arr[method](...args);
  1227. }
  1228. return res;
  1229. }
  1230. function noTracking(self, method, args = []) {
  1231. pauseTracking();
  1232. startBatch();
  1233. const res = toRaw(self)[method].apply(self, args);
  1234. endBatch();
  1235. resetTracking();
  1236. return res;
  1237. }
  1238. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  1239. const builtInSymbols = new Set(
  1240. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1241. );
  1242. function hasOwnProperty(key) {
  1243. if (!isSymbol(key)) key = String(key);
  1244. const obj = toRaw(this);
  1245. track(obj, "has", key);
  1246. return obj.hasOwnProperty(key);
  1247. }
  1248. class BaseReactiveHandler {
  1249. constructor(_isReadonly = false, _isShallow = false) {
  1250. this._isReadonly = _isReadonly;
  1251. this._isShallow = _isShallow;
  1252. }
  1253. get(target, key, receiver) {
  1254. if (key === "__v_skip") return target["__v_skip"];
  1255. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  1256. if (key === "__v_isReactive") {
  1257. return !isReadonly2;
  1258. } else if (key === "__v_isReadonly") {
  1259. return isReadonly2;
  1260. } else if (key === "__v_isShallow") {
  1261. return isShallow2;
  1262. } else if (key === "__v_raw") {
  1263. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  1264. // this means the receiver is a user proxy of the reactive proxy
  1265. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  1266. return target;
  1267. }
  1268. return;
  1269. }
  1270. const targetIsArray = isArray(target);
  1271. if (!isReadonly2) {
  1272. let fn;
  1273. if (targetIsArray && (fn = arrayInstrumentations[key])) {
  1274. return fn;
  1275. }
  1276. if (key === "hasOwnProperty") {
  1277. return hasOwnProperty;
  1278. }
  1279. }
  1280. const res = Reflect.get(
  1281. target,
  1282. key,
  1283. // if this is a proxy wrapping a ref, return methods using the raw ref
  1284. // as receiver so that we don't have to call `toRaw` on the ref in all
  1285. // its class methods
  1286. isRef(target) ? target : receiver
  1287. );
  1288. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1289. return res;
  1290. }
  1291. if (!isReadonly2) {
  1292. track(target, "get", key);
  1293. }
  1294. if (isShallow2) {
  1295. return res;
  1296. }
  1297. if (isRef(res)) {
  1298. return targetIsArray && isIntegerKey(key) ? res : res.value;
  1299. }
  1300. if (isObject(res)) {
  1301. return isReadonly2 ? readonly(res) : reactive(res);
  1302. }
  1303. return res;
  1304. }
  1305. }
  1306. class MutableReactiveHandler extends BaseReactiveHandler {
  1307. constructor(isShallow2 = false) {
  1308. super(false, isShallow2);
  1309. }
  1310. set(target, key, value, receiver) {
  1311. let oldValue = target[key];
  1312. if (!this._isShallow) {
  1313. const isOldValueReadonly = isReadonly(oldValue);
  1314. if (!isShallow(value) && !isReadonly(value)) {
  1315. oldValue = toRaw(oldValue);
  1316. value = toRaw(value);
  1317. }
  1318. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  1319. if (isOldValueReadonly) {
  1320. return false;
  1321. } else {
  1322. oldValue.value = value;
  1323. return true;
  1324. }
  1325. }
  1326. }
  1327. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  1328. const result = Reflect.set(
  1329. target,
  1330. key,
  1331. value,
  1332. isRef(target) ? target : receiver
  1333. );
  1334. if (target === toRaw(receiver)) {
  1335. if (!hadKey) {
  1336. trigger(target, "add", key, value);
  1337. } else if (hasChanged(value, oldValue)) {
  1338. trigger(target, "set", key, value, oldValue);
  1339. }
  1340. }
  1341. return result;
  1342. }
  1343. deleteProperty(target, key) {
  1344. const hadKey = hasOwn(target, key);
  1345. const oldValue = target[key];
  1346. const result = Reflect.deleteProperty(target, key);
  1347. if (result && hadKey) {
  1348. trigger(target, "delete", key, void 0, oldValue);
  1349. }
  1350. return result;
  1351. }
  1352. has(target, key) {
  1353. const result = Reflect.has(target, key);
  1354. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  1355. track(target, "has", key);
  1356. }
  1357. return result;
  1358. }
  1359. ownKeys(target) {
  1360. track(
  1361. target,
  1362. "iterate",
  1363. isArray(target) ? "length" : ITERATE_KEY
  1364. );
  1365. return Reflect.ownKeys(target);
  1366. }
  1367. }
  1368. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  1369. constructor(isShallow2 = false) {
  1370. super(true, isShallow2);
  1371. }
  1372. set(target, key) {
  1373. {
  1374. warn$2(
  1375. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1376. target
  1377. );
  1378. }
  1379. return true;
  1380. }
  1381. deleteProperty(target, key) {
  1382. {
  1383. warn$2(
  1384. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  1385. target
  1386. );
  1387. }
  1388. return true;
  1389. }
  1390. }
  1391. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  1392. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  1393. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
  1394. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  1395. const toShallow = (value) => value;
  1396. const getProto = (v) => Reflect.getPrototypeOf(v);
  1397. function createIterableMethod(method, isReadonly2, isShallow2) {
  1398. return function(...args) {
  1399. const target = this["__v_raw"];
  1400. const rawTarget = toRaw(target);
  1401. const targetIsMap = isMap(rawTarget);
  1402. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1403. const isKeyOnly = method === "keys" && targetIsMap;
  1404. const innerIterator = target[method](...args);
  1405. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1406. !isReadonly2 && track(
  1407. rawTarget,
  1408. "iterate",
  1409. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1410. );
  1411. return {
  1412. // iterator protocol
  1413. next() {
  1414. const { value, done } = innerIterator.next();
  1415. return done ? { value, done } : {
  1416. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1417. done
  1418. };
  1419. },
  1420. // iterable protocol
  1421. [Symbol.iterator]() {
  1422. return this;
  1423. }
  1424. };
  1425. };
  1426. }
  1427. function createReadonlyMethod(type) {
  1428. return function(...args) {
  1429. {
  1430. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1431. warn$2(
  1432. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1433. toRaw(this)
  1434. );
  1435. }
  1436. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1437. };
  1438. }
  1439. function createInstrumentations(readonly, shallow) {
  1440. const instrumentations = {
  1441. get(key) {
  1442. const target = this["__v_raw"];
  1443. const rawTarget = toRaw(target);
  1444. const rawKey = toRaw(key);
  1445. if (!readonly) {
  1446. if (hasChanged(key, rawKey)) {
  1447. track(rawTarget, "get", key);
  1448. }
  1449. track(rawTarget, "get", rawKey);
  1450. }
  1451. const { has } = getProto(rawTarget);
  1452. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1453. if (has.call(rawTarget, key)) {
  1454. return wrap(target.get(key));
  1455. } else if (has.call(rawTarget, rawKey)) {
  1456. return wrap(target.get(rawKey));
  1457. } else if (target !== rawTarget) {
  1458. target.get(key);
  1459. }
  1460. },
  1461. get size() {
  1462. const target = this["__v_raw"];
  1463. !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
  1464. return Reflect.get(target, "size", target);
  1465. },
  1466. has(key) {
  1467. const target = this["__v_raw"];
  1468. const rawTarget = toRaw(target);
  1469. const rawKey = toRaw(key);
  1470. if (!readonly) {
  1471. if (hasChanged(key, rawKey)) {
  1472. track(rawTarget, "has", key);
  1473. }
  1474. track(rawTarget, "has", rawKey);
  1475. }
  1476. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  1477. },
  1478. forEach(callback, thisArg) {
  1479. const observed = this;
  1480. const target = observed["__v_raw"];
  1481. const rawTarget = toRaw(target);
  1482. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1483. !readonly && track(rawTarget, "iterate", ITERATE_KEY);
  1484. return target.forEach((value, key) => {
  1485. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1486. });
  1487. }
  1488. };
  1489. extend(
  1490. instrumentations,
  1491. readonly ? {
  1492. add: createReadonlyMethod("add"),
  1493. set: createReadonlyMethod("set"),
  1494. delete: createReadonlyMethod("delete"),
  1495. clear: createReadonlyMethod("clear")
  1496. } : {
  1497. add(value) {
  1498. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1499. value = toRaw(value);
  1500. }
  1501. const target = toRaw(this);
  1502. const proto = getProto(target);
  1503. const hadKey = proto.has.call(target, value);
  1504. if (!hadKey) {
  1505. target.add(value);
  1506. trigger(target, "add", value, value);
  1507. }
  1508. return this;
  1509. },
  1510. set(key, value) {
  1511. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1512. value = toRaw(value);
  1513. }
  1514. const target = toRaw(this);
  1515. const { has, get } = getProto(target);
  1516. let hadKey = has.call(target, key);
  1517. if (!hadKey) {
  1518. key = toRaw(key);
  1519. hadKey = has.call(target, key);
  1520. } else {
  1521. checkIdentityKeys(target, has, key);
  1522. }
  1523. const oldValue = get.call(target, key);
  1524. target.set(key, value);
  1525. if (!hadKey) {
  1526. trigger(target, "add", key, value);
  1527. } else if (hasChanged(value, oldValue)) {
  1528. trigger(target, "set", key, value, oldValue);
  1529. }
  1530. return this;
  1531. },
  1532. delete(key) {
  1533. const target = toRaw(this);
  1534. const { has, get } = getProto(target);
  1535. let hadKey = has.call(target, key);
  1536. if (!hadKey) {
  1537. key = toRaw(key);
  1538. hadKey = has.call(target, key);
  1539. } else {
  1540. checkIdentityKeys(target, has, key);
  1541. }
  1542. const oldValue = get ? get.call(target, key) : void 0;
  1543. const result = target.delete(key);
  1544. if (hadKey) {
  1545. trigger(target, "delete", key, void 0, oldValue);
  1546. }
  1547. return result;
  1548. },
  1549. clear() {
  1550. const target = toRaw(this);
  1551. const hadItems = target.size !== 0;
  1552. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1553. const result = target.clear();
  1554. if (hadItems) {
  1555. trigger(
  1556. target,
  1557. "clear",
  1558. void 0,
  1559. void 0,
  1560. oldTarget
  1561. );
  1562. }
  1563. return result;
  1564. }
  1565. }
  1566. );
  1567. const iteratorMethods = [
  1568. "keys",
  1569. "values",
  1570. "entries",
  1571. Symbol.iterator
  1572. ];
  1573. iteratorMethods.forEach((method) => {
  1574. instrumentations[method] = createIterableMethod(method, readonly, shallow);
  1575. });
  1576. return instrumentations;
  1577. }
  1578. function createInstrumentationGetter(isReadonly2, shallow) {
  1579. const instrumentations = createInstrumentations(isReadonly2, shallow);
  1580. return (target, key, receiver) => {
  1581. if (key === "__v_isReactive") {
  1582. return !isReadonly2;
  1583. } else if (key === "__v_isReadonly") {
  1584. return isReadonly2;
  1585. } else if (key === "__v_raw") {
  1586. return target;
  1587. }
  1588. return Reflect.get(
  1589. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1590. key,
  1591. receiver
  1592. );
  1593. };
  1594. }
  1595. const mutableCollectionHandlers = {
  1596. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1597. };
  1598. const shallowCollectionHandlers = {
  1599. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1600. };
  1601. const readonlyCollectionHandlers = {
  1602. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1603. };
  1604. const shallowReadonlyCollectionHandlers = {
  1605. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1606. };
  1607. function checkIdentityKeys(target, has, key) {
  1608. const rawKey = toRaw(key);
  1609. if (rawKey !== key && has.call(target, rawKey)) {
  1610. const type = toRawType(target);
  1611. warn$2(
  1612. `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
  1613. );
  1614. }
  1615. }
  1616. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1617. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1618. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1619. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1620. function targetTypeMap(rawType) {
  1621. switch (rawType) {
  1622. case "Object":
  1623. case "Array":
  1624. return 1 /* COMMON */;
  1625. case "Map":
  1626. case "Set":
  1627. case "WeakMap":
  1628. case "WeakSet":
  1629. return 2 /* COLLECTION */;
  1630. default:
  1631. return 0 /* INVALID */;
  1632. }
  1633. }
  1634. function getTargetType(value) {
  1635. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1636. }
  1637. function reactive(target) {
  1638. if (isReadonly(target)) {
  1639. return target;
  1640. }
  1641. return createReactiveObject(
  1642. target,
  1643. false,
  1644. mutableHandlers,
  1645. mutableCollectionHandlers,
  1646. reactiveMap
  1647. );
  1648. }
  1649. function shallowReactive(target) {
  1650. return createReactiveObject(
  1651. target,
  1652. false,
  1653. shallowReactiveHandlers,
  1654. shallowCollectionHandlers,
  1655. shallowReactiveMap
  1656. );
  1657. }
  1658. function readonly(target) {
  1659. return createReactiveObject(
  1660. target,
  1661. true,
  1662. readonlyHandlers,
  1663. readonlyCollectionHandlers,
  1664. readonlyMap
  1665. );
  1666. }
  1667. function shallowReadonly(target) {
  1668. return createReactiveObject(
  1669. target,
  1670. true,
  1671. shallowReadonlyHandlers,
  1672. shallowReadonlyCollectionHandlers,
  1673. shallowReadonlyMap
  1674. );
  1675. }
  1676. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1677. if (!isObject(target)) {
  1678. {
  1679. warn$2(
  1680. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1681. target
  1682. )}`
  1683. );
  1684. }
  1685. return target;
  1686. }
  1687. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1688. return target;
  1689. }
  1690. const existingProxy = proxyMap.get(target);
  1691. if (existingProxy) {
  1692. return existingProxy;
  1693. }
  1694. const targetType = getTargetType(target);
  1695. if (targetType === 0 /* INVALID */) {
  1696. return target;
  1697. }
  1698. const proxy = new Proxy(
  1699. target,
  1700. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1701. );
  1702. proxyMap.set(target, proxy);
  1703. return proxy;
  1704. }
  1705. function isReactive(value) {
  1706. if (isReadonly(value)) {
  1707. return isReactive(value["__v_raw"]);
  1708. }
  1709. return !!(value && value["__v_isReactive"]);
  1710. }
  1711. function isReadonly(value) {
  1712. return !!(value && value["__v_isReadonly"]);
  1713. }
  1714. function isShallow(value) {
  1715. return !!(value && value["__v_isShallow"]);
  1716. }
  1717. function isProxy(value) {
  1718. return value ? !!value["__v_raw"] : false;
  1719. }
  1720. function toRaw(observed) {
  1721. const raw = observed && observed["__v_raw"];
  1722. return raw ? toRaw(raw) : observed;
  1723. }
  1724. function markRaw(value) {
  1725. if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
  1726. def(value, "__v_skip", true);
  1727. }
  1728. return value;
  1729. }
  1730. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1731. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1732. function isRef(r) {
  1733. return r ? r["__v_isRef"] === true : false;
  1734. }
  1735. function ref(value) {
  1736. return createRef(value, false);
  1737. }
  1738. function shallowRef(value) {
  1739. return createRef(value, true);
  1740. }
  1741. function createRef(rawValue, shallow) {
  1742. if (isRef(rawValue)) {
  1743. return rawValue;
  1744. }
  1745. return new RefImpl(rawValue, shallow);
  1746. }
  1747. class RefImpl {
  1748. constructor(value, isShallow2) {
  1749. this.dep = new Dep();
  1750. this["__v_isRef"] = true;
  1751. this["__v_isShallow"] = false;
  1752. this._rawValue = isShallow2 ? value : toRaw(value);
  1753. this._value = isShallow2 ? value : toReactive(value);
  1754. this["__v_isShallow"] = isShallow2;
  1755. }
  1756. get value() {
  1757. {
  1758. this.dep.track({
  1759. target: this,
  1760. type: "get",
  1761. key: "value"
  1762. });
  1763. }
  1764. return this._value;
  1765. }
  1766. set value(newValue) {
  1767. const oldValue = this._rawValue;
  1768. const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
  1769. newValue = useDirectValue ? newValue : toRaw(newValue);
  1770. if (hasChanged(newValue, oldValue)) {
  1771. this._rawValue = newValue;
  1772. this._value = useDirectValue ? newValue : toReactive(newValue);
  1773. {
  1774. this.dep.trigger({
  1775. target: this,
  1776. type: "set",
  1777. key: "value",
  1778. newValue,
  1779. oldValue
  1780. });
  1781. }
  1782. }
  1783. }
  1784. }
  1785. function triggerRef(ref2) {
  1786. if (ref2.dep) {
  1787. {
  1788. ref2.dep.trigger({
  1789. target: ref2,
  1790. type: "set",
  1791. key: "value",
  1792. newValue: ref2._value
  1793. });
  1794. }
  1795. }
  1796. }
  1797. function unref(ref2) {
  1798. return isRef(ref2) ? ref2.value : ref2;
  1799. }
  1800. function toValue(source) {
  1801. return isFunction(source) ? source() : unref(source);
  1802. }
  1803. const shallowUnwrapHandlers = {
  1804. get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
  1805. set: (target, key, value, receiver) => {
  1806. const oldValue = target[key];
  1807. if (isRef(oldValue) && !isRef(value)) {
  1808. oldValue.value = value;
  1809. return true;
  1810. } else {
  1811. return Reflect.set(target, key, value, receiver);
  1812. }
  1813. }
  1814. };
  1815. function proxyRefs(objectWithRefs) {
  1816. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1817. }
  1818. class CustomRefImpl {
  1819. constructor(factory) {
  1820. this["__v_isRef"] = true;
  1821. this._value = void 0;
  1822. const dep = this.dep = new Dep();
  1823. const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
  1824. this._get = get;
  1825. this._set = set;
  1826. }
  1827. get value() {
  1828. return this._value = this._get();
  1829. }
  1830. set value(newVal) {
  1831. this._set(newVal);
  1832. }
  1833. }
  1834. function customRef(factory) {
  1835. return new CustomRefImpl(factory);
  1836. }
  1837. function toRefs(object) {
  1838. if (!isProxy(object)) {
  1839. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1840. }
  1841. const ret = isArray(object) ? new Array(object.length) : {};
  1842. for (const key in object) {
  1843. ret[key] = propertyToRef(object, key);
  1844. }
  1845. return ret;
  1846. }
  1847. class ObjectRefImpl {
  1848. constructor(_object, _key, _defaultValue) {
  1849. this._object = _object;
  1850. this._key = _key;
  1851. this._defaultValue = _defaultValue;
  1852. this["__v_isRef"] = true;
  1853. this._value = void 0;
  1854. }
  1855. get value() {
  1856. const val = this._object[this._key];
  1857. return this._value = val === void 0 ? this._defaultValue : val;
  1858. }
  1859. set value(newVal) {
  1860. this._object[this._key] = newVal;
  1861. }
  1862. get dep() {
  1863. return getDepFromReactive(toRaw(this._object), this._key);
  1864. }
  1865. }
  1866. class GetterRefImpl {
  1867. constructor(_getter) {
  1868. this._getter = _getter;
  1869. this["__v_isRef"] = true;
  1870. this["__v_isReadonly"] = true;
  1871. this._value = void 0;
  1872. }
  1873. get value() {
  1874. return this._value = this._getter();
  1875. }
  1876. }
  1877. function toRef(source, key, defaultValue) {
  1878. if (isRef(source)) {
  1879. return source;
  1880. } else if (isFunction(source)) {
  1881. return new GetterRefImpl(source);
  1882. } else if (isObject(source) && arguments.length > 1) {
  1883. return propertyToRef(source, key, defaultValue);
  1884. } else {
  1885. return ref(source);
  1886. }
  1887. }
  1888. function propertyToRef(source, key, defaultValue) {
  1889. const val = source[key];
  1890. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1891. }
  1892. class ComputedRefImpl {
  1893. constructor(fn, setter, isSSR) {
  1894. this.fn = fn;
  1895. this.setter = setter;
  1896. /**
  1897. * @internal
  1898. */
  1899. this._value = void 0;
  1900. /**
  1901. * @internal
  1902. */
  1903. this.dep = new Dep(this);
  1904. /**
  1905. * @internal
  1906. */
  1907. this.__v_isRef = true;
  1908. // TODO isolatedDeclarations "__v_isReadonly"
  1909. // A computed is also a subscriber that tracks other deps
  1910. /**
  1911. * @internal
  1912. */
  1913. this.deps = void 0;
  1914. /**
  1915. * @internal
  1916. */
  1917. this.depsTail = void 0;
  1918. /**
  1919. * @internal
  1920. */
  1921. this.flags = 16;
  1922. /**
  1923. * @internal
  1924. */
  1925. this.globalVersion = globalVersion - 1;
  1926. /**
  1927. * @internal
  1928. */
  1929. this.next = void 0;
  1930. // for backwards compat
  1931. this.effect = this;
  1932. this["__v_isReadonly"] = !setter;
  1933. this.isSSR = isSSR;
  1934. }
  1935. /**
  1936. * @internal
  1937. */
  1938. notify() {
  1939. this.flags |= 16;
  1940. if (!(this.flags & 8) && // avoid infinite self recursion
  1941. activeSub !== this) {
  1942. batch(this, true);
  1943. return true;
  1944. }
  1945. }
  1946. get value() {
  1947. const link = this.dep.track({
  1948. target: this,
  1949. type: "get",
  1950. key: "value"
  1951. }) ;
  1952. refreshComputed(this);
  1953. if (link) {
  1954. link.version = this.dep.version;
  1955. }
  1956. return this._value;
  1957. }
  1958. set value(newValue) {
  1959. if (this.setter) {
  1960. this.setter(newValue);
  1961. } else {
  1962. warn$2("Write operation failed: computed value is readonly");
  1963. }
  1964. }
  1965. }
  1966. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1967. let getter;
  1968. let setter;
  1969. if (isFunction(getterOrOptions)) {
  1970. getter = getterOrOptions;
  1971. } else {
  1972. getter = getterOrOptions.get;
  1973. setter = getterOrOptions.set;
  1974. }
  1975. const cRef = new ComputedRefImpl(getter, setter, isSSR);
  1976. if (debugOptions && !isSSR) {
  1977. cRef.onTrack = debugOptions.onTrack;
  1978. cRef.onTrigger = debugOptions.onTrigger;
  1979. }
  1980. return cRef;
  1981. }
  1982. const TrackOpTypes = {
  1983. "GET": "get",
  1984. "HAS": "has",
  1985. "ITERATE": "iterate"
  1986. };
  1987. const TriggerOpTypes = {
  1988. "SET": "set",
  1989. "ADD": "add",
  1990. "DELETE": "delete",
  1991. "CLEAR": "clear"
  1992. };
  1993. const INITIAL_WATCHER_VALUE = {};
  1994. const cleanupMap = /* @__PURE__ */ new WeakMap();
  1995. let activeWatcher = void 0;
  1996. function getCurrentWatcher() {
  1997. return activeWatcher;
  1998. }
  1999. function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
  2000. if (owner) {
  2001. let cleanups = cleanupMap.get(owner);
  2002. if (!cleanups) cleanupMap.set(owner, cleanups = []);
  2003. cleanups.push(cleanupFn);
  2004. } else if (!failSilently) {
  2005. warn$2(
  2006. `onWatcherCleanup() was called when there was no active watcher to associate with.`
  2007. );
  2008. }
  2009. }
  2010. function watch$1(source, cb, options = EMPTY_OBJ) {
  2011. const { immediate, deep, once, scheduler, augmentJob, call } = options;
  2012. const warnInvalidSource = (s) => {
  2013. (options.onWarn || warn$2)(
  2014. `Invalid watch source: `,
  2015. s,
  2016. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  2017. );
  2018. };
  2019. const reactiveGetter = (source2) => {
  2020. if (deep) return source2;
  2021. if (isShallow(source2) || deep === false || deep === 0)
  2022. return traverse(source2, 1);
  2023. return traverse(source2);
  2024. };
  2025. let effect;
  2026. let getter;
  2027. let cleanup;
  2028. let boundCleanup;
  2029. let forceTrigger = false;
  2030. let isMultiSource = false;
  2031. if (isRef(source)) {
  2032. getter = () => source.value;
  2033. forceTrigger = isShallow(source);
  2034. } else if (isReactive(source)) {
  2035. getter = () => reactiveGetter(source);
  2036. forceTrigger = true;
  2037. } else if (isArray(source)) {
  2038. isMultiSource = true;
  2039. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  2040. getter = () => source.map((s) => {
  2041. if (isRef(s)) {
  2042. return s.value;
  2043. } else if (isReactive(s)) {
  2044. return reactiveGetter(s);
  2045. } else if (isFunction(s)) {
  2046. return call ? call(s, 2) : s();
  2047. } else {
  2048. warnInvalidSource(s);
  2049. }
  2050. });
  2051. } else if (isFunction(source)) {
  2052. if (cb) {
  2053. getter = call ? () => call(source, 2) : source;
  2054. } else {
  2055. getter = () => {
  2056. if (cleanup) {
  2057. pauseTracking();
  2058. try {
  2059. cleanup();
  2060. } finally {
  2061. resetTracking();
  2062. }
  2063. }
  2064. const currentEffect = activeWatcher;
  2065. activeWatcher = effect;
  2066. try {
  2067. return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
  2068. } finally {
  2069. activeWatcher = currentEffect;
  2070. }
  2071. };
  2072. }
  2073. } else {
  2074. getter = NOOP;
  2075. warnInvalidSource(source);
  2076. }
  2077. if (cb && deep) {
  2078. const baseGetter = getter;
  2079. const depth = deep === true ? Infinity : deep;
  2080. getter = () => traverse(baseGetter(), depth);
  2081. }
  2082. const scope = getCurrentScope();
  2083. const watchHandle = () => {
  2084. effect.stop();
  2085. if (scope && scope.active) {
  2086. remove(scope.effects, effect);
  2087. }
  2088. };
  2089. if (once && cb) {
  2090. const _cb = cb;
  2091. cb = (...args) => {
  2092. _cb(...args);
  2093. watchHandle();
  2094. };
  2095. }
  2096. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2097. const job = (immediateFirstRun) => {
  2098. if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
  2099. return;
  2100. }
  2101. if (cb) {
  2102. const newValue = effect.run();
  2103. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
  2104. if (cleanup) {
  2105. cleanup();
  2106. }
  2107. const currentWatcher = activeWatcher;
  2108. activeWatcher = effect;
  2109. try {
  2110. const args = [
  2111. newValue,
  2112. // pass undefined as the old value when it's changed for the first time
  2113. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  2114. boundCleanup
  2115. ];
  2116. call ? call(cb, 3, args) : (
  2117. // @ts-expect-error
  2118. cb(...args)
  2119. );
  2120. oldValue = newValue;
  2121. } finally {
  2122. activeWatcher = currentWatcher;
  2123. }
  2124. }
  2125. } else {
  2126. effect.run();
  2127. }
  2128. };
  2129. if (augmentJob) {
  2130. augmentJob(job);
  2131. }
  2132. effect = new ReactiveEffect(getter);
  2133. effect.scheduler = scheduler ? () => scheduler(job, false) : job;
  2134. boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
  2135. cleanup = effect.onStop = () => {
  2136. const cleanups = cleanupMap.get(effect);
  2137. if (cleanups) {
  2138. if (call) {
  2139. call(cleanups, 4);
  2140. } else {
  2141. for (const cleanup2 of cleanups) cleanup2();
  2142. }
  2143. cleanupMap.delete(effect);
  2144. }
  2145. };
  2146. {
  2147. effect.onTrack = options.onTrack;
  2148. effect.onTrigger = options.onTrigger;
  2149. }
  2150. if (cb) {
  2151. if (immediate) {
  2152. job(true);
  2153. } else {
  2154. oldValue = effect.run();
  2155. }
  2156. } else if (scheduler) {
  2157. scheduler(job.bind(null, true), true);
  2158. } else {
  2159. effect.run();
  2160. }
  2161. watchHandle.pause = effect.pause.bind(effect);
  2162. watchHandle.resume = effect.resume.bind(effect);
  2163. watchHandle.stop = watchHandle;
  2164. return watchHandle;
  2165. }
  2166. function traverse(value, depth = Infinity, seen) {
  2167. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  2168. return value;
  2169. }
  2170. seen = seen || /* @__PURE__ */ new Set();
  2171. if (seen.has(value)) {
  2172. return value;
  2173. }
  2174. seen.add(value);
  2175. depth--;
  2176. if (isRef(value)) {
  2177. traverse(value.value, depth, seen);
  2178. } else if (isArray(value)) {
  2179. for (let i = 0; i < value.length; i++) {
  2180. traverse(value[i], depth, seen);
  2181. }
  2182. } else if (isSet(value) || isMap(value)) {
  2183. value.forEach((v) => {
  2184. traverse(v, depth, seen);
  2185. });
  2186. } else if (isPlainObject(value)) {
  2187. for (const key in value) {
  2188. traverse(value[key], depth, seen);
  2189. }
  2190. for (const key of Object.getOwnPropertySymbols(value)) {
  2191. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  2192. traverse(value[key], depth, seen);
  2193. }
  2194. }
  2195. }
  2196. return value;
  2197. }
  2198. const stack$1 = [];
  2199. function pushWarningContext(vnode) {
  2200. stack$1.push(vnode);
  2201. }
  2202. function popWarningContext() {
  2203. stack$1.pop();
  2204. }
  2205. let isWarning = false;
  2206. function warn$1(msg, ...args) {
  2207. if (isWarning) return;
  2208. isWarning = true;
  2209. pauseTracking();
  2210. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  2211. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  2212. const trace = getComponentTrace();
  2213. if (appWarnHandler) {
  2214. callWithErrorHandling(
  2215. appWarnHandler,
  2216. instance,
  2217. 11,
  2218. [
  2219. // eslint-disable-next-line no-restricted-syntax
  2220. msg + args.map((a) => {
  2221. var _a, _b;
  2222. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  2223. }).join(""),
  2224. instance && instance.proxy,
  2225. trace.map(
  2226. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  2227. ).join("\n"),
  2228. trace
  2229. ]
  2230. );
  2231. } else {
  2232. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  2233. if (trace.length && // avoid spamming console during tests
  2234. true) {
  2235. warnArgs.push(`
  2236. `, ...formatTrace(trace));
  2237. }
  2238. console.warn(...warnArgs);
  2239. }
  2240. resetTracking();
  2241. isWarning = false;
  2242. }
  2243. function getComponentTrace() {
  2244. let currentVNode = stack$1[stack$1.length - 1];
  2245. if (!currentVNode) {
  2246. return [];
  2247. }
  2248. const normalizedStack = [];
  2249. while (currentVNode) {
  2250. const last = normalizedStack[0];
  2251. if (last && last.vnode === currentVNode) {
  2252. last.recurseCount++;
  2253. } else {
  2254. normalizedStack.push({
  2255. vnode: currentVNode,
  2256. recurseCount: 0
  2257. });
  2258. }
  2259. const parentInstance = currentVNode.component && currentVNode.component.parent;
  2260. currentVNode = parentInstance && parentInstance.vnode;
  2261. }
  2262. return normalizedStack;
  2263. }
  2264. function formatTrace(trace) {
  2265. const logs = [];
  2266. trace.forEach((entry, i) => {
  2267. logs.push(...i === 0 ? [] : [`
  2268. `], ...formatTraceEntry(entry));
  2269. });
  2270. return logs;
  2271. }
  2272. function formatTraceEntry({ vnode, recurseCount }) {
  2273. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  2274. const isRoot = vnode.component ? vnode.component.parent == null : false;
  2275. const open = ` at <${formatComponentName(
  2276. vnode.component,
  2277. vnode.type,
  2278. isRoot
  2279. )}`;
  2280. const close = `>` + postfix;
  2281. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  2282. }
  2283. function formatProps(props) {
  2284. const res = [];
  2285. const keys = Object.keys(props);
  2286. keys.slice(0, 3).forEach((key) => {
  2287. res.push(...formatProp(key, props[key]));
  2288. });
  2289. if (keys.length > 3) {
  2290. res.push(` ...`);
  2291. }
  2292. return res;
  2293. }
  2294. function formatProp(key, value, raw) {
  2295. if (isString(value)) {
  2296. value = JSON.stringify(value);
  2297. return raw ? value : [`${key}=${value}`];
  2298. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  2299. return raw ? value : [`${key}=${value}`];
  2300. } else if (isRef(value)) {
  2301. value = formatProp(key, toRaw(value.value), true);
  2302. return raw ? value : [`${key}=Ref<`, value, `>`];
  2303. } else if (isFunction(value)) {
  2304. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  2305. } else {
  2306. value = toRaw(value);
  2307. return raw ? value : [`${key}=`, value];
  2308. }
  2309. }
  2310. function assertNumber(val, type) {
  2311. if (val === void 0) {
  2312. return;
  2313. } else if (typeof val !== "number") {
  2314. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  2315. } else if (isNaN(val)) {
  2316. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  2317. }
  2318. }
  2319. const ErrorCodes = {
  2320. "SETUP_FUNCTION": 0,
  2321. "0": "SETUP_FUNCTION",
  2322. "RENDER_FUNCTION": 1,
  2323. "1": "RENDER_FUNCTION",
  2324. "NATIVE_EVENT_HANDLER": 5,
  2325. "5": "NATIVE_EVENT_HANDLER",
  2326. "COMPONENT_EVENT_HANDLER": 6,
  2327. "6": "COMPONENT_EVENT_HANDLER",
  2328. "VNODE_HOOK": 7,
  2329. "7": "VNODE_HOOK",
  2330. "DIRECTIVE_HOOK": 8,
  2331. "8": "DIRECTIVE_HOOK",
  2332. "TRANSITION_HOOK": 9,
  2333. "9": "TRANSITION_HOOK",
  2334. "APP_ERROR_HANDLER": 10,
  2335. "10": "APP_ERROR_HANDLER",
  2336. "APP_WARN_HANDLER": 11,
  2337. "11": "APP_WARN_HANDLER",
  2338. "FUNCTION_REF": 12,
  2339. "12": "FUNCTION_REF",
  2340. "ASYNC_COMPONENT_LOADER": 13,
  2341. "13": "ASYNC_COMPONENT_LOADER",
  2342. "SCHEDULER": 14,
  2343. "14": "SCHEDULER",
  2344. "COMPONENT_UPDATE": 15,
  2345. "15": "COMPONENT_UPDATE",
  2346. "APP_UNMOUNT_CLEANUP": 16,
  2347. "16": "APP_UNMOUNT_CLEANUP"
  2348. };
  2349. const ErrorTypeStrings$1 = {
  2350. ["sp"]: "serverPrefetch hook",
  2351. ["bc"]: "beforeCreate hook",
  2352. ["c"]: "created hook",
  2353. ["bm"]: "beforeMount hook",
  2354. ["m"]: "mounted hook",
  2355. ["bu"]: "beforeUpdate hook",
  2356. ["u"]: "updated",
  2357. ["bum"]: "beforeUnmount hook",
  2358. ["um"]: "unmounted hook",
  2359. ["a"]: "activated hook",
  2360. ["da"]: "deactivated hook",
  2361. ["ec"]: "errorCaptured hook",
  2362. ["rtc"]: "renderTracked hook",
  2363. ["rtg"]: "renderTriggered hook",
  2364. [0]: "setup function",
  2365. [1]: "render function",
  2366. [2]: "watcher getter",
  2367. [3]: "watcher callback",
  2368. [4]: "watcher cleanup function",
  2369. [5]: "native event handler",
  2370. [6]: "component event handler",
  2371. [7]: "vnode hook",
  2372. [8]: "directive hook",
  2373. [9]: "transition hook",
  2374. [10]: "app errorHandler",
  2375. [11]: "app warnHandler",
  2376. [12]: "ref function",
  2377. [13]: "async component loader",
  2378. [14]: "scheduler flush",
  2379. [15]: "component update",
  2380. [16]: "app unmount cleanup function"
  2381. };
  2382. function callWithErrorHandling(fn, instance, type, args) {
  2383. try {
  2384. return args ? fn(...args) : fn();
  2385. } catch (err) {
  2386. handleError(err, instance, type);
  2387. }
  2388. }
  2389. function callWithAsyncErrorHandling(fn, instance, type, args) {
  2390. if (isFunction(fn)) {
  2391. const res = callWithErrorHandling(fn, instance, type, args);
  2392. if (res && isPromise(res)) {
  2393. res.catch((err) => {
  2394. handleError(err, instance, type);
  2395. });
  2396. }
  2397. return res;
  2398. }
  2399. if (isArray(fn)) {
  2400. const values = [];
  2401. for (let i = 0; i < fn.length; i++) {
  2402. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  2403. }
  2404. return values;
  2405. } else {
  2406. warn$1(
  2407. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  2408. );
  2409. }
  2410. }
  2411. function handleError(err, instance, type, throwInDev = true) {
  2412. const contextVNode = instance ? instance.vnode : null;
  2413. const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
  2414. if (instance) {
  2415. let cur = instance.parent;
  2416. const exposedInstance = instance.proxy;
  2417. const errorInfo = ErrorTypeStrings$1[type] ;
  2418. while (cur) {
  2419. const errorCapturedHooks = cur.ec;
  2420. if (errorCapturedHooks) {
  2421. for (let i = 0; i < errorCapturedHooks.length; i++) {
  2422. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  2423. return;
  2424. }
  2425. }
  2426. }
  2427. cur = cur.parent;
  2428. }
  2429. if (errorHandler) {
  2430. pauseTracking();
  2431. callWithErrorHandling(errorHandler, null, 10, [
  2432. err,
  2433. exposedInstance,
  2434. errorInfo
  2435. ]);
  2436. resetTracking();
  2437. return;
  2438. }
  2439. }
  2440. logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
  2441. }
  2442. function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
  2443. {
  2444. const info = ErrorTypeStrings$1[type];
  2445. if (contextVNode) {
  2446. pushWarningContext(contextVNode);
  2447. }
  2448. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  2449. if (contextVNode) {
  2450. popWarningContext();
  2451. }
  2452. if (throwInDev) {
  2453. throw err;
  2454. } else {
  2455. console.error(err);
  2456. }
  2457. }
  2458. }
  2459. const queue = [];
  2460. let flushIndex = -1;
  2461. const pendingPostFlushCbs = [];
  2462. let activePostFlushCbs = null;
  2463. let postFlushIndex = 0;
  2464. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  2465. let currentFlushPromise = null;
  2466. const RECURSION_LIMIT = 100;
  2467. function nextTick(fn) {
  2468. const p = currentFlushPromise || resolvedPromise;
  2469. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  2470. }
  2471. function findInsertionIndex(id) {
  2472. let start = flushIndex + 1;
  2473. let end = queue.length;
  2474. while (start < end) {
  2475. const middle = start + end >>> 1;
  2476. const middleJob = queue[middle];
  2477. const middleJobId = getId(middleJob);
  2478. if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
  2479. start = middle + 1;
  2480. } else {
  2481. end = middle;
  2482. }
  2483. }
  2484. return start;
  2485. }
  2486. function queueJob(job) {
  2487. if (!(job.flags & 1)) {
  2488. const jobId = getId(job);
  2489. const lastJob = queue[queue.length - 1];
  2490. if (!lastJob || // fast path when the job id is larger than the tail
  2491. !(job.flags & 2) && jobId >= getId(lastJob)) {
  2492. queue.push(job);
  2493. } else {
  2494. queue.splice(findInsertionIndex(jobId), 0, job);
  2495. }
  2496. job.flags |= 1;
  2497. queueFlush();
  2498. }
  2499. }
  2500. function queueFlush() {
  2501. if (!currentFlushPromise) {
  2502. currentFlushPromise = resolvedPromise.then(flushJobs);
  2503. }
  2504. }
  2505. function queuePostFlushCb(cb) {
  2506. if (!isArray(cb)) {
  2507. if (activePostFlushCbs && cb.id === -1) {
  2508. activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
  2509. } else if (!(cb.flags & 1)) {
  2510. pendingPostFlushCbs.push(cb);
  2511. cb.flags |= 1;
  2512. }
  2513. } else {
  2514. pendingPostFlushCbs.push(...cb);
  2515. }
  2516. queueFlush();
  2517. }
  2518. function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
  2519. {
  2520. seen = seen || /* @__PURE__ */ new Map();
  2521. }
  2522. for (; i < queue.length; i++) {
  2523. const cb = queue[i];
  2524. if (cb && cb.flags & 2) {
  2525. if (instance && cb.id !== instance.uid) {
  2526. continue;
  2527. }
  2528. if (checkRecursiveUpdates(seen, cb)) {
  2529. continue;
  2530. }
  2531. queue.splice(i, 1);
  2532. i--;
  2533. if (cb.flags & 4) {
  2534. cb.flags &= ~1;
  2535. }
  2536. cb();
  2537. if (!(cb.flags & 4)) {
  2538. cb.flags &= ~1;
  2539. }
  2540. }
  2541. }
  2542. }
  2543. function flushPostFlushCbs(seen) {
  2544. if (pendingPostFlushCbs.length) {
  2545. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  2546. (a, b) => getId(a) - getId(b)
  2547. );
  2548. pendingPostFlushCbs.length = 0;
  2549. if (activePostFlushCbs) {
  2550. activePostFlushCbs.push(...deduped);
  2551. return;
  2552. }
  2553. activePostFlushCbs = deduped;
  2554. {
  2555. seen = seen || /* @__PURE__ */ new Map();
  2556. }
  2557. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  2558. const cb = activePostFlushCbs[postFlushIndex];
  2559. if (checkRecursiveUpdates(seen, cb)) {
  2560. continue;
  2561. }
  2562. if (cb.flags & 4) {
  2563. cb.flags &= ~1;
  2564. }
  2565. if (!(cb.flags & 8)) cb();
  2566. cb.flags &= ~1;
  2567. }
  2568. activePostFlushCbs = null;
  2569. postFlushIndex = 0;
  2570. }
  2571. }
  2572. const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
  2573. function flushJobs(seen) {
  2574. {
  2575. seen = seen || /* @__PURE__ */ new Map();
  2576. }
  2577. const check = (job) => checkRecursiveUpdates(seen, job) ;
  2578. try {
  2579. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  2580. const job = queue[flushIndex];
  2581. if (job && !(job.flags & 8)) {
  2582. if (check(job)) {
  2583. continue;
  2584. }
  2585. if (job.flags & 4) {
  2586. job.flags &= ~1;
  2587. }
  2588. callWithErrorHandling(
  2589. job,
  2590. job.i,
  2591. job.i ? 15 : 14
  2592. );
  2593. if (!(job.flags & 4)) {
  2594. job.flags &= ~1;
  2595. }
  2596. }
  2597. }
  2598. } finally {
  2599. for (; flushIndex < queue.length; flushIndex++) {
  2600. const job = queue[flushIndex];
  2601. if (job) {
  2602. job.flags &= ~1;
  2603. }
  2604. }
  2605. flushIndex = -1;
  2606. queue.length = 0;
  2607. flushPostFlushCbs(seen);
  2608. currentFlushPromise = null;
  2609. if (queue.length || pendingPostFlushCbs.length) {
  2610. flushJobs(seen);
  2611. }
  2612. }
  2613. }
  2614. function checkRecursiveUpdates(seen, fn) {
  2615. const count = seen.get(fn) || 0;
  2616. if (count > RECURSION_LIMIT) {
  2617. const instance = fn.i;
  2618. const componentName = instance && getComponentName(instance.type);
  2619. handleError(
  2620. `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.`,
  2621. null,
  2622. 10
  2623. );
  2624. return true;
  2625. }
  2626. seen.set(fn, count + 1);
  2627. return false;
  2628. }
  2629. let isHmrUpdating = false;
  2630. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2631. {
  2632. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2633. createRecord: tryWrap(createRecord),
  2634. rerender: tryWrap(rerender),
  2635. reload: tryWrap(reload)
  2636. };
  2637. }
  2638. const map = /* @__PURE__ */ new Map();
  2639. function registerHMR(instance) {
  2640. const id = instance.type.__hmrId;
  2641. let record = map.get(id);
  2642. if (!record) {
  2643. createRecord(id, instance.type);
  2644. record = map.get(id);
  2645. }
  2646. record.instances.add(instance);
  2647. }
  2648. function unregisterHMR(instance) {
  2649. map.get(instance.type.__hmrId).instances.delete(instance);
  2650. }
  2651. function createRecord(id, initialDef) {
  2652. if (map.has(id)) {
  2653. return false;
  2654. }
  2655. map.set(id, {
  2656. initialDef: normalizeClassComponent(initialDef),
  2657. instances: /* @__PURE__ */ new Set()
  2658. });
  2659. return true;
  2660. }
  2661. function normalizeClassComponent(component) {
  2662. return isClassComponent(component) ? component.__vccOpts : component;
  2663. }
  2664. function rerender(id, newRender) {
  2665. const record = map.get(id);
  2666. if (!record) {
  2667. return;
  2668. }
  2669. record.initialDef.render = newRender;
  2670. [...record.instances].forEach((instance) => {
  2671. if (newRender) {
  2672. instance.render = newRender;
  2673. normalizeClassComponent(instance.type).render = newRender;
  2674. }
  2675. instance.renderCache = [];
  2676. isHmrUpdating = true;
  2677. instance.update();
  2678. isHmrUpdating = false;
  2679. });
  2680. }
  2681. function reload(id, newComp) {
  2682. const record = map.get(id);
  2683. if (!record) return;
  2684. newComp = normalizeClassComponent(newComp);
  2685. updateComponentDef(record.initialDef, newComp);
  2686. const instances = [...record.instances];
  2687. for (let i = 0; i < instances.length; i++) {
  2688. const instance = instances[i];
  2689. const oldComp = normalizeClassComponent(instance.type);
  2690. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2691. if (!dirtyInstances) {
  2692. if (oldComp !== record.initialDef) {
  2693. updateComponentDef(oldComp, newComp);
  2694. }
  2695. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2696. }
  2697. dirtyInstances.add(instance);
  2698. instance.appContext.propsCache.delete(instance.type);
  2699. instance.appContext.emitsCache.delete(instance.type);
  2700. instance.appContext.optionsCache.delete(instance.type);
  2701. if (instance.ceReload) {
  2702. dirtyInstances.add(instance);
  2703. instance.ceReload(newComp.styles);
  2704. dirtyInstances.delete(instance);
  2705. } else if (instance.parent) {
  2706. queueJob(() => {
  2707. isHmrUpdating = true;
  2708. instance.parent.update();
  2709. isHmrUpdating = false;
  2710. dirtyInstances.delete(instance);
  2711. });
  2712. } else if (instance.appContext.reload) {
  2713. instance.appContext.reload();
  2714. } else if (typeof window !== "undefined") {
  2715. window.location.reload();
  2716. } else {
  2717. console.warn(
  2718. "[HMR] Root or manually mounted instance modified. Full reload required."
  2719. );
  2720. }
  2721. if (instance.root.ce && instance !== instance.root) {
  2722. instance.root.ce._removeChildStyle(oldComp);
  2723. }
  2724. }
  2725. queuePostFlushCb(() => {
  2726. hmrDirtyComponents.clear();
  2727. });
  2728. }
  2729. function updateComponentDef(oldComp, newComp) {
  2730. extend(oldComp, newComp);
  2731. for (const key in oldComp) {
  2732. if (key !== "__file" && !(key in newComp)) {
  2733. delete oldComp[key];
  2734. }
  2735. }
  2736. }
  2737. function tryWrap(fn) {
  2738. return (id, arg) => {
  2739. try {
  2740. return fn(id, arg);
  2741. } catch (e) {
  2742. console.error(e);
  2743. console.warn(
  2744. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2745. );
  2746. }
  2747. };
  2748. }
  2749. let devtools$1;
  2750. let buffer = [];
  2751. let devtoolsNotInstalled = false;
  2752. function emit$1(event, ...args) {
  2753. if (devtools$1) {
  2754. devtools$1.emit(event, ...args);
  2755. } else if (!devtoolsNotInstalled) {
  2756. buffer.push({ event, args });
  2757. }
  2758. }
  2759. function setDevtoolsHook$1(hook, target) {
  2760. var _a, _b;
  2761. devtools$1 = hook;
  2762. if (devtools$1) {
  2763. devtools$1.enabled = true;
  2764. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2765. buffer = [];
  2766. } else if (
  2767. // handle late devtools injection - only do this if we are in an actual
  2768. // browser environment to avoid the timer handle stalling test runner exit
  2769. // (#4815)
  2770. typeof window !== "undefined" && // some envs mock window but not fully
  2771. window.HTMLElement && // also exclude jsdom
  2772. // eslint-disable-next-line no-restricted-syntax
  2773. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2774. ) {
  2775. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2776. replay.push((newHook) => {
  2777. setDevtoolsHook$1(newHook, target);
  2778. });
  2779. setTimeout(() => {
  2780. if (!devtools$1) {
  2781. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2782. devtoolsNotInstalled = true;
  2783. buffer = [];
  2784. }
  2785. }, 3e3);
  2786. } else {
  2787. devtoolsNotInstalled = true;
  2788. buffer = [];
  2789. }
  2790. }
  2791. function devtoolsInitApp(app, version) {
  2792. emit$1("app:init" /* APP_INIT */, app, version, {
  2793. Fragment,
  2794. Text,
  2795. Comment,
  2796. Static
  2797. });
  2798. }
  2799. function devtoolsUnmountApp(app) {
  2800. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2801. }
  2802. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
  2803. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2804. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2805. "component:removed" /* COMPONENT_REMOVED */
  2806. );
  2807. const devtoolsComponentRemoved = (component) => {
  2808. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2809. !devtools$1.cleanupBuffer(component)) {
  2810. _devtoolsComponentRemoved(component);
  2811. }
  2812. };
  2813. /*! #__NO_SIDE_EFFECTS__ */
  2814. // @__NO_SIDE_EFFECTS__
  2815. function createDevtoolsComponentHook(hook) {
  2816. return (component) => {
  2817. emit$1(
  2818. hook,
  2819. component.appContext.app,
  2820. component.uid,
  2821. component.parent ? component.parent.uid : void 0,
  2822. component
  2823. );
  2824. };
  2825. }
  2826. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
  2827. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
  2828. function createDevtoolsPerformanceHook(hook) {
  2829. return (component, type, time) => {
  2830. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2831. };
  2832. }
  2833. function devtoolsComponentEmit(component, event, params) {
  2834. emit$1(
  2835. "component:emit" /* COMPONENT_EMIT */,
  2836. component.appContext.app,
  2837. component,
  2838. event,
  2839. params
  2840. );
  2841. }
  2842. let currentRenderingInstance = null;
  2843. let currentScopeId = null;
  2844. function setCurrentRenderingInstance(instance) {
  2845. const prev = currentRenderingInstance;
  2846. currentRenderingInstance = instance;
  2847. currentScopeId = instance && instance.type.__scopeId || null;
  2848. return prev;
  2849. }
  2850. function pushScopeId(id) {
  2851. currentScopeId = id;
  2852. }
  2853. function popScopeId() {
  2854. currentScopeId = null;
  2855. }
  2856. const withScopeId = (_id) => withCtx;
  2857. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2858. if (!ctx) return fn;
  2859. if (fn._n) {
  2860. return fn;
  2861. }
  2862. const renderFnWithContext = (...args) => {
  2863. if (renderFnWithContext._d) {
  2864. setBlockTracking(-1);
  2865. }
  2866. const prevInstance = setCurrentRenderingInstance(ctx);
  2867. let res;
  2868. try {
  2869. res = fn(...args);
  2870. } finally {
  2871. setCurrentRenderingInstance(prevInstance);
  2872. if (renderFnWithContext._d) {
  2873. setBlockTracking(1);
  2874. }
  2875. }
  2876. {
  2877. devtoolsComponentUpdated(ctx);
  2878. }
  2879. return res;
  2880. };
  2881. renderFnWithContext._n = true;
  2882. renderFnWithContext._c = true;
  2883. renderFnWithContext._d = true;
  2884. return renderFnWithContext;
  2885. }
  2886. function validateDirectiveName(name) {
  2887. if (isBuiltInDirective(name)) {
  2888. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2889. }
  2890. }
  2891. function withDirectives(vnode, directives) {
  2892. if (currentRenderingInstance === null) {
  2893. warn$1(`withDirectives can only be used inside render functions.`);
  2894. return vnode;
  2895. }
  2896. const instance = getComponentPublicInstance(currentRenderingInstance);
  2897. const bindings = vnode.dirs || (vnode.dirs = []);
  2898. for (let i = 0; i < directives.length; i++) {
  2899. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  2900. if (dir) {
  2901. if (isFunction(dir)) {
  2902. dir = {
  2903. mounted: dir,
  2904. updated: dir
  2905. };
  2906. }
  2907. if (dir.deep) {
  2908. traverse(value);
  2909. }
  2910. bindings.push({
  2911. dir,
  2912. instance,
  2913. value,
  2914. oldValue: void 0,
  2915. arg,
  2916. modifiers
  2917. });
  2918. }
  2919. }
  2920. return vnode;
  2921. }
  2922. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  2923. const bindings = vnode.dirs;
  2924. const oldBindings = prevVNode && prevVNode.dirs;
  2925. for (let i = 0; i < bindings.length; i++) {
  2926. const binding = bindings[i];
  2927. if (oldBindings) {
  2928. binding.oldValue = oldBindings[i].value;
  2929. }
  2930. let hook = binding.dir[name];
  2931. if (hook) {
  2932. pauseTracking();
  2933. callWithAsyncErrorHandling(hook, instance, 8, [
  2934. vnode.el,
  2935. binding,
  2936. vnode,
  2937. prevVNode
  2938. ]);
  2939. resetTracking();
  2940. }
  2941. }
  2942. }
  2943. const TeleportEndKey = Symbol("_vte");
  2944. const isTeleport = (type) => type.__isTeleport;
  2945. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  2946. const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
  2947. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  2948. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  2949. const resolveTarget = (props, select) => {
  2950. const targetSelector = props && props.to;
  2951. if (isString(targetSelector)) {
  2952. if (!select) {
  2953. warn$1(
  2954. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  2955. );
  2956. return null;
  2957. } else {
  2958. const target = select(targetSelector);
  2959. if (!target && !isTeleportDisabled(props)) {
  2960. warn$1(
  2961. `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.`
  2962. );
  2963. }
  2964. return target;
  2965. }
  2966. } else {
  2967. if (!targetSelector && !isTeleportDisabled(props)) {
  2968. warn$1(`Invalid Teleport target: ${targetSelector}`);
  2969. }
  2970. return targetSelector;
  2971. }
  2972. };
  2973. const TeleportImpl = {
  2974. name: "Teleport",
  2975. __isTeleport: true,
  2976. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  2977. const {
  2978. mc: mountChildren,
  2979. pc: patchChildren,
  2980. pbc: patchBlockChildren,
  2981. o: { insert, querySelector, createText, createComment }
  2982. } = internals;
  2983. const disabled = isTeleportDisabled(n2.props);
  2984. let { shapeFlag, children, dynamicChildren } = n2;
  2985. if (isHmrUpdating) {
  2986. optimized = false;
  2987. dynamicChildren = null;
  2988. }
  2989. if (n1 == null) {
  2990. const placeholder = n2.el = createComment("teleport start") ;
  2991. const mainAnchor = n2.anchor = createComment("teleport end") ;
  2992. insert(placeholder, container, anchor);
  2993. insert(mainAnchor, container, anchor);
  2994. const mount = (container2, anchor2) => {
  2995. if (shapeFlag & 16) {
  2996. if (parentComponent && parentComponent.isCE) {
  2997. parentComponent.ce._teleportTarget = container2;
  2998. }
  2999. mountChildren(
  3000. children,
  3001. container2,
  3002. anchor2,
  3003. parentComponent,
  3004. parentSuspense,
  3005. namespace,
  3006. slotScopeIds,
  3007. optimized
  3008. );
  3009. }
  3010. };
  3011. const mountToTarget = () => {
  3012. const target = n2.target = resolveTarget(n2.props, querySelector);
  3013. const targetAnchor = prepareAnchor(target, n2, createText, insert);
  3014. if (target) {
  3015. if (namespace !== "svg" && isTargetSVG(target)) {
  3016. namespace = "svg";
  3017. } else if (namespace !== "mathml" && isTargetMathML(target)) {
  3018. namespace = "mathml";
  3019. }
  3020. if (!disabled) {
  3021. mount(target, targetAnchor);
  3022. updateCssVars(n2, false);
  3023. }
  3024. } else if (!disabled) {
  3025. warn$1(
  3026. "Invalid Teleport target on mount:",
  3027. target,
  3028. `(${typeof target})`
  3029. );
  3030. }
  3031. };
  3032. if (disabled) {
  3033. mount(container, mainAnchor);
  3034. updateCssVars(n2, true);
  3035. }
  3036. if (isTeleportDeferred(n2.props)) {
  3037. queuePostRenderEffect(() => {
  3038. mountToTarget();
  3039. n2.el.__isMounted = true;
  3040. }, parentSuspense);
  3041. } else {
  3042. mountToTarget();
  3043. }
  3044. } else {
  3045. if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) {
  3046. queuePostRenderEffect(() => {
  3047. TeleportImpl.process(
  3048. n1,
  3049. n2,
  3050. container,
  3051. anchor,
  3052. parentComponent,
  3053. parentSuspense,
  3054. namespace,
  3055. slotScopeIds,
  3056. optimized,
  3057. internals
  3058. );
  3059. delete n1.el.__isMounted;
  3060. }, parentSuspense);
  3061. return;
  3062. }
  3063. n2.el = n1.el;
  3064. n2.targetStart = n1.targetStart;
  3065. const mainAnchor = n2.anchor = n1.anchor;
  3066. const target = n2.target = n1.target;
  3067. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  3068. const wasDisabled = isTeleportDisabled(n1.props);
  3069. const currentContainer = wasDisabled ? container : target;
  3070. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  3071. if (namespace === "svg" || isTargetSVG(target)) {
  3072. namespace = "svg";
  3073. } else if (namespace === "mathml" || isTargetMathML(target)) {
  3074. namespace = "mathml";
  3075. }
  3076. if (dynamicChildren) {
  3077. patchBlockChildren(
  3078. n1.dynamicChildren,
  3079. dynamicChildren,
  3080. currentContainer,
  3081. parentComponent,
  3082. parentSuspense,
  3083. namespace,
  3084. slotScopeIds
  3085. );
  3086. traverseStaticChildren(n1, n2, true);
  3087. } else if (!optimized) {
  3088. patchChildren(
  3089. n1,
  3090. n2,
  3091. currentContainer,
  3092. currentAnchor,
  3093. parentComponent,
  3094. parentSuspense,
  3095. namespace,
  3096. slotScopeIds,
  3097. false
  3098. );
  3099. }
  3100. if (disabled) {
  3101. if (!wasDisabled) {
  3102. moveTeleport(
  3103. n2,
  3104. container,
  3105. mainAnchor,
  3106. internals,
  3107. 1
  3108. );
  3109. } else {
  3110. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  3111. n2.props.to = n1.props.to;
  3112. }
  3113. }
  3114. } else {
  3115. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  3116. const nextTarget = n2.target = resolveTarget(
  3117. n2.props,
  3118. querySelector
  3119. );
  3120. if (nextTarget) {
  3121. moveTeleport(
  3122. n2,
  3123. nextTarget,
  3124. null,
  3125. internals,
  3126. 0
  3127. );
  3128. } else {
  3129. warn$1(
  3130. "Invalid Teleport target on update:",
  3131. target,
  3132. `(${typeof target})`
  3133. );
  3134. }
  3135. } else if (wasDisabled) {
  3136. moveTeleport(
  3137. n2,
  3138. target,
  3139. targetAnchor,
  3140. internals,
  3141. 1
  3142. );
  3143. }
  3144. }
  3145. updateCssVars(n2, disabled);
  3146. }
  3147. },
  3148. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  3149. const {
  3150. shapeFlag,
  3151. children,
  3152. anchor,
  3153. targetStart,
  3154. targetAnchor,
  3155. target,
  3156. props
  3157. } = vnode;
  3158. if (target) {
  3159. hostRemove(targetStart);
  3160. hostRemove(targetAnchor);
  3161. }
  3162. doRemove && hostRemove(anchor);
  3163. if (shapeFlag & 16) {
  3164. const shouldRemove = doRemove || !isTeleportDisabled(props);
  3165. for (let i = 0; i < children.length; i++) {
  3166. const child = children[i];
  3167. unmount(
  3168. child,
  3169. parentComponent,
  3170. parentSuspense,
  3171. shouldRemove,
  3172. !!child.dynamicChildren
  3173. );
  3174. }
  3175. }
  3176. },
  3177. move: moveTeleport,
  3178. hydrate: hydrateTeleport
  3179. };
  3180. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  3181. if (moveType === 0) {
  3182. insert(vnode.targetAnchor, container, parentAnchor);
  3183. }
  3184. const { el, anchor, shapeFlag, children, props } = vnode;
  3185. const isReorder = moveType === 2;
  3186. if (isReorder) {
  3187. insert(el, container, parentAnchor);
  3188. }
  3189. if (!isReorder || isTeleportDisabled(props)) {
  3190. if (shapeFlag & 16) {
  3191. for (let i = 0; i < children.length; i++) {
  3192. move(
  3193. children[i],
  3194. container,
  3195. parentAnchor,
  3196. 2
  3197. );
  3198. }
  3199. }
  3200. }
  3201. if (isReorder) {
  3202. insert(anchor, container, parentAnchor);
  3203. }
  3204. }
  3205. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  3206. o: { nextSibling, parentNode, querySelector, insert, createText }
  3207. }, hydrateChildren) {
  3208. const target = vnode.target = resolveTarget(
  3209. vnode.props,
  3210. querySelector
  3211. );
  3212. if (target) {
  3213. const disabled = isTeleportDisabled(vnode.props);
  3214. const targetNode = target._lpa || target.firstChild;
  3215. if (vnode.shapeFlag & 16) {
  3216. if (disabled) {
  3217. vnode.anchor = hydrateChildren(
  3218. nextSibling(node),
  3219. vnode,
  3220. parentNode(node),
  3221. parentComponent,
  3222. parentSuspense,
  3223. slotScopeIds,
  3224. optimized
  3225. );
  3226. vnode.targetStart = targetNode;
  3227. vnode.targetAnchor = targetNode && nextSibling(targetNode);
  3228. } else {
  3229. vnode.anchor = nextSibling(node);
  3230. let targetAnchor = targetNode;
  3231. while (targetAnchor) {
  3232. if (targetAnchor && targetAnchor.nodeType === 8) {
  3233. if (targetAnchor.data === "teleport start anchor") {
  3234. vnode.targetStart = targetAnchor;
  3235. } else if (targetAnchor.data === "teleport anchor") {
  3236. vnode.targetAnchor = targetAnchor;
  3237. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  3238. break;
  3239. }
  3240. }
  3241. targetAnchor = nextSibling(targetAnchor);
  3242. }
  3243. if (!vnode.targetAnchor) {
  3244. prepareAnchor(target, vnode, createText, insert);
  3245. }
  3246. hydrateChildren(
  3247. targetNode && nextSibling(targetNode),
  3248. vnode,
  3249. target,
  3250. parentComponent,
  3251. parentSuspense,
  3252. slotScopeIds,
  3253. optimized
  3254. );
  3255. }
  3256. }
  3257. updateCssVars(vnode, disabled);
  3258. }
  3259. return vnode.anchor && nextSibling(vnode.anchor);
  3260. }
  3261. const Teleport = TeleportImpl;
  3262. function updateCssVars(vnode, isDisabled) {
  3263. const ctx = vnode.ctx;
  3264. if (ctx && ctx.ut) {
  3265. let node, anchor;
  3266. if (isDisabled) {
  3267. node = vnode.el;
  3268. anchor = vnode.anchor;
  3269. } else {
  3270. node = vnode.targetStart;
  3271. anchor = vnode.targetAnchor;
  3272. }
  3273. while (node && node !== anchor) {
  3274. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  3275. node = node.nextSibling;
  3276. }
  3277. ctx.ut();
  3278. }
  3279. }
  3280. function prepareAnchor(target, vnode, createText, insert) {
  3281. const targetStart = vnode.targetStart = createText("");
  3282. const targetAnchor = vnode.targetAnchor = createText("");
  3283. targetStart[TeleportEndKey] = targetAnchor;
  3284. if (target) {
  3285. insert(targetStart, target);
  3286. insert(targetAnchor, target);
  3287. }
  3288. return targetAnchor;
  3289. }
  3290. const leaveCbKey = Symbol("_leaveCb");
  3291. const enterCbKey$1 = Symbol("_enterCb");
  3292. function useTransitionState() {
  3293. const state = {
  3294. isMounted: false,
  3295. isLeaving: false,
  3296. isUnmounting: false,
  3297. leavingVNodes: /* @__PURE__ */ new Map()
  3298. };
  3299. onMounted(() => {
  3300. state.isMounted = true;
  3301. });
  3302. onBeforeUnmount(() => {
  3303. state.isUnmounting = true;
  3304. });
  3305. return state;
  3306. }
  3307. const TransitionHookValidator = [Function, Array];
  3308. const BaseTransitionPropsValidators = {
  3309. mode: String,
  3310. appear: Boolean,
  3311. persisted: Boolean,
  3312. // enter
  3313. onBeforeEnter: TransitionHookValidator,
  3314. onEnter: TransitionHookValidator,
  3315. onAfterEnter: TransitionHookValidator,
  3316. onEnterCancelled: TransitionHookValidator,
  3317. // leave
  3318. onBeforeLeave: TransitionHookValidator,
  3319. onLeave: TransitionHookValidator,
  3320. onAfterLeave: TransitionHookValidator,
  3321. onLeaveCancelled: TransitionHookValidator,
  3322. // appear
  3323. onBeforeAppear: TransitionHookValidator,
  3324. onAppear: TransitionHookValidator,
  3325. onAfterAppear: TransitionHookValidator,
  3326. onAppearCancelled: TransitionHookValidator
  3327. };
  3328. const recursiveGetSubtree = (instance) => {
  3329. const subTree = instance.subTree;
  3330. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  3331. };
  3332. const BaseTransitionImpl = {
  3333. name: `BaseTransition`,
  3334. props: BaseTransitionPropsValidators,
  3335. setup(props, { slots }) {
  3336. const instance = getCurrentInstance();
  3337. const state = useTransitionState();
  3338. return () => {
  3339. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3340. if (!children || !children.length) {
  3341. return;
  3342. }
  3343. const child = findNonCommentChild(children);
  3344. const rawProps = toRaw(props);
  3345. const { mode } = rawProps;
  3346. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3347. warn$1(`invalid <transition> mode: ${mode}`);
  3348. }
  3349. if (state.isLeaving) {
  3350. return emptyPlaceholder(child);
  3351. }
  3352. const innerChild = getInnerChild$1(child);
  3353. if (!innerChild) {
  3354. return emptyPlaceholder(child);
  3355. }
  3356. let enterHooks = resolveTransitionHooks(
  3357. innerChild,
  3358. rawProps,
  3359. state,
  3360. instance,
  3361. // #11061, ensure enterHooks is fresh after clone
  3362. (hooks) => enterHooks = hooks
  3363. );
  3364. if (innerChild.type !== Comment) {
  3365. setTransitionHooks(innerChild, enterHooks);
  3366. }
  3367. let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
  3368. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
  3369. let leavingHooks = resolveTransitionHooks(
  3370. oldInnerChild,
  3371. rawProps,
  3372. state,
  3373. instance
  3374. );
  3375. setTransitionHooks(oldInnerChild, leavingHooks);
  3376. if (mode === "out-in" && innerChild.type !== Comment) {
  3377. state.isLeaving = true;
  3378. leavingHooks.afterLeave = () => {
  3379. state.isLeaving = false;
  3380. if (!(instance.job.flags & 8)) {
  3381. instance.update();
  3382. }
  3383. delete leavingHooks.afterLeave;
  3384. oldInnerChild = void 0;
  3385. };
  3386. return emptyPlaceholder(child);
  3387. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3388. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3389. const leavingVNodesCache = getLeavingNodesForType(
  3390. state,
  3391. oldInnerChild
  3392. );
  3393. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3394. el[leaveCbKey] = () => {
  3395. earlyRemove();
  3396. el[leaveCbKey] = void 0;
  3397. delete enterHooks.delayedLeave;
  3398. oldInnerChild = void 0;
  3399. };
  3400. enterHooks.delayedLeave = () => {
  3401. delayedLeave();
  3402. delete enterHooks.delayedLeave;
  3403. oldInnerChild = void 0;
  3404. };
  3405. };
  3406. } else {
  3407. oldInnerChild = void 0;
  3408. }
  3409. } else if (oldInnerChild) {
  3410. oldInnerChild = void 0;
  3411. }
  3412. return child;
  3413. };
  3414. }
  3415. };
  3416. function findNonCommentChild(children) {
  3417. let child = children[0];
  3418. if (children.length > 1) {
  3419. let hasFound = false;
  3420. for (const c of children) {
  3421. if (c.type !== Comment) {
  3422. if (hasFound) {
  3423. warn$1(
  3424. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3425. );
  3426. break;
  3427. }
  3428. child = c;
  3429. hasFound = true;
  3430. }
  3431. }
  3432. }
  3433. return child;
  3434. }
  3435. const BaseTransition = BaseTransitionImpl;
  3436. function getLeavingNodesForType(state, vnode) {
  3437. const { leavingVNodes } = state;
  3438. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3439. if (!leavingVNodesCache) {
  3440. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3441. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3442. }
  3443. return leavingVNodesCache;
  3444. }
  3445. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  3446. const {
  3447. appear,
  3448. mode,
  3449. persisted = false,
  3450. onBeforeEnter,
  3451. onEnter,
  3452. onAfterEnter,
  3453. onEnterCancelled,
  3454. onBeforeLeave,
  3455. onLeave,
  3456. onAfterLeave,
  3457. onLeaveCancelled,
  3458. onBeforeAppear,
  3459. onAppear,
  3460. onAfterAppear,
  3461. onAppearCancelled
  3462. } = props;
  3463. const key = String(vnode.key);
  3464. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3465. const callHook = (hook, args) => {
  3466. hook && callWithAsyncErrorHandling(
  3467. hook,
  3468. instance,
  3469. 9,
  3470. args
  3471. );
  3472. };
  3473. const callAsyncHook = (hook, args) => {
  3474. const done = args[1];
  3475. callHook(hook, args);
  3476. if (isArray(hook)) {
  3477. if (hook.every((hook2) => hook2.length <= 1)) done();
  3478. } else if (hook.length <= 1) {
  3479. done();
  3480. }
  3481. };
  3482. const hooks = {
  3483. mode,
  3484. persisted,
  3485. beforeEnter(el) {
  3486. let hook = onBeforeEnter;
  3487. if (!state.isMounted) {
  3488. if (appear) {
  3489. hook = onBeforeAppear || onBeforeEnter;
  3490. } else {
  3491. return;
  3492. }
  3493. }
  3494. if (el[leaveCbKey]) {
  3495. el[leaveCbKey](
  3496. true
  3497. /* cancelled */
  3498. );
  3499. }
  3500. const leavingVNode = leavingVNodesCache[key];
  3501. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3502. leavingVNode.el[leaveCbKey]();
  3503. }
  3504. callHook(hook, [el]);
  3505. },
  3506. enter(el) {
  3507. let hook = onEnter;
  3508. let afterHook = onAfterEnter;
  3509. let cancelHook = onEnterCancelled;
  3510. if (!state.isMounted) {
  3511. if (appear) {
  3512. hook = onAppear || onEnter;
  3513. afterHook = onAfterAppear || onAfterEnter;
  3514. cancelHook = onAppearCancelled || onEnterCancelled;
  3515. } else {
  3516. return;
  3517. }
  3518. }
  3519. let called = false;
  3520. const done = el[enterCbKey$1] = (cancelled) => {
  3521. if (called) return;
  3522. called = true;
  3523. if (cancelled) {
  3524. callHook(cancelHook, [el]);
  3525. } else {
  3526. callHook(afterHook, [el]);
  3527. }
  3528. if (hooks.delayedLeave) {
  3529. hooks.delayedLeave();
  3530. }
  3531. el[enterCbKey$1] = void 0;
  3532. };
  3533. if (hook) {
  3534. callAsyncHook(hook, [el, done]);
  3535. } else {
  3536. done();
  3537. }
  3538. },
  3539. leave(el, remove) {
  3540. const key2 = String(vnode.key);
  3541. if (el[enterCbKey$1]) {
  3542. el[enterCbKey$1](
  3543. true
  3544. /* cancelled */
  3545. );
  3546. }
  3547. if (state.isUnmounting) {
  3548. return remove();
  3549. }
  3550. callHook(onBeforeLeave, [el]);
  3551. let called = false;
  3552. const done = el[leaveCbKey] = (cancelled) => {
  3553. if (called) return;
  3554. called = true;
  3555. remove();
  3556. if (cancelled) {
  3557. callHook(onLeaveCancelled, [el]);
  3558. } else {
  3559. callHook(onAfterLeave, [el]);
  3560. }
  3561. el[leaveCbKey] = void 0;
  3562. if (leavingVNodesCache[key2] === vnode) {
  3563. delete leavingVNodesCache[key2];
  3564. }
  3565. };
  3566. leavingVNodesCache[key2] = vnode;
  3567. if (onLeave) {
  3568. callAsyncHook(onLeave, [el, done]);
  3569. } else {
  3570. done();
  3571. }
  3572. },
  3573. clone(vnode2) {
  3574. const hooks2 = resolveTransitionHooks(
  3575. vnode2,
  3576. props,
  3577. state,
  3578. instance,
  3579. postClone
  3580. );
  3581. if (postClone) postClone(hooks2);
  3582. return hooks2;
  3583. }
  3584. };
  3585. return hooks;
  3586. }
  3587. function emptyPlaceholder(vnode) {
  3588. if (isKeepAlive(vnode)) {
  3589. vnode = cloneVNode(vnode);
  3590. vnode.children = null;
  3591. return vnode;
  3592. }
  3593. }
  3594. function getInnerChild$1(vnode) {
  3595. if (!isKeepAlive(vnode)) {
  3596. if (isTeleport(vnode.type) && vnode.children) {
  3597. return findNonCommentChild(vnode.children);
  3598. }
  3599. return vnode;
  3600. }
  3601. if (vnode.component) {
  3602. return vnode.component.subTree;
  3603. }
  3604. const { shapeFlag, children } = vnode;
  3605. if (children) {
  3606. if (shapeFlag & 16) {
  3607. return children[0];
  3608. }
  3609. if (shapeFlag & 32 && isFunction(children.default)) {
  3610. return children.default();
  3611. }
  3612. }
  3613. }
  3614. function setTransitionHooks(vnode, hooks) {
  3615. if (vnode.shapeFlag & 6 && vnode.component) {
  3616. vnode.transition = hooks;
  3617. setTransitionHooks(vnode.component.subTree, hooks);
  3618. } else if (vnode.shapeFlag & 128) {
  3619. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3620. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3621. } else {
  3622. vnode.transition = hooks;
  3623. }
  3624. }
  3625. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3626. let ret = [];
  3627. let keyedFragmentCount = 0;
  3628. for (let i = 0; i < children.length; i++) {
  3629. let child = children[i];
  3630. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3631. if (child.type === Fragment) {
  3632. if (child.patchFlag & 128) keyedFragmentCount++;
  3633. ret = ret.concat(
  3634. getTransitionRawChildren(child.children, keepComment, key)
  3635. );
  3636. } else if (keepComment || child.type !== Comment) {
  3637. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3638. }
  3639. }
  3640. if (keyedFragmentCount > 1) {
  3641. for (let i = 0; i < ret.length; i++) {
  3642. ret[i].patchFlag = -2;
  3643. }
  3644. }
  3645. return ret;
  3646. }
  3647. /*! #__NO_SIDE_EFFECTS__ */
  3648. // @__NO_SIDE_EFFECTS__
  3649. function defineComponent(options, extraOptions) {
  3650. return isFunction(options) ? (
  3651. // #8236: extend call and options.name access are considered side-effects
  3652. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3653. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3654. ) : options;
  3655. }
  3656. function useId() {
  3657. const i = getCurrentInstance();
  3658. if (i) {
  3659. return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
  3660. } else {
  3661. warn$1(
  3662. `useId() is called when there is no active component instance to be associated with.`
  3663. );
  3664. }
  3665. return "";
  3666. }
  3667. function markAsyncBoundary(instance) {
  3668. instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
  3669. }
  3670. const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
  3671. function useTemplateRef(key) {
  3672. const i = getCurrentInstance();
  3673. const r = shallowRef(null);
  3674. if (i) {
  3675. const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
  3676. let desc;
  3677. if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
  3678. warn$1(`useTemplateRef('${key}') already exists.`);
  3679. } else {
  3680. Object.defineProperty(refs, key, {
  3681. enumerable: true,
  3682. get: () => r.value,
  3683. set: (val) => r.value = val
  3684. });
  3685. }
  3686. } else {
  3687. warn$1(
  3688. `useTemplateRef() is called when there is no active component instance to be associated with.`
  3689. );
  3690. }
  3691. const ret = readonly(r) ;
  3692. {
  3693. knownTemplateRefs.add(ret);
  3694. }
  3695. return ret;
  3696. }
  3697. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  3698. if (isArray(rawRef)) {
  3699. rawRef.forEach(
  3700. (r, i) => setRef(
  3701. r,
  3702. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  3703. parentSuspense,
  3704. vnode,
  3705. isUnmount
  3706. )
  3707. );
  3708. return;
  3709. }
  3710. if (isAsyncWrapper(vnode) && !isUnmount) {
  3711. if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
  3712. setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
  3713. }
  3714. return;
  3715. }
  3716. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  3717. const value = isUnmount ? null : refValue;
  3718. const { i: owner, r: ref } = rawRef;
  3719. if (!owner) {
  3720. warn$1(
  3721. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  3722. );
  3723. return;
  3724. }
  3725. const oldRef = oldRawRef && oldRawRef.r;
  3726. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  3727. const setupState = owner.setupState;
  3728. const rawSetupState = toRaw(setupState);
  3729. const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
  3730. {
  3731. if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
  3732. warn$1(
  3733. `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
  3734. );
  3735. }
  3736. if (knownTemplateRefs.has(rawSetupState[key])) {
  3737. return false;
  3738. }
  3739. }
  3740. return hasOwn(rawSetupState, key);
  3741. };
  3742. if (oldRef != null && oldRef !== ref) {
  3743. if (isString(oldRef)) {
  3744. refs[oldRef] = null;
  3745. if (canSetSetupRef(oldRef)) {
  3746. setupState[oldRef] = null;
  3747. }
  3748. } else if (isRef(oldRef)) {
  3749. oldRef.value = null;
  3750. }
  3751. }
  3752. if (isFunction(ref)) {
  3753. callWithErrorHandling(ref, owner, 12, [value, refs]);
  3754. } else {
  3755. const _isString = isString(ref);
  3756. const _isRef = isRef(ref);
  3757. if (_isString || _isRef) {
  3758. const doSet = () => {
  3759. if (rawRef.f) {
  3760. const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
  3761. if (isUnmount) {
  3762. isArray(existing) && remove(existing, refValue);
  3763. } else {
  3764. if (!isArray(existing)) {
  3765. if (_isString) {
  3766. refs[ref] = [refValue];
  3767. if (canSetSetupRef(ref)) {
  3768. setupState[ref] = refs[ref];
  3769. }
  3770. } else {
  3771. ref.value = [refValue];
  3772. if (rawRef.k) refs[rawRef.k] = ref.value;
  3773. }
  3774. } else if (!existing.includes(refValue)) {
  3775. existing.push(refValue);
  3776. }
  3777. }
  3778. } else if (_isString) {
  3779. refs[ref] = value;
  3780. if (canSetSetupRef(ref)) {
  3781. setupState[ref] = value;
  3782. }
  3783. } else if (_isRef) {
  3784. ref.value = value;
  3785. if (rawRef.k) refs[rawRef.k] = value;
  3786. } else {
  3787. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  3788. }
  3789. };
  3790. if (value) {
  3791. doSet.id = -1;
  3792. queuePostRenderEffect(doSet, parentSuspense);
  3793. } else {
  3794. doSet();
  3795. }
  3796. } else {
  3797. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  3798. }
  3799. }
  3800. }
  3801. let hasLoggedMismatchError = false;
  3802. const logMismatchError = () => {
  3803. if (hasLoggedMismatchError) {
  3804. return;
  3805. }
  3806. console.error("Hydration completed but contains mismatches.");
  3807. hasLoggedMismatchError = true;
  3808. };
  3809. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  3810. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  3811. const getContainerType = (container) => {
  3812. if (container.nodeType !== 1) return void 0;
  3813. if (isSVGContainer(container)) return "svg";
  3814. if (isMathMLContainer(container)) return "mathml";
  3815. return void 0;
  3816. };
  3817. const isComment = (node) => node.nodeType === 8;
  3818. function createHydrationFunctions(rendererInternals) {
  3819. const {
  3820. mt: mountComponent,
  3821. p: patch,
  3822. o: {
  3823. patchProp,
  3824. createText,
  3825. nextSibling,
  3826. parentNode,
  3827. remove,
  3828. insert,
  3829. createComment
  3830. }
  3831. } = rendererInternals;
  3832. const hydrate = (vnode, container) => {
  3833. if (!container.hasChildNodes()) {
  3834. warn$1(
  3835. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  3836. );
  3837. patch(null, vnode, container);
  3838. flushPostFlushCbs();
  3839. container._vnode = vnode;
  3840. return;
  3841. }
  3842. hydrateNode(container.firstChild, vnode, null, null, null);
  3843. flushPostFlushCbs();
  3844. container._vnode = vnode;
  3845. };
  3846. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  3847. optimized = optimized || !!vnode.dynamicChildren;
  3848. const isFragmentStart = isComment(node) && node.data === "[";
  3849. const onMismatch = () => handleMismatch(
  3850. node,
  3851. vnode,
  3852. parentComponent,
  3853. parentSuspense,
  3854. slotScopeIds,
  3855. isFragmentStart
  3856. );
  3857. const { type, ref, shapeFlag, patchFlag } = vnode;
  3858. let domType = node.nodeType;
  3859. vnode.el = node;
  3860. {
  3861. def(node, "__vnode", vnode, true);
  3862. def(node, "__vueParentComponent", parentComponent, true);
  3863. }
  3864. if (patchFlag === -2) {
  3865. optimized = false;
  3866. vnode.dynamicChildren = null;
  3867. }
  3868. let nextNode = null;
  3869. switch (type) {
  3870. case Text:
  3871. if (domType !== 3) {
  3872. if (vnode.children === "") {
  3873. insert(vnode.el = createText(""), parentNode(node), node);
  3874. nextNode = node;
  3875. } else {
  3876. nextNode = onMismatch();
  3877. }
  3878. } else {
  3879. if (node.data !== vnode.children) {
  3880. warn$1(
  3881. `Hydration text mismatch in`,
  3882. node.parentNode,
  3883. `
  3884. - rendered on server: ${JSON.stringify(
  3885. node.data
  3886. )}
  3887. - expected on client: ${JSON.stringify(vnode.children)}`
  3888. );
  3889. logMismatchError();
  3890. node.data = vnode.children;
  3891. }
  3892. nextNode = nextSibling(node);
  3893. }
  3894. break;
  3895. case Comment:
  3896. if (isTemplateNode(node)) {
  3897. nextNode = nextSibling(node);
  3898. replaceNode(
  3899. vnode.el = node.content.firstChild,
  3900. node,
  3901. parentComponent
  3902. );
  3903. } else if (domType !== 8 || isFragmentStart) {
  3904. nextNode = onMismatch();
  3905. } else {
  3906. nextNode = nextSibling(node);
  3907. }
  3908. break;
  3909. case Static:
  3910. if (isFragmentStart) {
  3911. node = nextSibling(node);
  3912. domType = node.nodeType;
  3913. }
  3914. if (domType === 1 || domType === 3) {
  3915. nextNode = node;
  3916. const needToAdoptContent = !vnode.children.length;
  3917. for (let i = 0; i < vnode.staticCount; i++) {
  3918. if (needToAdoptContent)
  3919. vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
  3920. if (i === vnode.staticCount - 1) {
  3921. vnode.anchor = nextNode;
  3922. }
  3923. nextNode = nextSibling(nextNode);
  3924. }
  3925. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  3926. } else {
  3927. onMismatch();
  3928. }
  3929. break;
  3930. case Fragment:
  3931. if (!isFragmentStart) {
  3932. nextNode = onMismatch();
  3933. } else {
  3934. nextNode = hydrateFragment(
  3935. node,
  3936. vnode,
  3937. parentComponent,
  3938. parentSuspense,
  3939. slotScopeIds,
  3940. optimized
  3941. );
  3942. }
  3943. break;
  3944. default:
  3945. if (shapeFlag & 1) {
  3946. if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  3947. nextNode = onMismatch();
  3948. } else {
  3949. nextNode = hydrateElement(
  3950. node,
  3951. vnode,
  3952. parentComponent,
  3953. parentSuspense,
  3954. slotScopeIds,
  3955. optimized
  3956. );
  3957. }
  3958. } else if (shapeFlag & 6) {
  3959. vnode.slotScopeIds = slotScopeIds;
  3960. const container = parentNode(node);
  3961. if (isFragmentStart) {
  3962. nextNode = locateClosingAnchor(node);
  3963. } else if (isComment(node) && node.data === "teleport start") {
  3964. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  3965. } else {
  3966. nextNode = nextSibling(node);
  3967. }
  3968. mountComponent(
  3969. vnode,
  3970. container,
  3971. null,
  3972. parentComponent,
  3973. parentSuspense,
  3974. getContainerType(container),
  3975. optimized
  3976. );
  3977. if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
  3978. let subTree;
  3979. if (isFragmentStart) {
  3980. subTree = createVNode(Fragment);
  3981. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  3982. } else {
  3983. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  3984. }
  3985. subTree.el = node;
  3986. vnode.component.subTree = subTree;
  3987. }
  3988. } else if (shapeFlag & 64) {
  3989. if (domType !== 8) {
  3990. nextNode = onMismatch();
  3991. } else {
  3992. nextNode = vnode.type.hydrate(
  3993. node,
  3994. vnode,
  3995. parentComponent,
  3996. parentSuspense,
  3997. slotScopeIds,
  3998. optimized,
  3999. rendererInternals,
  4000. hydrateChildren
  4001. );
  4002. }
  4003. } else if (shapeFlag & 128) {
  4004. nextNode = vnode.type.hydrate(
  4005. node,
  4006. vnode,
  4007. parentComponent,
  4008. parentSuspense,
  4009. getContainerType(parentNode(node)),
  4010. slotScopeIds,
  4011. optimized,
  4012. rendererInternals,
  4013. hydrateNode
  4014. );
  4015. } else {
  4016. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  4017. }
  4018. }
  4019. if (ref != null) {
  4020. setRef(ref, null, parentSuspense, vnode);
  4021. }
  4022. return nextNode;
  4023. };
  4024. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4025. optimized = optimized || !!vnode.dynamicChildren;
  4026. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  4027. const forcePatch = type === "input" || type === "option";
  4028. {
  4029. if (dirs) {
  4030. invokeDirectiveHook(vnode, null, parentComponent, "created");
  4031. }
  4032. let needCallTransitionHooks = false;
  4033. if (isTemplateNode(el)) {
  4034. needCallTransitionHooks = needTransition(
  4035. null,
  4036. // no need check parentSuspense in hydration
  4037. transition
  4038. ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  4039. const content = el.content.firstChild;
  4040. if (needCallTransitionHooks) {
  4041. transition.beforeEnter(content);
  4042. }
  4043. replaceNode(content, el, parentComponent);
  4044. vnode.el = el = content;
  4045. }
  4046. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  4047. !(props && (props.innerHTML || props.textContent))) {
  4048. let next = hydrateChildren(
  4049. el.firstChild,
  4050. vnode,
  4051. el,
  4052. parentComponent,
  4053. parentSuspense,
  4054. slotScopeIds,
  4055. optimized
  4056. );
  4057. let hasWarned = false;
  4058. while (next) {
  4059. if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
  4060. if (!hasWarned) {
  4061. warn$1(
  4062. `Hydration children mismatch on`,
  4063. el,
  4064. `
  4065. Server rendered element contains more child nodes than client vdom.`
  4066. );
  4067. hasWarned = true;
  4068. }
  4069. logMismatchError();
  4070. }
  4071. const cur = next;
  4072. next = next.nextSibling;
  4073. remove(cur);
  4074. }
  4075. } else if (shapeFlag & 8) {
  4076. let clientText = vnode.children;
  4077. if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
  4078. clientText = clientText.slice(1);
  4079. }
  4080. if (el.textContent !== clientText) {
  4081. if (!isMismatchAllowed(el, 0 /* TEXT */)) {
  4082. warn$1(
  4083. `Hydration text content mismatch on`,
  4084. el,
  4085. `
  4086. - rendered on server: ${el.textContent}
  4087. - expected on client: ${vnode.children}`
  4088. );
  4089. logMismatchError();
  4090. }
  4091. el.textContent = vnode.children;
  4092. }
  4093. }
  4094. if (props) {
  4095. {
  4096. const isCustomElement = el.tagName.includes("-");
  4097. for (const key in props) {
  4098. if (// #11189 skip if this node has directives that have created hooks
  4099. // as it could have mutated the DOM in any possible way
  4100. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  4101. logMismatchError();
  4102. }
  4103. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  4104. key[0] === "." || isCustomElement) {
  4105. patchProp(el, key, null, props[key], void 0, parentComponent);
  4106. }
  4107. }
  4108. }
  4109. }
  4110. let vnodeHooks;
  4111. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  4112. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4113. }
  4114. if (dirs) {
  4115. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4116. }
  4117. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  4118. queueEffectWithSuspense(() => {
  4119. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4120. needCallTransitionHooks && transition.enter(el);
  4121. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4122. }, parentSuspense);
  4123. }
  4124. }
  4125. return el.nextSibling;
  4126. };
  4127. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4128. optimized = optimized || !!parentVNode.dynamicChildren;
  4129. const children = parentVNode.children;
  4130. const l = children.length;
  4131. let hasWarned = false;
  4132. for (let i = 0; i < l; i++) {
  4133. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  4134. const isText = vnode.type === Text;
  4135. if (node) {
  4136. if (isText && !optimized) {
  4137. if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
  4138. insert(
  4139. createText(
  4140. node.data.slice(vnode.children.length)
  4141. ),
  4142. container,
  4143. nextSibling(node)
  4144. );
  4145. node.data = vnode.children;
  4146. }
  4147. }
  4148. node = hydrateNode(
  4149. node,
  4150. vnode,
  4151. parentComponent,
  4152. parentSuspense,
  4153. slotScopeIds,
  4154. optimized
  4155. );
  4156. } else if (isText && !vnode.children) {
  4157. insert(vnode.el = createText(""), container);
  4158. } else {
  4159. if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
  4160. if (!hasWarned) {
  4161. warn$1(
  4162. `Hydration children mismatch on`,
  4163. container,
  4164. `
  4165. Server rendered element contains fewer child nodes than client vdom.`
  4166. );
  4167. hasWarned = true;
  4168. }
  4169. logMismatchError();
  4170. }
  4171. patch(
  4172. null,
  4173. vnode,
  4174. container,
  4175. null,
  4176. parentComponent,
  4177. parentSuspense,
  4178. getContainerType(container),
  4179. slotScopeIds
  4180. );
  4181. }
  4182. }
  4183. return node;
  4184. };
  4185. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4186. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  4187. if (fragmentSlotScopeIds) {
  4188. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4189. }
  4190. const container = parentNode(node);
  4191. const next = hydrateChildren(
  4192. nextSibling(node),
  4193. vnode,
  4194. container,
  4195. parentComponent,
  4196. parentSuspense,
  4197. slotScopeIds,
  4198. optimized
  4199. );
  4200. if (next && isComment(next) && next.data === "]") {
  4201. return nextSibling(vnode.anchor = next);
  4202. } else {
  4203. logMismatchError();
  4204. insert(vnode.anchor = createComment(`]`), container, next);
  4205. return next;
  4206. }
  4207. };
  4208. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  4209. if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
  4210. warn$1(
  4211. `Hydration node mismatch:
  4212. - rendered on server:`,
  4213. node,
  4214. node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  4215. `
  4216. - expected on client:`,
  4217. vnode.type
  4218. );
  4219. logMismatchError();
  4220. }
  4221. vnode.el = null;
  4222. if (isFragment) {
  4223. const end = locateClosingAnchor(node);
  4224. while (true) {
  4225. const next2 = nextSibling(node);
  4226. if (next2 && next2 !== end) {
  4227. remove(next2);
  4228. } else {
  4229. break;
  4230. }
  4231. }
  4232. }
  4233. const next = nextSibling(node);
  4234. const container = parentNode(node);
  4235. remove(node);
  4236. patch(
  4237. null,
  4238. vnode,
  4239. container,
  4240. next,
  4241. parentComponent,
  4242. parentSuspense,
  4243. getContainerType(container),
  4244. slotScopeIds
  4245. );
  4246. if (parentComponent) {
  4247. parentComponent.vnode.el = vnode.el;
  4248. updateHOCHostEl(parentComponent, vnode.el);
  4249. }
  4250. return next;
  4251. };
  4252. const locateClosingAnchor = (node, open = "[", close = "]") => {
  4253. let match = 0;
  4254. while (node) {
  4255. node = nextSibling(node);
  4256. if (node && isComment(node)) {
  4257. if (node.data === open) match++;
  4258. if (node.data === close) {
  4259. if (match === 0) {
  4260. return nextSibling(node);
  4261. } else {
  4262. match--;
  4263. }
  4264. }
  4265. }
  4266. }
  4267. return node;
  4268. };
  4269. const replaceNode = (newNode, oldNode, parentComponent) => {
  4270. const parentNode2 = oldNode.parentNode;
  4271. if (parentNode2) {
  4272. parentNode2.replaceChild(newNode, oldNode);
  4273. }
  4274. let parent = parentComponent;
  4275. while (parent) {
  4276. if (parent.vnode.el === oldNode) {
  4277. parent.vnode.el = parent.subTree.el = newNode;
  4278. }
  4279. parent = parent.parent;
  4280. }
  4281. };
  4282. const isTemplateNode = (node) => {
  4283. return node.nodeType === 1 && node.tagName === "TEMPLATE";
  4284. };
  4285. return [hydrate, hydrateNode];
  4286. }
  4287. function propHasMismatch(el, key, clientValue, vnode, instance) {
  4288. let mismatchType;
  4289. let mismatchKey;
  4290. let actual;
  4291. let expected;
  4292. if (key === "class") {
  4293. actual = el.getAttribute("class");
  4294. expected = normalizeClass(clientValue);
  4295. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  4296. mismatchType = 2 /* CLASS */;
  4297. mismatchKey = `class`;
  4298. }
  4299. } else if (key === "style") {
  4300. actual = el.getAttribute("style") || "";
  4301. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  4302. const actualMap = toStyleMap(actual);
  4303. const expectedMap = toStyleMap(expected);
  4304. if (vnode.dirs) {
  4305. for (const { dir, value } of vnode.dirs) {
  4306. if (dir.name === "show" && !value) {
  4307. expectedMap.set("display", "none");
  4308. }
  4309. }
  4310. }
  4311. if (instance) {
  4312. resolveCssVars(instance, vnode, expectedMap);
  4313. }
  4314. if (!isMapEqual(actualMap, expectedMap)) {
  4315. mismatchType = 3 /* STYLE */;
  4316. mismatchKey = "style";
  4317. }
  4318. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  4319. if (isBooleanAttr(key)) {
  4320. actual = el.hasAttribute(key);
  4321. expected = includeBooleanAttr(clientValue);
  4322. } else if (clientValue == null) {
  4323. actual = el.hasAttribute(key);
  4324. expected = false;
  4325. } else {
  4326. if (el.hasAttribute(key)) {
  4327. actual = el.getAttribute(key);
  4328. } else if (key === "value" && el.tagName === "TEXTAREA") {
  4329. actual = el.value;
  4330. } else {
  4331. actual = false;
  4332. }
  4333. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  4334. }
  4335. if (actual !== expected) {
  4336. mismatchType = 4 /* ATTRIBUTE */;
  4337. mismatchKey = key;
  4338. }
  4339. }
  4340. if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
  4341. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  4342. const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
  4343. const postSegment = `
  4344. - rendered on server: ${format(actual)}
  4345. - expected on client: ${format(expected)}
  4346. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  4347. You should fix the source of the mismatch.`;
  4348. {
  4349. warn$1(preSegment, el, postSegment);
  4350. }
  4351. return true;
  4352. }
  4353. return false;
  4354. }
  4355. function toClassSet(str) {
  4356. return new Set(str.trim().split(/\s+/));
  4357. }
  4358. function isSetEqual(a, b) {
  4359. if (a.size !== b.size) {
  4360. return false;
  4361. }
  4362. for (const s of a) {
  4363. if (!b.has(s)) {
  4364. return false;
  4365. }
  4366. }
  4367. return true;
  4368. }
  4369. function toStyleMap(str) {
  4370. const styleMap = /* @__PURE__ */ new Map();
  4371. for (const item of str.split(";")) {
  4372. let [key, value] = item.split(":");
  4373. key = key.trim();
  4374. value = value && value.trim();
  4375. if (key && value) {
  4376. styleMap.set(key, value);
  4377. }
  4378. }
  4379. return styleMap;
  4380. }
  4381. function isMapEqual(a, b) {
  4382. if (a.size !== b.size) {
  4383. return false;
  4384. }
  4385. for (const [key, value] of a) {
  4386. if (value !== b.get(key)) {
  4387. return false;
  4388. }
  4389. }
  4390. return true;
  4391. }
  4392. function resolveCssVars(instance, vnode, expectedMap) {
  4393. const root = instance.subTree;
  4394. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  4395. const cssVars = instance.getCssVars();
  4396. for (const key in cssVars) {
  4397. expectedMap.set(
  4398. `--${getEscapedCssVarName(key)}`,
  4399. String(cssVars[key])
  4400. );
  4401. }
  4402. }
  4403. if (vnode === root && instance.parent) {
  4404. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  4405. }
  4406. }
  4407. const allowMismatchAttr = "data-allow-mismatch";
  4408. const MismatchTypeString = {
  4409. [0 /* TEXT */]: "text",
  4410. [1 /* CHILDREN */]: "children",
  4411. [2 /* CLASS */]: "class",
  4412. [3 /* STYLE */]: "style",
  4413. [4 /* ATTRIBUTE */]: "attribute"
  4414. };
  4415. function isMismatchAllowed(el, allowedType) {
  4416. if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
  4417. while (el && !el.hasAttribute(allowMismatchAttr)) {
  4418. el = el.parentElement;
  4419. }
  4420. }
  4421. const allowedAttr = el && el.getAttribute(allowMismatchAttr);
  4422. if (allowedAttr == null) {
  4423. return false;
  4424. } else if (allowedAttr === "") {
  4425. return true;
  4426. } else {
  4427. const list = allowedAttr.split(",");
  4428. if (allowedType === 0 /* TEXT */ && list.includes("children")) {
  4429. return true;
  4430. }
  4431. return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
  4432. }
  4433. }
  4434. const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
  4435. const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
  4436. const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
  4437. const id = requestIdleCallback(hydrate, { timeout });
  4438. return () => cancelIdleCallback(id);
  4439. };
  4440. function elementIsVisibleInViewport(el) {
  4441. const { top, left, bottom, right } = el.getBoundingClientRect();
  4442. const { innerHeight, innerWidth } = window;
  4443. return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
  4444. }
  4445. const hydrateOnVisible = (opts) => (hydrate, forEach) => {
  4446. const ob = new IntersectionObserver((entries) => {
  4447. for (const e of entries) {
  4448. if (!e.isIntersecting) continue;
  4449. ob.disconnect();
  4450. hydrate();
  4451. break;
  4452. }
  4453. }, opts);
  4454. forEach((el) => {
  4455. if (!(el instanceof Element)) return;
  4456. if (elementIsVisibleInViewport(el)) {
  4457. hydrate();
  4458. ob.disconnect();
  4459. return false;
  4460. }
  4461. ob.observe(el);
  4462. });
  4463. return () => ob.disconnect();
  4464. };
  4465. const hydrateOnMediaQuery = (query) => (hydrate) => {
  4466. if (query) {
  4467. const mql = matchMedia(query);
  4468. if (mql.matches) {
  4469. hydrate();
  4470. } else {
  4471. mql.addEventListener("change", hydrate, { once: true });
  4472. return () => mql.removeEventListener("change", hydrate);
  4473. }
  4474. }
  4475. };
  4476. const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
  4477. if (isString(interactions)) interactions = [interactions];
  4478. let hasHydrated = false;
  4479. const doHydrate = (e) => {
  4480. if (!hasHydrated) {
  4481. hasHydrated = true;
  4482. teardown();
  4483. hydrate();
  4484. e.target.dispatchEvent(new e.constructor(e.type, e));
  4485. }
  4486. };
  4487. const teardown = () => {
  4488. forEach((el) => {
  4489. for (const i of interactions) {
  4490. el.removeEventListener(i, doHydrate);
  4491. }
  4492. });
  4493. };
  4494. forEach((el) => {
  4495. for (const i of interactions) {
  4496. el.addEventListener(i, doHydrate, { once: true });
  4497. }
  4498. });
  4499. return teardown;
  4500. };
  4501. function forEachElement(node, cb) {
  4502. if (isComment(node) && node.data === "[") {
  4503. let depth = 1;
  4504. let next = node.nextSibling;
  4505. while (next) {
  4506. if (next.nodeType === 1) {
  4507. const result = cb(next);
  4508. if (result === false) {
  4509. break;
  4510. }
  4511. } else if (isComment(next)) {
  4512. if (next.data === "]") {
  4513. if (--depth === 0) break;
  4514. } else if (next.data === "[") {
  4515. depth++;
  4516. }
  4517. }
  4518. next = next.nextSibling;
  4519. }
  4520. } else {
  4521. cb(node);
  4522. }
  4523. }
  4524. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  4525. /*! #__NO_SIDE_EFFECTS__ */
  4526. // @__NO_SIDE_EFFECTS__
  4527. function defineAsyncComponent(source) {
  4528. if (isFunction(source)) {
  4529. source = { loader: source };
  4530. }
  4531. const {
  4532. loader,
  4533. loadingComponent,
  4534. errorComponent,
  4535. delay = 200,
  4536. hydrate: hydrateStrategy,
  4537. timeout,
  4538. // undefined = never times out
  4539. suspensible = true,
  4540. onError: userOnError
  4541. } = source;
  4542. let pendingRequest = null;
  4543. let resolvedComp;
  4544. let retries = 0;
  4545. const retry = () => {
  4546. retries++;
  4547. pendingRequest = null;
  4548. return load();
  4549. };
  4550. const load = () => {
  4551. let thisRequest;
  4552. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  4553. err = err instanceof Error ? err : new Error(String(err));
  4554. if (userOnError) {
  4555. return new Promise((resolve, reject) => {
  4556. const userRetry = () => resolve(retry());
  4557. const userFail = () => reject(err);
  4558. userOnError(err, userRetry, userFail, retries + 1);
  4559. });
  4560. } else {
  4561. throw err;
  4562. }
  4563. }).then((comp) => {
  4564. if (thisRequest !== pendingRequest && pendingRequest) {
  4565. return pendingRequest;
  4566. }
  4567. if (!comp) {
  4568. warn$1(
  4569. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  4570. );
  4571. }
  4572. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  4573. comp = comp.default;
  4574. }
  4575. if (comp && !isObject(comp) && !isFunction(comp)) {
  4576. throw new Error(`Invalid async component load result: ${comp}`);
  4577. }
  4578. resolvedComp = comp;
  4579. return comp;
  4580. }));
  4581. };
  4582. return defineComponent({
  4583. name: "AsyncComponentWrapper",
  4584. __asyncLoader: load,
  4585. __asyncHydrate(el, instance, hydrate) {
  4586. const doHydrate = hydrateStrategy ? () => {
  4587. const teardown = hydrateStrategy(
  4588. hydrate,
  4589. (cb) => forEachElement(el, cb)
  4590. );
  4591. if (teardown) {
  4592. (instance.bum || (instance.bum = [])).push(teardown);
  4593. }
  4594. } : hydrate;
  4595. if (resolvedComp) {
  4596. doHydrate();
  4597. } else {
  4598. load().then(() => !instance.isUnmounted && doHydrate());
  4599. }
  4600. },
  4601. get __asyncResolved() {
  4602. return resolvedComp;
  4603. },
  4604. setup() {
  4605. const instance = currentInstance;
  4606. markAsyncBoundary(instance);
  4607. if (resolvedComp) {
  4608. return () => createInnerComp(resolvedComp, instance);
  4609. }
  4610. const onError = (err) => {
  4611. pendingRequest = null;
  4612. handleError(
  4613. err,
  4614. instance,
  4615. 13,
  4616. !errorComponent
  4617. );
  4618. };
  4619. if (suspensible && instance.suspense || false) {
  4620. return load().then((comp) => {
  4621. return () => createInnerComp(comp, instance);
  4622. }).catch((err) => {
  4623. onError(err);
  4624. return () => errorComponent ? createVNode(errorComponent, {
  4625. error: err
  4626. }) : null;
  4627. });
  4628. }
  4629. const loaded = ref(false);
  4630. const error = ref();
  4631. const delayed = ref(!!delay);
  4632. if (delay) {
  4633. setTimeout(() => {
  4634. delayed.value = false;
  4635. }, delay);
  4636. }
  4637. if (timeout != null) {
  4638. setTimeout(() => {
  4639. if (!loaded.value && !error.value) {
  4640. const err = new Error(
  4641. `Async component timed out after ${timeout}ms.`
  4642. );
  4643. onError(err);
  4644. error.value = err;
  4645. }
  4646. }, timeout);
  4647. }
  4648. load().then(() => {
  4649. loaded.value = true;
  4650. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  4651. instance.parent.update();
  4652. }
  4653. }).catch((err) => {
  4654. onError(err);
  4655. error.value = err;
  4656. });
  4657. return () => {
  4658. if (loaded.value && resolvedComp) {
  4659. return createInnerComp(resolvedComp, instance);
  4660. } else if (error.value && errorComponent) {
  4661. return createVNode(errorComponent, {
  4662. error: error.value
  4663. });
  4664. } else if (loadingComponent && !delayed.value) {
  4665. return createVNode(loadingComponent);
  4666. }
  4667. };
  4668. }
  4669. });
  4670. }
  4671. function createInnerComp(comp, parent) {
  4672. const { ref: ref2, props, children, ce } = parent.vnode;
  4673. const vnode = createVNode(comp, props, children);
  4674. vnode.ref = ref2;
  4675. vnode.ce = ce;
  4676. delete parent.vnode.ce;
  4677. return vnode;
  4678. }
  4679. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  4680. const KeepAliveImpl = {
  4681. name: `KeepAlive`,
  4682. // Marker for special handling inside the renderer. We are not using a ===
  4683. // check directly on KeepAlive in the renderer, because importing it directly
  4684. // would prevent it from being tree-shaken.
  4685. __isKeepAlive: true,
  4686. props: {
  4687. include: [String, RegExp, Array],
  4688. exclude: [String, RegExp, Array],
  4689. max: [String, Number]
  4690. },
  4691. setup(props, { slots }) {
  4692. const instance = getCurrentInstance();
  4693. const sharedContext = instance.ctx;
  4694. const cache = /* @__PURE__ */ new Map();
  4695. const keys = /* @__PURE__ */ new Set();
  4696. let current = null;
  4697. {
  4698. instance.__v_cache = cache;
  4699. }
  4700. const parentSuspense = instance.suspense;
  4701. const {
  4702. renderer: {
  4703. p: patch,
  4704. m: move,
  4705. um: _unmount,
  4706. o: { createElement }
  4707. }
  4708. } = sharedContext;
  4709. const storageContainer = createElement("div");
  4710. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  4711. const instance2 = vnode.component;
  4712. move(vnode, container, anchor, 0, parentSuspense);
  4713. patch(
  4714. instance2.vnode,
  4715. vnode,
  4716. container,
  4717. anchor,
  4718. instance2,
  4719. parentSuspense,
  4720. namespace,
  4721. vnode.slotScopeIds,
  4722. optimized
  4723. );
  4724. queuePostRenderEffect(() => {
  4725. instance2.isDeactivated = false;
  4726. if (instance2.a) {
  4727. invokeArrayFns(instance2.a);
  4728. }
  4729. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  4730. if (vnodeHook) {
  4731. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4732. }
  4733. }, parentSuspense);
  4734. {
  4735. devtoolsComponentAdded(instance2);
  4736. }
  4737. };
  4738. sharedContext.deactivate = (vnode) => {
  4739. const instance2 = vnode.component;
  4740. invalidateMount(instance2.m);
  4741. invalidateMount(instance2.a);
  4742. move(vnode, storageContainer, null, 1, parentSuspense);
  4743. queuePostRenderEffect(() => {
  4744. if (instance2.da) {
  4745. invokeArrayFns(instance2.da);
  4746. }
  4747. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  4748. if (vnodeHook) {
  4749. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4750. }
  4751. instance2.isDeactivated = true;
  4752. }, parentSuspense);
  4753. {
  4754. devtoolsComponentAdded(instance2);
  4755. }
  4756. };
  4757. function unmount(vnode) {
  4758. resetShapeFlag(vnode);
  4759. _unmount(vnode, instance, parentSuspense, true);
  4760. }
  4761. function pruneCache(filter) {
  4762. cache.forEach((vnode, key) => {
  4763. const name = getComponentName(vnode.type);
  4764. if (name && !filter(name)) {
  4765. pruneCacheEntry(key);
  4766. }
  4767. });
  4768. }
  4769. function pruneCacheEntry(key) {
  4770. const cached = cache.get(key);
  4771. if (cached && (!current || !isSameVNodeType(cached, current))) {
  4772. unmount(cached);
  4773. } else if (current) {
  4774. resetShapeFlag(current);
  4775. }
  4776. cache.delete(key);
  4777. keys.delete(key);
  4778. }
  4779. watch(
  4780. () => [props.include, props.exclude],
  4781. ([include, exclude]) => {
  4782. include && pruneCache((name) => matches(include, name));
  4783. exclude && pruneCache((name) => !matches(exclude, name));
  4784. },
  4785. // prune post-render after `current` has been updated
  4786. { flush: "post", deep: true }
  4787. );
  4788. let pendingCacheKey = null;
  4789. const cacheSubtree = () => {
  4790. if (pendingCacheKey != null) {
  4791. if (isSuspense(instance.subTree.type)) {
  4792. queuePostRenderEffect(() => {
  4793. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4794. }, instance.subTree.suspense);
  4795. } else {
  4796. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4797. }
  4798. }
  4799. };
  4800. onMounted(cacheSubtree);
  4801. onUpdated(cacheSubtree);
  4802. onBeforeUnmount(() => {
  4803. cache.forEach((cached) => {
  4804. const { subTree, suspense } = instance;
  4805. const vnode = getInnerChild(subTree);
  4806. if (cached.type === vnode.type && cached.key === vnode.key) {
  4807. resetShapeFlag(vnode);
  4808. const da = vnode.component.da;
  4809. da && queuePostRenderEffect(da, suspense);
  4810. return;
  4811. }
  4812. unmount(cached);
  4813. });
  4814. });
  4815. return () => {
  4816. pendingCacheKey = null;
  4817. if (!slots.default) {
  4818. return current = null;
  4819. }
  4820. const children = slots.default();
  4821. const rawVNode = children[0];
  4822. if (children.length > 1) {
  4823. {
  4824. warn$1(`KeepAlive should contain exactly one component child.`);
  4825. }
  4826. current = null;
  4827. return children;
  4828. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  4829. current = null;
  4830. return rawVNode;
  4831. }
  4832. let vnode = getInnerChild(rawVNode);
  4833. if (vnode.type === Comment) {
  4834. current = null;
  4835. return vnode;
  4836. }
  4837. const comp = vnode.type;
  4838. const name = getComponentName(
  4839. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  4840. );
  4841. const { include, exclude, max } = props;
  4842. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  4843. vnode.shapeFlag &= ~256;
  4844. current = vnode;
  4845. return rawVNode;
  4846. }
  4847. const key = vnode.key == null ? comp : vnode.key;
  4848. const cachedVNode = cache.get(key);
  4849. if (vnode.el) {
  4850. vnode = cloneVNode(vnode);
  4851. if (rawVNode.shapeFlag & 128) {
  4852. rawVNode.ssContent = vnode;
  4853. }
  4854. }
  4855. pendingCacheKey = key;
  4856. if (cachedVNode) {
  4857. vnode.el = cachedVNode.el;
  4858. vnode.component = cachedVNode.component;
  4859. if (vnode.transition) {
  4860. setTransitionHooks(vnode, vnode.transition);
  4861. }
  4862. vnode.shapeFlag |= 512;
  4863. keys.delete(key);
  4864. keys.add(key);
  4865. } else {
  4866. keys.add(key);
  4867. if (max && keys.size > parseInt(max, 10)) {
  4868. pruneCacheEntry(keys.values().next().value);
  4869. }
  4870. }
  4871. vnode.shapeFlag |= 256;
  4872. current = vnode;
  4873. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  4874. };
  4875. }
  4876. };
  4877. const KeepAlive = KeepAliveImpl;
  4878. function matches(pattern, name) {
  4879. if (isArray(pattern)) {
  4880. return pattern.some((p) => matches(p, name));
  4881. } else if (isString(pattern)) {
  4882. return pattern.split(",").includes(name);
  4883. } else if (isRegExp(pattern)) {
  4884. pattern.lastIndex = 0;
  4885. return pattern.test(name);
  4886. }
  4887. return false;
  4888. }
  4889. function onActivated(hook, target) {
  4890. registerKeepAliveHook(hook, "a", target);
  4891. }
  4892. function onDeactivated(hook, target) {
  4893. registerKeepAliveHook(hook, "da", target);
  4894. }
  4895. function registerKeepAliveHook(hook, type, target = currentInstance) {
  4896. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  4897. let current = target;
  4898. while (current) {
  4899. if (current.isDeactivated) {
  4900. return;
  4901. }
  4902. current = current.parent;
  4903. }
  4904. return hook();
  4905. });
  4906. injectHook(type, wrappedHook, target);
  4907. if (target) {
  4908. let current = target.parent;
  4909. while (current && current.parent) {
  4910. if (isKeepAlive(current.parent.vnode)) {
  4911. injectToKeepAliveRoot(wrappedHook, type, target, current);
  4912. }
  4913. current = current.parent;
  4914. }
  4915. }
  4916. }
  4917. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  4918. const injected = injectHook(
  4919. type,
  4920. hook,
  4921. keepAliveRoot,
  4922. true
  4923. /* prepend */
  4924. );
  4925. onUnmounted(() => {
  4926. remove(keepAliveRoot[type], injected);
  4927. }, target);
  4928. }
  4929. function resetShapeFlag(vnode) {
  4930. vnode.shapeFlag &= ~256;
  4931. vnode.shapeFlag &= ~512;
  4932. }
  4933. function getInnerChild(vnode) {
  4934. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  4935. }
  4936. function injectHook(type, hook, target = currentInstance, prepend = false) {
  4937. if (target) {
  4938. const hooks = target[type] || (target[type] = []);
  4939. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  4940. pauseTracking();
  4941. const reset = setCurrentInstance(target);
  4942. const res = callWithAsyncErrorHandling(hook, target, type, args);
  4943. reset();
  4944. resetTracking();
  4945. return res;
  4946. });
  4947. if (prepend) {
  4948. hooks.unshift(wrappedHook);
  4949. } else {
  4950. hooks.push(wrappedHook);
  4951. }
  4952. return wrappedHook;
  4953. } else {
  4954. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  4955. warn$1(
  4956. `${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.` )
  4957. );
  4958. }
  4959. }
  4960. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  4961. if (!isInSSRComponentSetup || lifecycle === "sp") {
  4962. injectHook(lifecycle, (...args) => hook(...args), target);
  4963. }
  4964. };
  4965. const onBeforeMount = createHook("bm");
  4966. const onMounted = createHook("m");
  4967. const onBeforeUpdate = createHook(
  4968. "bu"
  4969. );
  4970. const onUpdated = createHook("u");
  4971. const onBeforeUnmount = createHook(
  4972. "bum"
  4973. );
  4974. const onUnmounted = createHook("um");
  4975. const onServerPrefetch = createHook(
  4976. "sp"
  4977. );
  4978. const onRenderTriggered = createHook("rtg");
  4979. const onRenderTracked = createHook("rtc");
  4980. function onErrorCaptured(hook, target = currentInstance) {
  4981. injectHook("ec", hook, target);
  4982. }
  4983. const COMPONENTS = "components";
  4984. const DIRECTIVES = "directives";
  4985. function resolveComponent(name, maybeSelfReference) {
  4986. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  4987. }
  4988. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  4989. function resolveDynamicComponent(component) {
  4990. if (isString(component)) {
  4991. return resolveAsset(COMPONENTS, component, false) || component;
  4992. } else {
  4993. return component || NULL_DYNAMIC_COMPONENT;
  4994. }
  4995. }
  4996. function resolveDirective(name) {
  4997. return resolveAsset(DIRECTIVES, name);
  4998. }
  4999. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  5000. const instance = currentRenderingInstance || currentInstance;
  5001. if (instance) {
  5002. const Component = instance.type;
  5003. if (type === COMPONENTS) {
  5004. const selfName = getComponentName(
  5005. Component,
  5006. false
  5007. );
  5008. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  5009. return Component;
  5010. }
  5011. }
  5012. const res = (
  5013. // local registration
  5014. // check instance[type] first which is resolved for options API
  5015. resolve(instance[type] || Component[type], name) || // global registration
  5016. resolve(instance.appContext[type], name)
  5017. );
  5018. if (!res && maybeSelfReference) {
  5019. return Component;
  5020. }
  5021. if (warnMissing && !res) {
  5022. const extra = type === COMPONENTS ? `
  5023. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  5024. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  5025. }
  5026. return res;
  5027. } else {
  5028. warn$1(
  5029. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  5030. );
  5031. }
  5032. }
  5033. function resolve(registry, name) {
  5034. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  5035. }
  5036. function renderList(source, renderItem, cache, index) {
  5037. let ret;
  5038. const cached = cache && cache[index];
  5039. const sourceIsArray = isArray(source);
  5040. if (sourceIsArray || isString(source)) {
  5041. const sourceIsReactiveArray = sourceIsArray && isReactive(source);
  5042. let needsWrap = false;
  5043. if (sourceIsReactiveArray) {
  5044. needsWrap = !isShallow(source);
  5045. source = shallowReadArray(source);
  5046. }
  5047. ret = new Array(source.length);
  5048. for (let i = 0, l = source.length; i < l; i++) {
  5049. ret[i] = renderItem(
  5050. needsWrap ? toReactive(source[i]) : source[i],
  5051. i,
  5052. void 0,
  5053. cached && cached[i]
  5054. );
  5055. }
  5056. } else if (typeof source === "number") {
  5057. if (!Number.isInteger(source)) {
  5058. warn$1(`The v-for range expect an integer value but got ${source}.`);
  5059. }
  5060. ret = new Array(source);
  5061. for (let i = 0; i < source; i++) {
  5062. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  5063. }
  5064. } else if (isObject(source)) {
  5065. if (source[Symbol.iterator]) {
  5066. ret = Array.from(
  5067. source,
  5068. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  5069. );
  5070. } else {
  5071. const keys = Object.keys(source);
  5072. ret = new Array(keys.length);
  5073. for (let i = 0, l = keys.length; i < l; i++) {
  5074. const key = keys[i];
  5075. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  5076. }
  5077. }
  5078. } else {
  5079. ret = [];
  5080. }
  5081. if (cache) {
  5082. cache[index] = ret;
  5083. }
  5084. return ret;
  5085. }
  5086. function createSlots(slots, dynamicSlots) {
  5087. for (let i = 0; i < dynamicSlots.length; i++) {
  5088. const slot = dynamicSlots[i];
  5089. if (isArray(slot)) {
  5090. for (let j = 0; j < slot.length; j++) {
  5091. slots[slot[j].name] = slot[j].fn;
  5092. }
  5093. } else if (slot) {
  5094. slots[slot.name] = slot.key ? (...args) => {
  5095. const res = slot.fn(...args);
  5096. if (res) res.key = slot.key;
  5097. return res;
  5098. } : slot.fn;
  5099. }
  5100. }
  5101. return slots;
  5102. }
  5103. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  5104. if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
  5105. if (name !== "default") props.name = name;
  5106. return openBlock(), createBlock(
  5107. Fragment,
  5108. null,
  5109. [createVNode("slot", props, fallback && fallback())],
  5110. 64
  5111. );
  5112. }
  5113. let slot = slots[name];
  5114. if (slot && slot.length > 1) {
  5115. warn$1(
  5116. `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.`
  5117. );
  5118. slot = () => [];
  5119. }
  5120. if (slot && slot._c) {
  5121. slot._d = false;
  5122. }
  5123. openBlock();
  5124. const validSlotContent = slot && ensureValidVNode(slot(props));
  5125. const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
  5126. // key attached in the `createSlots` helper, respect that
  5127. validSlotContent && validSlotContent.key;
  5128. const rendered = createBlock(
  5129. Fragment,
  5130. {
  5131. key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
  5132. (!validSlotContent && fallback ? "_fb" : "")
  5133. },
  5134. validSlotContent || (fallback ? fallback() : []),
  5135. validSlotContent && slots._ === 1 ? 64 : -2
  5136. );
  5137. if (!noSlotted && rendered.scopeId) {
  5138. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  5139. }
  5140. if (slot && slot._c) {
  5141. slot._d = true;
  5142. }
  5143. return rendered;
  5144. }
  5145. function ensureValidVNode(vnodes) {
  5146. return vnodes.some((child) => {
  5147. if (!isVNode(child)) return true;
  5148. if (child.type === Comment) return false;
  5149. if (child.type === Fragment && !ensureValidVNode(child.children))
  5150. return false;
  5151. return true;
  5152. }) ? vnodes : null;
  5153. }
  5154. function toHandlers(obj, preserveCaseIfNecessary) {
  5155. const ret = {};
  5156. if (!isObject(obj)) {
  5157. warn$1(`v-on with no argument expects an object value.`);
  5158. return ret;
  5159. }
  5160. for (const key in obj) {
  5161. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  5162. }
  5163. return ret;
  5164. }
  5165. const getPublicInstance = (i) => {
  5166. if (!i) return null;
  5167. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  5168. return getPublicInstance(i.parent);
  5169. };
  5170. const publicPropertiesMap = (
  5171. // Move PURE marker to new line to workaround compiler discarding it
  5172. // due to type annotation
  5173. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  5174. $: (i) => i,
  5175. $el: (i) => i.vnode.el,
  5176. $data: (i) => i.data,
  5177. $props: (i) => shallowReadonly(i.props) ,
  5178. $attrs: (i) => shallowReadonly(i.attrs) ,
  5179. $slots: (i) => shallowReadonly(i.slots) ,
  5180. $refs: (i) => shallowReadonly(i.refs) ,
  5181. $parent: (i) => getPublicInstance(i.parent),
  5182. $root: (i) => getPublicInstance(i.root),
  5183. $host: (i) => i.ce,
  5184. $emit: (i) => i.emit,
  5185. $options: (i) => resolveMergedOptions(i) ,
  5186. $forceUpdate: (i) => i.f || (i.f = () => {
  5187. queueJob(i.update);
  5188. }),
  5189. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  5190. $watch: (i) => instanceWatch.bind(i)
  5191. })
  5192. );
  5193. const isReservedPrefix = (key) => key === "_" || key === "$";
  5194. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  5195. const PublicInstanceProxyHandlers = {
  5196. get({ _: instance }, key) {
  5197. if (key === "__v_skip") {
  5198. return true;
  5199. }
  5200. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  5201. if (key === "__isVue") {
  5202. return true;
  5203. }
  5204. let normalizedProps;
  5205. if (key[0] !== "$") {
  5206. const n = accessCache[key];
  5207. if (n !== void 0) {
  5208. switch (n) {
  5209. case 1 /* SETUP */:
  5210. return setupState[key];
  5211. case 2 /* DATA */:
  5212. return data[key];
  5213. case 4 /* CONTEXT */:
  5214. return ctx[key];
  5215. case 3 /* PROPS */:
  5216. return props[key];
  5217. }
  5218. } else if (hasSetupBinding(setupState, key)) {
  5219. accessCache[key] = 1 /* SETUP */;
  5220. return setupState[key];
  5221. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5222. accessCache[key] = 2 /* DATA */;
  5223. return data[key];
  5224. } else if (
  5225. // only cache other properties when instance has declared (thus stable)
  5226. // props
  5227. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  5228. ) {
  5229. accessCache[key] = 3 /* PROPS */;
  5230. return props[key];
  5231. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5232. accessCache[key] = 4 /* CONTEXT */;
  5233. return ctx[key];
  5234. } else if (shouldCacheAccess) {
  5235. accessCache[key] = 0 /* OTHER */;
  5236. }
  5237. }
  5238. const publicGetter = publicPropertiesMap[key];
  5239. let cssModule, globalProperties;
  5240. if (publicGetter) {
  5241. if (key === "$attrs") {
  5242. track(instance.attrs, "get", "");
  5243. markAttrsAccessed();
  5244. } else if (key === "$slots") {
  5245. track(instance, "get", key);
  5246. }
  5247. return publicGetter(instance);
  5248. } else if (
  5249. // css module (injected by vue-loader)
  5250. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  5251. ) {
  5252. return cssModule;
  5253. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5254. accessCache[key] = 4 /* CONTEXT */;
  5255. return ctx[key];
  5256. } else if (
  5257. // global properties
  5258. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  5259. ) {
  5260. {
  5261. return globalProperties[key];
  5262. }
  5263. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  5264. // to infinite warning loop
  5265. key.indexOf("__v") !== 0)) {
  5266. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  5267. warn$1(
  5268. `Property ${JSON.stringify(
  5269. key
  5270. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  5271. );
  5272. } else if (instance === currentRenderingInstance) {
  5273. warn$1(
  5274. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  5275. );
  5276. }
  5277. }
  5278. },
  5279. set({ _: instance }, key, value) {
  5280. const { data, setupState, ctx } = instance;
  5281. if (hasSetupBinding(setupState, key)) {
  5282. setupState[key] = value;
  5283. return true;
  5284. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  5285. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  5286. return false;
  5287. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5288. data[key] = value;
  5289. return true;
  5290. } else if (hasOwn(instance.props, key)) {
  5291. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  5292. return false;
  5293. }
  5294. if (key[0] === "$" && key.slice(1) in instance) {
  5295. warn$1(
  5296. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  5297. );
  5298. return false;
  5299. } else {
  5300. if (key in instance.appContext.config.globalProperties) {
  5301. Object.defineProperty(ctx, key, {
  5302. enumerable: true,
  5303. configurable: true,
  5304. value
  5305. });
  5306. } else {
  5307. ctx[key] = value;
  5308. }
  5309. }
  5310. return true;
  5311. },
  5312. has({
  5313. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  5314. }, key) {
  5315. let normalizedProps;
  5316. return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
  5317. },
  5318. defineProperty(target, key, descriptor) {
  5319. if (descriptor.get != null) {
  5320. target._.accessCache[key] = 0;
  5321. } else if (hasOwn(descriptor, "value")) {
  5322. this.set(target, key, descriptor.value, null);
  5323. }
  5324. return Reflect.defineProperty(target, key, descriptor);
  5325. }
  5326. };
  5327. {
  5328. PublicInstanceProxyHandlers.ownKeys = (target) => {
  5329. warn$1(
  5330. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  5331. );
  5332. return Reflect.ownKeys(target);
  5333. };
  5334. }
  5335. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
  5336. get(target, key) {
  5337. if (key === Symbol.unscopables) {
  5338. return;
  5339. }
  5340. return PublicInstanceProxyHandlers.get(target, key, target);
  5341. },
  5342. has(_, key) {
  5343. const has = key[0] !== "_" && !isGloballyAllowed(key);
  5344. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  5345. warn$1(
  5346. `Property ${JSON.stringify(
  5347. key
  5348. )} should not start with _ which is a reserved prefix for Vue internals.`
  5349. );
  5350. }
  5351. return has;
  5352. }
  5353. });
  5354. function createDevRenderContext(instance) {
  5355. const target = {};
  5356. Object.defineProperty(target, `_`, {
  5357. configurable: true,
  5358. enumerable: false,
  5359. get: () => instance
  5360. });
  5361. Object.keys(publicPropertiesMap).forEach((key) => {
  5362. Object.defineProperty(target, key, {
  5363. configurable: true,
  5364. enumerable: false,
  5365. get: () => publicPropertiesMap[key](instance),
  5366. // intercepted by the proxy so no need for implementation,
  5367. // but needed to prevent set errors
  5368. set: NOOP
  5369. });
  5370. });
  5371. return target;
  5372. }
  5373. function exposePropsOnRenderContext(instance) {
  5374. const {
  5375. ctx,
  5376. propsOptions: [propsOptions]
  5377. } = instance;
  5378. if (propsOptions) {
  5379. Object.keys(propsOptions).forEach((key) => {
  5380. Object.defineProperty(ctx, key, {
  5381. enumerable: true,
  5382. configurable: true,
  5383. get: () => instance.props[key],
  5384. set: NOOP
  5385. });
  5386. });
  5387. }
  5388. }
  5389. function exposeSetupStateOnRenderContext(instance) {
  5390. const { ctx, setupState } = instance;
  5391. Object.keys(toRaw(setupState)).forEach((key) => {
  5392. if (!setupState.__isScriptSetup) {
  5393. if (isReservedPrefix(key[0])) {
  5394. warn$1(
  5395. `setup() return property ${JSON.stringify(
  5396. key
  5397. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  5398. );
  5399. return;
  5400. }
  5401. Object.defineProperty(ctx, key, {
  5402. enumerable: true,
  5403. configurable: true,
  5404. get: () => setupState[key],
  5405. set: NOOP
  5406. });
  5407. }
  5408. });
  5409. }
  5410. const warnRuntimeUsage = (method) => warn$1(
  5411. `${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.`
  5412. );
  5413. function defineProps() {
  5414. {
  5415. warnRuntimeUsage(`defineProps`);
  5416. }
  5417. return null;
  5418. }
  5419. function defineEmits() {
  5420. {
  5421. warnRuntimeUsage(`defineEmits`);
  5422. }
  5423. return null;
  5424. }
  5425. function defineExpose(exposed) {
  5426. {
  5427. warnRuntimeUsage(`defineExpose`);
  5428. }
  5429. }
  5430. function defineOptions(options) {
  5431. {
  5432. warnRuntimeUsage(`defineOptions`);
  5433. }
  5434. }
  5435. function defineSlots() {
  5436. {
  5437. warnRuntimeUsage(`defineSlots`);
  5438. }
  5439. return null;
  5440. }
  5441. function defineModel() {
  5442. {
  5443. warnRuntimeUsage("defineModel");
  5444. }
  5445. }
  5446. function withDefaults(props, defaults) {
  5447. {
  5448. warnRuntimeUsage(`withDefaults`);
  5449. }
  5450. return null;
  5451. }
  5452. function useSlots() {
  5453. return getContext().slots;
  5454. }
  5455. function useAttrs() {
  5456. return getContext().attrs;
  5457. }
  5458. function getContext() {
  5459. const i = getCurrentInstance();
  5460. if (!i) {
  5461. warn$1(`useContext() called without active instance.`);
  5462. }
  5463. return i.setupContext || (i.setupContext = createSetupContext(i));
  5464. }
  5465. function normalizePropsOrEmits(props) {
  5466. return isArray(props) ? props.reduce(
  5467. (normalized, p) => (normalized[p] = null, normalized),
  5468. {}
  5469. ) : props;
  5470. }
  5471. function mergeDefaults(raw, defaults) {
  5472. const props = normalizePropsOrEmits(raw);
  5473. for (const key in defaults) {
  5474. if (key.startsWith("__skip")) continue;
  5475. let opt = props[key];
  5476. if (opt) {
  5477. if (isArray(opt) || isFunction(opt)) {
  5478. opt = props[key] = { type: opt, default: defaults[key] };
  5479. } else {
  5480. opt.default = defaults[key];
  5481. }
  5482. } else if (opt === null) {
  5483. opt = props[key] = { default: defaults[key] };
  5484. } else {
  5485. warn$1(`props default key "${key}" has no corresponding declaration.`);
  5486. }
  5487. if (opt && defaults[`__skip_${key}`]) {
  5488. opt.skipFactory = true;
  5489. }
  5490. }
  5491. return props;
  5492. }
  5493. function mergeModels(a, b) {
  5494. if (!a || !b) return a || b;
  5495. if (isArray(a) && isArray(b)) return a.concat(b);
  5496. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  5497. }
  5498. function createPropsRestProxy(props, excludedKeys) {
  5499. const ret = {};
  5500. for (const key in props) {
  5501. if (!excludedKeys.includes(key)) {
  5502. Object.defineProperty(ret, key, {
  5503. enumerable: true,
  5504. get: () => props[key]
  5505. });
  5506. }
  5507. }
  5508. return ret;
  5509. }
  5510. function withAsyncContext(getAwaitable) {
  5511. const ctx = getCurrentInstance();
  5512. if (!ctx) {
  5513. warn$1(
  5514. `withAsyncContext called without active current instance. This is likely a bug.`
  5515. );
  5516. }
  5517. let awaitable = getAwaitable();
  5518. unsetCurrentInstance();
  5519. if (isPromise(awaitable)) {
  5520. awaitable = awaitable.catch((e) => {
  5521. setCurrentInstance(ctx);
  5522. throw e;
  5523. });
  5524. }
  5525. return [awaitable, () => setCurrentInstance(ctx)];
  5526. }
  5527. function createDuplicateChecker() {
  5528. const cache = /* @__PURE__ */ Object.create(null);
  5529. return (type, key) => {
  5530. if (cache[key]) {
  5531. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  5532. } else {
  5533. cache[key] = type;
  5534. }
  5535. };
  5536. }
  5537. let shouldCacheAccess = true;
  5538. function applyOptions(instance) {
  5539. const options = resolveMergedOptions(instance);
  5540. const publicThis = instance.proxy;
  5541. const ctx = instance.ctx;
  5542. shouldCacheAccess = false;
  5543. if (options.beforeCreate) {
  5544. callHook$1(options.beforeCreate, instance, "bc");
  5545. }
  5546. const {
  5547. // state
  5548. data: dataOptions,
  5549. computed: computedOptions,
  5550. methods,
  5551. watch: watchOptions,
  5552. provide: provideOptions,
  5553. inject: injectOptions,
  5554. // lifecycle
  5555. created,
  5556. beforeMount,
  5557. mounted,
  5558. beforeUpdate,
  5559. updated,
  5560. activated,
  5561. deactivated,
  5562. beforeDestroy,
  5563. beforeUnmount,
  5564. destroyed,
  5565. unmounted,
  5566. render,
  5567. renderTracked,
  5568. renderTriggered,
  5569. errorCaptured,
  5570. serverPrefetch,
  5571. // public API
  5572. expose,
  5573. inheritAttrs,
  5574. // assets
  5575. components,
  5576. directives,
  5577. filters
  5578. } = options;
  5579. const checkDuplicateProperties = createDuplicateChecker() ;
  5580. {
  5581. const [propsOptions] = instance.propsOptions;
  5582. if (propsOptions) {
  5583. for (const key in propsOptions) {
  5584. checkDuplicateProperties("Props" /* PROPS */, key);
  5585. }
  5586. }
  5587. }
  5588. if (injectOptions) {
  5589. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  5590. }
  5591. if (methods) {
  5592. for (const key in methods) {
  5593. const methodHandler = methods[key];
  5594. if (isFunction(methodHandler)) {
  5595. {
  5596. Object.defineProperty(ctx, key, {
  5597. value: methodHandler.bind(publicThis),
  5598. configurable: true,
  5599. enumerable: true,
  5600. writable: true
  5601. });
  5602. }
  5603. {
  5604. checkDuplicateProperties("Methods" /* METHODS */, key);
  5605. }
  5606. } else {
  5607. warn$1(
  5608. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  5609. );
  5610. }
  5611. }
  5612. }
  5613. if (dataOptions) {
  5614. if (!isFunction(dataOptions)) {
  5615. warn$1(
  5616. `The data option must be a function. Plain object usage is no longer supported.`
  5617. );
  5618. }
  5619. const data = dataOptions.call(publicThis, publicThis);
  5620. if (isPromise(data)) {
  5621. warn$1(
  5622. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  5623. );
  5624. }
  5625. if (!isObject(data)) {
  5626. warn$1(`data() should return an object.`);
  5627. } else {
  5628. instance.data = reactive(data);
  5629. {
  5630. for (const key in data) {
  5631. checkDuplicateProperties("Data" /* DATA */, key);
  5632. if (!isReservedPrefix(key[0])) {
  5633. Object.defineProperty(ctx, key, {
  5634. configurable: true,
  5635. enumerable: true,
  5636. get: () => data[key],
  5637. set: NOOP
  5638. });
  5639. }
  5640. }
  5641. }
  5642. }
  5643. }
  5644. shouldCacheAccess = true;
  5645. if (computedOptions) {
  5646. for (const key in computedOptions) {
  5647. const opt = computedOptions[key];
  5648. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  5649. if (get === NOOP) {
  5650. warn$1(`Computed property "${key}" has no getter.`);
  5651. }
  5652. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  5653. warn$1(
  5654. `Write operation failed: computed property "${key}" is readonly.`
  5655. );
  5656. } ;
  5657. const c = computed({
  5658. get,
  5659. set
  5660. });
  5661. Object.defineProperty(ctx, key, {
  5662. enumerable: true,
  5663. configurable: true,
  5664. get: () => c.value,
  5665. set: (v) => c.value = v
  5666. });
  5667. {
  5668. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  5669. }
  5670. }
  5671. }
  5672. if (watchOptions) {
  5673. for (const key in watchOptions) {
  5674. createWatcher(watchOptions[key], ctx, publicThis, key);
  5675. }
  5676. }
  5677. if (provideOptions) {
  5678. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  5679. Reflect.ownKeys(provides).forEach((key) => {
  5680. provide(key, provides[key]);
  5681. });
  5682. }
  5683. if (created) {
  5684. callHook$1(created, instance, "c");
  5685. }
  5686. function registerLifecycleHook(register, hook) {
  5687. if (isArray(hook)) {
  5688. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  5689. } else if (hook) {
  5690. register(hook.bind(publicThis));
  5691. }
  5692. }
  5693. registerLifecycleHook(onBeforeMount, beforeMount);
  5694. registerLifecycleHook(onMounted, mounted);
  5695. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  5696. registerLifecycleHook(onUpdated, updated);
  5697. registerLifecycleHook(onActivated, activated);
  5698. registerLifecycleHook(onDeactivated, deactivated);
  5699. registerLifecycleHook(onErrorCaptured, errorCaptured);
  5700. registerLifecycleHook(onRenderTracked, renderTracked);
  5701. registerLifecycleHook(onRenderTriggered, renderTriggered);
  5702. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  5703. registerLifecycleHook(onUnmounted, unmounted);
  5704. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  5705. if (isArray(expose)) {
  5706. if (expose.length) {
  5707. const exposed = instance.exposed || (instance.exposed = {});
  5708. expose.forEach((key) => {
  5709. Object.defineProperty(exposed, key, {
  5710. get: () => publicThis[key],
  5711. set: (val) => publicThis[key] = val
  5712. });
  5713. });
  5714. } else if (!instance.exposed) {
  5715. instance.exposed = {};
  5716. }
  5717. }
  5718. if (render && instance.render === NOOP) {
  5719. instance.render = render;
  5720. }
  5721. if (inheritAttrs != null) {
  5722. instance.inheritAttrs = inheritAttrs;
  5723. }
  5724. if (components) instance.components = components;
  5725. if (directives) instance.directives = directives;
  5726. }
  5727. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  5728. if (isArray(injectOptions)) {
  5729. injectOptions = normalizeInject(injectOptions);
  5730. }
  5731. for (const key in injectOptions) {
  5732. const opt = injectOptions[key];
  5733. let injected;
  5734. if (isObject(opt)) {
  5735. if ("default" in opt) {
  5736. injected = inject(
  5737. opt.from || key,
  5738. opt.default,
  5739. true
  5740. );
  5741. } else {
  5742. injected = inject(opt.from || key);
  5743. }
  5744. } else {
  5745. injected = inject(opt);
  5746. }
  5747. if (isRef(injected)) {
  5748. Object.defineProperty(ctx, key, {
  5749. enumerable: true,
  5750. configurable: true,
  5751. get: () => injected.value,
  5752. set: (v) => injected.value = v
  5753. });
  5754. } else {
  5755. ctx[key] = injected;
  5756. }
  5757. {
  5758. checkDuplicateProperties("Inject" /* INJECT */, key);
  5759. }
  5760. }
  5761. }
  5762. function callHook$1(hook, instance, type) {
  5763. callWithAsyncErrorHandling(
  5764. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  5765. instance,
  5766. type
  5767. );
  5768. }
  5769. function createWatcher(raw, ctx, publicThis, key) {
  5770. let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  5771. if (isString(raw)) {
  5772. const handler = ctx[raw];
  5773. if (isFunction(handler)) {
  5774. {
  5775. watch(getter, handler);
  5776. }
  5777. } else {
  5778. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  5779. }
  5780. } else if (isFunction(raw)) {
  5781. {
  5782. watch(getter, raw.bind(publicThis));
  5783. }
  5784. } else if (isObject(raw)) {
  5785. if (isArray(raw)) {
  5786. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  5787. } else {
  5788. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  5789. if (isFunction(handler)) {
  5790. watch(getter, handler, raw);
  5791. } else {
  5792. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  5793. }
  5794. }
  5795. } else {
  5796. warn$1(`Invalid watch option: "${key}"`, raw);
  5797. }
  5798. }
  5799. function resolveMergedOptions(instance) {
  5800. const base = instance.type;
  5801. const { mixins, extends: extendsOptions } = base;
  5802. const {
  5803. mixins: globalMixins,
  5804. optionsCache: cache,
  5805. config: { optionMergeStrategies }
  5806. } = instance.appContext;
  5807. const cached = cache.get(base);
  5808. let resolved;
  5809. if (cached) {
  5810. resolved = cached;
  5811. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  5812. {
  5813. resolved = base;
  5814. }
  5815. } else {
  5816. resolved = {};
  5817. if (globalMixins.length) {
  5818. globalMixins.forEach(
  5819. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  5820. );
  5821. }
  5822. mergeOptions(resolved, base, optionMergeStrategies);
  5823. }
  5824. if (isObject(base)) {
  5825. cache.set(base, resolved);
  5826. }
  5827. return resolved;
  5828. }
  5829. function mergeOptions(to, from, strats, asMixin = false) {
  5830. const { mixins, extends: extendsOptions } = from;
  5831. if (extendsOptions) {
  5832. mergeOptions(to, extendsOptions, strats, true);
  5833. }
  5834. if (mixins) {
  5835. mixins.forEach(
  5836. (m) => mergeOptions(to, m, strats, true)
  5837. );
  5838. }
  5839. for (const key in from) {
  5840. if (asMixin && key === "expose") {
  5841. warn$1(
  5842. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  5843. );
  5844. } else {
  5845. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  5846. to[key] = strat ? strat(to[key], from[key]) : from[key];
  5847. }
  5848. }
  5849. return to;
  5850. }
  5851. const internalOptionMergeStrats = {
  5852. data: mergeDataFn,
  5853. props: mergeEmitsOrPropsOptions,
  5854. emits: mergeEmitsOrPropsOptions,
  5855. // objects
  5856. methods: mergeObjectOptions,
  5857. computed: mergeObjectOptions,
  5858. // lifecycle
  5859. beforeCreate: mergeAsArray$1,
  5860. created: mergeAsArray$1,
  5861. beforeMount: mergeAsArray$1,
  5862. mounted: mergeAsArray$1,
  5863. beforeUpdate: mergeAsArray$1,
  5864. updated: mergeAsArray$1,
  5865. beforeDestroy: mergeAsArray$1,
  5866. beforeUnmount: mergeAsArray$1,
  5867. destroyed: mergeAsArray$1,
  5868. unmounted: mergeAsArray$1,
  5869. activated: mergeAsArray$1,
  5870. deactivated: mergeAsArray$1,
  5871. errorCaptured: mergeAsArray$1,
  5872. serverPrefetch: mergeAsArray$1,
  5873. // assets
  5874. components: mergeObjectOptions,
  5875. directives: mergeObjectOptions,
  5876. // watch
  5877. watch: mergeWatchOptions,
  5878. // provide / inject
  5879. provide: mergeDataFn,
  5880. inject: mergeInject
  5881. };
  5882. function mergeDataFn(to, from) {
  5883. if (!from) {
  5884. return to;
  5885. }
  5886. if (!to) {
  5887. return from;
  5888. }
  5889. return function mergedDataFn() {
  5890. return (extend)(
  5891. isFunction(to) ? to.call(this, this) : to,
  5892. isFunction(from) ? from.call(this, this) : from
  5893. );
  5894. };
  5895. }
  5896. function mergeInject(to, from) {
  5897. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  5898. }
  5899. function normalizeInject(raw) {
  5900. if (isArray(raw)) {
  5901. const res = {};
  5902. for (let i = 0; i < raw.length; i++) {
  5903. res[raw[i]] = raw[i];
  5904. }
  5905. return res;
  5906. }
  5907. return raw;
  5908. }
  5909. function mergeAsArray$1(to, from) {
  5910. return to ? [...new Set([].concat(to, from))] : from;
  5911. }
  5912. function mergeObjectOptions(to, from) {
  5913. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  5914. }
  5915. function mergeEmitsOrPropsOptions(to, from) {
  5916. if (to) {
  5917. if (isArray(to) && isArray(from)) {
  5918. return [.../* @__PURE__ */ new Set([...to, ...from])];
  5919. }
  5920. return extend(
  5921. /* @__PURE__ */ Object.create(null),
  5922. normalizePropsOrEmits(to),
  5923. normalizePropsOrEmits(from != null ? from : {})
  5924. );
  5925. } else {
  5926. return from;
  5927. }
  5928. }
  5929. function mergeWatchOptions(to, from) {
  5930. if (!to) return from;
  5931. if (!from) return to;
  5932. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  5933. for (const key in from) {
  5934. merged[key] = mergeAsArray$1(to[key], from[key]);
  5935. }
  5936. return merged;
  5937. }
  5938. function createAppContext() {
  5939. return {
  5940. app: null,
  5941. config: {
  5942. isNativeTag: NO,
  5943. performance: false,
  5944. globalProperties: {},
  5945. optionMergeStrategies: {},
  5946. errorHandler: void 0,
  5947. warnHandler: void 0,
  5948. compilerOptions: {}
  5949. },
  5950. mixins: [],
  5951. components: {},
  5952. directives: {},
  5953. provides: /* @__PURE__ */ Object.create(null),
  5954. optionsCache: /* @__PURE__ */ new WeakMap(),
  5955. propsCache: /* @__PURE__ */ new WeakMap(),
  5956. emitsCache: /* @__PURE__ */ new WeakMap()
  5957. };
  5958. }
  5959. let uid$1 = 0;
  5960. function createAppAPI(render, hydrate) {
  5961. return function createApp(rootComponent, rootProps = null) {
  5962. if (!isFunction(rootComponent)) {
  5963. rootComponent = extend({}, rootComponent);
  5964. }
  5965. if (rootProps != null && !isObject(rootProps)) {
  5966. warn$1(`root props passed to app.mount() must be an object.`);
  5967. rootProps = null;
  5968. }
  5969. const context = createAppContext();
  5970. const installedPlugins = /* @__PURE__ */ new WeakSet();
  5971. const pluginCleanupFns = [];
  5972. let isMounted = false;
  5973. const app = context.app = {
  5974. _uid: uid$1++,
  5975. _component: rootComponent,
  5976. _props: rootProps,
  5977. _container: null,
  5978. _context: context,
  5979. _instance: null,
  5980. version,
  5981. get config() {
  5982. return context.config;
  5983. },
  5984. set config(v) {
  5985. {
  5986. warn$1(
  5987. `app.config cannot be replaced. Modify individual options instead.`
  5988. );
  5989. }
  5990. },
  5991. use(plugin, ...options) {
  5992. if (installedPlugins.has(plugin)) {
  5993. warn$1(`Plugin has already been applied to target app.`);
  5994. } else if (plugin && isFunction(plugin.install)) {
  5995. installedPlugins.add(plugin);
  5996. plugin.install(app, ...options);
  5997. } else if (isFunction(plugin)) {
  5998. installedPlugins.add(plugin);
  5999. plugin(app, ...options);
  6000. } else {
  6001. warn$1(
  6002. `A plugin must either be a function or an object with an "install" function.`
  6003. );
  6004. }
  6005. return app;
  6006. },
  6007. mixin(mixin) {
  6008. {
  6009. if (!context.mixins.includes(mixin)) {
  6010. context.mixins.push(mixin);
  6011. } else {
  6012. warn$1(
  6013. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  6014. );
  6015. }
  6016. }
  6017. return app;
  6018. },
  6019. component(name, component) {
  6020. {
  6021. validateComponentName(name, context.config);
  6022. }
  6023. if (!component) {
  6024. return context.components[name];
  6025. }
  6026. if (context.components[name]) {
  6027. warn$1(`Component "${name}" has already been registered in target app.`);
  6028. }
  6029. context.components[name] = component;
  6030. return app;
  6031. },
  6032. directive(name, directive) {
  6033. {
  6034. validateDirectiveName(name);
  6035. }
  6036. if (!directive) {
  6037. return context.directives[name];
  6038. }
  6039. if (context.directives[name]) {
  6040. warn$1(`Directive "${name}" has already been registered in target app.`);
  6041. }
  6042. context.directives[name] = directive;
  6043. return app;
  6044. },
  6045. mount(rootContainer, isHydrate, namespace) {
  6046. if (!isMounted) {
  6047. if (rootContainer.__vue_app__) {
  6048. warn$1(
  6049. `There is already an app instance mounted on the host container.
  6050. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  6051. );
  6052. }
  6053. const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
  6054. vnode.appContext = context;
  6055. if (namespace === true) {
  6056. namespace = "svg";
  6057. } else if (namespace === false) {
  6058. namespace = void 0;
  6059. }
  6060. {
  6061. context.reload = () => {
  6062. render(
  6063. cloneVNode(vnode),
  6064. rootContainer,
  6065. namespace
  6066. );
  6067. };
  6068. }
  6069. if (isHydrate && hydrate) {
  6070. hydrate(vnode, rootContainer);
  6071. } else {
  6072. render(vnode, rootContainer, namespace);
  6073. }
  6074. isMounted = true;
  6075. app._container = rootContainer;
  6076. rootContainer.__vue_app__ = app;
  6077. {
  6078. app._instance = vnode.component;
  6079. devtoolsInitApp(app, version);
  6080. }
  6081. return getComponentPublicInstance(vnode.component);
  6082. } else {
  6083. warn$1(
  6084. `App has already been mounted.
  6085. 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)\``
  6086. );
  6087. }
  6088. },
  6089. onUnmount(cleanupFn) {
  6090. if (typeof cleanupFn !== "function") {
  6091. warn$1(
  6092. `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
  6093. );
  6094. }
  6095. pluginCleanupFns.push(cleanupFn);
  6096. },
  6097. unmount() {
  6098. if (isMounted) {
  6099. callWithAsyncErrorHandling(
  6100. pluginCleanupFns,
  6101. app._instance,
  6102. 16
  6103. );
  6104. render(null, app._container);
  6105. {
  6106. app._instance = null;
  6107. devtoolsUnmountApp(app);
  6108. }
  6109. delete app._container.__vue_app__;
  6110. } else {
  6111. warn$1(`Cannot unmount an app that is not mounted.`);
  6112. }
  6113. },
  6114. provide(key, value) {
  6115. if (key in context.provides) {
  6116. warn$1(
  6117. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  6118. );
  6119. }
  6120. context.provides[key] = value;
  6121. return app;
  6122. },
  6123. runWithContext(fn) {
  6124. const lastApp = currentApp;
  6125. currentApp = app;
  6126. try {
  6127. return fn();
  6128. } finally {
  6129. currentApp = lastApp;
  6130. }
  6131. }
  6132. };
  6133. return app;
  6134. };
  6135. }
  6136. let currentApp = null;
  6137. function provide(key, value) {
  6138. if (!currentInstance) {
  6139. {
  6140. warn$1(`provide() can only be used inside setup().`);
  6141. }
  6142. } else {
  6143. let provides = currentInstance.provides;
  6144. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  6145. if (parentProvides === provides) {
  6146. provides = currentInstance.provides = Object.create(parentProvides);
  6147. }
  6148. provides[key] = value;
  6149. }
  6150. }
  6151. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  6152. const instance = currentInstance || currentRenderingInstance;
  6153. if (instance || currentApp) {
  6154. const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  6155. if (provides && key in provides) {
  6156. return provides[key];
  6157. } else if (arguments.length > 1) {
  6158. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  6159. } else {
  6160. warn$1(`injection "${String(key)}" not found.`);
  6161. }
  6162. } else {
  6163. warn$1(`inject() can only be used inside setup() or functional components.`);
  6164. }
  6165. }
  6166. function hasInjectionContext() {
  6167. return !!(currentInstance || currentRenderingInstance || currentApp);
  6168. }
  6169. const internalObjectProto = {};
  6170. const createInternalObject = () => Object.create(internalObjectProto);
  6171. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  6172. function initProps(instance, rawProps, isStateful, isSSR = false) {
  6173. const props = {};
  6174. const attrs = createInternalObject();
  6175. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  6176. setFullProps(instance, rawProps, props, attrs);
  6177. for (const key in instance.propsOptions[0]) {
  6178. if (!(key in props)) {
  6179. props[key] = void 0;
  6180. }
  6181. }
  6182. {
  6183. validateProps(rawProps || {}, props, instance);
  6184. }
  6185. if (isStateful) {
  6186. instance.props = isSSR ? props : shallowReactive(props);
  6187. } else {
  6188. if (!instance.type.props) {
  6189. instance.props = attrs;
  6190. } else {
  6191. instance.props = props;
  6192. }
  6193. }
  6194. instance.attrs = attrs;
  6195. }
  6196. function isInHmrContext(instance) {
  6197. while (instance) {
  6198. if (instance.type.__hmrId) return true;
  6199. instance = instance.parent;
  6200. }
  6201. }
  6202. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  6203. const {
  6204. props,
  6205. attrs,
  6206. vnode: { patchFlag }
  6207. } = instance;
  6208. const rawCurrentProps = toRaw(props);
  6209. const [options] = instance.propsOptions;
  6210. let hasAttrsChanged = false;
  6211. if (
  6212. // always force full diff in dev
  6213. // - #1942 if hmr is enabled with sfc component
  6214. // - vite#872 non-sfc component used by sfc component
  6215. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  6216. ) {
  6217. if (patchFlag & 8) {
  6218. const propsToUpdate = instance.vnode.dynamicProps;
  6219. for (let i = 0; i < propsToUpdate.length; i++) {
  6220. let key = propsToUpdate[i];
  6221. if (isEmitListener(instance.emitsOptions, key)) {
  6222. continue;
  6223. }
  6224. const value = rawProps[key];
  6225. if (options) {
  6226. if (hasOwn(attrs, key)) {
  6227. if (value !== attrs[key]) {
  6228. attrs[key] = value;
  6229. hasAttrsChanged = true;
  6230. }
  6231. } else {
  6232. const camelizedKey = camelize(key);
  6233. props[camelizedKey] = resolvePropValue(
  6234. options,
  6235. rawCurrentProps,
  6236. camelizedKey,
  6237. value,
  6238. instance,
  6239. false
  6240. );
  6241. }
  6242. } else {
  6243. if (value !== attrs[key]) {
  6244. attrs[key] = value;
  6245. hasAttrsChanged = true;
  6246. }
  6247. }
  6248. }
  6249. }
  6250. } else {
  6251. if (setFullProps(instance, rawProps, props, attrs)) {
  6252. hasAttrsChanged = true;
  6253. }
  6254. let kebabKey;
  6255. for (const key in rawCurrentProps) {
  6256. if (!rawProps || // for camelCase
  6257. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  6258. // and converted to camelCase (#955)
  6259. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  6260. if (options) {
  6261. if (rawPrevProps && // for camelCase
  6262. (rawPrevProps[key] !== void 0 || // for kebab-case
  6263. rawPrevProps[kebabKey] !== void 0)) {
  6264. props[key] = resolvePropValue(
  6265. options,
  6266. rawCurrentProps,
  6267. key,
  6268. void 0,
  6269. instance,
  6270. true
  6271. );
  6272. }
  6273. } else {
  6274. delete props[key];
  6275. }
  6276. }
  6277. }
  6278. if (attrs !== rawCurrentProps) {
  6279. for (const key in attrs) {
  6280. if (!rawProps || !hasOwn(rawProps, key) && true) {
  6281. delete attrs[key];
  6282. hasAttrsChanged = true;
  6283. }
  6284. }
  6285. }
  6286. }
  6287. if (hasAttrsChanged) {
  6288. trigger(instance.attrs, "set", "");
  6289. }
  6290. {
  6291. validateProps(rawProps || {}, props, instance);
  6292. }
  6293. }
  6294. function setFullProps(instance, rawProps, props, attrs) {
  6295. const [options, needCastKeys] = instance.propsOptions;
  6296. let hasAttrsChanged = false;
  6297. let rawCastValues;
  6298. if (rawProps) {
  6299. for (let key in rawProps) {
  6300. if (isReservedProp(key)) {
  6301. continue;
  6302. }
  6303. const value = rawProps[key];
  6304. let camelKey;
  6305. if (options && hasOwn(options, camelKey = camelize(key))) {
  6306. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  6307. props[camelKey] = value;
  6308. } else {
  6309. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  6310. }
  6311. } else if (!isEmitListener(instance.emitsOptions, key)) {
  6312. if (!(key in attrs) || value !== attrs[key]) {
  6313. attrs[key] = value;
  6314. hasAttrsChanged = true;
  6315. }
  6316. }
  6317. }
  6318. }
  6319. if (needCastKeys) {
  6320. const rawCurrentProps = toRaw(props);
  6321. const castValues = rawCastValues || EMPTY_OBJ;
  6322. for (let i = 0; i < needCastKeys.length; i++) {
  6323. const key = needCastKeys[i];
  6324. props[key] = resolvePropValue(
  6325. options,
  6326. rawCurrentProps,
  6327. key,
  6328. castValues[key],
  6329. instance,
  6330. !hasOwn(castValues, key)
  6331. );
  6332. }
  6333. }
  6334. return hasAttrsChanged;
  6335. }
  6336. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  6337. const opt = options[key];
  6338. if (opt != null) {
  6339. const hasDefault = hasOwn(opt, "default");
  6340. if (hasDefault && value === void 0) {
  6341. const defaultValue = opt.default;
  6342. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  6343. const { propsDefaults } = instance;
  6344. if (key in propsDefaults) {
  6345. value = propsDefaults[key];
  6346. } else {
  6347. const reset = setCurrentInstance(instance);
  6348. value = propsDefaults[key] = defaultValue.call(
  6349. null,
  6350. props
  6351. );
  6352. reset();
  6353. }
  6354. } else {
  6355. value = defaultValue;
  6356. }
  6357. if (instance.ce) {
  6358. instance.ce._setProp(key, value);
  6359. }
  6360. }
  6361. if (opt[0 /* shouldCast */]) {
  6362. if (isAbsent && !hasDefault) {
  6363. value = false;
  6364. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  6365. value = true;
  6366. }
  6367. }
  6368. }
  6369. return value;
  6370. }
  6371. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  6372. function normalizePropsOptions(comp, appContext, asMixin = false) {
  6373. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  6374. const cached = cache.get(comp);
  6375. if (cached) {
  6376. return cached;
  6377. }
  6378. const raw = comp.props;
  6379. const normalized = {};
  6380. const needCastKeys = [];
  6381. let hasExtends = false;
  6382. if (!isFunction(comp)) {
  6383. const extendProps = (raw2) => {
  6384. hasExtends = true;
  6385. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  6386. extend(normalized, props);
  6387. if (keys) needCastKeys.push(...keys);
  6388. };
  6389. if (!asMixin && appContext.mixins.length) {
  6390. appContext.mixins.forEach(extendProps);
  6391. }
  6392. if (comp.extends) {
  6393. extendProps(comp.extends);
  6394. }
  6395. if (comp.mixins) {
  6396. comp.mixins.forEach(extendProps);
  6397. }
  6398. }
  6399. if (!raw && !hasExtends) {
  6400. if (isObject(comp)) {
  6401. cache.set(comp, EMPTY_ARR);
  6402. }
  6403. return EMPTY_ARR;
  6404. }
  6405. if (isArray(raw)) {
  6406. for (let i = 0; i < raw.length; i++) {
  6407. if (!isString(raw[i])) {
  6408. warn$1(`props must be strings when using array syntax.`, raw[i]);
  6409. }
  6410. const normalizedKey = camelize(raw[i]);
  6411. if (validatePropName(normalizedKey)) {
  6412. normalized[normalizedKey] = EMPTY_OBJ;
  6413. }
  6414. }
  6415. } else if (raw) {
  6416. if (!isObject(raw)) {
  6417. warn$1(`invalid props options`, raw);
  6418. }
  6419. for (const key in raw) {
  6420. const normalizedKey = camelize(key);
  6421. if (validatePropName(normalizedKey)) {
  6422. const opt = raw[key];
  6423. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  6424. const propType = prop.type;
  6425. let shouldCast = false;
  6426. let shouldCastTrue = true;
  6427. if (isArray(propType)) {
  6428. for (let index = 0; index < propType.length; ++index) {
  6429. const type = propType[index];
  6430. const typeName = isFunction(type) && type.name;
  6431. if (typeName === "Boolean") {
  6432. shouldCast = true;
  6433. break;
  6434. } else if (typeName === "String") {
  6435. shouldCastTrue = false;
  6436. }
  6437. }
  6438. } else {
  6439. shouldCast = isFunction(propType) && propType.name === "Boolean";
  6440. }
  6441. prop[0 /* shouldCast */] = shouldCast;
  6442. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  6443. if (shouldCast || hasOwn(prop, "default")) {
  6444. needCastKeys.push(normalizedKey);
  6445. }
  6446. }
  6447. }
  6448. }
  6449. const res = [normalized, needCastKeys];
  6450. if (isObject(comp)) {
  6451. cache.set(comp, res);
  6452. }
  6453. return res;
  6454. }
  6455. function validatePropName(key) {
  6456. if (key[0] !== "$" && !isReservedProp(key)) {
  6457. return true;
  6458. } else {
  6459. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  6460. }
  6461. return false;
  6462. }
  6463. function getType(ctor) {
  6464. if (ctor === null) {
  6465. return "null";
  6466. }
  6467. if (typeof ctor === "function") {
  6468. return ctor.name || "";
  6469. } else if (typeof ctor === "object") {
  6470. const name = ctor.constructor && ctor.constructor.name;
  6471. return name || "";
  6472. }
  6473. return "";
  6474. }
  6475. function validateProps(rawProps, props, instance) {
  6476. const resolvedValues = toRaw(props);
  6477. const options = instance.propsOptions[0];
  6478. const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
  6479. for (const key in options) {
  6480. let opt = options[key];
  6481. if (opt == null) continue;
  6482. validateProp(
  6483. key,
  6484. resolvedValues[key],
  6485. opt,
  6486. shallowReadonly(resolvedValues) ,
  6487. !camelizePropsKey.includes(key)
  6488. );
  6489. }
  6490. }
  6491. function validateProp(name, value, prop, props, isAbsent) {
  6492. const { type, required, validator, skipCheck } = prop;
  6493. if (required && isAbsent) {
  6494. warn$1('Missing required prop: "' + name + '"');
  6495. return;
  6496. }
  6497. if (value == null && !required) {
  6498. return;
  6499. }
  6500. if (type != null && type !== true && !skipCheck) {
  6501. let isValid = false;
  6502. const types = isArray(type) ? type : [type];
  6503. const expectedTypes = [];
  6504. for (let i = 0; i < types.length && !isValid; i++) {
  6505. const { valid, expectedType } = assertType(value, types[i]);
  6506. expectedTypes.push(expectedType || "");
  6507. isValid = valid;
  6508. }
  6509. if (!isValid) {
  6510. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  6511. return;
  6512. }
  6513. }
  6514. if (validator && !validator(value, props)) {
  6515. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  6516. }
  6517. }
  6518. const isSimpleType = /* @__PURE__ */ makeMap(
  6519. "String,Number,Boolean,Function,Symbol,BigInt"
  6520. );
  6521. function assertType(value, type) {
  6522. let valid;
  6523. const expectedType = getType(type);
  6524. if (expectedType === "null") {
  6525. valid = value === null;
  6526. } else if (isSimpleType(expectedType)) {
  6527. const t = typeof value;
  6528. valid = t === expectedType.toLowerCase();
  6529. if (!valid && t === "object") {
  6530. valid = value instanceof type;
  6531. }
  6532. } else if (expectedType === "Object") {
  6533. valid = isObject(value);
  6534. } else if (expectedType === "Array") {
  6535. valid = isArray(value);
  6536. } else {
  6537. valid = value instanceof type;
  6538. }
  6539. return {
  6540. valid,
  6541. expectedType
  6542. };
  6543. }
  6544. function getInvalidTypeMessage(name, value, expectedTypes) {
  6545. if (expectedTypes.length === 0) {
  6546. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  6547. }
  6548. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  6549. const expectedType = expectedTypes[0];
  6550. const receivedType = toRawType(value);
  6551. const expectedValue = styleValue(value, expectedType);
  6552. const receivedValue = styleValue(value, receivedType);
  6553. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  6554. message += ` with value ${expectedValue}`;
  6555. }
  6556. message += `, got ${receivedType} `;
  6557. if (isExplicable(receivedType)) {
  6558. message += `with value ${receivedValue}.`;
  6559. }
  6560. return message;
  6561. }
  6562. function styleValue(value, type) {
  6563. if (type === "String") {
  6564. return `"${value}"`;
  6565. } else if (type === "Number") {
  6566. return `${Number(value)}`;
  6567. } else {
  6568. return `${value}`;
  6569. }
  6570. }
  6571. function isExplicable(type) {
  6572. const explicitTypes = ["string", "number", "boolean"];
  6573. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  6574. }
  6575. function isBoolean(...args) {
  6576. return args.some((elem) => elem.toLowerCase() === "boolean");
  6577. }
  6578. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  6579. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  6580. const normalizeSlot = (key, rawSlot, ctx) => {
  6581. if (rawSlot._n) {
  6582. return rawSlot;
  6583. }
  6584. const normalized = withCtx((...args) => {
  6585. if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
  6586. warn$1(
  6587. `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.`
  6588. );
  6589. }
  6590. return normalizeSlotValue(rawSlot(...args));
  6591. }, ctx);
  6592. normalized._c = false;
  6593. return normalized;
  6594. };
  6595. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  6596. const ctx = rawSlots._ctx;
  6597. for (const key in rawSlots) {
  6598. if (isInternalKey(key)) continue;
  6599. const value = rawSlots[key];
  6600. if (isFunction(value)) {
  6601. slots[key] = normalizeSlot(key, value, ctx);
  6602. } else if (value != null) {
  6603. {
  6604. warn$1(
  6605. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  6606. );
  6607. }
  6608. const normalized = normalizeSlotValue(value);
  6609. slots[key] = () => normalized;
  6610. }
  6611. }
  6612. };
  6613. const normalizeVNodeSlots = (instance, children) => {
  6614. if (!isKeepAlive(instance.vnode) && true) {
  6615. warn$1(
  6616. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  6617. );
  6618. }
  6619. const normalized = normalizeSlotValue(children);
  6620. instance.slots.default = () => normalized;
  6621. };
  6622. const assignSlots = (slots, children, optimized) => {
  6623. for (const key in children) {
  6624. if (optimized || key !== "_") {
  6625. slots[key] = children[key];
  6626. }
  6627. }
  6628. };
  6629. const initSlots = (instance, children, optimized) => {
  6630. const slots = instance.slots = createInternalObject();
  6631. if (instance.vnode.shapeFlag & 32) {
  6632. const type = children._;
  6633. if (type) {
  6634. assignSlots(slots, children, optimized);
  6635. if (optimized) {
  6636. def(slots, "_", type, true);
  6637. }
  6638. } else {
  6639. normalizeObjectSlots(children, slots);
  6640. }
  6641. } else if (children) {
  6642. normalizeVNodeSlots(instance, children);
  6643. }
  6644. };
  6645. const updateSlots = (instance, children, optimized) => {
  6646. const { vnode, slots } = instance;
  6647. let needDeletionCheck = true;
  6648. let deletionComparisonTarget = EMPTY_OBJ;
  6649. if (vnode.shapeFlag & 32) {
  6650. const type = children._;
  6651. if (type) {
  6652. if (isHmrUpdating) {
  6653. assignSlots(slots, children, optimized);
  6654. trigger(instance, "set", "$slots");
  6655. } else if (optimized && type === 1) {
  6656. needDeletionCheck = false;
  6657. } else {
  6658. assignSlots(slots, children, optimized);
  6659. }
  6660. } else {
  6661. needDeletionCheck = !children.$stable;
  6662. normalizeObjectSlots(children, slots);
  6663. }
  6664. deletionComparisonTarget = children;
  6665. } else if (children) {
  6666. normalizeVNodeSlots(instance, children);
  6667. deletionComparisonTarget = { default: 1 };
  6668. }
  6669. if (needDeletionCheck) {
  6670. for (const key in slots) {
  6671. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  6672. delete slots[key];
  6673. }
  6674. }
  6675. }
  6676. };
  6677. let supported;
  6678. let perf;
  6679. function startMeasure(instance, type) {
  6680. if (instance.appContext.config.performance && isSupported()) {
  6681. perf.mark(`vue-${type}-${instance.uid}`);
  6682. }
  6683. {
  6684. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6685. }
  6686. }
  6687. function endMeasure(instance, type) {
  6688. if (instance.appContext.config.performance && isSupported()) {
  6689. const startTag = `vue-${type}-${instance.uid}`;
  6690. const endTag = startTag + `:end`;
  6691. perf.mark(endTag);
  6692. perf.measure(
  6693. `<${formatComponentName(instance, instance.type)}> ${type}`,
  6694. startTag,
  6695. endTag
  6696. );
  6697. perf.clearMarks(startTag);
  6698. perf.clearMarks(endTag);
  6699. }
  6700. {
  6701. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6702. }
  6703. }
  6704. function isSupported() {
  6705. if (supported !== void 0) {
  6706. return supported;
  6707. }
  6708. if (typeof window !== "undefined" && window.performance) {
  6709. supported = true;
  6710. perf = window.performance;
  6711. } else {
  6712. supported = false;
  6713. }
  6714. return supported;
  6715. }
  6716. const queuePostRenderEffect = queueEffectWithSuspense ;
  6717. function createRenderer(options) {
  6718. return baseCreateRenderer(options);
  6719. }
  6720. function createHydrationRenderer(options) {
  6721. return baseCreateRenderer(options, createHydrationFunctions);
  6722. }
  6723. function baseCreateRenderer(options, createHydrationFns) {
  6724. const target = getGlobalThis();
  6725. target.__VUE__ = true;
  6726. {
  6727. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6728. }
  6729. const {
  6730. insert: hostInsert,
  6731. remove: hostRemove,
  6732. patchProp: hostPatchProp,
  6733. createElement: hostCreateElement,
  6734. createText: hostCreateText,
  6735. createComment: hostCreateComment,
  6736. setText: hostSetText,
  6737. setElementText: hostSetElementText,
  6738. parentNode: hostParentNode,
  6739. nextSibling: hostNextSibling,
  6740. setScopeId: hostSetScopeId = NOOP,
  6741. insertStaticContent: hostInsertStaticContent
  6742. } = options;
  6743. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6744. if (n1 === n2) {
  6745. return;
  6746. }
  6747. if (n1 && !isSameVNodeType(n1, n2)) {
  6748. anchor = getNextHostNode(n1);
  6749. unmount(n1, parentComponent, parentSuspense, true);
  6750. n1 = null;
  6751. }
  6752. if (n2.patchFlag === -2) {
  6753. optimized = false;
  6754. n2.dynamicChildren = null;
  6755. }
  6756. const { type, ref, shapeFlag } = n2;
  6757. switch (type) {
  6758. case Text:
  6759. processText(n1, n2, container, anchor);
  6760. break;
  6761. case Comment:
  6762. processCommentNode(n1, n2, container, anchor);
  6763. break;
  6764. case Static:
  6765. if (n1 == null) {
  6766. mountStaticNode(n2, container, anchor, namespace);
  6767. } else {
  6768. patchStaticNode(n1, n2, container, namespace);
  6769. }
  6770. break;
  6771. case Fragment:
  6772. processFragment(
  6773. n1,
  6774. n2,
  6775. container,
  6776. anchor,
  6777. parentComponent,
  6778. parentSuspense,
  6779. namespace,
  6780. slotScopeIds,
  6781. optimized
  6782. );
  6783. break;
  6784. default:
  6785. if (shapeFlag & 1) {
  6786. processElement(
  6787. n1,
  6788. n2,
  6789. container,
  6790. anchor,
  6791. parentComponent,
  6792. parentSuspense,
  6793. namespace,
  6794. slotScopeIds,
  6795. optimized
  6796. );
  6797. } else if (shapeFlag & 6) {
  6798. processComponent(
  6799. n1,
  6800. n2,
  6801. container,
  6802. anchor,
  6803. parentComponent,
  6804. parentSuspense,
  6805. namespace,
  6806. slotScopeIds,
  6807. optimized
  6808. );
  6809. } else if (shapeFlag & 64) {
  6810. type.process(
  6811. n1,
  6812. n2,
  6813. container,
  6814. anchor,
  6815. parentComponent,
  6816. parentSuspense,
  6817. namespace,
  6818. slotScopeIds,
  6819. optimized,
  6820. internals
  6821. );
  6822. } else if (shapeFlag & 128) {
  6823. type.process(
  6824. n1,
  6825. n2,
  6826. container,
  6827. anchor,
  6828. parentComponent,
  6829. parentSuspense,
  6830. namespace,
  6831. slotScopeIds,
  6832. optimized,
  6833. internals
  6834. );
  6835. } else {
  6836. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  6837. }
  6838. }
  6839. if (ref != null && parentComponent) {
  6840. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6841. }
  6842. };
  6843. const processText = (n1, n2, container, anchor) => {
  6844. if (n1 == null) {
  6845. hostInsert(
  6846. n2.el = hostCreateText(n2.children),
  6847. container,
  6848. anchor
  6849. );
  6850. } else {
  6851. const el = n2.el = n1.el;
  6852. if (n2.children !== n1.children) {
  6853. hostSetText(el, n2.children);
  6854. }
  6855. }
  6856. };
  6857. const processCommentNode = (n1, n2, container, anchor) => {
  6858. if (n1 == null) {
  6859. hostInsert(
  6860. n2.el = hostCreateComment(n2.children || ""),
  6861. container,
  6862. anchor
  6863. );
  6864. } else {
  6865. n2.el = n1.el;
  6866. }
  6867. };
  6868. const mountStaticNode = (n2, container, anchor, namespace) => {
  6869. [n2.el, n2.anchor] = hostInsertStaticContent(
  6870. n2.children,
  6871. container,
  6872. anchor,
  6873. namespace,
  6874. n2.el,
  6875. n2.anchor
  6876. );
  6877. };
  6878. const patchStaticNode = (n1, n2, container, namespace) => {
  6879. if (n2.children !== n1.children) {
  6880. const anchor = hostNextSibling(n1.anchor);
  6881. removeStaticNode(n1);
  6882. [n2.el, n2.anchor] = hostInsertStaticContent(
  6883. n2.children,
  6884. container,
  6885. anchor,
  6886. namespace
  6887. );
  6888. } else {
  6889. n2.el = n1.el;
  6890. n2.anchor = n1.anchor;
  6891. }
  6892. };
  6893. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  6894. let next;
  6895. while (el && el !== anchor) {
  6896. next = hostNextSibling(el);
  6897. hostInsert(el, container, nextSibling);
  6898. el = next;
  6899. }
  6900. hostInsert(anchor, container, nextSibling);
  6901. };
  6902. const removeStaticNode = ({ el, anchor }) => {
  6903. let next;
  6904. while (el && el !== anchor) {
  6905. next = hostNextSibling(el);
  6906. hostRemove(el);
  6907. el = next;
  6908. }
  6909. hostRemove(anchor);
  6910. };
  6911. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6912. if (n2.type === "svg") {
  6913. namespace = "svg";
  6914. } else if (n2.type === "math") {
  6915. namespace = "mathml";
  6916. }
  6917. if (n1 == null) {
  6918. mountElement(
  6919. n2,
  6920. container,
  6921. anchor,
  6922. parentComponent,
  6923. parentSuspense,
  6924. namespace,
  6925. slotScopeIds,
  6926. optimized
  6927. );
  6928. } else {
  6929. patchElement(
  6930. n1,
  6931. n2,
  6932. parentComponent,
  6933. parentSuspense,
  6934. namespace,
  6935. slotScopeIds,
  6936. optimized
  6937. );
  6938. }
  6939. };
  6940. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6941. let el;
  6942. let vnodeHook;
  6943. const { props, shapeFlag, transition, dirs } = vnode;
  6944. el = vnode.el = hostCreateElement(
  6945. vnode.type,
  6946. namespace,
  6947. props && props.is,
  6948. props
  6949. );
  6950. if (shapeFlag & 8) {
  6951. hostSetElementText(el, vnode.children);
  6952. } else if (shapeFlag & 16) {
  6953. mountChildren(
  6954. vnode.children,
  6955. el,
  6956. null,
  6957. parentComponent,
  6958. parentSuspense,
  6959. resolveChildrenNamespace(vnode, namespace),
  6960. slotScopeIds,
  6961. optimized
  6962. );
  6963. }
  6964. if (dirs) {
  6965. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6966. }
  6967. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6968. if (props) {
  6969. for (const key in props) {
  6970. if (key !== "value" && !isReservedProp(key)) {
  6971. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  6972. }
  6973. }
  6974. if ("value" in props) {
  6975. hostPatchProp(el, "value", null, props.value, namespace);
  6976. }
  6977. if (vnodeHook = props.onVnodeBeforeMount) {
  6978. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6979. }
  6980. }
  6981. {
  6982. def(el, "__vnode", vnode, true);
  6983. def(el, "__vueParentComponent", parentComponent, true);
  6984. }
  6985. if (dirs) {
  6986. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6987. }
  6988. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  6989. if (needCallTransitionHooks) {
  6990. transition.beforeEnter(el);
  6991. }
  6992. hostInsert(el, container, anchor);
  6993. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6994. queuePostRenderEffect(() => {
  6995. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6996. needCallTransitionHooks && transition.enter(el);
  6997. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6998. }, parentSuspense);
  6999. }
  7000. };
  7001. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  7002. if (scopeId) {
  7003. hostSetScopeId(el, scopeId);
  7004. }
  7005. if (slotScopeIds) {
  7006. for (let i = 0; i < slotScopeIds.length; i++) {
  7007. hostSetScopeId(el, slotScopeIds[i]);
  7008. }
  7009. }
  7010. if (parentComponent) {
  7011. let subTree = parentComponent.subTree;
  7012. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  7013. subTree = filterSingleRoot(subTree.children) || subTree;
  7014. }
  7015. if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
  7016. const parentVNode = parentComponent.vnode;
  7017. setScopeId(
  7018. el,
  7019. parentVNode,
  7020. parentVNode.scopeId,
  7021. parentVNode.slotScopeIds,
  7022. parentComponent.parent
  7023. );
  7024. }
  7025. }
  7026. };
  7027. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  7028. for (let i = start; i < children.length; i++) {
  7029. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  7030. patch(
  7031. null,
  7032. child,
  7033. container,
  7034. anchor,
  7035. parentComponent,
  7036. parentSuspense,
  7037. namespace,
  7038. slotScopeIds,
  7039. optimized
  7040. );
  7041. }
  7042. };
  7043. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7044. const el = n2.el = n1.el;
  7045. {
  7046. el.__vnode = n2;
  7047. }
  7048. let { patchFlag, dynamicChildren, dirs } = n2;
  7049. patchFlag |= n1.patchFlag & 16;
  7050. const oldProps = n1.props || EMPTY_OBJ;
  7051. const newProps = n2.props || EMPTY_OBJ;
  7052. let vnodeHook;
  7053. parentComponent && toggleRecurse(parentComponent, false);
  7054. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  7055. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7056. }
  7057. if (dirs) {
  7058. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  7059. }
  7060. parentComponent && toggleRecurse(parentComponent, true);
  7061. if (isHmrUpdating) {
  7062. patchFlag = 0;
  7063. optimized = false;
  7064. dynamicChildren = null;
  7065. }
  7066. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  7067. hostSetElementText(el, "");
  7068. }
  7069. if (dynamicChildren) {
  7070. patchBlockChildren(
  7071. n1.dynamicChildren,
  7072. dynamicChildren,
  7073. el,
  7074. parentComponent,
  7075. parentSuspense,
  7076. resolveChildrenNamespace(n2, namespace),
  7077. slotScopeIds
  7078. );
  7079. {
  7080. traverseStaticChildren(n1, n2);
  7081. }
  7082. } else if (!optimized) {
  7083. patchChildren(
  7084. n1,
  7085. n2,
  7086. el,
  7087. null,
  7088. parentComponent,
  7089. parentSuspense,
  7090. resolveChildrenNamespace(n2, namespace),
  7091. slotScopeIds,
  7092. false
  7093. );
  7094. }
  7095. if (patchFlag > 0) {
  7096. if (patchFlag & 16) {
  7097. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7098. } else {
  7099. if (patchFlag & 2) {
  7100. if (oldProps.class !== newProps.class) {
  7101. hostPatchProp(el, "class", null, newProps.class, namespace);
  7102. }
  7103. }
  7104. if (patchFlag & 4) {
  7105. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  7106. }
  7107. if (patchFlag & 8) {
  7108. const propsToUpdate = n2.dynamicProps;
  7109. for (let i = 0; i < propsToUpdate.length; i++) {
  7110. const key = propsToUpdate[i];
  7111. const prev = oldProps[key];
  7112. const next = newProps[key];
  7113. if (next !== prev || key === "value") {
  7114. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7115. }
  7116. }
  7117. }
  7118. }
  7119. if (patchFlag & 1) {
  7120. if (n1.children !== n2.children) {
  7121. hostSetElementText(el, n2.children);
  7122. }
  7123. }
  7124. } else if (!optimized && dynamicChildren == null) {
  7125. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7126. }
  7127. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  7128. queuePostRenderEffect(() => {
  7129. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7130. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  7131. }, parentSuspense);
  7132. }
  7133. };
  7134. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  7135. for (let i = 0; i < newChildren.length; i++) {
  7136. const oldVNode = oldChildren[i];
  7137. const newVNode = newChildren[i];
  7138. const container = (
  7139. // oldVNode may be an errored async setup() component inside Suspense
  7140. // which will not have a mounted element
  7141. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  7142. // of the Fragment itself so it can move its children.
  7143. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  7144. // which also requires the correct parent container
  7145. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  7146. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  7147. // In other cases, the parent container is not actually used so we
  7148. // just pass the block element here to avoid a DOM parentNode call.
  7149. fallbackContainer
  7150. )
  7151. );
  7152. patch(
  7153. oldVNode,
  7154. newVNode,
  7155. container,
  7156. null,
  7157. parentComponent,
  7158. parentSuspense,
  7159. namespace,
  7160. slotScopeIds,
  7161. true
  7162. );
  7163. }
  7164. };
  7165. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  7166. if (oldProps !== newProps) {
  7167. if (oldProps !== EMPTY_OBJ) {
  7168. for (const key in oldProps) {
  7169. if (!isReservedProp(key) && !(key in newProps)) {
  7170. hostPatchProp(
  7171. el,
  7172. key,
  7173. oldProps[key],
  7174. null,
  7175. namespace,
  7176. parentComponent
  7177. );
  7178. }
  7179. }
  7180. }
  7181. for (const key in newProps) {
  7182. if (isReservedProp(key)) continue;
  7183. const next = newProps[key];
  7184. const prev = oldProps[key];
  7185. if (next !== prev && key !== "value") {
  7186. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7187. }
  7188. }
  7189. if ("value" in newProps) {
  7190. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  7191. }
  7192. }
  7193. };
  7194. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7195. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  7196. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  7197. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  7198. if (
  7199. // #5523 dev root fragment may inherit directives
  7200. isHmrUpdating || patchFlag & 2048
  7201. ) {
  7202. patchFlag = 0;
  7203. optimized = false;
  7204. dynamicChildren = null;
  7205. }
  7206. if (fragmentSlotScopeIds) {
  7207. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  7208. }
  7209. if (n1 == null) {
  7210. hostInsert(fragmentStartAnchor, container, anchor);
  7211. hostInsert(fragmentEndAnchor, container, anchor);
  7212. mountChildren(
  7213. // #10007
  7214. // such fragment like `<></>` will be compiled into
  7215. // a fragment which doesn't have a children.
  7216. // In this case fallback to an empty array
  7217. n2.children || [],
  7218. container,
  7219. fragmentEndAnchor,
  7220. parentComponent,
  7221. parentSuspense,
  7222. namespace,
  7223. slotScopeIds,
  7224. optimized
  7225. );
  7226. } else {
  7227. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  7228. // of renderSlot() with no valid children
  7229. n1.dynamicChildren) {
  7230. patchBlockChildren(
  7231. n1.dynamicChildren,
  7232. dynamicChildren,
  7233. container,
  7234. parentComponent,
  7235. parentSuspense,
  7236. namespace,
  7237. slotScopeIds
  7238. );
  7239. {
  7240. traverseStaticChildren(n1, n2);
  7241. }
  7242. } else {
  7243. patchChildren(
  7244. n1,
  7245. n2,
  7246. container,
  7247. fragmentEndAnchor,
  7248. parentComponent,
  7249. parentSuspense,
  7250. namespace,
  7251. slotScopeIds,
  7252. optimized
  7253. );
  7254. }
  7255. }
  7256. };
  7257. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7258. n2.slotScopeIds = slotScopeIds;
  7259. if (n1 == null) {
  7260. if (n2.shapeFlag & 512) {
  7261. parentComponent.ctx.activate(
  7262. n2,
  7263. container,
  7264. anchor,
  7265. namespace,
  7266. optimized
  7267. );
  7268. } else {
  7269. mountComponent(
  7270. n2,
  7271. container,
  7272. anchor,
  7273. parentComponent,
  7274. parentSuspense,
  7275. namespace,
  7276. optimized
  7277. );
  7278. }
  7279. } else {
  7280. updateComponent(n1, n2, optimized);
  7281. }
  7282. };
  7283. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  7284. const instance = (initialVNode.component = createComponentInstance(
  7285. initialVNode,
  7286. parentComponent,
  7287. parentSuspense
  7288. ));
  7289. if (instance.type.__hmrId) {
  7290. registerHMR(instance);
  7291. }
  7292. {
  7293. pushWarningContext(initialVNode);
  7294. startMeasure(instance, `mount`);
  7295. }
  7296. if (isKeepAlive(initialVNode)) {
  7297. instance.ctx.renderer = internals;
  7298. }
  7299. {
  7300. {
  7301. startMeasure(instance, `init`);
  7302. }
  7303. setupComponent(instance, false, optimized);
  7304. {
  7305. endMeasure(instance, `init`);
  7306. }
  7307. }
  7308. if (instance.asyncDep) {
  7309. if (isHmrUpdating) initialVNode.el = null;
  7310. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  7311. if (!initialVNode.el) {
  7312. const placeholder = instance.subTree = createVNode(Comment);
  7313. processCommentNode(null, placeholder, container, anchor);
  7314. }
  7315. } else {
  7316. setupRenderEffect(
  7317. instance,
  7318. initialVNode,
  7319. container,
  7320. anchor,
  7321. parentSuspense,
  7322. namespace,
  7323. optimized
  7324. );
  7325. }
  7326. {
  7327. popWarningContext();
  7328. endMeasure(instance, `mount`);
  7329. }
  7330. };
  7331. const updateComponent = (n1, n2, optimized) => {
  7332. const instance = n2.component = n1.component;
  7333. if (shouldUpdateComponent(n1, n2, optimized)) {
  7334. if (instance.asyncDep && !instance.asyncResolved) {
  7335. {
  7336. pushWarningContext(n2);
  7337. }
  7338. updateComponentPreRender(instance, n2, optimized);
  7339. {
  7340. popWarningContext();
  7341. }
  7342. return;
  7343. } else {
  7344. instance.next = n2;
  7345. instance.update();
  7346. }
  7347. } else {
  7348. n2.el = n1.el;
  7349. instance.vnode = n2;
  7350. }
  7351. };
  7352. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  7353. const componentUpdateFn = () => {
  7354. if (!instance.isMounted) {
  7355. let vnodeHook;
  7356. const { el, props } = initialVNode;
  7357. const { bm, m, parent, root, type } = instance;
  7358. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  7359. toggleRecurse(instance, false);
  7360. if (bm) {
  7361. invokeArrayFns(bm);
  7362. }
  7363. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  7364. invokeVNodeHook(vnodeHook, parent, initialVNode);
  7365. }
  7366. toggleRecurse(instance, true);
  7367. if (el && hydrateNode) {
  7368. const hydrateSubTree = () => {
  7369. {
  7370. startMeasure(instance, `render`);
  7371. }
  7372. instance.subTree = renderComponentRoot(instance);
  7373. {
  7374. endMeasure(instance, `render`);
  7375. }
  7376. {
  7377. startMeasure(instance, `hydrate`);
  7378. }
  7379. hydrateNode(
  7380. el,
  7381. instance.subTree,
  7382. instance,
  7383. parentSuspense,
  7384. null
  7385. );
  7386. {
  7387. endMeasure(instance, `hydrate`);
  7388. }
  7389. };
  7390. if (isAsyncWrapperVNode && type.__asyncHydrate) {
  7391. type.__asyncHydrate(
  7392. el,
  7393. instance,
  7394. hydrateSubTree
  7395. );
  7396. } else {
  7397. hydrateSubTree();
  7398. }
  7399. } else {
  7400. if (root.ce) {
  7401. root.ce._injectChildStyle(type);
  7402. }
  7403. {
  7404. startMeasure(instance, `render`);
  7405. }
  7406. const subTree = instance.subTree = renderComponentRoot(instance);
  7407. {
  7408. endMeasure(instance, `render`);
  7409. }
  7410. {
  7411. startMeasure(instance, `patch`);
  7412. }
  7413. patch(
  7414. null,
  7415. subTree,
  7416. container,
  7417. anchor,
  7418. instance,
  7419. parentSuspense,
  7420. namespace
  7421. );
  7422. {
  7423. endMeasure(instance, `patch`);
  7424. }
  7425. initialVNode.el = subTree.el;
  7426. }
  7427. if (m) {
  7428. queuePostRenderEffect(m, parentSuspense);
  7429. }
  7430. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  7431. const scopedInitialVNode = initialVNode;
  7432. queuePostRenderEffect(
  7433. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  7434. parentSuspense
  7435. );
  7436. }
  7437. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  7438. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  7439. }
  7440. instance.isMounted = true;
  7441. {
  7442. devtoolsComponentAdded(instance);
  7443. }
  7444. initialVNode = container = anchor = null;
  7445. } else {
  7446. let { next, bu, u, parent, vnode } = instance;
  7447. {
  7448. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  7449. if (nonHydratedAsyncRoot) {
  7450. if (next) {
  7451. next.el = vnode.el;
  7452. updateComponentPreRender(instance, next, optimized);
  7453. }
  7454. nonHydratedAsyncRoot.asyncDep.then(() => {
  7455. if (!instance.isUnmounted) {
  7456. componentUpdateFn();
  7457. }
  7458. });
  7459. return;
  7460. }
  7461. }
  7462. let originNext = next;
  7463. let vnodeHook;
  7464. {
  7465. pushWarningContext(next || instance.vnode);
  7466. }
  7467. toggleRecurse(instance, false);
  7468. if (next) {
  7469. next.el = vnode.el;
  7470. updateComponentPreRender(instance, next, optimized);
  7471. } else {
  7472. next = vnode;
  7473. }
  7474. if (bu) {
  7475. invokeArrayFns(bu);
  7476. }
  7477. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  7478. invokeVNodeHook(vnodeHook, parent, next, vnode);
  7479. }
  7480. toggleRecurse(instance, true);
  7481. {
  7482. startMeasure(instance, `render`);
  7483. }
  7484. const nextTree = renderComponentRoot(instance);
  7485. {
  7486. endMeasure(instance, `render`);
  7487. }
  7488. const prevTree = instance.subTree;
  7489. instance.subTree = nextTree;
  7490. {
  7491. startMeasure(instance, `patch`);
  7492. }
  7493. patch(
  7494. prevTree,
  7495. nextTree,
  7496. // parent may have changed if it's in a teleport
  7497. hostParentNode(prevTree.el),
  7498. // anchor may have changed if it's in a fragment
  7499. getNextHostNode(prevTree),
  7500. instance,
  7501. parentSuspense,
  7502. namespace
  7503. );
  7504. {
  7505. endMeasure(instance, `patch`);
  7506. }
  7507. next.el = nextTree.el;
  7508. if (originNext === null) {
  7509. updateHOCHostEl(instance, nextTree.el);
  7510. }
  7511. if (u) {
  7512. queuePostRenderEffect(u, parentSuspense);
  7513. }
  7514. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  7515. queuePostRenderEffect(
  7516. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  7517. parentSuspense
  7518. );
  7519. }
  7520. {
  7521. devtoolsComponentUpdated(instance);
  7522. }
  7523. {
  7524. popWarningContext();
  7525. }
  7526. }
  7527. };
  7528. instance.scope.on();
  7529. const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
  7530. instance.scope.off();
  7531. const update = instance.update = effect.run.bind(effect);
  7532. const job = instance.job = effect.runIfDirty.bind(effect);
  7533. job.i = instance;
  7534. job.id = instance.uid;
  7535. effect.scheduler = () => queueJob(job);
  7536. toggleRecurse(instance, true);
  7537. {
  7538. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  7539. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  7540. }
  7541. update();
  7542. };
  7543. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  7544. nextVNode.component = instance;
  7545. const prevProps = instance.vnode.props;
  7546. instance.vnode = nextVNode;
  7547. instance.next = null;
  7548. updateProps(instance, nextVNode.props, prevProps, optimized);
  7549. updateSlots(instance, nextVNode.children, optimized);
  7550. pauseTracking();
  7551. flushPreFlushCbs(instance);
  7552. resetTracking();
  7553. };
  7554. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  7555. const c1 = n1 && n1.children;
  7556. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  7557. const c2 = n2.children;
  7558. const { patchFlag, shapeFlag } = n2;
  7559. if (patchFlag > 0) {
  7560. if (patchFlag & 128) {
  7561. patchKeyedChildren(
  7562. c1,
  7563. c2,
  7564. container,
  7565. anchor,
  7566. parentComponent,
  7567. parentSuspense,
  7568. namespace,
  7569. slotScopeIds,
  7570. optimized
  7571. );
  7572. return;
  7573. } else if (patchFlag & 256) {
  7574. patchUnkeyedChildren(
  7575. c1,
  7576. c2,
  7577. container,
  7578. anchor,
  7579. parentComponent,
  7580. parentSuspense,
  7581. namespace,
  7582. slotScopeIds,
  7583. optimized
  7584. );
  7585. return;
  7586. }
  7587. }
  7588. if (shapeFlag & 8) {
  7589. if (prevShapeFlag & 16) {
  7590. unmountChildren(c1, parentComponent, parentSuspense);
  7591. }
  7592. if (c2 !== c1) {
  7593. hostSetElementText(container, c2);
  7594. }
  7595. } else {
  7596. if (prevShapeFlag & 16) {
  7597. if (shapeFlag & 16) {
  7598. patchKeyedChildren(
  7599. c1,
  7600. c2,
  7601. container,
  7602. anchor,
  7603. parentComponent,
  7604. parentSuspense,
  7605. namespace,
  7606. slotScopeIds,
  7607. optimized
  7608. );
  7609. } else {
  7610. unmountChildren(c1, parentComponent, parentSuspense, true);
  7611. }
  7612. } else {
  7613. if (prevShapeFlag & 8) {
  7614. hostSetElementText(container, "");
  7615. }
  7616. if (shapeFlag & 16) {
  7617. mountChildren(
  7618. c2,
  7619. container,
  7620. anchor,
  7621. parentComponent,
  7622. parentSuspense,
  7623. namespace,
  7624. slotScopeIds,
  7625. optimized
  7626. );
  7627. }
  7628. }
  7629. }
  7630. };
  7631. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7632. c1 = c1 || EMPTY_ARR;
  7633. c2 = c2 || EMPTY_ARR;
  7634. const oldLength = c1.length;
  7635. const newLength = c2.length;
  7636. const commonLength = Math.min(oldLength, newLength);
  7637. let i;
  7638. for (i = 0; i < commonLength; i++) {
  7639. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7640. patch(
  7641. c1[i],
  7642. nextChild,
  7643. container,
  7644. null,
  7645. parentComponent,
  7646. parentSuspense,
  7647. namespace,
  7648. slotScopeIds,
  7649. optimized
  7650. );
  7651. }
  7652. if (oldLength > newLength) {
  7653. unmountChildren(
  7654. c1,
  7655. parentComponent,
  7656. parentSuspense,
  7657. true,
  7658. false,
  7659. commonLength
  7660. );
  7661. } else {
  7662. mountChildren(
  7663. c2,
  7664. container,
  7665. anchor,
  7666. parentComponent,
  7667. parentSuspense,
  7668. namespace,
  7669. slotScopeIds,
  7670. optimized,
  7671. commonLength
  7672. );
  7673. }
  7674. };
  7675. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7676. let i = 0;
  7677. const l2 = c2.length;
  7678. let e1 = c1.length - 1;
  7679. let e2 = l2 - 1;
  7680. while (i <= e1 && i <= e2) {
  7681. const n1 = c1[i];
  7682. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7683. if (isSameVNodeType(n1, n2)) {
  7684. patch(
  7685. n1,
  7686. n2,
  7687. container,
  7688. null,
  7689. parentComponent,
  7690. parentSuspense,
  7691. namespace,
  7692. slotScopeIds,
  7693. optimized
  7694. );
  7695. } else {
  7696. break;
  7697. }
  7698. i++;
  7699. }
  7700. while (i <= e1 && i <= e2) {
  7701. const n1 = c1[e1];
  7702. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7703. if (isSameVNodeType(n1, n2)) {
  7704. patch(
  7705. n1,
  7706. n2,
  7707. container,
  7708. null,
  7709. parentComponent,
  7710. parentSuspense,
  7711. namespace,
  7712. slotScopeIds,
  7713. optimized
  7714. );
  7715. } else {
  7716. break;
  7717. }
  7718. e1--;
  7719. e2--;
  7720. }
  7721. if (i > e1) {
  7722. if (i <= e2) {
  7723. const nextPos = e2 + 1;
  7724. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7725. while (i <= e2) {
  7726. patch(
  7727. null,
  7728. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  7729. container,
  7730. anchor,
  7731. parentComponent,
  7732. parentSuspense,
  7733. namespace,
  7734. slotScopeIds,
  7735. optimized
  7736. );
  7737. i++;
  7738. }
  7739. }
  7740. } else if (i > e2) {
  7741. while (i <= e1) {
  7742. unmount(c1[i], parentComponent, parentSuspense, true);
  7743. i++;
  7744. }
  7745. } else {
  7746. const s1 = i;
  7747. const s2 = i;
  7748. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  7749. for (i = s2; i <= e2; i++) {
  7750. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7751. if (nextChild.key != null) {
  7752. if (keyToNewIndexMap.has(nextChild.key)) {
  7753. warn$1(
  7754. `Duplicate keys found during update:`,
  7755. JSON.stringify(nextChild.key),
  7756. `Make sure keys are unique.`
  7757. );
  7758. }
  7759. keyToNewIndexMap.set(nextChild.key, i);
  7760. }
  7761. }
  7762. let j;
  7763. let patched = 0;
  7764. const toBePatched = e2 - s2 + 1;
  7765. let moved = false;
  7766. let maxNewIndexSoFar = 0;
  7767. const newIndexToOldIndexMap = new Array(toBePatched);
  7768. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  7769. for (i = s1; i <= e1; i++) {
  7770. const prevChild = c1[i];
  7771. if (patched >= toBePatched) {
  7772. unmount(prevChild, parentComponent, parentSuspense, true);
  7773. continue;
  7774. }
  7775. let newIndex;
  7776. if (prevChild.key != null) {
  7777. newIndex = keyToNewIndexMap.get(prevChild.key);
  7778. } else {
  7779. for (j = s2; j <= e2; j++) {
  7780. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7781. newIndex = j;
  7782. break;
  7783. }
  7784. }
  7785. }
  7786. if (newIndex === void 0) {
  7787. unmount(prevChild, parentComponent, parentSuspense, true);
  7788. } else {
  7789. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7790. if (newIndex >= maxNewIndexSoFar) {
  7791. maxNewIndexSoFar = newIndex;
  7792. } else {
  7793. moved = true;
  7794. }
  7795. patch(
  7796. prevChild,
  7797. c2[newIndex],
  7798. container,
  7799. null,
  7800. parentComponent,
  7801. parentSuspense,
  7802. namespace,
  7803. slotScopeIds,
  7804. optimized
  7805. );
  7806. patched++;
  7807. }
  7808. }
  7809. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7810. j = increasingNewIndexSequence.length - 1;
  7811. for (i = toBePatched - 1; i >= 0; i--) {
  7812. const nextIndex = s2 + i;
  7813. const nextChild = c2[nextIndex];
  7814. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  7815. if (newIndexToOldIndexMap[i] === 0) {
  7816. patch(
  7817. null,
  7818. nextChild,
  7819. container,
  7820. anchor,
  7821. parentComponent,
  7822. parentSuspense,
  7823. namespace,
  7824. slotScopeIds,
  7825. optimized
  7826. );
  7827. } else if (moved) {
  7828. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7829. move(nextChild, container, anchor, 2);
  7830. } else {
  7831. j--;
  7832. }
  7833. }
  7834. }
  7835. }
  7836. };
  7837. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  7838. const { el, type, transition, children, shapeFlag } = vnode;
  7839. if (shapeFlag & 6) {
  7840. move(vnode.component.subTree, container, anchor, moveType);
  7841. return;
  7842. }
  7843. if (shapeFlag & 128) {
  7844. vnode.suspense.move(container, anchor, moveType);
  7845. return;
  7846. }
  7847. if (shapeFlag & 64) {
  7848. type.move(vnode, container, anchor, internals);
  7849. return;
  7850. }
  7851. if (type === Fragment) {
  7852. hostInsert(el, container, anchor);
  7853. for (let i = 0; i < children.length; i++) {
  7854. move(children[i], container, anchor, moveType);
  7855. }
  7856. hostInsert(vnode.anchor, container, anchor);
  7857. return;
  7858. }
  7859. if (type === Static) {
  7860. moveStaticNode(vnode, container, anchor);
  7861. return;
  7862. }
  7863. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  7864. if (needTransition2) {
  7865. if (moveType === 0) {
  7866. transition.beforeEnter(el);
  7867. hostInsert(el, container, anchor);
  7868. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7869. } else {
  7870. const { leave, delayLeave, afterLeave } = transition;
  7871. const remove2 = () => hostInsert(el, container, anchor);
  7872. const performLeave = () => {
  7873. leave(el, () => {
  7874. remove2();
  7875. afterLeave && afterLeave();
  7876. });
  7877. };
  7878. if (delayLeave) {
  7879. delayLeave(el, remove2, performLeave);
  7880. } else {
  7881. performLeave();
  7882. }
  7883. }
  7884. } else {
  7885. hostInsert(el, container, anchor);
  7886. }
  7887. };
  7888. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  7889. const {
  7890. type,
  7891. props,
  7892. ref,
  7893. children,
  7894. dynamicChildren,
  7895. shapeFlag,
  7896. patchFlag,
  7897. dirs,
  7898. cacheIndex
  7899. } = vnode;
  7900. if (patchFlag === -2) {
  7901. optimized = false;
  7902. }
  7903. if (ref != null) {
  7904. setRef(ref, null, parentSuspense, vnode, true);
  7905. }
  7906. if (cacheIndex != null) {
  7907. parentComponent.renderCache[cacheIndex] = void 0;
  7908. }
  7909. if (shapeFlag & 256) {
  7910. parentComponent.ctx.deactivate(vnode);
  7911. return;
  7912. }
  7913. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  7914. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  7915. let vnodeHook;
  7916. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  7917. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7918. }
  7919. if (shapeFlag & 6) {
  7920. unmountComponent(vnode.component, parentSuspense, doRemove);
  7921. } else {
  7922. if (shapeFlag & 128) {
  7923. vnode.suspense.unmount(parentSuspense, doRemove);
  7924. return;
  7925. }
  7926. if (shouldInvokeDirs) {
  7927. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  7928. }
  7929. if (shapeFlag & 64) {
  7930. vnode.type.remove(
  7931. vnode,
  7932. parentComponent,
  7933. parentSuspense,
  7934. internals,
  7935. doRemove
  7936. );
  7937. } else if (dynamicChildren && // #5154
  7938. // when v-once is used inside a block, setBlockTracking(-1) marks the
  7939. // parent block with hasOnce: true
  7940. // so that it doesn't take the fast path during unmount - otherwise
  7941. // components nested in v-once are never unmounted.
  7942. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7943. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7944. unmountChildren(
  7945. dynamicChildren,
  7946. parentComponent,
  7947. parentSuspense,
  7948. false,
  7949. true
  7950. );
  7951. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7952. unmountChildren(children, parentComponent, parentSuspense);
  7953. }
  7954. if (doRemove) {
  7955. remove(vnode);
  7956. }
  7957. }
  7958. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7959. queuePostRenderEffect(() => {
  7960. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7961. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  7962. }, parentSuspense);
  7963. }
  7964. };
  7965. const remove = (vnode) => {
  7966. const { type, el, anchor, transition } = vnode;
  7967. if (type === Fragment) {
  7968. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  7969. vnode.children.forEach((child) => {
  7970. if (child.type === Comment) {
  7971. hostRemove(child.el);
  7972. } else {
  7973. remove(child);
  7974. }
  7975. });
  7976. } else {
  7977. removeFragment(el, anchor);
  7978. }
  7979. return;
  7980. }
  7981. if (type === Static) {
  7982. removeStaticNode(vnode);
  7983. return;
  7984. }
  7985. const performRemove = () => {
  7986. hostRemove(el);
  7987. if (transition && !transition.persisted && transition.afterLeave) {
  7988. transition.afterLeave();
  7989. }
  7990. };
  7991. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  7992. const { leave, delayLeave } = transition;
  7993. const performLeave = () => leave(el, performRemove);
  7994. if (delayLeave) {
  7995. delayLeave(vnode.el, performRemove, performLeave);
  7996. } else {
  7997. performLeave();
  7998. }
  7999. } else {
  8000. performRemove();
  8001. }
  8002. };
  8003. const removeFragment = (cur, end) => {
  8004. let next;
  8005. while (cur !== end) {
  8006. next = hostNextSibling(cur);
  8007. hostRemove(cur);
  8008. cur = next;
  8009. }
  8010. hostRemove(end);
  8011. };
  8012. const unmountComponent = (instance, parentSuspense, doRemove) => {
  8013. if (instance.type.__hmrId) {
  8014. unregisterHMR(instance);
  8015. }
  8016. const { bum, scope, job, subTree, um, m, a } = instance;
  8017. invalidateMount(m);
  8018. invalidateMount(a);
  8019. if (bum) {
  8020. invokeArrayFns(bum);
  8021. }
  8022. scope.stop();
  8023. if (job) {
  8024. job.flags |= 8;
  8025. unmount(subTree, instance, parentSuspense, doRemove);
  8026. }
  8027. if (um) {
  8028. queuePostRenderEffect(um, parentSuspense);
  8029. }
  8030. queuePostRenderEffect(() => {
  8031. instance.isUnmounted = true;
  8032. }, parentSuspense);
  8033. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  8034. parentSuspense.deps--;
  8035. if (parentSuspense.deps === 0) {
  8036. parentSuspense.resolve();
  8037. }
  8038. }
  8039. {
  8040. devtoolsComponentRemoved(instance);
  8041. }
  8042. };
  8043. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  8044. for (let i = start; i < children.length; i++) {
  8045. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  8046. }
  8047. };
  8048. const getNextHostNode = (vnode) => {
  8049. if (vnode.shapeFlag & 6) {
  8050. return getNextHostNode(vnode.component.subTree);
  8051. }
  8052. if (vnode.shapeFlag & 128) {
  8053. return vnode.suspense.next();
  8054. }
  8055. const el = hostNextSibling(vnode.anchor || vnode.el);
  8056. const teleportEnd = el && el[TeleportEndKey];
  8057. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  8058. };
  8059. let isFlushing = false;
  8060. const render = (vnode, container, namespace) => {
  8061. if (vnode == null) {
  8062. if (container._vnode) {
  8063. unmount(container._vnode, null, null, true);
  8064. }
  8065. } else {
  8066. patch(
  8067. container._vnode || null,
  8068. vnode,
  8069. container,
  8070. null,
  8071. null,
  8072. null,
  8073. namespace
  8074. );
  8075. }
  8076. container._vnode = vnode;
  8077. if (!isFlushing) {
  8078. isFlushing = true;
  8079. flushPreFlushCbs();
  8080. flushPostFlushCbs();
  8081. isFlushing = false;
  8082. }
  8083. };
  8084. const internals = {
  8085. p: patch,
  8086. um: unmount,
  8087. m: move,
  8088. r: remove,
  8089. mt: mountComponent,
  8090. mc: mountChildren,
  8091. pc: patchChildren,
  8092. pbc: patchBlockChildren,
  8093. n: getNextHostNode,
  8094. o: options
  8095. };
  8096. let hydrate;
  8097. let hydrateNode;
  8098. if (createHydrationFns) {
  8099. [hydrate, hydrateNode] = createHydrationFns(
  8100. internals
  8101. );
  8102. }
  8103. return {
  8104. render,
  8105. hydrate,
  8106. createApp: createAppAPI(render, hydrate)
  8107. };
  8108. }
  8109. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  8110. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  8111. }
  8112. function toggleRecurse({ effect, job }, allowed) {
  8113. if (allowed) {
  8114. effect.flags |= 32;
  8115. job.flags |= 4;
  8116. } else {
  8117. effect.flags &= ~32;
  8118. job.flags &= ~4;
  8119. }
  8120. }
  8121. function needTransition(parentSuspense, transition) {
  8122. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  8123. }
  8124. function traverseStaticChildren(n1, n2, shallow = false) {
  8125. const ch1 = n1.children;
  8126. const ch2 = n2.children;
  8127. if (isArray(ch1) && isArray(ch2)) {
  8128. for (let i = 0; i < ch1.length; i++) {
  8129. const c1 = ch1[i];
  8130. let c2 = ch2[i];
  8131. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  8132. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  8133. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  8134. c2.el = c1.el;
  8135. }
  8136. if (!shallow && c2.patchFlag !== -2)
  8137. traverseStaticChildren(c1, c2);
  8138. }
  8139. if (c2.type === Text) {
  8140. c2.el = c1.el;
  8141. }
  8142. if (c2.type === Comment && !c2.el) {
  8143. c2.el = c1.el;
  8144. }
  8145. }
  8146. }
  8147. }
  8148. function getSequence(arr) {
  8149. const p = arr.slice();
  8150. const result = [0];
  8151. let i, j, u, v, c;
  8152. const len = arr.length;
  8153. for (i = 0; i < len; i++) {
  8154. const arrI = arr[i];
  8155. if (arrI !== 0) {
  8156. j = result[result.length - 1];
  8157. if (arr[j] < arrI) {
  8158. p[i] = j;
  8159. result.push(i);
  8160. continue;
  8161. }
  8162. u = 0;
  8163. v = result.length - 1;
  8164. while (u < v) {
  8165. c = u + v >> 1;
  8166. if (arr[result[c]] < arrI) {
  8167. u = c + 1;
  8168. } else {
  8169. v = c;
  8170. }
  8171. }
  8172. if (arrI < arr[result[u]]) {
  8173. if (u > 0) {
  8174. p[i] = result[u - 1];
  8175. }
  8176. result[u] = i;
  8177. }
  8178. }
  8179. }
  8180. u = result.length;
  8181. v = result[u - 1];
  8182. while (u-- > 0) {
  8183. result[u] = v;
  8184. v = p[v];
  8185. }
  8186. return result;
  8187. }
  8188. function locateNonHydratedAsyncRoot(instance) {
  8189. const subComponent = instance.subTree.component;
  8190. if (subComponent) {
  8191. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  8192. return subComponent;
  8193. } else {
  8194. return locateNonHydratedAsyncRoot(subComponent);
  8195. }
  8196. }
  8197. }
  8198. function invalidateMount(hooks) {
  8199. if (hooks) {
  8200. for (let i = 0; i < hooks.length; i++)
  8201. hooks[i].flags |= 8;
  8202. }
  8203. }
  8204. const ssrContextKey = Symbol.for("v-scx");
  8205. const useSSRContext = () => {
  8206. {
  8207. warn$1(`useSSRContext() is not supported in the global build.`);
  8208. }
  8209. };
  8210. function watchEffect(effect, options) {
  8211. return doWatch(effect, null, options);
  8212. }
  8213. function watchPostEffect(effect, options) {
  8214. return doWatch(
  8215. effect,
  8216. null,
  8217. extend({}, options, { flush: "post" })
  8218. );
  8219. }
  8220. function watchSyncEffect(effect, options) {
  8221. return doWatch(
  8222. effect,
  8223. null,
  8224. extend({}, options, { flush: "sync" })
  8225. );
  8226. }
  8227. function watch(source, cb, options) {
  8228. if (!isFunction(cb)) {
  8229. warn$1(
  8230. `\`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.`
  8231. );
  8232. }
  8233. return doWatch(source, cb, options);
  8234. }
  8235. function doWatch(source, cb, options = EMPTY_OBJ) {
  8236. const { immediate, deep, flush, once } = options;
  8237. if (!cb) {
  8238. if (immediate !== void 0) {
  8239. warn$1(
  8240. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  8241. );
  8242. }
  8243. if (deep !== void 0) {
  8244. warn$1(
  8245. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  8246. );
  8247. }
  8248. if (once !== void 0) {
  8249. warn$1(
  8250. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  8251. );
  8252. }
  8253. }
  8254. const baseWatchOptions = extend({}, options);
  8255. baseWatchOptions.onWarn = warn$1;
  8256. const instance = currentInstance;
  8257. baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
  8258. let isPre = false;
  8259. if (flush === "post") {
  8260. baseWatchOptions.scheduler = (job) => {
  8261. queuePostRenderEffect(job, instance && instance.suspense);
  8262. };
  8263. } else if (flush !== "sync") {
  8264. isPre = true;
  8265. baseWatchOptions.scheduler = (job, isFirstRun) => {
  8266. if (isFirstRun) {
  8267. job();
  8268. } else {
  8269. queueJob(job);
  8270. }
  8271. };
  8272. }
  8273. baseWatchOptions.augmentJob = (job) => {
  8274. if (cb) {
  8275. job.flags |= 4;
  8276. }
  8277. if (isPre) {
  8278. job.flags |= 2;
  8279. if (instance) {
  8280. job.id = instance.uid;
  8281. job.i = instance;
  8282. }
  8283. }
  8284. };
  8285. const watchHandle = watch$1(source, cb, baseWatchOptions);
  8286. return watchHandle;
  8287. }
  8288. function instanceWatch(source, value, options) {
  8289. const publicThis = this.proxy;
  8290. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  8291. let cb;
  8292. if (isFunction(value)) {
  8293. cb = value;
  8294. } else {
  8295. cb = value.handler;
  8296. options = value;
  8297. }
  8298. const reset = setCurrentInstance(this);
  8299. const res = doWatch(getter, cb.bind(publicThis), options);
  8300. reset();
  8301. return res;
  8302. }
  8303. function createPathGetter(ctx, path) {
  8304. const segments = path.split(".");
  8305. return () => {
  8306. let cur = ctx;
  8307. for (let i = 0; i < segments.length && cur; i++) {
  8308. cur = cur[segments[i]];
  8309. }
  8310. return cur;
  8311. };
  8312. }
  8313. function useModel(props, name, options = EMPTY_OBJ) {
  8314. const i = getCurrentInstance();
  8315. if (!i) {
  8316. warn$1(`useModel() called without active instance.`);
  8317. return ref();
  8318. }
  8319. const camelizedName = camelize(name);
  8320. if (!i.propsOptions[0][camelizedName]) {
  8321. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  8322. return ref();
  8323. }
  8324. const hyphenatedName = hyphenate(name);
  8325. const modifiers = getModelModifiers(props, camelizedName);
  8326. const res = customRef((track, trigger) => {
  8327. let localValue;
  8328. let prevSetValue = EMPTY_OBJ;
  8329. let prevEmittedValue;
  8330. watchSyncEffect(() => {
  8331. const propValue = props[camelizedName];
  8332. if (hasChanged(localValue, propValue)) {
  8333. localValue = propValue;
  8334. trigger();
  8335. }
  8336. });
  8337. return {
  8338. get() {
  8339. track();
  8340. return options.get ? options.get(localValue) : localValue;
  8341. },
  8342. set(value) {
  8343. const emittedValue = options.set ? options.set(value) : value;
  8344. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  8345. return;
  8346. }
  8347. const rawProps = i.vnode.props;
  8348. if (!(rawProps && // check if parent has passed v-model
  8349. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
  8350. localValue = value;
  8351. trigger();
  8352. }
  8353. i.emit(`update:${name}`, emittedValue);
  8354. if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
  8355. trigger();
  8356. }
  8357. prevSetValue = value;
  8358. prevEmittedValue = emittedValue;
  8359. }
  8360. };
  8361. });
  8362. res[Symbol.iterator] = () => {
  8363. let i2 = 0;
  8364. return {
  8365. next() {
  8366. if (i2 < 2) {
  8367. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  8368. } else {
  8369. return { done: true };
  8370. }
  8371. }
  8372. };
  8373. };
  8374. return res;
  8375. }
  8376. const getModelModifiers = (props, modelName) => {
  8377. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  8378. };
  8379. function emit(instance, event, ...rawArgs) {
  8380. if (instance.isUnmounted) return;
  8381. const props = instance.vnode.props || EMPTY_OBJ;
  8382. {
  8383. const {
  8384. emitsOptions,
  8385. propsOptions: [propsOptions]
  8386. } = instance;
  8387. if (emitsOptions) {
  8388. if (!(event in emitsOptions) && true) {
  8389. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  8390. warn$1(
  8391. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  8392. );
  8393. }
  8394. } else {
  8395. const validator = emitsOptions[event];
  8396. if (isFunction(validator)) {
  8397. const isValid = validator(...rawArgs);
  8398. if (!isValid) {
  8399. warn$1(
  8400. `Invalid event arguments: event validation failed for event "${event}".`
  8401. );
  8402. }
  8403. }
  8404. }
  8405. }
  8406. }
  8407. let args = rawArgs;
  8408. const isModelListener = event.startsWith("update:");
  8409. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  8410. if (modifiers) {
  8411. if (modifiers.trim) {
  8412. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  8413. }
  8414. if (modifiers.number) {
  8415. args = rawArgs.map(looseToNumber);
  8416. }
  8417. }
  8418. {
  8419. devtoolsComponentEmit(instance, event, args);
  8420. }
  8421. {
  8422. const lowerCaseEvent = event.toLowerCase();
  8423. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  8424. warn$1(
  8425. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  8426. instance,
  8427. instance.type
  8428. )} 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 "${hyphenate(
  8429. event
  8430. )}" instead of "${event}".`
  8431. );
  8432. }
  8433. }
  8434. let handlerName;
  8435. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  8436. props[handlerName = toHandlerKey(camelize(event))];
  8437. if (!handler && isModelListener) {
  8438. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  8439. }
  8440. if (handler) {
  8441. callWithAsyncErrorHandling(
  8442. handler,
  8443. instance,
  8444. 6,
  8445. args
  8446. );
  8447. }
  8448. const onceHandler = props[handlerName + `Once`];
  8449. if (onceHandler) {
  8450. if (!instance.emitted) {
  8451. instance.emitted = {};
  8452. } else if (instance.emitted[handlerName]) {
  8453. return;
  8454. }
  8455. instance.emitted[handlerName] = true;
  8456. callWithAsyncErrorHandling(
  8457. onceHandler,
  8458. instance,
  8459. 6,
  8460. args
  8461. );
  8462. }
  8463. }
  8464. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  8465. const cache = appContext.emitsCache;
  8466. const cached = cache.get(comp);
  8467. if (cached !== void 0) {
  8468. return cached;
  8469. }
  8470. const raw = comp.emits;
  8471. let normalized = {};
  8472. let hasExtends = false;
  8473. if (!isFunction(comp)) {
  8474. const extendEmits = (raw2) => {
  8475. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  8476. if (normalizedFromExtend) {
  8477. hasExtends = true;
  8478. extend(normalized, normalizedFromExtend);
  8479. }
  8480. };
  8481. if (!asMixin && appContext.mixins.length) {
  8482. appContext.mixins.forEach(extendEmits);
  8483. }
  8484. if (comp.extends) {
  8485. extendEmits(comp.extends);
  8486. }
  8487. if (comp.mixins) {
  8488. comp.mixins.forEach(extendEmits);
  8489. }
  8490. }
  8491. if (!raw && !hasExtends) {
  8492. if (isObject(comp)) {
  8493. cache.set(comp, null);
  8494. }
  8495. return null;
  8496. }
  8497. if (isArray(raw)) {
  8498. raw.forEach((key) => normalized[key] = null);
  8499. } else {
  8500. extend(normalized, raw);
  8501. }
  8502. if (isObject(comp)) {
  8503. cache.set(comp, normalized);
  8504. }
  8505. return normalized;
  8506. }
  8507. function isEmitListener(options, key) {
  8508. if (!options || !isOn(key)) {
  8509. return false;
  8510. }
  8511. key = key.slice(2).replace(/Once$/, "");
  8512. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  8513. }
  8514. let accessedAttrs = false;
  8515. function markAttrsAccessed() {
  8516. accessedAttrs = true;
  8517. }
  8518. function renderComponentRoot(instance) {
  8519. const {
  8520. type: Component,
  8521. vnode,
  8522. proxy,
  8523. withProxy,
  8524. propsOptions: [propsOptions],
  8525. slots,
  8526. attrs,
  8527. emit,
  8528. render,
  8529. renderCache,
  8530. props,
  8531. data,
  8532. setupState,
  8533. ctx,
  8534. inheritAttrs
  8535. } = instance;
  8536. const prev = setCurrentRenderingInstance(instance);
  8537. let result;
  8538. let fallthroughAttrs;
  8539. {
  8540. accessedAttrs = false;
  8541. }
  8542. try {
  8543. if (vnode.shapeFlag & 4) {
  8544. const proxyToUse = withProxy || proxy;
  8545. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  8546. get(target, key, receiver) {
  8547. warn$1(
  8548. `Property '${String(
  8549. key
  8550. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  8551. );
  8552. return Reflect.get(target, key, receiver);
  8553. }
  8554. }) : proxyToUse;
  8555. result = normalizeVNode(
  8556. render.call(
  8557. thisProxy,
  8558. proxyToUse,
  8559. renderCache,
  8560. true ? shallowReadonly(props) : props,
  8561. setupState,
  8562. data,
  8563. ctx
  8564. )
  8565. );
  8566. fallthroughAttrs = attrs;
  8567. } else {
  8568. const render2 = Component;
  8569. if (attrs === props) {
  8570. markAttrsAccessed();
  8571. }
  8572. result = normalizeVNode(
  8573. render2.length > 1 ? render2(
  8574. true ? shallowReadonly(props) : props,
  8575. true ? {
  8576. get attrs() {
  8577. markAttrsAccessed();
  8578. return shallowReadonly(attrs);
  8579. },
  8580. slots,
  8581. emit
  8582. } : { attrs, slots, emit }
  8583. ) : render2(
  8584. true ? shallowReadonly(props) : props,
  8585. null
  8586. )
  8587. );
  8588. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  8589. }
  8590. } catch (err) {
  8591. blockStack.length = 0;
  8592. handleError(err, instance, 1);
  8593. result = createVNode(Comment);
  8594. }
  8595. let root = result;
  8596. let setRoot = void 0;
  8597. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  8598. [root, setRoot] = getChildRoot(result);
  8599. }
  8600. if (fallthroughAttrs && inheritAttrs !== false) {
  8601. const keys = Object.keys(fallthroughAttrs);
  8602. const { shapeFlag } = root;
  8603. if (keys.length) {
  8604. if (shapeFlag & (1 | 6)) {
  8605. if (propsOptions && keys.some(isModelListener)) {
  8606. fallthroughAttrs = filterModelListeners(
  8607. fallthroughAttrs,
  8608. propsOptions
  8609. );
  8610. }
  8611. root = cloneVNode(root, fallthroughAttrs, false, true);
  8612. } else if (!accessedAttrs && root.type !== Comment) {
  8613. const allAttrs = Object.keys(attrs);
  8614. const eventAttrs = [];
  8615. const extraAttrs = [];
  8616. for (let i = 0, l = allAttrs.length; i < l; i++) {
  8617. const key = allAttrs[i];
  8618. if (isOn(key)) {
  8619. if (!isModelListener(key)) {
  8620. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  8621. }
  8622. } else {
  8623. extraAttrs.push(key);
  8624. }
  8625. }
  8626. if (extraAttrs.length) {
  8627. warn$1(
  8628. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
  8629. );
  8630. }
  8631. if (eventAttrs.length) {
  8632. warn$1(
  8633. `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.`
  8634. );
  8635. }
  8636. }
  8637. }
  8638. }
  8639. if (vnode.dirs) {
  8640. if (!isElementRoot(root)) {
  8641. warn$1(
  8642. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  8643. );
  8644. }
  8645. root = cloneVNode(root, null, false, true);
  8646. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  8647. }
  8648. if (vnode.transition) {
  8649. if (!isElementRoot(root)) {
  8650. warn$1(
  8651. `Component inside <Transition> renders non-element root node that cannot be animated.`
  8652. );
  8653. }
  8654. setTransitionHooks(root, vnode.transition);
  8655. }
  8656. if (setRoot) {
  8657. setRoot(root);
  8658. } else {
  8659. result = root;
  8660. }
  8661. setCurrentRenderingInstance(prev);
  8662. return result;
  8663. }
  8664. const getChildRoot = (vnode) => {
  8665. const rawChildren = vnode.children;
  8666. const dynamicChildren = vnode.dynamicChildren;
  8667. const childRoot = filterSingleRoot(rawChildren, false);
  8668. if (!childRoot) {
  8669. return [vnode, void 0];
  8670. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  8671. return getChildRoot(childRoot);
  8672. }
  8673. const index = rawChildren.indexOf(childRoot);
  8674. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  8675. const setRoot = (updatedRoot) => {
  8676. rawChildren[index] = updatedRoot;
  8677. if (dynamicChildren) {
  8678. if (dynamicIndex > -1) {
  8679. dynamicChildren[dynamicIndex] = updatedRoot;
  8680. } else if (updatedRoot.patchFlag > 0) {
  8681. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  8682. }
  8683. }
  8684. };
  8685. return [normalizeVNode(childRoot), setRoot];
  8686. };
  8687. function filterSingleRoot(children, recurse = true) {
  8688. let singleRoot;
  8689. for (let i = 0; i < children.length; i++) {
  8690. const child = children[i];
  8691. if (isVNode(child)) {
  8692. if (child.type !== Comment || child.children === "v-if") {
  8693. if (singleRoot) {
  8694. return;
  8695. } else {
  8696. singleRoot = child;
  8697. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  8698. return filterSingleRoot(singleRoot.children);
  8699. }
  8700. }
  8701. }
  8702. } else {
  8703. return;
  8704. }
  8705. }
  8706. return singleRoot;
  8707. }
  8708. const getFunctionalFallthrough = (attrs) => {
  8709. let res;
  8710. for (const key in attrs) {
  8711. if (key === "class" || key === "style" || isOn(key)) {
  8712. (res || (res = {}))[key] = attrs[key];
  8713. }
  8714. }
  8715. return res;
  8716. };
  8717. const filterModelListeners = (attrs, props) => {
  8718. const res = {};
  8719. for (const key in attrs) {
  8720. if (!isModelListener(key) || !(key.slice(9) in props)) {
  8721. res[key] = attrs[key];
  8722. }
  8723. }
  8724. return res;
  8725. };
  8726. const isElementRoot = (vnode) => {
  8727. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  8728. };
  8729. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  8730. const { props: prevProps, children: prevChildren, component } = prevVNode;
  8731. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  8732. const emits = component.emitsOptions;
  8733. if ((prevChildren || nextChildren) && isHmrUpdating) {
  8734. return true;
  8735. }
  8736. if (nextVNode.dirs || nextVNode.transition) {
  8737. return true;
  8738. }
  8739. if (optimized && patchFlag >= 0) {
  8740. if (patchFlag & 1024) {
  8741. return true;
  8742. }
  8743. if (patchFlag & 16) {
  8744. if (!prevProps) {
  8745. return !!nextProps;
  8746. }
  8747. return hasPropsChanged(prevProps, nextProps, emits);
  8748. } else if (patchFlag & 8) {
  8749. const dynamicProps = nextVNode.dynamicProps;
  8750. for (let i = 0; i < dynamicProps.length; i++) {
  8751. const key = dynamicProps[i];
  8752. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  8753. return true;
  8754. }
  8755. }
  8756. }
  8757. } else {
  8758. if (prevChildren || nextChildren) {
  8759. if (!nextChildren || !nextChildren.$stable) {
  8760. return true;
  8761. }
  8762. }
  8763. if (prevProps === nextProps) {
  8764. return false;
  8765. }
  8766. if (!prevProps) {
  8767. return !!nextProps;
  8768. }
  8769. if (!nextProps) {
  8770. return true;
  8771. }
  8772. return hasPropsChanged(prevProps, nextProps, emits);
  8773. }
  8774. return false;
  8775. }
  8776. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  8777. const nextKeys = Object.keys(nextProps);
  8778. if (nextKeys.length !== Object.keys(prevProps).length) {
  8779. return true;
  8780. }
  8781. for (let i = 0; i < nextKeys.length; i++) {
  8782. const key = nextKeys[i];
  8783. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  8784. return true;
  8785. }
  8786. }
  8787. return false;
  8788. }
  8789. function updateHOCHostEl({ vnode, parent }, el) {
  8790. while (parent) {
  8791. const root = parent.subTree;
  8792. if (root.suspense && root.suspense.activeBranch === vnode) {
  8793. root.el = vnode.el;
  8794. }
  8795. if (root === vnode) {
  8796. (vnode = parent.vnode).el = el;
  8797. parent = parent.parent;
  8798. } else {
  8799. break;
  8800. }
  8801. }
  8802. }
  8803. const isSuspense = (type) => type.__isSuspense;
  8804. let suspenseId = 0;
  8805. const SuspenseImpl = {
  8806. name: "Suspense",
  8807. // In order to make Suspense tree-shakable, we need to avoid importing it
  8808. // directly in the renderer. The renderer checks for the __isSuspense flag
  8809. // on a vnode's type and calls the `process` method, passing in renderer
  8810. // internals.
  8811. __isSuspense: true,
  8812. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8813. if (n1 == null) {
  8814. mountSuspense(
  8815. n2,
  8816. container,
  8817. anchor,
  8818. parentComponent,
  8819. parentSuspense,
  8820. namespace,
  8821. slotScopeIds,
  8822. optimized,
  8823. rendererInternals
  8824. );
  8825. } else {
  8826. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  8827. n2.suspense = n1.suspense;
  8828. n2.suspense.vnode = n2;
  8829. n2.el = n1.el;
  8830. return;
  8831. }
  8832. patchSuspense(
  8833. n1,
  8834. n2,
  8835. container,
  8836. anchor,
  8837. parentComponent,
  8838. namespace,
  8839. slotScopeIds,
  8840. optimized,
  8841. rendererInternals
  8842. );
  8843. }
  8844. },
  8845. hydrate: hydrateSuspense,
  8846. normalize: normalizeSuspenseChildren
  8847. };
  8848. const Suspense = SuspenseImpl ;
  8849. function triggerEvent(vnode, name) {
  8850. const eventListener = vnode.props && vnode.props[name];
  8851. if (isFunction(eventListener)) {
  8852. eventListener();
  8853. }
  8854. }
  8855. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8856. const {
  8857. p: patch,
  8858. o: { createElement }
  8859. } = rendererInternals;
  8860. const hiddenContainer = createElement("div");
  8861. const suspense = vnode.suspense = createSuspenseBoundary(
  8862. vnode,
  8863. parentSuspense,
  8864. parentComponent,
  8865. container,
  8866. hiddenContainer,
  8867. anchor,
  8868. namespace,
  8869. slotScopeIds,
  8870. optimized,
  8871. rendererInternals
  8872. );
  8873. patch(
  8874. null,
  8875. suspense.pendingBranch = vnode.ssContent,
  8876. hiddenContainer,
  8877. null,
  8878. parentComponent,
  8879. suspense,
  8880. namespace,
  8881. slotScopeIds
  8882. );
  8883. if (suspense.deps > 0) {
  8884. triggerEvent(vnode, "onPending");
  8885. triggerEvent(vnode, "onFallback");
  8886. patch(
  8887. null,
  8888. vnode.ssFallback,
  8889. container,
  8890. anchor,
  8891. parentComponent,
  8892. null,
  8893. // fallback tree will not have suspense context
  8894. namespace,
  8895. slotScopeIds
  8896. );
  8897. setActiveBranch(suspense, vnode.ssFallback);
  8898. } else {
  8899. suspense.resolve(false, true);
  8900. }
  8901. }
  8902. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  8903. const suspense = n2.suspense = n1.suspense;
  8904. suspense.vnode = n2;
  8905. n2.el = n1.el;
  8906. const newBranch = n2.ssContent;
  8907. const newFallback = n2.ssFallback;
  8908. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  8909. if (pendingBranch) {
  8910. suspense.pendingBranch = newBranch;
  8911. if (isSameVNodeType(newBranch, pendingBranch)) {
  8912. patch(
  8913. pendingBranch,
  8914. newBranch,
  8915. suspense.hiddenContainer,
  8916. null,
  8917. parentComponent,
  8918. suspense,
  8919. namespace,
  8920. slotScopeIds,
  8921. optimized
  8922. );
  8923. if (suspense.deps <= 0) {
  8924. suspense.resolve();
  8925. } else if (isInFallback) {
  8926. if (!isHydrating) {
  8927. patch(
  8928. activeBranch,
  8929. newFallback,
  8930. container,
  8931. anchor,
  8932. parentComponent,
  8933. null,
  8934. // fallback tree will not have suspense context
  8935. namespace,
  8936. slotScopeIds,
  8937. optimized
  8938. );
  8939. setActiveBranch(suspense, newFallback);
  8940. }
  8941. }
  8942. } else {
  8943. suspense.pendingId = suspenseId++;
  8944. if (isHydrating) {
  8945. suspense.isHydrating = false;
  8946. suspense.activeBranch = pendingBranch;
  8947. } else {
  8948. unmount(pendingBranch, parentComponent, suspense);
  8949. }
  8950. suspense.deps = 0;
  8951. suspense.effects.length = 0;
  8952. suspense.hiddenContainer = createElement("div");
  8953. if (isInFallback) {
  8954. patch(
  8955. null,
  8956. newBranch,
  8957. suspense.hiddenContainer,
  8958. null,
  8959. parentComponent,
  8960. suspense,
  8961. namespace,
  8962. slotScopeIds,
  8963. optimized
  8964. );
  8965. if (suspense.deps <= 0) {
  8966. suspense.resolve();
  8967. } else {
  8968. patch(
  8969. activeBranch,
  8970. newFallback,
  8971. container,
  8972. anchor,
  8973. parentComponent,
  8974. null,
  8975. // fallback tree will not have suspense context
  8976. namespace,
  8977. slotScopeIds,
  8978. optimized
  8979. );
  8980. setActiveBranch(suspense, newFallback);
  8981. }
  8982. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  8983. patch(
  8984. activeBranch,
  8985. newBranch,
  8986. container,
  8987. anchor,
  8988. parentComponent,
  8989. suspense,
  8990. namespace,
  8991. slotScopeIds,
  8992. optimized
  8993. );
  8994. suspense.resolve(true);
  8995. } else {
  8996. patch(
  8997. null,
  8998. newBranch,
  8999. suspense.hiddenContainer,
  9000. null,
  9001. parentComponent,
  9002. suspense,
  9003. namespace,
  9004. slotScopeIds,
  9005. optimized
  9006. );
  9007. if (suspense.deps <= 0) {
  9008. suspense.resolve();
  9009. }
  9010. }
  9011. }
  9012. } else {
  9013. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  9014. patch(
  9015. activeBranch,
  9016. newBranch,
  9017. container,
  9018. anchor,
  9019. parentComponent,
  9020. suspense,
  9021. namespace,
  9022. slotScopeIds,
  9023. optimized
  9024. );
  9025. setActiveBranch(suspense, newBranch);
  9026. } else {
  9027. triggerEvent(n2, "onPending");
  9028. suspense.pendingBranch = newBranch;
  9029. if (newBranch.shapeFlag & 512) {
  9030. suspense.pendingId = newBranch.component.suspenseId;
  9031. } else {
  9032. suspense.pendingId = suspenseId++;
  9033. }
  9034. patch(
  9035. null,
  9036. newBranch,
  9037. suspense.hiddenContainer,
  9038. null,
  9039. parentComponent,
  9040. suspense,
  9041. namespace,
  9042. slotScopeIds,
  9043. optimized
  9044. );
  9045. if (suspense.deps <= 0) {
  9046. suspense.resolve();
  9047. } else {
  9048. const { timeout, pendingId } = suspense;
  9049. if (timeout > 0) {
  9050. setTimeout(() => {
  9051. if (suspense.pendingId === pendingId) {
  9052. suspense.fallback(newFallback);
  9053. }
  9054. }, timeout);
  9055. } else if (timeout === 0) {
  9056. suspense.fallback(newFallback);
  9057. }
  9058. }
  9059. }
  9060. }
  9061. }
  9062. let hasWarned = false;
  9063. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  9064. if (!hasWarned) {
  9065. hasWarned = true;
  9066. console[console.info ? "info" : "log"](
  9067. `<Suspense> is an experimental feature and its API will likely change.`
  9068. );
  9069. }
  9070. const {
  9071. p: patch,
  9072. m: move,
  9073. um: unmount,
  9074. n: next,
  9075. o: { parentNode, remove }
  9076. } = rendererInternals;
  9077. let parentSuspenseId;
  9078. const isSuspensible = isVNodeSuspensible(vnode);
  9079. if (isSuspensible) {
  9080. if (parentSuspense && parentSuspense.pendingBranch) {
  9081. parentSuspenseId = parentSuspense.pendingId;
  9082. parentSuspense.deps++;
  9083. }
  9084. }
  9085. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  9086. {
  9087. assertNumber(timeout, `Suspense timeout`);
  9088. }
  9089. const initialAnchor = anchor;
  9090. const suspense = {
  9091. vnode,
  9092. parent: parentSuspense,
  9093. parentComponent,
  9094. namespace,
  9095. container,
  9096. hiddenContainer,
  9097. deps: 0,
  9098. pendingId: suspenseId++,
  9099. timeout: typeof timeout === "number" ? timeout : -1,
  9100. activeBranch: null,
  9101. pendingBranch: null,
  9102. isInFallback: !isHydrating,
  9103. isHydrating,
  9104. isUnmounted: false,
  9105. effects: [],
  9106. resolve(resume = false, sync = false) {
  9107. {
  9108. if (!resume && !suspense.pendingBranch) {
  9109. throw new Error(
  9110. `suspense.resolve() is called without a pending branch.`
  9111. );
  9112. }
  9113. if (suspense.isUnmounted) {
  9114. throw new Error(
  9115. `suspense.resolve() is called on an already unmounted suspense boundary.`
  9116. );
  9117. }
  9118. }
  9119. const {
  9120. vnode: vnode2,
  9121. activeBranch,
  9122. pendingBranch,
  9123. pendingId,
  9124. effects,
  9125. parentComponent: parentComponent2,
  9126. container: container2
  9127. } = suspense;
  9128. let delayEnter = false;
  9129. if (suspense.isHydrating) {
  9130. suspense.isHydrating = false;
  9131. } else if (!resume) {
  9132. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  9133. if (delayEnter) {
  9134. activeBranch.transition.afterLeave = () => {
  9135. if (pendingId === suspense.pendingId) {
  9136. move(
  9137. pendingBranch,
  9138. container2,
  9139. anchor === initialAnchor ? next(activeBranch) : anchor,
  9140. 0
  9141. );
  9142. queuePostFlushCb(effects);
  9143. }
  9144. };
  9145. }
  9146. if (activeBranch) {
  9147. if (parentNode(activeBranch.el) === container2) {
  9148. anchor = next(activeBranch);
  9149. }
  9150. unmount(activeBranch, parentComponent2, suspense, true);
  9151. }
  9152. if (!delayEnter) {
  9153. move(pendingBranch, container2, anchor, 0);
  9154. }
  9155. }
  9156. setActiveBranch(suspense, pendingBranch);
  9157. suspense.pendingBranch = null;
  9158. suspense.isInFallback = false;
  9159. let parent = suspense.parent;
  9160. let hasUnresolvedAncestor = false;
  9161. while (parent) {
  9162. if (parent.pendingBranch) {
  9163. parent.effects.push(...effects);
  9164. hasUnresolvedAncestor = true;
  9165. break;
  9166. }
  9167. parent = parent.parent;
  9168. }
  9169. if (!hasUnresolvedAncestor && !delayEnter) {
  9170. queuePostFlushCb(effects);
  9171. }
  9172. suspense.effects = [];
  9173. if (isSuspensible) {
  9174. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  9175. parentSuspense.deps--;
  9176. if (parentSuspense.deps === 0 && !sync) {
  9177. parentSuspense.resolve();
  9178. }
  9179. }
  9180. }
  9181. triggerEvent(vnode2, "onResolve");
  9182. },
  9183. fallback(fallbackVNode) {
  9184. if (!suspense.pendingBranch) {
  9185. return;
  9186. }
  9187. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  9188. triggerEvent(vnode2, "onFallback");
  9189. const anchor2 = next(activeBranch);
  9190. const mountFallback = () => {
  9191. if (!suspense.isInFallback) {
  9192. return;
  9193. }
  9194. patch(
  9195. null,
  9196. fallbackVNode,
  9197. container2,
  9198. anchor2,
  9199. parentComponent2,
  9200. null,
  9201. // fallback tree will not have suspense context
  9202. namespace2,
  9203. slotScopeIds,
  9204. optimized
  9205. );
  9206. setActiveBranch(suspense, fallbackVNode);
  9207. };
  9208. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  9209. if (delayEnter) {
  9210. activeBranch.transition.afterLeave = mountFallback;
  9211. }
  9212. suspense.isInFallback = true;
  9213. unmount(
  9214. activeBranch,
  9215. parentComponent2,
  9216. null,
  9217. // no suspense so unmount hooks fire now
  9218. true
  9219. // shouldRemove
  9220. );
  9221. if (!delayEnter) {
  9222. mountFallback();
  9223. }
  9224. },
  9225. move(container2, anchor2, type) {
  9226. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  9227. suspense.container = container2;
  9228. },
  9229. next() {
  9230. return suspense.activeBranch && next(suspense.activeBranch);
  9231. },
  9232. registerDep(instance, setupRenderEffect, optimized2) {
  9233. const isInPendingSuspense = !!suspense.pendingBranch;
  9234. if (isInPendingSuspense) {
  9235. suspense.deps++;
  9236. }
  9237. const hydratedEl = instance.vnode.el;
  9238. instance.asyncDep.catch((err) => {
  9239. handleError(err, instance, 0);
  9240. }).then((asyncSetupResult) => {
  9241. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  9242. return;
  9243. }
  9244. instance.asyncResolved = true;
  9245. const { vnode: vnode2 } = instance;
  9246. {
  9247. pushWarningContext(vnode2);
  9248. }
  9249. handleSetupResult(instance, asyncSetupResult, false);
  9250. if (hydratedEl) {
  9251. vnode2.el = hydratedEl;
  9252. }
  9253. const placeholder = !hydratedEl && instance.subTree.el;
  9254. setupRenderEffect(
  9255. instance,
  9256. vnode2,
  9257. // component may have been moved before resolve.
  9258. // if this is not a hydration, instance.subTree will be the comment
  9259. // placeholder.
  9260. parentNode(hydratedEl || instance.subTree.el),
  9261. // anchor will not be used if this is hydration, so only need to
  9262. // consider the comment placeholder case.
  9263. hydratedEl ? null : next(instance.subTree),
  9264. suspense,
  9265. namespace,
  9266. optimized2
  9267. );
  9268. if (placeholder) {
  9269. remove(placeholder);
  9270. }
  9271. updateHOCHostEl(instance, vnode2.el);
  9272. {
  9273. popWarningContext();
  9274. }
  9275. if (isInPendingSuspense && --suspense.deps === 0) {
  9276. suspense.resolve();
  9277. }
  9278. });
  9279. },
  9280. unmount(parentSuspense2, doRemove) {
  9281. suspense.isUnmounted = true;
  9282. if (suspense.activeBranch) {
  9283. unmount(
  9284. suspense.activeBranch,
  9285. parentComponent,
  9286. parentSuspense2,
  9287. doRemove
  9288. );
  9289. }
  9290. if (suspense.pendingBranch) {
  9291. unmount(
  9292. suspense.pendingBranch,
  9293. parentComponent,
  9294. parentSuspense2,
  9295. doRemove
  9296. );
  9297. }
  9298. }
  9299. };
  9300. return suspense;
  9301. }
  9302. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  9303. const suspense = vnode.suspense = createSuspenseBoundary(
  9304. vnode,
  9305. parentSuspense,
  9306. parentComponent,
  9307. node.parentNode,
  9308. // eslint-disable-next-line no-restricted-globals
  9309. document.createElement("div"),
  9310. null,
  9311. namespace,
  9312. slotScopeIds,
  9313. optimized,
  9314. rendererInternals,
  9315. true
  9316. );
  9317. const result = hydrateNode(
  9318. node,
  9319. suspense.pendingBranch = vnode.ssContent,
  9320. parentComponent,
  9321. suspense,
  9322. slotScopeIds,
  9323. optimized
  9324. );
  9325. if (suspense.deps === 0) {
  9326. suspense.resolve(false, true);
  9327. }
  9328. return result;
  9329. }
  9330. function normalizeSuspenseChildren(vnode) {
  9331. const { shapeFlag, children } = vnode;
  9332. const isSlotChildren = shapeFlag & 32;
  9333. vnode.ssContent = normalizeSuspenseSlot(
  9334. isSlotChildren ? children.default : children
  9335. );
  9336. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  9337. }
  9338. function normalizeSuspenseSlot(s) {
  9339. let block;
  9340. if (isFunction(s)) {
  9341. const trackBlock = isBlockTreeEnabled && s._c;
  9342. if (trackBlock) {
  9343. s._d = false;
  9344. openBlock();
  9345. }
  9346. s = s();
  9347. if (trackBlock) {
  9348. s._d = true;
  9349. block = currentBlock;
  9350. closeBlock();
  9351. }
  9352. }
  9353. if (isArray(s)) {
  9354. const singleChild = filterSingleRoot(s);
  9355. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  9356. warn$1(`<Suspense> slots expect a single root node.`);
  9357. }
  9358. s = singleChild;
  9359. }
  9360. s = normalizeVNode(s);
  9361. if (block && !s.dynamicChildren) {
  9362. s.dynamicChildren = block.filter((c) => c !== s);
  9363. }
  9364. return s;
  9365. }
  9366. function queueEffectWithSuspense(fn, suspense) {
  9367. if (suspense && suspense.pendingBranch) {
  9368. if (isArray(fn)) {
  9369. suspense.effects.push(...fn);
  9370. } else {
  9371. suspense.effects.push(fn);
  9372. }
  9373. } else {
  9374. queuePostFlushCb(fn);
  9375. }
  9376. }
  9377. function setActiveBranch(suspense, branch) {
  9378. suspense.activeBranch = branch;
  9379. const { vnode, parentComponent } = suspense;
  9380. let el = branch.el;
  9381. while (!el && branch.component) {
  9382. branch = branch.component.subTree;
  9383. el = branch.el;
  9384. }
  9385. vnode.el = el;
  9386. if (parentComponent && parentComponent.subTree === vnode) {
  9387. parentComponent.vnode.el = el;
  9388. updateHOCHostEl(parentComponent, el);
  9389. }
  9390. }
  9391. function isVNodeSuspensible(vnode) {
  9392. const suspensible = vnode.props && vnode.props.suspensible;
  9393. return suspensible != null && suspensible !== false;
  9394. }
  9395. const Fragment = Symbol.for("v-fgt");
  9396. const Text = Symbol.for("v-txt");
  9397. const Comment = Symbol.for("v-cmt");
  9398. const Static = Symbol.for("v-stc");
  9399. const blockStack = [];
  9400. let currentBlock = null;
  9401. function openBlock(disableTracking = false) {
  9402. blockStack.push(currentBlock = disableTracking ? null : []);
  9403. }
  9404. function closeBlock() {
  9405. blockStack.pop();
  9406. currentBlock = blockStack[blockStack.length - 1] || null;
  9407. }
  9408. let isBlockTreeEnabled = 1;
  9409. function setBlockTracking(value, inVOnce = false) {
  9410. isBlockTreeEnabled += value;
  9411. if (value < 0 && currentBlock && inVOnce) {
  9412. currentBlock.hasOnce = true;
  9413. }
  9414. }
  9415. function setupBlock(vnode) {
  9416. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  9417. closeBlock();
  9418. if (isBlockTreeEnabled > 0 && currentBlock) {
  9419. currentBlock.push(vnode);
  9420. }
  9421. return vnode;
  9422. }
  9423. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  9424. return setupBlock(
  9425. createBaseVNode(
  9426. type,
  9427. props,
  9428. children,
  9429. patchFlag,
  9430. dynamicProps,
  9431. shapeFlag,
  9432. true
  9433. )
  9434. );
  9435. }
  9436. function createBlock(type, props, children, patchFlag, dynamicProps) {
  9437. return setupBlock(
  9438. createVNode(
  9439. type,
  9440. props,
  9441. children,
  9442. patchFlag,
  9443. dynamicProps,
  9444. true
  9445. )
  9446. );
  9447. }
  9448. function isVNode(value) {
  9449. return value ? value.__v_isVNode === true : false;
  9450. }
  9451. function isSameVNodeType(n1, n2) {
  9452. if (n2.shapeFlag & 6 && n1.component) {
  9453. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  9454. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  9455. n1.shapeFlag &= ~256;
  9456. n2.shapeFlag &= ~512;
  9457. return false;
  9458. }
  9459. }
  9460. return n1.type === n2.type && n1.key === n2.key;
  9461. }
  9462. let vnodeArgsTransformer;
  9463. function transformVNodeArgs(transformer) {
  9464. vnodeArgsTransformer = transformer;
  9465. }
  9466. const createVNodeWithArgsTransform = (...args) => {
  9467. return _createVNode(
  9468. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  9469. );
  9470. };
  9471. const normalizeKey = ({ key }) => key != null ? key : null;
  9472. const normalizeRef = ({
  9473. ref,
  9474. ref_key,
  9475. ref_for
  9476. }) => {
  9477. if (typeof ref === "number") {
  9478. ref = "" + ref;
  9479. }
  9480. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  9481. };
  9482. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  9483. const vnode = {
  9484. __v_isVNode: true,
  9485. __v_skip: true,
  9486. type,
  9487. props,
  9488. key: props && normalizeKey(props),
  9489. ref: props && normalizeRef(props),
  9490. scopeId: currentScopeId,
  9491. slotScopeIds: null,
  9492. children,
  9493. component: null,
  9494. suspense: null,
  9495. ssContent: null,
  9496. ssFallback: null,
  9497. dirs: null,
  9498. transition: null,
  9499. el: null,
  9500. anchor: null,
  9501. target: null,
  9502. targetStart: null,
  9503. targetAnchor: null,
  9504. staticCount: 0,
  9505. shapeFlag,
  9506. patchFlag,
  9507. dynamicProps,
  9508. dynamicChildren: null,
  9509. appContext: null,
  9510. ctx: currentRenderingInstance
  9511. };
  9512. if (needFullChildrenNormalization) {
  9513. normalizeChildren(vnode, children);
  9514. if (shapeFlag & 128) {
  9515. type.normalize(vnode);
  9516. }
  9517. } else if (children) {
  9518. vnode.shapeFlag |= isString(children) ? 8 : 16;
  9519. }
  9520. if (vnode.key !== vnode.key) {
  9521. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  9522. }
  9523. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  9524. !isBlockNode && // has current parent block
  9525. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  9526. // component nodes also should always be patched, because even if the
  9527. // component doesn't need to update, it needs to persist the instance on to
  9528. // the next vnode so that it can be properly unmounted later.
  9529. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  9530. // vnode should not be considered dynamic due to handler caching.
  9531. vnode.patchFlag !== 32) {
  9532. currentBlock.push(vnode);
  9533. }
  9534. return vnode;
  9535. }
  9536. const createVNode = createVNodeWithArgsTransform ;
  9537. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  9538. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  9539. if (!type) {
  9540. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  9541. }
  9542. type = Comment;
  9543. }
  9544. if (isVNode(type)) {
  9545. const cloned = cloneVNode(
  9546. type,
  9547. props,
  9548. true
  9549. /* mergeRef: true */
  9550. );
  9551. if (children) {
  9552. normalizeChildren(cloned, children);
  9553. }
  9554. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  9555. if (cloned.shapeFlag & 6) {
  9556. currentBlock[currentBlock.indexOf(type)] = cloned;
  9557. } else {
  9558. currentBlock.push(cloned);
  9559. }
  9560. }
  9561. cloned.patchFlag = -2;
  9562. return cloned;
  9563. }
  9564. if (isClassComponent(type)) {
  9565. type = type.__vccOpts;
  9566. }
  9567. if (props) {
  9568. props = guardReactiveProps(props);
  9569. let { class: klass, style } = props;
  9570. if (klass && !isString(klass)) {
  9571. props.class = normalizeClass(klass);
  9572. }
  9573. if (isObject(style)) {
  9574. if (isProxy(style) && !isArray(style)) {
  9575. style = extend({}, style);
  9576. }
  9577. props.style = normalizeStyle(style);
  9578. }
  9579. }
  9580. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  9581. if (shapeFlag & 4 && isProxy(type)) {
  9582. type = toRaw(type);
  9583. warn$1(
  9584. `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\`.`,
  9585. `
  9586. Component that was made reactive: `,
  9587. type
  9588. );
  9589. }
  9590. return createBaseVNode(
  9591. type,
  9592. props,
  9593. children,
  9594. patchFlag,
  9595. dynamicProps,
  9596. shapeFlag,
  9597. isBlockNode,
  9598. true
  9599. );
  9600. }
  9601. function guardReactiveProps(props) {
  9602. if (!props) return null;
  9603. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  9604. }
  9605. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  9606. const { props, ref, patchFlag, children, transition } = vnode;
  9607. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  9608. const cloned = {
  9609. __v_isVNode: true,
  9610. __v_skip: true,
  9611. type: vnode.type,
  9612. props: mergedProps,
  9613. key: mergedProps && normalizeKey(mergedProps),
  9614. ref: extraProps && extraProps.ref ? (
  9615. // #2078 in the case of <component :is="vnode" ref="extra"/>
  9616. // if the vnode itself already has a ref, cloneVNode will need to merge
  9617. // the refs so the single vnode can be set on multiple refs
  9618. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  9619. ) : ref,
  9620. scopeId: vnode.scopeId,
  9621. slotScopeIds: vnode.slotScopeIds,
  9622. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  9623. target: vnode.target,
  9624. targetStart: vnode.targetStart,
  9625. targetAnchor: vnode.targetAnchor,
  9626. staticCount: vnode.staticCount,
  9627. shapeFlag: vnode.shapeFlag,
  9628. // if the vnode is cloned with extra props, we can no longer assume its
  9629. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  9630. // note: preserve flag for fragments since they use the flag for children
  9631. // fast paths only.
  9632. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  9633. dynamicProps: vnode.dynamicProps,
  9634. dynamicChildren: vnode.dynamicChildren,
  9635. appContext: vnode.appContext,
  9636. dirs: vnode.dirs,
  9637. transition,
  9638. // These should technically only be non-null on mounted VNodes. However,
  9639. // they *should* be copied for kept-alive vnodes. So we just always copy
  9640. // them since them being non-null during a mount doesn't affect the logic as
  9641. // they will simply be overwritten.
  9642. component: vnode.component,
  9643. suspense: vnode.suspense,
  9644. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  9645. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  9646. el: vnode.el,
  9647. anchor: vnode.anchor,
  9648. ctx: vnode.ctx,
  9649. ce: vnode.ce
  9650. };
  9651. if (transition && cloneTransition) {
  9652. setTransitionHooks(
  9653. cloned,
  9654. transition.clone(cloned)
  9655. );
  9656. }
  9657. return cloned;
  9658. }
  9659. function deepCloneVNode(vnode) {
  9660. const cloned = cloneVNode(vnode);
  9661. if (isArray(vnode.children)) {
  9662. cloned.children = vnode.children.map(deepCloneVNode);
  9663. }
  9664. return cloned;
  9665. }
  9666. function createTextVNode(text = " ", flag = 0) {
  9667. return createVNode(Text, null, text, flag);
  9668. }
  9669. function createStaticVNode(content, numberOfNodes) {
  9670. const vnode = createVNode(Static, null, content);
  9671. vnode.staticCount = numberOfNodes;
  9672. return vnode;
  9673. }
  9674. function createCommentVNode(text = "", asBlock = false) {
  9675. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  9676. }
  9677. function normalizeVNode(child) {
  9678. if (child == null || typeof child === "boolean") {
  9679. return createVNode(Comment);
  9680. } else if (isArray(child)) {
  9681. return createVNode(
  9682. Fragment,
  9683. null,
  9684. // #3666, avoid reference pollution when reusing vnode
  9685. child.slice()
  9686. );
  9687. } else if (isVNode(child)) {
  9688. return cloneIfMounted(child);
  9689. } else {
  9690. return createVNode(Text, null, String(child));
  9691. }
  9692. }
  9693. function cloneIfMounted(child) {
  9694. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  9695. }
  9696. function normalizeChildren(vnode, children) {
  9697. let type = 0;
  9698. const { shapeFlag } = vnode;
  9699. if (children == null) {
  9700. children = null;
  9701. } else if (isArray(children)) {
  9702. type = 16;
  9703. } else if (typeof children === "object") {
  9704. if (shapeFlag & (1 | 64)) {
  9705. const slot = children.default;
  9706. if (slot) {
  9707. slot._c && (slot._d = false);
  9708. normalizeChildren(vnode, slot());
  9709. slot._c && (slot._d = true);
  9710. }
  9711. return;
  9712. } else {
  9713. type = 32;
  9714. const slotFlag = children._;
  9715. if (!slotFlag && !isInternalObject(children)) {
  9716. children._ctx = currentRenderingInstance;
  9717. } else if (slotFlag === 3 && currentRenderingInstance) {
  9718. if (currentRenderingInstance.slots._ === 1) {
  9719. children._ = 1;
  9720. } else {
  9721. children._ = 2;
  9722. vnode.patchFlag |= 1024;
  9723. }
  9724. }
  9725. }
  9726. } else if (isFunction(children)) {
  9727. children = { default: children, _ctx: currentRenderingInstance };
  9728. type = 32;
  9729. } else {
  9730. children = String(children);
  9731. if (shapeFlag & 64) {
  9732. type = 16;
  9733. children = [createTextVNode(children)];
  9734. } else {
  9735. type = 8;
  9736. }
  9737. }
  9738. vnode.children = children;
  9739. vnode.shapeFlag |= type;
  9740. }
  9741. function mergeProps(...args) {
  9742. const ret = {};
  9743. for (let i = 0; i < args.length; i++) {
  9744. const toMerge = args[i];
  9745. for (const key in toMerge) {
  9746. if (key === "class") {
  9747. if (ret.class !== toMerge.class) {
  9748. ret.class = normalizeClass([ret.class, toMerge.class]);
  9749. }
  9750. } else if (key === "style") {
  9751. ret.style = normalizeStyle([ret.style, toMerge.style]);
  9752. } else if (isOn(key)) {
  9753. const existing = ret[key];
  9754. const incoming = toMerge[key];
  9755. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  9756. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  9757. }
  9758. } else if (key !== "") {
  9759. ret[key] = toMerge[key];
  9760. }
  9761. }
  9762. }
  9763. return ret;
  9764. }
  9765. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  9766. callWithAsyncErrorHandling(hook, instance, 7, [
  9767. vnode,
  9768. prevVNode
  9769. ]);
  9770. }
  9771. const emptyAppContext = createAppContext();
  9772. let uid = 0;
  9773. function createComponentInstance(vnode, parent, suspense) {
  9774. const type = vnode.type;
  9775. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  9776. const instance = {
  9777. uid: uid++,
  9778. vnode,
  9779. type,
  9780. parent,
  9781. appContext,
  9782. root: null,
  9783. // to be immediately set
  9784. next: null,
  9785. subTree: null,
  9786. // will be set synchronously right after creation
  9787. effect: null,
  9788. update: null,
  9789. // will be set synchronously right after creation
  9790. job: null,
  9791. scope: new EffectScope(
  9792. true
  9793. /* detached */
  9794. ),
  9795. render: null,
  9796. proxy: null,
  9797. exposed: null,
  9798. exposeProxy: null,
  9799. withProxy: null,
  9800. provides: parent ? parent.provides : Object.create(appContext.provides),
  9801. ids: parent ? parent.ids : ["", 0, 0],
  9802. accessCache: null,
  9803. renderCache: [],
  9804. // local resolved assets
  9805. components: null,
  9806. directives: null,
  9807. // resolved props and emits options
  9808. propsOptions: normalizePropsOptions(type, appContext),
  9809. emitsOptions: normalizeEmitsOptions(type, appContext),
  9810. // emit
  9811. emit: null,
  9812. // to be set immediately
  9813. emitted: null,
  9814. // props default value
  9815. propsDefaults: EMPTY_OBJ,
  9816. // inheritAttrs
  9817. inheritAttrs: type.inheritAttrs,
  9818. // state
  9819. ctx: EMPTY_OBJ,
  9820. data: EMPTY_OBJ,
  9821. props: EMPTY_OBJ,
  9822. attrs: EMPTY_OBJ,
  9823. slots: EMPTY_OBJ,
  9824. refs: EMPTY_OBJ,
  9825. setupState: EMPTY_OBJ,
  9826. setupContext: null,
  9827. // suspense related
  9828. suspense,
  9829. suspenseId: suspense ? suspense.pendingId : 0,
  9830. asyncDep: null,
  9831. asyncResolved: false,
  9832. // lifecycle hooks
  9833. // not using enums here because it results in computed properties
  9834. isMounted: false,
  9835. isUnmounted: false,
  9836. isDeactivated: false,
  9837. bc: null,
  9838. c: null,
  9839. bm: null,
  9840. m: null,
  9841. bu: null,
  9842. u: null,
  9843. um: null,
  9844. bum: null,
  9845. da: null,
  9846. a: null,
  9847. rtg: null,
  9848. rtc: null,
  9849. ec: null,
  9850. sp: null
  9851. };
  9852. {
  9853. instance.ctx = createDevRenderContext(instance);
  9854. }
  9855. instance.root = parent ? parent.root : instance;
  9856. instance.emit = emit.bind(null, instance);
  9857. if (vnode.ce) {
  9858. vnode.ce(instance);
  9859. }
  9860. return instance;
  9861. }
  9862. let currentInstance = null;
  9863. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  9864. let internalSetCurrentInstance;
  9865. let setInSSRSetupState;
  9866. {
  9867. internalSetCurrentInstance = (i) => {
  9868. currentInstance = i;
  9869. };
  9870. setInSSRSetupState = (v) => {
  9871. isInSSRComponentSetup = v;
  9872. };
  9873. }
  9874. const setCurrentInstance = (instance) => {
  9875. const prev = currentInstance;
  9876. internalSetCurrentInstance(instance);
  9877. instance.scope.on();
  9878. return () => {
  9879. instance.scope.off();
  9880. internalSetCurrentInstance(prev);
  9881. };
  9882. };
  9883. const unsetCurrentInstance = () => {
  9884. currentInstance && currentInstance.scope.off();
  9885. internalSetCurrentInstance(null);
  9886. };
  9887. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  9888. function validateComponentName(name, { isNativeTag }) {
  9889. if (isBuiltInTag(name) || isNativeTag(name)) {
  9890. warn$1(
  9891. "Do not use built-in or reserved HTML elements as component id: " + name
  9892. );
  9893. }
  9894. }
  9895. function isStatefulComponent(instance) {
  9896. return instance.vnode.shapeFlag & 4;
  9897. }
  9898. let isInSSRComponentSetup = false;
  9899. function setupComponent(instance, isSSR = false, optimized = false) {
  9900. isSSR && setInSSRSetupState(isSSR);
  9901. const { props, children } = instance.vnode;
  9902. const isStateful = isStatefulComponent(instance);
  9903. initProps(instance, props, isStateful, isSSR);
  9904. initSlots(instance, children, optimized);
  9905. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  9906. isSSR && setInSSRSetupState(false);
  9907. return setupResult;
  9908. }
  9909. function setupStatefulComponent(instance, isSSR) {
  9910. var _a;
  9911. const Component = instance.type;
  9912. {
  9913. if (Component.name) {
  9914. validateComponentName(Component.name, instance.appContext.config);
  9915. }
  9916. if (Component.components) {
  9917. const names = Object.keys(Component.components);
  9918. for (let i = 0; i < names.length; i++) {
  9919. validateComponentName(names[i], instance.appContext.config);
  9920. }
  9921. }
  9922. if (Component.directives) {
  9923. const names = Object.keys(Component.directives);
  9924. for (let i = 0; i < names.length; i++) {
  9925. validateDirectiveName(names[i]);
  9926. }
  9927. }
  9928. if (Component.compilerOptions && isRuntimeOnly()) {
  9929. warn$1(
  9930. `"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.`
  9931. );
  9932. }
  9933. }
  9934. instance.accessCache = /* @__PURE__ */ Object.create(null);
  9935. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  9936. {
  9937. exposePropsOnRenderContext(instance);
  9938. }
  9939. const { setup } = Component;
  9940. if (setup) {
  9941. pauseTracking();
  9942. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  9943. const reset = setCurrentInstance(instance);
  9944. const setupResult = callWithErrorHandling(
  9945. setup,
  9946. instance,
  9947. 0,
  9948. [
  9949. shallowReadonly(instance.props) ,
  9950. setupContext
  9951. ]
  9952. );
  9953. const isAsyncSetup = isPromise(setupResult);
  9954. resetTracking();
  9955. reset();
  9956. if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
  9957. markAsyncBoundary(instance);
  9958. }
  9959. if (isAsyncSetup) {
  9960. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  9961. if (isSSR) {
  9962. return setupResult.then((resolvedResult) => {
  9963. handleSetupResult(instance, resolvedResult, isSSR);
  9964. }).catch((e) => {
  9965. handleError(e, instance, 0);
  9966. });
  9967. } else {
  9968. instance.asyncDep = setupResult;
  9969. if (!instance.suspense) {
  9970. const name = (_a = Component.name) != null ? _a : "Anonymous";
  9971. warn$1(
  9972. `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.`
  9973. );
  9974. }
  9975. }
  9976. } else {
  9977. handleSetupResult(instance, setupResult, isSSR);
  9978. }
  9979. } else {
  9980. finishComponentSetup(instance, isSSR);
  9981. }
  9982. }
  9983. function handleSetupResult(instance, setupResult, isSSR) {
  9984. if (isFunction(setupResult)) {
  9985. {
  9986. instance.render = setupResult;
  9987. }
  9988. } else if (isObject(setupResult)) {
  9989. if (isVNode(setupResult)) {
  9990. warn$1(
  9991. `setup() should not return VNodes directly - return a render function instead.`
  9992. );
  9993. }
  9994. {
  9995. instance.devtoolsRawSetupState = setupResult;
  9996. }
  9997. instance.setupState = proxyRefs(setupResult);
  9998. {
  9999. exposeSetupStateOnRenderContext(instance);
  10000. }
  10001. } else if (setupResult !== void 0) {
  10002. warn$1(
  10003. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  10004. );
  10005. }
  10006. finishComponentSetup(instance, isSSR);
  10007. }
  10008. let compile$1;
  10009. let installWithProxy;
  10010. function registerRuntimeCompiler(_compile) {
  10011. compile$1 = _compile;
  10012. installWithProxy = (i) => {
  10013. if (i.render._rc) {
  10014. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  10015. }
  10016. };
  10017. }
  10018. const isRuntimeOnly = () => !compile$1;
  10019. function finishComponentSetup(instance, isSSR, skipOptions) {
  10020. const Component = instance.type;
  10021. if (!instance.render) {
  10022. if (!isSSR && compile$1 && !Component.render) {
  10023. const template = Component.template || resolveMergedOptions(instance).template;
  10024. if (template) {
  10025. {
  10026. startMeasure(instance, `compile`);
  10027. }
  10028. const { isCustomElement, compilerOptions } = instance.appContext.config;
  10029. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  10030. const finalCompilerOptions = extend(
  10031. extend(
  10032. {
  10033. isCustomElement,
  10034. delimiters
  10035. },
  10036. compilerOptions
  10037. ),
  10038. componentCompilerOptions
  10039. );
  10040. Component.render = compile$1(template, finalCompilerOptions);
  10041. {
  10042. endMeasure(instance, `compile`);
  10043. }
  10044. }
  10045. }
  10046. instance.render = Component.render || NOOP;
  10047. if (installWithProxy) {
  10048. installWithProxy(instance);
  10049. }
  10050. }
  10051. {
  10052. const reset = setCurrentInstance(instance);
  10053. pauseTracking();
  10054. try {
  10055. applyOptions(instance);
  10056. } finally {
  10057. resetTracking();
  10058. reset();
  10059. }
  10060. }
  10061. if (!Component.render && instance.render === NOOP && !isSSR) {
  10062. if (!compile$1 && Component.template) {
  10063. warn$1(
  10064. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
  10065. );
  10066. } else {
  10067. warn$1(`Component is missing template or render function: `, Component);
  10068. }
  10069. }
  10070. }
  10071. const attrsProxyHandlers = {
  10072. get(target, key) {
  10073. markAttrsAccessed();
  10074. track(target, "get", "");
  10075. return target[key];
  10076. },
  10077. set() {
  10078. warn$1(`setupContext.attrs is readonly.`);
  10079. return false;
  10080. },
  10081. deleteProperty() {
  10082. warn$1(`setupContext.attrs is readonly.`);
  10083. return false;
  10084. }
  10085. } ;
  10086. function getSlotsProxy(instance) {
  10087. return new Proxy(instance.slots, {
  10088. get(target, key) {
  10089. track(instance, "get", "$slots");
  10090. return target[key];
  10091. }
  10092. });
  10093. }
  10094. function createSetupContext(instance) {
  10095. const expose = (exposed) => {
  10096. {
  10097. if (instance.exposed) {
  10098. warn$1(`expose() should be called only once per setup().`);
  10099. }
  10100. if (exposed != null) {
  10101. let exposedType = typeof exposed;
  10102. if (exposedType === "object") {
  10103. if (isArray(exposed)) {
  10104. exposedType = "array";
  10105. } else if (isRef(exposed)) {
  10106. exposedType = "ref";
  10107. }
  10108. }
  10109. if (exposedType !== "object") {
  10110. warn$1(
  10111. `expose() should be passed a plain object, received ${exposedType}.`
  10112. );
  10113. }
  10114. }
  10115. }
  10116. instance.exposed = exposed || {};
  10117. };
  10118. {
  10119. let attrsProxy;
  10120. let slotsProxy;
  10121. return Object.freeze({
  10122. get attrs() {
  10123. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  10124. },
  10125. get slots() {
  10126. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  10127. },
  10128. get emit() {
  10129. return (event, ...args) => instance.emit(event, ...args);
  10130. },
  10131. expose
  10132. });
  10133. }
  10134. }
  10135. function getComponentPublicInstance(instance) {
  10136. if (instance.exposed) {
  10137. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  10138. get(target, key) {
  10139. if (key in target) {
  10140. return target[key];
  10141. } else if (key in publicPropertiesMap) {
  10142. return publicPropertiesMap[key](instance);
  10143. }
  10144. },
  10145. has(target, key) {
  10146. return key in target || key in publicPropertiesMap;
  10147. }
  10148. }));
  10149. } else {
  10150. return instance.proxy;
  10151. }
  10152. }
  10153. const classifyRE = /(?:^|[-_])(\w)/g;
  10154. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  10155. function getComponentName(Component, includeInferred = true) {
  10156. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  10157. }
  10158. function formatComponentName(instance, Component, isRoot = false) {
  10159. let name = getComponentName(Component);
  10160. if (!name && Component.__file) {
  10161. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  10162. if (match) {
  10163. name = match[1];
  10164. }
  10165. }
  10166. if (!name && instance && instance.parent) {
  10167. const inferFromRegistry = (registry) => {
  10168. for (const key in registry) {
  10169. if (registry[key] === Component) {
  10170. return key;
  10171. }
  10172. }
  10173. };
  10174. name = inferFromRegistry(
  10175. instance.components || instance.parent.type.components
  10176. ) || inferFromRegistry(instance.appContext.components);
  10177. }
  10178. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  10179. }
  10180. function isClassComponent(value) {
  10181. return isFunction(value) && "__vccOpts" in value;
  10182. }
  10183. const computed = (getterOrOptions, debugOptions) => {
  10184. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  10185. {
  10186. const i = getCurrentInstance();
  10187. if (i && i.appContext.config.warnRecursiveComputed) {
  10188. c._warnRecursive = true;
  10189. }
  10190. }
  10191. return c;
  10192. };
  10193. function h(type, propsOrChildren, children) {
  10194. const l = arguments.length;
  10195. if (l === 2) {
  10196. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  10197. if (isVNode(propsOrChildren)) {
  10198. return createVNode(type, null, [propsOrChildren]);
  10199. }
  10200. return createVNode(type, propsOrChildren);
  10201. } else {
  10202. return createVNode(type, null, propsOrChildren);
  10203. }
  10204. } else {
  10205. if (l > 3) {
  10206. children = Array.prototype.slice.call(arguments, 2);
  10207. } else if (l === 3 && isVNode(children)) {
  10208. children = [children];
  10209. }
  10210. return createVNode(type, propsOrChildren, children);
  10211. }
  10212. }
  10213. function initCustomFormatter() {
  10214. if (typeof window === "undefined") {
  10215. return;
  10216. }
  10217. const vueStyle = { style: "color:#3ba776" };
  10218. const numberStyle = { style: "color:#1677ff" };
  10219. const stringStyle = { style: "color:#f5222d" };
  10220. const keywordStyle = { style: "color:#eb2f96" };
  10221. const formatter = {
  10222. __vue_custom_formatter: true,
  10223. header(obj) {
  10224. if (!isObject(obj)) {
  10225. return null;
  10226. }
  10227. if (obj.__isVue) {
  10228. return ["div", vueStyle, `VueInstance`];
  10229. } else if (isRef(obj)) {
  10230. return [
  10231. "div",
  10232. {},
  10233. ["span", vueStyle, genRefFlag(obj)],
  10234. "<",
  10235. // avoid debugger accessing value affecting behavior
  10236. formatValue("_value" in obj ? obj._value : obj),
  10237. `>`
  10238. ];
  10239. } else if (isReactive(obj)) {
  10240. return [
  10241. "div",
  10242. {},
  10243. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  10244. "<",
  10245. formatValue(obj),
  10246. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  10247. ];
  10248. } else if (isReadonly(obj)) {
  10249. return [
  10250. "div",
  10251. {},
  10252. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  10253. "<",
  10254. formatValue(obj),
  10255. ">"
  10256. ];
  10257. }
  10258. return null;
  10259. },
  10260. hasBody(obj) {
  10261. return obj && obj.__isVue;
  10262. },
  10263. body(obj) {
  10264. if (obj && obj.__isVue) {
  10265. return [
  10266. "div",
  10267. {},
  10268. ...formatInstance(obj.$)
  10269. ];
  10270. }
  10271. }
  10272. };
  10273. function formatInstance(instance) {
  10274. const blocks = [];
  10275. if (instance.type.props && instance.props) {
  10276. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  10277. }
  10278. if (instance.setupState !== EMPTY_OBJ) {
  10279. blocks.push(createInstanceBlock("setup", instance.setupState));
  10280. }
  10281. if (instance.data !== EMPTY_OBJ) {
  10282. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  10283. }
  10284. const computed = extractKeys(instance, "computed");
  10285. if (computed) {
  10286. blocks.push(createInstanceBlock("computed", computed));
  10287. }
  10288. const injected = extractKeys(instance, "inject");
  10289. if (injected) {
  10290. blocks.push(createInstanceBlock("injected", injected));
  10291. }
  10292. blocks.push([
  10293. "div",
  10294. {},
  10295. [
  10296. "span",
  10297. {
  10298. style: keywordStyle.style + ";opacity:0.66"
  10299. },
  10300. "$ (internal): "
  10301. ],
  10302. ["object", { object: instance }]
  10303. ]);
  10304. return blocks;
  10305. }
  10306. function createInstanceBlock(type, target) {
  10307. target = extend({}, target);
  10308. if (!Object.keys(target).length) {
  10309. return ["span", {}];
  10310. }
  10311. return [
  10312. "div",
  10313. { style: "line-height:1.25em;margin-bottom:0.6em" },
  10314. [
  10315. "div",
  10316. {
  10317. style: "color:#476582"
  10318. },
  10319. type
  10320. ],
  10321. [
  10322. "div",
  10323. {
  10324. style: "padding-left:1.25em"
  10325. },
  10326. ...Object.keys(target).map((key) => {
  10327. return [
  10328. "div",
  10329. {},
  10330. ["span", keywordStyle, key + ": "],
  10331. formatValue(target[key], false)
  10332. ];
  10333. })
  10334. ]
  10335. ];
  10336. }
  10337. function formatValue(v, asRaw = true) {
  10338. if (typeof v === "number") {
  10339. return ["span", numberStyle, v];
  10340. } else if (typeof v === "string") {
  10341. return ["span", stringStyle, JSON.stringify(v)];
  10342. } else if (typeof v === "boolean") {
  10343. return ["span", keywordStyle, v];
  10344. } else if (isObject(v)) {
  10345. return ["object", { object: asRaw ? toRaw(v) : v }];
  10346. } else {
  10347. return ["span", stringStyle, String(v)];
  10348. }
  10349. }
  10350. function extractKeys(instance, type) {
  10351. const Comp = instance.type;
  10352. if (isFunction(Comp)) {
  10353. return;
  10354. }
  10355. const extracted = {};
  10356. for (const key in instance.ctx) {
  10357. if (isKeyOfType(Comp, key, type)) {
  10358. extracted[key] = instance.ctx[key];
  10359. }
  10360. }
  10361. return extracted;
  10362. }
  10363. function isKeyOfType(Comp, key, type) {
  10364. const opts = Comp[type];
  10365. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  10366. return true;
  10367. }
  10368. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  10369. return true;
  10370. }
  10371. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  10372. return true;
  10373. }
  10374. }
  10375. function genRefFlag(v) {
  10376. if (isShallow(v)) {
  10377. return `ShallowRef`;
  10378. }
  10379. if (v.effect) {
  10380. return `ComputedRef`;
  10381. }
  10382. return `Ref`;
  10383. }
  10384. if (window.devtoolsFormatters) {
  10385. window.devtoolsFormatters.push(formatter);
  10386. } else {
  10387. window.devtoolsFormatters = [formatter];
  10388. }
  10389. }
  10390. function withMemo(memo, render, cache, index) {
  10391. const cached = cache[index];
  10392. if (cached && isMemoSame(cached, memo)) {
  10393. return cached;
  10394. }
  10395. const ret = render();
  10396. ret.memo = memo.slice();
  10397. ret.cacheIndex = index;
  10398. return cache[index] = ret;
  10399. }
  10400. function isMemoSame(cached, memo) {
  10401. const prev = cached.memo;
  10402. if (prev.length != memo.length) {
  10403. return false;
  10404. }
  10405. for (let i = 0; i < prev.length; i++) {
  10406. if (hasChanged(prev[i], memo[i])) {
  10407. return false;
  10408. }
  10409. }
  10410. if (isBlockTreeEnabled > 0 && currentBlock) {
  10411. currentBlock.push(cached);
  10412. }
  10413. return true;
  10414. }
  10415. const version = "3.5.13";
  10416. const warn = warn$1 ;
  10417. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  10418. const devtools = devtools$1 ;
  10419. const setDevtoolsHook = setDevtoolsHook$1 ;
  10420. const ssrUtils = null;
  10421. const resolveFilter = null;
  10422. const compatUtils = null;
  10423. const DeprecationTypes = null;
  10424. let policy = void 0;
  10425. const tt = typeof window !== "undefined" && window.trustedTypes;
  10426. if (tt) {
  10427. try {
  10428. policy = /* @__PURE__ */ tt.createPolicy("vue", {
  10429. createHTML: (val) => val
  10430. });
  10431. } catch (e) {
  10432. warn(`Error creating trusted types policy: ${e}`);
  10433. }
  10434. }
  10435. const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
  10436. const svgNS = "http://www.w3.org/2000/svg";
  10437. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  10438. const doc = typeof document !== "undefined" ? document : null;
  10439. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  10440. const nodeOps = {
  10441. insert: (child, parent, anchor) => {
  10442. parent.insertBefore(child, anchor || null);
  10443. },
  10444. remove: (child) => {
  10445. const parent = child.parentNode;
  10446. if (parent) {
  10447. parent.removeChild(child);
  10448. }
  10449. },
  10450. createElement: (tag, namespace, is, props) => {
  10451. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  10452. if (tag === "select" && props && props.multiple != null) {
  10453. el.setAttribute("multiple", props.multiple);
  10454. }
  10455. return el;
  10456. },
  10457. createText: (text) => doc.createTextNode(text),
  10458. createComment: (text) => doc.createComment(text),
  10459. setText: (node, text) => {
  10460. node.nodeValue = text;
  10461. },
  10462. setElementText: (el, text) => {
  10463. el.textContent = text;
  10464. },
  10465. parentNode: (node) => node.parentNode,
  10466. nextSibling: (node) => node.nextSibling,
  10467. querySelector: (selector) => doc.querySelector(selector),
  10468. setScopeId(el, id) {
  10469. el.setAttribute(id, "");
  10470. },
  10471. // __UNSAFE__
  10472. // Reason: innerHTML.
  10473. // Static content here can only come from compiled templates.
  10474. // As long as the user only uses trusted templates, this is safe.
  10475. insertStaticContent(content, parent, anchor, namespace, start, end) {
  10476. const before = anchor ? anchor.previousSibling : parent.lastChild;
  10477. if (start && (start === end || start.nextSibling)) {
  10478. while (true) {
  10479. parent.insertBefore(start.cloneNode(true), anchor);
  10480. if (start === end || !(start = start.nextSibling)) break;
  10481. }
  10482. } else {
  10483. templateContainer.innerHTML = unsafeToTrustedHTML(
  10484. namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
  10485. );
  10486. const template = templateContainer.content;
  10487. if (namespace === "svg" || namespace === "mathml") {
  10488. const wrapper = template.firstChild;
  10489. while (wrapper.firstChild) {
  10490. template.appendChild(wrapper.firstChild);
  10491. }
  10492. template.removeChild(wrapper);
  10493. }
  10494. parent.insertBefore(template, anchor);
  10495. }
  10496. return [
  10497. // first
  10498. before ? before.nextSibling : parent.firstChild,
  10499. // last
  10500. anchor ? anchor.previousSibling : parent.lastChild
  10501. ];
  10502. }
  10503. };
  10504. const TRANSITION$1 = "transition";
  10505. const ANIMATION = "animation";
  10506. const vtcKey = Symbol("_vtc");
  10507. const DOMTransitionPropsValidators = {
  10508. name: String,
  10509. type: String,
  10510. css: {
  10511. type: Boolean,
  10512. default: true
  10513. },
  10514. duration: [String, Number, Object],
  10515. enterFromClass: String,
  10516. enterActiveClass: String,
  10517. enterToClass: String,
  10518. appearFromClass: String,
  10519. appearActiveClass: String,
  10520. appearToClass: String,
  10521. leaveFromClass: String,
  10522. leaveActiveClass: String,
  10523. leaveToClass: String
  10524. };
  10525. const TransitionPropsValidators = /* @__PURE__ */ extend(
  10526. {},
  10527. BaseTransitionPropsValidators,
  10528. DOMTransitionPropsValidators
  10529. );
  10530. const decorate$1 = (t) => {
  10531. t.displayName = "Transition";
  10532. t.props = TransitionPropsValidators;
  10533. return t;
  10534. };
  10535. const Transition = /* @__PURE__ */ decorate$1(
  10536. (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
  10537. );
  10538. const callHook = (hook, args = []) => {
  10539. if (isArray(hook)) {
  10540. hook.forEach((h2) => h2(...args));
  10541. } else if (hook) {
  10542. hook(...args);
  10543. }
  10544. };
  10545. const hasExplicitCallback = (hook) => {
  10546. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  10547. };
  10548. function resolveTransitionProps(rawProps) {
  10549. const baseProps = {};
  10550. for (const key in rawProps) {
  10551. if (!(key in DOMTransitionPropsValidators)) {
  10552. baseProps[key] = rawProps[key];
  10553. }
  10554. }
  10555. if (rawProps.css === false) {
  10556. return baseProps;
  10557. }
  10558. const {
  10559. name = "v",
  10560. type,
  10561. duration,
  10562. enterFromClass = `${name}-enter-from`,
  10563. enterActiveClass = `${name}-enter-active`,
  10564. enterToClass = `${name}-enter-to`,
  10565. appearFromClass = enterFromClass,
  10566. appearActiveClass = enterActiveClass,
  10567. appearToClass = enterToClass,
  10568. leaveFromClass = `${name}-leave-from`,
  10569. leaveActiveClass = `${name}-leave-active`,
  10570. leaveToClass = `${name}-leave-to`
  10571. } = rawProps;
  10572. const durations = normalizeDuration(duration);
  10573. const enterDuration = durations && durations[0];
  10574. const leaveDuration = durations && durations[1];
  10575. const {
  10576. onBeforeEnter,
  10577. onEnter,
  10578. onEnterCancelled,
  10579. onLeave,
  10580. onLeaveCancelled,
  10581. onBeforeAppear = onBeforeEnter,
  10582. onAppear = onEnter,
  10583. onAppearCancelled = onEnterCancelled
  10584. } = baseProps;
  10585. const finishEnter = (el, isAppear, done, isCancelled) => {
  10586. el._enterCancelled = isCancelled;
  10587. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10588. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  10589. done && done();
  10590. };
  10591. const finishLeave = (el, done) => {
  10592. el._isLeaving = false;
  10593. removeTransitionClass(el, leaveFromClass);
  10594. removeTransitionClass(el, leaveToClass);
  10595. removeTransitionClass(el, leaveActiveClass);
  10596. done && done();
  10597. };
  10598. const makeEnterHook = (isAppear) => {
  10599. return (el, done) => {
  10600. const hook = isAppear ? onAppear : onEnter;
  10601. const resolve = () => finishEnter(el, isAppear, done);
  10602. callHook(hook, [el, resolve]);
  10603. nextFrame(() => {
  10604. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  10605. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10606. if (!hasExplicitCallback(hook)) {
  10607. whenTransitionEnds(el, type, enterDuration, resolve);
  10608. }
  10609. });
  10610. };
  10611. };
  10612. return extend(baseProps, {
  10613. onBeforeEnter(el) {
  10614. callHook(onBeforeEnter, [el]);
  10615. addTransitionClass(el, enterFromClass);
  10616. addTransitionClass(el, enterActiveClass);
  10617. },
  10618. onBeforeAppear(el) {
  10619. callHook(onBeforeAppear, [el]);
  10620. addTransitionClass(el, appearFromClass);
  10621. addTransitionClass(el, appearActiveClass);
  10622. },
  10623. onEnter: makeEnterHook(false),
  10624. onAppear: makeEnterHook(true),
  10625. onLeave(el, done) {
  10626. el._isLeaving = true;
  10627. const resolve = () => finishLeave(el, done);
  10628. addTransitionClass(el, leaveFromClass);
  10629. if (!el._enterCancelled) {
  10630. forceReflow();
  10631. addTransitionClass(el, leaveActiveClass);
  10632. } else {
  10633. addTransitionClass(el, leaveActiveClass);
  10634. forceReflow();
  10635. }
  10636. nextFrame(() => {
  10637. if (!el._isLeaving) {
  10638. return;
  10639. }
  10640. removeTransitionClass(el, leaveFromClass);
  10641. addTransitionClass(el, leaveToClass);
  10642. if (!hasExplicitCallback(onLeave)) {
  10643. whenTransitionEnds(el, type, leaveDuration, resolve);
  10644. }
  10645. });
  10646. callHook(onLeave, [el, resolve]);
  10647. },
  10648. onEnterCancelled(el) {
  10649. finishEnter(el, false, void 0, true);
  10650. callHook(onEnterCancelled, [el]);
  10651. },
  10652. onAppearCancelled(el) {
  10653. finishEnter(el, true, void 0, true);
  10654. callHook(onAppearCancelled, [el]);
  10655. },
  10656. onLeaveCancelled(el) {
  10657. finishLeave(el);
  10658. callHook(onLeaveCancelled, [el]);
  10659. }
  10660. });
  10661. }
  10662. function normalizeDuration(duration) {
  10663. if (duration == null) {
  10664. return null;
  10665. } else if (isObject(duration)) {
  10666. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  10667. } else {
  10668. const n = NumberOf(duration);
  10669. return [n, n];
  10670. }
  10671. }
  10672. function NumberOf(val) {
  10673. const res = toNumber(val);
  10674. {
  10675. assertNumber(res, "<transition> explicit duration");
  10676. }
  10677. return res;
  10678. }
  10679. function addTransitionClass(el, cls) {
  10680. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  10681. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  10682. }
  10683. function removeTransitionClass(el, cls) {
  10684. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  10685. const _vtc = el[vtcKey];
  10686. if (_vtc) {
  10687. _vtc.delete(cls);
  10688. if (!_vtc.size) {
  10689. el[vtcKey] = void 0;
  10690. }
  10691. }
  10692. }
  10693. function nextFrame(cb) {
  10694. requestAnimationFrame(() => {
  10695. requestAnimationFrame(cb);
  10696. });
  10697. }
  10698. let endId = 0;
  10699. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  10700. const id = el._endId = ++endId;
  10701. const resolveIfNotStale = () => {
  10702. if (id === el._endId) {
  10703. resolve();
  10704. }
  10705. };
  10706. if (explicitTimeout != null) {
  10707. return setTimeout(resolveIfNotStale, explicitTimeout);
  10708. }
  10709. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  10710. if (!type) {
  10711. return resolve();
  10712. }
  10713. const endEvent = type + "end";
  10714. let ended = 0;
  10715. const end = () => {
  10716. el.removeEventListener(endEvent, onEnd);
  10717. resolveIfNotStale();
  10718. };
  10719. const onEnd = (e) => {
  10720. if (e.target === el && ++ended >= propCount) {
  10721. end();
  10722. }
  10723. };
  10724. setTimeout(() => {
  10725. if (ended < propCount) {
  10726. end();
  10727. }
  10728. }, timeout + 1);
  10729. el.addEventListener(endEvent, onEnd);
  10730. }
  10731. function getTransitionInfo(el, expectedType) {
  10732. const styles = window.getComputedStyle(el);
  10733. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  10734. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  10735. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  10736. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  10737. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  10738. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  10739. const animationTimeout = getTimeout(animationDelays, animationDurations);
  10740. let type = null;
  10741. let timeout = 0;
  10742. let propCount = 0;
  10743. if (expectedType === TRANSITION$1) {
  10744. if (transitionTimeout > 0) {
  10745. type = TRANSITION$1;
  10746. timeout = transitionTimeout;
  10747. propCount = transitionDurations.length;
  10748. }
  10749. } else if (expectedType === ANIMATION) {
  10750. if (animationTimeout > 0) {
  10751. type = ANIMATION;
  10752. timeout = animationTimeout;
  10753. propCount = animationDurations.length;
  10754. }
  10755. } else {
  10756. timeout = Math.max(transitionTimeout, animationTimeout);
  10757. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  10758. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  10759. }
  10760. const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
  10761. getStyleProperties(`${TRANSITION$1}Property`).toString()
  10762. );
  10763. return {
  10764. type,
  10765. timeout,
  10766. propCount,
  10767. hasTransform
  10768. };
  10769. }
  10770. function getTimeout(delays, durations) {
  10771. while (delays.length < durations.length) {
  10772. delays = delays.concat(delays);
  10773. }
  10774. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  10775. }
  10776. function toMs(s) {
  10777. if (s === "auto") return 0;
  10778. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  10779. }
  10780. function forceReflow() {
  10781. return document.body.offsetHeight;
  10782. }
  10783. function patchClass(el, value, isSVG) {
  10784. const transitionClasses = el[vtcKey];
  10785. if (transitionClasses) {
  10786. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  10787. }
  10788. if (value == null) {
  10789. el.removeAttribute("class");
  10790. } else if (isSVG) {
  10791. el.setAttribute("class", value);
  10792. } else {
  10793. el.className = value;
  10794. }
  10795. }
  10796. const vShowOriginalDisplay = Symbol("_vod");
  10797. const vShowHidden = Symbol("_vsh");
  10798. const vShow = {
  10799. beforeMount(el, { value }, { transition }) {
  10800. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  10801. if (transition && value) {
  10802. transition.beforeEnter(el);
  10803. } else {
  10804. setDisplay(el, value);
  10805. }
  10806. },
  10807. mounted(el, { value }, { transition }) {
  10808. if (transition && value) {
  10809. transition.enter(el);
  10810. }
  10811. },
  10812. updated(el, { value, oldValue }, { transition }) {
  10813. if (!value === !oldValue) return;
  10814. if (transition) {
  10815. if (value) {
  10816. transition.beforeEnter(el);
  10817. setDisplay(el, true);
  10818. transition.enter(el);
  10819. } else {
  10820. transition.leave(el, () => {
  10821. setDisplay(el, false);
  10822. });
  10823. }
  10824. } else {
  10825. setDisplay(el, value);
  10826. }
  10827. },
  10828. beforeUnmount(el, { value }) {
  10829. setDisplay(el, value);
  10830. }
  10831. };
  10832. {
  10833. vShow.name = "show";
  10834. }
  10835. function setDisplay(el, value) {
  10836. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  10837. el[vShowHidden] = !value;
  10838. }
  10839. const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
  10840. function useCssVars(getter) {
  10841. const instance = getCurrentInstance();
  10842. if (!instance) {
  10843. warn(`useCssVars is called without current active component instance.`);
  10844. return;
  10845. }
  10846. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  10847. Array.from(
  10848. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  10849. ).forEach((node) => setVarsOnNode(node, vars));
  10850. };
  10851. {
  10852. instance.getCssVars = () => getter(instance.proxy);
  10853. }
  10854. const setVars = () => {
  10855. const vars = getter(instance.proxy);
  10856. if (instance.ce) {
  10857. setVarsOnNode(instance.ce, vars);
  10858. } else {
  10859. setVarsOnVNode(instance.subTree, vars);
  10860. }
  10861. updateTeleports(vars);
  10862. };
  10863. onBeforeUpdate(() => {
  10864. queuePostFlushCb(setVars);
  10865. });
  10866. onMounted(() => {
  10867. watch(setVars, NOOP, { flush: "post" });
  10868. const ob = new MutationObserver(setVars);
  10869. ob.observe(instance.subTree.el.parentNode, { childList: true });
  10870. onUnmounted(() => ob.disconnect());
  10871. });
  10872. }
  10873. function setVarsOnVNode(vnode, vars) {
  10874. if (vnode.shapeFlag & 128) {
  10875. const suspense = vnode.suspense;
  10876. vnode = suspense.activeBranch;
  10877. if (suspense.pendingBranch && !suspense.isHydrating) {
  10878. suspense.effects.push(() => {
  10879. setVarsOnVNode(suspense.activeBranch, vars);
  10880. });
  10881. }
  10882. }
  10883. while (vnode.component) {
  10884. vnode = vnode.component.subTree;
  10885. }
  10886. if (vnode.shapeFlag & 1 && vnode.el) {
  10887. setVarsOnNode(vnode.el, vars);
  10888. } else if (vnode.type === Fragment) {
  10889. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  10890. } else if (vnode.type === Static) {
  10891. let { el, anchor } = vnode;
  10892. while (el) {
  10893. setVarsOnNode(el, vars);
  10894. if (el === anchor) break;
  10895. el = el.nextSibling;
  10896. }
  10897. }
  10898. }
  10899. function setVarsOnNode(el, vars) {
  10900. if (el.nodeType === 1) {
  10901. const style = el.style;
  10902. let cssText = "";
  10903. for (const key in vars) {
  10904. style.setProperty(`--${key}`, vars[key]);
  10905. cssText += `--${key}: ${vars[key]};`;
  10906. }
  10907. style[CSS_VAR_TEXT] = cssText;
  10908. }
  10909. }
  10910. const displayRE = /(^|;)\s*display\s*:/;
  10911. function patchStyle(el, prev, next) {
  10912. const style = el.style;
  10913. const isCssString = isString(next);
  10914. let hasControlledDisplay = false;
  10915. if (next && !isCssString) {
  10916. if (prev) {
  10917. if (!isString(prev)) {
  10918. for (const key in prev) {
  10919. if (next[key] == null) {
  10920. setStyle(style, key, "");
  10921. }
  10922. }
  10923. } else {
  10924. for (const prevStyle of prev.split(";")) {
  10925. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  10926. if (next[key] == null) {
  10927. setStyle(style, key, "");
  10928. }
  10929. }
  10930. }
  10931. }
  10932. for (const key in next) {
  10933. if (key === "display") {
  10934. hasControlledDisplay = true;
  10935. }
  10936. setStyle(style, key, next[key]);
  10937. }
  10938. } else {
  10939. if (isCssString) {
  10940. if (prev !== next) {
  10941. const cssVarText = style[CSS_VAR_TEXT];
  10942. if (cssVarText) {
  10943. next += ";" + cssVarText;
  10944. }
  10945. style.cssText = next;
  10946. hasControlledDisplay = displayRE.test(next);
  10947. }
  10948. } else if (prev) {
  10949. el.removeAttribute("style");
  10950. }
  10951. }
  10952. if (vShowOriginalDisplay in el) {
  10953. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  10954. if (el[vShowHidden]) {
  10955. style.display = "none";
  10956. }
  10957. }
  10958. }
  10959. const semicolonRE = /[^\\];\s*$/;
  10960. const importantRE = /\s*!important$/;
  10961. function setStyle(style, name, val) {
  10962. if (isArray(val)) {
  10963. val.forEach((v) => setStyle(style, name, v));
  10964. } else {
  10965. if (val == null) val = "";
  10966. {
  10967. if (semicolonRE.test(val)) {
  10968. warn(
  10969. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  10970. );
  10971. }
  10972. }
  10973. if (name.startsWith("--")) {
  10974. style.setProperty(name, val);
  10975. } else {
  10976. const prefixed = autoPrefix(style, name);
  10977. if (importantRE.test(val)) {
  10978. style.setProperty(
  10979. hyphenate(prefixed),
  10980. val.replace(importantRE, ""),
  10981. "important"
  10982. );
  10983. } else {
  10984. style[prefixed] = val;
  10985. }
  10986. }
  10987. }
  10988. }
  10989. const prefixes = ["Webkit", "Moz", "ms"];
  10990. const prefixCache = {};
  10991. function autoPrefix(style, rawName) {
  10992. const cached = prefixCache[rawName];
  10993. if (cached) {
  10994. return cached;
  10995. }
  10996. let name = camelize(rawName);
  10997. if (name !== "filter" && name in style) {
  10998. return prefixCache[rawName] = name;
  10999. }
  11000. name = capitalize(name);
  11001. for (let i = 0; i < prefixes.length; i++) {
  11002. const prefixed = prefixes[i] + name;
  11003. if (prefixed in style) {
  11004. return prefixCache[rawName] = prefixed;
  11005. }
  11006. }
  11007. return rawName;
  11008. }
  11009. const xlinkNS = "http://www.w3.org/1999/xlink";
  11010. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  11011. if (isSVG && key.startsWith("xlink:")) {
  11012. if (value == null) {
  11013. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  11014. } else {
  11015. el.setAttributeNS(xlinkNS, key, value);
  11016. }
  11017. } else {
  11018. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  11019. el.removeAttribute(key);
  11020. } else {
  11021. el.setAttribute(
  11022. key,
  11023. isBoolean ? "" : isSymbol(value) ? String(value) : value
  11024. );
  11025. }
  11026. }
  11027. }
  11028. function patchDOMProp(el, key, value, parentComponent, attrName) {
  11029. if (key === "innerHTML" || key === "textContent") {
  11030. if (value != null) {
  11031. el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
  11032. }
  11033. return;
  11034. }
  11035. const tag = el.tagName;
  11036. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  11037. !tag.includes("-")) {
  11038. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  11039. const newValue = value == null ? (
  11040. // #11647: value should be set as empty string for null and undefined,
  11041. // but <input type="checkbox"> should be set as 'on'.
  11042. el.type === "checkbox" ? "on" : ""
  11043. ) : String(value);
  11044. if (oldValue !== newValue || !("_value" in el)) {
  11045. el.value = newValue;
  11046. }
  11047. if (value == null) {
  11048. el.removeAttribute(key);
  11049. }
  11050. el._value = value;
  11051. return;
  11052. }
  11053. let needRemove = false;
  11054. if (value === "" || value == null) {
  11055. const type = typeof el[key];
  11056. if (type === "boolean") {
  11057. value = includeBooleanAttr(value);
  11058. } else if (value == null && type === "string") {
  11059. value = "";
  11060. needRemove = true;
  11061. } else if (type === "number") {
  11062. value = 0;
  11063. needRemove = true;
  11064. }
  11065. }
  11066. try {
  11067. el[key] = value;
  11068. } catch (e) {
  11069. if (!needRemove) {
  11070. warn(
  11071. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  11072. e
  11073. );
  11074. }
  11075. }
  11076. needRemove && el.removeAttribute(attrName || key);
  11077. }
  11078. function addEventListener(el, event, handler, options) {
  11079. el.addEventListener(event, handler, options);
  11080. }
  11081. function removeEventListener(el, event, handler, options) {
  11082. el.removeEventListener(event, handler, options);
  11083. }
  11084. const veiKey = Symbol("_vei");
  11085. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  11086. const invokers = el[veiKey] || (el[veiKey] = {});
  11087. const existingInvoker = invokers[rawName];
  11088. if (nextValue && existingInvoker) {
  11089. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  11090. } else {
  11091. const [name, options] = parseName(rawName);
  11092. if (nextValue) {
  11093. const invoker = invokers[rawName] = createInvoker(
  11094. sanitizeEventValue(nextValue, rawName) ,
  11095. instance
  11096. );
  11097. addEventListener(el, name, invoker, options);
  11098. } else if (existingInvoker) {
  11099. removeEventListener(el, name, existingInvoker, options);
  11100. invokers[rawName] = void 0;
  11101. }
  11102. }
  11103. }
  11104. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  11105. function parseName(name) {
  11106. let options;
  11107. if (optionsModifierRE.test(name)) {
  11108. options = {};
  11109. let m;
  11110. while (m = name.match(optionsModifierRE)) {
  11111. name = name.slice(0, name.length - m[0].length);
  11112. options[m[0].toLowerCase()] = true;
  11113. }
  11114. }
  11115. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  11116. return [event, options];
  11117. }
  11118. let cachedNow = 0;
  11119. const p = /* @__PURE__ */ Promise.resolve();
  11120. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  11121. function createInvoker(initialValue, instance) {
  11122. const invoker = (e) => {
  11123. if (!e._vts) {
  11124. e._vts = Date.now();
  11125. } else if (e._vts <= invoker.attached) {
  11126. return;
  11127. }
  11128. callWithAsyncErrorHandling(
  11129. patchStopImmediatePropagation(e, invoker.value),
  11130. instance,
  11131. 5,
  11132. [e]
  11133. );
  11134. };
  11135. invoker.value = initialValue;
  11136. invoker.attached = getNow();
  11137. return invoker;
  11138. }
  11139. function sanitizeEventValue(value, propName) {
  11140. if (isFunction(value) || isArray(value)) {
  11141. return value;
  11142. }
  11143. warn(
  11144. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  11145. Expected function or array of functions, received type ${typeof value}.`
  11146. );
  11147. return NOOP;
  11148. }
  11149. function patchStopImmediatePropagation(e, value) {
  11150. if (isArray(value)) {
  11151. const originalStop = e.stopImmediatePropagation;
  11152. e.stopImmediatePropagation = () => {
  11153. originalStop.call(e);
  11154. e._stopped = true;
  11155. };
  11156. return value.map(
  11157. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  11158. );
  11159. } else {
  11160. return value;
  11161. }
  11162. }
  11163. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  11164. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  11165. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  11166. const isSVG = namespace === "svg";
  11167. if (key === "class") {
  11168. patchClass(el, nextValue, isSVG);
  11169. } else if (key === "style") {
  11170. patchStyle(el, prevValue, nextValue);
  11171. } else if (isOn(key)) {
  11172. if (!isModelListener(key)) {
  11173. patchEvent(el, key, prevValue, nextValue, parentComponent);
  11174. }
  11175. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  11176. patchDOMProp(el, key, nextValue);
  11177. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  11178. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  11179. }
  11180. } else if (
  11181. // #11081 force set props for possible async custom element
  11182. el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
  11183. ) {
  11184. patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
  11185. } else {
  11186. if (key === "true-value") {
  11187. el._trueValue = nextValue;
  11188. } else if (key === "false-value") {
  11189. el._falseValue = nextValue;
  11190. }
  11191. patchAttr(el, key, nextValue, isSVG);
  11192. }
  11193. };
  11194. function shouldSetAsProp(el, key, value, isSVG) {
  11195. if (isSVG) {
  11196. if (key === "innerHTML" || key === "textContent") {
  11197. return true;
  11198. }
  11199. if (key in el && isNativeOn(key) && isFunction(value)) {
  11200. return true;
  11201. }
  11202. return false;
  11203. }
  11204. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  11205. return false;
  11206. }
  11207. if (key === "form") {
  11208. return false;
  11209. }
  11210. if (key === "list" && el.tagName === "INPUT") {
  11211. return false;
  11212. }
  11213. if (key === "type" && el.tagName === "TEXTAREA") {
  11214. return false;
  11215. }
  11216. if (key === "width" || key === "height") {
  11217. const tag = el.tagName;
  11218. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  11219. return false;
  11220. }
  11221. }
  11222. if (isNativeOn(key) && isString(value)) {
  11223. return false;
  11224. }
  11225. return key in el;
  11226. }
  11227. const REMOVAL = {};
  11228. /*! #__NO_SIDE_EFFECTS__ */
  11229. // @__NO_SIDE_EFFECTS__
  11230. function defineCustomElement(options, extraOptions, _createApp) {
  11231. const Comp = defineComponent(options, extraOptions);
  11232. if (isPlainObject(Comp)) extend(Comp, extraOptions);
  11233. class VueCustomElement extends VueElement {
  11234. constructor(initialProps) {
  11235. super(Comp, initialProps, _createApp);
  11236. }
  11237. }
  11238. VueCustomElement.def = Comp;
  11239. return VueCustomElement;
  11240. }
  11241. /*! #__NO_SIDE_EFFECTS__ */
  11242. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  11243. return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
  11244. };
  11245. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  11246. };
  11247. class VueElement extends BaseClass {
  11248. constructor(_def, _props = {}, _createApp = createApp) {
  11249. super();
  11250. this._def = _def;
  11251. this._props = _props;
  11252. this._createApp = _createApp;
  11253. this._isVueCE = true;
  11254. /**
  11255. * @internal
  11256. */
  11257. this._instance = null;
  11258. /**
  11259. * @internal
  11260. */
  11261. this._app = null;
  11262. /**
  11263. * @internal
  11264. */
  11265. this._nonce = this._def.nonce;
  11266. this._connected = false;
  11267. this._resolved = false;
  11268. this._numberProps = null;
  11269. this._styleChildren = /* @__PURE__ */ new WeakSet();
  11270. this._ob = null;
  11271. if (this.shadowRoot && _createApp !== createApp) {
  11272. this._root = this.shadowRoot;
  11273. } else {
  11274. if (this.shadowRoot) {
  11275. warn(
  11276. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  11277. );
  11278. }
  11279. if (_def.shadowRoot !== false) {
  11280. this.attachShadow({ mode: "open" });
  11281. this._root = this.shadowRoot;
  11282. } else {
  11283. this._root = this;
  11284. }
  11285. }
  11286. if (!this._def.__asyncLoader) {
  11287. this._resolveProps(this._def);
  11288. }
  11289. }
  11290. connectedCallback() {
  11291. if (!this.isConnected) return;
  11292. if (!this.shadowRoot) {
  11293. this._parseSlots();
  11294. }
  11295. this._connected = true;
  11296. let parent = this;
  11297. while (parent = parent && (parent.parentNode || parent.host)) {
  11298. if (parent instanceof VueElement) {
  11299. this._parent = parent;
  11300. break;
  11301. }
  11302. }
  11303. if (!this._instance) {
  11304. if (this._resolved) {
  11305. this._setParent();
  11306. this._update();
  11307. } else {
  11308. if (parent && parent._pendingResolve) {
  11309. this._pendingResolve = parent._pendingResolve.then(() => {
  11310. this._pendingResolve = void 0;
  11311. this._resolveDef();
  11312. });
  11313. } else {
  11314. this._resolveDef();
  11315. }
  11316. }
  11317. }
  11318. }
  11319. _setParent(parent = this._parent) {
  11320. if (parent) {
  11321. this._instance.parent = parent._instance;
  11322. this._instance.provides = parent._instance.provides;
  11323. }
  11324. }
  11325. disconnectedCallback() {
  11326. this._connected = false;
  11327. nextTick(() => {
  11328. if (!this._connected) {
  11329. if (this._ob) {
  11330. this._ob.disconnect();
  11331. this._ob = null;
  11332. }
  11333. this._app && this._app.unmount();
  11334. if (this._instance) this._instance.ce = void 0;
  11335. this._app = this._instance = null;
  11336. }
  11337. });
  11338. }
  11339. /**
  11340. * resolve inner component definition (handle possible async component)
  11341. */
  11342. _resolveDef() {
  11343. if (this._pendingResolve) {
  11344. return;
  11345. }
  11346. for (let i = 0; i < this.attributes.length; i++) {
  11347. this._setAttr(this.attributes[i].name);
  11348. }
  11349. this._ob = new MutationObserver((mutations) => {
  11350. for (const m of mutations) {
  11351. this._setAttr(m.attributeName);
  11352. }
  11353. });
  11354. this._ob.observe(this, { attributes: true });
  11355. const resolve = (def, isAsync = false) => {
  11356. this._resolved = true;
  11357. this._pendingResolve = void 0;
  11358. const { props, styles } = def;
  11359. let numberProps;
  11360. if (props && !isArray(props)) {
  11361. for (const key in props) {
  11362. const opt = props[key];
  11363. if (opt === Number || opt && opt.type === Number) {
  11364. if (key in this._props) {
  11365. this._props[key] = toNumber(this._props[key]);
  11366. }
  11367. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  11368. }
  11369. }
  11370. }
  11371. this._numberProps = numberProps;
  11372. if (isAsync) {
  11373. this._resolveProps(def);
  11374. }
  11375. if (this.shadowRoot) {
  11376. this._applyStyles(styles);
  11377. } else if (styles) {
  11378. warn(
  11379. "Custom element style injection is not supported when using shadowRoot: false"
  11380. );
  11381. }
  11382. this._mount(def);
  11383. };
  11384. const asyncDef = this._def.__asyncLoader;
  11385. if (asyncDef) {
  11386. this._pendingResolve = asyncDef().then(
  11387. (def) => resolve(this._def = def, true)
  11388. );
  11389. } else {
  11390. resolve(this._def);
  11391. }
  11392. }
  11393. _mount(def) {
  11394. if (!def.name) {
  11395. def.name = "VueElement";
  11396. }
  11397. this._app = this._createApp(def);
  11398. if (def.configureApp) {
  11399. def.configureApp(this._app);
  11400. }
  11401. this._app._ceVNode = this._createVNode();
  11402. this._app.mount(this._root);
  11403. const exposed = this._instance && this._instance.exposed;
  11404. if (!exposed) return;
  11405. for (const key in exposed) {
  11406. if (!hasOwn(this, key)) {
  11407. Object.defineProperty(this, key, {
  11408. // unwrap ref to be consistent with public instance behavior
  11409. get: () => unref(exposed[key])
  11410. });
  11411. } else {
  11412. warn(`Exposed property "${key}" already exists on custom element.`);
  11413. }
  11414. }
  11415. }
  11416. _resolveProps(def) {
  11417. const { props } = def;
  11418. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  11419. for (const key of Object.keys(this)) {
  11420. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  11421. this._setProp(key, this[key]);
  11422. }
  11423. }
  11424. for (const key of declaredPropKeys.map(camelize)) {
  11425. Object.defineProperty(this, key, {
  11426. get() {
  11427. return this._getProp(key);
  11428. },
  11429. set(val) {
  11430. this._setProp(key, val, true, true);
  11431. }
  11432. });
  11433. }
  11434. }
  11435. _setAttr(key) {
  11436. if (key.startsWith("data-v-")) return;
  11437. const has = this.hasAttribute(key);
  11438. let value = has ? this.getAttribute(key) : REMOVAL;
  11439. const camelKey = camelize(key);
  11440. if (has && this._numberProps && this._numberProps[camelKey]) {
  11441. value = toNumber(value);
  11442. }
  11443. this._setProp(camelKey, value, false, true);
  11444. }
  11445. /**
  11446. * @internal
  11447. */
  11448. _getProp(key) {
  11449. return this._props[key];
  11450. }
  11451. /**
  11452. * @internal
  11453. */
  11454. _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
  11455. if (val !== this._props[key]) {
  11456. if (val === REMOVAL) {
  11457. delete this._props[key];
  11458. } else {
  11459. this._props[key] = val;
  11460. if (key === "key" && this._app) {
  11461. this._app._ceVNode.key = val;
  11462. }
  11463. }
  11464. if (shouldUpdate && this._instance) {
  11465. this._update();
  11466. }
  11467. if (shouldReflect) {
  11468. const ob = this._ob;
  11469. ob && ob.disconnect();
  11470. if (val === true) {
  11471. this.setAttribute(hyphenate(key), "");
  11472. } else if (typeof val === "string" || typeof val === "number") {
  11473. this.setAttribute(hyphenate(key), val + "");
  11474. } else if (!val) {
  11475. this.removeAttribute(hyphenate(key));
  11476. }
  11477. ob && ob.observe(this, { attributes: true });
  11478. }
  11479. }
  11480. }
  11481. _update() {
  11482. render(this._createVNode(), this._root);
  11483. }
  11484. _createVNode() {
  11485. const baseProps = {};
  11486. if (!this.shadowRoot) {
  11487. baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
  11488. }
  11489. const vnode = createVNode(this._def, extend(baseProps, this._props));
  11490. if (!this._instance) {
  11491. vnode.ce = (instance) => {
  11492. this._instance = instance;
  11493. instance.ce = this;
  11494. instance.isCE = true;
  11495. {
  11496. instance.ceReload = (newStyles) => {
  11497. if (this._styles) {
  11498. this._styles.forEach((s) => this._root.removeChild(s));
  11499. this._styles.length = 0;
  11500. }
  11501. this._applyStyles(newStyles);
  11502. this._instance = null;
  11503. this._update();
  11504. };
  11505. }
  11506. const dispatch = (event, args) => {
  11507. this.dispatchEvent(
  11508. new CustomEvent(
  11509. event,
  11510. isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
  11511. )
  11512. );
  11513. };
  11514. instance.emit = (event, ...args) => {
  11515. dispatch(event, args);
  11516. if (hyphenate(event) !== event) {
  11517. dispatch(hyphenate(event), args);
  11518. }
  11519. };
  11520. this._setParent();
  11521. };
  11522. }
  11523. return vnode;
  11524. }
  11525. _applyStyles(styles, owner) {
  11526. if (!styles) return;
  11527. if (owner) {
  11528. if (owner === this._def || this._styleChildren.has(owner)) {
  11529. return;
  11530. }
  11531. this._styleChildren.add(owner);
  11532. }
  11533. const nonce = this._nonce;
  11534. for (let i = styles.length - 1; i >= 0; i--) {
  11535. const s = document.createElement("style");
  11536. if (nonce) s.setAttribute("nonce", nonce);
  11537. s.textContent = styles[i];
  11538. this.shadowRoot.prepend(s);
  11539. {
  11540. if (owner) {
  11541. if (owner.__hmrId) {
  11542. if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
  11543. let entry = this._childStyles.get(owner.__hmrId);
  11544. if (!entry) {
  11545. this._childStyles.set(owner.__hmrId, entry = []);
  11546. }
  11547. entry.push(s);
  11548. }
  11549. } else {
  11550. (this._styles || (this._styles = [])).push(s);
  11551. }
  11552. }
  11553. }
  11554. }
  11555. /**
  11556. * Only called when shadowRoot is false
  11557. */
  11558. _parseSlots() {
  11559. const slots = this._slots = {};
  11560. let n;
  11561. while (n = this.firstChild) {
  11562. const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
  11563. (slots[slotName] || (slots[slotName] = [])).push(n);
  11564. this.removeChild(n);
  11565. }
  11566. }
  11567. /**
  11568. * Only called when shadowRoot is false
  11569. */
  11570. _renderSlots() {
  11571. const outlets = (this._teleportTarget || this).querySelectorAll("slot");
  11572. const scopeId = this._instance.type.__scopeId;
  11573. for (let i = 0; i < outlets.length; i++) {
  11574. const o = outlets[i];
  11575. const slotName = o.getAttribute("name") || "default";
  11576. const content = this._slots[slotName];
  11577. const parent = o.parentNode;
  11578. if (content) {
  11579. for (const n of content) {
  11580. if (scopeId && n.nodeType === 1) {
  11581. const id = scopeId + "-s";
  11582. const walker = document.createTreeWalker(n, 1);
  11583. n.setAttribute(id, "");
  11584. let child;
  11585. while (child = walker.nextNode()) {
  11586. child.setAttribute(id, "");
  11587. }
  11588. }
  11589. parent.insertBefore(n, o);
  11590. }
  11591. } else {
  11592. while (o.firstChild) parent.insertBefore(o.firstChild, o);
  11593. }
  11594. parent.removeChild(o);
  11595. }
  11596. }
  11597. /**
  11598. * @internal
  11599. */
  11600. _injectChildStyle(comp) {
  11601. this._applyStyles(comp.styles, comp);
  11602. }
  11603. /**
  11604. * @internal
  11605. */
  11606. _removeChildStyle(comp) {
  11607. {
  11608. this._styleChildren.delete(comp);
  11609. if (this._childStyles && comp.__hmrId) {
  11610. const oldStyles = this._childStyles.get(comp.__hmrId);
  11611. if (oldStyles) {
  11612. oldStyles.forEach((s) => this._root.removeChild(s));
  11613. oldStyles.length = 0;
  11614. }
  11615. }
  11616. }
  11617. }
  11618. }
  11619. function useHost(caller) {
  11620. const instance = getCurrentInstance();
  11621. const el = instance && instance.ce;
  11622. if (el) {
  11623. return el;
  11624. } else {
  11625. if (!instance) {
  11626. warn(
  11627. `${caller || "useHost"} called without an active component instance.`
  11628. );
  11629. } else {
  11630. warn(
  11631. `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
  11632. );
  11633. }
  11634. }
  11635. return null;
  11636. }
  11637. function useShadowRoot() {
  11638. const el = useHost("useShadowRoot") ;
  11639. return el && el.shadowRoot;
  11640. }
  11641. function useCssModule(name = "$style") {
  11642. {
  11643. {
  11644. warn(`useCssModule() is not supported in the global build.`);
  11645. }
  11646. return EMPTY_OBJ;
  11647. }
  11648. }
  11649. const positionMap = /* @__PURE__ */ new WeakMap();
  11650. const newPositionMap = /* @__PURE__ */ new WeakMap();
  11651. const moveCbKey = Symbol("_moveCb");
  11652. const enterCbKey = Symbol("_enterCb");
  11653. const decorate = (t) => {
  11654. delete t.props.mode;
  11655. return t;
  11656. };
  11657. const TransitionGroupImpl = /* @__PURE__ */ decorate({
  11658. name: "TransitionGroup",
  11659. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  11660. tag: String,
  11661. moveClass: String
  11662. }),
  11663. setup(props, { slots }) {
  11664. const instance = getCurrentInstance();
  11665. const state = useTransitionState();
  11666. let prevChildren;
  11667. let children;
  11668. onUpdated(() => {
  11669. if (!prevChildren.length) {
  11670. return;
  11671. }
  11672. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  11673. if (!hasCSSTransform(
  11674. prevChildren[0].el,
  11675. instance.vnode.el,
  11676. moveClass
  11677. )) {
  11678. return;
  11679. }
  11680. prevChildren.forEach(callPendingCbs);
  11681. prevChildren.forEach(recordPosition);
  11682. const movedChildren = prevChildren.filter(applyTranslation);
  11683. forceReflow();
  11684. movedChildren.forEach((c) => {
  11685. const el = c.el;
  11686. const style = el.style;
  11687. addTransitionClass(el, moveClass);
  11688. style.transform = style.webkitTransform = style.transitionDuration = "";
  11689. const cb = el[moveCbKey] = (e) => {
  11690. if (e && e.target !== el) {
  11691. return;
  11692. }
  11693. if (!e || /transform$/.test(e.propertyName)) {
  11694. el.removeEventListener("transitionend", cb);
  11695. el[moveCbKey] = null;
  11696. removeTransitionClass(el, moveClass);
  11697. }
  11698. };
  11699. el.addEventListener("transitionend", cb);
  11700. });
  11701. });
  11702. return () => {
  11703. const rawProps = toRaw(props);
  11704. const cssTransitionProps = resolveTransitionProps(rawProps);
  11705. let tag = rawProps.tag || Fragment;
  11706. prevChildren = [];
  11707. if (children) {
  11708. for (let i = 0; i < children.length; i++) {
  11709. const child = children[i];
  11710. if (child.el && child.el instanceof Element) {
  11711. prevChildren.push(child);
  11712. setTransitionHooks(
  11713. child,
  11714. resolveTransitionHooks(
  11715. child,
  11716. cssTransitionProps,
  11717. state,
  11718. instance
  11719. )
  11720. );
  11721. positionMap.set(
  11722. child,
  11723. child.el.getBoundingClientRect()
  11724. );
  11725. }
  11726. }
  11727. }
  11728. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  11729. for (let i = 0; i < children.length; i++) {
  11730. const child = children[i];
  11731. if (child.key != null) {
  11732. setTransitionHooks(
  11733. child,
  11734. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  11735. );
  11736. } else if (child.type !== Text) {
  11737. warn(`<TransitionGroup> children must be keyed.`);
  11738. }
  11739. }
  11740. return createVNode(tag, null, children);
  11741. };
  11742. }
  11743. });
  11744. const TransitionGroup = TransitionGroupImpl;
  11745. function callPendingCbs(c) {
  11746. const el = c.el;
  11747. if (el[moveCbKey]) {
  11748. el[moveCbKey]();
  11749. }
  11750. if (el[enterCbKey]) {
  11751. el[enterCbKey]();
  11752. }
  11753. }
  11754. function recordPosition(c) {
  11755. newPositionMap.set(c, c.el.getBoundingClientRect());
  11756. }
  11757. function applyTranslation(c) {
  11758. const oldPos = positionMap.get(c);
  11759. const newPos = newPositionMap.get(c);
  11760. const dx = oldPos.left - newPos.left;
  11761. const dy = oldPos.top - newPos.top;
  11762. if (dx || dy) {
  11763. const s = c.el.style;
  11764. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  11765. s.transitionDuration = "0s";
  11766. return c;
  11767. }
  11768. }
  11769. function hasCSSTransform(el, root, moveClass) {
  11770. const clone = el.cloneNode();
  11771. const _vtc = el[vtcKey];
  11772. if (_vtc) {
  11773. _vtc.forEach((cls) => {
  11774. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  11775. });
  11776. }
  11777. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  11778. clone.style.display = "none";
  11779. const container = root.nodeType === 1 ? root : root.parentNode;
  11780. container.appendChild(clone);
  11781. const { hasTransform } = getTransitionInfo(clone);
  11782. container.removeChild(clone);
  11783. return hasTransform;
  11784. }
  11785. const getModelAssigner = (vnode) => {
  11786. const fn = vnode.props["onUpdate:modelValue"] || false;
  11787. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  11788. };
  11789. function onCompositionStart(e) {
  11790. e.target.composing = true;
  11791. }
  11792. function onCompositionEnd(e) {
  11793. const target = e.target;
  11794. if (target.composing) {
  11795. target.composing = false;
  11796. target.dispatchEvent(new Event("input"));
  11797. }
  11798. }
  11799. const assignKey = Symbol("_assign");
  11800. const vModelText = {
  11801. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  11802. el[assignKey] = getModelAssigner(vnode);
  11803. const castToNumber = number || vnode.props && vnode.props.type === "number";
  11804. addEventListener(el, lazy ? "change" : "input", (e) => {
  11805. if (e.target.composing) return;
  11806. let domValue = el.value;
  11807. if (trim) {
  11808. domValue = domValue.trim();
  11809. }
  11810. if (castToNumber) {
  11811. domValue = looseToNumber(domValue);
  11812. }
  11813. el[assignKey](domValue);
  11814. });
  11815. if (trim) {
  11816. addEventListener(el, "change", () => {
  11817. el.value = el.value.trim();
  11818. });
  11819. }
  11820. if (!lazy) {
  11821. addEventListener(el, "compositionstart", onCompositionStart);
  11822. addEventListener(el, "compositionend", onCompositionEnd);
  11823. addEventListener(el, "change", onCompositionEnd);
  11824. }
  11825. },
  11826. // set value on mounted so it's after min/max for type="range"
  11827. mounted(el, { value }) {
  11828. el.value = value == null ? "" : value;
  11829. },
  11830. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  11831. el[assignKey] = getModelAssigner(vnode);
  11832. if (el.composing) return;
  11833. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  11834. const newValue = value == null ? "" : value;
  11835. if (elValue === newValue) {
  11836. return;
  11837. }
  11838. if (document.activeElement === el && el.type !== "range") {
  11839. if (lazy && value === oldValue) {
  11840. return;
  11841. }
  11842. if (trim && el.value.trim() === newValue) {
  11843. return;
  11844. }
  11845. }
  11846. el.value = newValue;
  11847. }
  11848. };
  11849. const vModelCheckbox = {
  11850. // #4096 array checkboxes need to be deep traversed
  11851. deep: true,
  11852. created(el, _, vnode) {
  11853. el[assignKey] = getModelAssigner(vnode);
  11854. addEventListener(el, "change", () => {
  11855. const modelValue = el._modelValue;
  11856. const elementValue = getValue(el);
  11857. const checked = el.checked;
  11858. const assign = el[assignKey];
  11859. if (isArray(modelValue)) {
  11860. const index = looseIndexOf(modelValue, elementValue);
  11861. const found = index !== -1;
  11862. if (checked && !found) {
  11863. assign(modelValue.concat(elementValue));
  11864. } else if (!checked && found) {
  11865. const filtered = [...modelValue];
  11866. filtered.splice(index, 1);
  11867. assign(filtered);
  11868. }
  11869. } else if (isSet(modelValue)) {
  11870. const cloned = new Set(modelValue);
  11871. if (checked) {
  11872. cloned.add(elementValue);
  11873. } else {
  11874. cloned.delete(elementValue);
  11875. }
  11876. assign(cloned);
  11877. } else {
  11878. assign(getCheckboxValue(el, checked));
  11879. }
  11880. });
  11881. },
  11882. // set initial checked on mount to wait for true-value/false-value
  11883. mounted: setChecked,
  11884. beforeUpdate(el, binding, vnode) {
  11885. el[assignKey] = getModelAssigner(vnode);
  11886. setChecked(el, binding, vnode);
  11887. }
  11888. };
  11889. function setChecked(el, { value, oldValue }, vnode) {
  11890. el._modelValue = value;
  11891. let checked;
  11892. if (isArray(value)) {
  11893. checked = looseIndexOf(value, vnode.props.value) > -1;
  11894. } else if (isSet(value)) {
  11895. checked = value.has(vnode.props.value);
  11896. } else {
  11897. if (value === oldValue) return;
  11898. checked = looseEqual(value, getCheckboxValue(el, true));
  11899. }
  11900. if (el.checked !== checked) {
  11901. el.checked = checked;
  11902. }
  11903. }
  11904. const vModelRadio = {
  11905. created(el, { value }, vnode) {
  11906. el.checked = looseEqual(value, vnode.props.value);
  11907. el[assignKey] = getModelAssigner(vnode);
  11908. addEventListener(el, "change", () => {
  11909. el[assignKey](getValue(el));
  11910. });
  11911. },
  11912. beforeUpdate(el, { value, oldValue }, vnode) {
  11913. el[assignKey] = getModelAssigner(vnode);
  11914. if (value !== oldValue) {
  11915. el.checked = looseEqual(value, vnode.props.value);
  11916. }
  11917. }
  11918. };
  11919. const vModelSelect = {
  11920. // <select multiple> value need to be deep traversed
  11921. deep: true,
  11922. created(el, { value, modifiers: { number } }, vnode) {
  11923. const isSetModel = isSet(value);
  11924. addEventListener(el, "change", () => {
  11925. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  11926. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  11927. );
  11928. el[assignKey](
  11929. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  11930. );
  11931. el._assigning = true;
  11932. nextTick(() => {
  11933. el._assigning = false;
  11934. });
  11935. });
  11936. el[assignKey] = getModelAssigner(vnode);
  11937. },
  11938. // set value in mounted & updated because <select> relies on its children
  11939. // <option>s.
  11940. mounted(el, { value }) {
  11941. setSelected(el, value);
  11942. },
  11943. beforeUpdate(el, _binding, vnode) {
  11944. el[assignKey] = getModelAssigner(vnode);
  11945. },
  11946. updated(el, { value }) {
  11947. if (!el._assigning) {
  11948. setSelected(el, value);
  11949. }
  11950. }
  11951. };
  11952. function setSelected(el, value) {
  11953. const isMultiple = el.multiple;
  11954. const isArrayValue = isArray(value);
  11955. if (isMultiple && !isArrayValue && !isSet(value)) {
  11956. warn(
  11957. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  11958. );
  11959. return;
  11960. }
  11961. for (let i = 0, l = el.options.length; i < l; i++) {
  11962. const option = el.options[i];
  11963. const optionValue = getValue(option);
  11964. if (isMultiple) {
  11965. if (isArrayValue) {
  11966. const optionType = typeof optionValue;
  11967. if (optionType === "string" || optionType === "number") {
  11968. option.selected = value.some((v) => String(v) === String(optionValue));
  11969. } else {
  11970. option.selected = looseIndexOf(value, optionValue) > -1;
  11971. }
  11972. } else {
  11973. option.selected = value.has(optionValue);
  11974. }
  11975. } else if (looseEqual(getValue(option), value)) {
  11976. if (el.selectedIndex !== i) el.selectedIndex = i;
  11977. return;
  11978. }
  11979. }
  11980. if (!isMultiple && el.selectedIndex !== -1) {
  11981. el.selectedIndex = -1;
  11982. }
  11983. }
  11984. function getValue(el) {
  11985. return "_value" in el ? el._value : el.value;
  11986. }
  11987. function getCheckboxValue(el, checked) {
  11988. const key = checked ? "_trueValue" : "_falseValue";
  11989. return key in el ? el[key] : checked;
  11990. }
  11991. const vModelDynamic = {
  11992. created(el, binding, vnode) {
  11993. callModelHook(el, binding, vnode, null, "created");
  11994. },
  11995. mounted(el, binding, vnode) {
  11996. callModelHook(el, binding, vnode, null, "mounted");
  11997. },
  11998. beforeUpdate(el, binding, vnode, prevVNode) {
  11999. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  12000. },
  12001. updated(el, binding, vnode, prevVNode) {
  12002. callModelHook(el, binding, vnode, prevVNode, "updated");
  12003. }
  12004. };
  12005. function resolveDynamicModel(tagName, type) {
  12006. switch (tagName) {
  12007. case "SELECT":
  12008. return vModelSelect;
  12009. case "TEXTAREA":
  12010. return vModelText;
  12011. default:
  12012. switch (type) {
  12013. case "checkbox":
  12014. return vModelCheckbox;
  12015. case "radio":
  12016. return vModelRadio;
  12017. default:
  12018. return vModelText;
  12019. }
  12020. }
  12021. }
  12022. function callModelHook(el, binding, vnode, prevVNode, hook) {
  12023. const modelToUse = resolveDynamicModel(
  12024. el.tagName,
  12025. vnode.props && vnode.props.type
  12026. );
  12027. const fn = modelToUse[hook];
  12028. fn && fn(el, binding, vnode, prevVNode);
  12029. }
  12030. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  12031. const modifierGuards = {
  12032. stop: (e) => e.stopPropagation(),
  12033. prevent: (e) => e.preventDefault(),
  12034. self: (e) => e.target !== e.currentTarget,
  12035. ctrl: (e) => !e.ctrlKey,
  12036. shift: (e) => !e.shiftKey,
  12037. alt: (e) => !e.altKey,
  12038. meta: (e) => !e.metaKey,
  12039. left: (e) => "button" in e && e.button !== 0,
  12040. middle: (e) => "button" in e && e.button !== 1,
  12041. right: (e) => "button" in e && e.button !== 2,
  12042. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  12043. };
  12044. const withModifiers = (fn, modifiers) => {
  12045. const cache = fn._withMods || (fn._withMods = {});
  12046. const cacheKey = modifiers.join(".");
  12047. return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
  12048. for (let i = 0; i < modifiers.length; i++) {
  12049. const guard = modifierGuards[modifiers[i]];
  12050. if (guard && guard(event, modifiers)) return;
  12051. }
  12052. return fn(event, ...args);
  12053. });
  12054. };
  12055. const keyNames = {
  12056. esc: "escape",
  12057. space: " ",
  12058. up: "arrow-up",
  12059. left: "arrow-left",
  12060. right: "arrow-right",
  12061. down: "arrow-down",
  12062. delete: "backspace"
  12063. };
  12064. const withKeys = (fn, modifiers) => {
  12065. const cache = fn._withKeys || (fn._withKeys = {});
  12066. const cacheKey = modifiers.join(".");
  12067. return cache[cacheKey] || (cache[cacheKey] = (event) => {
  12068. if (!("key" in event)) {
  12069. return;
  12070. }
  12071. const eventKey = hyphenate(event.key);
  12072. if (modifiers.some(
  12073. (k) => k === eventKey || keyNames[k] === eventKey
  12074. )) {
  12075. return fn(event);
  12076. }
  12077. });
  12078. };
  12079. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  12080. let renderer;
  12081. let enabledHydration = false;
  12082. function ensureRenderer() {
  12083. return renderer || (renderer = createRenderer(rendererOptions));
  12084. }
  12085. function ensureHydrationRenderer() {
  12086. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  12087. enabledHydration = true;
  12088. return renderer;
  12089. }
  12090. const render = (...args) => {
  12091. ensureRenderer().render(...args);
  12092. };
  12093. const hydrate = (...args) => {
  12094. ensureHydrationRenderer().hydrate(...args);
  12095. };
  12096. const createApp = (...args) => {
  12097. const app = ensureRenderer().createApp(...args);
  12098. {
  12099. injectNativeTagCheck(app);
  12100. injectCompilerOptionsCheck(app);
  12101. }
  12102. const { mount } = app;
  12103. app.mount = (containerOrSelector) => {
  12104. const container = normalizeContainer(containerOrSelector);
  12105. if (!container) return;
  12106. const component = app._component;
  12107. if (!isFunction(component) && !component.render && !component.template) {
  12108. component.template = container.innerHTML;
  12109. }
  12110. if (container.nodeType === 1) {
  12111. container.textContent = "";
  12112. }
  12113. const proxy = mount(container, false, resolveRootNamespace(container));
  12114. if (container instanceof Element) {
  12115. container.removeAttribute("v-cloak");
  12116. container.setAttribute("data-v-app", "");
  12117. }
  12118. return proxy;
  12119. };
  12120. return app;
  12121. };
  12122. const createSSRApp = (...args) => {
  12123. const app = ensureHydrationRenderer().createApp(...args);
  12124. {
  12125. injectNativeTagCheck(app);
  12126. injectCompilerOptionsCheck(app);
  12127. }
  12128. const { mount } = app;
  12129. app.mount = (containerOrSelector) => {
  12130. const container = normalizeContainer(containerOrSelector);
  12131. if (container) {
  12132. return mount(container, true, resolveRootNamespace(container));
  12133. }
  12134. };
  12135. return app;
  12136. };
  12137. function resolveRootNamespace(container) {
  12138. if (container instanceof SVGElement) {
  12139. return "svg";
  12140. }
  12141. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  12142. return "mathml";
  12143. }
  12144. }
  12145. function injectNativeTagCheck(app) {
  12146. Object.defineProperty(app.config, "isNativeTag", {
  12147. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  12148. writable: false
  12149. });
  12150. }
  12151. function injectCompilerOptionsCheck(app) {
  12152. if (isRuntimeOnly()) {
  12153. const isCustomElement = app.config.isCustomElement;
  12154. Object.defineProperty(app.config, "isCustomElement", {
  12155. get() {
  12156. return isCustomElement;
  12157. },
  12158. set() {
  12159. warn(
  12160. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  12161. );
  12162. }
  12163. });
  12164. const compilerOptions = app.config.compilerOptions;
  12165. const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead.
  12166. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  12167. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  12168. - For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc`;
  12169. Object.defineProperty(app.config, "compilerOptions", {
  12170. get() {
  12171. warn(msg);
  12172. return compilerOptions;
  12173. },
  12174. set() {
  12175. warn(msg);
  12176. }
  12177. });
  12178. }
  12179. }
  12180. function normalizeContainer(container) {
  12181. if (isString(container)) {
  12182. const res = document.querySelector(container);
  12183. if (!res) {
  12184. warn(
  12185. `Failed to mount app: mount target selector "${container}" returned null.`
  12186. );
  12187. }
  12188. return res;
  12189. }
  12190. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  12191. warn(
  12192. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  12193. );
  12194. }
  12195. return container;
  12196. }
  12197. const initDirectivesForSSR = NOOP;
  12198. function initDev() {
  12199. {
  12200. {
  12201. console.info(
  12202. `You are running a development build of Vue.
  12203. Make sure to use the production build (*.prod.js) when deploying for production.`
  12204. );
  12205. }
  12206. initCustomFormatter();
  12207. }
  12208. }
  12209. const FRAGMENT = Symbol(`Fragment` );
  12210. const TELEPORT = Symbol(`Teleport` );
  12211. const SUSPENSE = Symbol(`Suspense` );
  12212. const KEEP_ALIVE = Symbol(`KeepAlive` );
  12213. const BASE_TRANSITION = Symbol(
  12214. `BaseTransition`
  12215. );
  12216. const OPEN_BLOCK = Symbol(`openBlock` );
  12217. const CREATE_BLOCK = Symbol(`createBlock` );
  12218. const CREATE_ELEMENT_BLOCK = Symbol(
  12219. `createElementBlock`
  12220. );
  12221. const CREATE_VNODE = Symbol(`createVNode` );
  12222. const CREATE_ELEMENT_VNODE = Symbol(
  12223. `createElementVNode`
  12224. );
  12225. const CREATE_COMMENT = Symbol(
  12226. `createCommentVNode`
  12227. );
  12228. const CREATE_TEXT = Symbol(
  12229. `createTextVNode`
  12230. );
  12231. const CREATE_STATIC = Symbol(
  12232. `createStaticVNode`
  12233. );
  12234. const RESOLVE_COMPONENT = Symbol(
  12235. `resolveComponent`
  12236. );
  12237. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  12238. `resolveDynamicComponent`
  12239. );
  12240. const RESOLVE_DIRECTIVE = Symbol(
  12241. `resolveDirective`
  12242. );
  12243. const RESOLVE_FILTER = Symbol(
  12244. `resolveFilter`
  12245. );
  12246. const WITH_DIRECTIVES = Symbol(
  12247. `withDirectives`
  12248. );
  12249. const RENDER_LIST = Symbol(`renderList` );
  12250. const RENDER_SLOT = Symbol(`renderSlot` );
  12251. const CREATE_SLOTS = Symbol(`createSlots` );
  12252. const TO_DISPLAY_STRING = Symbol(
  12253. `toDisplayString`
  12254. );
  12255. const MERGE_PROPS = Symbol(`mergeProps` );
  12256. const NORMALIZE_CLASS = Symbol(
  12257. `normalizeClass`
  12258. );
  12259. const NORMALIZE_STYLE = Symbol(
  12260. `normalizeStyle`
  12261. );
  12262. const NORMALIZE_PROPS = Symbol(
  12263. `normalizeProps`
  12264. );
  12265. const GUARD_REACTIVE_PROPS = Symbol(
  12266. `guardReactiveProps`
  12267. );
  12268. const TO_HANDLERS = Symbol(`toHandlers` );
  12269. const CAMELIZE = Symbol(`camelize` );
  12270. const CAPITALIZE = Symbol(`capitalize` );
  12271. const TO_HANDLER_KEY = Symbol(
  12272. `toHandlerKey`
  12273. );
  12274. const SET_BLOCK_TRACKING = Symbol(
  12275. `setBlockTracking`
  12276. );
  12277. const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
  12278. const POP_SCOPE_ID = Symbol(`popScopeId` );
  12279. const WITH_CTX = Symbol(`withCtx` );
  12280. const UNREF = Symbol(`unref` );
  12281. const IS_REF = Symbol(`isRef` );
  12282. const WITH_MEMO = Symbol(`withMemo` );
  12283. const IS_MEMO_SAME = Symbol(`isMemoSame` );
  12284. const helperNameMap = {
  12285. [FRAGMENT]: `Fragment`,
  12286. [TELEPORT]: `Teleport`,
  12287. [SUSPENSE]: `Suspense`,
  12288. [KEEP_ALIVE]: `KeepAlive`,
  12289. [BASE_TRANSITION]: `BaseTransition`,
  12290. [OPEN_BLOCK]: `openBlock`,
  12291. [CREATE_BLOCK]: `createBlock`,
  12292. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  12293. [CREATE_VNODE]: `createVNode`,
  12294. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  12295. [CREATE_COMMENT]: `createCommentVNode`,
  12296. [CREATE_TEXT]: `createTextVNode`,
  12297. [CREATE_STATIC]: `createStaticVNode`,
  12298. [RESOLVE_COMPONENT]: `resolveComponent`,
  12299. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  12300. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  12301. [RESOLVE_FILTER]: `resolveFilter`,
  12302. [WITH_DIRECTIVES]: `withDirectives`,
  12303. [RENDER_LIST]: `renderList`,
  12304. [RENDER_SLOT]: `renderSlot`,
  12305. [CREATE_SLOTS]: `createSlots`,
  12306. [TO_DISPLAY_STRING]: `toDisplayString`,
  12307. [MERGE_PROPS]: `mergeProps`,
  12308. [NORMALIZE_CLASS]: `normalizeClass`,
  12309. [NORMALIZE_STYLE]: `normalizeStyle`,
  12310. [NORMALIZE_PROPS]: `normalizeProps`,
  12311. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  12312. [TO_HANDLERS]: `toHandlers`,
  12313. [CAMELIZE]: `camelize`,
  12314. [CAPITALIZE]: `capitalize`,
  12315. [TO_HANDLER_KEY]: `toHandlerKey`,
  12316. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  12317. [PUSH_SCOPE_ID]: `pushScopeId`,
  12318. [POP_SCOPE_ID]: `popScopeId`,
  12319. [WITH_CTX]: `withCtx`,
  12320. [UNREF]: `unref`,
  12321. [IS_REF]: `isRef`,
  12322. [WITH_MEMO]: `withMemo`,
  12323. [IS_MEMO_SAME]: `isMemoSame`
  12324. };
  12325. function registerRuntimeHelpers(helpers) {
  12326. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  12327. helperNameMap[s] = helpers[s];
  12328. });
  12329. }
  12330. const locStub = {
  12331. start: { line: 1, column: 1, offset: 0 },
  12332. end: { line: 1, column: 1, offset: 0 },
  12333. source: ""
  12334. };
  12335. function createRoot(children, source = "") {
  12336. return {
  12337. type: 0,
  12338. source,
  12339. children,
  12340. helpers: /* @__PURE__ */ new Set(),
  12341. components: [],
  12342. directives: [],
  12343. hoists: [],
  12344. imports: [],
  12345. cached: [],
  12346. temps: 0,
  12347. codegenNode: void 0,
  12348. loc: locStub
  12349. };
  12350. }
  12351. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  12352. if (context) {
  12353. if (isBlock) {
  12354. context.helper(OPEN_BLOCK);
  12355. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  12356. } else {
  12357. context.helper(getVNodeHelper(context.inSSR, isComponent));
  12358. }
  12359. if (directives) {
  12360. context.helper(WITH_DIRECTIVES);
  12361. }
  12362. }
  12363. return {
  12364. type: 13,
  12365. tag,
  12366. props,
  12367. children,
  12368. patchFlag,
  12369. dynamicProps,
  12370. directives,
  12371. isBlock,
  12372. disableTracking,
  12373. isComponent,
  12374. loc
  12375. };
  12376. }
  12377. function createArrayExpression(elements, loc = locStub) {
  12378. return {
  12379. type: 17,
  12380. loc,
  12381. elements
  12382. };
  12383. }
  12384. function createObjectExpression(properties, loc = locStub) {
  12385. return {
  12386. type: 15,
  12387. loc,
  12388. properties
  12389. };
  12390. }
  12391. function createObjectProperty(key, value) {
  12392. return {
  12393. type: 16,
  12394. loc: locStub,
  12395. key: isString(key) ? createSimpleExpression(key, true) : key,
  12396. value
  12397. };
  12398. }
  12399. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  12400. return {
  12401. type: 4,
  12402. loc,
  12403. content,
  12404. isStatic,
  12405. constType: isStatic ? 3 : constType
  12406. };
  12407. }
  12408. function createCompoundExpression(children, loc = locStub) {
  12409. return {
  12410. type: 8,
  12411. loc,
  12412. children
  12413. };
  12414. }
  12415. function createCallExpression(callee, args = [], loc = locStub) {
  12416. return {
  12417. type: 14,
  12418. loc,
  12419. callee,
  12420. arguments: args
  12421. };
  12422. }
  12423. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  12424. return {
  12425. type: 18,
  12426. params,
  12427. returns,
  12428. newline,
  12429. isSlot,
  12430. loc
  12431. };
  12432. }
  12433. function createConditionalExpression(test, consequent, alternate, newline = true) {
  12434. return {
  12435. type: 19,
  12436. test,
  12437. consequent,
  12438. alternate,
  12439. newline,
  12440. loc: locStub
  12441. };
  12442. }
  12443. function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
  12444. return {
  12445. type: 20,
  12446. index,
  12447. value,
  12448. needPauseTracking,
  12449. inVOnce,
  12450. needArraySpread: false,
  12451. loc: locStub
  12452. };
  12453. }
  12454. function createBlockStatement(body) {
  12455. return {
  12456. type: 21,
  12457. body,
  12458. loc: locStub
  12459. };
  12460. }
  12461. function getVNodeHelper(ssr, isComponent) {
  12462. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  12463. }
  12464. function getVNodeBlockHelper(ssr, isComponent) {
  12465. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  12466. }
  12467. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  12468. if (!node.isBlock) {
  12469. node.isBlock = true;
  12470. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  12471. helper(OPEN_BLOCK);
  12472. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  12473. }
  12474. }
  12475. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  12476. const defaultDelimitersClose = new Uint8Array([125, 125]);
  12477. function isTagStartChar(c) {
  12478. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  12479. }
  12480. function isWhitespace(c) {
  12481. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  12482. }
  12483. function isEndOfTagSection(c) {
  12484. return c === 47 || c === 62 || isWhitespace(c);
  12485. }
  12486. function toCharCodes(str) {
  12487. const ret = new Uint8Array(str.length);
  12488. for (let i = 0; i < str.length; i++) {
  12489. ret[i] = str.charCodeAt(i);
  12490. }
  12491. return ret;
  12492. }
  12493. const Sequences = {
  12494. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  12495. // CDATA[
  12496. CdataEnd: new Uint8Array([93, 93, 62]),
  12497. // ]]>
  12498. CommentEnd: new Uint8Array([45, 45, 62]),
  12499. // `-->`
  12500. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  12501. // `<\/script`
  12502. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  12503. // `</style`
  12504. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  12505. // `</title`
  12506. TextareaEnd: new Uint8Array([
  12507. 60,
  12508. 47,
  12509. 116,
  12510. 101,
  12511. 120,
  12512. 116,
  12513. 97,
  12514. 114,
  12515. 101,
  12516. 97
  12517. ])
  12518. // `</textarea
  12519. };
  12520. class Tokenizer {
  12521. constructor(stack, cbs) {
  12522. this.stack = stack;
  12523. this.cbs = cbs;
  12524. /** The current state the tokenizer is in. */
  12525. this.state = 1;
  12526. /** The read buffer. */
  12527. this.buffer = "";
  12528. /** The beginning of the section that is currently being read. */
  12529. this.sectionStart = 0;
  12530. /** The index within the buffer that we are currently looking at. */
  12531. this.index = 0;
  12532. /** The start of the last entity. */
  12533. this.entityStart = 0;
  12534. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  12535. this.baseState = 1;
  12536. /** For special parsing behavior inside of script and style tags. */
  12537. this.inRCDATA = false;
  12538. /** For disabling RCDATA tags handling */
  12539. this.inXML = false;
  12540. /** For disabling interpolation parsing in v-pre */
  12541. this.inVPre = false;
  12542. /** Record newline positions for fast line / column calculation */
  12543. this.newlines = [];
  12544. this.mode = 0;
  12545. this.delimiterOpen = defaultDelimitersOpen;
  12546. this.delimiterClose = defaultDelimitersClose;
  12547. this.delimiterIndex = -1;
  12548. this.currentSequence = void 0;
  12549. this.sequenceIndex = 0;
  12550. }
  12551. get inSFCRoot() {
  12552. return this.mode === 2 && this.stack.length === 0;
  12553. }
  12554. reset() {
  12555. this.state = 1;
  12556. this.mode = 0;
  12557. this.buffer = "";
  12558. this.sectionStart = 0;
  12559. this.index = 0;
  12560. this.baseState = 1;
  12561. this.inRCDATA = false;
  12562. this.currentSequence = void 0;
  12563. this.newlines.length = 0;
  12564. this.delimiterOpen = defaultDelimitersOpen;
  12565. this.delimiterClose = defaultDelimitersClose;
  12566. }
  12567. /**
  12568. * Generate Position object with line / column information using recorded
  12569. * newline positions. We know the index is always going to be an already
  12570. * processed index, so all the newlines up to this index should have been
  12571. * recorded.
  12572. */
  12573. getPos(index) {
  12574. let line = 1;
  12575. let column = index + 1;
  12576. for (let i = this.newlines.length - 1; i >= 0; i--) {
  12577. const newlineIndex = this.newlines[i];
  12578. if (index > newlineIndex) {
  12579. line = i + 2;
  12580. column = index - newlineIndex;
  12581. break;
  12582. }
  12583. }
  12584. return {
  12585. column,
  12586. line,
  12587. offset: index
  12588. };
  12589. }
  12590. peek() {
  12591. return this.buffer.charCodeAt(this.index + 1);
  12592. }
  12593. stateText(c) {
  12594. if (c === 60) {
  12595. if (this.index > this.sectionStart) {
  12596. this.cbs.ontext(this.sectionStart, this.index);
  12597. }
  12598. this.state = 5;
  12599. this.sectionStart = this.index;
  12600. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  12601. this.state = 2;
  12602. this.delimiterIndex = 0;
  12603. this.stateInterpolationOpen(c);
  12604. }
  12605. }
  12606. stateInterpolationOpen(c) {
  12607. if (c === this.delimiterOpen[this.delimiterIndex]) {
  12608. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  12609. const start = this.index + 1 - this.delimiterOpen.length;
  12610. if (start > this.sectionStart) {
  12611. this.cbs.ontext(this.sectionStart, start);
  12612. }
  12613. this.state = 3;
  12614. this.sectionStart = start;
  12615. } else {
  12616. this.delimiterIndex++;
  12617. }
  12618. } else if (this.inRCDATA) {
  12619. this.state = 32;
  12620. this.stateInRCDATA(c);
  12621. } else {
  12622. this.state = 1;
  12623. this.stateText(c);
  12624. }
  12625. }
  12626. stateInterpolation(c) {
  12627. if (c === this.delimiterClose[0]) {
  12628. this.state = 4;
  12629. this.delimiterIndex = 0;
  12630. this.stateInterpolationClose(c);
  12631. }
  12632. }
  12633. stateInterpolationClose(c) {
  12634. if (c === this.delimiterClose[this.delimiterIndex]) {
  12635. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  12636. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  12637. if (this.inRCDATA) {
  12638. this.state = 32;
  12639. } else {
  12640. this.state = 1;
  12641. }
  12642. this.sectionStart = this.index + 1;
  12643. } else {
  12644. this.delimiterIndex++;
  12645. }
  12646. } else {
  12647. this.state = 3;
  12648. this.stateInterpolation(c);
  12649. }
  12650. }
  12651. stateSpecialStartSequence(c) {
  12652. const isEnd = this.sequenceIndex === this.currentSequence.length;
  12653. const isMatch = isEnd ? (
  12654. // If we are at the end of the sequence, make sure the tag name has ended
  12655. isEndOfTagSection(c)
  12656. ) : (
  12657. // Otherwise, do a case-insensitive comparison
  12658. (c | 32) === this.currentSequence[this.sequenceIndex]
  12659. );
  12660. if (!isMatch) {
  12661. this.inRCDATA = false;
  12662. } else if (!isEnd) {
  12663. this.sequenceIndex++;
  12664. return;
  12665. }
  12666. this.sequenceIndex = 0;
  12667. this.state = 6;
  12668. this.stateInTagName(c);
  12669. }
  12670. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  12671. stateInRCDATA(c) {
  12672. if (this.sequenceIndex === this.currentSequence.length) {
  12673. if (c === 62 || isWhitespace(c)) {
  12674. const endOfText = this.index - this.currentSequence.length;
  12675. if (this.sectionStart < endOfText) {
  12676. const actualIndex = this.index;
  12677. this.index = endOfText;
  12678. this.cbs.ontext(this.sectionStart, endOfText);
  12679. this.index = actualIndex;
  12680. }
  12681. this.sectionStart = endOfText + 2;
  12682. this.stateInClosingTagName(c);
  12683. this.inRCDATA = false;
  12684. return;
  12685. }
  12686. this.sequenceIndex = 0;
  12687. }
  12688. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  12689. this.sequenceIndex += 1;
  12690. } else if (this.sequenceIndex === 0) {
  12691. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  12692. if (!this.inVPre && c === this.delimiterOpen[0]) {
  12693. this.state = 2;
  12694. this.delimiterIndex = 0;
  12695. this.stateInterpolationOpen(c);
  12696. }
  12697. } else if (this.fastForwardTo(60)) {
  12698. this.sequenceIndex = 1;
  12699. }
  12700. } else {
  12701. this.sequenceIndex = Number(c === 60);
  12702. }
  12703. }
  12704. stateCDATASequence(c) {
  12705. if (c === Sequences.Cdata[this.sequenceIndex]) {
  12706. if (++this.sequenceIndex === Sequences.Cdata.length) {
  12707. this.state = 28;
  12708. this.currentSequence = Sequences.CdataEnd;
  12709. this.sequenceIndex = 0;
  12710. this.sectionStart = this.index + 1;
  12711. }
  12712. } else {
  12713. this.sequenceIndex = 0;
  12714. this.state = 23;
  12715. this.stateInDeclaration(c);
  12716. }
  12717. }
  12718. /**
  12719. * When we wait for one specific character, we can speed things up
  12720. * by skipping through the buffer until we find it.
  12721. *
  12722. * @returns Whether the character was found.
  12723. */
  12724. fastForwardTo(c) {
  12725. while (++this.index < this.buffer.length) {
  12726. const cc = this.buffer.charCodeAt(this.index);
  12727. if (cc === 10) {
  12728. this.newlines.push(this.index);
  12729. }
  12730. if (cc === c) {
  12731. return true;
  12732. }
  12733. }
  12734. this.index = this.buffer.length - 1;
  12735. return false;
  12736. }
  12737. /**
  12738. * Comments and CDATA end with `-->` and `]]>`.
  12739. *
  12740. * Their common qualities are:
  12741. * - Their end sequences have a distinct character they start with.
  12742. * - That character is then repeated, so we have to check multiple repeats.
  12743. * - All characters but the start character of the sequence can be skipped.
  12744. */
  12745. stateInCommentLike(c) {
  12746. if (c === this.currentSequence[this.sequenceIndex]) {
  12747. if (++this.sequenceIndex === this.currentSequence.length) {
  12748. if (this.currentSequence === Sequences.CdataEnd) {
  12749. this.cbs.oncdata(this.sectionStart, this.index - 2);
  12750. } else {
  12751. this.cbs.oncomment(this.sectionStart, this.index - 2);
  12752. }
  12753. this.sequenceIndex = 0;
  12754. this.sectionStart = this.index + 1;
  12755. this.state = 1;
  12756. }
  12757. } else if (this.sequenceIndex === 0) {
  12758. if (this.fastForwardTo(this.currentSequence[0])) {
  12759. this.sequenceIndex = 1;
  12760. }
  12761. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  12762. this.sequenceIndex = 0;
  12763. }
  12764. }
  12765. startSpecial(sequence, offset) {
  12766. this.enterRCDATA(sequence, offset);
  12767. this.state = 31;
  12768. }
  12769. enterRCDATA(sequence, offset) {
  12770. this.inRCDATA = true;
  12771. this.currentSequence = sequence;
  12772. this.sequenceIndex = offset;
  12773. }
  12774. stateBeforeTagName(c) {
  12775. if (c === 33) {
  12776. this.state = 22;
  12777. this.sectionStart = this.index + 1;
  12778. } else if (c === 63) {
  12779. this.state = 24;
  12780. this.sectionStart = this.index + 1;
  12781. } else if (isTagStartChar(c)) {
  12782. this.sectionStart = this.index;
  12783. if (this.mode === 0) {
  12784. this.state = 6;
  12785. } else if (this.inSFCRoot) {
  12786. this.state = 34;
  12787. } else if (!this.inXML) {
  12788. if (c === 116) {
  12789. this.state = 30;
  12790. } else {
  12791. this.state = c === 115 ? 29 : 6;
  12792. }
  12793. } else {
  12794. this.state = 6;
  12795. }
  12796. } else if (c === 47) {
  12797. this.state = 8;
  12798. } else {
  12799. this.state = 1;
  12800. this.stateText(c);
  12801. }
  12802. }
  12803. stateInTagName(c) {
  12804. if (isEndOfTagSection(c)) {
  12805. this.handleTagName(c);
  12806. }
  12807. }
  12808. stateInSFCRootTagName(c) {
  12809. if (isEndOfTagSection(c)) {
  12810. const tag = this.buffer.slice(this.sectionStart, this.index);
  12811. if (tag !== "template") {
  12812. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  12813. }
  12814. this.handleTagName(c);
  12815. }
  12816. }
  12817. handleTagName(c) {
  12818. this.cbs.onopentagname(this.sectionStart, this.index);
  12819. this.sectionStart = -1;
  12820. this.state = 11;
  12821. this.stateBeforeAttrName(c);
  12822. }
  12823. stateBeforeClosingTagName(c) {
  12824. if (isWhitespace(c)) ; else if (c === 62) {
  12825. {
  12826. this.cbs.onerr(14, this.index);
  12827. }
  12828. this.state = 1;
  12829. this.sectionStart = this.index + 1;
  12830. } else {
  12831. this.state = isTagStartChar(c) ? 9 : 27;
  12832. this.sectionStart = this.index;
  12833. }
  12834. }
  12835. stateInClosingTagName(c) {
  12836. if (c === 62 || isWhitespace(c)) {
  12837. this.cbs.onclosetag(this.sectionStart, this.index);
  12838. this.sectionStart = -1;
  12839. this.state = 10;
  12840. this.stateAfterClosingTagName(c);
  12841. }
  12842. }
  12843. stateAfterClosingTagName(c) {
  12844. if (c === 62) {
  12845. this.state = 1;
  12846. this.sectionStart = this.index + 1;
  12847. }
  12848. }
  12849. stateBeforeAttrName(c) {
  12850. if (c === 62) {
  12851. this.cbs.onopentagend(this.index);
  12852. if (this.inRCDATA) {
  12853. this.state = 32;
  12854. } else {
  12855. this.state = 1;
  12856. }
  12857. this.sectionStart = this.index + 1;
  12858. } else if (c === 47) {
  12859. this.state = 7;
  12860. if (this.peek() !== 62) {
  12861. this.cbs.onerr(22, this.index);
  12862. }
  12863. } else if (c === 60 && this.peek() === 47) {
  12864. this.cbs.onopentagend(this.index);
  12865. this.state = 5;
  12866. this.sectionStart = this.index;
  12867. } else if (!isWhitespace(c)) {
  12868. if (c === 61) {
  12869. this.cbs.onerr(
  12870. 19,
  12871. this.index
  12872. );
  12873. }
  12874. this.handleAttrStart(c);
  12875. }
  12876. }
  12877. handleAttrStart(c) {
  12878. if (c === 118 && this.peek() === 45) {
  12879. this.state = 13;
  12880. this.sectionStart = this.index;
  12881. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  12882. this.cbs.ondirname(this.index, this.index + 1);
  12883. this.state = 14;
  12884. this.sectionStart = this.index + 1;
  12885. } else {
  12886. this.state = 12;
  12887. this.sectionStart = this.index;
  12888. }
  12889. }
  12890. stateInSelfClosingTag(c) {
  12891. if (c === 62) {
  12892. this.cbs.onselfclosingtag(this.index);
  12893. this.state = 1;
  12894. this.sectionStart = this.index + 1;
  12895. this.inRCDATA = false;
  12896. } else if (!isWhitespace(c)) {
  12897. this.state = 11;
  12898. this.stateBeforeAttrName(c);
  12899. }
  12900. }
  12901. stateInAttrName(c) {
  12902. if (c === 61 || isEndOfTagSection(c)) {
  12903. this.cbs.onattribname(this.sectionStart, this.index);
  12904. this.handleAttrNameEnd(c);
  12905. } else if (c === 34 || c === 39 || c === 60) {
  12906. this.cbs.onerr(
  12907. 17,
  12908. this.index
  12909. );
  12910. }
  12911. }
  12912. stateInDirName(c) {
  12913. if (c === 61 || isEndOfTagSection(c)) {
  12914. this.cbs.ondirname(this.sectionStart, this.index);
  12915. this.handleAttrNameEnd(c);
  12916. } else if (c === 58) {
  12917. this.cbs.ondirname(this.sectionStart, this.index);
  12918. this.state = 14;
  12919. this.sectionStart = this.index + 1;
  12920. } else if (c === 46) {
  12921. this.cbs.ondirname(this.sectionStart, this.index);
  12922. this.state = 16;
  12923. this.sectionStart = this.index + 1;
  12924. }
  12925. }
  12926. stateInDirArg(c) {
  12927. if (c === 61 || isEndOfTagSection(c)) {
  12928. this.cbs.ondirarg(this.sectionStart, this.index);
  12929. this.handleAttrNameEnd(c);
  12930. } else if (c === 91) {
  12931. this.state = 15;
  12932. } else if (c === 46) {
  12933. this.cbs.ondirarg(this.sectionStart, this.index);
  12934. this.state = 16;
  12935. this.sectionStart = this.index + 1;
  12936. }
  12937. }
  12938. stateInDynamicDirArg(c) {
  12939. if (c === 93) {
  12940. this.state = 14;
  12941. } else if (c === 61 || isEndOfTagSection(c)) {
  12942. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  12943. this.handleAttrNameEnd(c);
  12944. {
  12945. this.cbs.onerr(
  12946. 27,
  12947. this.index
  12948. );
  12949. }
  12950. }
  12951. }
  12952. stateInDirModifier(c) {
  12953. if (c === 61 || isEndOfTagSection(c)) {
  12954. this.cbs.ondirmodifier(this.sectionStart, this.index);
  12955. this.handleAttrNameEnd(c);
  12956. } else if (c === 46) {
  12957. this.cbs.ondirmodifier(this.sectionStart, this.index);
  12958. this.sectionStart = this.index + 1;
  12959. }
  12960. }
  12961. handleAttrNameEnd(c) {
  12962. this.sectionStart = this.index;
  12963. this.state = 17;
  12964. this.cbs.onattribnameend(this.index);
  12965. this.stateAfterAttrName(c);
  12966. }
  12967. stateAfterAttrName(c) {
  12968. if (c === 61) {
  12969. this.state = 18;
  12970. } else if (c === 47 || c === 62) {
  12971. this.cbs.onattribend(0, this.sectionStart);
  12972. this.sectionStart = -1;
  12973. this.state = 11;
  12974. this.stateBeforeAttrName(c);
  12975. } else if (!isWhitespace(c)) {
  12976. this.cbs.onattribend(0, this.sectionStart);
  12977. this.handleAttrStart(c);
  12978. }
  12979. }
  12980. stateBeforeAttrValue(c) {
  12981. if (c === 34) {
  12982. this.state = 19;
  12983. this.sectionStart = this.index + 1;
  12984. } else if (c === 39) {
  12985. this.state = 20;
  12986. this.sectionStart = this.index + 1;
  12987. } else if (!isWhitespace(c)) {
  12988. this.sectionStart = this.index;
  12989. this.state = 21;
  12990. this.stateInAttrValueNoQuotes(c);
  12991. }
  12992. }
  12993. handleInAttrValue(c, quote) {
  12994. if (c === quote || this.fastForwardTo(quote)) {
  12995. this.cbs.onattribdata(this.sectionStart, this.index);
  12996. this.sectionStart = -1;
  12997. this.cbs.onattribend(
  12998. quote === 34 ? 3 : 2,
  12999. this.index + 1
  13000. );
  13001. this.state = 11;
  13002. }
  13003. }
  13004. stateInAttrValueDoubleQuotes(c) {
  13005. this.handleInAttrValue(c, 34);
  13006. }
  13007. stateInAttrValueSingleQuotes(c) {
  13008. this.handleInAttrValue(c, 39);
  13009. }
  13010. stateInAttrValueNoQuotes(c) {
  13011. if (isWhitespace(c) || c === 62) {
  13012. this.cbs.onattribdata(this.sectionStart, this.index);
  13013. this.sectionStart = -1;
  13014. this.cbs.onattribend(1, this.index);
  13015. this.state = 11;
  13016. this.stateBeforeAttrName(c);
  13017. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  13018. this.cbs.onerr(
  13019. 18,
  13020. this.index
  13021. );
  13022. } else ;
  13023. }
  13024. stateBeforeDeclaration(c) {
  13025. if (c === 91) {
  13026. this.state = 26;
  13027. this.sequenceIndex = 0;
  13028. } else {
  13029. this.state = c === 45 ? 25 : 23;
  13030. }
  13031. }
  13032. stateInDeclaration(c) {
  13033. if (c === 62 || this.fastForwardTo(62)) {
  13034. this.state = 1;
  13035. this.sectionStart = this.index + 1;
  13036. }
  13037. }
  13038. stateInProcessingInstruction(c) {
  13039. if (c === 62 || this.fastForwardTo(62)) {
  13040. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  13041. this.state = 1;
  13042. this.sectionStart = this.index + 1;
  13043. }
  13044. }
  13045. stateBeforeComment(c) {
  13046. if (c === 45) {
  13047. this.state = 28;
  13048. this.currentSequence = Sequences.CommentEnd;
  13049. this.sequenceIndex = 2;
  13050. this.sectionStart = this.index + 1;
  13051. } else {
  13052. this.state = 23;
  13053. }
  13054. }
  13055. stateInSpecialComment(c) {
  13056. if (c === 62 || this.fastForwardTo(62)) {
  13057. this.cbs.oncomment(this.sectionStart, this.index);
  13058. this.state = 1;
  13059. this.sectionStart = this.index + 1;
  13060. }
  13061. }
  13062. stateBeforeSpecialS(c) {
  13063. if (c === Sequences.ScriptEnd[3]) {
  13064. this.startSpecial(Sequences.ScriptEnd, 4);
  13065. } else if (c === Sequences.StyleEnd[3]) {
  13066. this.startSpecial(Sequences.StyleEnd, 4);
  13067. } else {
  13068. this.state = 6;
  13069. this.stateInTagName(c);
  13070. }
  13071. }
  13072. stateBeforeSpecialT(c) {
  13073. if (c === Sequences.TitleEnd[3]) {
  13074. this.startSpecial(Sequences.TitleEnd, 4);
  13075. } else if (c === Sequences.TextareaEnd[3]) {
  13076. this.startSpecial(Sequences.TextareaEnd, 4);
  13077. } else {
  13078. this.state = 6;
  13079. this.stateInTagName(c);
  13080. }
  13081. }
  13082. startEntity() {
  13083. }
  13084. stateInEntity() {
  13085. }
  13086. /**
  13087. * Iterates through the buffer, calling the function corresponding to the current state.
  13088. *
  13089. * States that are more likely to be hit are higher up, as a performance improvement.
  13090. */
  13091. parse(input) {
  13092. this.buffer = input;
  13093. while (this.index < this.buffer.length) {
  13094. const c = this.buffer.charCodeAt(this.index);
  13095. if (c === 10) {
  13096. this.newlines.push(this.index);
  13097. }
  13098. switch (this.state) {
  13099. case 1: {
  13100. this.stateText(c);
  13101. break;
  13102. }
  13103. case 2: {
  13104. this.stateInterpolationOpen(c);
  13105. break;
  13106. }
  13107. case 3: {
  13108. this.stateInterpolation(c);
  13109. break;
  13110. }
  13111. case 4: {
  13112. this.stateInterpolationClose(c);
  13113. break;
  13114. }
  13115. case 31: {
  13116. this.stateSpecialStartSequence(c);
  13117. break;
  13118. }
  13119. case 32: {
  13120. this.stateInRCDATA(c);
  13121. break;
  13122. }
  13123. case 26: {
  13124. this.stateCDATASequence(c);
  13125. break;
  13126. }
  13127. case 19: {
  13128. this.stateInAttrValueDoubleQuotes(c);
  13129. break;
  13130. }
  13131. case 12: {
  13132. this.stateInAttrName(c);
  13133. break;
  13134. }
  13135. case 13: {
  13136. this.stateInDirName(c);
  13137. break;
  13138. }
  13139. case 14: {
  13140. this.stateInDirArg(c);
  13141. break;
  13142. }
  13143. case 15: {
  13144. this.stateInDynamicDirArg(c);
  13145. break;
  13146. }
  13147. case 16: {
  13148. this.stateInDirModifier(c);
  13149. break;
  13150. }
  13151. case 28: {
  13152. this.stateInCommentLike(c);
  13153. break;
  13154. }
  13155. case 27: {
  13156. this.stateInSpecialComment(c);
  13157. break;
  13158. }
  13159. case 11: {
  13160. this.stateBeforeAttrName(c);
  13161. break;
  13162. }
  13163. case 6: {
  13164. this.stateInTagName(c);
  13165. break;
  13166. }
  13167. case 34: {
  13168. this.stateInSFCRootTagName(c);
  13169. break;
  13170. }
  13171. case 9: {
  13172. this.stateInClosingTagName(c);
  13173. break;
  13174. }
  13175. case 5: {
  13176. this.stateBeforeTagName(c);
  13177. break;
  13178. }
  13179. case 17: {
  13180. this.stateAfterAttrName(c);
  13181. break;
  13182. }
  13183. case 20: {
  13184. this.stateInAttrValueSingleQuotes(c);
  13185. break;
  13186. }
  13187. case 18: {
  13188. this.stateBeforeAttrValue(c);
  13189. break;
  13190. }
  13191. case 8: {
  13192. this.stateBeforeClosingTagName(c);
  13193. break;
  13194. }
  13195. case 10: {
  13196. this.stateAfterClosingTagName(c);
  13197. break;
  13198. }
  13199. case 29: {
  13200. this.stateBeforeSpecialS(c);
  13201. break;
  13202. }
  13203. case 30: {
  13204. this.stateBeforeSpecialT(c);
  13205. break;
  13206. }
  13207. case 21: {
  13208. this.stateInAttrValueNoQuotes(c);
  13209. break;
  13210. }
  13211. case 7: {
  13212. this.stateInSelfClosingTag(c);
  13213. break;
  13214. }
  13215. case 23: {
  13216. this.stateInDeclaration(c);
  13217. break;
  13218. }
  13219. case 22: {
  13220. this.stateBeforeDeclaration(c);
  13221. break;
  13222. }
  13223. case 25: {
  13224. this.stateBeforeComment(c);
  13225. break;
  13226. }
  13227. case 24: {
  13228. this.stateInProcessingInstruction(c);
  13229. break;
  13230. }
  13231. case 33: {
  13232. this.stateInEntity();
  13233. break;
  13234. }
  13235. }
  13236. this.index++;
  13237. }
  13238. this.cleanup();
  13239. this.finish();
  13240. }
  13241. /**
  13242. * Remove data that has already been consumed from the buffer.
  13243. */
  13244. cleanup() {
  13245. if (this.sectionStart !== this.index) {
  13246. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  13247. this.cbs.ontext(this.sectionStart, this.index);
  13248. this.sectionStart = this.index;
  13249. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  13250. this.cbs.onattribdata(this.sectionStart, this.index);
  13251. this.sectionStart = this.index;
  13252. }
  13253. }
  13254. }
  13255. finish() {
  13256. this.handleTrailingData();
  13257. this.cbs.onend();
  13258. }
  13259. /** Handle any trailing data. */
  13260. handleTrailingData() {
  13261. const endIndex = this.buffer.length;
  13262. if (this.sectionStart >= endIndex) {
  13263. return;
  13264. }
  13265. if (this.state === 28) {
  13266. if (this.currentSequence === Sequences.CdataEnd) {
  13267. this.cbs.oncdata(this.sectionStart, endIndex);
  13268. } else {
  13269. this.cbs.oncomment(this.sectionStart, endIndex);
  13270. }
  13271. } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else {
  13272. this.cbs.ontext(this.sectionStart, endIndex);
  13273. }
  13274. }
  13275. emitCodePoint(cp, consumed) {
  13276. }
  13277. }
  13278. function defaultOnError(error) {
  13279. throw error;
  13280. }
  13281. function defaultOnWarn(msg) {
  13282. console.warn(`[Vue warn] ${msg.message}`);
  13283. }
  13284. function createCompilerError(code, loc, messages, additionalMessage) {
  13285. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  13286. const error = new SyntaxError(String(msg));
  13287. error.code = code;
  13288. error.loc = loc;
  13289. return error;
  13290. }
  13291. const errorMessages = {
  13292. // parse errors
  13293. [0]: "Illegal comment.",
  13294. [1]: "CDATA section is allowed only in XML context.",
  13295. [2]: "Duplicate attribute.",
  13296. [3]: "End tag cannot have attributes.",
  13297. [4]: "Illegal '/' in tags.",
  13298. [5]: "Unexpected EOF in tag.",
  13299. [6]: "Unexpected EOF in CDATA section.",
  13300. [7]: "Unexpected EOF in comment.",
  13301. [8]: "Unexpected EOF in script.",
  13302. [9]: "Unexpected EOF in tag.",
  13303. [10]: "Incorrectly closed comment.",
  13304. [11]: "Incorrectly opened comment.",
  13305. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  13306. [13]: "Attribute value was expected.",
  13307. [14]: "End tag name was expected.",
  13308. [15]: "Whitespace was expected.",
  13309. [16]: "Unexpected '<!--' in comment.",
  13310. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  13311. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  13312. [19]: "Attribute name cannot start with '='.",
  13313. [21]: "'<?' is allowed only in XML context.",
  13314. [20]: `Unexpected null character.`,
  13315. [22]: "Illegal '/' in tags.",
  13316. // Vue-specific parse errors
  13317. [23]: "Invalid end tag.",
  13318. [24]: "Element is missing end tag.",
  13319. [25]: "Interpolation end sign was not found.",
  13320. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  13321. [26]: "Legal directive name was expected.",
  13322. // transform errors
  13323. [28]: `v-if/v-else-if is missing expression.`,
  13324. [29]: `v-if/else branches must use unique keys.`,
  13325. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  13326. [31]: `v-for is missing expression.`,
  13327. [32]: `v-for has invalid expression.`,
  13328. [33]: `<template v-for> key should be placed on the <template> tag.`,
  13329. [34]: `v-bind is missing expression.`,
  13330. [52]: `v-bind with same-name shorthand only allows static argument.`,
  13331. [35]: `v-on is missing expression.`,
  13332. [36]: `Unexpected custom directive on <slot> outlet.`,
  13333. [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
  13334. [38]: `Duplicate slot names found. `,
  13335. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  13336. [40]: `v-slot can only be used on components or <template> tags.`,
  13337. [41]: `v-model is missing expression.`,
  13338. [42]: `v-model value must be a valid JavaScript member expression.`,
  13339. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  13340. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  13341. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  13342. [45]: `Error parsing JavaScript expression: `,
  13343. [46]: `<KeepAlive> expects exactly one child component.`,
  13344. [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`,
  13345. // generic errors
  13346. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  13347. [48]: `ES module mode is not supported in this build of compiler.`,
  13348. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  13349. [50]: `"scopeId" option is only supported in module mode.`,
  13350. // just to fulfill types
  13351. [53]: ``
  13352. };
  13353. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  13354. function isCoreComponent(tag) {
  13355. switch (tag) {
  13356. case "Teleport":
  13357. case "teleport":
  13358. return TELEPORT;
  13359. case "Suspense":
  13360. case "suspense":
  13361. return SUSPENSE;
  13362. case "KeepAlive":
  13363. case "keep-alive":
  13364. return KEEP_ALIVE;
  13365. case "BaseTransition":
  13366. case "base-transition":
  13367. return BASE_TRANSITION;
  13368. }
  13369. }
  13370. const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
  13371. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  13372. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  13373. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  13374. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  13375. const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
  13376. const isMemberExpressionBrowser = (exp) => {
  13377. const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
  13378. let state = 0 /* inMemberExp */;
  13379. let stateStack = [];
  13380. let currentOpenBracketCount = 0;
  13381. let currentOpenParensCount = 0;
  13382. let currentStringType = null;
  13383. for (let i = 0; i < path.length; i++) {
  13384. const char = path.charAt(i);
  13385. switch (state) {
  13386. case 0 /* inMemberExp */:
  13387. if (char === "[") {
  13388. stateStack.push(state);
  13389. state = 1 /* inBrackets */;
  13390. currentOpenBracketCount++;
  13391. } else if (char === "(") {
  13392. stateStack.push(state);
  13393. state = 2 /* inParens */;
  13394. currentOpenParensCount++;
  13395. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  13396. return false;
  13397. }
  13398. break;
  13399. case 1 /* inBrackets */:
  13400. if (char === `'` || char === `"` || char === "`") {
  13401. stateStack.push(state);
  13402. state = 3 /* inString */;
  13403. currentStringType = char;
  13404. } else if (char === `[`) {
  13405. currentOpenBracketCount++;
  13406. } else if (char === `]`) {
  13407. if (!--currentOpenBracketCount) {
  13408. state = stateStack.pop();
  13409. }
  13410. }
  13411. break;
  13412. case 2 /* inParens */:
  13413. if (char === `'` || char === `"` || char === "`") {
  13414. stateStack.push(state);
  13415. state = 3 /* inString */;
  13416. currentStringType = char;
  13417. } else if (char === `(`) {
  13418. currentOpenParensCount++;
  13419. } else if (char === `)`) {
  13420. if (i === path.length - 1) {
  13421. return false;
  13422. }
  13423. if (!--currentOpenParensCount) {
  13424. state = stateStack.pop();
  13425. }
  13426. }
  13427. break;
  13428. case 3 /* inString */:
  13429. if (char === currentStringType) {
  13430. state = stateStack.pop();
  13431. currentStringType = null;
  13432. }
  13433. break;
  13434. }
  13435. }
  13436. return !currentOpenBracketCount && !currentOpenParensCount;
  13437. };
  13438. const isMemberExpression = isMemberExpressionBrowser ;
  13439. const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  13440. const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
  13441. const isFnExpression = isFnExpressionBrowser ;
  13442. function assert(condition, msg) {
  13443. if (!condition) {
  13444. throw new Error(msg || `unexpected compiler condition`);
  13445. }
  13446. }
  13447. function findDir(node, name, allowEmpty = false) {
  13448. for (let i = 0; i < node.props.length; i++) {
  13449. const p = node.props[i];
  13450. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  13451. return p;
  13452. }
  13453. }
  13454. }
  13455. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  13456. for (let i = 0; i < node.props.length; i++) {
  13457. const p = node.props[i];
  13458. if (p.type === 6) {
  13459. if (dynamicOnly) continue;
  13460. if (p.name === name && (p.value || allowEmpty)) {
  13461. return p;
  13462. }
  13463. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  13464. return p;
  13465. }
  13466. }
  13467. }
  13468. function isStaticArgOf(arg, name) {
  13469. return !!(arg && isStaticExp(arg) && arg.content === name);
  13470. }
  13471. function hasDynamicKeyVBind(node) {
  13472. return node.props.some(
  13473. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  13474. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  13475. !p.arg.isStatic)
  13476. // v-bind:[foo]
  13477. );
  13478. }
  13479. function isText$1(node) {
  13480. return node.type === 5 || node.type === 2;
  13481. }
  13482. function isVSlot(p) {
  13483. return p.type === 7 && p.name === "slot";
  13484. }
  13485. function isTemplateNode(node) {
  13486. return node.type === 1 && node.tagType === 3;
  13487. }
  13488. function isSlotOutlet(node) {
  13489. return node.type === 1 && node.tagType === 2;
  13490. }
  13491. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  13492. function getUnnormalizedProps(props, callPath = []) {
  13493. if (props && !isString(props) && props.type === 14) {
  13494. const callee = props.callee;
  13495. if (!isString(callee) && propsHelperSet.has(callee)) {
  13496. return getUnnormalizedProps(
  13497. props.arguments[0],
  13498. callPath.concat(props)
  13499. );
  13500. }
  13501. }
  13502. return [props, callPath];
  13503. }
  13504. function injectProp(node, prop, context) {
  13505. let propsWithInjection;
  13506. let props = node.type === 13 ? node.props : node.arguments[2];
  13507. let callPath = [];
  13508. let parentCall;
  13509. if (props && !isString(props) && props.type === 14) {
  13510. const ret = getUnnormalizedProps(props);
  13511. props = ret[0];
  13512. callPath = ret[1];
  13513. parentCall = callPath[callPath.length - 1];
  13514. }
  13515. if (props == null || isString(props)) {
  13516. propsWithInjection = createObjectExpression([prop]);
  13517. } else if (props.type === 14) {
  13518. const first = props.arguments[0];
  13519. if (!isString(first) && first.type === 15) {
  13520. if (!hasProp(prop, first)) {
  13521. first.properties.unshift(prop);
  13522. }
  13523. } else {
  13524. if (props.callee === TO_HANDLERS) {
  13525. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  13526. createObjectExpression([prop]),
  13527. props
  13528. ]);
  13529. } else {
  13530. props.arguments.unshift(createObjectExpression([prop]));
  13531. }
  13532. }
  13533. !propsWithInjection && (propsWithInjection = props);
  13534. } else if (props.type === 15) {
  13535. if (!hasProp(prop, props)) {
  13536. props.properties.unshift(prop);
  13537. }
  13538. propsWithInjection = props;
  13539. } else {
  13540. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  13541. createObjectExpression([prop]),
  13542. props
  13543. ]);
  13544. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  13545. parentCall = callPath[callPath.length - 2];
  13546. }
  13547. }
  13548. if (node.type === 13) {
  13549. if (parentCall) {
  13550. parentCall.arguments[0] = propsWithInjection;
  13551. } else {
  13552. node.props = propsWithInjection;
  13553. }
  13554. } else {
  13555. if (parentCall) {
  13556. parentCall.arguments[0] = propsWithInjection;
  13557. } else {
  13558. node.arguments[2] = propsWithInjection;
  13559. }
  13560. }
  13561. }
  13562. function hasProp(prop, props) {
  13563. let result = false;
  13564. if (prop.key.type === 4) {
  13565. const propKeyName = prop.key.content;
  13566. result = props.properties.some(
  13567. (p) => p.key.type === 4 && p.key.content === propKeyName
  13568. );
  13569. }
  13570. return result;
  13571. }
  13572. function toValidAssetId(name, type) {
  13573. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  13574. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  13575. })}`;
  13576. }
  13577. function getMemoedVNodeCall(node) {
  13578. if (node.type === 14 && node.callee === WITH_MEMO) {
  13579. return node.arguments[1].returns;
  13580. } else {
  13581. return node;
  13582. }
  13583. }
  13584. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
  13585. const defaultParserOptions = {
  13586. parseMode: "base",
  13587. ns: 0,
  13588. delimiters: [`{{`, `}}`],
  13589. getNamespace: () => 0,
  13590. isVoidTag: NO,
  13591. isPreTag: NO,
  13592. isIgnoreNewlineTag: NO,
  13593. isCustomElement: NO,
  13594. onError: defaultOnError,
  13595. onWarn: defaultOnWarn,
  13596. comments: true,
  13597. prefixIdentifiers: false
  13598. };
  13599. let currentOptions = defaultParserOptions;
  13600. let currentRoot = null;
  13601. let currentInput = "";
  13602. let currentOpenTag = null;
  13603. let currentProp = null;
  13604. let currentAttrValue = "";
  13605. let currentAttrStartIndex = -1;
  13606. let currentAttrEndIndex = -1;
  13607. let inPre = 0;
  13608. let inVPre = false;
  13609. let currentVPreBoundary = null;
  13610. const stack = [];
  13611. const tokenizer = new Tokenizer(stack, {
  13612. onerr: emitError,
  13613. ontext(start, end) {
  13614. onText(getSlice(start, end), start, end);
  13615. },
  13616. ontextentity(char, start, end) {
  13617. onText(char, start, end);
  13618. },
  13619. oninterpolation(start, end) {
  13620. if (inVPre) {
  13621. return onText(getSlice(start, end), start, end);
  13622. }
  13623. let innerStart = start + tokenizer.delimiterOpen.length;
  13624. let innerEnd = end - tokenizer.delimiterClose.length;
  13625. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  13626. innerStart++;
  13627. }
  13628. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  13629. innerEnd--;
  13630. }
  13631. let exp = getSlice(innerStart, innerEnd);
  13632. if (exp.includes("&")) {
  13633. {
  13634. exp = currentOptions.decodeEntities(exp, false);
  13635. }
  13636. }
  13637. addNode({
  13638. type: 5,
  13639. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  13640. loc: getLoc(start, end)
  13641. });
  13642. },
  13643. onopentagname(start, end) {
  13644. const name = getSlice(start, end);
  13645. currentOpenTag = {
  13646. type: 1,
  13647. tag: name,
  13648. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  13649. tagType: 0,
  13650. // will be refined on tag close
  13651. props: [],
  13652. children: [],
  13653. loc: getLoc(start - 1, end),
  13654. codegenNode: void 0
  13655. };
  13656. },
  13657. onopentagend(end) {
  13658. endOpenTag(end);
  13659. },
  13660. onclosetag(start, end) {
  13661. const name = getSlice(start, end);
  13662. if (!currentOptions.isVoidTag(name)) {
  13663. let found = false;
  13664. for (let i = 0; i < stack.length; i++) {
  13665. const e = stack[i];
  13666. if (e.tag.toLowerCase() === name.toLowerCase()) {
  13667. found = true;
  13668. if (i > 0) {
  13669. emitError(24, stack[0].loc.start.offset);
  13670. }
  13671. for (let j = 0; j <= i; j++) {
  13672. const el = stack.shift();
  13673. onCloseTag(el, end, j < i);
  13674. }
  13675. break;
  13676. }
  13677. }
  13678. if (!found) {
  13679. emitError(23, backTrack(start, 60));
  13680. }
  13681. }
  13682. },
  13683. onselfclosingtag(end) {
  13684. const name = currentOpenTag.tag;
  13685. currentOpenTag.isSelfClosing = true;
  13686. endOpenTag(end);
  13687. if (stack[0] && stack[0].tag === name) {
  13688. onCloseTag(stack.shift(), end);
  13689. }
  13690. },
  13691. onattribname(start, end) {
  13692. currentProp = {
  13693. type: 6,
  13694. name: getSlice(start, end),
  13695. nameLoc: getLoc(start, end),
  13696. value: void 0,
  13697. loc: getLoc(start)
  13698. };
  13699. },
  13700. ondirname(start, end) {
  13701. const raw = getSlice(start, end);
  13702. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  13703. if (!inVPre && name === "") {
  13704. emitError(26, start);
  13705. }
  13706. if (inVPre || name === "") {
  13707. currentProp = {
  13708. type: 6,
  13709. name: raw,
  13710. nameLoc: getLoc(start, end),
  13711. value: void 0,
  13712. loc: getLoc(start)
  13713. };
  13714. } else {
  13715. currentProp = {
  13716. type: 7,
  13717. name,
  13718. rawName: raw,
  13719. exp: void 0,
  13720. arg: void 0,
  13721. modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
  13722. loc: getLoc(start)
  13723. };
  13724. if (name === "pre") {
  13725. inVPre = tokenizer.inVPre = true;
  13726. currentVPreBoundary = currentOpenTag;
  13727. const props = currentOpenTag.props;
  13728. for (let i = 0; i < props.length; i++) {
  13729. if (props[i].type === 7) {
  13730. props[i] = dirToAttr(props[i]);
  13731. }
  13732. }
  13733. }
  13734. }
  13735. },
  13736. ondirarg(start, end) {
  13737. if (start === end) return;
  13738. const arg = getSlice(start, end);
  13739. if (inVPre) {
  13740. currentProp.name += arg;
  13741. setLocEnd(currentProp.nameLoc, end);
  13742. } else {
  13743. const isStatic = arg[0] !== `[`;
  13744. currentProp.arg = createExp(
  13745. isStatic ? arg : arg.slice(1, -1),
  13746. isStatic,
  13747. getLoc(start, end),
  13748. isStatic ? 3 : 0
  13749. );
  13750. }
  13751. },
  13752. ondirmodifier(start, end) {
  13753. const mod = getSlice(start, end);
  13754. if (inVPre) {
  13755. currentProp.name += "." + mod;
  13756. setLocEnd(currentProp.nameLoc, end);
  13757. } else if (currentProp.name === "slot") {
  13758. const arg = currentProp.arg;
  13759. if (arg) {
  13760. arg.content += "." + mod;
  13761. setLocEnd(arg.loc, end);
  13762. }
  13763. } else {
  13764. const exp = createSimpleExpression(mod, true, getLoc(start, end));
  13765. currentProp.modifiers.push(exp);
  13766. }
  13767. },
  13768. onattribdata(start, end) {
  13769. currentAttrValue += getSlice(start, end);
  13770. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  13771. currentAttrEndIndex = end;
  13772. },
  13773. onattribentity(char, start, end) {
  13774. currentAttrValue += char;
  13775. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  13776. currentAttrEndIndex = end;
  13777. },
  13778. onattribnameend(end) {
  13779. const start = currentProp.loc.start.offset;
  13780. const name = getSlice(start, end);
  13781. if (currentProp.type === 7) {
  13782. currentProp.rawName = name;
  13783. }
  13784. if (currentOpenTag.props.some(
  13785. (p) => (p.type === 7 ? p.rawName : p.name) === name
  13786. )) {
  13787. emitError(2, start);
  13788. }
  13789. },
  13790. onattribend(quote, end) {
  13791. if (currentOpenTag && currentProp) {
  13792. setLocEnd(currentProp.loc, end);
  13793. if (quote !== 0) {
  13794. if (currentAttrValue.includes("&")) {
  13795. currentAttrValue = currentOptions.decodeEntities(
  13796. currentAttrValue,
  13797. true
  13798. );
  13799. }
  13800. if (currentProp.type === 6) {
  13801. if (currentProp.name === "class") {
  13802. currentAttrValue = condense(currentAttrValue).trim();
  13803. }
  13804. if (quote === 1 && !currentAttrValue) {
  13805. emitError(13, end);
  13806. }
  13807. currentProp.value = {
  13808. type: 2,
  13809. content: currentAttrValue,
  13810. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  13811. };
  13812. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  13813. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  13814. }
  13815. } else {
  13816. let expParseMode = 0 /* Normal */;
  13817. currentProp.exp = createExp(
  13818. currentAttrValue,
  13819. false,
  13820. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  13821. 0,
  13822. expParseMode
  13823. );
  13824. if (currentProp.name === "for") {
  13825. currentProp.forParseResult = parseForExpression(currentProp.exp);
  13826. }
  13827. }
  13828. }
  13829. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  13830. currentOpenTag.props.push(currentProp);
  13831. }
  13832. }
  13833. currentAttrValue = "";
  13834. currentAttrStartIndex = currentAttrEndIndex = -1;
  13835. },
  13836. oncomment(start, end) {
  13837. if (currentOptions.comments) {
  13838. addNode({
  13839. type: 3,
  13840. content: getSlice(start, end),
  13841. loc: getLoc(start - 4, end + 3)
  13842. });
  13843. }
  13844. },
  13845. onend() {
  13846. const end = currentInput.length;
  13847. if (tokenizer.state !== 1) {
  13848. switch (tokenizer.state) {
  13849. case 5:
  13850. case 8:
  13851. emitError(5, end);
  13852. break;
  13853. case 3:
  13854. case 4:
  13855. emitError(
  13856. 25,
  13857. tokenizer.sectionStart
  13858. );
  13859. break;
  13860. case 28:
  13861. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  13862. emitError(6, end);
  13863. } else {
  13864. emitError(7, end);
  13865. }
  13866. break;
  13867. case 6:
  13868. case 7:
  13869. case 9:
  13870. case 11:
  13871. case 12:
  13872. case 13:
  13873. case 14:
  13874. case 15:
  13875. case 16:
  13876. case 17:
  13877. case 18:
  13878. case 19:
  13879. // "
  13880. case 20:
  13881. // '
  13882. case 21:
  13883. emitError(9, end);
  13884. break;
  13885. }
  13886. }
  13887. for (let index = 0; index < stack.length; index++) {
  13888. onCloseTag(stack[index], end - 1);
  13889. emitError(24, stack[index].loc.start.offset);
  13890. }
  13891. },
  13892. oncdata(start, end) {
  13893. if (stack[0].ns !== 0) {
  13894. onText(getSlice(start, end), start, end);
  13895. } else {
  13896. emitError(1, start - 9);
  13897. }
  13898. },
  13899. onprocessinginstruction(start) {
  13900. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  13901. emitError(
  13902. 21,
  13903. start - 1
  13904. );
  13905. }
  13906. }
  13907. });
  13908. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  13909. const stripParensRE = /^\(|\)$/g;
  13910. function parseForExpression(input) {
  13911. const loc = input.loc;
  13912. const exp = input.content;
  13913. const inMatch = exp.match(forAliasRE);
  13914. if (!inMatch) return;
  13915. const [, LHS, RHS] = inMatch;
  13916. const createAliasExpression = (content, offset, asParam = false) => {
  13917. const start = loc.start.offset + offset;
  13918. const end = start + content.length;
  13919. return createExp(
  13920. content,
  13921. false,
  13922. getLoc(start, end),
  13923. 0,
  13924. asParam ? 1 /* Params */ : 0 /* Normal */
  13925. );
  13926. };
  13927. const result = {
  13928. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  13929. value: void 0,
  13930. key: void 0,
  13931. index: void 0,
  13932. finalized: false
  13933. };
  13934. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  13935. const trimmedOffset = LHS.indexOf(valueContent);
  13936. const iteratorMatch = valueContent.match(forIteratorRE);
  13937. if (iteratorMatch) {
  13938. valueContent = valueContent.replace(forIteratorRE, "").trim();
  13939. const keyContent = iteratorMatch[1].trim();
  13940. let keyOffset;
  13941. if (keyContent) {
  13942. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  13943. result.key = createAliasExpression(keyContent, keyOffset, true);
  13944. }
  13945. if (iteratorMatch[2]) {
  13946. const indexContent = iteratorMatch[2].trim();
  13947. if (indexContent) {
  13948. result.index = createAliasExpression(
  13949. indexContent,
  13950. exp.indexOf(
  13951. indexContent,
  13952. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  13953. ),
  13954. true
  13955. );
  13956. }
  13957. }
  13958. }
  13959. if (valueContent) {
  13960. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  13961. }
  13962. return result;
  13963. }
  13964. function getSlice(start, end) {
  13965. return currentInput.slice(start, end);
  13966. }
  13967. function endOpenTag(end) {
  13968. if (tokenizer.inSFCRoot) {
  13969. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  13970. }
  13971. addNode(currentOpenTag);
  13972. const { tag, ns } = currentOpenTag;
  13973. if (ns === 0 && currentOptions.isPreTag(tag)) {
  13974. inPre++;
  13975. }
  13976. if (currentOptions.isVoidTag(tag)) {
  13977. onCloseTag(currentOpenTag, end);
  13978. } else {
  13979. stack.unshift(currentOpenTag);
  13980. if (ns === 1 || ns === 2) {
  13981. tokenizer.inXML = true;
  13982. }
  13983. }
  13984. currentOpenTag = null;
  13985. }
  13986. function onText(content, start, end) {
  13987. {
  13988. const tag = stack[0] && stack[0].tag;
  13989. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  13990. content = currentOptions.decodeEntities(content, false);
  13991. }
  13992. }
  13993. const parent = stack[0] || currentRoot;
  13994. const lastNode = parent.children[parent.children.length - 1];
  13995. if (lastNode && lastNode.type === 2) {
  13996. lastNode.content += content;
  13997. setLocEnd(lastNode.loc, end);
  13998. } else {
  13999. parent.children.push({
  14000. type: 2,
  14001. content,
  14002. loc: getLoc(start, end)
  14003. });
  14004. }
  14005. }
  14006. function onCloseTag(el, end, isImplied = false) {
  14007. if (isImplied) {
  14008. setLocEnd(el.loc, backTrack(end, 60));
  14009. } else {
  14010. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  14011. }
  14012. if (tokenizer.inSFCRoot) {
  14013. if (el.children.length) {
  14014. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  14015. } else {
  14016. el.innerLoc.end = extend({}, el.innerLoc.start);
  14017. }
  14018. el.innerLoc.source = getSlice(
  14019. el.innerLoc.start.offset,
  14020. el.innerLoc.end.offset
  14021. );
  14022. }
  14023. const { tag, ns, children } = el;
  14024. if (!inVPre) {
  14025. if (tag === "slot") {
  14026. el.tagType = 2;
  14027. } else if (isFragmentTemplate(el)) {
  14028. el.tagType = 3;
  14029. } else if (isComponent(el)) {
  14030. el.tagType = 1;
  14031. }
  14032. }
  14033. if (!tokenizer.inRCDATA) {
  14034. el.children = condenseWhitespace(children);
  14035. }
  14036. if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
  14037. const first = children[0];
  14038. if (first && first.type === 2) {
  14039. first.content = first.content.replace(/^\r?\n/, "");
  14040. }
  14041. }
  14042. if (ns === 0 && currentOptions.isPreTag(tag)) {
  14043. inPre--;
  14044. }
  14045. if (currentVPreBoundary === el) {
  14046. inVPre = tokenizer.inVPre = false;
  14047. currentVPreBoundary = null;
  14048. }
  14049. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  14050. tokenizer.inXML = false;
  14051. }
  14052. }
  14053. function lookAhead(index, c) {
  14054. let i = index;
  14055. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
  14056. return i;
  14057. }
  14058. function backTrack(index, c) {
  14059. let i = index;
  14060. while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
  14061. return i;
  14062. }
  14063. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  14064. function isFragmentTemplate({ tag, props }) {
  14065. if (tag === "template") {
  14066. for (let i = 0; i < props.length; i++) {
  14067. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  14068. return true;
  14069. }
  14070. }
  14071. }
  14072. return false;
  14073. }
  14074. function isComponent({ tag, props }) {
  14075. if (currentOptions.isCustomElement(tag)) {
  14076. return false;
  14077. }
  14078. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  14079. return true;
  14080. }
  14081. for (let i = 0; i < props.length; i++) {
  14082. const p = props[i];
  14083. if (p.type === 6) {
  14084. if (p.name === "is" && p.value) {
  14085. if (p.value.content.startsWith("vue:")) {
  14086. return true;
  14087. }
  14088. }
  14089. }
  14090. }
  14091. return false;
  14092. }
  14093. function isUpperCase(c) {
  14094. return c > 64 && c < 91;
  14095. }
  14096. const windowsNewlineRE = /\r\n/g;
  14097. function condenseWhitespace(nodes, tag) {
  14098. const shouldCondense = currentOptions.whitespace !== "preserve";
  14099. let removedWhitespace = false;
  14100. for (let i = 0; i < nodes.length; i++) {
  14101. const node = nodes[i];
  14102. if (node.type === 2) {
  14103. if (!inPre) {
  14104. if (isAllWhitespace(node.content)) {
  14105. const prev = nodes[i - 1] && nodes[i - 1].type;
  14106. const next = nodes[i + 1] && nodes[i + 1].type;
  14107. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  14108. removedWhitespace = true;
  14109. nodes[i] = null;
  14110. } else {
  14111. node.content = " ";
  14112. }
  14113. } else if (shouldCondense) {
  14114. node.content = condense(node.content);
  14115. }
  14116. } else {
  14117. node.content = node.content.replace(windowsNewlineRE, "\n");
  14118. }
  14119. }
  14120. }
  14121. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  14122. }
  14123. function isAllWhitespace(str) {
  14124. for (let i = 0; i < str.length; i++) {
  14125. if (!isWhitespace(str.charCodeAt(i))) {
  14126. return false;
  14127. }
  14128. }
  14129. return true;
  14130. }
  14131. function hasNewlineChar(str) {
  14132. for (let i = 0; i < str.length; i++) {
  14133. const c = str.charCodeAt(i);
  14134. if (c === 10 || c === 13) {
  14135. return true;
  14136. }
  14137. }
  14138. return false;
  14139. }
  14140. function condense(str) {
  14141. let ret = "";
  14142. let prevCharIsWhitespace = false;
  14143. for (let i = 0; i < str.length; i++) {
  14144. if (isWhitespace(str.charCodeAt(i))) {
  14145. if (!prevCharIsWhitespace) {
  14146. ret += " ";
  14147. prevCharIsWhitespace = true;
  14148. }
  14149. } else {
  14150. ret += str[i];
  14151. prevCharIsWhitespace = false;
  14152. }
  14153. }
  14154. return ret;
  14155. }
  14156. function addNode(node) {
  14157. (stack[0] || currentRoot).children.push(node);
  14158. }
  14159. function getLoc(start, end) {
  14160. return {
  14161. start: tokenizer.getPos(start),
  14162. // @ts-expect-error allow late attachment
  14163. end: end == null ? end : tokenizer.getPos(end),
  14164. // @ts-expect-error allow late attachment
  14165. source: end == null ? end : getSlice(start, end)
  14166. };
  14167. }
  14168. function cloneLoc(loc) {
  14169. return getLoc(loc.start.offset, loc.end.offset);
  14170. }
  14171. function setLocEnd(loc, end) {
  14172. loc.end = tokenizer.getPos(end);
  14173. loc.source = getSlice(loc.start.offset, end);
  14174. }
  14175. function dirToAttr(dir) {
  14176. const attr = {
  14177. type: 6,
  14178. name: dir.rawName,
  14179. nameLoc: getLoc(
  14180. dir.loc.start.offset,
  14181. dir.loc.start.offset + dir.rawName.length
  14182. ),
  14183. value: void 0,
  14184. loc: dir.loc
  14185. };
  14186. if (dir.exp) {
  14187. const loc = dir.exp.loc;
  14188. if (loc.end.offset < dir.loc.end.offset) {
  14189. loc.start.offset--;
  14190. loc.start.column--;
  14191. loc.end.offset++;
  14192. loc.end.column++;
  14193. }
  14194. attr.value = {
  14195. type: 2,
  14196. content: dir.exp.content,
  14197. loc
  14198. };
  14199. }
  14200. return attr;
  14201. }
  14202. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  14203. const exp = createSimpleExpression(content, isStatic, loc, constType);
  14204. return exp;
  14205. }
  14206. function emitError(code, index, message) {
  14207. currentOptions.onError(
  14208. createCompilerError(code, getLoc(index, index), void 0, message)
  14209. );
  14210. }
  14211. function reset() {
  14212. tokenizer.reset();
  14213. currentOpenTag = null;
  14214. currentProp = null;
  14215. currentAttrValue = "";
  14216. currentAttrStartIndex = -1;
  14217. currentAttrEndIndex = -1;
  14218. stack.length = 0;
  14219. }
  14220. function baseParse(input, options) {
  14221. reset();
  14222. currentInput = input;
  14223. currentOptions = extend({}, defaultParserOptions);
  14224. if (options) {
  14225. let key;
  14226. for (key in options) {
  14227. if (options[key] != null) {
  14228. currentOptions[key] = options[key];
  14229. }
  14230. }
  14231. }
  14232. {
  14233. if (!currentOptions.decodeEntities) {
  14234. throw new Error(
  14235. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  14236. );
  14237. }
  14238. }
  14239. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  14240. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  14241. const delimiters = options && options.delimiters;
  14242. if (delimiters) {
  14243. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  14244. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  14245. }
  14246. const root = currentRoot = createRoot([], input);
  14247. tokenizer.parse(currentInput);
  14248. root.loc = getLoc(0, input.length);
  14249. root.children = condenseWhitespace(root.children);
  14250. currentRoot = null;
  14251. return root;
  14252. }
  14253. function cacheStatic(root, context) {
  14254. walk(
  14255. root,
  14256. void 0,
  14257. context,
  14258. // Root node is unfortunately non-hoistable due to potential parent
  14259. // fallthrough attributes.
  14260. isSingleElementRoot(root, root.children[0])
  14261. );
  14262. }
  14263. function isSingleElementRoot(root, child) {
  14264. const { children } = root;
  14265. return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
  14266. }
  14267. function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
  14268. const { children } = node;
  14269. const toCache = [];
  14270. for (let i = 0; i < children.length; i++) {
  14271. const child = children[i];
  14272. if (child.type === 1 && child.tagType === 0) {
  14273. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  14274. if (constantType > 0) {
  14275. if (constantType >= 2) {
  14276. child.codegenNode.patchFlag = -1;
  14277. toCache.push(child);
  14278. continue;
  14279. }
  14280. } else {
  14281. const codegenNode = child.codegenNode;
  14282. if (codegenNode.type === 13) {
  14283. const flag = codegenNode.patchFlag;
  14284. if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  14285. const props = getNodeProps(child);
  14286. if (props) {
  14287. codegenNode.props = context.hoist(props);
  14288. }
  14289. }
  14290. if (codegenNode.dynamicProps) {
  14291. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  14292. }
  14293. }
  14294. }
  14295. } else if (child.type === 12) {
  14296. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  14297. if (constantType >= 2) {
  14298. toCache.push(child);
  14299. continue;
  14300. }
  14301. }
  14302. if (child.type === 1) {
  14303. const isComponent = child.tagType === 1;
  14304. if (isComponent) {
  14305. context.scopes.vSlot++;
  14306. }
  14307. walk(child, node, context, false, inFor);
  14308. if (isComponent) {
  14309. context.scopes.vSlot--;
  14310. }
  14311. } else if (child.type === 11) {
  14312. walk(child, node, context, child.children.length === 1, true);
  14313. } else if (child.type === 9) {
  14314. for (let i2 = 0; i2 < child.branches.length; i2++) {
  14315. walk(
  14316. child.branches[i2],
  14317. node,
  14318. context,
  14319. child.branches[i2].children.length === 1,
  14320. inFor
  14321. );
  14322. }
  14323. }
  14324. }
  14325. let cachedAsArray = false;
  14326. if (toCache.length === children.length && node.type === 1) {
  14327. if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  14328. node.codegenNode.children = getCacheExpression(
  14329. createArrayExpression(node.codegenNode.children)
  14330. );
  14331. cachedAsArray = true;
  14332. } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
  14333. const slot = getSlotNode(node.codegenNode, "default");
  14334. if (slot) {
  14335. slot.returns = getCacheExpression(
  14336. createArrayExpression(slot.returns)
  14337. );
  14338. cachedAsArray = true;
  14339. }
  14340. } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) {
  14341. const slotName = findDir(node, "slot", true);
  14342. const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
  14343. if (slot) {
  14344. slot.returns = getCacheExpression(
  14345. createArrayExpression(slot.returns)
  14346. );
  14347. cachedAsArray = true;
  14348. }
  14349. }
  14350. }
  14351. if (!cachedAsArray) {
  14352. for (const child of toCache) {
  14353. child.codegenNode = context.cache(child.codegenNode);
  14354. }
  14355. }
  14356. function getCacheExpression(value) {
  14357. const exp = context.cache(value);
  14358. if (inFor && context.hmr) {
  14359. exp.needArraySpread = true;
  14360. }
  14361. return exp;
  14362. }
  14363. function getSlotNode(node2, name) {
  14364. if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
  14365. const slot = node2.children.properties.find(
  14366. (p) => p.key === name || p.key.content === name
  14367. );
  14368. return slot && slot.value;
  14369. }
  14370. }
  14371. if (toCache.length && context.transformHoist) {
  14372. context.transformHoist(children, context, node);
  14373. }
  14374. }
  14375. function getConstantType(node, context) {
  14376. const { constantCache } = context;
  14377. switch (node.type) {
  14378. case 1:
  14379. if (node.tagType !== 0) {
  14380. return 0;
  14381. }
  14382. const cached = constantCache.get(node);
  14383. if (cached !== void 0) {
  14384. return cached;
  14385. }
  14386. const codegenNode = node.codegenNode;
  14387. if (codegenNode.type !== 13) {
  14388. return 0;
  14389. }
  14390. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
  14391. return 0;
  14392. }
  14393. if (codegenNode.patchFlag === void 0) {
  14394. let returnType2 = 3;
  14395. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  14396. if (generatedPropsType === 0) {
  14397. constantCache.set(node, 0);
  14398. return 0;
  14399. }
  14400. if (generatedPropsType < returnType2) {
  14401. returnType2 = generatedPropsType;
  14402. }
  14403. for (let i = 0; i < node.children.length; i++) {
  14404. const childType = getConstantType(node.children[i], context);
  14405. if (childType === 0) {
  14406. constantCache.set(node, 0);
  14407. return 0;
  14408. }
  14409. if (childType < returnType2) {
  14410. returnType2 = childType;
  14411. }
  14412. }
  14413. if (returnType2 > 1) {
  14414. for (let i = 0; i < node.props.length; i++) {
  14415. const p = node.props[i];
  14416. if (p.type === 7 && p.name === "bind" && p.exp) {
  14417. const expType = getConstantType(p.exp, context);
  14418. if (expType === 0) {
  14419. constantCache.set(node, 0);
  14420. return 0;
  14421. }
  14422. if (expType < returnType2) {
  14423. returnType2 = expType;
  14424. }
  14425. }
  14426. }
  14427. }
  14428. if (codegenNode.isBlock) {
  14429. for (let i = 0; i < node.props.length; i++) {
  14430. const p = node.props[i];
  14431. if (p.type === 7) {
  14432. constantCache.set(node, 0);
  14433. return 0;
  14434. }
  14435. }
  14436. context.removeHelper(OPEN_BLOCK);
  14437. context.removeHelper(
  14438. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  14439. );
  14440. codegenNode.isBlock = false;
  14441. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  14442. }
  14443. constantCache.set(node, returnType2);
  14444. return returnType2;
  14445. } else {
  14446. constantCache.set(node, 0);
  14447. return 0;
  14448. }
  14449. case 2:
  14450. case 3:
  14451. return 3;
  14452. case 9:
  14453. case 11:
  14454. case 10:
  14455. return 0;
  14456. case 5:
  14457. case 12:
  14458. return getConstantType(node.content, context);
  14459. case 4:
  14460. return node.constType;
  14461. case 8:
  14462. let returnType = 3;
  14463. for (let i = 0; i < node.children.length; i++) {
  14464. const child = node.children[i];
  14465. if (isString(child) || isSymbol(child)) {
  14466. continue;
  14467. }
  14468. const childType = getConstantType(child, context);
  14469. if (childType === 0) {
  14470. return 0;
  14471. } else if (childType < returnType) {
  14472. returnType = childType;
  14473. }
  14474. }
  14475. return returnType;
  14476. case 20:
  14477. return 2;
  14478. default:
  14479. return 0;
  14480. }
  14481. }
  14482. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  14483. NORMALIZE_CLASS,
  14484. NORMALIZE_STYLE,
  14485. NORMALIZE_PROPS,
  14486. GUARD_REACTIVE_PROPS
  14487. ]);
  14488. function getConstantTypeOfHelperCall(value, context) {
  14489. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  14490. const arg = value.arguments[0];
  14491. if (arg.type === 4) {
  14492. return getConstantType(arg, context);
  14493. } else if (arg.type === 14) {
  14494. return getConstantTypeOfHelperCall(arg, context);
  14495. }
  14496. }
  14497. return 0;
  14498. }
  14499. function getGeneratedPropsConstantType(node, context) {
  14500. let returnType = 3;
  14501. const props = getNodeProps(node);
  14502. if (props && props.type === 15) {
  14503. const { properties } = props;
  14504. for (let i = 0; i < properties.length; i++) {
  14505. const { key, value } = properties[i];
  14506. const keyType = getConstantType(key, context);
  14507. if (keyType === 0) {
  14508. return keyType;
  14509. }
  14510. if (keyType < returnType) {
  14511. returnType = keyType;
  14512. }
  14513. let valueType;
  14514. if (value.type === 4) {
  14515. valueType = getConstantType(value, context);
  14516. } else if (value.type === 14) {
  14517. valueType = getConstantTypeOfHelperCall(value, context);
  14518. } else {
  14519. valueType = 0;
  14520. }
  14521. if (valueType === 0) {
  14522. return valueType;
  14523. }
  14524. if (valueType < returnType) {
  14525. returnType = valueType;
  14526. }
  14527. }
  14528. }
  14529. return returnType;
  14530. }
  14531. function getNodeProps(node) {
  14532. const codegenNode = node.codegenNode;
  14533. if (codegenNode.type === 13) {
  14534. return codegenNode.props;
  14535. }
  14536. }
  14537. function createTransformContext(root, {
  14538. filename = "",
  14539. prefixIdentifiers = false,
  14540. hoistStatic = false,
  14541. hmr = false,
  14542. cacheHandlers = false,
  14543. nodeTransforms = [],
  14544. directiveTransforms = {},
  14545. transformHoist = null,
  14546. isBuiltInComponent = NOOP,
  14547. isCustomElement = NOOP,
  14548. expressionPlugins = [],
  14549. scopeId = null,
  14550. slotted = true,
  14551. ssr = false,
  14552. inSSR = false,
  14553. ssrCssVars = ``,
  14554. bindingMetadata = EMPTY_OBJ,
  14555. inline = false,
  14556. isTS = false,
  14557. onError = defaultOnError,
  14558. onWarn = defaultOnWarn,
  14559. compatConfig
  14560. }) {
  14561. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  14562. const context = {
  14563. // options
  14564. filename,
  14565. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  14566. prefixIdentifiers,
  14567. hoistStatic,
  14568. hmr,
  14569. cacheHandlers,
  14570. nodeTransforms,
  14571. directiveTransforms,
  14572. transformHoist,
  14573. isBuiltInComponent,
  14574. isCustomElement,
  14575. expressionPlugins,
  14576. scopeId,
  14577. slotted,
  14578. ssr,
  14579. inSSR,
  14580. ssrCssVars,
  14581. bindingMetadata,
  14582. inline,
  14583. isTS,
  14584. onError,
  14585. onWarn,
  14586. compatConfig,
  14587. // state
  14588. root,
  14589. helpers: /* @__PURE__ */ new Map(),
  14590. components: /* @__PURE__ */ new Set(),
  14591. directives: /* @__PURE__ */ new Set(),
  14592. hoists: [],
  14593. imports: [],
  14594. cached: [],
  14595. constantCache: /* @__PURE__ */ new WeakMap(),
  14596. temps: 0,
  14597. identifiers: /* @__PURE__ */ Object.create(null),
  14598. scopes: {
  14599. vFor: 0,
  14600. vSlot: 0,
  14601. vPre: 0,
  14602. vOnce: 0
  14603. },
  14604. parent: null,
  14605. grandParent: null,
  14606. currentNode: root,
  14607. childIndex: 0,
  14608. inVOnce: false,
  14609. // methods
  14610. helper(name) {
  14611. const count = context.helpers.get(name) || 0;
  14612. context.helpers.set(name, count + 1);
  14613. return name;
  14614. },
  14615. removeHelper(name) {
  14616. const count = context.helpers.get(name);
  14617. if (count) {
  14618. const currentCount = count - 1;
  14619. if (!currentCount) {
  14620. context.helpers.delete(name);
  14621. } else {
  14622. context.helpers.set(name, currentCount);
  14623. }
  14624. }
  14625. },
  14626. helperString(name) {
  14627. return `_${helperNameMap[context.helper(name)]}`;
  14628. },
  14629. replaceNode(node) {
  14630. {
  14631. if (!context.currentNode) {
  14632. throw new Error(`Node being replaced is already removed.`);
  14633. }
  14634. if (!context.parent) {
  14635. throw new Error(`Cannot replace root node.`);
  14636. }
  14637. }
  14638. context.parent.children[context.childIndex] = context.currentNode = node;
  14639. },
  14640. removeNode(node) {
  14641. if (!context.parent) {
  14642. throw new Error(`Cannot remove root node.`);
  14643. }
  14644. const list = context.parent.children;
  14645. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  14646. if (removalIndex < 0) {
  14647. throw new Error(`node being removed is not a child of current parent`);
  14648. }
  14649. if (!node || node === context.currentNode) {
  14650. context.currentNode = null;
  14651. context.onNodeRemoved();
  14652. } else {
  14653. if (context.childIndex > removalIndex) {
  14654. context.childIndex--;
  14655. context.onNodeRemoved();
  14656. }
  14657. }
  14658. context.parent.children.splice(removalIndex, 1);
  14659. },
  14660. onNodeRemoved: NOOP,
  14661. addIdentifiers(exp) {
  14662. },
  14663. removeIdentifiers(exp) {
  14664. },
  14665. hoist(exp) {
  14666. if (isString(exp)) exp = createSimpleExpression(exp);
  14667. context.hoists.push(exp);
  14668. const identifier = createSimpleExpression(
  14669. `_hoisted_${context.hoists.length}`,
  14670. false,
  14671. exp.loc,
  14672. 2
  14673. );
  14674. identifier.hoisted = exp;
  14675. return identifier;
  14676. },
  14677. cache(exp, isVNode = false, inVOnce = false) {
  14678. const cacheExp = createCacheExpression(
  14679. context.cached.length,
  14680. exp,
  14681. isVNode,
  14682. inVOnce
  14683. );
  14684. context.cached.push(cacheExp);
  14685. return cacheExp;
  14686. }
  14687. };
  14688. return context;
  14689. }
  14690. function transform(root, options) {
  14691. const context = createTransformContext(root, options);
  14692. traverseNode(root, context);
  14693. if (options.hoistStatic) {
  14694. cacheStatic(root, context);
  14695. }
  14696. if (!options.ssr) {
  14697. createRootCodegen(root, context);
  14698. }
  14699. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  14700. root.components = [...context.components];
  14701. root.directives = [...context.directives];
  14702. root.imports = context.imports;
  14703. root.hoists = context.hoists;
  14704. root.temps = context.temps;
  14705. root.cached = context.cached;
  14706. root.transformed = true;
  14707. }
  14708. function createRootCodegen(root, context) {
  14709. const { helper } = context;
  14710. const { children } = root;
  14711. if (children.length === 1) {
  14712. const child = children[0];
  14713. if (isSingleElementRoot(root, child) && child.codegenNode) {
  14714. const codegenNode = child.codegenNode;
  14715. if (codegenNode.type === 13) {
  14716. convertToBlock(codegenNode, context);
  14717. }
  14718. root.codegenNode = codegenNode;
  14719. } else {
  14720. root.codegenNode = child;
  14721. }
  14722. } else if (children.length > 1) {
  14723. let patchFlag = 64;
  14724. if (children.filter((c) => c.type !== 3).length === 1) {
  14725. patchFlag |= 2048;
  14726. }
  14727. root.codegenNode = createVNodeCall(
  14728. context,
  14729. helper(FRAGMENT),
  14730. void 0,
  14731. root.children,
  14732. patchFlag,
  14733. void 0,
  14734. void 0,
  14735. true,
  14736. void 0,
  14737. false
  14738. );
  14739. } else ;
  14740. }
  14741. function traverseChildren(parent, context) {
  14742. let i = 0;
  14743. const nodeRemoved = () => {
  14744. i--;
  14745. };
  14746. for (; i < parent.children.length; i++) {
  14747. const child = parent.children[i];
  14748. if (isString(child)) continue;
  14749. context.grandParent = context.parent;
  14750. context.parent = parent;
  14751. context.childIndex = i;
  14752. context.onNodeRemoved = nodeRemoved;
  14753. traverseNode(child, context);
  14754. }
  14755. }
  14756. function traverseNode(node, context) {
  14757. context.currentNode = node;
  14758. const { nodeTransforms } = context;
  14759. const exitFns = [];
  14760. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  14761. const onExit = nodeTransforms[i2](node, context);
  14762. if (onExit) {
  14763. if (isArray(onExit)) {
  14764. exitFns.push(...onExit);
  14765. } else {
  14766. exitFns.push(onExit);
  14767. }
  14768. }
  14769. if (!context.currentNode) {
  14770. return;
  14771. } else {
  14772. node = context.currentNode;
  14773. }
  14774. }
  14775. switch (node.type) {
  14776. case 3:
  14777. if (!context.ssr) {
  14778. context.helper(CREATE_COMMENT);
  14779. }
  14780. break;
  14781. case 5:
  14782. if (!context.ssr) {
  14783. context.helper(TO_DISPLAY_STRING);
  14784. }
  14785. break;
  14786. // for container types, further traverse downwards
  14787. case 9:
  14788. for (let i2 = 0; i2 < node.branches.length; i2++) {
  14789. traverseNode(node.branches[i2], context);
  14790. }
  14791. break;
  14792. case 10:
  14793. case 11:
  14794. case 1:
  14795. case 0:
  14796. traverseChildren(node, context);
  14797. break;
  14798. }
  14799. context.currentNode = node;
  14800. let i = exitFns.length;
  14801. while (i--) {
  14802. exitFns[i]();
  14803. }
  14804. }
  14805. function createStructuralDirectiveTransform(name, fn) {
  14806. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  14807. return (node, context) => {
  14808. if (node.type === 1) {
  14809. const { props } = node;
  14810. if (node.tagType === 3 && props.some(isVSlot)) {
  14811. return;
  14812. }
  14813. const exitFns = [];
  14814. for (let i = 0; i < props.length; i++) {
  14815. const prop = props[i];
  14816. if (prop.type === 7 && matches(prop.name)) {
  14817. props.splice(i, 1);
  14818. i--;
  14819. const onExit = fn(node, prop, context);
  14820. if (onExit) exitFns.push(onExit);
  14821. }
  14822. }
  14823. return exitFns;
  14824. }
  14825. };
  14826. }
  14827. const PURE_ANNOTATION = `/*@__PURE__*/`;
  14828. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  14829. function createCodegenContext(ast, {
  14830. mode = "function",
  14831. prefixIdentifiers = mode === "module",
  14832. sourceMap = false,
  14833. filename = `template.vue.html`,
  14834. scopeId = null,
  14835. optimizeImports = false,
  14836. runtimeGlobalName = `Vue`,
  14837. runtimeModuleName = `vue`,
  14838. ssrRuntimeModuleName = "vue/server-renderer",
  14839. ssr = false,
  14840. isTS = false,
  14841. inSSR = false
  14842. }) {
  14843. const context = {
  14844. mode,
  14845. prefixIdentifiers,
  14846. sourceMap,
  14847. filename,
  14848. scopeId,
  14849. optimizeImports,
  14850. runtimeGlobalName,
  14851. runtimeModuleName,
  14852. ssrRuntimeModuleName,
  14853. ssr,
  14854. isTS,
  14855. inSSR,
  14856. source: ast.source,
  14857. code: ``,
  14858. column: 1,
  14859. line: 1,
  14860. offset: 0,
  14861. indentLevel: 0,
  14862. pure: false,
  14863. map: void 0,
  14864. helper(key) {
  14865. return `_${helperNameMap[key]}`;
  14866. },
  14867. push(code, newlineIndex = -2 /* None */, node) {
  14868. context.code += code;
  14869. },
  14870. indent() {
  14871. newline(++context.indentLevel);
  14872. },
  14873. deindent(withoutNewLine = false) {
  14874. if (withoutNewLine) {
  14875. --context.indentLevel;
  14876. } else {
  14877. newline(--context.indentLevel);
  14878. }
  14879. },
  14880. newline() {
  14881. newline(context.indentLevel);
  14882. }
  14883. };
  14884. function newline(n) {
  14885. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  14886. }
  14887. return context;
  14888. }
  14889. function generate(ast, options = {}) {
  14890. const context = createCodegenContext(ast, options);
  14891. if (options.onContextCreated) options.onContextCreated(context);
  14892. const {
  14893. mode,
  14894. push,
  14895. prefixIdentifiers,
  14896. indent,
  14897. deindent,
  14898. newline,
  14899. scopeId,
  14900. ssr
  14901. } = context;
  14902. const helpers = Array.from(ast.helpers);
  14903. const hasHelpers = helpers.length > 0;
  14904. const useWithBlock = !prefixIdentifiers && mode !== "module";
  14905. const preambleContext = context;
  14906. {
  14907. genFunctionPreamble(ast, preambleContext);
  14908. }
  14909. const functionName = ssr ? `ssrRender` : `render`;
  14910. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  14911. const signature = args.join(", ");
  14912. {
  14913. push(`function ${functionName}(${signature}) {`);
  14914. }
  14915. indent();
  14916. if (useWithBlock) {
  14917. push(`with (_ctx) {`);
  14918. indent();
  14919. if (hasHelpers) {
  14920. push(
  14921. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  14922. `,
  14923. -1 /* End */
  14924. );
  14925. newline();
  14926. }
  14927. }
  14928. if (ast.components.length) {
  14929. genAssets(ast.components, "component", context);
  14930. if (ast.directives.length || ast.temps > 0) {
  14931. newline();
  14932. }
  14933. }
  14934. if (ast.directives.length) {
  14935. genAssets(ast.directives, "directive", context);
  14936. if (ast.temps > 0) {
  14937. newline();
  14938. }
  14939. }
  14940. if (ast.temps > 0) {
  14941. push(`let `);
  14942. for (let i = 0; i < ast.temps; i++) {
  14943. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  14944. }
  14945. }
  14946. if (ast.components.length || ast.directives.length || ast.temps) {
  14947. push(`
  14948. `, 0 /* Start */);
  14949. newline();
  14950. }
  14951. if (!ssr) {
  14952. push(`return `);
  14953. }
  14954. if (ast.codegenNode) {
  14955. genNode(ast.codegenNode, context);
  14956. } else {
  14957. push(`null`);
  14958. }
  14959. if (useWithBlock) {
  14960. deindent();
  14961. push(`}`);
  14962. }
  14963. deindent();
  14964. push(`}`);
  14965. return {
  14966. ast,
  14967. code: context.code,
  14968. preamble: ``,
  14969. map: context.map ? context.map.toJSON() : void 0
  14970. };
  14971. }
  14972. function genFunctionPreamble(ast, context) {
  14973. const {
  14974. ssr,
  14975. prefixIdentifiers,
  14976. push,
  14977. newline,
  14978. runtimeModuleName,
  14979. runtimeGlobalName,
  14980. ssrRuntimeModuleName
  14981. } = context;
  14982. const VueBinding = runtimeGlobalName;
  14983. const helpers = Array.from(ast.helpers);
  14984. if (helpers.length > 0) {
  14985. {
  14986. push(`const _Vue = ${VueBinding}
  14987. `, -1 /* End */);
  14988. if (ast.hoists.length) {
  14989. const staticHelpers = [
  14990. CREATE_VNODE,
  14991. CREATE_ELEMENT_VNODE,
  14992. CREATE_COMMENT,
  14993. CREATE_TEXT,
  14994. CREATE_STATIC
  14995. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  14996. push(`const { ${staticHelpers} } = _Vue
  14997. `, -1 /* End */);
  14998. }
  14999. }
  15000. }
  15001. genHoists(ast.hoists, context);
  15002. newline();
  15003. push(`return `);
  15004. }
  15005. function genAssets(assets, type, { helper, push, newline, isTS }) {
  15006. const resolver = helper(
  15007. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  15008. );
  15009. for (let i = 0; i < assets.length; i++) {
  15010. let id = assets[i];
  15011. const maybeSelfReference = id.endsWith("__self");
  15012. if (maybeSelfReference) {
  15013. id = id.slice(0, -6);
  15014. }
  15015. push(
  15016. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  15017. );
  15018. if (i < assets.length - 1) {
  15019. newline();
  15020. }
  15021. }
  15022. }
  15023. function genHoists(hoists, context) {
  15024. if (!hoists.length) {
  15025. return;
  15026. }
  15027. context.pure = true;
  15028. const { push, newline } = context;
  15029. newline();
  15030. for (let i = 0; i < hoists.length; i++) {
  15031. const exp = hoists[i];
  15032. if (exp) {
  15033. push(`const _hoisted_${i + 1} = `);
  15034. genNode(exp, context);
  15035. newline();
  15036. }
  15037. }
  15038. context.pure = false;
  15039. }
  15040. function isText(n) {
  15041. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  15042. }
  15043. function genNodeListAsArray(nodes, context) {
  15044. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  15045. context.push(`[`);
  15046. multilines && context.indent();
  15047. genNodeList(nodes, context, multilines);
  15048. multilines && context.deindent();
  15049. context.push(`]`);
  15050. }
  15051. function genNodeList(nodes, context, multilines = false, comma = true) {
  15052. const { push, newline } = context;
  15053. for (let i = 0; i < nodes.length; i++) {
  15054. const node = nodes[i];
  15055. if (isString(node)) {
  15056. push(node, -3 /* Unknown */);
  15057. } else if (isArray(node)) {
  15058. genNodeListAsArray(node, context);
  15059. } else {
  15060. genNode(node, context);
  15061. }
  15062. if (i < nodes.length - 1) {
  15063. if (multilines) {
  15064. comma && push(",");
  15065. newline();
  15066. } else {
  15067. comma && push(", ");
  15068. }
  15069. }
  15070. }
  15071. }
  15072. function genNode(node, context) {
  15073. if (isString(node)) {
  15074. context.push(node, -3 /* Unknown */);
  15075. return;
  15076. }
  15077. if (isSymbol(node)) {
  15078. context.push(context.helper(node));
  15079. return;
  15080. }
  15081. switch (node.type) {
  15082. case 1:
  15083. case 9:
  15084. case 11:
  15085. assert(
  15086. node.codegenNode != null,
  15087. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  15088. );
  15089. genNode(node.codegenNode, context);
  15090. break;
  15091. case 2:
  15092. genText(node, context);
  15093. break;
  15094. case 4:
  15095. genExpression(node, context);
  15096. break;
  15097. case 5:
  15098. genInterpolation(node, context);
  15099. break;
  15100. case 12:
  15101. genNode(node.codegenNode, context);
  15102. break;
  15103. case 8:
  15104. genCompoundExpression(node, context);
  15105. break;
  15106. case 3:
  15107. genComment(node, context);
  15108. break;
  15109. case 13:
  15110. genVNodeCall(node, context);
  15111. break;
  15112. case 14:
  15113. genCallExpression(node, context);
  15114. break;
  15115. case 15:
  15116. genObjectExpression(node, context);
  15117. break;
  15118. case 17:
  15119. genArrayExpression(node, context);
  15120. break;
  15121. case 18:
  15122. genFunctionExpression(node, context);
  15123. break;
  15124. case 19:
  15125. genConditionalExpression(node, context);
  15126. break;
  15127. case 20:
  15128. genCacheExpression(node, context);
  15129. break;
  15130. case 21:
  15131. genNodeList(node.body, context, true, false);
  15132. break;
  15133. // SSR only types
  15134. case 22:
  15135. break;
  15136. case 23:
  15137. break;
  15138. case 24:
  15139. break;
  15140. case 25:
  15141. break;
  15142. case 26:
  15143. break;
  15144. /* v8 ignore start */
  15145. case 10:
  15146. break;
  15147. default:
  15148. {
  15149. assert(false, `unhandled codegen node type: ${node.type}`);
  15150. const exhaustiveCheck = node;
  15151. return exhaustiveCheck;
  15152. }
  15153. }
  15154. }
  15155. function genText(node, context) {
  15156. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  15157. }
  15158. function genExpression(node, context) {
  15159. const { content, isStatic } = node;
  15160. context.push(
  15161. isStatic ? JSON.stringify(content) : content,
  15162. -3 /* Unknown */,
  15163. node
  15164. );
  15165. }
  15166. function genInterpolation(node, context) {
  15167. const { push, helper, pure } = context;
  15168. if (pure) push(PURE_ANNOTATION);
  15169. push(`${helper(TO_DISPLAY_STRING)}(`);
  15170. genNode(node.content, context);
  15171. push(`)`);
  15172. }
  15173. function genCompoundExpression(node, context) {
  15174. for (let i = 0; i < node.children.length; i++) {
  15175. const child = node.children[i];
  15176. if (isString(child)) {
  15177. context.push(child, -3 /* Unknown */);
  15178. } else {
  15179. genNode(child, context);
  15180. }
  15181. }
  15182. }
  15183. function genExpressionAsPropertyKey(node, context) {
  15184. const { push } = context;
  15185. if (node.type === 8) {
  15186. push(`[`);
  15187. genCompoundExpression(node, context);
  15188. push(`]`);
  15189. } else if (node.isStatic) {
  15190. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  15191. push(text, -2 /* None */, node);
  15192. } else {
  15193. push(`[${node.content}]`, -3 /* Unknown */, node);
  15194. }
  15195. }
  15196. function genComment(node, context) {
  15197. const { push, helper, pure } = context;
  15198. if (pure) {
  15199. push(PURE_ANNOTATION);
  15200. }
  15201. push(
  15202. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  15203. -3 /* Unknown */,
  15204. node
  15205. );
  15206. }
  15207. function genVNodeCall(node, context) {
  15208. const { push, helper, pure } = context;
  15209. const {
  15210. tag,
  15211. props,
  15212. children,
  15213. patchFlag,
  15214. dynamicProps,
  15215. directives,
  15216. isBlock,
  15217. disableTracking,
  15218. isComponent
  15219. } = node;
  15220. let patchFlagString;
  15221. if (patchFlag) {
  15222. {
  15223. if (patchFlag < 0) {
  15224. patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  15225. } else {
  15226. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  15227. patchFlagString = patchFlag + ` /* ${flagNames} */`;
  15228. }
  15229. }
  15230. }
  15231. if (directives) {
  15232. push(helper(WITH_DIRECTIVES) + `(`);
  15233. }
  15234. if (isBlock) {
  15235. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  15236. }
  15237. if (pure) {
  15238. push(PURE_ANNOTATION);
  15239. }
  15240. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  15241. push(helper(callHelper) + `(`, -2 /* None */, node);
  15242. genNodeList(
  15243. genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
  15244. context
  15245. );
  15246. push(`)`);
  15247. if (isBlock) {
  15248. push(`)`);
  15249. }
  15250. if (directives) {
  15251. push(`, `);
  15252. genNode(directives, context);
  15253. push(`)`);
  15254. }
  15255. }
  15256. function genNullableArgs(args) {
  15257. let i = args.length;
  15258. while (i--) {
  15259. if (args[i] != null) break;
  15260. }
  15261. return args.slice(0, i + 1).map((arg) => arg || `null`);
  15262. }
  15263. function genCallExpression(node, context) {
  15264. const { push, helper, pure } = context;
  15265. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  15266. if (pure) {
  15267. push(PURE_ANNOTATION);
  15268. }
  15269. push(callee + `(`, -2 /* None */, node);
  15270. genNodeList(node.arguments, context);
  15271. push(`)`);
  15272. }
  15273. function genObjectExpression(node, context) {
  15274. const { push, indent, deindent, newline } = context;
  15275. const { properties } = node;
  15276. if (!properties.length) {
  15277. push(`{}`, -2 /* None */, node);
  15278. return;
  15279. }
  15280. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  15281. push(multilines ? `{` : `{ `);
  15282. multilines && indent();
  15283. for (let i = 0; i < properties.length; i++) {
  15284. const { key, value } = properties[i];
  15285. genExpressionAsPropertyKey(key, context);
  15286. push(`: `);
  15287. genNode(value, context);
  15288. if (i < properties.length - 1) {
  15289. push(`,`);
  15290. newline();
  15291. }
  15292. }
  15293. multilines && deindent();
  15294. push(multilines ? `}` : ` }`);
  15295. }
  15296. function genArrayExpression(node, context) {
  15297. genNodeListAsArray(node.elements, context);
  15298. }
  15299. function genFunctionExpression(node, context) {
  15300. const { push, indent, deindent } = context;
  15301. const { params, returns, body, newline, isSlot } = node;
  15302. if (isSlot) {
  15303. push(`_${helperNameMap[WITH_CTX]}(`);
  15304. }
  15305. push(`(`, -2 /* None */, node);
  15306. if (isArray(params)) {
  15307. genNodeList(params, context);
  15308. } else if (params) {
  15309. genNode(params, context);
  15310. }
  15311. push(`) => `);
  15312. if (newline || body) {
  15313. push(`{`);
  15314. indent();
  15315. }
  15316. if (returns) {
  15317. if (newline) {
  15318. push(`return `);
  15319. }
  15320. if (isArray(returns)) {
  15321. genNodeListAsArray(returns, context);
  15322. } else {
  15323. genNode(returns, context);
  15324. }
  15325. } else if (body) {
  15326. genNode(body, context);
  15327. }
  15328. if (newline || body) {
  15329. deindent();
  15330. push(`}`);
  15331. }
  15332. if (isSlot) {
  15333. push(`)`);
  15334. }
  15335. }
  15336. function genConditionalExpression(node, context) {
  15337. const { test, consequent, alternate, newline: needNewline } = node;
  15338. const { push, indent, deindent, newline } = context;
  15339. if (test.type === 4) {
  15340. const needsParens = !isSimpleIdentifier(test.content);
  15341. needsParens && push(`(`);
  15342. genExpression(test, context);
  15343. needsParens && push(`)`);
  15344. } else {
  15345. push(`(`);
  15346. genNode(test, context);
  15347. push(`)`);
  15348. }
  15349. needNewline && indent();
  15350. context.indentLevel++;
  15351. needNewline || push(` `);
  15352. push(`? `);
  15353. genNode(consequent, context);
  15354. context.indentLevel--;
  15355. needNewline && newline();
  15356. needNewline || push(` `);
  15357. push(`: `);
  15358. const isNested = alternate.type === 19;
  15359. if (!isNested) {
  15360. context.indentLevel++;
  15361. }
  15362. genNode(alternate, context);
  15363. if (!isNested) {
  15364. context.indentLevel--;
  15365. }
  15366. needNewline && deindent(
  15367. true
  15368. /* without newline */
  15369. );
  15370. }
  15371. function genCacheExpression(node, context) {
  15372. const { push, helper, indent, deindent, newline } = context;
  15373. const { needPauseTracking, needArraySpread } = node;
  15374. if (needArraySpread) {
  15375. push(`[...(`);
  15376. }
  15377. push(`_cache[${node.index}] || (`);
  15378. if (needPauseTracking) {
  15379. indent();
  15380. push(`${helper(SET_BLOCK_TRACKING)}(-1`);
  15381. if (node.inVOnce) push(`, true`);
  15382. push(`),`);
  15383. newline();
  15384. push(`(`);
  15385. }
  15386. push(`_cache[${node.index}] = `);
  15387. genNode(node.value, context);
  15388. if (needPauseTracking) {
  15389. push(`).cacheIndex = ${node.index},`);
  15390. newline();
  15391. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  15392. newline();
  15393. push(`_cache[${node.index}]`);
  15394. deindent();
  15395. }
  15396. push(`)`);
  15397. if (needArraySpread) {
  15398. push(`)]`);
  15399. }
  15400. }
  15401. const prohibitedKeywordRE = new RegExp(
  15402. "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b"
  15403. );
  15404. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  15405. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  15406. const exp = node.content;
  15407. if (!exp.trim()) {
  15408. return;
  15409. }
  15410. try {
  15411. new Function(
  15412. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  15413. );
  15414. } catch (e) {
  15415. let message = e.message;
  15416. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  15417. if (keywordMatch) {
  15418. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  15419. }
  15420. context.onError(
  15421. createCompilerError(
  15422. 45,
  15423. node.loc,
  15424. void 0,
  15425. message
  15426. )
  15427. );
  15428. }
  15429. }
  15430. const transformExpression = (node, context) => {
  15431. if (node.type === 5) {
  15432. node.content = processExpression(
  15433. node.content,
  15434. context
  15435. );
  15436. } else if (node.type === 1) {
  15437. const memo = findDir(node, "memo");
  15438. for (let i = 0; i < node.props.length; i++) {
  15439. const dir = node.props[i];
  15440. if (dir.type === 7 && dir.name !== "for") {
  15441. const exp = dir.exp;
  15442. const arg = dir.arg;
  15443. if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
  15444. !(memo && arg && arg.type === 4 && arg.content === "key")) {
  15445. dir.exp = processExpression(
  15446. exp,
  15447. context,
  15448. // slot args must be processed as function params
  15449. dir.name === "slot"
  15450. );
  15451. }
  15452. if (arg && arg.type === 4 && !arg.isStatic) {
  15453. dir.arg = processExpression(arg, context);
  15454. }
  15455. }
  15456. }
  15457. }
  15458. };
  15459. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  15460. {
  15461. {
  15462. validateBrowserExpression(node, context, asParams, asRawStatements);
  15463. }
  15464. return node;
  15465. }
  15466. }
  15467. const transformIf = createStructuralDirectiveTransform(
  15468. /^(if|else|else-if)$/,
  15469. (node, dir, context) => {
  15470. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  15471. const siblings = context.parent.children;
  15472. let i = siblings.indexOf(ifNode);
  15473. let key = 0;
  15474. while (i-- >= 0) {
  15475. const sibling = siblings[i];
  15476. if (sibling && sibling.type === 9) {
  15477. key += sibling.branches.length;
  15478. }
  15479. }
  15480. return () => {
  15481. if (isRoot) {
  15482. ifNode.codegenNode = createCodegenNodeForBranch(
  15483. branch,
  15484. key,
  15485. context
  15486. );
  15487. } else {
  15488. const parentCondition = getParentCondition(ifNode.codegenNode);
  15489. parentCondition.alternate = createCodegenNodeForBranch(
  15490. branch,
  15491. key + ifNode.branches.length - 1,
  15492. context
  15493. );
  15494. }
  15495. };
  15496. });
  15497. }
  15498. );
  15499. function processIf(node, dir, context, processCodegen) {
  15500. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  15501. const loc = dir.exp ? dir.exp.loc : node.loc;
  15502. context.onError(
  15503. createCompilerError(28, dir.loc)
  15504. );
  15505. dir.exp = createSimpleExpression(`true`, false, loc);
  15506. }
  15507. if (dir.exp) {
  15508. validateBrowserExpression(dir.exp, context);
  15509. }
  15510. if (dir.name === "if") {
  15511. const branch = createIfBranch(node, dir);
  15512. const ifNode = {
  15513. type: 9,
  15514. loc: cloneLoc(node.loc),
  15515. branches: [branch]
  15516. };
  15517. context.replaceNode(ifNode);
  15518. if (processCodegen) {
  15519. return processCodegen(ifNode, branch, true);
  15520. }
  15521. } else {
  15522. const siblings = context.parent.children;
  15523. const comments = [];
  15524. let i = siblings.indexOf(node);
  15525. while (i-- >= -1) {
  15526. const sibling = siblings[i];
  15527. if (sibling && sibling.type === 3) {
  15528. context.removeNode(sibling);
  15529. comments.unshift(sibling);
  15530. continue;
  15531. }
  15532. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  15533. context.removeNode(sibling);
  15534. continue;
  15535. }
  15536. if (sibling && sibling.type === 9) {
  15537. if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  15538. context.onError(
  15539. createCompilerError(30, node.loc)
  15540. );
  15541. }
  15542. context.removeNode();
  15543. const branch = createIfBranch(node, dir);
  15544. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  15545. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  15546. branch.children = [...comments, ...branch.children];
  15547. }
  15548. {
  15549. const key = branch.userKey;
  15550. if (key) {
  15551. sibling.branches.forEach(({ userKey }) => {
  15552. if (isSameKey(userKey, key)) {
  15553. context.onError(
  15554. createCompilerError(
  15555. 29,
  15556. branch.userKey.loc
  15557. )
  15558. );
  15559. }
  15560. });
  15561. }
  15562. }
  15563. sibling.branches.push(branch);
  15564. const onExit = processCodegen && processCodegen(sibling, branch, false);
  15565. traverseNode(branch, context);
  15566. if (onExit) onExit();
  15567. context.currentNode = null;
  15568. } else {
  15569. context.onError(
  15570. createCompilerError(30, node.loc)
  15571. );
  15572. }
  15573. break;
  15574. }
  15575. }
  15576. }
  15577. function createIfBranch(node, dir) {
  15578. const isTemplateIf = node.tagType === 3;
  15579. return {
  15580. type: 10,
  15581. loc: node.loc,
  15582. condition: dir.name === "else" ? void 0 : dir.exp,
  15583. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  15584. userKey: findProp(node, `key`),
  15585. isTemplateIf
  15586. };
  15587. }
  15588. function createCodegenNodeForBranch(branch, keyIndex, context) {
  15589. if (branch.condition) {
  15590. return createConditionalExpression(
  15591. branch.condition,
  15592. createChildrenCodegenNode(branch, keyIndex, context),
  15593. // make sure to pass in asBlock: true so that the comment node call
  15594. // closes the current block.
  15595. createCallExpression(context.helper(CREATE_COMMENT), [
  15596. '"v-if"' ,
  15597. "true"
  15598. ])
  15599. );
  15600. } else {
  15601. return createChildrenCodegenNode(branch, keyIndex, context);
  15602. }
  15603. }
  15604. function createChildrenCodegenNode(branch, keyIndex, context) {
  15605. const { helper } = context;
  15606. const keyProperty = createObjectProperty(
  15607. `key`,
  15608. createSimpleExpression(
  15609. `${keyIndex}`,
  15610. false,
  15611. locStub,
  15612. 2
  15613. )
  15614. );
  15615. const { children } = branch;
  15616. const firstChild = children[0];
  15617. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  15618. if (needFragmentWrapper) {
  15619. if (children.length === 1 && firstChild.type === 11) {
  15620. const vnodeCall = firstChild.codegenNode;
  15621. injectProp(vnodeCall, keyProperty, context);
  15622. return vnodeCall;
  15623. } else {
  15624. let patchFlag = 64;
  15625. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  15626. patchFlag |= 2048;
  15627. }
  15628. return createVNodeCall(
  15629. context,
  15630. helper(FRAGMENT),
  15631. createObjectExpression([keyProperty]),
  15632. children,
  15633. patchFlag,
  15634. void 0,
  15635. void 0,
  15636. true,
  15637. false,
  15638. false,
  15639. branch.loc
  15640. );
  15641. }
  15642. } else {
  15643. const ret = firstChild.codegenNode;
  15644. const vnodeCall = getMemoedVNodeCall(ret);
  15645. if (vnodeCall.type === 13) {
  15646. convertToBlock(vnodeCall, context);
  15647. }
  15648. injectProp(vnodeCall, keyProperty, context);
  15649. return ret;
  15650. }
  15651. }
  15652. function isSameKey(a, b) {
  15653. if (!a || a.type !== b.type) {
  15654. return false;
  15655. }
  15656. if (a.type === 6) {
  15657. if (a.value.content !== b.value.content) {
  15658. return false;
  15659. }
  15660. } else {
  15661. const exp = a.exp;
  15662. const branchExp = b.exp;
  15663. if (exp.type !== branchExp.type) {
  15664. return false;
  15665. }
  15666. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  15667. return false;
  15668. }
  15669. }
  15670. return true;
  15671. }
  15672. function getParentCondition(node) {
  15673. while (true) {
  15674. if (node.type === 19) {
  15675. if (node.alternate.type === 19) {
  15676. node = node.alternate;
  15677. } else {
  15678. return node;
  15679. }
  15680. } else if (node.type === 20) {
  15681. node = node.value;
  15682. }
  15683. }
  15684. }
  15685. const transformBind = (dir, _node, context) => {
  15686. const { modifiers, loc } = dir;
  15687. const arg = dir.arg;
  15688. let { exp } = dir;
  15689. if (exp && exp.type === 4 && !exp.content.trim()) {
  15690. {
  15691. exp = void 0;
  15692. }
  15693. }
  15694. if (!exp) {
  15695. if (arg.type !== 4 || !arg.isStatic) {
  15696. context.onError(
  15697. createCompilerError(
  15698. 52,
  15699. arg.loc
  15700. )
  15701. );
  15702. return {
  15703. props: [
  15704. createObjectProperty(arg, createSimpleExpression("", true, loc))
  15705. ]
  15706. };
  15707. }
  15708. transformBindShorthand(dir);
  15709. exp = dir.exp;
  15710. }
  15711. if (arg.type !== 4) {
  15712. arg.children.unshift(`(`);
  15713. arg.children.push(`) || ""`);
  15714. } else if (!arg.isStatic) {
  15715. arg.content = `${arg.content} || ""`;
  15716. }
  15717. if (modifiers.some((mod) => mod.content === "camel")) {
  15718. if (arg.type === 4) {
  15719. if (arg.isStatic) {
  15720. arg.content = camelize(arg.content);
  15721. } else {
  15722. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  15723. }
  15724. } else {
  15725. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  15726. arg.children.push(`)`);
  15727. }
  15728. }
  15729. if (!context.inSSR) {
  15730. if (modifiers.some((mod) => mod.content === "prop")) {
  15731. injectPrefix(arg, ".");
  15732. }
  15733. if (modifiers.some((mod) => mod.content === "attr")) {
  15734. injectPrefix(arg, "^");
  15735. }
  15736. }
  15737. return {
  15738. props: [createObjectProperty(arg, exp)]
  15739. };
  15740. };
  15741. const transformBindShorthand = (dir, context) => {
  15742. const arg = dir.arg;
  15743. const propName = camelize(arg.content);
  15744. dir.exp = createSimpleExpression(propName, false, arg.loc);
  15745. };
  15746. const injectPrefix = (arg, prefix) => {
  15747. if (arg.type === 4) {
  15748. if (arg.isStatic) {
  15749. arg.content = prefix + arg.content;
  15750. } else {
  15751. arg.content = `\`${prefix}\${${arg.content}}\``;
  15752. }
  15753. } else {
  15754. arg.children.unshift(`'${prefix}' + (`);
  15755. arg.children.push(`)`);
  15756. }
  15757. };
  15758. const transformFor = createStructuralDirectiveTransform(
  15759. "for",
  15760. (node, dir, context) => {
  15761. const { helper, removeHelper } = context;
  15762. return processFor(node, dir, context, (forNode) => {
  15763. const renderExp = createCallExpression(helper(RENDER_LIST), [
  15764. forNode.source
  15765. ]);
  15766. const isTemplate = isTemplateNode(node);
  15767. const memo = findDir(node, "memo");
  15768. const keyProp = findProp(node, `key`, false, true);
  15769. const isDirKey = keyProp && keyProp.type === 7;
  15770. if (isDirKey && !keyProp.exp) {
  15771. transformBindShorthand(keyProp);
  15772. }
  15773. let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
  15774. const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
  15775. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  15776. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  15777. forNode.codegenNode = createVNodeCall(
  15778. context,
  15779. helper(FRAGMENT),
  15780. void 0,
  15781. renderExp,
  15782. fragmentFlag,
  15783. void 0,
  15784. void 0,
  15785. true,
  15786. !isStableFragment,
  15787. false,
  15788. node.loc
  15789. );
  15790. return () => {
  15791. let childBlock;
  15792. const { children } = forNode;
  15793. if (isTemplate) {
  15794. node.children.some((c) => {
  15795. if (c.type === 1) {
  15796. const key = findProp(c, "key");
  15797. if (key) {
  15798. context.onError(
  15799. createCompilerError(
  15800. 33,
  15801. key.loc
  15802. )
  15803. );
  15804. return true;
  15805. }
  15806. }
  15807. });
  15808. }
  15809. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  15810. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  15811. if (slotOutlet) {
  15812. childBlock = slotOutlet.codegenNode;
  15813. if (isTemplate && keyProperty) {
  15814. injectProp(childBlock, keyProperty, context);
  15815. }
  15816. } else if (needFragmentWrapper) {
  15817. childBlock = createVNodeCall(
  15818. context,
  15819. helper(FRAGMENT),
  15820. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  15821. node.children,
  15822. 64,
  15823. void 0,
  15824. void 0,
  15825. true,
  15826. void 0,
  15827. false
  15828. );
  15829. } else {
  15830. childBlock = children[0].codegenNode;
  15831. if (isTemplate && keyProperty) {
  15832. injectProp(childBlock, keyProperty, context);
  15833. }
  15834. if (childBlock.isBlock !== !isStableFragment) {
  15835. if (childBlock.isBlock) {
  15836. removeHelper(OPEN_BLOCK);
  15837. removeHelper(
  15838. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  15839. );
  15840. } else {
  15841. removeHelper(
  15842. getVNodeHelper(context.inSSR, childBlock.isComponent)
  15843. );
  15844. }
  15845. }
  15846. childBlock.isBlock = !isStableFragment;
  15847. if (childBlock.isBlock) {
  15848. helper(OPEN_BLOCK);
  15849. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  15850. } else {
  15851. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  15852. }
  15853. }
  15854. if (memo) {
  15855. const loop = createFunctionExpression(
  15856. createForLoopParams(forNode.parseResult, [
  15857. createSimpleExpression(`_cached`)
  15858. ])
  15859. );
  15860. loop.body = createBlockStatement([
  15861. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  15862. createCompoundExpression([
  15863. `if (_cached`,
  15864. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  15865. ` && ${context.helperString(
  15866. IS_MEMO_SAME
  15867. )}(_cached, _memo)) return _cached`
  15868. ]),
  15869. createCompoundExpression([`const _item = `, childBlock]),
  15870. createSimpleExpression(`_item.memo = _memo`),
  15871. createSimpleExpression(`return _item`)
  15872. ]);
  15873. renderExp.arguments.push(
  15874. loop,
  15875. createSimpleExpression(`_cache`),
  15876. createSimpleExpression(String(context.cached.length))
  15877. );
  15878. context.cached.push(null);
  15879. } else {
  15880. renderExp.arguments.push(
  15881. createFunctionExpression(
  15882. createForLoopParams(forNode.parseResult),
  15883. childBlock,
  15884. true
  15885. )
  15886. );
  15887. }
  15888. };
  15889. });
  15890. }
  15891. );
  15892. function processFor(node, dir, context, processCodegen) {
  15893. if (!dir.exp) {
  15894. context.onError(
  15895. createCompilerError(31, dir.loc)
  15896. );
  15897. return;
  15898. }
  15899. const parseResult = dir.forParseResult;
  15900. if (!parseResult) {
  15901. context.onError(
  15902. createCompilerError(32, dir.loc)
  15903. );
  15904. return;
  15905. }
  15906. finalizeForParseResult(parseResult, context);
  15907. const { addIdentifiers, removeIdentifiers, scopes } = context;
  15908. const { source, value, key, index } = parseResult;
  15909. const forNode = {
  15910. type: 11,
  15911. loc: dir.loc,
  15912. source,
  15913. valueAlias: value,
  15914. keyAlias: key,
  15915. objectIndexAlias: index,
  15916. parseResult,
  15917. children: isTemplateNode(node) ? node.children : [node]
  15918. };
  15919. context.replaceNode(forNode);
  15920. scopes.vFor++;
  15921. const onExit = processCodegen && processCodegen(forNode);
  15922. return () => {
  15923. scopes.vFor--;
  15924. if (onExit) onExit();
  15925. };
  15926. }
  15927. function finalizeForParseResult(result, context) {
  15928. if (result.finalized) return;
  15929. {
  15930. validateBrowserExpression(result.source, context);
  15931. if (result.key) {
  15932. validateBrowserExpression(
  15933. result.key,
  15934. context,
  15935. true
  15936. );
  15937. }
  15938. if (result.index) {
  15939. validateBrowserExpression(
  15940. result.index,
  15941. context,
  15942. true
  15943. );
  15944. }
  15945. if (result.value) {
  15946. validateBrowserExpression(
  15947. result.value,
  15948. context,
  15949. true
  15950. );
  15951. }
  15952. }
  15953. result.finalized = true;
  15954. }
  15955. function createForLoopParams({ value, key, index }, memoArgs = []) {
  15956. return createParamsList([value, key, index, ...memoArgs]);
  15957. }
  15958. function createParamsList(args) {
  15959. let i = args.length;
  15960. while (i--) {
  15961. if (args[i]) break;
  15962. }
  15963. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  15964. }
  15965. const defaultFallback = createSimpleExpression(`undefined`, false);
  15966. const trackSlotScopes = (node, context) => {
  15967. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  15968. const vSlot = findDir(node, "slot");
  15969. if (vSlot) {
  15970. vSlot.exp;
  15971. context.scopes.vSlot++;
  15972. return () => {
  15973. context.scopes.vSlot--;
  15974. };
  15975. }
  15976. }
  15977. };
  15978. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  15979. props,
  15980. children,
  15981. false,
  15982. true,
  15983. children.length ? children[0].loc : loc
  15984. );
  15985. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  15986. context.helper(WITH_CTX);
  15987. const { children, loc } = node;
  15988. const slotsProperties = [];
  15989. const dynamicSlots = [];
  15990. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  15991. const onComponentSlot = findDir(node, "slot", true);
  15992. if (onComponentSlot) {
  15993. const { arg, exp } = onComponentSlot;
  15994. if (arg && !isStaticExp(arg)) {
  15995. hasDynamicSlots = true;
  15996. }
  15997. slotsProperties.push(
  15998. createObjectProperty(
  15999. arg || createSimpleExpression("default", true),
  16000. buildSlotFn(exp, void 0, children, loc)
  16001. )
  16002. );
  16003. }
  16004. let hasTemplateSlots = false;
  16005. let hasNamedDefaultSlot = false;
  16006. const implicitDefaultChildren = [];
  16007. const seenSlotNames = /* @__PURE__ */ new Set();
  16008. let conditionalBranchIndex = 0;
  16009. for (let i = 0; i < children.length; i++) {
  16010. const slotElement = children[i];
  16011. let slotDir;
  16012. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  16013. if (slotElement.type !== 3) {
  16014. implicitDefaultChildren.push(slotElement);
  16015. }
  16016. continue;
  16017. }
  16018. if (onComponentSlot) {
  16019. context.onError(
  16020. createCompilerError(37, slotDir.loc)
  16021. );
  16022. break;
  16023. }
  16024. hasTemplateSlots = true;
  16025. const { children: slotChildren, loc: slotLoc } = slotElement;
  16026. const {
  16027. arg: slotName = createSimpleExpression(`default`, true),
  16028. exp: slotProps,
  16029. loc: dirLoc
  16030. } = slotDir;
  16031. let staticSlotName;
  16032. if (isStaticExp(slotName)) {
  16033. staticSlotName = slotName ? slotName.content : `default`;
  16034. } else {
  16035. hasDynamicSlots = true;
  16036. }
  16037. const vFor = findDir(slotElement, "for");
  16038. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  16039. let vIf;
  16040. let vElse;
  16041. if (vIf = findDir(slotElement, "if")) {
  16042. hasDynamicSlots = true;
  16043. dynamicSlots.push(
  16044. createConditionalExpression(
  16045. vIf.exp,
  16046. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  16047. defaultFallback
  16048. )
  16049. );
  16050. } else if (vElse = findDir(
  16051. slotElement,
  16052. /^else(-if)?$/,
  16053. true
  16054. /* allowEmpty */
  16055. )) {
  16056. let j = i;
  16057. let prev;
  16058. while (j--) {
  16059. prev = children[j];
  16060. if (prev.type !== 3) {
  16061. break;
  16062. }
  16063. }
  16064. if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
  16065. let conditional = dynamicSlots[dynamicSlots.length - 1];
  16066. while (conditional.alternate.type === 19) {
  16067. conditional = conditional.alternate;
  16068. }
  16069. conditional.alternate = vElse.exp ? createConditionalExpression(
  16070. vElse.exp,
  16071. buildDynamicSlot(
  16072. slotName,
  16073. slotFunction,
  16074. conditionalBranchIndex++
  16075. ),
  16076. defaultFallback
  16077. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  16078. } else {
  16079. context.onError(
  16080. createCompilerError(30, vElse.loc)
  16081. );
  16082. }
  16083. } else if (vFor) {
  16084. hasDynamicSlots = true;
  16085. const parseResult = vFor.forParseResult;
  16086. if (parseResult) {
  16087. finalizeForParseResult(parseResult, context);
  16088. dynamicSlots.push(
  16089. createCallExpression(context.helper(RENDER_LIST), [
  16090. parseResult.source,
  16091. createFunctionExpression(
  16092. createForLoopParams(parseResult),
  16093. buildDynamicSlot(slotName, slotFunction),
  16094. true
  16095. )
  16096. ])
  16097. );
  16098. } else {
  16099. context.onError(
  16100. createCompilerError(
  16101. 32,
  16102. vFor.loc
  16103. )
  16104. );
  16105. }
  16106. } else {
  16107. if (staticSlotName) {
  16108. if (seenSlotNames.has(staticSlotName)) {
  16109. context.onError(
  16110. createCompilerError(
  16111. 38,
  16112. dirLoc
  16113. )
  16114. );
  16115. continue;
  16116. }
  16117. seenSlotNames.add(staticSlotName);
  16118. if (staticSlotName === "default") {
  16119. hasNamedDefaultSlot = true;
  16120. }
  16121. }
  16122. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  16123. }
  16124. }
  16125. if (!onComponentSlot) {
  16126. const buildDefaultSlotProperty = (props, children2) => {
  16127. const fn = buildSlotFn(props, void 0, children2, loc);
  16128. return createObjectProperty(`default`, fn);
  16129. };
  16130. if (!hasTemplateSlots) {
  16131. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  16132. } else if (implicitDefaultChildren.length && // #3766
  16133. // with whitespace: 'preserve', whitespaces between slots will end up in
  16134. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  16135. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  16136. if (hasNamedDefaultSlot) {
  16137. context.onError(
  16138. createCompilerError(
  16139. 39,
  16140. implicitDefaultChildren[0].loc
  16141. )
  16142. );
  16143. } else {
  16144. slotsProperties.push(
  16145. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  16146. );
  16147. }
  16148. }
  16149. }
  16150. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  16151. let slots = createObjectExpression(
  16152. slotsProperties.concat(
  16153. createObjectProperty(
  16154. `_`,
  16155. // 2 = compiled but dynamic = can skip normalization, but must run diff
  16156. // 1 = compiled and static = can skip normalization AND diff as optimized
  16157. createSimpleExpression(
  16158. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  16159. false
  16160. )
  16161. )
  16162. ),
  16163. loc
  16164. );
  16165. if (dynamicSlots.length) {
  16166. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  16167. slots,
  16168. createArrayExpression(dynamicSlots)
  16169. ]);
  16170. }
  16171. return {
  16172. slots,
  16173. hasDynamicSlots
  16174. };
  16175. }
  16176. function buildDynamicSlot(name, fn, index) {
  16177. const props = [
  16178. createObjectProperty(`name`, name),
  16179. createObjectProperty(`fn`, fn)
  16180. ];
  16181. if (index != null) {
  16182. props.push(
  16183. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  16184. );
  16185. }
  16186. return createObjectExpression(props);
  16187. }
  16188. function hasForwardedSlots(children) {
  16189. for (let i = 0; i < children.length; i++) {
  16190. const child = children[i];
  16191. switch (child.type) {
  16192. case 1:
  16193. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  16194. return true;
  16195. }
  16196. break;
  16197. case 9:
  16198. if (hasForwardedSlots(child.branches)) return true;
  16199. break;
  16200. case 10:
  16201. case 11:
  16202. if (hasForwardedSlots(child.children)) return true;
  16203. break;
  16204. }
  16205. }
  16206. return false;
  16207. }
  16208. function isNonWhitespaceContent(node) {
  16209. if (node.type !== 2 && node.type !== 12)
  16210. return true;
  16211. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  16212. }
  16213. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  16214. const transformElement = (node, context) => {
  16215. return function postTransformElement() {
  16216. node = context.currentNode;
  16217. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  16218. return;
  16219. }
  16220. const { tag, props } = node;
  16221. const isComponent = node.tagType === 1;
  16222. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  16223. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  16224. let vnodeProps;
  16225. let vnodeChildren;
  16226. let patchFlag = 0;
  16227. let vnodeDynamicProps;
  16228. let dynamicPropNames;
  16229. let vnodeDirectives;
  16230. let shouldUseBlock = (
  16231. // dynamic component may resolve to plain elements
  16232. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  16233. // updates inside get proper isSVG flag at runtime. (#639, #643)
  16234. // This is technically web-specific, but splitting the logic out of core
  16235. // leads to too much unnecessary complexity.
  16236. (tag === "svg" || tag === "foreignObject" || tag === "math")
  16237. );
  16238. if (props.length > 0) {
  16239. const propsBuildResult = buildProps(
  16240. node,
  16241. context,
  16242. void 0,
  16243. isComponent,
  16244. isDynamicComponent
  16245. );
  16246. vnodeProps = propsBuildResult.props;
  16247. patchFlag = propsBuildResult.patchFlag;
  16248. dynamicPropNames = propsBuildResult.dynamicPropNames;
  16249. const directives = propsBuildResult.directives;
  16250. vnodeDirectives = directives && directives.length ? createArrayExpression(
  16251. directives.map((dir) => buildDirectiveArgs(dir, context))
  16252. ) : void 0;
  16253. if (propsBuildResult.shouldUseBlock) {
  16254. shouldUseBlock = true;
  16255. }
  16256. }
  16257. if (node.children.length > 0) {
  16258. if (vnodeTag === KEEP_ALIVE) {
  16259. shouldUseBlock = true;
  16260. patchFlag |= 1024;
  16261. if (node.children.length > 1) {
  16262. context.onError(
  16263. createCompilerError(46, {
  16264. start: node.children[0].loc.start,
  16265. end: node.children[node.children.length - 1].loc.end,
  16266. source: ""
  16267. })
  16268. );
  16269. }
  16270. }
  16271. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  16272. vnodeTag !== TELEPORT && // explained above.
  16273. vnodeTag !== KEEP_ALIVE;
  16274. if (shouldBuildAsSlots) {
  16275. const { slots, hasDynamicSlots } = buildSlots(node, context);
  16276. vnodeChildren = slots;
  16277. if (hasDynamicSlots) {
  16278. patchFlag |= 1024;
  16279. }
  16280. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  16281. const child = node.children[0];
  16282. const type = child.type;
  16283. const hasDynamicTextChild = type === 5 || type === 8;
  16284. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  16285. patchFlag |= 1;
  16286. }
  16287. if (hasDynamicTextChild || type === 2) {
  16288. vnodeChildren = child;
  16289. } else {
  16290. vnodeChildren = node.children;
  16291. }
  16292. } else {
  16293. vnodeChildren = node.children;
  16294. }
  16295. }
  16296. if (dynamicPropNames && dynamicPropNames.length) {
  16297. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  16298. }
  16299. node.codegenNode = createVNodeCall(
  16300. context,
  16301. vnodeTag,
  16302. vnodeProps,
  16303. vnodeChildren,
  16304. patchFlag === 0 ? void 0 : patchFlag,
  16305. vnodeDynamicProps,
  16306. vnodeDirectives,
  16307. !!shouldUseBlock,
  16308. false,
  16309. isComponent,
  16310. node.loc
  16311. );
  16312. };
  16313. };
  16314. function resolveComponentType(node, context, ssr = false) {
  16315. let { tag } = node;
  16316. const isExplicitDynamic = isComponentTag(tag);
  16317. const isProp = findProp(
  16318. node,
  16319. "is",
  16320. false,
  16321. true
  16322. /* allow empty */
  16323. );
  16324. if (isProp) {
  16325. if (isExplicitDynamic || false) {
  16326. let exp;
  16327. if (isProp.type === 6) {
  16328. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  16329. } else {
  16330. exp = isProp.exp;
  16331. if (!exp) {
  16332. exp = createSimpleExpression(`is`, false, isProp.arg.loc);
  16333. }
  16334. }
  16335. if (exp) {
  16336. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  16337. exp
  16338. ]);
  16339. }
  16340. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  16341. tag = isProp.value.content.slice(4);
  16342. }
  16343. }
  16344. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  16345. if (builtIn) {
  16346. if (!ssr) context.helper(builtIn);
  16347. return builtIn;
  16348. }
  16349. context.helper(RESOLVE_COMPONENT);
  16350. context.components.add(tag);
  16351. return toValidAssetId(tag, `component`);
  16352. }
  16353. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  16354. const { tag, loc: elementLoc, children } = node;
  16355. let properties = [];
  16356. const mergeArgs = [];
  16357. const runtimeDirectives = [];
  16358. const hasChildren = children.length > 0;
  16359. let shouldUseBlock = false;
  16360. let patchFlag = 0;
  16361. let hasRef = false;
  16362. let hasClassBinding = false;
  16363. let hasStyleBinding = false;
  16364. let hasHydrationEventBinding = false;
  16365. let hasDynamicKeys = false;
  16366. let hasVnodeHook = false;
  16367. const dynamicPropNames = [];
  16368. const pushMergeArg = (arg) => {
  16369. if (properties.length) {
  16370. mergeArgs.push(
  16371. createObjectExpression(dedupeProperties(properties), elementLoc)
  16372. );
  16373. properties = [];
  16374. }
  16375. if (arg) mergeArgs.push(arg);
  16376. };
  16377. const pushRefVForMarker = () => {
  16378. if (context.scopes.vFor > 0) {
  16379. properties.push(
  16380. createObjectProperty(
  16381. createSimpleExpression("ref_for", true),
  16382. createSimpleExpression("true")
  16383. )
  16384. );
  16385. }
  16386. };
  16387. const analyzePatchFlag = ({ key, value }) => {
  16388. if (isStaticExp(key)) {
  16389. const name = key.content;
  16390. const isEventHandler = isOn(name);
  16391. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  16392. // dedicated fast path.
  16393. name.toLowerCase() !== "onclick" && // omit v-model handlers
  16394. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  16395. !isReservedProp(name)) {
  16396. hasHydrationEventBinding = true;
  16397. }
  16398. if (isEventHandler && isReservedProp(name)) {
  16399. hasVnodeHook = true;
  16400. }
  16401. if (isEventHandler && value.type === 14) {
  16402. value = value.arguments[0];
  16403. }
  16404. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  16405. return;
  16406. }
  16407. if (name === "ref") {
  16408. hasRef = true;
  16409. } else if (name === "class") {
  16410. hasClassBinding = true;
  16411. } else if (name === "style") {
  16412. hasStyleBinding = true;
  16413. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  16414. dynamicPropNames.push(name);
  16415. }
  16416. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  16417. dynamicPropNames.push(name);
  16418. }
  16419. } else {
  16420. hasDynamicKeys = true;
  16421. }
  16422. };
  16423. for (let i = 0; i < props.length; i++) {
  16424. const prop = props[i];
  16425. if (prop.type === 6) {
  16426. const { loc, name, nameLoc, value } = prop;
  16427. let isStatic = true;
  16428. if (name === "ref") {
  16429. hasRef = true;
  16430. pushRefVForMarker();
  16431. }
  16432. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  16433. continue;
  16434. }
  16435. properties.push(
  16436. createObjectProperty(
  16437. createSimpleExpression(name, true, nameLoc),
  16438. createSimpleExpression(
  16439. value ? value.content : "",
  16440. isStatic,
  16441. value ? value.loc : loc
  16442. )
  16443. )
  16444. );
  16445. } else {
  16446. const { name, arg, exp, loc, modifiers } = prop;
  16447. const isVBind = name === "bind";
  16448. const isVOn = name === "on";
  16449. if (name === "slot") {
  16450. if (!isComponent) {
  16451. context.onError(
  16452. createCompilerError(40, loc)
  16453. );
  16454. }
  16455. continue;
  16456. }
  16457. if (name === "once" || name === "memo") {
  16458. continue;
  16459. }
  16460. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  16461. continue;
  16462. }
  16463. if (isVOn && ssr) {
  16464. continue;
  16465. }
  16466. if (
  16467. // #938: elements with dynamic keys should be forced into blocks
  16468. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  16469. // before children
  16470. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  16471. ) {
  16472. shouldUseBlock = true;
  16473. }
  16474. if (isVBind && isStaticArgOf(arg, "ref")) {
  16475. pushRefVForMarker();
  16476. }
  16477. if (!arg && (isVBind || isVOn)) {
  16478. hasDynamicKeys = true;
  16479. if (exp) {
  16480. if (isVBind) {
  16481. pushRefVForMarker();
  16482. pushMergeArg();
  16483. mergeArgs.push(exp);
  16484. } else {
  16485. pushMergeArg({
  16486. type: 14,
  16487. loc,
  16488. callee: context.helper(TO_HANDLERS),
  16489. arguments: isComponent ? [exp] : [exp, `true`]
  16490. });
  16491. }
  16492. } else {
  16493. context.onError(
  16494. createCompilerError(
  16495. isVBind ? 34 : 35,
  16496. loc
  16497. )
  16498. );
  16499. }
  16500. continue;
  16501. }
  16502. if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
  16503. patchFlag |= 32;
  16504. }
  16505. const directiveTransform = context.directiveTransforms[name];
  16506. if (directiveTransform) {
  16507. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  16508. !ssr && props2.forEach(analyzePatchFlag);
  16509. if (isVOn && arg && !isStaticExp(arg)) {
  16510. pushMergeArg(createObjectExpression(props2, elementLoc));
  16511. } else {
  16512. properties.push(...props2);
  16513. }
  16514. if (needRuntime) {
  16515. runtimeDirectives.push(prop);
  16516. if (isSymbol(needRuntime)) {
  16517. directiveImportMap.set(prop, needRuntime);
  16518. }
  16519. }
  16520. } else if (!isBuiltInDirective(name)) {
  16521. runtimeDirectives.push(prop);
  16522. if (hasChildren) {
  16523. shouldUseBlock = true;
  16524. }
  16525. }
  16526. }
  16527. }
  16528. let propsExpression = void 0;
  16529. if (mergeArgs.length) {
  16530. pushMergeArg();
  16531. if (mergeArgs.length > 1) {
  16532. propsExpression = createCallExpression(
  16533. context.helper(MERGE_PROPS),
  16534. mergeArgs,
  16535. elementLoc
  16536. );
  16537. } else {
  16538. propsExpression = mergeArgs[0];
  16539. }
  16540. } else if (properties.length) {
  16541. propsExpression = createObjectExpression(
  16542. dedupeProperties(properties),
  16543. elementLoc
  16544. );
  16545. }
  16546. if (hasDynamicKeys) {
  16547. patchFlag |= 16;
  16548. } else {
  16549. if (hasClassBinding && !isComponent) {
  16550. patchFlag |= 2;
  16551. }
  16552. if (hasStyleBinding && !isComponent) {
  16553. patchFlag |= 4;
  16554. }
  16555. if (dynamicPropNames.length) {
  16556. patchFlag |= 8;
  16557. }
  16558. if (hasHydrationEventBinding) {
  16559. patchFlag |= 32;
  16560. }
  16561. }
  16562. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  16563. patchFlag |= 512;
  16564. }
  16565. if (!context.inSSR && propsExpression) {
  16566. switch (propsExpression.type) {
  16567. case 15:
  16568. let classKeyIndex = -1;
  16569. let styleKeyIndex = -1;
  16570. let hasDynamicKey = false;
  16571. for (let i = 0; i < propsExpression.properties.length; i++) {
  16572. const key = propsExpression.properties[i].key;
  16573. if (isStaticExp(key)) {
  16574. if (key.content === "class") {
  16575. classKeyIndex = i;
  16576. } else if (key.content === "style") {
  16577. styleKeyIndex = i;
  16578. }
  16579. } else if (!key.isHandlerKey) {
  16580. hasDynamicKey = true;
  16581. }
  16582. }
  16583. const classProp = propsExpression.properties[classKeyIndex];
  16584. const styleProp = propsExpression.properties[styleKeyIndex];
  16585. if (!hasDynamicKey) {
  16586. if (classProp && !isStaticExp(classProp.value)) {
  16587. classProp.value = createCallExpression(
  16588. context.helper(NORMALIZE_CLASS),
  16589. [classProp.value]
  16590. );
  16591. }
  16592. if (styleProp && // the static style is compiled into an object,
  16593. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  16594. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  16595. // v-bind:style with static literal object
  16596. styleProp.value.type === 17)) {
  16597. styleProp.value = createCallExpression(
  16598. context.helper(NORMALIZE_STYLE),
  16599. [styleProp.value]
  16600. );
  16601. }
  16602. } else {
  16603. propsExpression = createCallExpression(
  16604. context.helper(NORMALIZE_PROPS),
  16605. [propsExpression]
  16606. );
  16607. }
  16608. break;
  16609. case 14:
  16610. break;
  16611. default:
  16612. propsExpression = createCallExpression(
  16613. context.helper(NORMALIZE_PROPS),
  16614. [
  16615. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  16616. propsExpression
  16617. ])
  16618. ]
  16619. );
  16620. break;
  16621. }
  16622. }
  16623. return {
  16624. props: propsExpression,
  16625. directives: runtimeDirectives,
  16626. patchFlag,
  16627. dynamicPropNames,
  16628. shouldUseBlock
  16629. };
  16630. }
  16631. function dedupeProperties(properties) {
  16632. const knownProps = /* @__PURE__ */ new Map();
  16633. const deduped = [];
  16634. for (let i = 0; i < properties.length; i++) {
  16635. const prop = properties[i];
  16636. if (prop.key.type === 8 || !prop.key.isStatic) {
  16637. deduped.push(prop);
  16638. continue;
  16639. }
  16640. const name = prop.key.content;
  16641. const existing = knownProps.get(name);
  16642. if (existing) {
  16643. if (name === "style" || name === "class" || isOn(name)) {
  16644. mergeAsArray(existing, prop);
  16645. }
  16646. } else {
  16647. knownProps.set(name, prop);
  16648. deduped.push(prop);
  16649. }
  16650. }
  16651. return deduped;
  16652. }
  16653. function mergeAsArray(existing, incoming) {
  16654. if (existing.value.type === 17) {
  16655. existing.value.elements.push(incoming.value);
  16656. } else {
  16657. existing.value = createArrayExpression(
  16658. [existing.value, incoming.value],
  16659. existing.loc
  16660. );
  16661. }
  16662. }
  16663. function buildDirectiveArgs(dir, context) {
  16664. const dirArgs = [];
  16665. const runtime = directiveImportMap.get(dir);
  16666. if (runtime) {
  16667. dirArgs.push(context.helperString(runtime));
  16668. } else {
  16669. {
  16670. context.helper(RESOLVE_DIRECTIVE);
  16671. context.directives.add(dir.name);
  16672. dirArgs.push(toValidAssetId(dir.name, `directive`));
  16673. }
  16674. }
  16675. const { loc } = dir;
  16676. if (dir.exp) dirArgs.push(dir.exp);
  16677. if (dir.arg) {
  16678. if (!dir.exp) {
  16679. dirArgs.push(`void 0`);
  16680. }
  16681. dirArgs.push(dir.arg);
  16682. }
  16683. if (Object.keys(dir.modifiers).length) {
  16684. if (!dir.arg) {
  16685. if (!dir.exp) {
  16686. dirArgs.push(`void 0`);
  16687. }
  16688. dirArgs.push(`void 0`);
  16689. }
  16690. const trueExpression = createSimpleExpression(`true`, false, loc);
  16691. dirArgs.push(
  16692. createObjectExpression(
  16693. dir.modifiers.map(
  16694. (modifier) => createObjectProperty(modifier, trueExpression)
  16695. ),
  16696. loc
  16697. )
  16698. );
  16699. }
  16700. return createArrayExpression(dirArgs, dir.loc);
  16701. }
  16702. function stringifyDynamicPropNames(props) {
  16703. let propsNamesString = `[`;
  16704. for (let i = 0, l = props.length; i < l; i++) {
  16705. propsNamesString += JSON.stringify(props[i]);
  16706. if (i < l - 1) propsNamesString += ", ";
  16707. }
  16708. return propsNamesString + `]`;
  16709. }
  16710. function isComponentTag(tag) {
  16711. return tag === "component" || tag === "Component";
  16712. }
  16713. const transformSlotOutlet = (node, context) => {
  16714. if (isSlotOutlet(node)) {
  16715. const { children, loc } = node;
  16716. const { slotName, slotProps } = processSlotOutlet(node, context);
  16717. const slotArgs = [
  16718. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  16719. slotName,
  16720. "{}",
  16721. "undefined",
  16722. "true"
  16723. ];
  16724. let expectedLen = 2;
  16725. if (slotProps) {
  16726. slotArgs[2] = slotProps;
  16727. expectedLen = 3;
  16728. }
  16729. if (children.length) {
  16730. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  16731. expectedLen = 4;
  16732. }
  16733. if (context.scopeId && !context.slotted) {
  16734. expectedLen = 5;
  16735. }
  16736. slotArgs.splice(expectedLen);
  16737. node.codegenNode = createCallExpression(
  16738. context.helper(RENDER_SLOT),
  16739. slotArgs,
  16740. loc
  16741. );
  16742. }
  16743. };
  16744. function processSlotOutlet(node, context) {
  16745. let slotName = `"default"`;
  16746. let slotProps = void 0;
  16747. const nonNameProps = [];
  16748. for (let i = 0; i < node.props.length; i++) {
  16749. const p = node.props[i];
  16750. if (p.type === 6) {
  16751. if (p.value) {
  16752. if (p.name === "name") {
  16753. slotName = JSON.stringify(p.value.content);
  16754. } else {
  16755. p.name = camelize(p.name);
  16756. nonNameProps.push(p);
  16757. }
  16758. }
  16759. } else {
  16760. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  16761. if (p.exp) {
  16762. slotName = p.exp;
  16763. } else if (p.arg && p.arg.type === 4) {
  16764. const name = camelize(p.arg.content);
  16765. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  16766. }
  16767. } else {
  16768. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  16769. p.arg.content = camelize(p.arg.content);
  16770. }
  16771. nonNameProps.push(p);
  16772. }
  16773. }
  16774. }
  16775. if (nonNameProps.length > 0) {
  16776. const { props, directives } = buildProps(
  16777. node,
  16778. context,
  16779. nonNameProps,
  16780. false,
  16781. false
  16782. );
  16783. slotProps = props;
  16784. if (directives.length) {
  16785. context.onError(
  16786. createCompilerError(
  16787. 36,
  16788. directives[0].loc
  16789. )
  16790. );
  16791. }
  16792. }
  16793. return {
  16794. slotName,
  16795. slotProps
  16796. };
  16797. }
  16798. const transformOn$1 = (dir, node, context, augmentor) => {
  16799. const { loc, modifiers, arg } = dir;
  16800. if (!dir.exp && !modifiers.length) {
  16801. context.onError(createCompilerError(35, loc));
  16802. }
  16803. let eventName;
  16804. if (arg.type === 4) {
  16805. if (arg.isStatic) {
  16806. let rawName = arg.content;
  16807. if (rawName.startsWith("vnode")) {
  16808. context.onError(createCompilerError(51, arg.loc));
  16809. }
  16810. if (rawName.startsWith("vue:")) {
  16811. rawName = `vnode-${rawName.slice(4)}`;
  16812. }
  16813. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  16814. // for non-element and vnode lifecycle event listeners, auto convert
  16815. // it to camelCase. See issue #2249
  16816. toHandlerKey(camelize(rawName))
  16817. ) : (
  16818. // preserve case for plain element listeners that have uppercase
  16819. // letters, as these may be custom elements' custom events
  16820. `on:${rawName}`
  16821. );
  16822. eventName = createSimpleExpression(eventString, true, arg.loc);
  16823. } else {
  16824. eventName = createCompoundExpression([
  16825. `${context.helperString(TO_HANDLER_KEY)}(`,
  16826. arg,
  16827. `)`
  16828. ]);
  16829. }
  16830. } else {
  16831. eventName = arg;
  16832. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  16833. eventName.children.push(`)`);
  16834. }
  16835. let exp = dir.exp;
  16836. if (exp && !exp.content.trim()) {
  16837. exp = void 0;
  16838. }
  16839. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  16840. if (exp) {
  16841. const isMemberExp = isMemberExpression(exp);
  16842. const isInlineStatement = !(isMemberExp || isFnExpression(exp));
  16843. const hasMultipleStatements = exp.content.includes(`;`);
  16844. {
  16845. validateBrowserExpression(
  16846. exp,
  16847. context,
  16848. false,
  16849. hasMultipleStatements
  16850. );
  16851. }
  16852. if (isInlineStatement || shouldCache && isMemberExp) {
  16853. exp = createCompoundExpression([
  16854. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  16855. exp,
  16856. hasMultipleStatements ? `}` : `)`
  16857. ]);
  16858. }
  16859. }
  16860. let ret = {
  16861. props: [
  16862. createObjectProperty(
  16863. eventName,
  16864. exp || createSimpleExpression(`() => {}`, false, loc)
  16865. )
  16866. ]
  16867. };
  16868. if (augmentor) {
  16869. ret = augmentor(ret);
  16870. }
  16871. if (shouldCache) {
  16872. ret.props[0].value = context.cache(ret.props[0].value);
  16873. }
  16874. ret.props.forEach((p) => p.key.isHandlerKey = true);
  16875. return ret;
  16876. };
  16877. const transformText = (node, context) => {
  16878. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  16879. return () => {
  16880. const children = node.children;
  16881. let currentContainer = void 0;
  16882. let hasText = false;
  16883. for (let i = 0; i < children.length; i++) {
  16884. const child = children[i];
  16885. if (isText$1(child)) {
  16886. hasText = true;
  16887. for (let j = i + 1; j < children.length; j++) {
  16888. const next = children[j];
  16889. if (isText$1(next)) {
  16890. if (!currentContainer) {
  16891. currentContainer = children[i] = createCompoundExpression(
  16892. [child],
  16893. child.loc
  16894. );
  16895. }
  16896. currentContainer.children.push(` + `, next);
  16897. children.splice(j, 1);
  16898. j--;
  16899. } else {
  16900. currentContainer = void 0;
  16901. break;
  16902. }
  16903. }
  16904. }
  16905. }
  16906. if (!hasText || // if this is a plain element with a single text child, leave it
  16907. // as-is since the runtime has dedicated fast path for this by directly
  16908. // setting textContent of the element.
  16909. // for component root it's always normalized anyway.
  16910. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  16911. // custom directives can potentially add DOM elements arbitrarily,
  16912. // we need to avoid setting textContent of the element at runtime
  16913. // to avoid accidentally overwriting the DOM elements added
  16914. // by the user through custom directives.
  16915. !node.props.find(
  16916. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  16917. ) && // in compat mode, <template> tags with no special directives
  16918. // will be rendered as a fragment so its children must be
  16919. // converted into vnodes.
  16920. true)) {
  16921. return;
  16922. }
  16923. for (let i = 0; i < children.length; i++) {
  16924. const child = children[i];
  16925. if (isText$1(child) || child.type === 8) {
  16926. const callArgs = [];
  16927. if (child.type !== 2 || child.content !== " ") {
  16928. callArgs.push(child);
  16929. }
  16930. if (!context.ssr && getConstantType(child, context) === 0) {
  16931. callArgs.push(
  16932. 1 + (` /* ${PatchFlagNames[1]} */` )
  16933. );
  16934. }
  16935. children[i] = {
  16936. type: 12,
  16937. content: child,
  16938. loc: child.loc,
  16939. codegenNode: createCallExpression(
  16940. context.helper(CREATE_TEXT),
  16941. callArgs
  16942. )
  16943. };
  16944. }
  16945. }
  16946. };
  16947. }
  16948. };
  16949. const seen$1 = /* @__PURE__ */ new WeakSet();
  16950. const transformOnce = (node, context) => {
  16951. if (node.type === 1 && findDir(node, "once", true)) {
  16952. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  16953. return;
  16954. }
  16955. seen$1.add(node);
  16956. context.inVOnce = true;
  16957. context.helper(SET_BLOCK_TRACKING);
  16958. return () => {
  16959. context.inVOnce = false;
  16960. const cur = context.currentNode;
  16961. if (cur.codegenNode) {
  16962. cur.codegenNode = context.cache(
  16963. cur.codegenNode,
  16964. true,
  16965. true
  16966. );
  16967. }
  16968. };
  16969. }
  16970. };
  16971. const transformModel$1 = (dir, node, context) => {
  16972. const { exp, arg } = dir;
  16973. if (!exp) {
  16974. context.onError(
  16975. createCompilerError(41, dir.loc)
  16976. );
  16977. return createTransformProps();
  16978. }
  16979. const rawExp = exp.loc.source.trim();
  16980. const expString = exp.type === 4 ? exp.content : rawExp;
  16981. const bindingType = context.bindingMetadata[rawExp];
  16982. if (bindingType === "props" || bindingType === "props-aliased") {
  16983. context.onError(createCompilerError(44, exp.loc));
  16984. return createTransformProps();
  16985. }
  16986. const maybeRef = false;
  16987. if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
  16988. context.onError(
  16989. createCompilerError(42, exp.loc)
  16990. );
  16991. return createTransformProps();
  16992. }
  16993. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  16994. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  16995. let assignmentExp;
  16996. const eventArg = context.isTS ? `($event: any)` : `$event`;
  16997. {
  16998. assignmentExp = createCompoundExpression([
  16999. `${eventArg} => ((`,
  17000. exp,
  17001. `) = $event)`
  17002. ]);
  17003. }
  17004. const props = [
  17005. // modelValue: foo
  17006. createObjectProperty(propName, dir.exp),
  17007. // "onUpdate:modelValue": $event => (foo = $event)
  17008. createObjectProperty(eventName, assignmentExp)
  17009. ];
  17010. if (dir.modifiers.length && node.tagType === 1) {
  17011. const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  17012. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  17013. props.push(
  17014. createObjectProperty(
  17015. modifiersKey,
  17016. createSimpleExpression(
  17017. `{ ${modifiers} }`,
  17018. false,
  17019. dir.loc,
  17020. 2
  17021. )
  17022. )
  17023. );
  17024. }
  17025. return createTransformProps(props);
  17026. };
  17027. function createTransformProps(props = []) {
  17028. return { props };
  17029. }
  17030. const seen = /* @__PURE__ */ new WeakSet();
  17031. const transformMemo = (node, context) => {
  17032. if (node.type === 1) {
  17033. const dir = findDir(node, "memo");
  17034. if (!dir || seen.has(node)) {
  17035. return;
  17036. }
  17037. seen.add(node);
  17038. return () => {
  17039. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  17040. if (codegenNode && codegenNode.type === 13) {
  17041. if (node.tagType !== 1) {
  17042. convertToBlock(codegenNode, context);
  17043. }
  17044. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  17045. dir.exp,
  17046. createFunctionExpression(void 0, codegenNode),
  17047. `_cache`,
  17048. String(context.cached.length)
  17049. ]);
  17050. context.cached.push(null);
  17051. }
  17052. };
  17053. }
  17054. };
  17055. function getBaseTransformPreset(prefixIdentifiers) {
  17056. return [
  17057. [
  17058. transformOnce,
  17059. transformIf,
  17060. transformMemo,
  17061. transformFor,
  17062. ...[],
  17063. ...[transformExpression] ,
  17064. transformSlotOutlet,
  17065. transformElement,
  17066. trackSlotScopes,
  17067. transformText
  17068. ],
  17069. {
  17070. on: transformOn$1,
  17071. bind: transformBind,
  17072. model: transformModel$1
  17073. }
  17074. ];
  17075. }
  17076. function baseCompile(source, options = {}) {
  17077. const onError = options.onError || defaultOnError;
  17078. const isModuleMode = options.mode === "module";
  17079. {
  17080. if (options.prefixIdentifiers === true) {
  17081. onError(createCompilerError(47));
  17082. } else if (isModuleMode) {
  17083. onError(createCompilerError(48));
  17084. }
  17085. }
  17086. const prefixIdentifiers = false;
  17087. if (options.cacheHandlers) {
  17088. onError(createCompilerError(49));
  17089. }
  17090. if (options.scopeId && !isModuleMode) {
  17091. onError(createCompilerError(50));
  17092. }
  17093. const resolvedOptions = extend({}, options, {
  17094. prefixIdentifiers
  17095. });
  17096. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  17097. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  17098. transform(
  17099. ast,
  17100. extend({}, resolvedOptions, {
  17101. nodeTransforms: [
  17102. ...nodeTransforms,
  17103. ...options.nodeTransforms || []
  17104. // user transforms
  17105. ],
  17106. directiveTransforms: extend(
  17107. {},
  17108. directiveTransforms,
  17109. options.directiveTransforms || {}
  17110. // user transforms
  17111. )
  17112. })
  17113. );
  17114. return generate(ast, resolvedOptions);
  17115. }
  17116. const noopDirectiveTransform = () => ({ props: [] });
  17117. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  17118. const V_MODEL_CHECKBOX = Symbol(
  17119. `vModelCheckbox`
  17120. );
  17121. const V_MODEL_TEXT = Symbol(`vModelText` );
  17122. const V_MODEL_SELECT = Symbol(
  17123. `vModelSelect`
  17124. );
  17125. const V_MODEL_DYNAMIC = Symbol(
  17126. `vModelDynamic`
  17127. );
  17128. const V_ON_WITH_MODIFIERS = Symbol(
  17129. `vOnModifiersGuard`
  17130. );
  17131. const V_ON_WITH_KEYS = Symbol(
  17132. `vOnKeysGuard`
  17133. );
  17134. const V_SHOW = Symbol(`vShow` );
  17135. const TRANSITION = Symbol(`Transition` );
  17136. const TRANSITION_GROUP = Symbol(
  17137. `TransitionGroup`
  17138. );
  17139. registerRuntimeHelpers({
  17140. [V_MODEL_RADIO]: `vModelRadio`,
  17141. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  17142. [V_MODEL_TEXT]: `vModelText`,
  17143. [V_MODEL_SELECT]: `vModelSelect`,
  17144. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  17145. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  17146. [V_ON_WITH_KEYS]: `withKeys`,
  17147. [V_SHOW]: `vShow`,
  17148. [TRANSITION]: `Transition`,
  17149. [TRANSITION_GROUP]: `TransitionGroup`
  17150. });
  17151. let decoder;
  17152. function decodeHtmlBrowser(raw, asAttr = false) {
  17153. if (!decoder) {
  17154. decoder = document.createElement("div");
  17155. }
  17156. if (asAttr) {
  17157. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  17158. return decoder.children[0].getAttribute("foo");
  17159. } else {
  17160. decoder.innerHTML = raw;
  17161. return decoder.textContent;
  17162. }
  17163. }
  17164. const parserOptions = {
  17165. parseMode: "html",
  17166. isVoidTag,
  17167. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  17168. isPreTag: (tag) => tag === "pre",
  17169. isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
  17170. decodeEntities: decodeHtmlBrowser ,
  17171. isBuiltInComponent: (tag) => {
  17172. if (tag === "Transition" || tag === "transition") {
  17173. return TRANSITION;
  17174. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  17175. return TRANSITION_GROUP;
  17176. }
  17177. },
  17178. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  17179. getNamespace(tag, parent, rootNamespace) {
  17180. let ns = parent ? parent.ns : rootNamespace;
  17181. if (parent && ns === 2) {
  17182. if (parent.tag === "annotation-xml") {
  17183. if (tag === "svg") {
  17184. return 1;
  17185. }
  17186. if (parent.props.some(
  17187. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  17188. )) {
  17189. ns = 0;
  17190. }
  17191. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  17192. ns = 0;
  17193. }
  17194. } else if (parent && ns === 1) {
  17195. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  17196. ns = 0;
  17197. }
  17198. }
  17199. if (ns === 0) {
  17200. if (tag === "svg") {
  17201. return 1;
  17202. }
  17203. if (tag === "math") {
  17204. return 2;
  17205. }
  17206. }
  17207. return ns;
  17208. }
  17209. };
  17210. const transformStyle = (node) => {
  17211. if (node.type === 1) {
  17212. node.props.forEach((p, i) => {
  17213. if (p.type === 6 && p.name === "style" && p.value) {
  17214. node.props[i] = {
  17215. type: 7,
  17216. name: `bind`,
  17217. arg: createSimpleExpression(`style`, true, p.loc),
  17218. exp: parseInlineCSS(p.value.content, p.loc),
  17219. modifiers: [],
  17220. loc: p.loc
  17221. };
  17222. }
  17223. });
  17224. }
  17225. };
  17226. const parseInlineCSS = (cssText, loc) => {
  17227. const normalized = parseStringStyle(cssText);
  17228. return createSimpleExpression(
  17229. JSON.stringify(normalized),
  17230. false,
  17231. loc,
  17232. 3
  17233. );
  17234. };
  17235. function createDOMCompilerError(code, loc) {
  17236. return createCompilerError(
  17237. code,
  17238. loc,
  17239. DOMErrorMessages
  17240. );
  17241. }
  17242. const DOMErrorMessages = {
  17243. [53]: `v-html is missing expression.`,
  17244. [54]: `v-html will override element children.`,
  17245. [55]: `v-text is missing expression.`,
  17246. [56]: `v-text will override element children.`,
  17247. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  17248. [58]: `v-model argument is not supported on plain elements.`,
  17249. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  17250. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  17251. [61]: `v-show is missing expression.`,
  17252. [62]: `<Transition> expects exactly one child element or component.`,
  17253. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  17254. };
  17255. const transformVHtml = (dir, node, context) => {
  17256. const { exp, loc } = dir;
  17257. if (!exp) {
  17258. context.onError(
  17259. createDOMCompilerError(53, loc)
  17260. );
  17261. }
  17262. if (node.children.length) {
  17263. context.onError(
  17264. createDOMCompilerError(54, loc)
  17265. );
  17266. node.children.length = 0;
  17267. }
  17268. return {
  17269. props: [
  17270. createObjectProperty(
  17271. createSimpleExpression(`innerHTML`, true, loc),
  17272. exp || createSimpleExpression("", true)
  17273. )
  17274. ]
  17275. };
  17276. };
  17277. const transformVText = (dir, node, context) => {
  17278. const { exp, loc } = dir;
  17279. if (!exp) {
  17280. context.onError(
  17281. createDOMCompilerError(55, loc)
  17282. );
  17283. }
  17284. if (node.children.length) {
  17285. context.onError(
  17286. createDOMCompilerError(56, loc)
  17287. );
  17288. node.children.length = 0;
  17289. }
  17290. return {
  17291. props: [
  17292. createObjectProperty(
  17293. createSimpleExpression(`textContent`, true),
  17294. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  17295. context.helperString(TO_DISPLAY_STRING),
  17296. [exp],
  17297. loc
  17298. ) : createSimpleExpression("", true)
  17299. )
  17300. ]
  17301. };
  17302. };
  17303. const transformModel = (dir, node, context) => {
  17304. const baseResult = transformModel$1(dir, node, context);
  17305. if (!baseResult.props.length || node.tagType === 1) {
  17306. return baseResult;
  17307. }
  17308. if (dir.arg) {
  17309. context.onError(
  17310. createDOMCompilerError(
  17311. 58,
  17312. dir.arg.loc
  17313. )
  17314. );
  17315. }
  17316. function checkDuplicatedValue() {
  17317. const value = findDir(node, "bind");
  17318. if (value && isStaticArgOf(value.arg, "value")) {
  17319. context.onError(
  17320. createDOMCompilerError(
  17321. 60,
  17322. value.loc
  17323. )
  17324. );
  17325. }
  17326. }
  17327. const { tag } = node;
  17328. const isCustomElement = context.isCustomElement(tag);
  17329. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  17330. let directiveToUse = V_MODEL_TEXT;
  17331. let isInvalidType = false;
  17332. if (tag === "input" || isCustomElement) {
  17333. const type = findProp(node, `type`);
  17334. if (type) {
  17335. if (type.type === 7) {
  17336. directiveToUse = V_MODEL_DYNAMIC;
  17337. } else if (type.value) {
  17338. switch (type.value.content) {
  17339. case "radio":
  17340. directiveToUse = V_MODEL_RADIO;
  17341. break;
  17342. case "checkbox":
  17343. directiveToUse = V_MODEL_CHECKBOX;
  17344. break;
  17345. case "file":
  17346. isInvalidType = true;
  17347. context.onError(
  17348. createDOMCompilerError(
  17349. 59,
  17350. dir.loc
  17351. )
  17352. );
  17353. break;
  17354. default:
  17355. checkDuplicatedValue();
  17356. break;
  17357. }
  17358. }
  17359. } else if (hasDynamicKeyVBind(node)) {
  17360. directiveToUse = V_MODEL_DYNAMIC;
  17361. } else {
  17362. checkDuplicatedValue();
  17363. }
  17364. } else if (tag === "select") {
  17365. directiveToUse = V_MODEL_SELECT;
  17366. } else {
  17367. checkDuplicatedValue();
  17368. }
  17369. if (!isInvalidType) {
  17370. baseResult.needRuntime = context.helper(directiveToUse);
  17371. }
  17372. } else {
  17373. context.onError(
  17374. createDOMCompilerError(
  17375. 57,
  17376. dir.loc
  17377. )
  17378. );
  17379. }
  17380. baseResult.props = baseResult.props.filter(
  17381. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  17382. );
  17383. return baseResult;
  17384. };
  17385. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  17386. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  17387. // event propagation management
  17388. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  17389. );
  17390. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  17391. const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
  17392. const resolveModifiers = (key, modifiers, context, loc) => {
  17393. const keyModifiers = [];
  17394. const nonKeyModifiers = [];
  17395. const eventOptionModifiers = [];
  17396. for (let i = 0; i < modifiers.length; i++) {
  17397. const modifier = modifiers[i].content;
  17398. if (isEventOptionModifier(modifier)) {
  17399. eventOptionModifiers.push(modifier);
  17400. } else {
  17401. if (maybeKeyModifier(modifier)) {
  17402. if (isStaticExp(key)) {
  17403. if (isKeyboardEvent(key.content.toLowerCase())) {
  17404. keyModifiers.push(modifier);
  17405. } else {
  17406. nonKeyModifiers.push(modifier);
  17407. }
  17408. } else {
  17409. keyModifiers.push(modifier);
  17410. nonKeyModifiers.push(modifier);
  17411. }
  17412. } else {
  17413. if (isNonKeyModifier(modifier)) {
  17414. nonKeyModifiers.push(modifier);
  17415. } else {
  17416. keyModifiers.push(modifier);
  17417. }
  17418. }
  17419. }
  17420. }
  17421. return {
  17422. keyModifiers,
  17423. nonKeyModifiers,
  17424. eventOptionModifiers
  17425. };
  17426. };
  17427. const transformClick = (key, event) => {
  17428. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  17429. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  17430. `(`,
  17431. key,
  17432. `) === "onClick" ? "${event}" : (`,
  17433. key,
  17434. `)`
  17435. ]) : key;
  17436. };
  17437. const transformOn = (dir, node, context) => {
  17438. return transformOn$1(dir, node, context, (baseResult) => {
  17439. const { modifiers } = dir;
  17440. if (!modifiers.length) return baseResult;
  17441. let { key, value: handlerExp } = baseResult.props[0];
  17442. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  17443. if (nonKeyModifiers.includes("right")) {
  17444. key = transformClick(key, `onContextmenu`);
  17445. }
  17446. if (nonKeyModifiers.includes("middle")) {
  17447. key = transformClick(key, `onMouseup`);
  17448. }
  17449. if (nonKeyModifiers.length) {
  17450. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  17451. handlerExp,
  17452. JSON.stringify(nonKeyModifiers)
  17453. ]);
  17454. }
  17455. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  17456. (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
  17457. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  17458. handlerExp,
  17459. JSON.stringify(keyModifiers)
  17460. ]);
  17461. }
  17462. if (eventOptionModifiers.length) {
  17463. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  17464. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  17465. }
  17466. return {
  17467. props: [createObjectProperty(key, handlerExp)]
  17468. };
  17469. });
  17470. };
  17471. const transformShow = (dir, node, context) => {
  17472. const { exp, loc } = dir;
  17473. if (!exp) {
  17474. context.onError(
  17475. createDOMCompilerError(61, loc)
  17476. );
  17477. }
  17478. return {
  17479. props: [],
  17480. needRuntime: context.helper(V_SHOW)
  17481. };
  17482. };
  17483. const transformTransition = (node, context) => {
  17484. if (node.type === 1 && node.tagType === 1) {
  17485. const component = context.isBuiltInComponent(node.tag);
  17486. if (component === TRANSITION) {
  17487. return () => {
  17488. if (!node.children.length) {
  17489. return;
  17490. }
  17491. if (hasMultipleChildren(node)) {
  17492. context.onError(
  17493. createDOMCompilerError(
  17494. 62,
  17495. {
  17496. start: node.children[0].loc.start,
  17497. end: node.children[node.children.length - 1].loc.end,
  17498. source: ""
  17499. }
  17500. )
  17501. );
  17502. }
  17503. const child = node.children[0];
  17504. if (child.type === 1) {
  17505. for (const p of child.props) {
  17506. if (p.type === 7 && p.name === "show") {
  17507. node.props.push({
  17508. type: 6,
  17509. name: "persisted",
  17510. nameLoc: node.loc,
  17511. value: void 0,
  17512. loc: node.loc
  17513. });
  17514. }
  17515. }
  17516. }
  17517. };
  17518. }
  17519. }
  17520. };
  17521. function hasMultipleChildren(node) {
  17522. const children = node.children = node.children.filter(
  17523. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  17524. );
  17525. const child = children[0];
  17526. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  17527. }
  17528. const ignoreSideEffectTags = (node, context) => {
  17529. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  17530. context.onError(
  17531. createDOMCompilerError(
  17532. 63,
  17533. node.loc
  17534. )
  17535. );
  17536. context.removeNode();
  17537. }
  17538. };
  17539. function isValidHTMLNesting(parent, child) {
  17540. if (parent in onlyValidChildren) {
  17541. return onlyValidChildren[parent].has(child);
  17542. }
  17543. if (child in onlyValidParents) {
  17544. return onlyValidParents[child].has(parent);
  17545. }
  17546. if (parent in knownInvalidChildren) {
  17547. if (knownInvalidChildren[parent].has(child)) return false;
  17548. }
  17549. if (child in knownInvalidParents) {
  17550. if (knownInvalidParents[child].has(parent)) return false;
  17551. }
  17552. return true;
  17553. }
  17554. const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
  17555. const emptySet = /* @__PURE__ */ new Set([]);
  17556. const onlyValidChildren = {
  17557. head: /* @__PURE__ */ new Set([
  17558. "base",
  17559. "basefront",
  17560. "bgsound",
  17561. "link",
  17562. "meta",
  17563. "title",
  17564. "noscript",
  17565. "noframes",
  17566. "style",
  17567. "script",
  17568. "template"
  17569. ]),
  17570. optgroup: /* @__PURE__ */ new Set(["option"]),
  17571. select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
  17572. // table
  17573. table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
  17574. tr: /* @__PURE__ */ new Set(["td", "th"]),
  17575. colgroup: /* @__PURE__ */ new Set(["col"]),
  17576. tbody: /* @__PURE__ */ new Set(["tr"]),
  17577. thead: /* @__PURE__ */ new Set(["tr"]),
  17578. tfoot: /* @__PURE__ */ new Set(["tr"]),
  17579. // these elements can not have any children elements
  17580. script: emptySet,
  17581. iframe: emptySet,
  17582. option: emptySet,
  17583. textarea: emptySet,
  17584. style: emptySet,
  17585. title: emptySet
  17586. };
  17587. const onlyValidParents = {
  17588. // sections
  17589. html: emptySet,
  17590. body: /* @__PURE__ */ new Set(["html"]),
  17591. head: /* @__PURE__ */ new Set(["html"]),
  17592. // table
  17593. td: /* @__PURE__ */ new Set(["tr"]),
  17594. colgroup: /* @__PURE__ */ new Set(["table"]),
  17595. caption: /* @__PURE__ */ new Set(["table"]),
  17596. tbody: /* @__PURE__ */ new Set(["table"]),
  17597. tfoot: /* @__PURE__ */ new Set(["table"]),
  17598. col: /* @__PURE__ */ new Set(["colgroup"]),
  17599. th: /* @__PURE__ */ new Set(["tr"]),
  17600. thead: /* @__PURE__ */ new Set(["table"]),
  17601. tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
  17602. // data list
  17603. dd: /* @__PURE__ */ new Set(["dl", "div"]),
  17604. dt: /* @__PURE__ */ new Set(["dl", "div"]),
  17605. // other
  17606. figcaption: /* @__PURE__ */ new Set(["figure"]),
  17607. // li: new Set(["ul", "ol"]),
  17608. summary: /* @__PURE__ */ new Set(["details"]),
  17609. area: /* @__PURE__ */ new Set(["map"])
  17610. };
  17611. const knownInvalidChildren = {
  17612. p: /* @__PURE__ */ new Set([
  17613. "address",
  17614. "article",
  17615. "aside",
  17616. "blockquote",
  17617. "center",
  17618. "details",
  17619. "dialog",
  17620. "dir",
  17621. "div",
  17622. "dl",
  17623. "fieldset",
  17624. "figure",
  17625. "footer",
  17626. "form",
  17627. "h1",
  17628. "h2",
  17629. "h3",
  17630. "h4",
  17631. "h5",
  17632. "h6",
  17633. "header",
  17634. "hgroup",
  17635. "hr",
  17636. "li",
  17637. "main",
  17638. "nav",
  17639. "menu",
  17640. "ol",
  17641. "p",
  17642. "pre",
  17643. "section",
  17644. "table",
  17645. "ul"
  17646. ]),
  17647. svg: /* @__PURE__ */ new Set([
  17648. "b",
  17649. "blockquote",
  17650. "br",
  17651. "code",
  17652. "dd",
  17653. "div",
  17654. "dl",
  17655. "dt",
  17656. "em",
  17657. "embed",
  17658. "h1",
  17659. "h2",
  17660. "h3",
  17661. "h4",
  17662. "h5",
  17663. "h6",
  17664. "hr",
  17665. "i",
  17666. "img",
  17667. "li",
  17668. "menu",
  17669. "meta",
  17670. "ol",
  17671. "p",
  17672. "pre",
  17673. "ruby",
  17674. "s",
  17675. "small",
  17676. "span",
  17677. "strong",
  17678. "sub",
  17679. "sup",
  17680. "table",
  17681. "u",
  17682. "ul",
  17683. "var"
  17684. ])
  17685. };
  17686. const knownInvalidParents = {
  17687. a: /* @__PURE__ */ new Set(["a"]),
  17688. button: /* @__PURE__ */ new Set(["button"]),
  17689. dd: /* @__PURE__ */ new Set(["dd", "dt"]),
  17690. dt: /* @__PURE__ */ new Set(["dd", "dt"]),
  17691. form: /* @__PURE__ */ new Set(["form"]),
  17692. li: /* @__PURE__ */ new Set(["li"]),
  17693. h1: headings,
  17694. h2: headings,
  17695. h3: headings,
  17696. h4: headings,
  17697. h5: headings,
  17698. h6: headings
  17699. };
  17700. const validateHtmlNesting = (node, context) => {
  17701. if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
  17702. const error = new SyntaxError(
  17703. `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
  17704. );
  17705. error.loc = node.loc;
  17706. context.onWarn(error);
  17707. }
  17708. };
  17709. const DOMNodeTransforms = [
  17710. transformStyle,
  17711. ...[transformTransition, validateHtmlNesting]
  17712. ];
  17713. const DOMDirectiveTransforms = {
  17714. cloak: noopDirectiveTransform,
  17715. html: transformVHtml,
  17716. text: transformVText,
  17717. model: transformModel,
  17718. // override compiler-core
  17719. on: transformOn,
  17720. // override compiler-core
  17721. show: transformShow
  17722. };
  17723. function compile(src, options = {}) {
  17724. return baseCompile(
  17725. src,
  17726. extend({}, parserOptions, options, {
  17727. nodeTransforms: [
  17728. // ignore <script> and <tag>
  17729. // this is not put inside DOMNodeTransforms because that list is used
  17730. // by compiler-ssr to generate vnode fallback branches
  17731. ignoreSideEffectTags,
  17732. ...DOMNodeTransforms,
  17733. ...options.nodeTransforms || []
  17734. ],
  17735. directiveTransforms: extend(
  17736. {},
  17737. DOMDirectiveTransforms,
  17738. options.directiveTransforms || {}
  17739. ),
  17740. transformHoist: null
  17741. })
  17742. );
  17743. }
  17744. {
  17745. initDev();
  17746. }
  17747. const compileCache = /* @__PURE__ */ Object.create(null);
  17748. function compileToFunction(template, options) {
  17749. if (!isString(template)) {
  17750. if (template.nodeType) {
  17751. template = template.innerHTML;
  17752. } else {
  17753. warn(`invalid template option: `, template);
  17754. return NOOP;
  17755. }
  17756. }
  17757. const key = genCacheKey(template, options);
  17758. const cached = compileCache[key];
  17759. if (cached) {
  17760. return cached;
  17761. }
  17762. if (template[0] === "#") {
  17763. const el = document.querySelector(template);
  17764. if (!el) {
  17765. warn(`Template element not found or is empty: ${template}`);
  17766. }
  17767. template = el ? el.innerHTML : ``;
  17768. }
  17769. const opts = extend(
  17770. {
  17771. hoistStatic: true,
  17772. onError: onError ,
  17773. onWarn: (e) => onError(e, true)
  17774. },
  17775. options
  17776. );
  17777. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  17778. opts.isCustomElement = (tag) => !!customElements.get(tag);
  17779. }
  17780. const { code } = compile(template, opts);
  17781. function onError(err, asWarning = false) {
  17782. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  17783. const codeFrame = err.loc && generateCodeFrame(
  17784. template,
  17785. err.loc.start.offset,
  17786. err.loc.end.offset
  17787. );
  17788. warn(codeFrame ? `${message}
  17789. ${codeFrame}` : message);
  17790. }
  17791. const render = new Function(code)() ;
  17792. render._rc = true;
  17793. return compileCache[key] = render;
  17794. }
  17795. registerRuntimeCompiler(compileToFunction);
  17796. exports.BaseTransition = BaseTransition;
  17797. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  17798. exports.Comment = Comment;
  17799. exports.DeprecationTypes = DeprecationTypes;
  17800. exports.EffectScope = EffectScope;
  17801. exports.ErrorCodes = ErrorCodes;
  17802. exports.ErrorTypeStrings = ErrorTypeStrings;
  17803. exports.Fragment = Fragment;
  17804. exports.KeepAlive = KeepAlive;
  17805. exports.ReactiveEffect = ReactiveEffect;
  17806. exports.Static = Static;
  17807. exports.Suspense = Suspense;
  17808. exports.Teleport = Teleport;
  17809. exports.Text = Text;
  17810. exports.TrackOpTypes = TrackOpTypes;
  17811. exports.Transition = Transition;
  17812. exports.TransitionGroup = TransitionGroup;
  17813. exports.TriggerOpTypes = TriggerOpTypes;
  17814. exports.VueElement = VueElement;
  17815. exports.assertNumber = assertNumber;
  17816. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  17817. exports.callWithErrorHandling = callWithErrorHandling;
  17818. exports.camelize = camelize;
  17819. exports.capitalize = capitalize;
  17820. exports.cloneVNode = cloneVNode;
  17821. exports.compatUtils = compatUtils;
  17822. exports.compile = compileToFunction;
  17823. exports.computed = computed;
  17824. exports.createApp = createApp;
  17825. exports.createBlock = createBlock;
  17826. exports.createCommentVNode = createCommentVNode;
  17827. exports.createElementBlock = createElementBlock;
  17828. exports.createElementVNode = createBaseVNode;
  17829. exports.createHydrationRenderer = createHydrationRenderer;
  17830. exports.createPropsRestProxy = createPropsRestProxy;
  17831. exports.createRenderer = createRenderer;
  17832. exports.createSSRApp = createSSRApp;
  17833. exports.createSlots = createSlots;
  17834. exports.createStaticVNode = createStaticVNode;
  17835. exports.createTextVNode = createTextVNode;
  17836. exports.createVNode = createVNode;
  17837. exports.customRef = customRef;
  17838. exports.defineAsyncComponent = defineAsyncComponent;
  17839. exports.defineComponent = defineComponent;
  17840. exports.defineCustomElement = defineCustomElement;
  17841. exports.defineEmits = defineEmits;
  17842. exports.defineExpose = defineExpose;
  17843. exports.defineModel = defineModel;
  17844. exports.defineOptions = defineOptions;
  17845. exports.defineProps = defineProps;
  17846. exports.defineSSRCustomElement = defineSSRCustomElement;
  17847. exports.defineSlots = defineSlots;
  17848. exports.devtools = devtools;
  17849. exports.effect = effect;
  17850. exports.effectScope = effectScope;
  17851. exports.getCurrentInstance = getCurrentInstance;
  17852. exports.getCurrentScope = getCurrentScope;
  17853. exports.getCurrentWatcher = getCurrentWatcher;
  17854. exports.getTransitionRawChildren = getTransitionRawChildren;
  17855. exports.guardReactiveProps = guardReactiveProps;
  17856. exports.h = h;
  17857. exports.handleError = handleError;
  17858. exports.hasInjectionContext = hasInjectionContext;
  17859. exports.hydrate = hydrate;
  17860. exports.hydrateOnIdle = hydrateOnIdle;
  17861. exports.hydrateOnInteraction = hydrateOnInteraction;
  17862. exports.hydrateOnMediaQuery = hydrateOnMediaQuery;
  17863. exports.hydrateOnVisible = hydrateOnVisible;
  17864. exports.initCustomFormatter = initCustomFormatter;
  17865. exports.initDirectivesForSSR = initDirectivesForSSR;
  17866. exports.inject = inject;
  17867. exports.isMemoSame = isMemoSame;
  17868. exports.isProxy = isProxy;
  17869. exports.isReactive = isReactive;
  17870. exports.isReadonly = isReadonly;
  17871. exports.isRef = isRef;
  17872. exports.isRuntimeOnly = isRuntimeOnly;
  17873. exports.isShallow = isShallow;
  17874. exports.isVNode = isVNode;
  17875. exports.markRaw = markRaw;
  17876. exports.mergeDefaults = mergeDefaults;
  17877. exports.mergeModels = mergeModels;
  17878. exports.mergeProps = mergeProps;
  17879. exports.nextTick = nextTick;
  17880. exports.normalizeClass = normalizeClass;
  17881. exports.normalizeProps = normalizeProps;
  17882. exports.normalizeStyle = normalizeStyle;
  17883. exports.onActivated = onActivated;
  17884. exports.onBeforeMount = onBeforeMount;
  17885. exports.onBeforeUnmount = onBeforeUnmount;
  17886. exports.onBeforeUpdate = onBeforeUpdate;
  17887. exports.onDeactivated = onDeactivated;
  17888. exports.onErrorCaptured = onErrorCaptured;
  17889. exports.onMounted = onMounted;
  17890. exports.onRenderTracked = onRenderTracked;
  17891. exports.onRenderTriggered = onRenderTriggered;
  17892. exports.onScopeDispose = onScopeDispose;
  17893. exports.onServerPrefetch = onServerPrefetch;
  17894. exports.onUnmounted = onUnmounted;
  17895. exports.onUpdated = onUpdated;
  17896. exports.onWatcherCleanup = onWatcherCleanup;
  17897. exports.openBlock = openBlock;
  17898. exports.popScopeId = popScopeId;
  17899. exports.provide = provide;
  17900. exports.proxyRefs = proxyRefs;
  17901. exports.pushScopeId = pushScopeId;
  17902. exports.queuePostFlushCb = queuePostFlushCb;
  17903. exports.reactive = reactive;
  17904. exports.readonly = readonly;
  17905. exports.ref = ref;
  17906. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  17907. exports.render = render;
  17908. exports.renderList = renderList;
  17909. exports.renderSlot = renderSlot;
  17910. exports.resolveComponent = resolveComponent;
  17911. exports.resolveDirective = resolveDirective;
  17912. exports.resolveDynamicComponent = resolveDynamicComponent;
  17913. exports.resolveFilter = resolveFilter;
  17914. exports.resolveTransitionHooks = resolveTransitionHooks;
  17915. exports.setBlockTracking = setBlockTracking;
  17916. exports.setDevtoolsHook = setDevtoolsHook;
  17917. exports.setTransitionHooks = setTransitionHooks;
  17918. exports.shallowReactive = shallowReactive;
  17919. exports.shallowReadonly = shallowReadonly;
  17920. exports.shallowRef = shallowRef;
  17921. exports.ssrContextKey = ssrContextKey;
  17922. exports.ssrUtils = ssrUtils;
  17923. exports.stop = stop;
  17924. exports.toDisplayString = toDisplayString;
  17925. exports.toHandlerKey = toHandlerKey;
  17926. exports.toHandlers = toHandlers;
  17927. exports.toRaw = toRaw;
  17928. exports.toRef = toRef;
  17929. exports.toRefs = toRefs;
  17930. exports.toValue = toValue;
  17931. exports.transformVNodeArgs = transformVNodeArgs;
  17932. exports.triggerRef = triggerRef;
  17933. exports.unref = unref;
  17934. exports.useAttrs = useAttrs;
  17935. exports.useCssModule = useCssModule;
  17936. exports.useCssVars = useCssVars;
  17937. exports.useHost = useHost;
  17938. exports.useId = useId;
  17939. exports.useModel = useModel;
  17940. exports.useSSRContext = useSSRContext;
  17941. exports.useShadowRoot = useShadowRoot;
  17942. exports.useSlots = useSlots;
  17943. exports.useTemplateRef = useTemplateRef;
  17944. exports.useTransitionState = useTransitionState;
  17945. exports.vModelCheckbox = vModelCheckbox;
  17946. exports.vModelDynamic = vModelDynamic;
  17947. exports.vModelRadio = vModelRadio;
  17948. exports.vModelSelect = vModelSelect;
  17949. exports.vModelText = vModelText;
  17950. exports.vShow = vShow;
  17951. exports.version = version;
  17952. exports.warn = warn;
  17953. exports.watch = watch;
  17954. exports.watchEffect = watchEffect;
  17955. exports.watchPostEffect = watchPostEffect;
  17956. exports.watchSyncEffect = watchSyncEffect;
  17957. exports.withAsyncContext = withAsyncContext;
  17958. exports.withCtx = withCtx;
  17959. exports.withDefaults = withDefaults;
  17960. exports.withDirectives = withDirectives;
  17961. exports.withKeys = withKeys;
  17962. exports.withMemo = withMemo;
  17963. exports.withModifiers = withModifiers;
  17964. exports.withScopeId = withScopeId;
  17965. return exports;
  17966. })({});