vue.global.js 463 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361
  1. var Vue = (function (exports) {
  2. 'use strict';
  3. function makeMap(str, expectsLowerCase) {
  4. const map = /* @__PURE__ */ Object.create(null);
  5. const list = str.split(",");
  6. for (let i = 0; i < list.length; i++) {
  7. map[list[i]] = true;
  8. }
  9. return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
  10. }
  11. const EMPTY_OBJ = Object.freeze({}) ;
  12. const EMPTY_ARR = Object.freeze([]) ;
  13. const NOOP = () => {
  14. };
  15. const NO = () => false;
  16. const onRE = /^on[^a-z]/;
  17. const isOn = (key) => onRE.test(key);
  18. const isModelListener = (key) => key.startsWith("onUpdate:");
  19. const extend = Object.assign;
  20. const remove = (arr, el) => {
  21. const i = arr.indexOf(el);
  22. if (i > -1) {
  23. arr.splice(i, 1);
  24. }
  25. };
  26. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  27. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  28. const isArray = Array.isArray;
  29. const isMap = (val) => toTypeString(val) === "[object Map]";
  30. const isSet = (val) => toTypeString(val) === "[object Set]";
  31. const isDate = (val) => toTypeString(val) === "[object Date]";
  32. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  33. const isFunction = (val) => typeof val === "function";
  34. const isString = (val) => typeof val === "string";
  35. const isSymbol = (val) => typeof val === "symbol";
  36. const isObject = (val) => val !== null && typeof val === "object";
  37. const isPromise = (val) => {
  38. return isObject(val) && isFunction(val.then) && isFunction(val.catch);
  39. };
  40. const objectToString = Object.prototype.toString;
  41. const toTypeString = (value) => objectToString.call(value);
  42. const toRawType = (value) => {
  43. return toTypeString(value).slice(8, -1);
  44. };
  45. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  46. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  47. const isReservedProp = /* @__PURE__ */ makeMap(
  48. // the leading comma is intentional so empty string "" is also included
  49. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  50. );
  51. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  52. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  53. );
  54. const cacheStringFunction = (fn) => {
  55. const cache = /* @__PURE__ */ Object.create(null);
  56. return (str) => {
  57. const hit = cache[str];
  58. return hit || (cache[str] = fn(str));
  59. };
  60. };
  61. const camelizeRE = /-(\w)/g;
  62. const camelize = cacheStringFunction((str) => {
  63. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  64. });
  65. const hyphenateRE = /\B([A-Z])/g;
  66. const hyphenate = cacheStringFunction(
  67. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  68. );
  69. const capitalize = cacheStringFunction(
  70. (str) => str.charAt(0).toUpperCase() + str.slice(1)
  71. );
  72. const toHandlerKey = cacheStringFunction(
  73. (str) => str ? `on${capitalize(str)}` : ``
  74. );
  75. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  76. const invokeArrayFns = (fns, arg) => {
  77. for (let i = 0; i < fns.length; i++) {
  78. fns[i](arg);
  79. }
  80. };
  81. const def = (obj, key, value) => {
  82. Object.defineProperty(obj, key, {
  83. configurable: true,
  84. enumerable: false,
  85. value
  86. });
  87. };
  88. const looseToNumber = (val) => {
  89. const n = parseFloat(val);
  90. return isNaN(n) ? val : n;
  91. };
  92. const toNumber = (val) => {
  93. const n = isString(val) ? Number(val) : NaN;
  94. return isNaN(n) ? val : n;
  95. };
  96. let _globalThis;
  97. const getGlobalThis = () => {
  98. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  99. };
  100. const PatchFlagNames = {
  101. [1]: `TEXT`,
  102. [2]: `CLASS`,
  103. [4]: `STYLE`,
  104. [8]: `PROPS`,
  105. [16]: `FULL_PROPS`,
  106. [32]: `HYDRATE_EVENTS`,
  107. [64]: `STABLE_FRAGMENT`,
  108. [128]: `KEYED_FRAGMENT`,
  109. [256]: `UNKEYED_FRAGMENT`,
  110. [512]: `NEED_PATCH`,
  111. [1024]: `DYNAMIC_SLOTS`,
  112. [2048]: `DEV_ROOT_FRAGMENT`,
  113. [-1]: `HOISTED`,
  114. [-2]: `BAIL`
  115. };
  116. const slotFlagsText = {
  117. [1]: "STABLE",
  118. [2]: "DYNAMIC",
  119. [3]: "FORWARDED"
  120. };
  121. const GLOBALS_WHITE_LISTED = "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";
  122. const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
  123. const range = 2;
  124. function generateCodeFrame(source, start = 0, end = source.length) {
  125. let lines = source.split(/(\r?\n)/);
  126. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  127. lines = lines.filter((_, idx) => idx % 2 === 0);
  128. let count = 0;
  129. const res = [];
  130. for (let i = 0; i < lines.length; i++) {
  131. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  132. if (count >= start) {
  133. for (let j = i - range; j <= i + range || end > count; j++) {
  134. if (j < 0 || j >= lines.length)
  135. continue;
  136. const line = j + 1;
  137. res.push(
  138. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  139. );
  140. const lineLength = lines[j].length;
  141. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  142. if (j === i) {
  143. const pad = start - (count - (lineLength + newLineSeqLength));
  144. const length = Math.max(
  145. 1,
  146. end > count ? lineLength - pad : end - start
  147. );
  148. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  149. } else if (j > i) {
  150. if (end > count) {
  151. const length = Math.max(Math.min(end - count, lineLength), 1);
  152. res.push(` | ` + "^".repeat(length));
  153. }
  154. count += lineLength + newLineSeqLength;
  155. }
  156. }
  157. break;
  158. }
  159. }
  160. return res.join("\n");
  161. }
  162. function normalizeStyle(value) {
  163. if (isArray(value)) {
  164. const res = {};
  165. for (let i = 0; i < value.length; i++) {
  166. const item = value[i];
  167. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  168. if (normalized) {
  169. for (const key in normalized) {
  170. res[key] = normalized[key];
  171. }
  172. }
  173. }
  174. return res;
  175. } else if (isString(value)) {
  176. return value;
  177. } else if (isObject(value)) {
  178. return value;
  179. }
  180. }
  181. const listDelimiterRE = /;(?![^(]*\))/g;
  182. const propertyDelimiterRE = /:([^]+)/;
  183. const styleCommentRE = /\/\*[^]*?\*\//g;
  184. function parseStringStyle(cssText) {
  185. const ret = {};
  186. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  187. if (item) {
  188. const tmp = item.split(propertyDelimiterRE);
  189. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  190. }
  191. });
  192. return ret;
  193. }
  194. function normalizeClass(value) {
  195. let res = "";
  196. if (isString(value)) {
  197. res = value;
  198. } else if (isArray(value)) {
  199. for (let i = 0; i < value.length; i++) {
  200. const normalized = normalizeClass(value[i]);
  201. if (normalized) {
  202. res += normalized + " ";
  203. }
  204. }
  205. } else if (isObject(value)) {
  206. for (const name in value) {
  207. if (value[name]) {
  208. res += name + " ";
  209. }
  210. }
  211. }
  212. return res.trim();
  213. }
  214. function normalizeProps(props) {
  215. if (!props)
  216. return null;
  217. let { class: klass, style } = props;
  218. if (klass && !isString(klass)) {
  219. props.class = normalizeClass(klass);
  220. }
  221. if (style) {
  222. props.style = normalizeStyle(style);
  223. }
  224. return props;
  225. }
  226. 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";
  227. 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";
  228. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  229. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  230. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  231. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  232. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  233. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  234. function includeBooleanAttr(value) {
  235. return !!value || value === "";
  236. }
  237. function looseCompareArrays(a, b) {
  238. if (a.length !== b.length)
  239. return false;
  240. let equal = true;
  241. for (let i = 0; equal && i < a.length; i++) {
  242. equal = looseEqual(a[i], b[i]);
  243. }
  244. return equal;
  245. }
  246. function looseEqual(a, b) {
  247. if (a === b)
  248. return true;
  249. let aValidType = isDate(a);
  250. let bValidType = isDate(b);
  251. if (aValidType || bValidType) {
  252. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  253. }
  254. aValidType = isSymbol(a);
  255. bValidType = isSymbol(b);
  256. if (aValidType || bValidType) {
  257. return a === b;
  258. }
  259. aValidType = isArray(a);
  260. bValidType = isArray(b);
  261. if (aValidType || bValidType) {
  262. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  263. }
  264. aValidType = isObject(a);
  265. bValidType = isObject(b);
  266. if (aValidType || bValidType) {
  267. if (!aValidType || !bValidType) {
  268. return false;
  269. }
  270. const aKeysCount = Object.keys(a).length;
  271. const bKeysCount = Object.keys(b).length;
  272. if (aKeysCount !== bKeysCount) {
  273. return false;
  274. }
  275. for (const key in a) {
  276. const aHasKey = a.hasOwnProperty(key);
  277. const bHasKey = b.hasOwnProperty(key);
  278. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  279. return false;
  280. }
  281. }
  282. }
  283. return String(a) === String(b);
  284. }
  285. function looseIndexOf(arr, val) {
  286. return arr.findIndex((item) => looseEqual(item, val));
  287. }
  288. const toDisplayString = (val) => {
  289. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  290. };
  291. const replacer = (_key, val) => {
  292. if (val && val.__v_isRef) {
  293. return replacer(_key, val.value);
  294. } else if (isMap(val)) {
  295. return {
  296. [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
  297. entries[`${key} =>`] = val2;
  298. return entries;
  299. }, {})
  300. };
  301. } else if (isSet(val)) {
  302. return {
  303. [`Set(${val.size})`]: [...val.values()]
  304. };
  305. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  306. return String(val);
  307. }
  308. return val;
  309. };
  310. function warn$1(msg, ...args) {
  311. console.warn(`[Vue warn] ${msg}`, ...args);
  312. }
  313. let activeEffectScope;
  314. class EffectScope {
  315. constructor(detached = false) {
  316. this.detached = detached;
  317. /**
  318. * @internal
  319. */
  320. this._active = true;
  321. /**
  322. * @internal
  323. */
  324. this.effects = [];
  325. /**
  326. * @internal
  327. */
  328. this.cleanups = [];
  329. this.parent = activeEffectScope;
  330. if (!detached && activeEffectScope) {
  331. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  332. this
  333. ) - 1;
  334. }
  335. }
  336. get active() {
  337. return this._active;
  338. }
  339. run(fn) {
  340. if (this._active) {
  341. const currentEffectScope = activeEffectScope;
  342. try {
  343. activeEffectScope = this;
  344. return fn();
  345. } finally {
  346. activeEffectScope = currentEffectScope;
  347. }
  348. } else {
  349. warn$1(`cannot run an inactive effect scope.`);
  350. }
  351. }
  352. /**
  353. * This should only be called on non-detached scopes
  354. * @internal
  355. */
  356. on() {
  357. activeEffectScope = this;
  358. }
  359. /**
  360. * This should only be called on non-detached scopes
  361. * @internal
  362. */
  363. off() {
  364. activeEffectScope = this.parent;
  365. }
  366. stop(fromParent) {
  367. if (this._active) {
  368. let i, l;
  369. for (i = 0, l = this.effects.length; i < l; i++) {
  370. this.effects[i].stop();
  371. }
  372. for (i = 0, l = this.cleanups.length; i < l; i++) {
  373. this.cleanups[i]();
  374. }
  375. if (this.scopes) {
  376. for (i = 0, l = this.scopes.length; i < l; i++) {
  377. this.scopes[i].stop(true);
  378. }
  379. }
  380. if (!this.detached && this.parent && !fromParent) {
  381. const last = this.parent.scopes.pop();
  382. if (last && last !== this) {
  383. this.parent.scopes[this.index] = last;
  384. last.index = this.index;
  385. }
  386. }
  387. this.parent = void 0;
  388. this._active = false;
  389. }
  390. }
  391. }
  392. function effectScope(detached) {
  393. return new EffectScope(detached);
  394. }
  395. function recordEffectScope(effect, scope = activeEffectScope) {
  396. if (scope && scope.active) {
  397. scope.effects.push(effect);
  398. }
  399. }
  400. function getCurrentScope() {
  401. return activeEffectScope;
  402. }
  403. function onScopeDispose(fn) {
  404. if (activeEffectScope) {
  405. activeEffectScope.cleanups.push(fn);
  406. } else {
  407. warn$1(
  408. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  409. );
  410. }
  411. }
  412. const createDep = (effects) => {
  413. const dep = new Set(effects);
  414. dep.w = 0;
  415. dep.n = 0;
  416. return dep;
  417. };
  418. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  419. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  420. const initDepMarkers = ({ deps }) => {
  421. if (deps.length) {
  422. for (let i = 0; i < deps.length; i++) {
  423. deps[i].w |= trackOpBit;
  424. }
  425. }
  426. };
  427. const finalizeDepMarkers = (effect) => {
  428. const { deps } = effect;
  429. if (deps.length) {
  430. let ptr = 0;
  431. for (let i = 0; i < deps.length; i++) {
  432. const dep = deps[i];
  433. if (wasTracked(dep) && !newTracked(dep)) {
  434. dep.delete(effect);
  435. } else {
  436. deps[ptr++] = dep;
  437. }
  438. dep.w &= ~trackOpBit;
  439. dep.n &= ~trackOpBit;
  440. }
  441. deps.length = ptr;
  442. }
  443. };
  444. const targetMap = /* @__PURE__ */ new WeakMap();
  445. let effectTrackDepth = 0;
  446. let trackOpBit = 1;
  447. const maxMarkerBits = 30;
  448. let activeEffect;
  449. const ITERATE_KEY = Symbol("iterate" );
  450. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
  451. class ReactiveEffect {
  452. constructor(fn, scheduler = null, scope) {
  453. this.fn = fn;
  454. this.scheduler = scheduler;
  455. this.active = true;
  456. this.deps = [];
  457. this.parent = void 0;
  458. recordEffectScope(this, scope);
  459. }
  460. run() {
  461. if (!this.active) {
  462. return this.fn();
  463. }
  464. let parent = activeEffect;
  465. let lastShouldTrack = shouldTrack;
  466. while (parent) {
  467. if (parent === this) {
  468. return;
  469. }
  470. parent = parent.parent;
  471. }
  472. try {
  473. this.parent = activeEffect;
  474. activeEffect = this;
  475. shouldTrack = true;
  476. trackOpBit = 1 << ++effectTrackDepth;
  477. if (effectTrackDepth <= maxMarkerBits) {
  478. initDepMarkers(this);
  479. } else {
  480. cleanupEffect(this);
  481. }
  482. return this.fn();
  483. } finally {
  484. if (effectTrackDepth <= maxMarkerBits) {
  485. finalizeDepMarkers(this);
  486. }
  487. trackOpBit = 1 << --effectTrackDepth;
  488. activeEffect = this.parent;
  489. shouldTrack = lastShouldTrack;
  490. this.parent = void 0;
  491. if (this.deferStop) {
  492. this.stop();
  493. }
  494. }
  495. }
  496. stop() {
  497. if (activeEffect === this) {
  498. this.deferStop = true;
  499. } else if (this.active) {
  500. cleanupEffect(this);
  501. if (this.onStop) {
  502. this.onStop();
  503. }
  504. this.active = false;
  505. }
  506. }
  507. }
  508. function cleanupEffect(effect2) {
  509. const { deps } = effect2;
  510. if (deps.length) {
  511. for (let i = 0; i < deps.length; i++) {
  512. deps[i].delete(effect2);
  513. }
  514. deps.length = 0;
  515. }
  516. }
  517. function effect(fn, options) {
  518. if (fn.effect) {
  519. fn = fn.effect.fn;
  520. }
  521. const _effect = new ReactiveEffect(fn);
  522. if (options) {
  523. extend(_effect, options);
  524. if (options.scope)
  525. recordEffectScope(_effect, options.scope);
  526. }
  527. if (!options || !options.lazy) {
  528. _effect.run();
  529. }
  530. const runner = _effect.run.bind(_effect);
  531. runner.effect = _effect;
  532. return runner;
  533. }
  534. function stop(runner) {
  535. runner.effect.stop();
  536. }
  537. let shouldTrack = true;
  538. const trackStack = [];
  539. function pauseTracking() {
  540. trackStack.push(shouldTrack);
  541. shouldTrack = false;
  542. }
  543. function resetTracking() {
  544. const last = trackStack.pop();
  545. shouldTrack = last === void 0 ? true : last;
  546. }
  547. function track(target, type, key) {
  548. if (shouldTrack && activeEffect) {
  549. let depsMap = targetMap.get(target);
  550. if (!depsMap) {
  551. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  552. }
  553. let dep = depsMap.get(key);
  554. if (!dep) {
  555. depsMap.set(key, dep = createDep());
  556. }
  557. const eventInfo = { effect: activeEffect, target, type, key } ;
  558. trackEffects(dep, eventInfo);
  559. }
  560. }
  561. function trackEffects(dep, debuggerEventExtraInfo) {
  562. let shouldTrack2 = false;
  563. if (effectTrackDepth <= maxMarkerBits) {
  564. if (!newTracked(dep)) {
  565. dep.n |= trackOpBit;
  566. shouldTrack2 = !wasTracked(dep);
  567. }
  568. } else {
  569. shouldTrack2 = !dep.has(activeEffect);
  570. }
  571. if (shouldTrack2) {
  572. dep.add(activeEffect);
  573. activeEffect.deps.push(dep);
  574. if (activeEffect.onTrack) {
  575. activeEffect.onTrack(
  576. extend(
  577. {
  578. effect: activeEffect
  579. },
  580. debuggerEventExtraInfo
  581. )
  582. );
  583. }
  584. }
  585. }
  586. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  587. const depsMap = targetMap.get(target);
  588. if (!depsMap) {
  589. return;
  590. }
  591. let deps = [];
  592. if (type === "clear") {
  593. deps = [...depsMap.values()];
  594. } else if (key === "length" && isArray(target)) {
  595. const newLength = Number(newValue);
  596. depsMap.forEach((dep, key2) => {
  597. if (key2 === "length" || key2 >= newLength) {
  598. deps.push(dep);
  599. }
  600. });
  601. } else {
  602. if (key !== void 0) {
  603. deps.push(depsMap.get(key));
  604. }
  605. switch (type) {
  606. case "add":
  607. if (!isArray(target)) {
  608. deps.push(depsMap.get(ITERATE_KEY));
  609. if (isMap(target)) {
  610. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  611. }
  612. } else if (isIntegerKey(key)) {
  613. deps.push(depsMap.get("length"));
  614. }
  615. break;
  616. case "delete":
  617. if (!isArray(target)) {
  618. deps.push(depsMap.get(ITERATE_KEY));
  619. if (isMap(target)) {
  620. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  621. }
  622. }
  623. break;
  624. case "set":
  625. if (isMap(target)) {
  626. deps.push(depsMap.get(ITERATE_KEY));
  627. }
  628. break;
  629. }
  630. }
  631. const eventInfo = { target, type, key, newValue, oldValue, oldTarget } ;
  632. if (deps.length === 1) {
  633. if (deps[0]) {
  634. {
  635. triggerEffects(deps[0], eventInfo);
  636. }
  637. }
  638. } else {
  639. const effects = [];
  640. for (const dep of deps) {
  641. if (dep) {
  642. effects.push(...dep);
  643. }
  644. }
  645. {
  646. triggerEffects(createDep(effects), eventInfo);
  647. }
  648. }
  649. }
  650. function triggerEffects(dep, debuggerEventExtraInfo) {
  651. const effects = isArray(dep) ? dep : [...dep];
  652. for (const effect2 of effects) {
  653. if (effect2.computed) {
  654. triggerEffect(effect2, debuggerEventExtraInfo);
  655. }
  656. }
  657. for (const effect2 of effects) {
  658. if (!effect2.computed) {
  659. triggerEffect(effect2, debuggerEventExtraInfo);
  660. }
  661. }
  662. }
  663. function triggerEffect(effect2, debuggerEventExtraInfo) {
  664. if (effect2 !== activeEffect || effect2.allowRecurse) {
  665. if (effect2.onTrigger) {
  666. effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
  667. }
  668. if (effect2.scheduler) {
  669. effect2.scheduler();
  670. } else {
  671. effect2.run();
  672. }
  673. }
  674. }
  675. function getDepFromReactive(object, key) {
  676. var _a;
  677. return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
  678. }
  679. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  680. const builtInSymbols = new Set(
  681. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  682. );
  683. const get$1 = /* @__PURE__ */ createGetter();
  684. const shallowGet = /* @__PURE__ */ createGetter(false, true);
  685. const readonlyGet = /* @__PURE__ */ createGetter(true);
  686. const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
  687. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  688. function createArrayInstrumentations() {
  689. const instrumentations = {};
  690. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  691. instrumentations[key] = function(...args) {
  692. const arr = toRaw(this);
  693. for (let i = 0, l = this.length; i < l; i++) {
  694. track(arr, "get", i + "");
  695. }
  696. const res = arr[key](...args);
  697. if (res === -1 || res === false) {
  698. return arr[key](...args.map(toRaw));
  699. } else {
  700. return res;
  701. }
  702. };
  703. });
  704. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  705. instrumentations[key] = function(...args) {
  706. pauseTracking();
  707. const res = toRaw(this)[key].apply(this, args);
  708. resetTracking();
  709. return res;
  710. };
  711. });
  712. return instrumentations;
  713. }
  714. function hasOwnProperty(key) {
  715. const obj = toRaw(this);
  716. track(obj, "has", key);
  717. return obj.hasOwnProperty(key);
  718. }
  719. function createGetter(isReadonly2 = false, shallow = false) {
  720. return function get2(target, key, receiver) {
  721. if (key === "__v_isReactive") {
  722. return !isReadonly2;
  723. } else if (key === "__v_isReadonly") {
  724. return isReadonly2;
  725. } else if (key === "__v_isShallow") {
  726. return shallow;
  727. } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
  728. return target;
  729. }
  730. const targetIsArray = isArray(target);
  731. if (!isReadonly2) {
  732. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  733. return Reflect.get(arrayInstrumentations, key, receiver);
  734. }
  735. if (key === "hasOwnProperty") {
  736. return hasOwnProperty;
  737. }
  738. }
  739. const res = Reflect.get(target, key, receiver);
  740. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  741. return res;
  742. }
  743. if (!isReadonly2) {
  744. track(target, "get", key);
  745. }
  746. if (shallow) {
  747. return res;
  748. }
  749. if (isRef(res)) {
  750. return targetIsArray && isIntegerKey(key) ? res : res.value;
  751. }
  752. if (isObject(res)) {
  753. return isReadonly2 ? readonly(res) : reactive(res);
  754. }
  755. return res;
  756. };
  757. }
  758. const set$1 = /* @__PURE__ */ createSetter();
  759. const shallowSet = /* @__PURE__ */ createSetter(true);
  760. function createSetter(shallow = false) {
  761. return function set2(target, key, value, receiver) {
  762. let oldValue = target[key];
  763. if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
  764. return false;
  765. }
  766. if (!shallow) {
  767. if (!isShallow(value) && !isReadonly(value)) {
  768. oldValue = toRaw(oldValue);
  769. value = toRaw(value);
  770. }
  771. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  772. oldValue.value = value;
  773. return true;
  774. }
  775. }
  776. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  777. const result = Reflect.set(target, key, value, receiver);
  778. if (target === toRaw(receiver)) {
  779. if (!hadKey) {
  780. trigger(target, "add", key, value);
  781. } else if (hasChanged(value, oldValue)) {
  782. trigger(target, "set", key, value, oldValue);
  783. }
  784. }
  785. return result;
  786. };
  787. }
  788. function deleteProperty(target, key) {
  789. const hadKey = hasOwn(target, key);
  790. const oldValue = target[key];
  791. const result = Reflect.deleteProperty(target, key);
  792. if (result && hadKey) {
  793. trigger(target, "delete", key, void 0, oldValue);
  794. }
  795. return result;
  796. }
  797. function has$1(target, key) {
  798. const result = Reflect.has(target, key);
  799. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  800. track(target, "has", key);
  801. }
  802. return result;
  803. }
  804. function ownKeys(target) {
  805. track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
  806. return Reflect.ownKeys(target);
  807. }
  808. const mutableHandlers = {
  809. get: get$1,
  810. set: set$1,
  811. deleteProperty,
  812. has: has$1,
  813. ownKeys
  814. };
  815. const readonlyHandlers = {
  816. get: readonlyGet,
  817. set(target, key) {
  818. {
  819. warn$1(
  820. `Set operation on key "${String(key)}" failed: target is readonly.`,
  821. target
  822. );
  823. }
  824. return true;
  825. },
  826. deleteProperty(target, key) {
  827. {
  828. warn$1(
  829. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  830. target
  831. );
  832. }
  833. return true;
  834. }
  835. };
  836. const shallowReactiveHandlers = /* @__PURE__ */ extend(
  837. {},
  838. mutableHandlers,
  839. {
  840. get: shallowGet,
  841. set: shallowSet
  842. }
  843. );
  844. const shallowReadonlyHandlers = /* @__PURE__ */ extend(
  845. {},
  846. readonlyHandlers,
  847. {
  848. get: shallowReadonlyGet
  849. }
  850. );
  851. const toShallow = (value) => value;
  852. const getProto = (v) => Reflect.getPrototypeOf(v);
  853. function get(target, key, isReadonly = false, isShallow = false) {
  854. target = target["__v_raw"];
  855. const rawTarget = toRaw(target);
  856. const rawKey = toRaw(key);
  857. if (!isReadonly) {
  858. if (key !== rawKey) {
  859. track(rawTarget, "get", key);
  860. }
  861. track(rawTarget, "get", rawKey);
  862. }
  863. const { has: has2 } = getProto(rawTarget);
  864. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  865. if (has2.call(rawTarget, key)) {
  866. return wrap(target.get(key));
  867. } else if (has2.call(rawTarget, rawKey)) {
  868. return wrap(target.get(rawKey));
  869. } else if (target !== rawTarget) {
  870. target.get(key);
  871. }
  872. }
  873. function has(key, isReadonly = false) {
  874. const target = this["__v_raw"];
  875. const rawTarget = toRaw(target);
  876. const rawKey = toRaw(key);
  877. if (!isReadonly) {
  878. if (key !== rawKey) {
  879. track(rawTarget, "has", key);
  880. }
  881. track(rawTarget, "has", rawKey);
  882. }
  883. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  884. }
  885. function size(target, isReadonly = false) {
  886. target = target["__v_raw"];
  887. !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
  888. return Reflect.get(target, "size", target);
  889. }
  890. function add(value) {
  891. value = toRaw(value);
  892. const target = toRaw(this);
  893. const proto = getProto(target);
  894. const hadKey = proto.has.call(target, value);
  895. if (!hadKey) {
  896. target.add(value);
  897. trigger(target, "add", value, value);
  898. }
  899. return this;
  900. }
  901. function set(key, value) {
  902. value = toRaw(value);
  903. const target = toRaw(this);
  904. const { has: has2, get: get2 } = getProto(target);
  905. let hadKey = has2.call(target, key);
  906. if (!hadKey) {
  907. key = toRaw(key);
  908. hadKey = has2.call(target, key);
  909. } else {
  910. checkIdentityKeys(target, has2, key);
  911. }
  912. const oldValue = get2.call(target, key);
  913. target.set(key, value);
  914. if (!hadKey) {
  915. trigger(target, "add", key, value);
  916. } else if (hasChanged(value, oldValue)) {
  917. trigger(target, "set", key, value, oldValue);
  918. }
  919. return this;
  920. }
  921. function deleteEntry(key) {
  922. const target = toRaw(this);
  923. const { has: has2, get: get2 } = getProto(target);
  924. let hadKey = has2.call(target, key);
  925. if (!hadKey) {
  926. key = toRaw(key);
  927. hadKey = has2.call(target, key);
  928. } else {
  929. checkIdentityKeys(target, has2, key);
  930. }
  931. const oldValue = get2 ? get2.call(target, key) : void 0;
  932. const result = target.delete(key);
  933. if (hadKey) {
  934. trigger(target, "delete", key, void 0, oldValue);
  935. }
  936. return result;
  937. }
  938. function clear() {
  939. const target = toRaw(this);
  940. const hadItems = target.size !== 0;
  941. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  942. const result = target.clear();
  943. if (hadItems) {
  944. trigger(target, "clear", void 0, void 0, oldTarget);
  945. }
  946. return result;
  947. }
  948. function createForEach(isReadonly, isShallow) {
  949. return function forEach(callback, thisArg) {
  950. const observed = this;
  951. const target = observed["__v_raw"];
  952. const rawTarget = toRaw(target);
  953. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  954. !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
  955. return target.forEach((value, key) => {
  956. return callback.call(thisArg, wrap(value), wrap(key), observed);
  957. });
  958. };
  959. }
  960. function createIterableMethod(method, isReadonly, isShallow) {
  961. return function(...args) {
  962. const target = this["__v_raw"];
  963. const rawTarget = toRaw(target);
  964. const targetIsMap = isMap(rawTarget);
  965. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  966. const isKeyOnly = method === "keys" && targetIsMap;
  967. const innerIterator = target[method](...args);
  968. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  969. !isReadonly && track(
  970. rawTarget,
  971. "iterate",
  972. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  973. );
  974. return {
  975. // iterator protocol
  976. next() {
  977. const { value, done } = innerIterator.next();
  978. return done ? { value, done } : {
  979. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  980. done
  981. };
  982. },
  983. // iterable protocol
  984. [Symbol.iterator]() {
  985. return this;
  986. }
  987. };
  988. };
  989. }
  990. function createReadonlyMethod(type) {
  991. return function(...args) {
  992. {
  993. const key = args[0] ? `on key "${args[0]}" ` : ``;
  994. console.warn(
  995. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  996. toRaw(this)
  997. );
  998. }
  999. return type === "delete" ? false : this;
  1000. };
  1001. }
  1002. function createInstrumentations() {
  1003. const mutableInstrumentations2 = {
  1004. get(key) {
  1005. return get(this, key);
  1006. },
  1007. get size() {
  1008. return size(this);
  1009. },
  1010. has,
  1011. add,
  1012. set,
  1013. delete: deleteEntry,
  1014. clear,
  1015. forEach: createForEach(false, false)
  1016. };
  1017. const shallowInstrumentations2 = {
  1018. get(key) {
  1019. return get(this, key, false, true);
  1020. },
  1021. get size() {
  1022. return size(this);
  1023. },
  1024. has,
  1025. add,
  1026. set,
  1027. delete: deleteEntry,
  1028. clear,
  1029. forEach: createForEach(false, true)
  1030. };
  1031. const readonlyInstrumentations2 = {
  1032. get(key) {
  1033. return get(this, key, true);
  1034. },
  1035. get size() {
  1036. return size(this, true);
  1037. },
  1038. has(key) {
  1039. return has.call(this, key, true);
  1040. },
  1041. add: createReadonlyMethod("add"),
  1042. set: createReadonlyMethod("set"),
  1043. delete: createReadonlyMethod("delete"),
  1044. clear: createReadonlyMethod("clear"),
  1045. forEach: createForEach(true, false)
  1046. };
  1047. const shallowReadonlyInstrumentations2 = {
  1048. get(key) {
  1049. return get(this, key, true, true);
  1050. },
  1051. get size() {
  1052. return size(this, true);
  1053. },
  1054. has(key) {
  1055. return has.call(this, key, true);
  1056. },
  1057. add: createReadonlyMethod("add"),
  1058. set: createReadonlyMethod("set"),
  1059. delete: createReadonlyMethod("delete"),
  1060. clear: createReadonlyMethod("clear"),
  1061. forEach: createForEach(true, true)
  1062. };
  1063. const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  1064. iteratorMethods.forEach((method) => {
  1065. mutableInstrumentations2[method] = createIterableMethod(
  1066. method,
  1067. false,
  1068. false
  1069. );
  1070. readonlyInstrumentations2[method] = createIterableMethod(
  1071. method,
  1072. true,
  1073. false
  1074. );
  1075. shallowInstrumentations2[method] = createIterableMethod(
  1076. method,
  1077. false,
  1078. true
  1079. );
  1080. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1081. method,
  1082. true,
  1083. true
  1084. );
  1085. });
  1086. return [
  1087. mutableInstrumentations2,
  1088. readonlyInstrumentations2,
  1089. shallowInstrumentations2,
  1090. shallowReadonlyInstrumentations2
  1091. ];
  1092. }
  1093. const [
  1094. mutableInstrumentations,
  1095. readonlyInstrumentations,
  1096. shallowInstrumentations,
  1097. shallowReadonlyInstrumentations
  1098. ] = /* @__PURE__ */ createInstrumentations();
  1099. function createInstrumentationGetter(isReadonly, shallow) {
  1100. const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
  1101. return (target, key, receiver) => {
  1102. if (key === "__v_isReactive") {
  1103. return !isReadonly;
  1104. } else if (key === "__v_isReadonly") {
  1105. return isReadonly;
  1106. } else if (key === "__v_raw") {
  1107. return target;
  1108. }
  1109. return Reflect.get(
  1110. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1111. key,
  1112. receiver
  1113. );
  1114. };
  1115. }
  1116. const mutableCollectionHandlers = {
  1117. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1118. };
  1119. const shallowCollectionHandlers = {
  1120. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1121. };
  1122. const readonlyCollectionHandlers = {
  1123. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1124. };
  1125. const shallowReadonlyCollectionHandlers = {
  1126. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1127. };
  1128. function checkIdentityKeys(target, has2, key) {
  1129. const rawKey = toRaw(key);
  1130. if (rawKey !== key && has2.call(target, rawKey)) {
  1131. const type = toRawType(target);
  1132. console.warn(
  1133. `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.`
  1134. );
  1135. }
  1136. }
  1137. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1138. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1139. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1140. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1141. function targetTypeMap(rawType) {
  1142. switch (rawType) {
  1143. case "Object":
  1144. case "Array":
  1145. return 1 /* COMMON */;
  1146. case "Map":
  1147. case "Set":
  1148. case "WeakMap":
  1149. case "WeakSet":
  1150. return 2 /* COLLECTION */;
  1151. default:
  1152. return 0 /* INVALID */;
  1153. }
  1154. }
  1155. function getTargetType(value) {
  1156. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1157. }
  1158. function reactive(target) {
  1159. if (isReadonly(target)) {
  1160. return target;
  1161. }
  1162. return createReactiveObject(
  1163. target,
  1164. false,
  1165. mutableHandlers,
  1166. mutableCollectionHandlers,
  1167. reactiveMap
  1168. );
  1169. }
  1170. function shallowReactive(target) {
  1171. return createReactiveObject(
  1172. target,
  1173. false,
  1174. shallowReactiveHandlers,
  1175. shallowCollectionHandlers,
  1176. shallowReactiveMap
  1177. );
  1178. }
  1179. function readonly(target) {
  1180. return createReactiveObject(
  1181. target,
  1182. true,
  1183. readonlyHandlers,
  1184. readonlyCollectionHandlers,
  1185. readonlyMap
  1186. );
  1187. }
  1188. function shallowReadonly(target) {
  1189. return createReactiveObject(
  1190. target,
  1191. true,
  1192. shallowReadonlyHandlers,
  1193. shallowReadonlyCollectionHandlers,
  1194. shallowReadonlyMap
  1195. );
  1196. }
  1197. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1198. if (!isObject(target)) {
  1199. {
  1200. console.warn(`value cannot be made reactive: ${String(target)}`);
  1201. }
  1202. return target;
  1203. }
  1204. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1205. return target;
  1206. }
  1207. const existingProxy = proxyMap.get(target);
  1208. if (existingProxy) {
  1209. return existingProxy;
  1210. }
  1211. const targetType = getTargetType(target);
  1212. if (targetType === 0 /* INVALID */) {
  1213. return target;
  1214. }
  1215. const proxy = new Proxy(
  1216. target,
  1217. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1218. );
  1219. proxyMap.set(target, proxy);
  1220. return proxy;
  1221. }
  1222. function isReactive(value) {
  1223. if (isReadonly(value)) {
  1224. return isReactive(value["__v_raw"]);
  1225. }
  1226. return !!(value && value["__v_isReactive"]);
  1227. }
  1228. function isReadonly(value) {
  1229. return !!(value && value["__v_isReadonly"]);
  1230. }
  1231. function isShallow(value) {
  1232. return !!(value && value["__v_isShallow"]);
  1233. }
  1234. function isProxy(value) {
  1235. return isReactive(value) || isReadonly(value);
  1236. }
  1237. function toRaw(observed) {
  1238. const raw = observed && observed["__v_raw"];
  1239. return raw ? toRaw(raw) : observed;
  1240. }
  1241. function markRaw(value) {
  1242. def(value, "__v_skip", true);
  1243. return value;
  1244. }
  1245. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1246. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1247. function trackRefValue(ref2) {
  1248. if (shouldTrack && activeEffect) {
  1249. ref2 = toRaw(ref2);
  1250. {
  1251. trackEffects(ref2.dep || (ref2.dep = createDep()), {
  1252. target: ref2,
  1253. type: "get",
  1254. key: "value"
  1255. });
  1256. }
  1257. }
  1258. }
  1259. function triggerRefValue(ref2, newVal) {
  1260. ref2 = toRaw(ref2);
  1261. const dep = ref2.dep;
  1262. if (dep) {
  1263. {
  1264. triggerEffects(dep, {
  1265. target: ref2,
  1266. type: "set",
  1267. key: "value",
  1268. newValue: newVal
  1269. });
  1270. }
  1271. }
  1272. }
  1273. function isRef(r) {
  1274. return !!(r && r.__v_isRef === true);
  1275. }
  1276. function ref(value) {
  1277. return createRef(value, false);
  1278. }
  1279. function shallowRef(value) {
  1280. return createRef(value, true);
  1281. }
  1282. function createRef(rawValue, shallow) {
  1283. if (isRef(rawValue)) {
  1284. return rawValue;
  1285. }
  1286. return new RefImpl(rawValue, shallow);
  1287. }
  1288. class RefImpl {
  1289. constructor(value, __v_isShallow) {
  1290. this.__v_isShallow = __v_isShallow;
  1291. this.dep = void 0;
  1292. this.__v_isRef = true;
  1293. this._rawValue = __v_isShallow ? value : toRaw(value);
  1294. this._value = __v_isShallow ? value : toReactive(value);
  1295. }
  1296. get value() {
  1297. trackRefValue(this);
  1298. return this._value;
  1299. }
  1300. set value(newVal) {
  1301. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1302. newVal = useDirectValue ? newVal : toRaw(newVal);
  1303. if (hasChanged(newVal, this._rawValue)) {
  1304. this._rawValue = newVal;
  1305. this._value = useDirectValue ? newVal : toReactive(newVal);
  1306. triggerRefValue(this, newVal);
  1307. }
  1308. }
  1309. }
  1310. function triggerRef(ref2) {
  1311. triggerRefValue(ref2, ref2.value );
  1312. }
  1313. function unref(ref2) {
  1314. return isRef(ref2) ? ref2.value : ref2;
  1315. }
  1316. function toValue(source) {
  1317. return isFunction(source) ? source() : unref(source);
  1318. }
  1319. const shallowUnwrapHandlers = {
  1320. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1321. set: (target, key, value, receiver) => {
  1322. const oldValue = target[key];
  1323. if (isRef(oldValue) && !isRef(value)) {
  1324. oldValue.value = value;
  1325. return true;
  1326. } else {
  1327. return Reflect.set(target, key, value, receiver);
  1328. }
  1329. }
  1330. };
  1331. function proxyRefs(objectWithRefs) {
  1332. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1333. }
  1334. class CustomRefImpl {
  1335. constructor(factory) {
  1336. this.dep = void 0;
  1337. this.__v_isRef = true;
  1338. const { get, set } = factory(
  1339. () => trackRefValue(this),
  1340. () => triggerRefValue(this)
  1341. );
  1342. this._get = get;
  1343. this._set = set;
  1344. }
  1345. get value() {
  1346. return this._get();
  1347. }
  1348. set value(newVal) {
  1349. this._set(newVal);
  1350. }
  1351. }
  1352. function customRef(factory) {
  1353. return new CustomRefImpl(factory);
  1354. }
  1355. function toRefs(object) {
  1356. if (!isProxy(object)) {
  1357. console.warn(`toRefs() expects a reactive object but received a plain one.`);
  1358. }
  1359. const ret = isArray(object) ? new Array(object.length) : {};
  1360. for (const key in object) {
  1361. ret[key] = propertyToRef(object, key);
  1362. }
  1363. return ret;
  1364. }
  1365. class ObjectRefImpl {
  1366. constructor(_object, _key, _defaultValue) {
  1367. this._object = _object;
  1368. this._key = _key;
  1369. this._defaultValue = _defaultValue;
  1370. this.__v_isRef = true;
  1371. }
  1372. get value() {
  1373. const val = this._object[this._key];
  1374. return val === void 0 ? this._defaultValue : val;
  1375. }
  1376. set value(newVal) {
  1377. this._object[this._key] = newVal;
  1378. }
  1379. get dep() {
  1380. return getDepFromReactive(toRaw(this._object), this._key);
  1381. }
  1382. }
  1383. class GetterRefImpl {
  1384. constructor(_getter) {
  1385. this._getter = _getter;
  1386. this.__v_isRef = true;
  1387. this.__v_isReadonly = true;
  1388. }
  1389. get value() {
  1390. return this._getter();
  1391. }
  1392. }
  1393. function toRef(source, key, defaultValue) {
  1394. if (isRef(source)) {
  1395. return source;
  1396. } else if (isFunction(source)) {
  1397. return new GetterRefImpl(source);
  1398. } else if (isObject(source) && arguments.length > 1) {
  1399. return propertyToRef(source, key, defaultValue);
  1400. } else {
  1401. return ref(source);
  1402. }
  1403. }
  1404. function propertyToRef(source, key, defaultValue) {
  1405. const val = source[key];
  1406. return isRef(val) ? val : new ObjectRefImpl(
  1407. source,
  1408. key,
  1409. defaultValue
  1410. );
  1411. }
  1412. class ComputedRefImpl {
  1413. constructor(getter, _setter, isReadonly, isSSR) {
  1414. this._setter = _setter;
  1415. this.dep = void 0;
  1416. this.__v_isRef = true;
  1417. this["__v_isReadonly"] = false;
  1418. this._dirty = true;
  1419. this.effect = new ReactiveEffect(getter, () => {
  1420. if (!this._dirty) {
  1421. this._dirty = true;
  1422. triggerRefValue(this);
  1423. }
  1424. });
  1425. this.effect.computed = this;
  1426. this.effect.active = this._cacheable = !isSSR;
  1427. this["__v_isReadonly"] = isReadonly;
  1428. }
  1429. get value() {
  1430. const self = toRaw(this);
  1431. trackRefValue(self);
  1432. if (self._dirty || !self._cacheable) {
  1433. self._dirty = false;
  1434. self._value = self.effect.run();
  1435. }
  1436. return self._value;
  1437. }
  1438. set value(newValue) {
  1439. this._setter(newValue);
  1440. }
  1441. }
  1442. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1443. let getter;
  1444. let setter;
  1445. const onlyGetter = isFunction(getterOrOptions);
  1446. if (onlyGetter) {
  1447. getter = getterOrOptions;
  1448. setter = () => {
  1449. console.warn("Write operation failed: computed value is readonly");
  1450. } ;
  1451. } else {
  1452. getter = getterOrOptions.get;
  1453. setter = getterOrOptions.set;
  1454. }
  1455. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1456. if (debugOptions && !isSSR) {
  1457. cRef.effect.onTrack = debugOptions.onTrack;
  1458. cRef.effect.onTrigger = debugOptions.onTrigger;
  1459. }
  1460. return cRef;
  1461. }
  1462. const stack = [];
  1463. function pushWarningContext(vnode) {
  1464. stack.push(vnode);
  1465. }
  1466. function popWarningContext() {
  1467. stack.pop();
  1468. }
  1469. function warn(msg, ...args) {
  1470. pauseTracking();
  1471. const instance = stack.length ? stack[stack.length - 1].component : null;
  1472. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1473. const trace = getComponentTrace();
  1474. if (appWarnHandler) {
  1475. callWithErrorHandling(
  1476. appWarnHandler,
  1477. instance,
  1478. 11,
  1479. [
  1480. msg + args.join(""),
  1481. instance && instance.proxy,
  1482. trace.map(
  1483. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  1484. ).join("\n"),
  1485. trace
  1486. ]
  1487. );
  1488. } else {
  1489. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1490. if (trace.length && // avoid spamming console during tests
  1491. true) {
  1492. warnArgs.push(`
  1493. `, ...formatTrace(trace));
  1494. }
  1495. console.warn(...warnArgs);
  1496. }
  1497. resetTracking();
  1498. }
  1499. function getComponentTrace() {
  1500. let currentVNode = stack[stack.length - 1];
  1501. if (!currentVNode) {
  1502. return [];
  1503. }
  1504. const normalizedStack = [];
  1505. while (currentVNode) {
  1506. const last = normalizedStack[0];
  1507. if (last && last.vnode === currentVNode) {
  1508. last.recurseCount++;
  1509. } else {
  1510. normalizedStack.push({
  1511. vnode: currentVNode,
  1512. recurseCount: 0
  1513. });
  1514. }
  1515. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1516. currentVNode = parentInstance && parentInstance.vnode;
  1517. }
  1518. return normalizedStack;
  1519. }
  1520. function formatTrace(trace) {
  1521. const logs = [];
  1522. trace.forEach((entry, i) => {
  1523. logs.push(...i === 0 ? [] : [`
  1524. `], ...formatTraceEntry(entry));
  1525. });
  1526. return logs;
  1527. }
  1528. function formatTraceEntry({ vnode, recurseCount }) {
  1529. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1530. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1531. const open = ` at <${formatComponentName(
  1532. vnode.component,
  1533. vnode.type,
  1534. isRoot
  1535. )}`;
  1536. const close = `>` + postfix;
  1537. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1538. }
  1539. function formatProps(props) {
  1540. const res = [];
  1541. const keys = Object.keys(props);
  1542. keys.slice(0, 3).forEach((key) => {
  1543. res.push(...formatProp(key, props[key]));
  1544. });
  1545. if (keys.length > 3) {
  1546. res.push(` ...`);
  1547. }
  1548. return res;
  1549. }
  1550. function formatProp(key, value, raw) {
  1551. if (isString(value)) {
  1552. value = JSON.stringify(value);
  1553. return raw ? value : [`${key}=${value}`];
  1554. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1555. return raw ? value : [`${key}=${value}`];
  1556. } else if (isRef(value)) {
  1557. value = formatProp(key, toRaw(value.value), true);
  1558. return raw ? value : [`${key}=Ref<`, value, `>`];
  1559. } else if (isFunction(value)) {
  1560. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1561. } else {
  1562. value = toRaw(value);
  1563. return raw ? value : [`${key}=`, value];
  1564. }
  1565. }
  1566. function assertNumber(val, type) {
  1567. if (val === void 0) {
  1568. return;
  1569. } else if (typeof val !== "number") {
  1570. warn(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  1571. } else if (isNaN(val)) {
  1572. warn(`${type} is NaN - the duration expression might be incorrect.`);
  1573. }
  1574. }
  1575. const ErrorTypeStrings = {
  1576. ["sp"]: "serverPrefetch hook",
  1577. ["bc"]: "beforeCreate hook",
  1578. ["c"]: "created hook",
  1579. ["bm"]: "beforeMount hook",
  1580. ["m"]: "mounted hook",
  1581. ["bu"]: "beforeUpdate hook",
  1582. ["u"]: "updated",
  1583. ["bum"]: "beforeUnmount hook",
  1584. ["um"]: "unmounted hook",
  1585. ["a"]: "activated hook",
  1586. ["da"]: "deactivated hook",
  1587. ["ec"]: "errorCaptured hook",
  1588. ["rtc"]: "renderTracked hook",
  1589. ["rtg"]: "renderTriggered hook",
  1590. [0]: "setup function",
  1591. [1]: "render function",
  1592. [2]: "watcher getter",
  1593. [3]: "watcher callback",
  1594. [4]: "watcher cleanup function",
  1595. [5]: "native event handler",
  1596. [6]: "component event handler",
  1597. [7]: "vnode hook",
  1598. [8]: "directive hook",
  1599. [9]: "transition hook",
  1600. [10]: "app errorHandler",
  1601. [11]: "app warnHandler",
  1602. [12]: "ref function",
  1603. [13]: "async component loader",
  1604. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
  1605. };
  1606. function callWithErrorHandling(fn, instance, type, args) {
  1607. let res;
  1608. try {
  1609. res = args ? fn(...args) : fn();
  1610. } catch (err) {
  1611. handleError(err, instance, type);
  1612. }
  1613. return res;
  1614. }
  1615. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1616. if (isFunction(fn)) {
  1617. const res = callWithErrorHandling(fn, instance, type, args);
  1618. if (res && isPromise(res)) {
  1619. res.catch((err) => {
  1620. handleError(err, instance, type);
  1621. });
  1622. }
  1623. return res;
  1624. }
  1625. const values = [];
  1626. for (let i = 0; i < fn.length; i++) {
  1627. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1628. }
  1629. return values;
  1630. }
  1631. function handleError(err, instance, type, throwInDev = true) {
  1632. const contextVNode = instance ? instance.vnode : null;
  1633. if (instance) {
  1634. let cur = instance.parent;
  1635. const exposedInstance = instance.proxy;
  1636. const errorInfo = ErrorTypeStrings[type] ;
  1637. while (cur) {
  1638. const errorCapturedHooks = cur.ec;
  1639. if (errorCapturedHooks) {
  1640. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1641. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1642. return;
  1643. }
  1644. }
  1645. }
  1646. cur = cur.parent;
  1647. }
  1648. const appErrorHandler = instance.appContext.config.errorHandler;
  1649. if (appErrorHandler) {
  1650. callWithErrorHandling(
  1651. appErrorHandler,
  1652. null,
  1653. 10,
  1654. [err, exposedInstance, errorInfo]
  1655. );
  1656. return;
  1657. }
  1658. }
  1659. logError(err, type, contextVNode, throwInDev);
  1660. }
  1661. function logError(err, type, contextVNode, throwInDev = true) {
  1662. {
  1663. const info = ErrorTypeStrings[type];
  1664. if (contextVNode) {
  1665. pushWarningContext(contextVNode);
  1666. }
  1667. warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1668. if (contextVNode) {
  1669. popWarningContext();
  1670. }
  1671. if (throwInDev) {
  1672. throw err;
  1673. } else {
  1674. console.error(err);
  1675. }
  1676. }
  1677. }
  1678. let isFlushing = false;
  1679. let isFlushPending = false;
  1680. const queue = [];
  1681. let flushIndex = 0;
  1682. const pendingPostFlushCbs = [];
  1683. let activePostFlushCbs = null;
  1684. let postFlushIndex = 0;
  1685. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1686. let currentFlushPromise = null;
  1687. const RECURSION_LIMIT = 100;
  1688. function nextTick(fn) {
  1689. const p = currentFlushPromise || resolvedPromise;
  1690. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  1691. }
  1692. function findInsertionIndex(id) {
  1693. let start = flushIndex + 1;
  1694. let end = queue.length;
  1695. while (start < end) {
  1696. const middle = start + end >>> 1;
  1697. const middleJobId = getId(queue[middle]);
  1698. middleJobId < id ? start = middle + 1 : end = middle;
  1699. }
  1700. return start;
  1701. }
  1702. function queueJob(job) {
  1703. if (!queue.length || !queue.includes(
  1704. job,
  1705. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1706. )) {
  1707. if (job.id == null) {
  1708. queue.push(job);
  1709. } else {
  1710. queue.splice(findInsertionIndex(job.id), 0, job);
  1711. }
  1712. queueFlush();
  1713. }
  1714. }
  1715. function queueFlush() {
  1716. if (!isFlushing && !isFlushPending) {
  1717. isFlushPending = true;
  1718. currentFlushPromise = resolvedPromise.then(flushJobs);
  1719. }
  1720. }
  1721. function invalidateJob(job) {
  1722. const i = queue.indexOf(job);
  1723. if (i > flushIndex) {
  1724. queue.splice(i, 1);
  1725. }
  1726. }
  1727. function queuePostFlushCb(cb) {
  1728. if (!isArray(cb)) {
  1729. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1730. cb,
  1731. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1732. )) {
  1733. pendingPostFlushCbs.push(cb);
  1734. }
  1735. } else {
  1736. pendingPostFlushCbs.push(...cb);
  1737. }
  1738. queueFlush();
  1739. }
  1740. function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
  1741. {
  1742. seen = seen || /* @__PURE__ */ new Map();
  1743. }
  1744. for (; i < queue.length; i++) {
  1745. const cb = queue[i];
  1746. if (cb && cb.pre) {
  1747. if (checkRecursiveUpdates(seen, cb)) {
  1748. continue;
  1749. }
  1750. queue.splice(i, 1);
  1751. i--;
  1752. cb();
  1753. }
  1754. }
  1755. }
  1756. function flushPostFlushCbs(seen) {
  1757. if (pendingPostFlushCbs.length) {
  1758. const deduped = [...new Set(pendingPostFlushCbs)];
  1759. pendingPostFlushCbs.length = 0;
  1760. if (activePostFlushCbs) {
  1761. activePostFlushCbs.push(...deduped);
  1762. return;
  1763. }
  1764. activePostFlushCbs = deduped;
  1765. {
  1766. seen = seen || /* @__PURE__ */ new Map();
  1767. }
  1768. activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
  1769. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1770. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  1771. continue;
  1772. }
  1773. activePostFlushCbs[postFlushIndex]();
  1774. }
  1775. activePostFlushCbs = null;
  1776. postFlushIndex = 0;
  1777. }
  1778. }
  1779. const getId = (job) => job.id == null ? Infinity : job.id;
  1780. const comparator = (a, b) => {
  1781. const diff = getId(a) - getId(b);
  1782. if (diff === 0) {
  1783. if (a.pre && !b.pre)
  1784. return -1;
  1785. if (b.pre && !a.pre)
  1786. return 1;
  1787. }
  1788. return diff;
  1789. };
  1790. function flushJobs(seen) {
  1791. isFlushPending = false;
  1792. isFlushing = true;
  1793. {
  1794. seen = seen || /* @__PURE__ */ new Map();
  1795. }
  1796. queue.sort(comparator);
  1797. const check = (job) => checkRecursiveUpdates(seen, job) ;
  1798. try {
  1799. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1800. const job = queue[flushIndex];
  1801. if (job && job.active !== false) {
  1802. if (check(job)) {
  1803. continue;
  1804. }
  1805. callWithErrorHandling(job, null, 14);
  1806. }
  1807. }
  1808. } finally {
  1809. flushIndex = 0;
  1810. queue.length = 0;
  1811. flushPostFlushCbs(seen);
  1812. isFlushing = false;
  1813. currentFlushPromise = null;
  1814. if (queue.length || pendingPostFlushCbs.length) {
  1815. flushJobs(seen);
  1816. }
  1817. }
  1818. }
  1819. function checkRecursiveUpdates(seen, fn) {
  1820. if (!seen.has(fn)) {
  1821. seen.set(fn, 1);
  1822. } else {
  1823. const count = seen.get(fn);
  1824. if (count > RECURSION_LIMIT) {
  1825. const instance = fn.ownerInstance;
  1826. const componentName = instance && getComponentName(instance.type);
  1827. warn(
  1828. `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.`
  1829. );
  1830. return true;
  1831. } else {
  1832. seen.set(fn, count + 1);
  1833. }
  1834. }
  1835. }
  1836. let isHmrUpdating = false;
  1837. const hmrDirtyComponents = /* @__PURE__ */ new Set();
  1838. {
  1839. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  1840. createRecord: tryWrap(createRecord),
  1841. rerender: tryWrap(rerender),
  1842. reload: tryWrap(reload)
  1843. };
  1844. }
  1845. const map = /* @__PURE__ */ new Map();
  1846. function registerHMR(instance) {
  1847. const id = instance.type.__hmrId;
  1848. let record = map.get(id);
  1849. if (!record) {
  1850. createRecord(id, instance.type);
  1851. record = map.get(id);
  1852. }
  1853. record.instances.add(instance);
  1854. }
  1855. function unregisterHMR(instance) {
  1856. map.get(instance.type.__hmrId).instances.delete(instance);
  1857. }
  1858. function createRecord(id, initialDef) {
  1859. if (map.has(id)) {
  1860. return false;
  1861. }
  1862. map.set(id, {
  1863. initialDef: normalizeClassComponent(initialDef),
  1864. instances: /* @__PURE__ */ new Set()
  1865. });
  1866. return true;
  1867. }
  1868. function normalizeClassComponent(component) {
  1869. return isClassComponent(component) ? component.__vccOpts : component;
  1870. }
  1871. function rerender(id, newRender) {
  1872. const record = map.get(id);
  1873. if (!record) {
  1874. return;
  1875. }
  1876. record.initialDef.render = newRender;
  1877. [...record.instances].forEach((instance) => {
  1878. if (newRender) {
  1879. instance.render = newRender;
  1880. normalizeClassComponent(instance.type).render = newRender;
  1881. }
  1882. instance.renderCache = [];
  1883. isHmrUpdating = true;
  1884. instance.update();
  1885. isHmrUpdating = false;
  1886. });
  1887. }
  1888. function reload(id, newComp) {
  1889. const record = map.get(id);
  1890. if (!record)
  1891. return;
  1892. newComp = normalizeClassComponent(newComp);
  1893. updateComponentDef(record.initialDef, newComp);
  1894. const instances = [...record.instances];
  1895. for (const instance of instances) {
  1896. const oldComp = normalizeClassComponent(instance.type);
  1897. if (!hmrDirtyComponents.has(oldComp)) {
  1898. if (oldComp !== record.initialDef) {
  1899. updateComponentDef(oldComp, newComp);
  1900. }
  1901. hmrDirtyComponents.add(oldComp);
  1902. }
  1903. instance.appContext.propsCache.delete(instance.type);
  1904. instance.appContext.emitsCache.delete(instance.type);
  1905. instance.appContext.optionsCache.delete(instance.type);
  1906. if (instance.ceReload) {
  1907. hmrDirtyComponents.add(oldComp);
  1908. instance.ceReload(newComp.styles);
  1909. hmrDirtyComponents.delete(oldComp);
  1910. } else if (instance.parent) {
  1911. queueJob(instance.parent.update);
  1912. } else if (instance.appContext.reload) {
  1913. instance.appContext.reload();
  1914. } else if (typeof window !== "undefined") {
  1915. window.location.reload();
  1916. } else {
  1917. console.warn(
  1918. "[HMR] Root or manually mounted instance modified. Full reload required."
  1919. );
  1920. }
  1921. }
  1922. queuePostFlushCb(() => {
  1923. for (const instance of instances) {
  1924. hmrDirtyComponents.delete(
  1925. normalizeClassComponent(instance.type)
  1926. );
  1927. }
  1928. });
  1929. }
  1930. function updateComponentDef(oldComp, newComp) {
  1931. extend(oldComp, newComp);
  1932. for (const key in oldComp) {
  1933. if (key !== "__file" && !(key in newComp)) {
  1934. delete oldComp[key];
  1935. }
  1936. }
  1937. }
  1938. function tryWrap(fn) {
  1939. return (id, arg) => {
  1940. try {
  1941. return fn(id, arg);
  1942. } catch (e) {
  1943. console.error(e);
  1944. console.warn(
  1945. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  1946. );
  1947. }
  1948. };
  1949. }
  1950. exports.devtools = void 0;
  1951. let buffer = [];
  1952. let devtoolsNotInstalled = false;
  1953. function emit$1(event, ...args) {
  1954. if (exports.devtools) {
  1955. exports.devtools.emit(event, ...args);
  1956. } else if (!devtoolsNotInstalled) {
  1957. buffer.push({ event, args });
  1958. }
  1959. }
  1960. function setDevtoolsHook(hook, target) {
  1961. var _a, _b;
  1962. exports.devtools = hook;
  1963. if (exports.devtools) {
  1964. exports.devtools.enabled = true;
  1965. buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
  1966. buffer = [];
  1967. } else if (
  1968. // handle late devtools injection - only do this if we are in an actual
  1969. // browser environment to avoid the timer handle stalling test runner exit
  1970. // (#4815)
  1971. typeof window !== "undefined" && // some envs mock window but not fully
  1972. window.HTMLElement && // also exclude jsdom
  1973. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  1974. ) {
  1975. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  1976. replay.push((newHook) => {
  1977. setDevtoolsHook(newHook, target);
  1978. });
  1979. setTimeout(() => {
  1980. if (!exports.devtools) {
  1981. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  1982. devtoolsNotInstalled = true;
  1983. buffer = [];
  1984. }
  1985. }, 3e3);
  1986. } else {
  1987. devtoolsNotInstalled = true;
  1988. buffer = [];
  1989. }
  1990. }
  1991. function devtoolsInitApp(app, version) {
  1992. emit$1("app:init" /* APP_INIT */, app, version, {
  1993. Fragment,
  1994. Text,
  1995. Comment,
  1996. Static
  1997. });
  1998. }
  1999. function devtoolsUnmountApp(app) {
  2000. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2001. }
  2002. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  2003. "component:added" /* COMPONENT_ADDED */
  2004. );
  2005. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2006. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2007. "component:removed" /* COMPONENT_REMOVED */
  2008. );
  2009. const devtoolsComponentRemoved = (component) => {
  2010. if (exports.devtools && typeof exports.devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2011. !exports.devtools.cleanupBuffer(component)) {
  2012. _devtoolsComponentRemoved(component);
  2013. }
  2014. };
  2015. function createDevtoolsComponentHook(hook) {
  2016. return (component) => {
  2017. emit$1(
  2018. hook,
  2019. component.appContext.app,
  2020. component.uid,
  2021. component.parent ? component.parent.uid : void 0,
  2022. component
  2023. );
  2024. };
  2025. }
  2026. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2027. "perf:start" /* PERFORMANCE_START */
  2028. );
  2029. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2030. "perf:end" /* PERFORMANCE_END */
  2031. );
  2032. function createDevtoolsPerformanceHook(hook) {
  2033. return (component, type, time) => {
  2034. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2035. };
  2036. }
  2037. function devtoolsComponentEmit(component, event, params) {
  2038. emit$1(
  2039. "component:emit" /* COMPONENT_EMIT */,
  2040. component.appContext.app,
  2041. component,
  2042. event,
  2043. params
  2044. );
  2045. }
  2046. function emit(instance, event, ...rawArgs) {
  2047. if (instance.isUnmounted)
  2048. return;
  2049. const props = instance.vnode.props || EMPTY_OBJ;
  2050. {
  2051. const {
  2052. emitsOptions,
  2053. propsOptions: [propsOptions]
  2054. } = instance;
  2055. if (emitsOptions) {
  2056. if (!(event in emitsOptions) && true) {
  2057. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  2058. warn(
  2059. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
  2060. );
  2061. }
  2062. } else {
  2063. const validator = emitsOptions[event];
  2064. if (isFunction(validator)) {
  2065. const isValid = validator(...rawArgs);
  2066. if (!isValid) {
  2067. warn(
  2068. `Invalid event arguments: event validation failed for event "${event}".`
  2069. );
  2070. }
  2071. }
  2072. }
  2073. }
  2074. }
  2075. let args = rawArgs;
  2076. const isModelListener = event.startsWith("update:");
  2077. const modelArg = isModelListener && event.slice(7);
  2078. if (modelArg && modelArg in props) {
  2079. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  2080. const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
  2081. if (trim) {
  2082. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  2083. }
  2084. if (number) {
  2085. args = rawArgs.map(looseToNumber);
  2086. }
  2087. }
  2088. {
  2089. devtoolsComponentEmit(instance, event, args);
  2090. }
  2091. {
  2092. const lowerCaseEvent = event.toLowerCase();
  2093. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  2094. warn(
  2095. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  2096. instance,
  2097. instance.type
  2098. )} 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(event)}" instead of "${event}".`
  2099. );
  2100. }
  2101. }
  2102. let handlerName;
  2103. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  2104. props[handlerName = toHandlerKey(camelize(event))];
  2105. if (!handler && isModelListener) {
  2106. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  2107. }
  2108. if (handler) {
  2109. callWithAsyncErrorHandling(
  2110. handler,
  2111. instance,
  2112. 6,
  2113. args
  2114. );
  2115. }
  2116. const onceHandler = props[handlerName + `Once`];
  2117. if (onceHandler) {
  2118. if (!instance.emitted) {
  2119. instance.emitted = {};
  2120. } else if (instance.emitted[handlerName]) {
  2121. return;
  2122. }
  2123. instance.emitted[handlerName] = true;
  2124. callWithAsyncErrorHandling(
  2125. onceHandler,
  2126. instance,
  2127. 6,
  2128. args
  2129. );
  2130. }
  2131. }
  2132. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  2133. const cache = appContext.emitsCache;
  2134. const cached = cache.get(comp);
  2135. if (cached !== void 0) {
  2136. return cached;
  2137. }
  2138. const raw = comp.emits;
  2139. let normalized = {};
  2140. let hasExtends = false;
  2141. if (!isFunction(comp)) {
  2142. const extendEmits = (raw2) => {
  2143. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  2144. if (normalizedFromExtend) {
  2145. hasExtends = true;
  2146. extend(normalized, normalizedFromExtend);
  2147. }
  2148. };
  2149. if (!asMixin && appContext.mixins.length) {
  2150. appContext.mixins.forEach(extendEmits);
  2151. }
  2152. if (comp.extends) {
  2153. extendEmits(comp.extends);
  2154. }
  2155. if (comp.mixins) {
  2156. comp.mixins.forEach(extendEmits);
  2157. }
  2158. }
  2159. if (!raw && !hasExtends) {
  2160. if (isObject(comp)) {
  2161. cache.set(comp, null);
  2162. }
  2163. return null;
  2164. }
  2165. if (isArray(raw)) {
  2166. raw.forEach((key) => normalized[key] = null);
  2167. } else {
  2168. extend(normalized, raw);
  2169. }
  2170. if (isObject(comp)) {
  2171. cache.set(comp, normalized);
  2172. }
  2173. return normalized;
  2174. }
  2175. function isEmitListener(options, key) {
  2176. if (!options || !isOn(key)) {
  2177. return false;
  2178. }
  2179. key = key.slice(2).replace(/Once$/, "");
  2180. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  2181. }
  2182. let currentRenderingInstance = null;
  2183. let currentScopeId = null;
  2184. function setCurrentRenderingInstance(instance) {
  2185. const prev = currentRenderingInstance;
  2186. currentRenderingInstance = instance;
  2187. currentScopeId = instance && instance.type.__scopeId || null;
  2188. return prev;
  2189. }
  2190. function pushScopeId(id) {
  2191. currentScopeId = id;
  2192. }
  2193. function popScopeId() {
  2194. currentScopeId = null;
  2195. }
  2196. const withScopeId = (_id) => withCtx;
  2197. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2198. if (!ctx)
  2199. return fn;
  2200. if (fn._n) {
  2201. return fn;
  2202. }
  2203. const renderFnWithContext = (...args) => {
  2204. if (renderFnWithContext._d) {
  2205. setBlockTracking(-1);
  2206. }
  2207. const prevInstance = setCurrentRenderingInstance(ctx);
  2208. let res;
  2209. try {
  2210. res = fn(...args);
  2211. } finally {
  2212. setCurrentRenderingInstance(prevInstance);
  2213. if (renderFnWithContext._d) {
  2214. setBlockTracking(1);
  2215. }
  2216. }
  2217. {
  2218. devtoolsComponentUpdated(ctx);
  2219. }
  2220. return res;
  2221. };
  2222. renderFnWithContext._n = true;
  2223. renderFnWithContext._c = true;
  2224. renderFnWithContext._d = true;
  2225. return renderFnWithContext;
  2226. }
  2227. let accessedAttrs = false;
  2228. function markAttrsAccessed() {
  2229. accessedAttrs = true;
  2230. }
  2231. function renderComponentRoot(instance) {
  2232. const {
  2233. type: Component,
  2234. vnode,
  2235. proxy,
  2236. withProxy,
  2237. props,
  2238. propsOptions: [propsOptions],
  2239. slots,
  2240. attrs,
  2241. emit,
  2242. render,
  2243. renderCache,
  2244. data,
  2245. setupState,
  2246. ctx,
  2247. inheritAttrs
  2248. } = instance;
  2249. let result;
  2250. let fallthroughAttrs;
  2251. const prev = setCurrentRenderingInstance(instance);
  2252. {
  2253. accessedAttrs = false;
  2254. }
  2255. try {
  2256. if (vnode.shapeFlag & 4) {
  2257. const proxyToUse = withProxy || proxy;
  2258. result = normalizeVNode(
  2259. render.call(
  2260. proxyToUse,
  2261. proxyToUse,
  2262. renderCache,
  2263. props,
  2264. setupState,
  2265. data,
  2266. ctx
  2267. )
  2268. );
  2269. fallthroughAttrs = attrs;
  2270. } else {
  2271. const render2 = Component;
  2272. if (attrs === props) {
  2273. markAttrsAccessed();
  2274. }
  2275. result = normalizeVNode(
  2276. render2.length > 1 ? render2(
  2277. props,
  2278. true ? {
  2279. get attrs() {
  2280. markAttrsAccessed();
  2281. return attrs;
  2282. },
  2283. slots,
  2284. emit
  2285. } : { attrs, slots, emit }
  2286. ) : render2(
  2287. props,
  2288. null
  2289. /* we know it doesn't need it */
  2290. )
  2291. );
  2292. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  2293. }
  2294. } catch (err) {
  2295. blockStack.length = 0;
  2296. handleError(err, instance, 1);
  2297. result = createVNode(Comment);
  2298. }
  2299. let root = result;
  2300. let setRoot = void 0;
  2301. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  2302. [root, setRoot] = getChildRoot(result);
  2303. }
  2304. if (fallthroughAttrs && inheritAttrs !== false) {
  2305. const keys = Object.keys(fallthroughAttrs);
  2306. const { shapeFlag } = root;
  2307. if (keys.length) {
  2308. if (shapeFlag & (1 | 6)) {
  2309. if (propsOptions && keys.some(isModelListener)) {
  2310. fallthroughAttrs = filterModelListeners(
  2311. fallthroughAttrs,
  2312. propsOptions
  2313. );
  2314. }
  2315. root = cloneVNode(root, fallthroughAttrs);
  2316. } else if (!accessedAttrs && root.type !== Comment) {
  2317. const allAttrs = Object.keys(attrs);
  2318. const eventAttrs = [];
  2319. const extraAttrs = [];
  2320. for (let i = 0, l = allAttrs.length; i < l; i++) {
  2321. const key = allAttrs[i];
  2322. if (isOn(key)) {
  2323. if (!isModelListener(key)) {
  2324. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  2325. }
  2326. } else {
  2327. extraAttrs.push(key);
  2328. }
  2329. }
  2330. if (extraAttrs.length) {
  2331. warn(
  2332. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  2333. );
  2334. }
  2335. if (eventAttrs.length) {
  2336. warn(
  2337. `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.`
  2338. );
  2339. }
  2340. }
  2341. }
  2342. }
  2343. if (vnode.dirs) {
  2344. if (!isElementRoot(root)) {
  2345. warn(
  2346. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  2347. );
  2348. }
  2349. root = cloneVNode(root);
  2350. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  2351. }
  2352. if (vnode.transition) {
  2353. if (!isElementRoot(root)) {
  2354. warn(
  2355. `Component inside <Transition> renders non-element root node that cannot be animated.`
  2356. );
  2357. }
  2358. root.transition = vnode.transition;
  2359. }
  2360. if (setRoot) {
  2361. setRoot(root);
  2362. } else {
  2363. result = root;
  2364. }
  2365. setCurrentRenderingInstance(prev);
  2366. return result;
  2367. }
  2368. const getChildRoot = (vnode) => {
  2369. const rawChildren = vnode.children;
  2370. const dynamicChildren = vnode.dynamicChildren;
  2371. const childRoot = filterSingleRoot(rawChildren);
  2372. if (!childRoot) {
  2373. return [vnode, void 0];
  2374. }
  2375. const index = rawChildren.indexOf(childRoot);
  2376. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  2377. const setRoot = (updatedRoot) => {
  2378. rawChildren[index] = updatedRoot;
  2379. if (dynamicChildren) {
  2380. if (dynamicIndex > -1) {
  2381. dynamicChildren[dynamicIndex] = updatedRoot;
  2382. } else if (updatedRoot.patchFlag > 0) {
  2383. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  2384. }
  2385. }
  2386. };
  2387. return [normalizeVNode(childRoot), setRoot];
  2388. };
  2389. function filterSingleRoot(children) {
  2390. let singleRoot;
  2391. for (let i = 0; i < children.length; i++) {
  2392. const child = children[i];
  2393. if (isVNode(child)) {
  2394. if (child.type !== Comment || child.children === "v-if") {
  2395. if (singleRoot) {
  2396. return;
  2397. } else {
  2398. singleRoot = child;
  2399. }
  2400. }
  2401. } else {
  2402. return;
  2403. }
  2404. }
  2405. return singleRoot;
  2406. }
  2407. const getFunctionalFallthrough = (attrs) => {
  2408. let res;
  2409. for (const key in attrs) {
  2410. if (key === "class" || key === "style" || isOn(key)) {
  2411. (res || (res = {}))[key] = attrs[key];
  2412. }
  2413. }
  2414. return res;
  2415. };
  2416. const filterModelListeners = (attrs, props) => {
  2417. const res = {};
  2418. for (const key in attrs) {
  2419. if (!isModelListener(key) || !(key.slice(9) in props)) {
  2420. res[key] = attrs[key];
  2421. }
  2422. }
  2423. return res;
  2424. };
  2425. const isElementRoot = (vnode) => {
  2426. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  2427. };
  2428. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  2429. const { props: prevProps, children: prevChildren, component } = prevVNode;
  2430. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  2431. const emits = component.emitsOptions;
  2432. if ((prevChildren || nextChildren) && isHmrUpdating) {
  2433. return true;
  2434. }
  2435. if (nextVNode.dirs || nextVNode.transition) {
  2436. return true;
  2437. }
  2438. if (optimized && patchFlag >= 0) {
  2439. if (patchFlag & 1024) {
  2440. return true;
  2441. }
  2442. if (patchFlag & 16) {
  2443. if (!prevProps) {
  2444. return !!nextProps;
  2445. }
  2446. return hasPropsChanged(prevProps, nextProps, emits);
  2447. } else if (patchFlag & 8) {
  2448. const dynamicProps = nextVNode.dynamicProps;
  2449. for (let i = 0; i < dynamicProps.length; i++) {
  2450. const key = dynamicProps[i];
  2451. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  2452. return true;
  2453. }
  2454. }
  2455. }
  2456. } else {
  2457. if (prevChildren || nextChildren) {
  2458. if (!nextChildren || !nextChildren.$stable) {
  2459. return true;
  2460. }
  2461. }
  2462. if (prevProps === nextProps) {
  2463. return false;
  2464. }
  2465. if (!prevProps) {
  2466. return !!nextProps;
  2467. }
  2468. if (!nextProps) {
  2469. return true;
  2470. }
  2471. return hasPropsChanged(prevProps, nextProps, emits);
  2472. }
  2473. return false;
  2474. }
  2475. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  2476. const nextKeys = Object.keys(nextProps);
  2477. if (nextKeys.length !== Object.keys(prevProps).length) {
  2478. return true;
  2479. }
  2480. for (let i = 0; i < nextKeys.length; i++) {
  2481. const key = nextKeys[i];
  2482. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  2483. return true;
  2484. }
  2485. }
  2486. return false;
  2487. }
  2488. function updateHOCHostEl({ vnode, parent }, el) {
  2489. while (parent && parent.subTree === vnode) {
  2490. (vnode = parent.vnode).el = el;
  2491. parent = parent.parent;
  2492. }
  2493. }
  2494. const isSuspense = (type) => type.__isSuspense;
  2495. const SuspenseImpl = {
  2496. name: "Suspense",
  2497. // In order to make Suspense tree-shakable, we need to avoid importing it
  2498. // directly in the renderer. The renderer checks for the __isSuspense flag
  2499. // on a vnode's type and calls the `process` method, passing in renderer
  2500. // internals.
  2501. __isSuspense: true,
  2502. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  2503. if (n1 == null) {
  2504. mountSuspense(
  2505. n2,
  2506. container,
  2507. anchor,
  2508. parentComponent,
  2509. parentSuspense,
  2510. isSVG,
  2511. slotScopeIds,
  2512. optimized,
  2513. rendererInternals
  2514. );
  2515. } else {
  2516. patchSuspense(
  2517. n1,
  2518. n2,
  2519. container,
  2520. anchor,
  2521. parentComponent,
  2522. isSVG,
  2523. slotScopeIds,
  2524. optimized,
  2525. rendererInternals
  2526. );
  2527. }
  2528. },
  2529. hydrate: hydrateSuspense,
  2530. create: createSuspenseBoundary,
  2531. normalize: normalizeSuspenseChildren
  2532. };
  2533. const Suspense = SuspenseImpl ;
  2534. function triggerEvent(vnode, name) {
  2535. const eventListener = vnode.props && vnode.props[name];
  2536. if (isFunction(eventListener)) {
  2537. eventListener();
  2538. }
  2539. }
  2540. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  2541. const {
  2542. p: patch,
  2543. o: { createElement }
  2544. } = rendererInternals;
  2545. const hiddenContainer = createElement("div");
  2546. const suspense = vnode.suspense = createSuspenseBoundary(
  2547. vnode,
  2548. parentSuspense,
  2549. parentComponent,
  2550. container,
  2551. hiddenContainer,
  2552. anchor,
  2553. isSVG,
  2554. slotScopeIds,
  2555. optimized,
  2556. rendererInternals
  2557. );
  2558. patch(
  2559. null,
  2560. suspense.pendingBranch = vnode.ssContent,
  2561. hiddenContainer,
  2562. null,
  2563. parentComponent,
  2564. suspense,
  2565. isSVG,
  2566. slotScopeIds
  2567. );
  2568. if (suspense.deps > 0) {
  2569. triggerEvent(vnode, "onPending");
  2570. triggerEvent(vnode, "onFallback");
  2571. patch(
  2572. null,
  2573. vnode.ssFallback,
  2574. container,
  2575. anchor,
  2576. parentComponent,
  2577. null,
  2578. // fallback tree will not have suspense context
  2579. isSVG,
  2580. slotScopeIds
  2581. );
  2582. setActiveBranch(suspense, vnode.ssFallback);
  2583. } else {
  2584. suspense.resolve(false, true);
  2585. }
  2586. }
  2587. function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  2588. const suspense = n2.suspense = n1.suspense;
  2589. suspense.vnode = n2;
  2590. n2.el = n1.el;
  2591. const newBranch = n2.ssContent;
  2592. const newFallback = n2.ssFallback;
  2593. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  2594. if (pendingBranch) {
  2595. suspense.pendingBranch = newBranch;
  2596. if (isSameVNodeType(newBranch, pendingBranch)) {
  2597. patch(
  2598. pendingBranch,
  2599. newBranch,
  2600. suspense.hiddenContainer,
  2601. null,
  2602. parentComponent,
  2603. suspense,
  2604. isSVG,
  2605. slotScopeIds,
  2606. optimized
  2607. );
  2608. if (suspense.deps <= 0) {
  2609. suspense.resolve();
  2610. } else if (isInFallback) {
  2611. patch(
  2612. activeBranch,
  2613. newFallback,
  2614. container,
  2615. anchor,
  2616. parentComponent,
  2617. null,
  2618. // fallback tree will not have suspense context
  2619. isSVG,
  2620. slotScopeIds,
  2621. optimized
  2622. );
  2623. setActiveBranch(suspense, newFallback);
  2624. }
  2625. } else {
  2626. suspense.pendingId++;
  2627. if (isHydrating) {
  2628. suspense.isHydrating = false;
  2629. suspense.activeBranch = pendingBranch;
  2630. } else {
  2631. unmount(pendingBranch, parentComponent, suspense);
  2632. }
  2633. suspense.deps = 0;
  2634. suspense.effects.length = 0;
  2635. suspense.hiddenContainer = createElement("div");
  2636. if (isInFallback) {
  2637. patch(
  2638. null,
  2639. newBranch,
  2640. suspense.hiddenContainer,
  2641. null,
  2642. parentComponent,
  2643. suspense,
  2644. isSVG,
  2645. slotScopeIds,
  2646. optimized
  2647. );
  2648. if (suspense.deps <= 0) {
  2649. suspense.resolve();
  2650. } else {
  2651. patch(
  2652. activeBranch,
  2653. newFallback,
  2654. container,
  2655. anchor,
  2656. parentComponent,
  2657. null,
  2658. // fallback tree will not have suspense context
  2659. isSVG,
  2660. slotScopeIds,
  2661. optimized
  2662. );
  2663. setActiveBranch(suspense, newFallback);
  2664. }
  2665. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2666. patch(
  2667. activeBranch,
  2668. newBranch,
  2669. container,
  2670. anchor,
  2671. parentComponent,
  2672. suspense,
  2673. isSVG,
  2674. slotScopeIds,
  2675. optimized
  2676. );
  2677. suspense.resolve(true);
  2678. } else {
  2679. patch(
  2680. null,
  2681. newBranch,
  2682. suspense.hiddenContainer,
  2683. null,
  2684. parentComponent,
  2685. suspense,
  2686. isSVG,
  2687. slotScopeIds,
  2688. optimized
  2689. );
  2690. if (suspense.deps <= 0) {
  2691. suspense.resolve();
  2692. }
  2693. }
  2694. }
  2695. } else {
  2696. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2697. patch(
  2698. activeBranch,
  2699. newBranch,
  2700. container,
  2701. anchor,
  2702. parentComponent,
  2703. suspense,
  2704. isSVG,
  2705. slotScopeIds,
  2706. optimized
  2707. );
  2708. setActiveBranch(suspense, newBranch);
  2709. } else {
  2710. triggerEvent(n2, "onPending");
  2711. suspense.pendingBranch = newBranch;
  2712. suspense.pendingId++;
  2713. patch(
  2714. null,
  2715. newBranch,
  2716. suspense.hiddenContainer,
  2717. null,
  2718. parentComponent,
  2719. suspense,
  2720. isSVG,
  2721. slotScopeIds,
  2722. optimized
  2723. );
  2724. if (suspense.deps <= 0) {
  2725. suspense.resolve();
  2726. } else {
  2727. const { timeout, pendingId } = suspense;
  2728. if (timeout > 0) {
  2729. setTimeout(() => {
  2730. if (suspense.pendingId === pendingId) {
  2731. suspense.fallback(newFallback);
  2732. }
  2733. }, timeout);
  2734. } else if (timeout === 0) {
  2735. suspense.fallback(newFallback);
  2736. }
  2737. }
  2738. }
  2739. }
  2740. }
  2741. let hasWarned = false;
  2742. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  2743. if (!hasWarned) {
  2744. hasWarned = true;
  2745. console[console.info ? "info" : "log"](
  2746. `<Suspense> is an experimental feature and its API will likely change.`
  2747. );
  2748. }
  2749. const {
  2750. p: patch,
  2751. m: move,
  2752. um: unmount,
  2753. n: next,
  2754. o: { parentNode, remove }
  2755. } = rendererInternals;
  2756. let parentSuspenseId;
  2757. const isSuspensible = isVNodeSuspensible(vnode);
  2758. if (isSuspensible) {
  2759. if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
  2760. parentSuspenseId = parentSuspense.pendingId;
  2761. parentSuspense.deps++;
  2762. }
  2763. }
  2764. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  2765. {
  2766. assertNumber(timeout, `Suspense timeout`);
  2767. }
  2768. const suspense = {
  2769. vnode,
  2770. parent: parentSuspense,
  2771. parentComponent,
  2772. isSVG,
  2773. container,
  2774. hiddenContainer,
  2775. anchor,
  2776. deps: 0,
  2777. pendingId: 0,
  2778. timeout: typeof timeout === "number" ? timeout : -1,
  2779. activeBranch: null,
  2780. pendingBranch: null,
  2781. isInFallback: true,
  2782. isHydrating,
  2783. isUnmounted: false,
  2784. effects: [],
  2785. resolve(resume = false, sync = false) {
  2786. {
  2787. if (!resume && !suspense.pendingBranch) {
  2788. throw new Error(
  2789. `suspense.resolve() is called without a pending branch.`
  2790. );
  2791. }
  2792. if (suspense.isUnmounted) {
  2793. throw new Error(
  2794. `suspense.resolve() is called on an already unmounted suspense boundary.`
  2795. );
  2796. }
  2797. }
  2798. const {
  2799. vnode: vnode2,
  2800. activeBranch,
  2801. pendingBranch,
  2802. pendingId,
  2803. effects,
  2804. parentComponent: parentComponent2,
  2805. container: container2
  2806. } = suspense;
  2807. if (suspense.isHydrating) {
  2808. suspense.isHydrating = false;
  2809. } else if (!resume) {
  2810. const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  2811. if (delayEnter) {
  2812. activeBranch.transition.afterLeave = () => {
  2813. if (pendingId === suspense.pendingId) {
  2814. move(pendingBranch, container2, anchor2, 0);
  2815. }
  2816. };
  2817. }
  2818. let { anchor: anchor2 } = suspense;
  2819. if (activeBranch) {
  2820. anchor2 = next(activeBranch);
  2821. unmount(activeBranch, parentComponent2, suspense, true);
  2822. }
  2823. if (!delayEnter) {
  2824. move(pendingBranch, container2, anchor2, 0);
  2825. }
  2826. }
  2827. setActiveBranch(suspense, pendingBranch);
  2828. suspense.pendingBranch = null;
  2829. suspense.isInFallback = false;
  2830. let parent = suspense.parent;
  2831. let hasUnresolvedAncestor = false;
  2832. while (parent) {
  2833. if (parent.pendingBranch) {
  2834. parent.effects.push(...effects);
  2835. hasUnresolvedAncestor = true;
  2836. break;
  2837. }
  2838. parent = parent.parent;
  2839. }
  2840. if (!hasUnresolvedAncestor) {
  2841. queuePostFlushCb(effects);
  2842. }
  2843. suspense.effects = [];
  2844. if (isSuspensible) {
  2845. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  2846. parentSuspense.deps--;
  2847. if (parentSuspense.deps === 0 && !sync) {
  2848. parentSuspense.resolve();
  2849. }
  2850. }
  2851. }
  2852. triggerEvent(vnode2, "onResolve");
  2853. },
  2854. fallback(fallbackVNode) {
  2855. if (!suspense.pendingBranch) {
  2856. return;
  2857. }
  2858. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
  2859. triggerEvent(vnode2, "onFallback");
  2860. const anchor2 = next(activeBranch);
  2861. const mountFallback = () => {
  2862. if (!suspense.isInFallback) {
  2863. return;
  2864. }
  2865. patch(
  2866. null,
  2867. fallbackVNode,
  2868. container2,
  2869. anchor2,
  2870. parentComponent2,
  2871. null,
  2872. // fallback tree will not have suspense context
  2873. isSVG2,
  2874. slotScopeIds,
  2875. optimized
  2876. );
  2877. setActiveBranch(suspense, fallbackVNode);
  2878. };
  2879. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  2880. if (delayEnter) {
  2881. activeBranch.transition.afterLeave = mountFallback;
  2882. }
  2883. suspense.isInFallback = true;
  2884. unmount(
  2885. activeBranch,
  2886. parentComponent2,
  2887. null,
  2888. // no suspense so unmount hooks fire now
  2889. true
  2890. // shouldRemove
  2891. );
  2892. if (!delayEnter) {
  2893. mountFallback();
  2894. }
  2895. },
  2896. move(container2, anchor2, type) {
  2897. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  2898. suspense.container = container2;
  2899. },
  2900. next() {
  2901. return suspense.activeBranch && next(suspense.activeBranch);
  2902. },
  2903. registerDep(instance, setupRenderEffect) {
  2904. const isInPendingSuspense = !!suspense.pendingBranch;
  2905. if (isInPendingSuspense) {
  2906. suspense.deps++;
  2907. }
  2908. const hydratedEl = instance.vnode.el;
  2909. instance.asyncDep.catch((err) => {
  2910. handleError(err, instance, 0);
  2911. }).then((asyncSetupResult) => {
  2912. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  2913. return;
  2914. }
  2915. instance.asyncResolved = true;
  2916. const { vnode: vnode2 } = instance;
  2917. {
  2918. pushWarningContext(vnode2);
  2919. }
  2920. handleSetupResult(instance, asyncSetupResult, false);
  2921. if (hydratedEl) {
  2922. vnode2.el = hydratedEl;
  2923. }
  2924. const placeholder = !hydratedEl && instance.subTree.el;
  2925. setupRenderEffect(
  2926. instance,
  2927. vnode2,
  2928. // component may have been moved before resolve.
  2929. // if this is not a hydration, instance.subTree will be the comment
  2930. // placeholder.
  2931. parentNode(hydratedEl || instance.subTree.el),
  2932. // anchor will not be used if this is hydration, so only need to
  2933. // consider the comment placeholder case.
  2934. hydratedEl ? null : next(instance.subTree),
  2935. suspense,
  2936. isSVG,
  2937. optimized
  2938. );
  2939. if (placeholder) {
  2940. remove(placeholder);
  2941. }
  2942. updateHOCHostEl(instance, vnode2.el);
  2943. {
  2944. popWarningContext();
  2945. }
  2946. if (isInPendingSuspense && --suspense.deps === 0) {
  2947. suspense.resolve();
  2948. }
  2949. });
  2950. },
  2951. unmount(parentSuspense2, doRemove) {
  2952. suspense.isUnmounted = true;
  2953. if (suspense.activeBranch) {
  2954. unmount(
  2955. suspense.activeBranch,
  2956. parentComponent,
  2957. parentSuspense2,
  2958. doRemove
  2959. );
  2960. }
  2961. if (suspense.pendingBranch) {
  2962. unmount(
  2963. suspense.pendingBranch,
  2964. parentComponent,
  2965. parentSuspense2,
  2966. doRemove
  2967. );
  2968. }
  2969. }
  2970. };
  2971. return suspense;
  2972. }
  2973. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  2974. const suspense = vnode.suspense = createSuspenseBoundary(
  2975. vnode,
  2976. parentSuspense,
  2977. parentComponent,
  2978. node.parentNode,
  2979. document.createElement("div"),
  2980. null,
  2981. isSVG,
  2982. slotScopeIds,
  2983. optimized,
  2984. rendererInternals,
  2985. true
  2986. /* hydrating */
  2987. );
  2988. const result = hydrateNode(
  2989. node,
  2990. suspense.pendingBranch = vnode.ssContent,
  2991. parentComponent,
  2992. suspense,
  2993. slotScopeIds,
  2994. optimized
  2995. );
  2996. if (suspense.deps === 0) {
  2997. suspense.resolve(false, true);
  2998. }
  2999. return result;
  3000. }
  3001. function normalizeSuspenseChildren(vnode) {
  3002. const { shapeFlag, children } = vnode;
  3003. const isSlotChildren = shapeFlag & 32;
  3004. vnode.ssContent = normalizeSuspenseSlot(
  3005. isSlotChildren ? children.default : children
  3006. );
  3007. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  3008. }
  3009. function normalizeSuspenseSlot(s) {
  3010. let block;
  3011. if (isFunction(s)) {
  3012. const trackBlock = isBlockTreeEnabled && s._c;
  3013. if (trackBlock) {
  3014. s._d = false;
  3015. openBlock();
  3016. }
  3017. s = s();
  3018. if (trackBlock) {
  3019. s._d = true;
  3020. block = currentBlock;
  3021. closeBlock();
  3022. }
  3023. }
  3024. if (isArray(s)) {
  3025. const singleChild = filterSingleRoot(s);
  3026. if (!singleChild) {
  3027. warn(`<Suspense> slots expect a single root node.`);
  3028. }
  3029. s = singleChild;
  3030. }
  3031. s = normalizeVNode(s);
  3032. if (block && !s.dynamicChildren) {
  3033. s.dynamicChildren = block.filter((c) => c !== s);
  3034. }
  3035. return s;
  3036. }
  3037. function queueEffectWithSuspense(fn, suspense) {
  3038. if (suspense && suspense.pendingBranch) {
  3039. if (isArray(fn)) {
  3040. suspense.effects.push(...fn);
  3041. } else {
  3042. suspense.effects.push(fn);
  3043. }
  3044. } else {
  3045. queuePostFlushCb(fn);
  3046. }
  3047. }
  3048. function setActiveBranch(suspense, branch) {
  3049. suspense.activeBranch = branch;
  3050. const { vnode, parentComponent } = suspense;
  3051. const el = vnode.el = branch.el;
  3052. if (parentComponent && parentComponent.subTree === vnode) {
  3053. parentComponent.vnode.el = el;
  3054. updateHOCHostEl(parentComponent, el);
  3055. }
  3056. }
  3057. function isVNodeSuspensible(vnode) {
  3058. var _a;
  3059. return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
  3060. }
  3061. function watchEffect(effect, options) {
  3062. return doWatch(effect, null, options);
  3063. }
  3064. function watchPostEffect(effect, options) {
  3065. return doWatch(
  3066. effect,
  3067. null,
  3068. extend({}, options, { flush: "post" })
  3069. );
  3070. }
  3071. function watchSyncEffect(effect, options) {
  3072. return doWatch(
  3073. effect,
  3074. null,
  3075. extend({}, options, { flush: "sync" })
  3076. );
  3077. }
  3078. const INITIAL_WATCHER_VALUE = {};
  3079. function watch(source, cb, options) {
  3080. if (!isFunction(cb)) {
  3081. warn(
  3082. `\`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.`
  3083. );
  3084. }
  3085. return doWatch(source, cb, options);
  3086. }
  3087. function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
  3088. var _a;
  3089. if (!cb) {
  3090. if (immediate !== void 0) {
  3091. warn(
  3092. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  3093. );
  3094. }
  3095. if (deep !== void 0) {
  3096. warn(
  3097. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  3098. );
  3099. }
  3100. }
  3101. const warnInvalidSource = (s) => {
  3102. warn(
  3103. `Invalid watch source: `,
  3104. s,
  3105. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  3106. );
  3107. };
  3108. const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
  3109. let getter;
  3110. let forceTrigger = false;
  3111. let isMultiSource = false;
  3112. if (isRef(source)) {
  3113. getter = () => source.value;
  3114. forceTrigger = isShallow(source);
  3115. } else if (isReactive(source)) {
  3116. getter = () => source;
  3117. deep = true;
  3118. } else if (isArray(source)) {
  3119. isMultiSource = true;
  3120. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  3121. getter = () => source.map((s) => {
  3122. if (isRef(s)) {
  3123. return s.value;
  3124. } else if (isReactive(s)) {
  3125. return traverse(s);
  3126. } else if (isFunction(s)) {
  3127. return callWithErrorHandling(s, instance, 2);
  3128. } else {
  3129. warnInvalidSource(s);
  3130. }
  3131. });
  3132. } else if (isFunction(source)) {
  3133. if (cb) {
  3134. getter = () => callWithErrorHandling(source, instance, 2);
  3135. } else {
  3136. getter = () => {
  3137. if (instance && instance.isUnmounted) {
  3138. return;
  3139. }
  3140. if (cleanup) {
  3141. cleanup();
  3142. }
  3143. return callWithAsyncErrorHandling(
  3144. source,
  3145. instance,
  3146. 3,
  3147. [onCleanup]
  3148. );
  3149. };
  3150. }
  3151. } else {
  3152. getter = NOOP;
  3153. warnInvalidSource(source);
  3154. }
  3155. if (cb && deep) {
  3156. const baseGetter = getter;
  3157. getter = () => traverse(baseGetter());
  3158. }
  3159. let cleanup;
  3160. let onCleanup = (fn) => {
  3161. cleanup = effect.onStop = () => {
  3162. callWithErrorHandling(fn, instance, 4);
  3163. };
  3164. };
  3165. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  3166. const job = () => {
  3167. if (!effect.active) {
  3168. return;
  3169. }
  3170. if (cb) {
  3171. const newValue = effect.run();
  3172. if (deep || forceTrigger || (isMultiSource ? newValue.some(
  3173. (v, i) => hasChanged(v, oldValue[i])
  3174. ) : hasChanged(newValue, oldValue)) || false) {
  3175. if (cleanup) {
  3176. cleanup();
  3177. }
  3178. callWithAsyncErrorHandling(cb, instance, 3, [
  3179. newValue,
  3180. // pass undefined as the old value when it's changed for the first time
  3181. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  3182. onCleanup
  3183. ]);
  3184. oldValue = newValue;
  3185. }
  3186. } else {
  3187. effect.run();
  3188. }
  3189. };
  3190. job.allowRecurse = !!cb;
  3191. let scheduler;
  3192. if (flush === "sync") {
  3193. scheduler = job;
  3194. } else if (flush === "post") {
  3195. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  3196. } else {
  3197. job.pre = true;
  3198. if (instance)
  3199. job.id = instance.uid;
  3200. scheduler = () => queueJob(job);
  3201. }
  3202. const effect = new ReactiveEffect(getter, scheduler);
  3203. {
  3204. effect.onTrack = onTrack;
  3205. effect.onTrigger = onTrigger;
  3206. }
  3207. if (cb) {
  3208. if (immediate) {
  3209. job();
  3210. } else {
  3211. oldValue = effect.run();
  3212. }
  3213. } else if (flush === "post") {
  3214. queuePostRenderEffect(
  3215. effect.run.bind(effect),
  3216. instance && instance.suspense
  3217. );
  3218. } else {
  3219. effect.run();
  3220. }
  3221. const unwatch = () => {
  3222. effect.stop();
  3223. if (instance && instance.scope) {
  3224. remove(instance.scope.effects, effect);
  3225. }
  3226. };
  3227. return unwatch;
  3228. }
  3229. function instanceWatch(source, value, options) {
  3230. const publicThis = this.proxy;
  3231. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3232. let cb;
  3233. if (isFunction(value)) {
  3234. cb = value;
  3235. } else {
  3236. cb = value.handler;
  3237. options = value;
  3238. }
  3239. const cur = currentInstance;
  3240. setCurrentInstance(this);
  3241. const res = doWatch(getter, cb.bind(publicThis), options);
  3242. if (cur) {
  3243. setCurrentInstance(cur);
  3244. } else {
  3245. unsetCurrentInstance();
  3246. }
  3247. return res;
  3248. }
  3249. function createPathGetter(ctx, path) {
  3250. const segments = path.split(".");
  3251. return () => {
  3252. let cur = ctx;
  3253. for (let i = 0; i < segments.length && cur; i++) {
  3254. cur = cur[segments[i]];
  3255. }
  3256. return cur;
  3257. };
  3258. }
  3259. function traverse(value, seen) {
  3260. if (!isObject(value) || value["__v_skip"]) {
  3261. return value;
  3262. }
  3263. seen = seen || /* @__PURE__ */ new Set();
  3264. if (seen.has(value)) {
  3265. return value;
  3266. }
  3267. seen.add(value);
  3268. if (isRef(value)) {
  3269. traverse(value.value, seen);
  3270. } else if (isArray(value)) {
  3271. for (let i = 0; i < value.length; i++) {
  3272. traverse(value[i], seen);
  3273. }
  3274. } else if (isSet(value) || isMap(value)) {
  3275. value.forEach((v) => {
  3276. traverse(v, seen);
  3277. });
  3278. } else if (isPlainObject(value)) {
  3279. for (const key in value) {
  3280. traverse(value[key], seen);
  3281. }
  3282. }
  3283. return value;
  3284. }
  3285. function validateDirectiveName(name) {
  3286. if (isBuiltInDirective(name)) {
  3287. warn("Do not use built-in directive ids as custom directive id: " + name);
  3288. }
  3289. }
  3290. function withDirectives(vnode, directives) {
  3291. const internalInstance = currentRenderingInstance;
  3292. if (internalInstance === null) {
  3293. warn(`withDirectives can only be used inside render functions.`);
  3294. return vnode;
  3295. }
  3296. const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
  3297. const bindings = vnode.dirs || (vnode.dirs = []);
  3298. for (let i = 0; i < directives.length; i++) {
  3299. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  3300. if (dir) {
  3301. if (isFunction(dir)) {
  3302. dir = {
  3303. mounted: dir,
  3304. updated: dir
  3305. };
  3306. }
  3307. if (dir.deep) {
  3308. traverse(value);
  3309. }
  3310. bindings.push({
  3311. dir,
  3312. instance,
  3313. value,
  3314. oldValue: void 0,
  3315. arg,
  3316. modifiers
  3317. });
  3318. }
  3319. }
  3320. return vnode;
  3321. }
  3322. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  3323. const bindings = vnode.dirs;
  3324. const oldBindings = prevVNode && prevVNode.dirs;
  3325. for (let i = 0; i < bindings.length; i++) {
  3326. const binding = bindings[i];
  3327. if (oldBindings) {
  3328. binding.oldValue = oldBindings[i].value;
  3329. }
  3330. let hook = binding.dir[name];
  3331. if (hook) {
  3332. pauseTracking();
  3333. callWithAsyncErrorHandling(hook, instance, 8, [
  3334. vnode.el,
  3335. binding,
  3336. vnode,
  3337. prevVNode
  3338. ]);
  3339. resetTracking();
  3340. }
  3341. }
  3342. }
  3343. function useTransitionState() {
  3344. const state = {
  3345. isMounted: false,
  3346. isLeaving: false,
  3347. isUnmounting: false,
  3348. leavingVNodes: /* @__PURE__ */ new Map()
  3349. };
  3350. onMounted(() => {
  3351. state.isMounted = true;
  3352. });
  3353. onBeforeUnmount(() => {
  3354. state.isUnmounting = true;
  3355. });
  3356. return state;
  3357. }
  3358. const TransitionHookValidator = [Function, Array];
  3359. const BaseTransitionPropsValidators = {
  3360. mode: String,
  3361. appear: Boolean,
  3362. persisted: Boolean,
  3363. // enter
  3364. onBeforeEnter: TransitionHookValidator,
  3365. onEnter: TransitionHookValidator,
  3366. onAfterEnter: TransitionHookValidator,
  3367. onEnterCancelled: TransitionHookValidator,
  3368. // leave
  3369. onBeforeLeave: TransitionHookValidator,
  3370. onLeave: TransitionHookValidator,
  3371. onAfterLeave: TransitionHookValidator,
  3372. onLeaveCancelled: TransitionHookValidator,
  3373. // appear
  3374. onBeforeAppear: TransitionHookValidator,
  3375. onAppear: TransitionHookValidator,
  3376. onAfterAppear: TransitionHookValidator,
  3377. onAppearCancelled: TransitionHookValidator
  3378. };
  3379. const BaseTransitionImpl = {
  3380. name: `BaseTransition`,
  3381. props: BaseTransitionPropsValidators,
  3382. setup(props, { slots }) {
  3383. const instance = getCurrentInstance();
  3384. const state = useTransitionState();
  3385. let prevTransitionKey;
  3386. return () => {
  3387. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3388. if (!children || !children.length) {
  3389. return;
  3390. }
  3391. let child = children[0];
  3392. if (children.length > 1) {
  3393. let hasFound = false;
  3394. for (const c of children) {
  3395. if (c.type !== Comment) {
  3396. if (hasFound) {
  3397. warn(
  3398. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3399. );
  3400. break;
  3401. }
  3402. child = c;
  3403. hasFound = true;
  3404. }
  3405. }
  3406. }
  3407. const rawProps = toRaw(props);
  3408. const { mode } = rawProps;
  3409. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3410. warn(`invalid <transition> mode: ${mode}`);
  3411. }
  3412. if (state.isLeaving) {
  3413. return emptyPlaceholder(child);
  3414. }
  3415. const innerChild = getKeepAliveChild(child);
  3416. if (!innerChild) {
  3417. return emptyPlaceholder(child);
  3418. }
  3419. const enterHooks = resolveTransitionHooks(
  3420. innerChild,
  3421. rawProps,
  3422. state,
  3423. instance
  3424. );
  3425. setTransitionHooks(innerChild, enterHooks);
  3426. const oldChild = instance.subTree;
  3427. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  3428. let transitionKeyChanged = false;
  3429. const { getTransitionKey } = innerChild.type;
  3430. if (getTransitionKey) {
  3431. const key = getTransitionKey();
  3432. if (prevTransitionKey === void 0) {
  3433. prevTransitionKey = key;
  3434. } else if (key !== prevTransitionKey) {
  3435. prevTransitionKey = key;
  3436. transitionKeyChanged = true;
  3437. }
  3438. }
  3439. if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
  3440. const leavingHooks = resolveTransitionHooks(
  3441. oldInnerChild,
  3442. rawProps,
  3443. state,
  3444. instance
  3445. );
  3446. setTransitionHooks(oldInnerChild, leavingHooks);
  3447. if (mode === "out-in") {
  3448. state.isLeaving = true;
  3449. leavingHooks.afterLeave = () => {
  3450. state.isLeaving = false;
  3451. if (instance.update.active !== false) {
  3452. instance.update();
  3453. }
  3454. };
  3455. return emptyPlaceholder(child);
  3456. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3457. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3458. const leavingVNodesCache = getLeavingNodesForType(
  3459. state,
  3460. oldInnerChild
  3461. );
  3462. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3463. el._leaveCb = () => {
  3464. earlyRemove();
  3465. el._leaveCb = void 0;
  3466. delete enterHooks.delayedLeave;
  3467. };
  3468. enterHooks.delayedLeave = delayedLeave;
  3469. };
  3470. }
  3471. }
  3472. return child;
  3473. };
  3474. }
  3475. };
  3476. const BaseTransition = BaseTransitionImpl;
  3477. function getLeavingNodesForType(state, vnode) {
  3478. const { leavingVNodes } = state;
  3479. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3480. if (!leavingVNodesCache) {
  3481. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3482. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3483. }
  3484. return leavingVNodesCache;
  3485. }
  3486. function resolveTransitionHooks(vnode, props, state, instance) {
  3487. const {
  3488. appear,
  3489. mode,
  3490. persisted = false,
  3491. onBeforeEnter,
  3492. onEnter,
  3493. onAfterEnter,
  3494. onEnterCancelled,
  3495. onBeforeLeave,
  3496. onLeave,
  3497. onAfterLeave,
  3498. onLeaveCancelled,
  3499. onBeforeAppear,
  3500. onAppear,
  3501. onAfterAppear,
  3502. onAppearCancelled
  3503. } = props;
  3504. const key = String(vnode.key);
  3505. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3506. const callHook = (hook, args) => {
  3507. hook && callWithAsyncErrorHandling(
  3508. hook,
  3509. instance,
  3510. 9,
  3511. args
  3512. );
  3513. };
  3514. const callAsyncHook = (hook, args) => {
  3515. const done = args[1];
  3516. callHook(hook, args);
  3517. if (isArray(hook)) {
  3518. if (hook.every((hook2) => hook2.length <= 1))
  3519. done();
  3520. } else if (hook.length <= 1) {
  3521. done();
  3522. }
  3523. };
  3524. const hooks = {
  3525. mode,
  3526. persisted,
  3527. beforeEnter(el) {
  3528. let hook = onBeforeEnter;
  3529. if (!state.isMounted) {
  3530. if (appear) {
  3531. hook = onBeforeAppear || onBeforeEnter;
  3532. } else {
  3533. return;
  3534. }
  3535. }
  3536. if (el._leaveCb) {
  3537. el._leaveCb(
  3538. true
  3539. /* cancelled */
  3540. );
  3541. }
  3542. const leavingVNode = leavingVNodesCache[key];
  3543. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) {
  3544. leavingVNode.el._leaveCb();
  3545. }
  3546. callHook(hook, [el]);
  3547. },
  3548. enter(el) {
  3549. let hook = onEnter;
  3550. let afterHook = onAfterEnter;
  3551. let cancelHook = onEnterCancelled;
  3552. if (!state.isMounted) {
  3553. if (appear) {
  3554. hook = onAppear || onEnter;
  3555. afterHook = onAfterAppear || onAfterEnter;
  3556. cancelHook = onAppearCancelled || onEnterCancelled;
  3557. } else {
  3558. return;
  3559. }
  3560. }
  3561. let called = false;
  3562. const done = el._enterCb = (cancelled) => {
  3563. if (called)
  3564. return;
  3565. called = true;
  3566. if (cancelled) {
  3567. callHook(cancelHook, [el]);
  3568. } else {
  3569. callHook(afterHook, [el]);
  3570. }
  3571. if (hooks.delayedLeave) {
  3572. hooks.delayedLeave();
  3573. }
  3574. el._enterCb = void 0;
  3575. };
  3576. if (hook) {
  3577. callAsyncHook(hook, [el, done]);
  3578. } else {
  3579. done();
  3580. }
  3581. },
  3582. leave(el, remove) {
  3583. const key2 = String(vnode.key);
  3584. if (el._enterCb) {
  3585. el._enterCb(
  3586. true
  3587. /* cancelled */
  3588. );
  3589. }
  3590. if (state.isUnmounting) {
  3591. return remove();
  3592. }
  3593. callHook(onBeforeLeave, [el]);
  3594. let called = false;
  3595. const done = el._leaveCb = (cancelled) => {
  3596. if (called)
  3597. return;
  3598. called = true;
  3599. remove();
  3600. if (cancelled) {
  3601. callHook(onLeaveCancelled, [el]);
  3602. } else {
  3603. callHook(onAfterLeave, [el]);
  3604. }
  3605. el._leaveCb = void 0;
  3606. if (leavingVNodesCache[key2] === vnode) {
  3607. delete leavingVNodesCache[key2];
  3608. }
  3609. };
  3610. leavingVNodesCache[key2] = vnode;
  3611. if (onLeave) {
  3612. callAsyncHook(onLeave, [el, done]);
  3613. } else {
  3614. done();
  3615. }
  3616. },
  3617. clone(vnode2) {
  3618. return resolveTransitionHooks(vnode2, props, state, instance);
  3619. }
  3620. };
  3621. return hooks;
  3622. }
  3623. function emptyPlaceholder(vnode) {
  3624. if (isKeepAlive(vnode)) {
  3625. vnode = cloneVNode(vnode);
  3626. vnode.children = null;
  3627. return vnode;
  3628. }
  3629. }
  3630. function getKeepAliveChild(vnode) {
  3631. return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
  3632. }
  3633. function setTransitionHooks(vnode, hooks) {
  3634. if (vnode.shapeFlag & 6 && vnode.component) {
  3635. setTransitionHooks(vnode.component.subTree, hooks);
  3636. } else if (vnode.shapeFlag & 128) {
  3637. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3638. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3639. } else {
  3640. vnode.transition = hooks;
  3641. }
  3642. }
  3643. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3644. let ret = [];
  3645. let keyedFragmentCount = 0;
  3646. for (let i = 0; i < children.length; i++) {
  3647. let child = children[i];
  3648. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3649. if (child.type === Fragment) {
  3650. if (child.patchFlag & 128)
  3651. keyedFragmentCount++;
  3652. ret = ret.concat(
  3653. getTransitionRawChildren(child.children, keepComment, key)
  3654. );
  3655. } else if (keepComment || child.type !== Comment) {
  3656. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3657. }
  3658. }
  3659. if (keyedFragmentCount > 1) {
  3660. for (let i = 0; i < ret.length; i++) {
  3661. ret[i].patchFlag = -2;
  3662. }
  3663. }
  3664. return ret;
  3665. }
  3666. function defineComponent(options, extraOptions) {
  3667. return isFunction(options) ? (
  3668. // #8326: extend call and options.name access are considered side-effects
  3669. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3670. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3671. ) : options;
  3672. }
  3673. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  3674. function defineAsyncComponent(source) {
  3675. if (isFunction(source)) {
  3676. source = { loader: source };
  3677. }
  3678. const {
  3679. loader,
  3680. loadingComponent,
  3681. errorComponent,
  3682. delay = 200,
  3683. timeout,
  3684. // undefined = never times out
  3685. suspensible = true,
  3686. onError: userOnError
  3687. } = source;
  3688. let pendingRequest = null;
  3689. let resolvedComp;
  3690. let retries = 0;
  3691. const retry = () => {
  3692. retries++;
  3693. pendingRequest = null;
  3694. return load();
  3695. };
  3696. const load = () => {
  3697. let thisRequest;
  3698. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  3699. err = err instanceof Error ? err : new Error(String(err));
  3700. if (userOnError) {
  3701. return new Promise((resolve, reject) => {
  3702. const userRetry = () => resolve(retry());
  3703. const userFail = () => reject(err);
  3704. userOnError(err, userRetry, userFail, retries + 1);
  3705. });
  3706. } else {
  3707. throw err;
  3708. }
  3709. }).then((comp) => {
  3710. if (thisRequest !== pendingRequest && pendingRequest) {
  3711. return pendingRequest;
  3712. }
  3713. if (!comp) {
  3714. warn(
  3715. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  3716. );
  3717. }
  3718. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  3719. comp = comp.default;
  3720. }
  3721. if (comp && !isObject(comp) && !isFunction(comp)) {
  3722. throw new Error(`Invalid async component load result: ${comp}`);
  3723. }
  3724. resolvedComp = comp;
  3725. return comp;
  3726. }));
  3727. };
  3728. return defineComponent({
  3729. name: "AsyncComponentWrapper",
  3730. __asyncLoader: load,
  3731. get __asyncResolved() {
  3732. return resolvedComp;
  3733. },
  3734. setup() {
  3735. const instance = currentInstance;
  3736. if (resolvedComp) {
  3737. return () => createInnerComp(resolvedComp, instance);
  3738. }
  3739. const onError = (err) => {
  3740. pendingRequest = null;
  3741. handleError(
  3742. err,
  3743. instance,
  3744. 13,
  3745. !errorComponent
  3746. /* do not throw in dev if user provided error component */
  3747. );
  3748. };
  3749. if (suspensible && instance.suspense || false) {
  3750. return load().then((comp) => {
  3751. return () => createInnerComp(comp, instance);
  3752. }).catch((err) => {
  3753. onError(err);
  3754. return () => errorComponent ? createVNode(errorComponent, {
  3755. error: err
  3756. }) : null;
  3757. });
  3758. }
  3759. const loaded = ref(false);
  3760. const error = ref();
  3761. const delayed = ref(!!delay);
  3762. if (delay) {
  3763. setTimeout(() => {
  3764. delayed.value = false;
  3765. }, delay);
  3766. }
  3767. if (timeout != null) {
  3768. setTimeout(() => {
  3769. if (!loaded.value && !error.value) {
  3770. const err = new Error(
  3771. `Async component timed out after ${timeout}ms.`
  3772. );
  3773. onError(err);
  3774. error.value = err;
  3775. }
  3776. }, timeout);
  3777. }
  3778. load().then(() => {
  3779. loaded.value = true;
  3780. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  3781. queueJob(instance.parent.update);
  3782. }
  3783. }).catch((err) => {
  3784. onError(err);
  3785. error.value = err;
  3786. });
  3787. return () => {
  3788. if (loaded.value && resolvedComp) {
  3789. return createInnerComp(resolvedComp, instance);
  3790. } else if (error.value && errorComponent) {
  3791. return createVNode(errorComponent, {
  3792. error: error.value
  3793. });
  3794. } else if (loadingComponent && !delayed.value) {
  3795. return createVNode(loadingComponent);
  3796. }
  3797. };
  3798. }
  3799. });
  3800. }
  3801. function createInnerComp(comp, parent) {
  3802. const { ref: ref2, props, children, ce } = parent.vnode;
  3803. const vnode = createVNode(comp, props, children);
  3804. vnode.ref = ref2;
  3805. vnode.ce = ce;
  3806. delete parent.vnode.ce;
  3807. return vnode;
  3808. }
  3809. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  3810. const KeepAliveImpl = {
  3811. name: `KeepAlive`,
  3812. // Marker for special handling inside the renderer. We are not using a ===
  3813. // check directly on KeepAlive in the renderer, because importing it directly
  3814. // would prevent it from being tree-shaken.
  3815. __isKeepAlive: true,
  3816. props: {
  3817. include: [String, RegExp, Array],
  3818. exclude: [String, RegExp, Array],
  3819. max: [String, Number]
  3820. },
  3821. setup(props, { slots }) {
  3822. const instance = getCurrentInstance();
  3823. const sharedContext = instance.ctx;
  3824. const cache = /* @__PURE__ */ new Map();
  3825. const keys = /* @__PURE__ */ new Set();
  3826. let current = null;
  3827. {
  3828. instance.__v_cache = cache;
  3829. }
  3830. const parentSuspense = instance.suspense;
  3831. const {
  3832. renderer: {
  3833. p: patch,
  3834. m: move,
  3835. um: _unmount,
  3836. o: { createElement }
  3837. }
  3838. } = sharedContext;
  3839. const storageContainer = createElement("div");
  3840. sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
  3841. const instance2 = vnode.component;
  3842. move(vnode, container, anchor, 0, parentSuspense);
  3843. patch(
  3844. instance2.vnode,
  3845. vnode,
  3846. container,
  3847. anchor,
  3848. instance2,
  3849. parentSuspense,
  3850. isSVG,
  3851. vnode.slotScopeIds,
  3852. optimized
  3853. );
  3854. queuePostRenderEffect(() => {
  3855. instance2.isDeactivated = false;
  3856. if (instance2.a) {
  3857. invokeArrayFns(instance2.a);
  3858. }
  3859. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  3860. if (vnodeHook) {
  3861. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  3862. }
  3863. }, parentSuspense);
  3864. {
  3865. devtoolsComponentAdded(instance2);
  3866. }
  3867. };
  3868. sharedContext.deactivate = (vnode) => {
  3869. const instance2 = vnode.component;
  3870. move(vnode, storageContainer, null, 1, parentSuspense);
  3871. queuePostRenderEffect(() => {
  3872. if (instance2.da) {
  3873. invokeArrayFns(instance2.da);
  3874. }
  3875. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  3876. if (vnodeHook) {
  3877. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  3878. }
  3879. instance2.isDeactivated = true;
  3880. }, parentSuspense);
  3881. {
  3882. devtoolsComponentAdded(instance2);
  3883. }
  3884. };
  3885. function unmount(vnode) {
  3886. resetShapeFlag(vnode);
  3887. _unmount(vnode, instance, parentSuspense, true);
  3888. }
  3889. function pruneCache(filter) {
  3890. cache.forEach((vnode, key) => {
  3891. const name = getComponentName(vnode.type);
  3892. if (name && (!filter || !filter(name))) {
  3893. pruneCacheEntry(key);
  3894. }
  3895. });
  3896. }
  3897. function pruneCacheEntry(key) {
  3898. const cached = cache.get(key);
  3899. if (!current || !isSameVNodeType(cached, current)) {
  3900. unmount(cached);
  3901. } else if (current) {
  3902. resetShapeFlag(current);
  3903. }
  3904. cache.delete(key);
  3905. keys.delete(key);
  3906. }
  3907. watch(
  3908. () => [props.include, props.exclude],
  3909. ([include, exclude]) => {
  3910. include && pruneCache((name) => matches(include, name));
  3911. exclude && pruneCache((name) => !matches(exclude, name));
  3912. },
  3913. // prune post-render after `current` has been updated
  3914. { flush: "post", deep: true }
  3915. );
  3916. let pendingCacheKey = null;
  3917. const cacheSubtree = () => {
  3918. if (pendingCacheKey != null) {
  3919. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  3920. }
  3921. };
  3922. onMounted(cacheSubtree);
  3923. onUpdated(cacheSubtree);
  3924. onBeforeUnmount(() => {
  3925. cache.forEach((cached) => {
  3926. const { subTree, suspense } = instance;
  3927. const vnode = getInnerChild(subTree);
  3928. if (cached.type === vnode.type && cached.key === vnode.key) {
  3929. resetShapeFlag(vnode);
  3930. const da = vnode.component.da;
  3931. da && queuePostRenderEffect(da, suspense);
  3932. return;
  3933. }
  3934. unmount(cached);
  3935. });
  3936. });
  3937. return () => {
  3938. pendingCacheKey = null;
  3939. if (!slots.default) {
  3940. return null;
  3941. }
  3942. const children = slots.default();
  3943. const rawVNode = children[0];
  3944. if (children.length > 1) {
  3945. {
  3946. warn(`KeepAlive should contain exactly one component child.`);
  3947. }
  3948. current = null;
  3949. return children;
  3950. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  3951. current = null;
  3952. return rawVNode;
  3953. }
  3954. let vnode = getInnerChild(rawVNode);
  3955. const comp = vnode.type;
  3956. const name = getComponentName(
  3957. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  3958. );
  3959. const { include, exclude, max } = props;
  3960. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  3961. current = vnode;
  3962. return rawVNode;
  3963. }
  3964. const key = vnode.key == null ? comp : vnode.key;
  3965. const cachedVNode = cache.get(key);
  3966. if (vnode.el) {
  3967. vnode = cloneVNode(vnode);
  3968. if (rawVNode.shapeFlag & 128) {
  3969. rawVNode.ssContent = vnode;
  3970. }
  3971. }
  3972. pendingCacheKey = key;
  3973. if (cachedVNode) {
  3974. vnode.el = cachedVNode.el;
  3975. vnode.component = cachedVNode.component;
  3976. if (vnode.transition) {
  3977. setTransitionHooks(vnode, vnode.transition);
  3978. }
  3979. vnode.shapeFlag |= 512;
  3980. keys.delete(key);
  3981. keys.add(key);
  3982. } else {
  3983. keys.add(key);
  3984. if (max && keys.size > parseInt(max, 10)) {
  3985. pruneCacheEntry(keys.values().next().value);
  3986. }
  3987. }
  3988. vnode.shapeFlag |= 256;
  3989. current = vnode;
  3990. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  3991. };
  3992. }
  3993. };
  3994. const KeepAlive = KeepAliveImpl;
  3995. function matches(pattern, name) {
  3996. if (isArray(pattern)) {
  3997. return pattern.some((p) => matches(p, name));
  3998. } else if (isString(pattern)) {
  3999. return pattern.split(",").includes(name);
  4000. } else if (isRegExp(pattern)) {
  4001. return pattern.test(name);
  4002. }
  4003. return false;
  4004. }
  4005. function onActivated(hook, target) {
  4006. registerKeepAliveHook(hook, "a", target);
  4007. }
  4008. function onDeactivated(hook, target) {
  4009. registerKeepAliveHook(hook, "da", target);
  4010. }
  4011. function registerKeepAliveHook(hook, type, target = currentInstance) {
  4012. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  4013. let current = target;
  4014. while (current) {
  4015. if (current.isDeactivated) {
  4016. return;
  4017. }
  4018. current = current.parent;
  4019. }
  4020. return hook();
  4021. });
  4022. injectHook(type, wrappedHook, target);
  4023. if (target) {
  4024. let current = target.parent;
  4025. while (current && current.parent) {
  4026. if (isKeepAlive(current.parent.vnode)) {
  4027. injectToKeepAliveRoot(wrappedHook, type, target, current);
  4028. }
  4029. current = current.parent;
  4030. }
  4031. }
  4032. }
  4033. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  4034. const injected = injectHook(
  4035. type,
  4036. hook,
  4037. keepAliveRoot,
  4038. true
  4039. /* prepend */
  4040. );
  4041. onUnmounted(() => {
  4042. remove(keepAliveRoot[type], injected);
  4043. }, target);
  4044. }
  4045. function resetShapeFlag(vnode) {
  4046. vnode.shapeFlag &= ~256;
  4047. vnode.shapeFlag &= ~512;
  4048. }
  4049. function getInnerChild(vnode) {
  4050. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  4051. }
  4052. function injectHook(type, hook, target = currentInstance, prepend = false) {
  4053. if (target) {
  4054. const hooks = target[type] || (target[type] = []);
  4055. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  4056. if (target.isUnmounted) {
  4057. return;
  4058. }
  4059. pauseTracking();
  4060. setCurrentInstance(target);
  4061. const res = callWithAsyncErrorHandling(hook, target, type, args);
  4062. unsetCurrentInstance();
  4063. resetTracking();
  4064. return res;
  4065. });
  4066. if (prepend) {
  4067. hooks.unshift(wrappedHook);
  4068. } else {
  4069. hooks.push(wrappedHook);
  4070. }
  4071. return wrappedHook;
  4072. } else {
  4073. const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
  4074. warn(
  4075. `${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.` )
  4076. );
  4077. }
  4078. }
  4079. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  4080. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  4081. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  4082. );
  4083. const onBeforeMount = createHook("bm");
  4084. const onMounted = createHook("m");
  4085. const onBeforeUpdate = createHook("bu");
  4086. const onUpdated = createHook("u");
  4087. const onBeforeUnmount = createHook("bum");
  4088. const onUnmounted = createHook("um");
  4089. const onServerPrefetch = createHook("sp");
  4090. const onRenderTriggered = createHook(
  4091. "rtg"
  4092. );
  4093. const onRenderTracked = createHook(
  4094. "rtc"
  4095. );
  4096. function onErrorCaptured(hook, target = currentInstance) {
  4097. injectHook("ec", hook, target);
  4098. }
  4099. const COMPONENTS = "components";
  4100. const DIRECTIVES = "directives";
  4101. function resolveComponent(name, maybeSelfReference) {
  4102. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  4103. }
  4104. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  4105. function resolveDynamicComponent(component) {
  4106. if (isString(component)) {
  4107. return resolveAsset(COMPONENTS, component, false) || component;
  4108. } else {
  4109. return component || NULL_DYNAMIC_COMPONENT;
  4110. }
  4111. }
  4112. function resolveDirective(name) {
  4113. return resolveAsset(DIRECTIVES, name);
  4114. }
  4115. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  4116. const instance = currentRenderingInstance || currentInstance;
  4117. if (instance) {
  4118. const Component = instance.type;
  4119. if (type === COMPONENTS) {
  4120. const selfName = getComponentName(
  4121. Component,
  4122. false
  4123. /* do not include inferred name to avoid breaking existing code */
  4124. );
  4125. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  4126. return Component;
  4127. }
  4128. }
  4129. const res = (
  4130. // local registration
  4131. // check instance[type] first which is resolved for options API
  4132. resolve(instance[type] || Component[type], name) || // global registration
  4133. resolve(instance.appContext[type], name)
  4134. );
  4135. if (!res && maybeSelfReference) {
  4136. return Component;
  4137. }
  4138. if (warnMissing && !res) {
  4139. const extra = type === COMPONENTS ? `
  4140. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  4141. warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  4142. }
  4143. return res;
  4144. } else {
  4145. warn(
  4146. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  4147. );
  4148. }
  4149. }
  4150. function resolve(registry, name) {
  4151. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  4152. }
  4153. function renderList(source, renderItem, cache, index) {
  4154. let ret;
  4155. const cached = cache && cache[index];
  4156. if (isArray(source) || isString(source)) {
  4157. ret = new Array(source.length);
  4158. for (let i = 0, l = source.length; i < l; i++) {
  4159. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  4160. }
  4161. } else if (typeof source === "number") {
  4162. if (!Number.isInteger(source)) {
  4163. warn(`The v-for range expect an integer value but got ${source}.`);
  4164. }
  4165. ret = new Array(source);
  4166. for (let i = 0; i < source; i++) {
  4167. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  4168. }
  4169. } else if (isObject(source)) {
  4170. if (source[Symbol.iterator]) {
  4171. ret = Array.from(
  4172. source,
  4173. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  4174. );
  4175. } else {
  4176. const keys = Object.keys(source);
  4177. ret = new Array(keys.length);
  4178. for (let i = 0, l = keys.length; i < l; i++) {
  4179. const key = keys[i];
  4180. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  4181. }
  4182. }
  4183. } else {
  4184. ret = [];
  4185. }
  4186. if (cache) {
  4187. cache[index] = ret;
  4188. }
  4189. return ret;
  4190. }
  4191. function createSlots(slots, dynamicSlots) {
  4192. for (let i = 0; i < dynamicSlots.length; i++) {
  4193. const slot = dynamicSlots[i];
  4194. if (isArray(slot)) {
  4195. for (let j = 0; j < slot.length; j++) {
  4196. slots[slot[j].name] = slot[j].fn;
  4197. }
  4198. } else if (slot) {
  4199. slots[slot.name] = slot.key ? (...args) => {
  4200. const res = slot.fn(...args);
  4201. if (res)
  4202. res.key = slot.key;
  4203. return res;
  4204. } : slot.fn;
  4205. }
  4206. }
  4207. return slots;
  4208. }
  4209. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  4210. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  4211. if (name !== "default")
  4212. props.name = name;
  4213. return createVNode("slot", props, fallback && fallback());
  4214. }
  4215. let slot = slots[name];
  4216. if (slot && slot.length > 1) {
  4217. warn(
  4218. `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.`
  4219. );
  4220. slot = () => [];
  4221. }
  4222. if (slot && slot._c) {
  4223. slot._d = false;
  4224. }
  4225. openBlock();
  4226. const validSlotContent = slot && ensureValidVNode(slot(props));
  4227. const rendered = createBlock(
  4228. Fragment,
  4229. {
  4230. key: props.key || // slot content array of a dynamic conditional slot may have a branch
  4231. // key attached in the `createSlots` helper, respect that
  4232. validSlotContent && validSlotContent.key || `_${name}`
  4233. },
  4234. validSlotContent || (fallback ? fallback() : []),
  4235. validSlotContent && slots._ === 1 ? 64 : -2
  4236. );
  4237. if (!noSlotted && rendered.scopeId) {
  4238. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  4239. }
  4240. if (slot && slot._c) {
  4241. slot._d = true;
  4242. }
  4243. return rendered;
  4244. }
  4245. function ensureValidVNode(vnodes) {
  4246. return vnodes.some((child) => {
  4247. if (!isVNode(child))
  4248. return true;
  4249. if (child.type === Comment)
  4250. return false;
  4251. if (child.type === Fragment && !ensureValidVNode(child.children))
  4252. return false;
  4253. return true;
  4254. }) ? vnodes : null;
  4255. }
  4256. function toHandlers(obj, preserveCaseIfNecessary) {
  4257. const ret = {};
  4258. if (!isObject(obj)) {
  4259. warn(`v-on with no argument expects an object value.`);
  4260. return ret;
  4261. }
  4262. for (const key in obj) {
  4263. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  4264. }
  4265. return ret;
  4266. }
  4267. const getPublicInstance = (i) => {
  4268. if (!i)
  4269. return null;
  4270. if (isStatefulComponent(i))
  4271. return getExposeProxy(i) || i.proxy;
  4272. return getPublicInstance(i.parent);
  4273. };
  4274. const publicPropertiesMap = (
  4275. // Move PURE marker to new line to workaround compiler discarding it
  4276. // due to type annotation
  4277. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  4278. $: (i) => i,
  4279. $el: (i) => i.vnode.el,
  4280. $data: (i) => i.data,
  4281. $props: (i) => shallowReadonly(i.props) ,
  4282. $attrs: (i) => shallowReadonly(i.attrs) ,
  4283. $slots: (i) => shallowReadonly(i.slots) ,
  4284. $refs: (i) => shallowReadonly(i.refs) ,
  4285. $parent: (i) => getPublicInstance(i.parent),
  4286. $root: (i) => getPublicInstance(i.root),
  4287. $emit: (i) => i.emit,
  4288. $options: (i) => resolveMergedOptions(i) ,
  4289. $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
  4290. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  4291. $watch: (i) => instanceWatch.bind(i)
  4292. })
  4293. );
  4294. const isReservedPrefix = (key) => key === "_" || key === "$";
  4295. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  4296. const PublicInstanceProxyHandlers = {
  4297. get({ _: instance }, key) {
  4298. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  4299. if (key === "__isVue") {
  4300. return true;
  4301. }
  4302. let normalizedProps;
  4303. if (key[0] !== "$") {
  4304. const n = accessCache[key];
  4305. if (n !== void 0) {
  4306. switch (n) {
  4307. case 1 /* SETUP */:
  4308. return setupState[key];
  4309. case 2 /* DATA */:
  4310. return data[key];
  4311. case 4 /* CONTEXT */:
  4312. return ctx[key];
  4313. case 3 /* PROPS */:
  4314. return props[key];
  4315. }
  4316. } else if (hasSetupBinding(setupState, key)) {
  4317. accessCache[key] = 1 /* SETUP */;
  4318. return setupState[key];
  4319. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4320. accessCache[key] = 2 /* DATA */;
  4321. return data[key];
  4322. } else if (
  4323. // only cache other properties when instance has declared (thus stable)
  4324. // props
  4325. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  4326. ) {
  4327. accessCache[key] = 3 /* PROPS */;
  4328. return props[key];
  4329. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4330. accessCache[key] = 4 /* CONTEXT */;
  4331. return ctx[key];
  4332. } else if (shouldCacheAccess) {
  4333. accessCache[key] = 0 /* OTHER */;
  4334. }
  4335. }
  4336. const publicGetter = publicPropertiesMap[key];
  4337. let cssModule, globalProperties;
  4338. if (publicGetter) {
  4339. if (key === "$attrs") {
  4340. track(instance, "get", key);
  4341. markAttrsAccessed();
  4342. } else if (key === "$slots") {
  4343. track(instance, "get", key);
  4344. }
  4345. return publicGetter(instance);
  4346. } else if (
  4347. // css module (injected by vue-loader)
  4348. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  4349. ) {
  4350. return cssModule;
  4351. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4352. accessCache[key] = 4 /* CONTEXT */;
  4353. return ctx[key];
  4354. } else if (
  4355. // global properties
  4356. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  4357. ) {
  4358. {
  4359. return globalProperties[key];
  4360. }
  4361. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  4362. // to infinite warning loop
  4363. key.indexOf("__v") !== 0)) {
  4364. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  4365. warn(
  4366. `Property ${JSON.stringify(
  4367. key
  4368. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  4369. );
  4370. } else if (instance === currentRenderingInstance) {
  4371. warn(
  4372. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  4373. );
  4374. }
  4375. }
  4376. },
  4377. set({ _: instance }, key, value) {
  4378. const { data, setupState, ctx } = instance;
  4379. if (hasSetupBinding(setupState, key)) {
  4380. setupState[key] = value;
  4381. return true;
  4382. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  4383. warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  4384. return false;
  4385. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4386. data[key] = value;
  4387. return true;
  4388. } else if (hasOwn(instance.props, key)) {
  4389. warn(`Attempting to mutate prop "${key}". Props are readonly.`);
  4390. return false;
  4391. }
  4392. if (key[0] === "$" && key.slice(1) in instance) {
  4393. warn(
  4394. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  4395. );
  4396. return false;
  4397. } else {
  4398. if (key in instance.appContext.config.globalProperties) {
  4399. Object.defineProperty(ctx, key, {
  4400. enumerable: true,
  4401. configurable: true,
  4402. value
  4403. });
  4404. } else {
  4405. ctx[key] = value;
  4406. }
  4407. }
  4408. return true;
  4409. },
  4410. has({
  4411. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  4412. }, key) {
  4413. let normalizedProps;
  4414. 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);
  4415. },
  4416. defineProperty(target, key, descriptor) {
  4417. if (descriptor.get != null) {
  4418. target._.accessCache[key] = 0;
  4419. } else if (hasOwn(descriptor, "value")) {
  4420. this.set(target, key, descriptor.value, null);
  4421. }
  4422. return Reflect.defineProperty(target, key, descriptor);
  4423. }
  4424. };
  4425. {
  4426. PublicInstanceProxyHandlers.ownKeys = (target) => {
  4427. warn(
  4428. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  4429. );
  4430. return Reflect.ownKeys(target);
  4431. };
  4432. }
  4433. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
  4434. {},
  4435. PublicInstanceProxyHandlers,
  4436. {
  4437. get(target, key) {
  4438. if (key === Symbol.unscopables) {
  4439. return;
  4440. }
  4441. return PublicInstanceProxyHandlers.get(target, key, target);
  4442. },
  4443. has(_, key) {
  4444. const has = key[0] !== "_" && !isGloballyWhitelisted(key);
  4445. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  4446. warn(
  4447. `Property ${JSON.stringify(
  4448. key
  4449. )} should not start with _ which is a reserved prefix for Vue internals.`
  4450. );
  4451. }
  4452. return has;
  4453. }
  4454. }
  4455. );
  4456. function createDevRenderContext(instance) {
  4457. const target = {};
  4458. Object.defineProperty(target, `_`, {
  4459. configurable: true,
  4460. enumerable: false,
  4461. get: () => instance
  4462. });
  4463. Object.keys(publicPropertiesMap).forEach((key) => {
  4464. Object.defineProperty(target, key, {
  4465. configurable: true,
  4466. enumerable: false,
  4467. get: () => publicPropertiesMap[key](instance),
  4468. // intercepted by the proxy so no need for implementation,
  4469. // but needed to prevent set errors
  4470. set: NOOP
  4471. });
  4472. });
  4473. return target;
  4474. }
  4475. function exposePropsOnRenderContext(instance) {
  4476. const {
  4477. ctx,
  4478. propsOptions: [propsOptions]
  4479. } = instance;
  4480. if (propsOptions) {
  4481. Object.keys(propsOptions).forEach((key) => {
  4482. Object.defineProperty(ctx, key, {
  4483. enumerable: true,
  4484. configurable: true,
  4485. get: () => instance.props[key],
  4486. set: NOOP
  4487. });
  4488. });
  4489. }
  4490. }
  4491. function exposeSetupStateOnRenderContext(instance) {
  4492. const { ctx, setupState } = instance;
  4493. Object.keys(toRaw(setupState)).forEach((key) => {
  4494. if (!setupState.__isScriptSetup) {
  4495. if (isReservedPrefix(key[0])) {
  4496. warn(
  4497. `setup() return property ${JSON.stringify(
  4498. key
  4499. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  4500. );
  4501. return;
  4502. }
  4503. Object.defineProperty(ctx, key, {
  4504. enumerable: true,
  4505. configurable: true,
  4506. get: () => setupState[key],
  4507. set: NOOP
  4508. });
  4509. }
  4510. });
  4511. }
  4512. const warnRuntimeUsage = (method) => warn(
  4513. `${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.`
  4514. );
  4515. function defineProps() {
  4516. {
  4517. warnRuntimeUsage(`defineProps`);
  4518. }
  4519. return null;
  4520. }
  4521. function defineEmits() {
  4522. {
  4523. warnRuntimeUsage(`defineEmits`);
  4524. }
  4525. return null;
  4526. }
  4527. function defineExpose(exposed) {
  4528. {
  4529. warnRuntimeUsage(`defineExpose`);
  4530. }
  4531. }
  4532. function defineOptions(options) {
  4533. {
  4534. warnRuntimeUsage(`defineOptions`);
  4535. }
  4536. }
  4537. function defineSlots() {
  4538. {
  4539. warnRuntimeUsage(`defineSlots`);
  4540. }
  4541. return null;
  4542. }
  4543. function defineModel() {
  4544. {
  4545. warnRuntimeUsage("defineModel");
  4546. }
  4547. }
  4548. function withDefaults(props, defaults) {
  4549. {
  4550. warnRuntimeUsage(`withDefaults`);
  4551. }
  4552. return null;
  4553. }
  4554. function useSlots() {
  4555. return getContext().slots;
  4556. }
  4557. function useAttrs() {
  4558. return getContext().attrs;
  4559. }
  4560. function useModel(props, name, options) {
  4561. const i = getCurrentInstance();
  4562. if (!i) {
  4563. warn(`useModel() called without active instance.`);
  4564. return ref();
  4565. }
  4566. if (!i.propsOptions[0][name]) {
  4567. warn(`useModel() called with prop "${name}" which is not declared.`);
  4568. return ref();
  4569. }
  4570. if (options && options.local) {
  4571. const proxy = ref(props[name]);
  4572. watch(
  4573. () => props[name],
  4574. (v) => proxy.value = v
  4575. );
  4576. watch(proxy, (value) => {
  4577. if (value !== props[name]) {
  4578. i.emit(`update:${name}`, value);
  4579. }
  4580. });
  4581. return proxy;
  4582. } else {
  4583. return {
  4584. __v_isRef: true,
  4585. get value() {
  4586. return props[name];
  4587. },
  4588. set value(value) {
  4589. i.emit(`update:${name}`, value);
  4590. }
  4591. };
  4592. }
  4593. }
  4594. function getContext() {
  4595. const i = getCurrentInstance();
  4596. if (!i) {
  4597. warn(`useContext() called without active instance.`);
  4598. }
  4599. return i.setupContext || (i.setupContext = createSetupContext(i));
  4600. }
  4601. function normalizePropsOrEmits(props) {
  4602. return isArray(props) ? props.reduce(
  4603. (normalized, p) => (normalized[p] = null, normalized),
  4604. {}
  4605. ) : props;
  4606. }
  4607. function mergeDefaults(raw, defaults) {
  4608. const props = normalizePropsOrEmits(raw);
  4609. for (const key in defaults) {
  4610. if (key.startsWith("__skip"))
  4611. continue;
  4612. let opt = props[key];
  4613. if (opt) {
  4614. if (isArray(opt) || isFunction(opt)) {
  4615. opt = props[key] = { type: opt, default: defaults[key] };
  4616. } else {
  4617. opt.default = defaults[key];
  4618. }
  4619. } else if (opt === null) {
  4620. opt = props[key] = { default: defaults[key] };
  4621. } else {
  4622. warn(`props default key "${key}" has no corresponding declaration.`);
  4623. }
  4624. if (opt && defaults[`__skip_${key}`]) {
  4625. opt.skipFactory = true;
  4626. }
  4627. }
  4628. return props;
  4629. }
  4630. function mergeModels(a, b) {
  4631. if (!a || !b)
  4632. return a || b;
  4633. if (isArray(a) && isArray(b))
  4634. return a.concat(b);
  4635. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  4636. }
  4637. function createPropsRestProxy(props, excludedKeys) {
  4638. const ret = {};
  4639. for (const key in props) {
  4640. if (!excludedKeys.includes(key)) {
  4641. Object.defineProperty(ret, key, {
  4642. enumerable: true,
  4643. get: () => props[key]
  4644. });
  4645. }
  4646. }
  4647. return ret;
  4648. }
  4649. function withAsyncContext(getAwaitable) {
  4650. const ctx = getCurrentInstance();
  4651. if (!ctx) {
  4652. warn(
  4653. `withAsyncContext called without active current instance. This is likely a bug.`
  4654. );
  4655. }
  4656. let awaitable = getAwaitable();
  4657. unsetCurrentInstance();
  4658. if (isPromise(awaitable)) {
  4659. awaitable = awaitable.catch((e) => {
  4660. setCurrentInstance(ctx);
  4661. throw e;
  4662. });
  4663. }
  4664. return [awaitable, () => setCurrentInstance(ctx)];
  4665. }
  4666. function createDuplicateChecker() {
  4667. const cache = /* @__PURE__ */ Object.create(null);
  4668. return (type, key) => {
  4669. if (cache[key]) {
  4670. warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
  4671. } else {
  4672. cache[key] = type;
  4673. }
  4674. };
  4675. }
  4676. let shouldCacheAccess = true;
  4677. function applyOptions(instance) {
  4678. const options = resolveMergedOptions(instance);
  4679. const publicThis = instance.proxy;
  4680. const ctx = instance.ctx;
  4681. shouldCacheAccess = false;
  4682. if (options.beforeCreate) {
  4683. callHook$1(options.beforeCreate, instance, "bc");
  4684. }
  4685. const {
  4686. // state
  4687. data: dataOptions,
  4688. computed: computedOptions,
  4689. methods,
  4690. watch: watchOptions,
  4691. provide: provideOptions,
  4692. inject: injectOptions,
  4693. // lifecycle
  4694. created,
  4695. beforeMount,
  4696. mounted,
  4697. beforeUpdate,
  4698. updated,
  4699. activated,
  4700. deactivated,
  4701. beforeDestroy,
  4702. beforeUnmount,
  4703. destroyed,
  4704. unmounted,
  4705. render,
  4706. renderTracked,
  4707. renderTriggered,
  4708. errorCaptured,
  4709. serverPrefetch,
  4710. // public API
  4711. expose,
  4712. inheritAttrs,
  4713. // assets
  4714. components,
  4715. directives,
  4716. filters
  4717. } = options;
  4718. const checkDuplicateProperties = createDuplicateChecker() ;
  4719. {
  4720. const [propsOptions] = instance.propsOptions;
  4721. if (propsOptions) {
  4722. for (const key in propsOptions) {
  4723. checkDuplicateProperties("Props" /* PROPS */, key);
  4724. }
  4725. }
  4726. }
  4727. if (injectOptions) {
  4728. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  4729. }
  4730. if (methods) {
  4731. for (const key in methods) {
  4732. const methodHandler = methods[key];
  4733. if (isFunction(methodHandler)) {
  4734. {
  4735. Object.defineProperty(ctx, key, {
  4736. value: methodHandler.bind(publicThis),
  4737. configurable: true,
  4738. enumerable: true,
  4739. writable: true
  4740. });
  4741. }
  4742. {
  4743. checkDuplicateProperties("Methods" /* METHODS */, key);
  4744. }
  4745. } else {
  4746. warn(
  4747. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  4748. );
  4749. }
  4750. }
  4751. }
  4752. if (dataOptions) {
  4753. if (!isFunction(dataOptions)) {
  4754. warn(
  4755. `The data option must be a function. Plain object usage is no longer supported.`
  4756. );
  4757. }
  4758. const data = dataOptions.call(publicThis, publicThis);
  4759. if (isPromise(data)) {
  4760. warn(
  4761. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  4762. );
  4763. }
  4764. if (!isObject(data)) {
  4765. warn(`data() should return an object.`);
  4766. } else {
  4767. instance.data = reactive(data);
  4768. {
  4769. for (const key in data) {
  4770. checkDuplicateProperties("Data" /* DATA */, key);
  4771. if (!isReservedPrefix(key[0])) {
  4772. Object.defineProperty(ctx, key, {
  4773. configurable: true,
  4774. enumerable: true,
  4775. get: () => data[key],
  4776. set: NOOP
  4777. });
  4778. }
  4779. }
  4780. }
  4781. }
  4782. }
  4783. shouldCacheAccess = true;
  4784. if (computedOptions) {
  4785. for (const key in computedOptions) {
  4786. const opt = computedOptions[key];
  4787. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  4788. if (get === NOOP) {
  4789. warn(`Computed property "${key}" has no getter.`);
  4790. }
  4791. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  4792. warn(
  4793. `Write operation failed: computed property "${key}" is readonly.`
  4794. );
  4795. } ;
  4796. const c = computed({
  4797. get,
  4798. set
  4799. });
  4800. Object.defineProperty(ctx, key, {
  4801. enumerable: true,
  4802. configurable: true,
  4803. get: () => c.value,
  4804. set: (v) => c.value = v
  4805. });
  4806. {
  4807. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  4808. }
  4809. }
  4810. }
  4811. if (watchOptions) {
  4812. for (const key in watchOptions) {
  4813. createWatcher(watchOptions[key], ctx, publicThis, key);
  4814. }
  4815. }
  4816. if (provideOptions) {
  4817. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  4818. Reflect.ownKeys(provides).forEach((key) => {
  4819. provide(key, provides[key]);
  4820. });
  4821. }
  4822. if (created) {
  4823. callHook$1(created, instance, "c");
  4824. }
  4825. function registerLifecycleHook(register, hook) {
  4826. if (isArray(hook)) {
  4827. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  4828. } else if (hook) {
  4829. register(hook.bind(publicThis));
  4830. }
  4831. }
  4832. registerLifecycleHook(onBeforeMount, beforeMount);
  4833. registerLifecycleHook(onMounted, mounted);
  4834. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  4835. registerLifecycleHook(onUpdated, updated);
  4836. registerLifecycleHook(onActivated, activated);
  4837. registerLifecycleHook(onDeactivated, deactivated);
  4838. registerLifecycleHook(onErrorCaptured, errorCaptured);
  4839. registerLifecycleHook(onRenderTracked, renderTracked);
  4840. registerLifecycleHook(onRenderTriggered, renderTriggered);
  4841. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  4842. registerLifecycleHook(onUnmounted, unmounted);
  4843. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  4844. if (isArray(expose)) {
  4845. if (expose.length) {
  4846. const exposed = instance.exposed || (instance.exposed = {});
  4847. expose.forEach((key) => {
  4848. Object.defineProperty(exposed, key, {
  4849. get: () => publicThis[key],
  4850. set: (val) => publicThis[key] = val
  4851. });
  4852. });
  4853. } else if (!instance.exposed) {
  4854. instance.exposed = {};
  4855. }
  4856. }
  4857. if (render && instance.render === NOOP) {
  4858. instance.render = render;
  4859. }
  4860. if (inheritAttrs != null) {
  4861. instance.inheritAttrs = inheritAttrs;
  4862. }
  4863. if (components)
  4864. instance.components = components;
  4865. if (directives)
  4866. instance.directives = directives;
  4867. }
  4868. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  4869. if (isArray(injectOptions)) {
  4870. injectOptions = normalizeInject(injectOptions);
  4871. }
  4872. for (const key in injectOptions) {
  4873. const opt = injectOptions[key];
  4874. let injected;
  4875. if (isObject(opt)) {
  4876. if ("default" in opt) {
  4877. injected = inject(
  4878. opt.from || key,
  4879. opt.default,
  4880. true
  4881. /* treat default function as factory */
  4882. );
  4883. } else {
  4884. injected = inject(opt.from || key);
  4885. }
  4886. } else {
  4887. injected = inject(opt);
  4888. }
  4889. if (isRef(injected)) {
  4890. Object.defineProperty(ctx, key, {
  4891. enumerable: true,
  4892. configurable: true,
  4893. get: () => injected.value,
  4894. set: (v) => injected.value = v
  4895. });
  4896. } else {
  4897. ctx[key] = injected;
  4898. }
  4899. {
  4900. checkDuplicateProperties("Inject" /* INJECT */, key);
  4901. }
  4902. }
  4903. }
  4904. function callHook$1(hook, instance, type) {
  4905. callWithAsyncErrorHandling(
  4906. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  4907. instance,
  4908. type
  4909. );
  4910. }
  4911. function createWatcher(raw, ctx, publicThis, key) {
  4912. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  4913. if (isString(raw)) {
  4914. const handler = ctx[raw];
  4915. if (isFunction(handler)) {
  4916. watch(getter, handler);
  4917. } else {
  4918. warn(`Invalid watch handler specified by key "${raw}"`, handler);
  4919. }
  4920. } else if (isFunction(raw)) {
  4921. watch(getter, raw.bind(publicThis));
  4922. } else if (isObject(raw)) {
  4923. if (isArray(raw)) {
  4924. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  4925. } else {
  4926. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  4927. if (isFunction(handler)) {
  4928. watch(getter, handler, raw);
  4929. } else {
  4930. warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  4931. }
  4932. }
  4933. } else {
  4934. warn(`Invalid watch option: "${key}"`, raw);
  4935. }
  4936. }
  4937. function resolveMergedOptions(instance) {
  4938. const base = instance.type;
  4939. const { mixins, extends: extendsOptions } = base;
  4940. const {
  4941. mixins: globalMixins,
  4942. optionsCache: cache,
  4943. config: { optionMergeStrategies }
  4944. } = instance.appContext;
  4945. const cached = cache.get(base);
  4946. let resolved;
  4947. if (cached) {
  4948. resolved = cached;
  4949. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  4950. {
  4951. resolved = base;
  4952. }
  4953. } else {
  4954. resolved = {};
  4955. if (globalMixins.length) {
  4956. globalMixins.forEach(
  4957. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  4958. );
  4959. }
  4960. mergeOptions(resolved, base, optionMergeStrategies);
  4961. }
  4962. if (isObject(base)) {
  4963. cache.set(base, resolved);
  4964. }
  4965. return resolved;
  4966. }
  4967. function mergeOptions(to, from, strats, asMixin = false) {
  4968. const { mixins, extends: extendsOptions } = from;
  4969. if (extendsOptions) {
  4970. mergeOptions(to, extendsOptions, strats, true);
  4971. }
  4972. if (mixins) {
  4973. mixins.forEach(
  4974. (m) => mergeOptions(to, m, strats, true)
  4975. );
  4976. }
  4977. for (const key in from) {
  4978. if (asMixin && key === "expose") {
  4979. warn(
  4980. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  4981. );
  4982. } else {
  4983. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  4984. to[key] = strat ? strat(to[key], from[key]) : from[key];
  4985. }
  4986. }
  4987. return to;
  4988. }
  4989. const internalOptionMergeStrats = {
  4990. data: mergeDataFn,
  4991. props: mergeEmitsOrPropsOptions,
  4992. emits: mergeEmitsOrPropsOptions,
  4993. // objects
  4994. methods: mergeObjectOptions,
  4995. computed: mergeObjectOptions,
  4996. // lifecycle
  4997. beforeCreate: mergeAsArray$1,
  4998. created: mergeAsArray$1,
  4999. beforeMount: mergeAsArray$1,
  5000. mounted: mergeAsArray$1,
  5001. beforeUpdate: mergeAsArray$1,
  5002. updated: mergeAsArray$1,
  5003. beforeDestroy: mergeAsArray$1,
  5004. beforeUnmount: mergeAsArray$1,
  5005. destroyed: mergeAsArray$1,
  5006. unmounted: mergeAsArray$1,
  5007. activated: mergeAsArray$1,
  5008. deactivated: mergeAsArray$1,
  5009. errorCaptured: mergeAsArray$1,
  5010. serverPrefetch: mergeAsArray$1,
  5011. // assets
  5012. components: mergeObjectOptions,
  5013. directives: mergeObjectOptions,
  5014. // watch
  5015. watch: mergeWatchOptions,
  5016. // provide / inject
  5017. provide: mergeDataFn,
  5018. inject: mergeInject
  5019. };
  5020. function mergeDataFn(to, from) {
  5021. if (!from) {
  5022. return to;
  5023. }
  5024. if (!to) {
  5025. return from;
  5026. }
  5027. return function mergedDataFn() {
  5028. return (extend)(
  5029. isFunction(to) ? to.call(this, this) : to,
  5030. isFunction(from) ? from.call(this, this) : from
  5031. );
  5032. };
  5033. }
  5034. function mergeInject(to, from) {
  5035. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  5036. }
  5037. function normalizeInject(raw) {
  5038. if (isArray(raw)) {
  5039. const res = {};
  5040. for (let i = 0; i < raw.length; i++) {
  5041. res[raw[i]] = raw[i];
  5042. }
  5043. return res;
  5044. }
  5045. return raw;
  5046. }
  5047. function mergeAsArray$1(to, from) {
  5048. return to ? [...new Set([].concat(to, from))] : from;
  5049. }
  5050. function mergeObjectOptions(to, from) {
  5051. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  5052. }
  5053. function mergeEmitsOrPropsOptions(to, from) {
  5054. if (to) {
  5055. if (isArray(to) && isArray(from)) {
  5056. return [.../* @__PURE__ */ new Set([...to, ...from])];
  5057. }
  5058. return extend(
  5059. /* @__PURE__ */ Object.create(null),
  5060. normalizePropsOrEmits(to),
  5061. normalizePropsOrEmits(from != null ? from : {})
  5062. );
  5063. } else {
  5064. return from;
  5065. }
  5066. }
  5067. function mergeWatchOptions(to, from) {
  5068. if (!to)
  5069. return from;
  5070. if (!from)
  5071. return to;
  5072. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  5073. for (const key in from) {
  5074. merged[key] = mergeAsArray$1(to[key], from[key]);
  5075. }
  5076. return merged;
  5077. }
  5078. function createAppContext() {
  5079. return {
  5080. app: null,
  5081. config: {
  5082. isNativeTag: NO,
  5083. performance: false,
  5084. globalProperties: {},
  5085. optionMergeStrategies: {},
  5086. errorHandler: void 0,
  5087. warnHandler: void 0,
  5088. compilerOptions: {}
  5089. },
  5090. mixins: [],
  5091. components: {},
  5092. directives: {},
  5093. provides: /* @__PURE__ */ Object.create(null),
  5094. optionsCache: /* @__PURE__ */ new WeakMap(),
  5095. propsCache: /* @__PURE__ */ new WeakMap(),
  5096. emitsCache: /* @__PURE__ */ new WeakMap()
  5097. };
  5098. }
  5099. let uid$1 = 0;
  5100. function createAppAPI(render, hydrate) {
  5101. return function createApp(rootComponent, rootProps = null) {
  5102. if (!isFunction(rootComponent)) {
  5103. rootComponent = extend({}, rootComponent);
  5104. }
  5105. if (rootProps != null && !isObject(rootProps)) {
  5106. warn(`root props passed to app.mount() must be an object.`);
  5107. rootProps = null;
  5108. }
  5109. const context = createAppContext();
  5110. {
  5111. Object.defineProperty(context.config, "unwrapInjectedRef", {
  5112. get() {
  5113. return true;
  5114. },
  5115. set() {
  5116. warn(
  5117. `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
  5118. );
  5119. }
  5120. });
  5121. }
  5122. const installedPlugins = /* @__PURE__ */ new Set();
  5123. let isMounted = false;
  5124. const app = context.app = {
  5125. _uid: uid$1++,
  5126. _component: rootComponent,
  5127. _props: rootProps,
  5128. _container: null,
  5129. _context: context,
  5130. _instance: null,
  5131. version,
  5132. get config() {
  5133. return context.config;
  5134. },
  5135. set config(v) {
  5136. {
  5137. warn(
  5138. `app.config cannot be replaced. Modify individual options instead.`
  5139. );
  5140. }
  5141. },
  5142. use(plugin, ...options) {
  5143. if (installedPlugins.has(plugin)) {
  5144. warn(`Plugin has already been applied to target app.`);
  5145. } else if (plugin && isFunction(plugin.install)) {
  5146. installedPlugins.add(plugin);
  5147. plugin.install(app, ...options);
  5148. } else if (isFunction(plugin)) {
  5149. installedPlugins.add(plugin);
  5150. plugin(app, ...options);
  5151. } else {
  5152. warn(
  5153. `A plugin must either be a function or an object with an "install" function.`
  5154. );
  5155. }
  5156. return app;
  5157. },
  5158. mixin(mixin) {
  5159. {
  5160. if (!context.mixins.includes(mixin)) {
  5161. context.mixins.push(mixin);
  5162. } else {
  5163. warn(
  5164. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  5165. );
  5166. }
  5167. }
  5168. return app;
  5169. },
  5170. component(name, component) {
  5171. {
  5172. validateComponentName(name, context.config);
  5173. }
  5174. if (!component) {
  5175. return context.components[name];
  5176. }
  5177. if (context.components[name]) {
  5178. warn(`Component "${name}" has already been registered in target app.`);
  5179. }
  5180. context.components[name] = component;
  5181. return app;
  5182. },
  5183. directive(name, directive) {
  5184. {
  5185. validateDirectiveName(name);
  5186. }
  5187. if (!directive) {
  5188. return context.directives[name];
  5189. }
  5190. if (context.directives[name]) {
  5191. warn(`Directive "${name}" has already been registered in target app.`);
  5192. }
  5193. context.directives[name] = directive;
  5194. return app;
  5195. },
  5196. mount(rootContainer, isHydrate, isSVG) {
  5197. if (!isMounted) {
  5198. if (rootContainer.__vue_app__) {
  5199. warn(
  5200. `There is already an app instance mounted on the host container.
  5201. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  5202. );
  5203. }
  5204. const vnode = createVNode(
  5205. rootComponent,
  5206. rootProps
  5207. );
  5208. vnode.appContext = context;
  5209. {
  5210. context.reload = () => {
  5211. render(cloneVNode(vnode), rootContainer, isSVG);
  5212. };
  5213. }
  5214. if (isHydrate && hydrate) {
  5215. hydrate(vnode, rootContainer);
  5216. } else {
  5217. render(vnode, rootContainer, isSVG);
  5218. }
  5219. isMounted = true;
  5220. app._container = rootContainer;
  5221. rootContainer.__vue_app__ = app;
  5222. {
  5223. app._instance = vnode.component;
  5224. devtoolsInitApp(app, version);
  5225. }
  5226. return getExposeProxy(vnode.component) || vnode.component.proxy;
  5227. } else {
  5228. warn(
  5229. `App has already been mounted.
  5230. 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)\``
  5231. );
  5232. }
  5233. },
  5234. unmount() {
  5235. if (isMounted) {
  5236. render(null, app._container);
  5237. {
  5238. app._instance = null;
  5239. devtoolsUnmountApp(app);
  5240. }
  5241. delete app._container.__vue_app__;
  5242. } else {
  5243. warn(`Cannot unmount an app that is not mounted.`);
  5244. }
  5245. },
  5246. provide(key, value) {
  5247. if (key in context.provides) {
  5248. warn(
  5249. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  5250. );
  5251. }
  5252. context.provides[key] = value;
  5253. return app;
  5254. },
  5255. runWithContext(fn) {
  5256. currentApp = app;
  5257. try {
  5258. return fn();
  5259. } finally {
  5260. currentApp = null;
  5261. }
  5262. }
  5263. };
  5264. return app;
  5265. };
  5266. }
  5267. let currentApp = null;
  5268. function provide(key, value) {
  5269. if (!currentInstance) {
  5270. {
  5271. warn(`provide() can only be used inside setup().`);
  5272. }
  5273. } else {
  5274. let provides = currentInstance.provides;
  5275. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  5276. if (parentProvides === provides) {
  5277. provides = currentInstance.provides = Object.create(parentProvides);
  5278. }
  5279. provides[key] = value;
  5280. }
  5281. }
  5282. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  5283. const instance = currentInstance || currentRenderingInstance;
  5284. if (instance || currentApp) {
  5285. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  5286. if (provides && key in provides) {
  5287. return provides[key];
  5288. } else if (arguments.length > 1) {
  5289. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  5290. } else {
  5291. warn(`injection "${String(key)}" not found.`);
  5292. }
  5293. } else {
  5294. warn(`inject() can only be used inside setup() or functional components.`);
  5295. }
  5296. }
  5297. function hasInjectionContext() {
  5298. return !!(currentInstance || currentRenderingInstance || currentApp);
  5299. }
  5300. function initProps(instance, rawProps, isStateful, isSSR = false) {
  5301. const props = {};
  5302. const attrs = {};
  5303. def(attrs, InternalObjectKey, 1);
  5304. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  5305. setFullProps(instance, rawProps, props, attrs);
  5306. for (const key in instance.propsOptions[0]) {
  5307. if (!(key in props)) {
  5308. props[key] = void 0;
  5309. }
  5310. }
  5311. {
  5312. validateProps(rawProps || {}, props, instance);
  5313. }
  5314. if (isStateful) {
  5315. instance.props = isSSR ? props : shallowReactive(props);
  5316. } else {
  5317. if (!instance.type.props) {
  5318. instance.props = attrs;
  5319. } else {
  5320. instance.props = props;
  5321. }
  5322. }
  5323. instance.attrs = attrs;
  5324. }
  5325. function isInHmrContext(instance) {
  5326. while (instance) {
  5327. if (instance.type.__hmrId)
  5328. return true;
  5329. instance = instance.parent;
  5330. }
  5331. }
  5332. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  5333. const {
  5334. props,
  5335. attrs,
  5336. vnode: { patchFlag }
  5337. } = instance;
  5338. const rawCurrentProps = toRaw(props);
  5339. const [options] = instance.propsOptions;
  5340. let hasAttrsChanged = false;
  5341. if (
  5342. // always force full diff in dev
  5343. // - #1942 if hmr is enabled with sfc component
  5344. // - vite#872 non-sfc component used by sfc component
  5345. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  5346. ) {
  5347. if (patchFlag & 8) {
  5348. const propsToUpdate = instance.vnode.dynamicProps;
  5349. for (let i = 0; i < propsToUpdate.length; i++) {
  5350. let key = propsToUpdate[i];
  5351. if (isEmitListener(instance.emitsOptions, key)) {
  5352. continue;
  5353. }
  5354. const value = rawProps[key];
  5355. if (options) {
  5356. if (hasOwn(attrs, key)) {
  5357. if (value !== attrs[key]) {
  5358. attrs[key] = value;
  5359. hasAttrsChanged = true;
  5360. }
  5361. } else {
  5362. const camelizedKey = camelize(key);
  5363. props[camelizedKey] = resolvePropValue(
  5364. options,
  5365. rawCurrentProps,
  5366. camelizedKey,
  5367. value,
  5368. instance,
  5369. false
  5370. /* isAbsent */
  5371. );
  5372. }
  5373. } else {
  5374. if (value !== attrs[key]) {
  5375. attrs[key] = value;
  5376. hasAttrsChanged = true;
  5377. }
  5378. }
  5379. }
  5380. }
  5381. } else {
  5382. if (setFullProps(instance, rawProps, props, attrs)) {
  5383. hasAttrsChanged = true;
  5384. }
  5385. let kebabKey;
  5386. for (const key in rawCurrentProps) {
  5387. if (!rawProps || // for camelCase
  5388. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  5389. // and converted to camelCase (#955)
  5390. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  5391. if (options) {
  5392. if (rawPrevProps && // for camelCase
  5393. (rawPrevProps[key] !== void 0 || // for kebab-case
  5394. rawPrevProps[kebabKey] !== void 0)) {
  5395. props[key] = resolvePropValue(
  5396. options,
  5397. rawCurrentProps,
  5398. key,
  5399. void 0,
  5400. instance,
  5401. true
  5402. /* isAbsent */
  5403. );
  5404. }
  5405. } else {
  5406. delete props[key];
  5407. }
  5408. }
  5409. }
  5410. if (attrs !== rawCurrentProps) {
  5411. for (const key in attrs) {
  5412. if (!rawProps || !hasOwn(rawProps, key) && true) {
  5413. delete attrs[key];
  5414. hasAttrsChanged = true;
  5415. }
  5416. }
  5417. }
  5418. }
  5419. if (hasAttrsChanged) {
  5420. trigger(instance, "set", "$attrs");
  5421. }
  5422. {
  5423. validateProps(rawProps || {}, props, instance);
  5424. }
  5425. }
  5426. function setFullProps(instance, rawProps, props, attrs) {
  5427. const [options, needCastKeys] = instance.propsOptions;
  5428. let hasAttrsChanged = false;
  5429. let rawCastValues;
  5430. if (rawProps) {
  5431. for (let key in rawProps) {
  5432. if (isReservedProp(key)) {
  5433. continue;
  5434. }
  5435. const value = rawProps[key];
  5436. let camelKey;
  5437. if (options && hasOwn(options, camelKey = camelize(key))) {
  5438. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  5439. props[camelKey] = value;
  5440. } else {
  5441. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  5442. }
  5443. } else if (!isEmitListener(instance.emitsOptions, key)) {
  5444. if (!(key in attrs) || value !== attrs[key]) {
  5445. attrs[key] = value;
  5446. hasAttrsChanged = true;
  5447. }
  5448. }
  5449. }
  5450. }
  5451. if (needCastKeys) {
  5452. const rawCurrentProps = toRaw(props);
  5453. const castValues = rawCastValues || EMPTY_OBJ;
  5454. for (let i = 0; i < needCastKeys.length; i++) {
  5455. const key = needCastKeys[i];
  5456. props[key] = resolvePropValue(
  5457. options,
  5458. rawCurrentProps,
  5459. key,
  5460. castValues[key],
  5461. instance,
  5462. !hasOwn(castValues, key)
  5463. );
  5464. }
  5465. }
  5466. return hasAttrsChanged;
  5467. }
  5468. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  5469. const opt = options[key];
  5470. if (opt != null) {
  5471. const hasDefault = hasOwn(opt, "default");
  5472. if (hasDefault && value === void 0) {
  5473. const defaultValue = opt.default;
  5474. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  5475. const { propsDefaults } = instance;
  5476. if (key in propsDefaults) {
  5477. value = propsDefaults[key];
  5478. } else {
  5479. setCurrentInstance(instance);
  5480. value = propsDefaults[key] = defaultValue.call(
  5481. null,
  5482. props
  5483. );
  5484. unsetCurrentInstance();
  5485. }
  5486. } else {
  5487. value = defaultValue;
  5488. }
  5489. }
  5490. if (opt[0 /* shouldCast */]) {
  5491. if (isAbsent && !hasDefault) {
  5492. value = false;
  5493. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  5494. value = true;
  5495. }
  5496. }
  5497. }
  5498. return value;
  5499. }
  5500. function normalizePropsOptions(comp, appContext, asMixin = false) {
  5501. const cache = appContext.propsCache;
  5502. const cached = cache.get(comp);
  5503. if (cached) {
  5504. return cached;
  5505. }
  5506. const raw = comp.props;
  5507. const normalized = {};
  5508. const needCastKeys = [];
  5509. let hasExtends = false;
  5510. if (!isFunction(comp)) {
  5511. const extendProps = (raw2) => {
  5512. hasExtends = true;
  5513. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  5514. extend(normalized, props);
  5515. if (keys)
  5516. needCastKeys.push(...keys);
  5517. };
  5518. if (!asMixin && appContext.mixins.length) {
  5519. appContext.mixins.forEach(extendProps);
  5520. }
  5521. if (comp.extends) {
  5522. extendProps(comp.extends);
  5523. }
  5524. if (comp.mixins) {
  5525. comp.mixins.forEach(extendProps);
  5526. }
  5527. }
  5528. if (!raw && !hasExtends) {
  5529. if (isObject(comp)) {
  5530. cache.set(comp, EMPTY_ARR);
  5531. }
  5532. return EMPTY_ARR;
  5533. }
  5534. if (isArray(raw)) {
  5535. for (let i = 0; i < raw.length; i++) {
  5536. if (!isString(raw[i])) {
  5537. warn(`props must be strings when using array syntax.`, raw[i]);
  5538. }
  5539. const normalizedKey = camelize(raw[i]);
  5540. if (validatePropName(normalizedKey)) {
  5541. normalized[normalizedKey] = EMPTY_OBJ;
  5542. }
  5543. }
  5544. } else if (raw) {
  5545. if (!isObject(raw)) {
  5546. warn(`invalid props options`, raw);
  5547. }
  5548. for (const key in raw) {
  5549. const normalizedKey = camelize(key);
  5550. if (validatePropName(normalizedKey)) {
  5551. const opt = raw[key];
  5552. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  5553. if (prop) {
  5554. const booleanIndex = getTypeIndex(Boolean, prop.type);
  5555. const stringIndex = getTypeIndex(String, prop.type);
  5556. prop[0 /* shouldCast */] = booleanIndex > -1;
  5557. prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  5558. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  5559. needCastKeys.push(normalizedKey);
  5560. }
  5561. }
  5562. }
  5563. }
  5564. }
  5565. const res = [normalized, needCastKeys];
  5566. if (isObject(comp)) {
  5567. cache.set(comp, res);
  5568. }
  5569. return res;
  5570. }
  5571. function validatePropName(key) {
  5572. if (key[0] !== "$") {
  5573. return true;
  5574. } else {
  5575. warn(`Invalid prop name: "${key}" is a reserved property.`);
  5576. }
  5577. return false;
  5578. }
  5579. function getType(ctor) {
  5580. const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  5581. return match ? match[2] : ctor === null ? "null" : "";
  5582. }
  5583. function isSameType(a, b) {
  5584. return getType(a) === getType(b);
  5585. }
  5586. function getTypeIndex(type, expectedTypes) {
  5587. if (isArray(expectedTypes)) {
  5588. return expectedTypes.findIndex((t) => isSameType(t, type));
  5589. } else if (isFunction(expectedTypes)) {
  5590. return isSameType(expectedTypes, type) ? 0 : -1;
  5591. }
  5592. return -1;
  5593. }
  5594. function validateProps(rawProps, props, instance) {
  5595. const resolvedValues = toRaw(props);
  5596. const options = instance.propsOptions[0];
  5597. for (const key in options) {
  5598. let opt = options[key];
  5599. if (opt == null)
  5600. continue;
  5601. validateProp(
  5602. key,
  5603. resolvedValues[key],
  5604. opt,
  5605. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  5606. );
  5607. }
  5608. }
  5609. function validateProp(name, value, prop, isAbsent) {
  5610. const { type, required, validator, skipCheck } = prop;
  5611. if (required && isAbsent) {
  5612. warn('Missing required prop: "' + name + '"');
  5613. return;
  5614. }
  5615. if (value == null && !required) {
  5616. return;
  5617. }
  5618. if (type != null && type !== true && !skipCheck) {
  5619. let isValid = false;
  5620. const types = isArray(type) ? type : [type];
  5621. const expectedTypes = [];
  5622. for (let i = 0; i < types.length && !isValid; i++) {
  5623. const { valid, expectedType } = assertType(value, types[i]);
  5624. expectedTypes.push(expectedType || "");
  5625. isValid = valid;
  5626. }
  5627. if (!isValid) {
  5628. warn(getInvalidTypeMessage(name, value, expectedTypes));
  5629. return;
  5630. }
  5631. }
  5632. if (validator && !validator(value)) {
  5633. warn('Invalid prop: custom validator check failed for prop "' + name + '".');
  5634. }
  5635. }
  5636. const isSimpleType = /* @__PURE__ */ makeMap(
  5637. "String,Number,Boolean,Function,Symbol,BigInt"
  5638. );
  5639. function assertType(value, type) {
  5640. let valid;
  5641. const expectedType = getType(type);
  5642. if (isSimpleType(expectedType)) {
  5643. const t = typeof value;
  5644. valid = t === expectedType.toLowerCase();
  5645. if (!valid && t === "object") {
  5646. valid = value instanceof type;
  5647. }
  5648. } else if (expectedType === "Object") {
  5649. valid = isObject(value);
  5650. } else if (expectedType === "Array") {
  5651. valid = isArray(value);
  5652. } else if (expectedType === "null") {
  5653. valid = value === null;
  5654. } else {
  5655. valid = value instanceof type;
  5656. }
  5657. return {
  5658. valid,
  5659. expectedType
  5660. };
  5661. }
  5662. function getInvalidTypeMessage(name, value, expectedTypes) {
  5663. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  5664. const expectedType = expectedTypes[0];
  5665. const receivedType = toRawType(value);
  5666. const expectedValue = styleValue(value, expectedType);
  5667. const receivedValue = styleValue(value, receivedType);
  5668. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  5669. message += ` with value ${expectedValue}`;
  5670. }
  5671. message += `, got ${receivedType} `;
  5672. if (isExplicable(receivedType)) {
  5673. message += `with value ${receivedValue}.`;
  5674. }
  5675. return message;
  5676. }
  5677. function styleValue(value, type) {
  5678. if (type === "String") {
  5679. return `"${value}"`;
  5680. } else if (type === "Number") {
  5681. return `${Number(value)}`;
  5682. } else {
  5683. return `${value}`;
  5684. }
  5685. }
  5686. function isExplicable(type) {
  5687. const explicitTypes = ["string", "number", "boolean"];
  5688. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  5689. }
  5690. function isBoolean(...args) {
  5691. return args.some((elem) => elem.toLowerCase() === "boolean");
  5692. }
  5693. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  5694. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  5695. const normalizeSlot = (key, rawSlot, ctx) => {
  5696. if (rawSlot._n) {
  5697. return rawSlot;
  5698. }
  5699. const normalized = withCtx((...args) => {
  5700. if (currentInstance) {
  5701. warn(
  5702. `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.`
  5703. );
  5704. }
  5705. return normalizeSlotValue(rawSlot(...args));
  5706. }, ctx);
  5707. normalized._c = false;
  5708. return normalized;
  5709. };
  5710. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  5711. const ctx = rawSlots._ctx;
  5712. for (const key in rawSlots) {
  5713. if (isInternalKey(key))
  5714. continue;
  5715. const value = rawSlots[key];
  5716. if (isFunction(value)) {
  5717. slots[key] = normalizeSlot(key, value, ctx);
  5718. } else if (value != null) {
  5719. {
  5720. warn(
  5721. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  5722. );
  5723. }
  5724. const normalized = normalizeSlotValue(value);
  5725. slots[key] = () => normalized;
  5726. }
  5727. }
  5728. };
  5729. const normalizeVNodeSlots = (instance, children) => {
  5730. if (!isKeepAlive(instance.vnode) && true) {
  5731. warn(
  5732. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  5733. );
  5734. }
  5735. const normalized = normalizeSlotValue(children);
  5736. instance.slots.default = () => normalized;
  5737. };
  5738. const initSlots = (instance, children) => {
  5739. if (instance.vnode.shapeFlag & 32) {
  5740. const type = children._;
  5741. if (type) {
  5742. instance.slots = toRaw(children);
  5743. def(children, "_", type);
  5744. } else {
  5745. normalizeObjectSlots(
  5746. children,
  5747. instance.slots = {});
  5748. }
  5749. } else {
  5750. instance.slots = {};
  5751. if (children) {
  5752. normalizeVNodeSlots(instance, children);
  5753. }
  5754. }
  5755. def(instance.slots, InternalObjectKey, 1);
  5756. };
  5757. const updateSlots = (instance, children, optimized) => {
  5758. const { vnode, slots } = instance;
  5759. let needDeletionCheck = true;
  5760. let deletionComparisonTarget = EMPTY_OBJ;
  5761. if (vnode.shapeFlag & 32) {
  5762. const type = children._;
  5763. if (type) {
  5764. if (isHmrUpdating) {
  5765. extend(slots, children);
  5766. trigger(instance, "set", "$slots");
  5767. } else if (optimized && type === 1) {
  5768. needDeletionCheck = false;
  5769. } else {
  5770. extend(slots, children);
  5771. if (!optimized && type === 1) {
  5772. delete slots._;
  5773. }
  5774. }
  5775. } else {
  5776. needDeletionCheck = !children.$stable;
  5777. normalizeObjectSlots(children, slots);
  5778. }
  5779. deletionComparisonTarget = children;
  5780. } else if (children) {
  5781. normalizeVNodeSlots(instance, children);
  5782. deletionComparisonTarget = { default: 1 };
  5783. }
  5784. if (needDeletionCheck) {
  5785. for (const key in slots) {
  5786. if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
  5787. delete slots[key];
  5788. }
  5789. }
  5790. }
  5791. };
  5792. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  5793. if (isArray(rawRef)) {
  5794. rawRef.forEach(
  5795. (r, i) => setRef(
  5796. r,
  5797. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  5798. parentSuspense,
  5799. vnode,
  5800. isUnmount
  5801. )
  5802. );
  5803. return;
  5804. }
  5805. if (isAsyncWrapper(vnode) && !isUnmount) {
  5806. return;
  5807. }
  5808. const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  5809. const value = isUnmount ? null : refValue;
  5810. const { i: owner, r: ref } = rawRef;
  5811. if (!owner) {
  5812. warn(
  5813. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  5814. );
  5815. return;
  5816. }
  5817. const oldRef = oldRawRef && oldRawRef.r;
  5818. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  5819. const setupState = owner.setupState;
  5820. if (oldRef != null && oldRef !== ref) {
  5821. if (isString(oldRef)) {
  5822. refs[oldRef] = null;
  5823. if (hasOwn(setupState, oldRef)) {
  5824. setupState[oldRef] = null;
  5825. }
  5826. } else if (isRef(oldRef)) {
  5827. oldRef.value = null;
  5828. }
  5829. }
  5830. if (isFunction(ref)) {
  5831. callWithErrorHandling(ref, owner, 12, [value, refs]);
  5832. } else {
  5833. const _isString = isString(ref);
  5834. const _isRef = isRef(ref);
  5835. if (_isString || _isRef) {
  5836. const doSet = () => {
  5837. if (rawRef.f) {
  5838. const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  5839. if (isUnmount) {
  5840. isArray(existing) && remove(existing, refValue);
  5841. } else {
  5842. if (!isArray(existing)) {
  5843. if (_isString) {
  5844. refs[ref] = [refValue];
  5845. if (hasOwn(setupState, ref)) {
  5846. setupState[ref] = refs[ref];
  5847. }
  5848. } else {
  5849. ref.value = [refValue];
  5850. if (rawRef.k)
  5851. refs[rawRef.k] = ref.value;
  5852. }
  5853. } else if (!existing.includes(refValue)) {
  5854. existing.push(refValue);
  5855. }
  5856. }
  5857. } else if (_isString) {
  5858. refs[ref] = value;
  5859. if (hasOwn(setupState, ref)) {
  5860. setupState[ref] = value;
  5861. }
  5862. } else if (_isRef) {
  5863. ref.value = value;
  5864. if (rawRef.k)
  5865. refs[rawRef.k] = value;
  5866. } else {
  5867. warn("Invalid template ref type:", ref, `(${typeof ref})`);
  5868. }
  5869. };
  5870. if (value) {
  5871. doSet.id = -1;
  5872. queuePostRenderEffect(doSet, parentSuspense);
  5873. } else {
  5874. doSet();
  5875. }
  5876. } else {
  5877. warn("Invalid template ref type:", ref, `(${typeof ref})`);
  5878. }
  5879. }
  5880. }
  5881. let hasMismatch = false;
  5882. const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject";
  5883. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  5884. function createHydrationFunctions(rendererInternals) {
  5885. const {
  5886. mt: mountComponent,
  5887. p: patch,
  5888. o: {
  5889. patchProp,
  5890. createText,
  5891. nextSibling,
  5892. parentNode,
  5893. remove,
  5894. insert,
  5895. createComment
  5896. }
  5897. } = rendererInternals;
  5898. const hydrate = (vnode, container) => {
  5899. if (!container.hasChildNodes()) {
  5900. warn(
  5901. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  5902. );
  5903. patch(null, vnode, container);
  5904. flushPostFlushCbs();
  5905. container._vnode = vnode;
  5906. return;
  5907. }
  5908. hasMismatch = false;
  5909. hydrateNode(container.firstChild, vnode, null, null, null);
  5910. flushPostFlushCbs();
  5911. container._vnode = vnode;
  5912. if (hasMismatch && true) {
  5913. console.error(`Hydration completed but contains mismatches.`);
  5914. }
  5915. };
  5916. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  5917. const isFragmentStart = isComment(node) && node.data === "[";
  5918. const onMismatch = () => handleMismatch(
  5919. node,
  5920. vnode,
  5921. parentComponent,
  5922. parentSuspense,
  5923. slotScopeIds,
  5924. isFragmentStart
  5925. );
  5926. const { type, ref, shapeFlag, patchFlag } = vnode;
  5927. let domType = node.nodeType;
  5928. vnode.el = node;
  5929. if (patchFlag === -2) {
  5930. optimized = false;
  5931. vnode.dynamicChildren = null;
  5932. }
  5933. let nextNode = null;
  5934. switch (type) {
  5935. case Text:
  5936. if (domType !== 3 /* TEXT */) {
  5937. if (vnode.children === "") {
  5938. insert(vnode.el = createText(""), parentNode(node), node);
  5939. nextNode = node;
  5940. } else {
  5941. nextNode = onMismatch();
  5942. }
  5943. } else {
  5944. if (node.data !== vnode.children) {
  5945. hasMismatch = true;
  5946. warn(
  5947. `Hydration text mismatch:
  5948. - Client: ${JSON.stringify(node.data)}
  5949. - Server: ${JSON.stringify(vnode.children)}`
  5950. );
  5951. node.data = vnode.children;
  5952. }
  5953. nextNode = nextSibling(node);
  5954. }
  5955. break;
  5956. case Comment:
  5957. if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  5958. nextNode = onMismatch();
  5959. } else {
  5960. nextNode = nextSibling(node);
  5961. }
  5962. break;
  5963. case Static:
  5964. if (isFragmentStart) {
  5965. node = nextSibling(node);
  5966. domType = node.nodeType;
  5967. }
  5968. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  5969. nextNode = node;
  5970. const needToAdoptContent = !vnode.children.length;
  5971. for (let i = 0; i < vnode.staticCount; i++) {
  5972. if (needToAdoptContent)
  5973. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  5974. if (i === vnode.staticCount - 1) {
  5975. vnode.anchor = nextNode;
  5976. }
  5977. nextNode = nextSibling(nextNode);
  5978. }
  5979. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  5980. } else {
  5981. onMismatch();
  5982. }
  5983. break;
  5984. case Fragment:
  5985. if (!isFragmentStart) {
  5986. nextNode = onMismatch();
  5987. } else {
  5988. nextNode = hydrateFragment(
  5989. node,
  5990. vnode,
  5991. parentComponent,
  5992. parentSuspense,
  5993. slotScopeIds,
  5994. optimized
  5995. );
  5996. }
  5997. break;
  5998. default:
  5999. if (shapeFlag & 1) {
  6000. if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
  6001. nextNode = onMismatch();
  6002. } else {
  6003. nextNode = hydrateElement(
  6004. node,
  6005. vnode,
  6006. parentComponent,
  6007. parentSuspense,
  6008. slotScopeIds,
  6009. optimized
  6010. );
  6011. }
  6012. } else if (shapeFlag & 6) {
  6013. vnode.slotScopeIds = slotScopeIds;
  6014. const container = parentNode(node);
  6015. mountComponent(
  6016. vnode,
  6017. container,
  6018. null,
  6019. parentComponent,
  6020. parentSuspense,
  6021. isSVGContainer(container),
  6022. optimized
  6023. );
  6024. nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
  6025. if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
  6026. nextNode = nextSibling(nextNode);
  6027. }
  6028. if (isAsyncWrapper(vnode)) {
  6029. let subTree;
  6030. if (isFragmentStart) {
  6031. subTree = createVNode(Fragment);
  6032. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  6033. } else {
  6034. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  6035. }
  6036. subTree.el = node;
  6037. vnode.component.subTree = subTree;
  6038. }
  6039. } else if (shapeFlag & 64) {
  6040. if (domType !== 8 /* COMMENT */) {
  6041. nextNode = onMismatch();
  6042. } else {
  6043. nextNode = vnode.type.hydrate(
  6044. node,
  6045. vnode,
  6046. parentComponent,
  6047. parentSuspense,
  6048. slotScopeIds,
  6049. optimized,
  6050. rendererInternals,
  6051. hydrateChildren
  6052. );
  6053. }
  6054. } else if (shapeFlag & 128) {
  6055. nextNode = vnode.type.hydrate(
  6056. node,
  6057. vnode,
  6058. parentComponent,
  6059. parentSuspense,
  6060. isSVGContainer(parentNode(node)),
  6061. slotScopeIds,
  6062. optimized,
  6063. rendererInternals,
  6064. hydrateNode
  6065. );
  6066. } else {
  6067. warn("Invalid HostVNode type:", type, `(${typeof type})`);
  6068. }
  6069. }
  6070. if (ref != null) {
  6071. setRef(ref, null, parentSuspense, vnode);
  6072. }
  6073. return nextNode;
  6074. };
  6075. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6076. optimized = optimized || !!vnode.dynamicChildren;
  6077. const { type, props, patchFlag, shapeFlag, dirs } = vnode;
  6078. const forcePatchValue = type === "input" && dirs || type === "option";
  6079. {
  6080. if (dirs) {
  6081. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6082. }
  6083. if (props) {
  6084. if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
  6085. for (const key in props) {
  6086. if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
  6087. patchProp(
  6088. el,
  6089. key,
  6090. null,
  6091. props[key],
  6092. false,
  6093. void 0,
  6094. parentComponent
  6095. );
  6096. }
  6097. }
  6098. } else if (props.onClick) {
  6099. patchProp(
  6100. el,
  6101. "onClick",
  6102. null,
  6103. props.onClick,
  6104. false,
  6105. void 0,
  6106. parentComponent
  6107. );
  6108. }
  6109. }
  6110. let vnodeHooks;
  6111. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  6112. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6113. }
  6114. if (dirs) {
  6115. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6116. }
  6117. if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
  6118. queueEffectWithSuspense(() => {
  6119. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6120. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6121. }, parentSuspense);
  6122. }
  6123. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  6124. !(props && (props.innerHTML || props.textContent))) {
  6125. let next = hydrateChildren(
  6126. el.firstChild,
  6127. vnode,
  6128. el,
  6129. parentComponent,
  6130. parentSuspense,
  6131. slotScopeIds,
  6132. optimized
  6133. );
  6134. let hasWarned = false;
  6135. while (next) {
  6136. hasMismatch = true;
  6137. if (!hasWarned) {
  6138. warn(
  6139. `Hydration children mismatch in <${vnode.type}>: server rendered element contains more child nodes than client vdom.`
  6140. );
  6141. hasWarned = true;
  6142. }
  6143. const cur = next;
  6144. next = next.nextSibling;
  6145. remove(cur);
  6146. }
  6147. } else if (shapeFlag & 8) {
  6148. if (el.textContent !== vnode.children) {
  6149. hasMismatch = true;
  6150. warn(
  6151. `Hydration text content mismatch in <${vnode.type}>:
  6152. - Client: ${el.textContent}
  6153. - Server: ${vnode.children}`
  6154. );
  6155. el.textContent = vnode.children;
  6156. }
  6157. }
  6158. }
  6159. return el.nextSibling;
  6160. };
  6161. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6162. optimized = optimized || !!parentVNode.dynamicChildren;
  6163. const children = parentVNode.children;
  6164. const l = children.length;
  6165. let hasWarned = false;
  6166. for (let i = 0; i < l; i++) {
  6167. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  6168. if (node) {
  6169. node = hydrateNode(
  6170. node,
  6171. vnode,
  6172. parentComponent,
  6173. parentSuspense,
  6174. slotScopeIds,
  6175. optimized
  6176. );
  6177. } else if (vnode.type === Text && !vnode.children) {
  6178. continue;
  6179. } else {
  6180. hasMismatch = true;
  6181. if (!hasWarned) {
  6182. warn(
  6183. `Hydration children mismatch in <${container.tagName.toLowerCase()}>: server rendered element contains fewer child nodes than client vdom.`
  6184. );
  6185. hasWarned = true;
  6186. }
  6187. patch(
  6188. null,
  6189. vnode,
  6190. container,
  6191. null,
  6192. parentComponent,
  6193. parentSuspense,
  6194. isSVGContainer(container),
  6195. slotScopeIds
  6196. );
  6197. }
  6198. }
  6199. return node;
  6200. };
  6201. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6202. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  6203. if (fragmentSlotScopeIds) {
  6204. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6205. }
  6206. const container = parentNode(node);
  6207. const next = hydrateChildren(
  6208. nextSibling(node),
  6209. vnode,
  6210. container,
  6211. parentComponent,
  6212. parentSuspense,
  6213. slotScopeIds,
  6214. optimized
  6215. );
  6216. if (next && isComment(next) && next.data === "]") {
  6217. return nextSibling(vnode.anchor = next);
  6218. } else {
  6219. hasMismatch = true;
  6220. insert(vnode.anchor = createComment(`]`), container, next);
  6221. return next;
  6222. }
  6223. };
  6224. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  6225. hasMismatch = true;
  6226. warn(
  6227. `Hydration node mismatch:
  6228. - Client vnode:`,
  6229. vnode.type,
  6230. `
  6231. - Server rendered DOM:`,
  6232. node,
  6233. node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``
  6234. );
  6235. vnode.el = null;
  6236. if (isFragment) {
  6237. const end = locateClosingAsyncAnchor(node);
  6238. while (true) {
  6239. const next2 = nextSibling(node);
  6240. if (next2 && next2 !== end) {
  6241. remove(next2);
  6242. } else {
  6243. break;
  6244. }
  6245. }
  6246. }
  6247. const next = nextSibling(node);
  6248. const container = parentNode(node);
  6249. remove(node);
  6250. patch(
  6251. null,
  6252. vnode,
  6253. container,
  6254. next,
  6255. parentComponent,
  6256. parentSuspense,
  6257. isSVGContainer(container),
  6258. slotScopeIds
  6259. );
  6260. return next;
  6261. };
  6262. const locateClosingAsyncAnchor = (node) => {
  6263. let match = 0;
  6264. while (node) {
  6265. node = nextSibling(node);
  6266. if (node && isComment(node)) {
  6267. if (node.data === "[")
  6268. match++;
  6269. if (node.data === "]") {
  6270. if (match === 0) {
  6271. return nextSibling(node);
  6272. } else {
  6273. match--;
  6274. }
  6275. }
  6276. }
  6277. }
  6278. return node;
  6279. };
  6280. return [hydrate, hydrateNode];
  6281. }
  6282. let supported;
  6283. let perf;
  6284. function startMeasure(instance, type) {
  6285. if (instance.appContext.config.performance && isSupported()) {
  6286. perf.mark(`vue-${type}-${instance.uid}`);
  6287. }
  6288. {
  6289. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6290. }
  6291. }
  6292. function endMeasure(instance, type) {
  6293. if (instance.appContext.config.performance && isSupported()) {
  6294. const startTag = `vue-${type}-${instance.uid}`;
  6295. const endTag = startTag + `:end`;
  6296. perf.mark(endTag);
  6297. perf.measure(
  6298. `<${formatComponentName(instance, instance.type)}> ${type}`,
  6299. startTag,
  6300. endTag
  6301. );
  6302. perf.clearMarks(startTag);
  6303. perf.clearMarks(endTag);
  6304. }
  6305. {
  6306. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6307. }
  6308. }
  6309. function isSupported() {
  6310. if (supported !== void 0) {
  6311. return supported;
  6312. }
  6313. if (typeof window !== "undefined" && window.performance) {
  6314. supported = true;
  6315. perf = window.performance;
  6316. } else {
  6317. supported = false;
  6318. }
  6319. return supported;
  6320. }
  6321. const queuePostRenderEffect = queueEffectWithSuspense ;
  6322. function createRenderer(options) {
  6323. return baseCreateRenderer(options);
  6324. }
  6325. function createHydrationRenderer(options) {
  6326. return baseCreateRenderer(options, createHydrationFunctions);
  6327. }
  6328. function baseCreateRenderer(options, createHydrationFns) {
  6329. const target = getGlobalThis();
  6330. target.__VUE__ = true;
  6331. {
  6332. setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6333. }
  6334. const {
  6335. insert: hostInsert,
  6336. remove: hostRemove,
  6337. patchProp: hostPatchProp,
  6338. createElement: hostCreateElement,
  6339. createText: hostCreateText,
  6340. createComment: hostCreateComment,
  6341. setText: hostSetText,
  6342. setElementText: hostSetElementText,
  6343. parentNode: hostParentNode,
  6344. nextSibling: hostNextSibling,
  6345. setScopeId: hostSetScopeId = NOOP,
  6346. insertStaticContent: hostInsertStaticContent
  6347. } = options;
  6348. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6349. if (n1 === n2) {
  6350. return;
  6351. }
  6352. if (n1 && !isSameVNodeType(n1, n2)) {
  6353. anchor = getNextHostNode(n1);
  6354. unmount(n1, parentComponent, parentSuspense, true);
  6355. n1 = null;
  6356. }
  6357. if (n2.patchFlag === -2) {
  6358. optimized = false;
  6359. n2.dynamicChildren = null;
  6360. }
  6361. const { type, ref, shapeFlag } = n2;
  6362. switch (type) {
  6363. case Text:
  6364. processText(n1, n2, container, anchor);
  6365. break;
  6366. case Comment:
  6367. processCommentNode(n1, n2, container, anchor);
  6368. break;
  6369. case Static:
  6370. if (n1 == null) {
  6371. mountStaticNode(n2, container, anchor, isSVG);
  6372. } else {
  6373. patchStaticNode(n1, n2, container, isSVG);
  6374. }
  6375. break;
  6376. case Fragment:
  6377. processFragment(
  6378. n1,
  6379. n2,
  6380. container,
  6381. anchor,
  6382. parentComponent,
  6383. parentSuspense,
  6384. isSVG,
  6385. slotScopeIds,
  6386. optimized
  6387. );
  6388. break;
  6389. default:
  6390. if (shapeFlag & 1) {
  6391. processElement(
  6392. n1,
  6393. n2,
  6394. container,
  6395. anchor,
  6396. parentComponent,
  6397. parentSuspense,
  6398. isSVG,
  6399. slotScopeIds,
  6400. optimized
  6401. );
  6402. } else if (shapeFlag & 6) {
  6403. processComponent(
  6404. n1,
  6405. n2,
  6406. container,
  6407. anchor,
  6408. parentComponent,
  6409. parentSuspense,
  6410. isSVG,
  6411. slotScopeIds,
  6412. optimized
  6413. );
  6414. } else if (shapeFlag & 64) {
  6415. type.process(
  6416. n1,
  6417. n2,
  6418. container,
  6419. anchor,
  6420. parentComponent,
  6421. parentSuspense,
  6422. isSVG,
  6423. slotScopeIds,
  6424. optimized,
  6425. internals
  6426. );
  6427. } else if (shapeFlag & 128) {
  6428. type.process(
  6429. n1,
  6430. n2,
  6431. container,
  6432. anchor,
  6433. parentComponent,
  6434. parentSuspense,
  6435. isSVG,
  6436. slotScopeIds,
  6437. optimized,
  6438. internals
  6439. );
  6440. } else {
  6441. warn("Invalid VNode type:", type, `(${typeof type})`);
  6442. }
  6443. }
  6444. if (ref != null && parentComponent) {
  6445. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6446. }
  6447. };
  6448. const processText = (n1, n2, container, anchor) => {
  6449. if (n1 == null) {
  6450. hostInsert(
  6451. n2.el = hostCreateText(n2.children),
  6452. container,
  6453. anchor
  6454. );
  6455. } else {
  6456. const el = n2.el = n1.el;
  6457. if (n2.children !== n1.children) {
  6458. hostSetText(el, n2.children);
  6459. }
  6460. }
  6461. };
  6462. const processCommentNode = (n1, n2, container, anchor) => {
  6463. if (n1 == null) {
  6464. hostInsert(
  6465. n2.el = hostCreateComment(n2.children || ""),
  6466. container,
  6467. anchor
  6468. );
  6469. } else {
  6470. n2.el = n1.el;
  6471. }
  6472. };
  6473. const mountStaticNode = (n2, container, anchor, isSVG) => {
  6474. [n2.el, n2.anchor] = hostInsertStaticContent(
  6475. n2.children,
  6476. container,
  6477. anchor,
  6478. isSVG,
  6479. n2.el,
  6480. n2.anchor
  6481. );
  6482. };
  6483. const patchStaticNode = (n1, n2, container, isSVG) => {
  6484. if (n2.children !== n1.children) {
  6485. const anchor = hostNextSibling(n1.anchor);
  6486. removeStaticNode(n1);
  6487. [n2.el, n2.anchor] = hostInsertStaticContent(
  6488. n2.children,
  6489. container,
  6490. anchor,
  6491. isSVG
  6492. );
  6493. } else {
  6494. n2.el = n1.el;
  6495. n2.anchor = n1.anchor;
  6496. }
  6497. };
  6498. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  6499. let next;
  6500. while (el && el !== anchor) {
  6501. next = hostNextSibling(el);
  6502. hostInsert(el, container, nextSibling);
  6503. el = next;
  6504. }
  6505. hostInsert(anchor, container, nextSibling);
  6506. };
  6507. const removeStaticNode = ({ el, anchor }) => {
  6508. let next;
  6509. while (el && el !== anchor) {
  6510. next = hostNextSibling(el);
  6511. hostRemove(el);
  6512. el = next;
  6513. }
  6514. hostRemove(anchor);
  6515. };
  6516. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6517. isSVG = isSVG || n2.type === "svg";
  6518. if (n1 == null) {
  6519. mountElement(
  6520. n2,
  6521. container,
  6522. anchor,
  6523. parentComponent,
  6524. parentSuspense,
  6525. isSVG,
  6526. slotScopeIds,
  6527. optimized
  6528. );
  6529. } else {
  6530. patchElement(
  6531. n1,
  6532. n2,
  6533. parentComponent,
  6534. parentSuspense,
  6535. isSVG,
  6536. slotScopeIds,
  6537. optimized
  6538. );
  6539. }
  6540. };
  6541. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6542. let el;
  6543. let vnodeHook;
  6544. const { type, props, shapeFlag, transition, dirs } = vnode;
  6545. el = vnode.el = hostCreateElement(
  6546. vnode.type,
  6547. isSVG,
  6548. props && props.is,
  6549. props
  6550. );
  6551. if (shapeFlag & 8) {
  6552. hostSetElementText(el, vnode.children);
  6553. } else if (shapeFlag & 16) {
  6554. mountChildren(
  6555. vnode.children,
  6556. el,
  6557. null,
  6558. parentComponent,
  6559. parentSuspense,
  6560. isSVG && type !== "foreignObject",
  6561. slotScopeIds,
  6562. optimized
  6563. );
  6564. }
  6565. if (dirs) {
  6566. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6567. }
  6568. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6569. if (props) {
  6570. for (const key in props) {
  6571. if (key !== "value" && !isReservedProp(key)) {
  6572. hostPatchProp(
  6573. el,
  6574. key,
  6575. null,
  6576. props[key],
  6577. isSVG,
  6578. vnode.children,
  6579. parentComponent,
  6580. parentSuspense,
  6581. unmountChildren
  6582. );
  6583. }
  6584. }
  6585. if ("value" in props) {
  6586. hostPatchProp(el, "value", null, props.value);
  6587. }
  6588. if (vnodeHook = props.onVnodeBeforeMount) {
  6589. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6590. }
  6591. }
  6592. {
  6593. Object.defineProperty(el, "__vnode", {
  6594. value: vnode,
  6595. enumerable: false
  6596. });
  6597. Object.defineProperty(el, "__vueParentComponent", {
  6598. value: parentComponent,
  6599. enumerable: false
  6600. });
  6601. }
  6602. if (dirs) {
  6603. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6604. }
  6605. const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  6606. if (needCallTransitionHooks) {
  6607. transition.beforeEnter(el);
  6608. }
  6609. hostInsert(el, container, anchor);
  6610. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6611. queuePostRenderEffect(() => {
  6612. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6613. needCallTransitionHooks && transition.enter(el);
  6614. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6615. }, parentSuspense);
  6616. }
  6617. };
  6618. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6619. if (scopeId) {
  6620. hostSetScopeId(el, scopeId);
  6621. }
  6622. if (slotScopeIds) {
  6623. for (let i = 0; i < slotScopeIds.length; i++) {
  6624. hostSetScopeId(el, slotScopeIds[i]);
  6625. }
  6626. }
  6627. if (parentComponent) {
  6628. let subTree = parentComponent.subTree;
  6629. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  6630. subTree = filterSingleRoot(subTree.children) || subTree;
  6631. }
  6632. if (vnode === subTree) {
  6633. const parentVNode = parentComponent.vnode;
  6634. setScopeId(
  6635. el,
  6636. parentVNode,
  6637. parentVNode.scopeId,
  6638. parentVNode.slotScopeIds,
  6639. parentComponent.parent
  6640. );
  6641. }
  6642. }
  6643. };
  6644. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
  6645. for (let i = start; i < children.length; i++) {
  6646. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  6647. patch(
  6648. null,
  6649. child,
  6650. container,
  6651. anchor,
  6652. parentComponent,
  6653. parentSuspense,
  6654. isSVG,
  6655. slotScopeIds,
  6656. optimized
  6657. );
  6658. }
  6659. };
  6660. const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6661. const el = n2.el = n1.el;
  6662. let { patchFlag, dynamicChildren, dirs } = n2;
  6663. patchFlag |= n1.patchFlag & 16;
  6664. const oldProps = n1.props || EMPTY_OBJ;
  6665. const newProps = n2.props || EMPTY_OBJ;
  6666. let vnodeHook;
  6667. parentComponent && toggleRecurse(parentComponent, false);
  6668. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  6669. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6670. }
  6671. if (dirs) {
  6672. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  6673. }
  6674. parentComponent && toggleRecurse(parentComponent, true);
  6675. if (isHmrUpdating) {
  6676. patchFlag = 0;
  6677. optimized = false;
  6678. dynamicChildren = null;
  6679. }
  6680. const areChildrenSVG = isSVG && n2.type !== "foreignObject";
  6681. if (dynamicChildren) {
  6682. patchBlockChildren(
  6683. n1.dynamicChildren,
  6684. dynamicChildren,
  6685. el,
  6686. parentComponent,
  6687. parentSuspense,
  6688. areChildrenSVG,
  6689. slotScopeIds
  6690. );
  6691. {
  6692. traverseStaticChildren(n1, n2);
  6693. }
  6694. } else if (!optimized) {
  6695. patchChildren(
  6696. n1,
  6697. n2,
  6698. el,
  6699. null,
  6700. parentComponent,
  6701. parentSuspense,
  6702. areChildrenSVG,
  6703. slotScopeIds,
  6704. false
  6705. );
  6706. }
  6707. if (patchFlag > 0) {
  6708. if (patchFlag & 16) {
  6709. patchProps(
  6710. el,
  6711. n2,
  6712. oldProps,
  6713. newProps,
  6714. parentComponent,
  6715. parentSuspense,
  6716. isSVG
  6717. );
  6718. } else {
  6719. if (patchFlag & 2) {
  6720. if (oldProps.class !== newProps.class) {
  6721. hostPatchProp(el, "class", null, newProps.class, isSVG);
  6722. }
  6723. }
  6724. if (patchFlag & 4) {
  6725. hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
  6726. }
  6727. if (patchFlag & 8) {
  6728. const propsToUpdate = n2.dynamicProps;
  6729. for (let i = 0; i < propsToUpdate.length; i++) {
  6730. const key = propsToUpdate[i];
  6731. const prev = oldProps[key];
  6732. const next = newProps[key];
  6733. if (next !== prev || key === "value") {
  6734. hostPatchProp(
  6735. el,
  6736. key,
  6737. prev,
  6738. next,
  6739. isSVG,
  6740. n1.children,
  6741. parentComponent,
  6742. parentSuspense,
  6743. unmountChildren
  6744. );
  6745. }
  6746. }
  6747. }
  6748. }
  6749. if (patchFlag & 1) {
  6750. if (n1.children !== n2.children) {
  6751. hostSetElementText(el, n2.children);
  6752. }
  6753. }
  6754. } else if (!optimized && dynamicChildren == null) {
  6755. patchProps(
  6756. el,
  6757. n2,
  6758. oldProps,
  6759. newProps,
  6760. parentComponent,
  6761. parentSuspense,
  6762. isSVG
  6763. );
  6764. }
  6765. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  6766. queuePostRenderEffect(() => {
  6767. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6768. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  6769. }, parentSuspense);
  6770. }
  6771. };
  6772. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
  6773. for (let i = 0; i < newChildren.length; i++) {
  6774. const oldVNode = oldChildren[i];
  6775. const newVNode = newChildren[i];
  6776. const container = (
  6777. // oldVNode may be an errored async setup() component inside Suspense
  6778. // which will not have a mounted element
  6779. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  6780. // of the Fragment itself so it can move its children.
  6781. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  6782. // which also requires the correct parent container
  6783. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  6784. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  6785. // In other cases, the parent container is not actually used so we
  6786. // just pass the block element here to avoid a DOM parentNode call.
  6787. fallbackContainer
  6788. )
  6789. );
  6790. patch(
  6791. oldVNode,
  6792. newVNode,
  6793. container,
  6794. null,
  6795. parentComponent,
  6796. parentSuspense,
  6797. isSVG,
  6798. slotScopeIds,
  6799. true
  6800. );
  6801. }
  6802. };
  6803. const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
  6804. if (oldProps !== newProps) {
  6805. if (oldProps !== EMPTY_OBJ) {
  6806. for (const key in oldProps) {
  6807. if (!isReservedProp(key) && !(key in newProps)) {
  6808. hostPatchProp(
  6809. el,
  6810. key,
  6811. oldProps[key],
  6812. null,
  6813. isSVG,
  6814. vnode.children,
  6815. parentComponent,
  6816. parentSuspense,
  6817. unmountChildren
  6818. );
  6819. }
  6820. }
  6821. }
  6822. for (const key in newProps) {
  6823. if (isReservedProp(key))
  6824. continue;
  6825. const next = newProps[key];
  6826. const prev = oldProps[key];
  6827. if (next !== prev && key !== "value") {
  6828. hostPatchProp(
  6829. el,
  6830. key,
  6831. prev,
  6832. next,
  6833. isSVG,
  6834. vnode.children,
  6835. parentComponent,
  6836. parentSuspense,
  6837. unmountChildren
  6838. );
  6839. }
  6840. }
  6841. if ("value" in newProps) {
  6842. hostPatchProp(el, "value", oldProps.value, newProps.value);
  6843. }
  6844. }
  6845. };
  6846. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6847. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  6848. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  6849. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  6850. if (
  6851. // #5523 dev root fragment may inherit directives
  6852. isHmrUpdating || patchFlag & 2048
  6853. ) {
  6854. patchFlag = 0;
  6855. optimized = false;
  6856. dynamicChildren = null;
  6857. }
  6858. if (fragmentSlotScopeIds) {
  6859. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6860. }
  6861. if (n1 == null) {
  6862. hostInsert(fragmentStartAnchor, container, anchor);
  6863. hostInsert(fragmentEndAnchor, container, anchor);
  6864. mountChildren(
  6865. n2.children,
  6866. container,
  6867. fragmentEndAnchor,
  6868. parentComponent,
  6869. parentSuspense,
  6870. isSVG,
  6871. slotScopeIds,
  6872. optimized
  6873. );
  6874. } else {
  6875. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  6876. // of renderSlot() with no valid children
  6877. n1.dynamicChildren) {
  6878. patchBlockChildren(
  6879. n1.dynamicChildren,
  6880. dynamicChildren,
  6881. container,
  6882. parentComponent,
  6883. parentSuspense,
  6884. isSVG,
  6885. slotScopeIds
  6886. );
  6887. {
  6888. traverseStaticChildren(n1, n2);
  6889. }
  6890. } else {
  6891. patchChildren(
  6892. n1,
  6893. n2,
  6894. container,
  6895. fragmentEndAnchor,
  6896. parentComponent,
  6897. parentSuspense,
  6898. isSVG,
  6899. slotScopeIds,
  6900. optimized
  6901. );
  6902. }
  6903. }
  6904. };
  6905. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6906. n2.slotScopeIds = slotScopeIds;
  6907. if (n1 == null) {
  6908. if (n2.shapeFlag & 512) {
  6909. parentComponent.ctx.activate(
  6910. n2,
  6911. container,
  6912. anchor,
  6913. isSVG,
  6914. optimized
  6915. );
  6916. } else {
  6917. mountComponent(
  6918. n2,
  6919. container,
  6920. anchor,
  6921. parentComponent,
  6922. parentSuspense,
  6923. isSVG,
  6924. optimized
  6925. );
  6926. }
  6927. } else {
  6928. updateComponent(n1, n2, optimized);
  6929. }
  6930. };
  6931. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
  6932. const instance = (initialVNode.component = createComponentInstance(
  6933. initialVNode,
  6934. parentComponent,
  6935. parentSuspense
  6936. ));
  6937. if (instance.type.__hmrId) {
  6938. registerHMR(instance);
  6939. }
  6940. {
  6941. pushWarningContext(initialVNode);
  6942. startMeasure(instance, `mount`);
  6943. }
  6944. if (isKeepAlive(initialVNode)) {
  6945. instance.ctx.renderer = internals;
  6946. }
  6947. {
  6948. {
  6949. startMeasure(instance, `init`);
  6950. }
  6951. setupComponent(instance);
  6952. {
  6953. endMeasure(instance, `init`);
  6954. }
  6955. }
  6956. if (instance.asyncDep) {
  6957. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  6958. if (!initialVNode.el) {
  6959. const placeholder = instance.subTree = createVNode(Comment);
  6960. processCommentNode(null, placeholder, container, anchor);
  6961. }
  6962. return;
  6963. }
  6964. setupRenderEffect(
  6965. instance,
  6966. initialVNode,
  6967. container,
  6968. anchor,
  6969. parentSuspense,
  6970. isSVG,
  6971. optimized
  6972. );
  6973. {
  6974. popWarningContext();
  6975. endMeasure(instance, `mount`);
  6976. }
  6977. };
  6978. const updateComponent = (n1, n2, optimized) => {
  6979. const instance = n2.component = n1.component;
  6980. if (shouldUpdateComponent(n1, n2, optimized)) {
  6981. if (instance.asyncDep && !instance.asyncResolved) {
  6982. {
  6983. pushWarningContext(n2);
  6984. }
  6985. updateComponentPreRender(instance, n2, optimized);
  6986. {
  6987. popWarningContext();
  6988. }
  6989. return;
  6990. } else {
  6991. instance.next = n2;
  6992. invalidateJob(instance.update);
  6993. instance.update();
  6994. }
  6995. } else {
  6996. n2.el = n1.el;
  6997. instance.vnode = n2;
  6998. }
  6999. };
  7000. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
  7001. const componentUpdateFn = () => {
  7002. if (!instance.isMounted) {
  7003. let vnodeHook;
  7004. const { el, props } = initialVNode;
  7005. const { bm, m, parent } = instance;
  7006. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  7007. toggleRecurse(instance, false);
  7008. if (bm) {
  7009. invokeArrayFns(bm);
  7010. }
  7011. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  7012. invokeVNodeHook(vnodeHook, parent, initialVNode);
  7013. }
  7014. toggleRecurse(instance, true);
  7015. if (el && hydrateNode) {
  7016. const hydrateSubTree = () => {
  7017. {
  7018. startMeasure(instance, `render`);
  7019. }
  7020. instance.subTree = renderComponentRoot(instance);
  7021. {
  7022. endMeasure(instance, `render`);
  7023. }
  7024. {
  7025. startMeasure(instance, `hydrate`);
  7026. }
  7027. hydrateNode(
  7028. el,
  7029. instance.subTree,
  7030. instance,
  7031. parentSuspense,
  7032. null
  7033. );
  7034. {
  7035. endMeasure(instance, `hydrate`);
  7036. }
  7037. };
  7038. if (isAsyncWrapperVNode) {
  7039. initialVNode.type.__asyncLoader().then(
  7040. // note: we are moving the render call into an async callback,
  7041. // which means it won't track dependencies - but it's ok because
  7042. // a server-rendered async wrapper is already in resolved state
  7043. // and it will never need to change.
  7044. () => !instance.isUnmounted && hydrateSubTree()
  7045. );
  7046. } else {
  7047. hydrateSubTree();
  7048. }
  7049. } else {
  7050. {
  7051. startMeasure(instance, `render`);
  7052. }
  7053. const subTree = instance.subTree = renderComponentRoot(instance);
  7054. {
  7055. endMeasure(instance, `render`);
  7056. }
  7057. {
  7058. startMeasure(instance, `patch`);
  7059. }
  7060. patch(
  7061. null,
  7062. subTree,
  7063. container,
  7064. anchor,
  7065. instance,
  7066. parentSuspense,
  7067. isSVG
  7068. );
  7069. {
  7070. endMeasure(instance, `patch`);
  7071. }
  7072. initialVNode.el = subTree.el;
  7073. }
  7074. if (m) {
  7075. queuePostRenderEffect(m, parentSuspense);
  7076. }
  7077. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  7078. const scopedInitialVNode = initialVNode;
  7079. queuePostRenderEffect(
  7080. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  7081. parentSuspense
  7082. );
  7083. }
  7084. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  7085. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  7086. }
  7087. instance.isMounted = true;
  7088. {
  7089. devtoolsComponentAdded(instance);
  7090. }
  7091. initialVNode = container = anchor = null;
  7092. } else {
  7093. let { next, bu, u, parent, vnode } = instance;
  7094. let originNext = next;
  7095. let vnodeHook;
  7096. {
  7097. pushWarningContext(next || instance.vnode);
  7098. }
  7099. toggleRecurse(instance, false);
  7100. if (next) {
  7101. next.el = vnode.el;
  7102. updateComponentPreRender(instance, next, optimized);
  7103. } else {
  7104. next = vnode;
  7105. }
  7106. if (bu) {
  7107. invokeArrayFns(bu);
  7108. }
  7109. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  7110. invokeVNodeHook(vnodeHook, parent, next, vnode);
  7111. }
  7112. toggleRecurse(instance, true);
  7113. {
  7114. startMeasure(instance, `render`);
  7115. }
  7116. const nextTree = renderComponentRoot(instance);
  7117. {
  7118. endMeasure(instance, `render`);
  7119. }
  7120. const prevTree = instance.subTree;
  7121. instance.subTree = nextTree;
  7122. {
  7123. startMeasure(instance, `patch`);
  7124. }
  7125. patch(
  7126. prevTree,
  7127. nextTree,
  7128. // parent may have changed if it's in a teleport
  7129. hostParentNode(prevTree.el),
  7130. // anchor may have changed if it's in a fragment
  7131. getNextHostNode(prevTree),
  7132. instance,
  7133. parentSuspense,
  7134. isSVG
  7135. );
  7136. {
  7137. endMeasure(instance, `patch`);
  7138. }
  7139. next.el = nextTree.el;
  7140. if (originNext === null) {
  7141. updateHOCHostEl(instance, nextTree.el);
  7142. }
  7143. if (u) {
  7144. queuePostRenderEffect(u, parentSuspense);
  7145. }
  7146. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  7147. queuePostRenderEffect(
  7148. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  7149. parentSuspense
  7150. );
  7151. }
  7152. {
  7153. devtoolsComponentUpdated(instance);
  7154. }
  7155. {
  7156. popWarningContext();
  7157. }
  7158. }
  7159. };
  7160. const effect = instance.effect = new ReactiveEffect(
  7161. componentUpdateFn,
  7162. () => queueJob(update),
  7163. instance.scope
  7164. // track it in component's effect scope
  7165. );
  7166. const update = instance.update = () => effect.run();
  7167. update.id = instance.uid;
  7168. toggleRecurse(instance, true);
  7169. {
  7170. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  7171. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  7172. update.ownerInstance = instance;
  7173. }
  7174. update();
  7175. };
  7176. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  7177. nextVNode.component = instance;
  7178. const prevProps = instance.vnode.props;
  7179. instance.vnode = nextVNode;
  7180. instance.next = null;
  7181. updateProps(instance, nextVNode.props, prevProps, optimized);
  7182. updateSlots(instance, nextVNode.children, optimized);
  7183. pauseTracking();
  7184. flushPreFlushCbs();
  7185. resetTracking();
  7186. };
  7187. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
  7188. const c1 = n1 && n1.children;
  7189. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  7190. const c2 = n2.children;
  7191. const { patchFlag, shapeFlag } = n2;
  7192. if (patchFlag > 0) {
  7193. if (patchFlag & 128) {
  7194. patchKeyedChildren(
  7195. c1,
  7196. c2,
  7197. container,
  7198. anchor,
  7199. parentComponent,
  7200. parentSuspense,
  7201. isSVG,
  7202. slotScopeIds,
  7203. optimized
  7204. );
  7205. return;
  7206. } else if (patchFlag & 256) {
  7207. patchUnkeyedChildren(
  7208. c1,
  7209. c2,
  7210. container,
  7211. anchor,
  7212. parentComponent,
  7213. parentSuspense,
  7214. isSVG,
  7215. slotScopeIds,
  7216. optimized
  7217. );
  7218. return;
  7219. }
  7220. }
  7221. if (shapeFlag & 8) {
  7222. if (prevShapeFlag & 16) {
  7223. unmountChildren(c1, parentComponent, parentSuspense);
  7224. }
  7225. if (c2 !== c1) {
  7226. hostSetElementText(container, c2);
  7227. }
  7228. } else {
  7229. if (prevShapeFlag & 16) {
  7230. if (shapeFlag & 16) {
  7231. patchKeyedChildren(
  7232. c1,
  7233. c2,
  7234. container,
  7235. anchor,
  7236. parentComponent,
  7237. parentSuspense,
  7238. isSVG,
  7239. slotScopeIds,
  7240. optimized
  7241. );
  7242. } else {
  7243. unmountChildren(c1, parentComponent, parentSuspense, true);
  7244. }
  7245. } else {
  7246. if (prevShapeFlag & 8) {
  7247. hostSetElementText(container, "");
  7248. }
  7249. if (shapeFlag & 16) {
  7250. mountChildren(
  7251. c2,
  7252. container,
  7253. anchor,
  7254. parentComponent,
  7255. parentSuspense,
  7256. isSVG,
  7257. slotScopeIds,
  7258. optimized
  7259. );
  7260. }
  7261. }
  7262. }
  7263. };
  7264. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  7265. c1 = c1 || EMPTY_ARR;
  7266. c2 = c2 || EMPTY_ARR;
  7267. const oldLength = c1.length;
  7268. const newLength = c2.length;
  7269. const commonLength = Math.min(oldLength, newLength);
  7270. let i;
  7271. for (i = 0; i < commonLength; i++) {
  7272. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7273. patch(
  7274. c1[i],
  7275. nextChild,
  7276. container,
  7277. null,
  7278. parentComponent,
  7279. parentSuspense,
  7280. isSVG,
  7281. slotScopeIds,
  7282. optimized
  7283. );
  7284. }
  7285. if (oldLength > newLength) {
  7286. unmountChildren(
  7287. c1,
  7288. parentComponent,
  7289. parentSuspense,
  7290. true,
  7291. false,
  7292. commonLength
  7293. );
  7294. } else {
  7295. mountChildren(
  7296. c2,
  7297. container,
  7298. anchor,
  7299. parentComponent,
  7300. parentSuspense,
  7301. isSVG,
  7302. slotScopeIds,
  7303. optimized,
  7304. commonLength
  7305. );
  7306. }
  7307. };
  7308. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  7309. let i = 0;
  7310. const l2 = c2.length;
  7311. let e1 = c1.length - 1;
  7312. let e2 = l2 - 1;
  7313. while (i <= e1 && i <= e2) {
  7314. const n1 = c1[i];
  7315. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7316. if (isSameVNodeType(n1, n2)) {
  7317. patch(
  7318. n1,
  7319. n2,
  7320. container,
  7321. null,
  7322. parentComponent,
  7323. parentSuspense,
  7324. isSVG,
  7325. slotScopeIds,
  7326. optimized
  7327. );
  7328. } else {
  7329. break;
  7330. }
  7331. i++;
  7332. }
  7333. while (i <= e1 && i <= e2) {
  7334. const n1 = c1[e1];
  7335. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7336. if (isSameVNodeType(n1, n2)) {
  7337. patch(
  7338. n1,
  7339. n2,
  7340. container,
  7341. null,
  7342. parentComponent,
  7343. parentSuspense,
  7344. isSVG,
  7345. slotScopeIds,
  7346. optimized
  7347. );
  7348. } else {
  7349. break;
  7350. }
  7351. e1--;
  7352. e2--;
  7353. }
  7354. if (i > e1) {
  7355. if (i <= e2) {
  7356. const nextPos = e2 + 1;
  7357. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7358. while (i <= e2) {
  7359. patch(
  7360. null,
  7361. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  7362. container,
  7363. anchor,
  7364. parentComponent,
  7365. parentSuspense,
  7366. isSVG,
  7367. slotScopeIds,
  7368. optimized
  7369. );
  7370. i++;
  7371. }
  7372. }
  7373. } else if (i > e2) {
  7374. while (i <= e1) {
  7375. unmount(c1[i], parentComponent, parentSuspense, true);
  7376. i++;
  7377. }
  7378. } else {
  7379. const s1 = i;
  7380. const s2 = i;
  7381. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  7382. for (i = s2; i <= e2; i++) {
  7383. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7384. if (nextChild.key != null) {
  7385. if (keyToNewIndexMap.has(nextChild.key)) {
  7386. warn(
  7387. `Duplicate keys found during update:`,
  7388. JSON.stringify(nextChild.key),
  7389. `Make sure keys are unique.`
  7390. );
  7391. }
  7392. keyToNewIndexMap.set(nextChild.key, i);
  7393. }
  7394. }
  7395. let j;
  7396. let patched = 0;
  7397. const toBePatched = e2 - s2 + 1;
  7398. let moved = false;
  7399. let maxNewIndexSoFar = 0;
  7400. const newIndexToOldIndexMap = new Array(toBePatched);
  7401. for (i = 0; i < toBePatched; i++)
  7402. newIndexToOldIndexMap[i] = 0;
  7403. for (i = s1; i <= e1; i++) {
  7404. const prevChild = c1[i];
  7405. if (patched >= toBePatched) {
  7406. unmount(prevChild, parentComponent, parentSuspense, true);
  7407. continue;
  7408. }
  7409. let newIndex;
  7410. if (prevChild.key != null) {
  7411. newIndex = keyToNewIndexMap.get(prevChild.key);
  7412. } else {
  7413. for (j = s2; j <= e2; j++) {
  7414. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7415. newIndex = j;
  7416. break;
  7417. }
  7418. }
  7419. }
  7420. if (newIndex === void 0) {
  7421. unmount(prevChild, parentComponent, parentSuspense, true);
  7422. } else {
  7423. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7424. if (newIndex >= maxNewIndexSoFar) {
  7425. maxNewIndexSoFar = newIndex;
  7426. } else {
  7427. moved = true;
  7428. }
  7429. patch(
  7430. prevChild,
  7431. c2[newIndex],
  7432. container,
  7433. null,
  7434. parentComponent,
  7435. parentSuspense,
  7436. isSVG,
  7437. slotScopeIds,
  7438. optimized
  7439. );
  7440. patched++;
  7441. }
  7442. }
  7443. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7444. j = increasingNewIndexSequence.length - 1;
  7445. for (i = toBePatched - 1; i >= 0; i--) {
  7446. const nextIndex = s2 + i;
  7447. const nextChild = c2[nextIndex];
  7448. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  7449. if (newIndexToOldIndexMap[i] === 0) {
  7450. patch(
  7451. null,
  7452. nextChild,
  7453. container,
  7454. anchor,
  7455. parentComponent,
  7456. parentSuspense,
  7457. isSVG,
  7458. slotScopeIds,
  7459. optimized
  7460. );
  7461. } else if (moved) {
  7462. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7463. move(nextChild, container, anchor, 2);
  7464. } else {
  7465. j--;
  7466. }
  7467. }
  7468. }
  7469. }
  7470. };
  7471. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  7472. const { el, type, transition, children, shapeFlag } = vnode;
  7473. if (shapeFlag & 6) {
  7474. move(vnode.component.subTree, container, anchor, moveType);
  7475. return;
  7476. }
  7477. if (shapeFlag & 128) {
  7478. vnode.suspense.move(container, anchor, moveType);
  7479. return;
  7480. }
  7481. if (shapeFlag & 64) {
  7482. type.move(vnode, container, anchor, internals);
  7483. return;
  7484. }
  7485. if (type === Fragment) {
  7486. hostInsert(el, container, anchor);
  7487. for (let i = 0; i < children.length; i++) {
  7488. move(children[i], container, anchor, moveType);
  7489. }
  7490. hostInsert(vnode.anchor, container, anchor);
  7491. return;
  7492. }
  7493. if (type === Static) {
  7494. moveStaticNode(vnode, container, anchor);
  7495. return;
  7496. }
  7497. const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
  7498. if (needTransition) {
  7499. if (moveType === 0) {
  7500. transition.beforeEnter(el);
  7501. hostInsert(el, container, anchor);
  7502. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7503. } else {
  7504. const { leave, delayLeave, afterLeave } = transition;
  7505. const remove2 = () => hostInsert(el, container, anchor);
  7506. const performLeave = () => {
  7507. leave(el, () => {
  7508. remove2();
  7509. afterLeave && afterLeave();
  7510. });
  7511. };
  7512. if (delayLeave) {
  7513. delayLeave(el, remove2, performLeave);
  7514. } else {
  7515. performLeave();
  7516. }
  7517. }
  7518. } else {
  7519. hostInsert(el, container, anchor);
  7520. }
  7521. };
  7522. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  7523. const {
  7524. type,
  7525. props,
  7526. ref,
  7527. children,
  7528. dynamicChildren,
  7529. shapeFlag,
  7530. patchFlag,
  7531. dirs
  7532. } = vnode;
  7533. if (ref != null) {
  7534. setRef(ref, null, parentSuspense, vnode, true);
  7535. }
  7536. if (shapeFlag & 256) {
  7537. parentComponent.ctx.deactivate(vnode);
  7538. return;
  7539. }
  7540. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  7541. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  7542. let vnodeHook;
  7543. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  7544. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7545. }
  7546. if (shapeFlag & 6) {
  7547. unmountComponent(vnode.component, parentSuspense, doRemove);
  7548. } else {
  7549. if (shapeFlag & 128) {
  7550. vnode.suspense.unmount(parentSuspense, doRemove);
  7551. return;
  7552. }
  7553. if (shouldInvokeDirs) {
  7554. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  7555. }
  7556. if (shapeFlag & 64) {
  7557. vnode.type.remove(
  7558. vnode,
  7559. parentComponent,
  7560. parentSuspense,
  7561. optimized,
  7562. internals,
  7563. doRemove
  7564. );
  7565. } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7566. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7567. unmountChildren(
  7568. dynamicChildren,
  7569. parentComponent,
  7570. parentSuspense,
  7571. false,
  7572. true
  7573. );
  7574. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7575. unmountChildren(children, parentComponent, parentSuspense);
  7576. }
  7577. if (doRemove) {
  7578. remove(vnode);
  7579. }
  7580. }
  7581. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7582. queuePostRenderEffect(() => {
  7583. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7584. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  7585. }, parentSuspense);
  7586. }
  7587. };
  7588. const remove = (vnode) => {
  7589. const { type, el, anchor, transition } = vnode;
  7590. if (type === Fragment) {
  7591. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  7592. vnode.children.forEach((child) => {
  7593. if (child.type === Comment) {
  7594. hostRemove(child.el);
  7595. } else {
  7596. remove(child);
  7597. }
  7598. });
  7599. } else {
  7600. removeFragment(el, anchor);
  7601. }
  7602. return;
  7603. }
  7604. if (type === Static) {
  7605. removeStaticNode(vnode);
  7606. return;
  7607. }
  7608. const performRemove = () => {
  7609. hostRemove(el);
  7610. if (transition && !transition.persisted && transition.afterLeave) {
  7611. transition.afterLeave();
  7612. }
  7613. };
  7614. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  7615. const { leave, delayLeave } = transition;
  7616. const performLeave = () => leave(el, performRemove);
  7617. if (delayLeave) {
  7618. delayLeave(vnode.el, performRemove, performLeave);
  7619. } else {
  7620. performLeave();
  7621. }
  7622. } else {
  7623. performRemove();
  7624. }
  7625. };
  7626. const removeFragment = (cur, end) => {
  7627. let next;
  7628. while (cur !== end) {
  7629. next = hostNextSibling(cur);
  7630. hostRemove(cur);
  7631. cur = next;
  7632. }
  7633. hostRemove(end);
  7634. };
  7635. const unmountComponent = (instance, parentSuspense, doRemove) => {
  7636. if (instance.type.__hmrId) {
  7637. unregisterHMR(instance);
  7638. }
  7639. const { bum, scope, update, subTree, um } = instance;
  7640. if (bum) {
  7641. invokeArrayFns(bum);
  7642. }
  7643. scope.stop();
  7644. if (update) {
  7645. update.active = false;
  7646. unmount(subTree, instance, parentSuspense, doRemove);
  7647. }
  7648. if (um) {
  7649. queuePostRenderEffect(um, parentSuspense);
  7650. }
  7651. queuePostRenderEffect(() => {
  7652. instance.isUnmounted = true;
  7653. }, parentSuspense);
  7654. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  7655. parentSuspense.deps--;
  7656. if (parentSuspense.deps === 0) {
  7657. parentSuspense.resolve();
  7658. }
  7659. }
  7660. {
  7661. devtoolsComponentRemoved(instance);
  7662. }
  7663. };
  7664. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  7665. for (let i = start; i < children.length; i++) {
  7666. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  7667. }
  7668. };
  7669. const getNextHostNode = (vnode) => {
  7670. if (vnode.shapeFlag & 6) {
  7671. return getNextHostNode(vnode.component.subTree);
  7672. }
  7673. if (vnode.shapeFlag & 128) {
  7674. return vnode.suspense.next();
  7675. }
  7676. return hostNextSibling(vnode.anchor || vnode.el);
  7677. };
  7678. const render = (vnode, container, isSVG) => {
  7679. if (vnode == null) {
  7680. if (container._vnode) {
  7681. unmount(container._vnode, null, null, true);
  7682. }
  7683. } else {
  7684. patch(container._vnode || null, vnode, container, null, null, null, isSVG);
  7685. }
  7686. flushPreFlushCbs();
  7687. flushPostFlushCbs();
  7688. container._vnode = vnode;
  7689. };
  7690. const internals = {
  7691. p: patch,
  7692. um: unmount,
  7693. m: move,
  7694. r: remove,
  7695. mt: mountComponent,
  7696. mc: mountChildren,
  7697. pc: patchChildren,
  7698. pbc: patchBlockChildren,
  7699. n: getNextHostNode,
  7700. o: options
  7701. };
  7702. let hydrate;
  7703. let hydrateNode;
  7704. if (createHydrationFns) {
  7705. [hydrate, hydrateNode] = createHydrationFns(
  7706. internals
  7707. );
  7708. }
  7709. return {
  7710. render,
  7711. hydrate,
  7712. createApp: createAppAPI(render, hydrate)
  7713. };
  7714. }
  7715. function toggleRecurse({ effect, update }, allowed) {
  7716. effect.allowRecurse = update.allowRecurse = allowed;
  7717. }
  7718. function traverseStaticChildren(n1, n2, shallow = false) {
  7719. const ch1 = n1.children;
  7720. const ch2 = n2.children;
  7721. if (isArray(ch1) && isArray(ch2)) {
  7722. for (let i = 0; i < ch1.length; i++) {
  7723. const c1 = ch1[i];
  7724. let c2 = ch2[i];
  7725. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  7726. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  7727. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  7728. c2.el = c1.el;
  7729. }
  7730. if (!shallow)
  7731. traverseStaticChildren(c1, c2);
  7732. }
  7733. if (c2.type === Text) {
  7734. c2.el = c1.el;
  7735. }
  7736. if (c2.type === Comment && !c2.el) {
  7737. c2.el = c1.el;
  7738. }
  7739. }
  7740. }
  7741. }
  7742. function getSequence(arr) {
  7743. const p = arr.slice();
  7744. const result = [0];
  7745. let i, j, u, v, c;
  7746. const len = arr.length;
  7747. for (i = 0; i < len; i++) {
  7748. const arrI = arr[i];
  7749. if (arrI !== 0) {
  7750. j = result[result.length - 1];
  7751. if (arr[j] < arrI) {
  7752. p[i] = j;
  7753. result.push(i);
  7754. continue;
  7755. }
  7756. u = 0;
  7757. v = result.length - 1;
  7758. while (u < v) {
  7759. c = u + v >> 1;
  7760. if (arr[result[c]] < arrI) {
  7761. u = c + 1;
  7762. } else {
  7763. v = c;
  7764. }
  7765. }
  7766. if (arrI < arr[result[u]]) {
  7767. if (u > 0) {
  7768. p[i] = result[u - 1];
  7769. }
  7770. result[u] = i;
  7771. }
  7772. }
  7773. }
  7774. u = result.length;
  7775. v = result[u - 1];
  7776. while (u-- > 0) {
  7777. result[u] = v;
  7778. v = p[v];
  7779. }
  7780. return result;
  7781. }
  7782. const isTeleport = (type) => type.__isTeleport;
  7783. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  7784. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  7785. const resolveTarget = (props, select) => {
  7786. const targetSelector = props && props.to;
  7787. if (isString(targetSelector)) {
  7788. if (!select) {
  7789. warn(
  7790. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  7791. );
  7792. return null;
  7793. } else {
  7794. const target = select(targetSelector);
  7795. if (!target) {
  7796. warn(
  7797. `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.`
  7798. );
  7799. }
  7800. return target;
  7801. }
  7802. } else {
  7803. if (!targetSelector && !isTeleportDisabled(props)) {
  7804. warn(`Invalid Teleport target: ${targetSelector}`);
  7805. }
  7806. return targetSelector;
  7807. }
  7808. };
  7809. const TeleportImpl = {
  7810. __isTeleport: true,
  7811. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
  7812. const {
  7813. mc: mountChildren,
  7814. pc: patchChildren,
  7815. pbc: patchBlockChildren,
  7816. o: { insert, querySelector, createText, createComment }
  7817. } = internals;
  7818. const disabled = isTeleportDisabled(n2.props);
  7819. let { shapeFlag, children, dynamicChildren } = n2;
  7820. if (isHmrUpdating) {
  7821. optimized = false;
  7822. dynamicChildren = null;
  7823. }
  7824. if (n1 == null) {
  7825. const placeholder = n2.el = createComment("teleport start") ;
  7826. const mainAnchor = n2.anchor = createComment("teleport end") ;
  7827. insert(placeholder, container, anchor);
  7828. insert(mainAnchor, container, anchor);
  7829. const target = n2.target = resolveTarget(n2.props, querySelector);
  7830. const targetAnchor = n2.targetAnchor = createText("");
  7831. if (target) {
  7832. insert(targetAnchor, target);
  7833. isSVG = isSVG || isTargetSVG(target);
  7834. } else if (!disabled) {
  7835. warn("Invalid Teleport target on mount:", target, `(${typeof target})`);
  7836. }
  7837. const mount = (container2, anchor2) => {
  7838. if (shapeFlag & 16) {
  7839. mountChildren(
  7840. children,
  7841. container2,
  7842. anchor2,
  7843. parentComponent,
  7844. parentSuspense,
  7845. isSVG,
  7846. slotScopeIds,
  7847. optimized
  7848. );
  7849. }
  7850. };
  7851. if (disabled) {
  7852. mount(container, mainAnchor);
  7853. } else if (target) {
  7854. mount(target, targetAnchor);
  7855. }
  7856. } else {
  7857. n2.el = n1.el;
  7858. const mainAnchor = n2.anchor = n1.anchor;
  7859. const target = n2.target = n1.target;
  7860. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  7861. const wasDisabled = isTeleportDisabled(n1.props);
  7862. const currentContainer = wasDisabled ? container : target;
  7863. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  7864. isSVG = isSVG || isTargetSVG(target);
  7865. if (dynamicChildren) {
  7866. patchBlockChildren(
  7867. n1.dynamicChildren,
  7868. dynamicChildren,
  7869. currentContainer,
  7870. parentComponent,
  7871. parentSuspense,
  7872. isSVG,
  7873. slotScopeIds
  7874. );
  7875. traverseStaticChildren(n1, n2, true);
  7876. } else if (!optimized) {
  7877. patchChildren(
  7878. n1,
  7879. n2,
  7880. currentContainer,
  7881. currentAnchor,
  7882. parentComponent,
  7883. parentSuspense,
  7884. isSVG,
  7885. slotScopeIds,
  7886. false
  7887. );
  7888. }
  7889. if (disabled) {
  7890. if (!wasDisabled) {
  7891. moveTeleport(
  7892. n2,
  7893. container,
  7894. mainAnchor,
  7895. internals,
  7896. 1
  7897. );
  7898. }
  7899. } else {
  7900. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  7901. const nextTarget = n2.target = resolveTarget(
  7902. n2.props,
  7903. querySelector
  7904. );
  7905. if (nextTarget) {
  7906. moveTeleport(
  7907. n2,
  7908. nextTarget,
  7909. null,
  7910. internals,
  7911. 0
  7912. );
  7913. } else {
  7914. warn(
  7915. "Invalid Teleport target on update:",
  7916. target,
  7917. `(${typeof target})`
  7918. );
  7919. }
  7920. } else if (wasDisabled) {
  7921. moveTeleport(
  7922. n2,
  7923. target,
  7924. targetAnchor,
  7925. internals,
  7926. 1
  7927. );
  7928. }
  7929. }
  7930. }
  7931. updateCssVars(n2);
  7932. },
  7933. remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  7934. const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
  7935. if (target) {
  7936. hostRemove(targetAnchor);
  7937. }
  7938. if (doRemove || !isTeleportDisabled(props)) {
  7939. hostRemove(anchor);
  7940. if (shapeFlag & 16) {
  7941. for (let i = 0; i < children.length; i++) {
  7942. const child = children[i];
  7943. unmount(
  7944. child,
  7945. parentComponent,
  7946. parentSuspense,
  7947. true,
  7948. !!child.dynamicChildren
  7949. );
  7950. }
  7951. }
  7952. }
  7953. },
  7954. move: moveTeleport,
  7955. hydrate: hydrateTeleport
  7956. };
  7957. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  7958. if (moveType === 0) {
  7959. insert(vnode.targetAnchor, container, parentAnchor);
  7960. }
  7961. const { el, anchor, shapeFlag, children, props } = vnode;
  7962. const isReorder = moveType === 2;
  7963. if (isReorder) {
  7964. insert(el, container, parentAnchor);
  7965. }
  7966. if (!isReorder || isTeleportDisabled(props)) {
  7967. if (shapeFlag & 16) {
  7968. for (let i = 0; i < children.length; i++) {
  7969. move(
  7970. children[i],
  7971. container,
  7972. parentAnchor,
  7973. 2
  7974. );
  7975. }
  7976. }
  7977. }
  7978. if (isReorder) {
  7979. insert(anchor, container, parentAnchor);
  7980. }
  7981. }
  7982. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  7983. o: { nextSibling, parentNode, querySelector }
  7984. }, hydrateChildren) {
  7985. const target = vnode.target = resolveTarget(
  7986. vnode.props,
  7987. querySelector
  7988. );
  7989. if (target) {
  7990. const targetNode = target._lpa || target.firstChild;
  7991. if (vnode.shapeFlag & 16) {
  7992. if (isTeleportDisabled(vnode.props)) {
  7993. vnode.anchor = hydrateChildren(
  7994. nextSibling(node),
  7995. vnode,
  7996. parentNode(node),
  7997. parentComponent,
  7998. parentSuspense,
  7999. slotScopeIds,
  8000. optimized
  8001. );
  8002. vnode.targetAnchor = targetNode;
  8003. } else {
  8004. vnode.anchor = nextSibling(node);
  8005. let targetAnchor = targetNode;
  8006. while (targetAnchor) {
  8007. targetAnchor = nextSibling(targetAnchor);
  8008. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
  8009. vnode.targetAnchor = targetAnchor;
  8010. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  8011. break;
  8012. }
  8013. }
  8014. hydrateChildren(
  8015. targetNode,
  8016. vnode,
  8017. target,
  8018. parentComponent,
  8019. parentSuspense,
  8020. slotScopeIds,
  8021. optimized
  8022. );
  8023. }
  8024. }
  8025. updateCssVars(vnode);
  8026. }
  8027. return vnode.anchor && nextSibling(vnode.anchor);
  8028. }
  8029. const Teleport = TeleportImpl;
  8030. function updateCssVars(vnode) {
  8031. const ctx = vnode.ctx;
  8032. if (ctx && ctx.ut) {
  8033. let node = vnode.children[0].el;
  8034. while (node !== vnode.targetAnchor) {
  8035. if (node.nodeType === 1)
  8036. node.setAttribute("data-v-owner", ctx.uid);
  8037. node = node.nextSibling;
  8038. }
  8039. ctx.ut();
  8040. }
  8041. }
  8042. const Fragment = Symbol.for("v-fgt");
  8043. const Text = Symbol.for("v-txt");
  8044. const Comment = Symbol.for("v-cmt");
  8045. const Static = Symbol.for("v-stc");
  8046. const blockStack = [];
  8047. let currentBlock = null;
  8048. function openBlock(disableTracking = false) {
  8049. blockStack.push(currentBlock = disableTracking ? null : []);
  8050. }
  8051. function closeBlock() {
  8052. blockStack.pop();
  8053. currentBlock = blockStack[blockStack.length - 1] || null;
  8054. }
  8055. let isBlockTreeEnabled = 1;
  8056. function setBlockTracking(value) {
  8057. isBlockTreeEnabled += value;
  8058. }
  8059. function setupBlock(vnode) {
  8060. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  8061. closeBlock();
  8062. if (isBlockTreeEnabled > 0 && currentBlock) {
  8063. currentBlock.push(vnode);
  8064. }
  8065. return vnode;
  8066. }
  8067. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  8068. return setupBlock(
  8069. createBaseVNode(
  8070. type,
  8071. props,
  8072. children,
  8073. patchFlag,
  8074. dynamicProps,
  8075. shapeFlag,
  8076. true
  8077. /* isBlock */
  8078. )
  8079. );
  8080. }
  8081. function createBlock(type, props, children, patchFlag, dynamicProps) {
  8082. return setupBlock(
  8083. createVNode(
  8084. type,
  8085. props,
  8086. children,
  8087. patchFlag,
  8088. dynamicProps,
  8089. true
  8090. /* isBlock: prevent a block from tracking itself */
  8091. )
  8092. );
  8093. }
  8094. function isVNode(value) {
  8095. return value ? value.__v_isVNode === true : false;
  8096. }
  8097. function isSameVNodeType(n1, n2) {
  8098. if (n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
  8099. n1.shapeFlag &= ~256;
  8100. n2.shapeFlag &= ~512;
  8101. return false;
  8102. }
  8103. return n1.type === n2.type && n1.key === n2.key;
  8104. }
  8105. let vnodeArgsTransformer;
  8106. function transformVNodeArgs(transformer) {
  8107. vnodeArgsTransformer = transformer;
  8108. }
  8109. const createVNodeWithArgsTransform = (...args) => {
  8110. return _createVNode(
  8111. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  8112. );
  8113. };
  8114. const InternalObjectKey = `__vInternal`;
  8115. const normalizeKey = ({ key }) => key != null ? key : null;
  8116. const normalizeRef = ({
  8117. ref,
  8118. ref_key,
  8119. ref_for
  8120. }) => {
  8121. if (typeof ref === "number") {
  8122. ref = "" + ref;
  8123. }
  8124. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  8125. };
  8126. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  8127. const vnode = {
  8128. __v_isVNode: true,
  8129. __v_skip: true,
  8130. type,
  8131. props,
  8132. key: props && normalizeKey(props),
  8133. ref: props && normalizeRef(props),
  8134. scopeId: currentScopeId,
  8135. slotScopeIds: null,
  8136. children,
  8137. component: null,
  8138. suspense: null,
  8139. ssContent: null,
  8140. ssFallback: null,
  8141. dirs: null,
  8142. transition: null,
  8143. el: null,
  8144. anchor: null,
  8145. target: null,
  8146. targetAnchor: null,
  8147. staticCount: 0,
  8148. shapeFlag,
  8149. patchFlag,
  8150. dynamicProps,
  8151. dynamicChildren: null,
  8152. appContext: null,
  8153. ctx: currentRenderingInstance
  8154. };
  8155. if (needFullChildrenNormalization) {
  8156. normalizeChildren(vnode, children);
  8157. if (shapeFlag & 128) {
  8158. type.normalize(vnode);
  8159. }
  8160. } else if (children) {
  8161. vnode.shapeFlag |= isString(children) ? 8 : 16;
  8162. }
  8163. if (vnode.key !== vnode.key) {
  8164. warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  8165. }
  8166. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  8167. !isBlockNode && // has current parent block
  8168. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  8169. // component nodes also should always be patched, because even if the
  8170. // component doesn't need to update, it needs to persist the instance on to
  8171. // the next vnode so that it can be properly unmounted later.
  8172. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  8173. // vnode should not be considered dynamic due to handler caching.
  8174. vnode.patchFlag !== 32) {
  8175. currentBlock.push(vnode);
  8176. }
  8177. return vnode;
  8178. }
  8179. const createVNode = createVNodeWithArgsTransform ;
  8180. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  8181. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  8182. if (!type) {
  8183. warn(`Invalid vnode type when creating vnode: ${type}.`);
  8184. }
  8185. type = Comment;
  8186. }
  8187. if (isVNode(type)) {
  8188. const cloned = cloneVNode(
  8189. type,
  8190. props,
  8191. true
  8192. /* mergeRef: true */
  8193. );
  8194. if (children) {
  8195. normalizeChildren(cloned, children);
  8196. }
  8197. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  8198. if (cloned.shapeFlag & 6) {
  8199. currentBlock[currentBlock.indexOf(type)] = cloned;
  8200. } else {
  8201. currentBlock.push(cloned);
  8202. }
  8203. }
  8204. cloned.patchFlag |= -2;
  8205. return cloned;
  8206. }
  8207. if (isClassComponent(type)) {
  8208. type = type.__vccOpts;
  8209. }
  8210. if (props) {
  8211. props = guardReactiveProps(props);
  8212. let { class: klass, style } = props;
  8213. if (klass && !isString(klass)) {
  8214. props.class = normalizeClass(klass);
  8215. }
  8216. if (isObject(style)) {
  8217. if (isProxy(style) && !isArray(style)) {
  8218. style = extend({}, style);
  8219. }
  8220. props.style = normalizeStyle(style);
  8221. }
  8222. }
  8223. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  8224. if (shapeFlag & 4 && isProxy(type)) {
  8225. type = toRaw(type);
  8226. warn(
  8227. `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
  8228. `
  8229. Component that was made reactive: `,
  8230. type
  8231. );
  8232. }
  8233. return createBaseVNode(
  8234. type,
  8235. props,
  8236. children,
  8237. patchFlag,
  8238. dynamicProps,
  8239. shapeFlag,
  8240. isBlockNode,
  8241. true
  8242. );
  8243. }
  8244. function guardReactiveProps(props) {
  8245. if (!props)
  8246. return null;
  8247. return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
  8248. }
  8249. function cloneVNode(vnode, extraProps, mergeRef = false) {
  8250. const { props, ref, patchFlag, children } = vnode;
  8251. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  8252. const cloned = {
  8253. __v_isVNode: true,
  8254. __v_skip: true,
  8255. type: vnode.type,
  8256. props: mergedProps,
  8257. key: mergedProps && normalizeKey(mergedProps),
  8258. ref: extraProps && extraProps.ref ? (
  8259. // #2078 in the case of <component :is="vnode" ref="extra"/>
  8260. // if the vnode itself already has a ref, cloneVNode will need to merge
  8261. // the refs so the single vnode can be set on multiple refs
  8262. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  8263. ) : ref,
  8264. scopeId: vnode.scopeId,
  8265. slotScopeIds: vnode.slotScopeIds,
  8266. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  8267. target: vnode.target,
  8268. targetAnchor: vnode.targetAnchor,
  8269. staticCount: vnode.staticCount,
  8270. shapeFlag: vnode.shapeFlag,
  8271. // if the vnode is cloned with extra props, we can no longer assume its
  8272. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  8273. // note: preserve flag for fragments since they use the flag for children
  8274. // fast paths only.
  8275. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  8276. dynamicProps: vnode.dynamicProps,
  8277. dynamicChildren: vnode.dynamicChildren,
  8278. appContext: vnode.appContext,
  8279. dirs: vnode.dirs,
  8280. transition: vnode.transition,
  8281. // These should technically only be non-null on mounted VNodes. However,
  8282. // they *should* be copied for kept-alive vnodes. So we just always copy
  8283. // them since them being non-null during a mount doesn't affect the logic as
  8284. // they will simply be overwritten.
  8285. component: vnode.component,
  8286. suspense: vnode.suspense,
  8287. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  8288. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  8289. el: vnode.el,
  8290. anchor: vnode.anchor,
  8291. ctx: vnode.ctx,
  8292. ce: vnode.ce
  8293. };
  8294. return cloned;
  8295. }
  8296. function deepCloneVNode(vnode) {
  8297. const cloned = cloneVNode(vnode);
  8298. if (isArray(vnode.children)) {
  8299. cloned.children = vnode.children.map(deepCloneVNode);
  8300. }
  8301. return cloned;
  8302. }
  8303. function createTextVNode(text = " ", flag = 0) {
  8304. return createVNode(Text, null, text, flag);
  8305. }
  8306. function createStaticVNode(content, numberOfNodes) {
  8307. const vnode = createVNode(Static, null, content);
  8308. vnode.staticCount = numberOfNodes;
  8309. return vnode;
  8310. }
  8311. function createCommentVNode(text = "", asBlock = false) {
  8312. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  8313. }
  8314. function normalizeVNode(child) {
  8315. if (child == null || typeof child === "boolean") {
  8316. return createVNode(Comment);
  8317. } else if (isArray(child)) {
  8318. return createVNode(
  8319. Fragment,
  8320. null,
  8321. // #3666, avoid reference pollution when reusing vnode
  8322. child.slice()
  8323. );
  8324. } else if (typeof child === "object") {
  8325. return cloneIfMounted(child);
  8326. } else {
  8327. return createVNode(Text, null, String(child));
  8328. }
  8329. }
  8330. function cloneIfMounted(child) {
  8331. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  8332. }
  8333. function normalizeChildren(vnode, children) {
  8334. let type = 0;
  8335. const { shapeFlag } = vnode;
  8336. if (children == null) {
  8337. children = null;
  8338. } else if (isArray(children)) {
  8339. type = 16;
  8340. } else if (typeof children === "object") {
  8341. if (shapeFlag & (1 | 64)) {
  8342. const slot = children.default;
  8343. if (slot) {
  8344. slot._c && (slot._d = false);
  8345. normalizeChildren(vnode, slot());
  8346. slot._c && (slot._d = true);
  8347. }
  8348. return;
  8349. } else {
  8350. type = 32;
  8351. const slotFlag = children._;
  8352. if (!slotFlag && !(InternalObjectKey in children)) {
  8353. children._ctx = currentRenderingInstance;
  8354. } else if (slotFlag === 3 && currentRenderingInstance) {
  8355. if (currentRenderingInstance.slots._ === 1) {
  8356. children._ = 1;
  8357. } else {
  8358. children._ = 2;
  8359. vnode.patchFlag |= 1024;
  8360. }
  8361. }
  8362. }
  8363. } else if (isFunction(children)) {
  8364. children = { default: children, _ctx: currentRenderingInstance };
  8365. type = 32;
  8366. } else {
  8367. children = String(children);
  8368. if (shapeFlag & 64) {
  8369. type = 16;
  8370. children = [createTextVNode(children)];
  8371. } else {
  8372. type = 8;
  8373. }
  8374. }
  8375. vnode.children = children;
  8376. vnode.shapeFlag |= type;
  8377. }
  8378. function mergeProps(...args) {
  8379. const ret = {};
  8380. for (let i = 0; i < args.length; i++) {
  8381. const toMerge = args[i];
  8382. for (const key in toMerge) {
  8383. if (key === "class") {
  8384. if (ret.class !== toMerge.class) {
  8385. ret.class = normalizeClass([ret.class, toMerge.class]);
  8386. }
  8387. } else if (key === "style") {
  8388. ret.style = normalizeStyle([ret.style, toMerge.style]);
  8389. } else if (isOn(key)) {
  8390. const existing = ret[key];
  8391. const incoming = toMerge[key];
  8392. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  8393. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  8394. }
  8395. } else if (key !== "") {
  8396. ret[key] = toMerge[key];
  8397. }
  8398. }
  8399. }
  8400. return ret;
  8401. }
  8402. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  8403. callWithAsyncErrorHandling(hook, instance, 7, [
  8404. vnode,
  8405. prevVNode
  8406. ]);
  8407. }
  8408. const emptyAppContext = createAppContext();
  8409. let uid = 0;
  8410. function createComponentInstance(vnode, parent, suspense) {
  8411. const type = vnode.type;
  8412. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  8413. const instance = {
  8414. uid: uid++,
  8415. vnode,
  8416. type,
  8417. parent,
  8418. appContext,
  8419. root: null,
  8420. // to be immediately set
  8421. next: null,
  8422. subTree: null,
  8423. // will be set synchronously right after creation
  8424. effect: null,
  8425. update: null,
  8426. // will be set synchronously right after creation
  8427. scope: new EffectScope(
  8428. true
  8429. /* detached */
  8430. ),
  8431. render: null,
  8432. proxy: null,
  8433. exposed: null,
  8434. exposeProxy: null,
  8435. withProxy: null,
  8436. provides: parent ? parent.provides : Object.create(appContext.provides),
  8437. accessCache: null,
  8438. renderCache: [],
  8439. // local resolved assets
  8440. components: null,
  8441. directives: null,
  8442. // resolved props and emits options
  8443. propsOptions: normalizePropsOptions(type, appContext),
  8444. emitsOptions: normalizeEmitsOptions(type, appContext),
  8445. // emit
  8446. emit: null,
  8447. // to be set immediately
  8448. emitted: null,
  8449. // props default value
  8450. propsDefaults: EMPTY_OBJ,
  8451. // inheritAttrs
  8452. inheritAttrs: type.inheritAttrs,
  8453. // state
  8454. ctx: EMPTY_OBJ,
  8455. data: EMPTY_OBJ,
  8456. props: EMPTY_OBJ,
  8457. attrs: EMPTY_OBJ,
  8458. slots: EMPTY_OBJ,
  8459. refs: EMPTY_OBJ,
  8460. setupState: EMPTY_OBJ,
  8461. setupContext: null,
  8462. attrsProxy: null,
  8463. slotsProxy: null,
  8464. // suspense related
  8465. suspense,
  8466. suspenseId: suspense ? suspense.pendingId : 0,
  8467. asyncDep: null,
  8468. asyncResolved: false,
  8469. // lifecycle hooks
  8470. // not using enums here because it results in computed properties
  8471. isMounted: false,
  8472. isUnmounted: false,
  8473. isDeactivated: false,
  8474. bc: null,
  8475. c: null,
  8476. bm: null,
  8477. m: null,
  8478. bu: null,
  8479. u: null,
  8480. um: null,
  8481. bum: null,
  8482. da: null,
  8483. a: null,
  8484. rtg: null,
  8485. rtc: null,
  8486. ec: null,
  8487. sp: null
  8488. };
  8489. {
  8490. instance.ctx = createDevRenderContext(instance);
  8491. }
  8492. instance.root = parent ? parent.root : instance;
  8493. instance.emit = emit.bind(null, instance);
  8494. if (vnode.ce) {
  8495. vnode.ce(instance);
  8496. }
  8497. return instance;
  8498. }
  8499. let currentInstance = null;
  8500. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  8501. let internalSetCurrentInstance;
  8502. {
  8503. internalSetCurrentInstance = (i) => {
  8504. currentInstance = i;
  8505. };
  8506. }
  8507. const setCurrentInstance = (instance) => {
  8508. internalSetCurrentInstance(instance);
  8509. instance.scope.on();
  8510. };
  8511. const unsetCurrentInstance = () => {
  8512. currentInstance && currentInstance.scope.off();
  8513. internalSetCurrentInstance(null);
  8514. };
  8515. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  8516. function validateComponentName(name, config) {
  8517. const appIsNativeTag = config.isNativeTag || NO;
  8518. if (isBuiltInTag(name) || appIsNativeTag(name)) {
  8519. warn(
  8520. "Do not use built-in or reserved HTML elements as component id: " + name
  8521. );
  8522. }
  8523. }
  8524. function isStatefulComponent(instance) {
  8525. return instance.vnode.shapeFlag & 4;
  8526. }
  8527. let isInSSRComponentSetup = false;
  8528. function setupComponent(instance, isSSR = false) {
  8529. isInSSRComponentSetup = isSSR;
  8530. const { props, children } = instance.vnode;
  8531. const isStateful = isStatefulComponent(instance);
  8532. initProps(instance, props, isStateful, isSSR);
  8533. initSlots(instance, children);
  8534. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  8535. isInSSRComponentSetup = false;
  8536. return setupResult;
  8537. }
  8538. function setupStatefulComponent(instance, isSSR) {
  8539. var _a;
  8540. const Component = instance.type;
  8541. {
  8542. if (Component.name) {
  8543. validateComponentName(Component.name, instance.appContext.config);
  8544. }
  8545. if (Component.components) {
  8546. const names = Object.keys(Component.components);
  8547. for (let i = 0; i < names.length; i++) {
  8548. validateComponentName(names[i], instance.appContext.config);
  8549. }
  8550. }
  8551. if (Component.directives) {
  8552. const names = Object.keys(Component.directives);
  8553. for (let i = 0; i < names.length; i++) {
  8554. validateDirectiveName(names[i]);
  8555. }
  8556. }
  8557. if (Component.compilerOptions && isRuntimeOnly()) {
  8558. warn(
  8559. `"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.`
  8560. );
  8561. }
  8562. }
  8563. instance.accessCache = /* @__PURE__ */ Object.create(null);
  8564. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  8565. {
  8566. exposePropsOnRenderContext(instance);
  8567. }
  8568. const { setup } = Component;
  8569. if (setup) {
  8570. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  8571. setCurrentInstance(instance);
  8572. pauseTracking();
  8573. const setupResult = callWithErrorHandling(
  8574. setup,
  8575. instance,
  8576. 0,
  8577. [shallowReadonly(instance.props) , setupContext]
  8578. );
  8579. resetTracking();
  8580. unsetCurrentInstance();
  8581. if (isPromise(setupResult)) {
  8582. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  8583. if (isSSR) {
  8584. return setupResult.then((resolvedResult) => {
  8585. handleSetupResult(instance, resolvedResult, isSSR);
  8586. }).catch((e) => {
  8587. handleError(e, instance, 0);
  8588. });
  8589. } else {
  8590. instance.asyncDep = setupResult;
  8591. if (!instance.suspense) {
  8592. const name = (_a = Component.name) != null ? _a : "Anonymous";
  8593. warn(
  8594. `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.`
  8595. );
  8596. }
  8597. }
  8598. } else {
  8599. handleSetupResult(instance, setupResult, isSSR);
  8600. }
  8601. } else {
  8602. finishComponentSetup(instance, isSSR);
  8603. }
  8604. }
  8605. function handleSetupResult(instance, setupResult, isSSR) {
  8606. if (isFunction(setupResult)) {
  8607. {
  8608. instance.render = setupResult;
  8609. }
  8610. } else if (isObject(setupResult)) {
  8611. if (isVNode(setupResult)) {
  8612. warn(
  8613. `setup() should not return VNodes directly - return a render function instead.`
  8614. );
  8615. }
  8616. {
  8617. instance.devtoolsRawSetupState = setupResult;
  8618. }
  8619. instance.setupState = proxyRefs(setupResult);
  8620. {
  8621. exposeSetupStateOnRenderContext(instance);
  8622. }
  8623. } else if (setupResult !== void 0) {
  8624. warn(
  8625. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  8626. );
  8627. }
  8628. finishComponentSetup(instance, isSSR);
  8629. }
  8630. let compile$1;
  8631. let installWithProxy;
  8632. function registerRuntimeCompiler(_compile) {
  8633. compile$1 = _compile;
  8634. installWithProxy = (i) => {
  8635. if (i.render._rc) {
  8636. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  8637. }
  8638. };
  8639. }
  8640. const isRuntimeOnly = () => !compile$1;
  8641. function finishComponentSetup(instance, isSSR, skipOptions) {
  8642. const Component = instance.type;
  8643. if (!instance.render) {
  8644. if (!isSSR && compile$1 && !Component.render) {
  8645. const template = Component.template || resolveMergedOptions(instance).template;
  8646. if (template) {
  8647. {
  8648. startMeasure(instance, `compile`);
  8649. }
  8650. const { isCustomElement, compilerOptions } = instance.appContext.config;
  8651. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  8652. const finalCompilerOptions = extend(
  8653. extend(
  8654. {
  8655. isCustomElement,
  8656. delimiters
  8657. },
  8658. compilerOptions
  8659. ),
  8660. componentCompilerOptions
  8661. );
  8662. Component.render = compile$1(template, finalCompilerOptions);
  8663. {
  8664. endMeasure(instance, `compile`);
  8665. }
  8666. }
  8667. }
  8668. instance.render = Component.render || NOOP;
  8669. if (installWithProxy) {
  8670. installWithProxy(instance);
  8671. }
  8672. }
  8673. {
  8674. setCurrentInstance(instance);
  8675. pauseTracking();
  8676. applyOptions(instance);
  8677. resetTracking();
  8678. unsetCurrentInstance();
  8679. }
  8680. if (!Component.render && instance.render === NOOP && !isSSR) {
  8681. if (!compile$1 && Component.template) {
  8682. warn(
  8683. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
  8684. /* should not happen */
  8685. );
  8686. } else {
  8687. warn(`Component is missing template or render function.`);
  8688. }
  8689. }
  8690. }
  8691. function getAttrsProxy(instance) {
  8692. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  8693. instance.attrs,
  8694. {
  8695. get(target, key) {
  8696. markAttrsAccessed();
  8697. track(instance, "get", "$attrs");
  8698. return target[key];
  8699. },
  8700. set() {
  8701. warn(`setupContext.attrs is readonly.`);
  8702. return false;
  8703. },
  8704. deleteProperty() {
  8705. warn(`setupContext.attrs is readonly.`);
  8706. return false;
  8707. }
  8708. }
  8709. ));
  8710. }
  8711. function getSlotsProxy(instance) {
  8712. return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
  8713. get(target, key) {
  8714. track(instance, "get", "$slots");
  8715. return target[key];
  8716. }
  8717. }));
  8718. }
  8719. function createSetupContext(instance) {
  8720. const expose = (exposed) => {
  8721. {
  8722. if (instance.exposed) {
  8723. warn(`expose() should be called only once per setup().`);
  8724. }
  8725. if (exposed != null) {
  8726. let exposedType = typeof exposed;
  8727. if (exposedType === "object") {
  8728. if (isArray(exposed)) {
  8729. exposedType = "array";
  8730. } else if (isRef(exposed)) {
  8731. exposedType = "ref";
  8732. }
  8733. }
  8734. if (exposedType !== "object") {
  8735. warn(
  8736. `expose() should be passed a plain object, received ${exposedType}.`
  8737. );
  8738. }
  8739. }
  8740. }
  8741. instance.exposed = exposed || {};
  8742. };
  8743. {
  8744. return Object.freeze({
  8745. get attrs() {
  8746. return getAttrsProxy(instance);
  8747. },
  8748. get slots() {
  8749. return getSlotsProxy(instance);
  8750. },
  8751. get emit() {
  8752. return (event, ...args) => instance.emit(event, ...args);
  8753. },
  8754. expose
  8755. });
  8756. }
  8757. }
  8758. function getExposeProxy(instance) {
  8759. if (instance.exposed) {
  8760. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  8761. get(target, key) {
  8762. if (key in target) {
  8763. return target[key];
  8764. } else if (key in publicPropertiesMap) {
  8765. return publicPropertiesMap[key](instance);
  8766. }
  8767. },
  8768. has(target, key) {
  8769. return key in target || key in publicPropertiesMap;
  8770. }
  8771. }));
  8772. }
  8773. }
  8774. const classifyRE = /(?:^|[-_])(\w)/g;
  8775. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  8776. function getComponentName(Component, includeInferred = true) {
  8777. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  8778. }
  8779. function formatComponentName(instance, Component, isRoot = false) {
  8780. let name = getComponentName(Component);
  8781. if (!name && Component.__file) {
  8782. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  8783. if (match) {
  8784. name = match[1];
  8785. }
  8786. }
  8787. if (!name && instance && instance.parent) {
  8788. const inferFromRegistry = (registry) => {
  8789. for (const key in registry) {
  8790. if (registry[key] === Component) {
  8791. return key;
  8792. }
  8793. }
  8794. };
  8795. name = inferFromRegistry(
  8796. instance.components || instance.parent.type.components
  8797. ) || inferFromRegistry(instance.appContext.components);
  8798. }
  8799. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  8800. }
  8801. function isClassComponent(value) {
  8802. return isFunction(value) && "__vccOpts" in value;
  8803. }
  8804. const computed = (getterOrOptions, debugOptions) => {
  8805. return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  8806. };
  8807. function h(type, propsOrChildren, children) {
  8808. const l = arguments.length;
  8809. if (l === 2) {
  8810. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  8811. if (isVNode(propsOrChildren)) {
  8812. return createVNode(type, null, [propsOrChildren]);
  8813. }
  8814. return createVNode(type, propsOrChildren);
  8815. } else {
  8816. return createVNode(type, null, propsOrChildren);
  8817. }
  8818. } else {
  8819. if (l > 3) {
  8820. children = Array.prototype.slice.call(arguments, 2);
  8821. } else if (l === 3 && isVNode(children)) {
  8822. children = [children];
  8823. }
  8824. return createVNode(type, propsOrChildren, children);
  8825. }
  8826. }
  8827. const ssrContextKey = Symbol.for("v-scx");
  8828. const useSSRContext = () => {
  8829. {
  8830. warn(`useSSRContext() is not supported in the global build.`);
  8831. }
  8832. };
  8833. function initCustomFormatter() {
  8834. if (typeof window === "undefined") {
  8835. return;
  8836. }
  8837. const vueStyle = { style: "color:#3ba776" };
  8838. const numberStyle = { style: "color:#0b1bc9" };
  8839. const stringStyle = { style: "color:#b62e24" };
  8840. const keywordStyle = { style: "color:#9d288c" };
  8841. const formatter = {
  8842. header(obj) {
  8843. if (!isObject(obj)) {
  8844. return null;
  8845. }
  8846. if (obj.__isVue) {
  8847. return ["div", vueStyle, `VueInstance`];
  8848. } else if (isRef(obj)) {
  8849. return [
  8850. "div",
  8851. {},
  8852. ["span", vueStyle, genRefFlag(obj)],
  8853. "<",
  8854. formatValue(obj.value),
  8855. `>`
  8856. ];
  8857. } else if (isReactive(obj)) {
  8858. return [
  8859. "div",
  8860. {},
  8861. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  8862. "<",
  8863. formatValue(obj),
  8864. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  8865. ];
  8866. } else if (isReadonly(obj)) {
  8867. return [
  8868. "div",
  8869. {},
  8870. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  8871. "<",
  8872. formatValue(obj),
  8873. ">"
  8874. ];
  8875. }
  8876. return null;
  8877. },
  8878. hasBody(obj) {
  8879. return obj && obj.__isVue;
  8880. },
  8881. body(obj) {
  8882. if (obj && obj.__isVue) {
  8883. return [
  8884. "div",
  8885. {},
  8886. ...formatInstance(obj.$)
  8887. ];
  8888. }
  8889. }
  8890. };
  8891. function formatInstance(instance) {
  8892. const blocks = [];
  8893. if (instance.type.props && instance.props) {
  8894. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  8895. }
  8896. if (instance.setupState !== EMPTY_OBJ) {
  8897. blocks.push(createInstanceBlock("setup", instance.setupState));
  8898. }
  8899. if (instance.data !== EMPTY_OBJ) {
  8900. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  8901. }
  8902. const computed = extractKeys(instance, "computed");
  8903. if (computed) {
  8904. blocks.push(createInstanceBlock("computed", computed));
  8905. }
  8906. const injected = extractKeys(instance, "inject");
  8907. if (injected) {
  8908. blocks.push(createInstanceBlock("injected", injected));
  8909. }
  8910. blocks.push([
  8911. "div",
  8912. {},
  8913. [
  8914. "span",
  8915. {
  8916. style: keywordStyle.style + ";opacity:0.66"
  8917. },
  8918. "$ (internal): "
  8919. ],
  8920. ["object", { object: instance }]
  8921. ]);
  8922. return blocks;
  8923. }
  8924. function createInstanceBlock(type, target) {
  8925. target = extend({}, target);
  8926. if (!Object.keys(target).length) {
  8927. return ["span", {}];
  8928. }
  8929. return [
  8930. "div",
  8931. { style: "line-height:1.25em;margin-bottom:0.6em" },
  8932. [
  8933. "div",
  8934. {
  8935. style: "color:#476582"
  8936. },
  8937. type
  8938. ],
  8939. [
  8940. "div",
  8941. {
  8942. style: "padding-left:1.25em"
  8943. },
  8944. ...Object.keys(target).map((key) => {
  8945. return [
  8946. "div",
  8947. {},
  8948. ["span", keywordStyle, key + ": "],
  8949. formatValue(target[key], false)
  8950. ];
  8951. })
  8952. ]
  8953. ];
  8954. }
  8955. function formatValue(v, asRaw = true) {
  8956. if (typeof v === "number") {
  8957. return ["span", numberStyle, v];
  8958. } else if (typeof v === "string") {
  8959. return ["span", stringStyle, JSON.stringify(v)];
  8960. } else if (typeof v === "boolean") {
  8961. return ["span", keywordStyle, v];
  8962. } else if (isObject(v)) {
  8963. return ["object", { object: asRaw ? toRaw(v) : v }];
  8964. } else {
  8965. return ["span", stringStyle, String(v)];
  8966. }
  8967. }
  8968. function extractKeys(instance, type) {
  8969. const Comp = instance.type;
  8970. if (isFunction(Comp)) {
  8971. return;
  8972. }
  8973. const extracted = {};
  8974. for (const key in instance.ctx) {
  8975. if (isKeyOfType(Comp, key, type)) {
  8976. extracted[key] = instance.ctx[key];
  8977. }
  8978. }
  8979. return extracted;
  8980. }
  8981. function isKeyOfType(Comp, key, type) {
  8982. const opts = Comp[type];
  8983. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  8984. return true;
  8985. }
  8986. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  8987. return true;
  8988. }
  8989. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  8990. return true;
  8991. }
  8992. }
  8993. function genRefFlag(v) {
  8994. if (isShallow(v)) {
  8995. return `ShallowRef`;
  8996. }
  8997. if (v.effect) {
  8998. return `ComputedRef`;
  8999. }
  9000. return `Ref`;
  9001. }
  9002. if (window.devtoolsFormatters) {
  9003. window.devtoolsFormatters.push(formatter);
  9004. } else {
  9005. window.devtoolsFormatters = [formatter];
  9006. }
  9007. }
  9008. function withMemo(memo, render, cache, index) {
  9009. const cached = cache[index];
  9010. if (cached && isMemoSame(cached, memo)) {
  9011. return cached;
  9012. }
  9013. const ret = render();
  9014. ret.memo = memo.slice();
  9015. return cache[index] = ret;
  9016. }
  9017. function isMemoSame(cached, memo) {
  9018. const prev = cached.memo;
  9019. if (prev.length != memo.length) {
  9020. return false;
  9021. }
  9022. for (let i = 0; i < prev.length; i++) {
  9023. if (hasChanged(prev[i], memo[i])) {
  9024. return false;
  9025. }
  9026. }
  9027. if (isBlockTreeEnabled > 0 && currentBlock) {
  9028. currentBlock.push(cached);
  9029. }
  9030. return true;
  9031. }
  9032. const version = "3.3.4";
  9033. const ssrUtils = null;
  9034. const resolveFilter = null;
  9035. const compatUtils = null;
  9036. const svgNS = "http://www.w3.org/2000/svg";
  9037. const doc = typeof document !== "undefined" ? document : null;
  9038. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  9039. const nodeOps = {
  9040. insert: (child, parent, anchor) => {
  9041. parent.insertBefore(child, anchor || null);
  9042. },
  9043. remove: (child) => {
  9044. const parent = child.parentNode;
  9045. if (parent) {
  9046. parent.removeChild(child);
  9047. }
  9048. },
  9049. createElement: (tag, isSVG, is, props) => {
  9050. const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0);
  9051. if (tag === "select" && props && props.multiple != null) {
  9052. el.setAttribute("multiple", props.multiple);
  9053. }
  9054. return el;
  9055. },
  9056. createText: (text) => doc.createTextNode(text),
  9057. createComment: (text) => doc.createComment(text),
  9058. setText: (node, text) => {
  9059. node.nodeValue = text;
  9060. },
  9061. setElementText: (el, text) => {
  9062. el.textContent = text;
  9063. },
  9064. parentNode: (node) => node.parentNode,
  9065. nextSibling: (node) => node.nextSibling,
  9066. querySelector: (selector) => doc.querySelector(selector),
  9067. setScopeId(el, id) {
  9068. el.setAttribute(id, "");
  9069. },
  9070. // __UNSAFE__
  9071. // Reason: innerHTML.
  9072. // Static content here can only come from compiled templates.
  9073. // As long as the user only uses trusted templates, this is safe.
  9074. insertStaticContent(content, parent, anchor, isSVG, start, end) {
  9075. const before = anchor ? anchor.previousSibling : parent.lastChild;
  9076. if (start && (start === end || start.nextSibling)) {
  9077. while (true) {
  9078. parent.insertBefore(start.cloneNode(true), anchor);
  9079. if (start === end || !(start = start.nextSibling))
  9080. break;
  9081. }
  9082. } else {
  9083. templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
  9084. const template = templateContainer.content;
  9085. if (isSVG) {
  9086. const wrapper = template.firstChild;
  9087. while (wrapper.firstChild) {
  9088. template.appendChild(wrapper.firstChild);
  9089. }
  9090. template.removeChild(wrapper);
  9091. }
  9092. parent.insertBefore(template, anchor);
  9093. }
  9094. return [
  9095. // first
  9096. before ? before.nextSibling : parent.firstChild,
  9097. // last
  9098. anchor ? anchor.previousSibling : parent.lastChild
  9099. ];
  9100. }
  9101. };
  9102. function patchClass(el, value, isSVG) {
  9103. const transitionClasses = el._vtc;
  9104. if (transitionClasses) {
  9105. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  9106. }
  9107. if (value == null) {
  9108. el.removeAttribute("class");
  9109. } else if (isSVG) {
  9110. el.setAttribute("class", value);
  9111. } else {
  9112. el.className = value;
  9113. }
  9114. }
  9115. function patchStyle(el, prev, next) {
  9116. const style = el.style;
  9117. const isCssString = isString(next);
  9118. if (next && !isCssString) {
  9119. if (prev && !isString(prev)) {
  9120. for (const key in prev) {
  9121. if (next[key] == null) {
  9122. setStyle(style, key, "");
  9123. }
  9124. }
  9125. }
  9126. for (const key in next) {
  9127. setStyle(style, key, next[key]);
  9128. }
  9129. } else {
  9130. const currentDisplay = style.display;
  9131. if (isCssString) {
  9132. if (prev !== next) {
  9133. style.cssText = next;
  9134. }
  9135. } else if (prev) {
  9136. el.removeAttribute("style");
  9137. }
  9138. if ("_vod" in el) {
  9139. style.display = currentDisplay;
  9140. }
  9141. }
  9142. }
  9143. const semicolonRE = /[^\\];\s*$/;
  9144. const importantRE = /\s*!important$/;
  9145. function setStyle(style, name, val) {
  9146. if (isArray(val)) {
  9147. val.forEach((v) => setStyle(style, name, v));
  9148. } else {
  9149. if (val == null)
  9150. val = "";
  9151. {
  9152. if (semicolonRE.test(val)) {
  9153. warn(
  9154. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  9155. );
  9156. }
  9157. }
  9158. if (name.startsWith("--")) {
  9159. style.setProperty(name, val);
  9160. } else {
  9161. const prefixed = autoPrefix(style, name);
  9162. if (importantRE.test(val)) {
  9163. style.setProperty(
  9164. hyphenate(prefixed),
  9165. val.replace(importantRE, ""),
  9166. "important"
  9167. );
  9168. } else {
  9169. style[prefixed] = val;
  9170. }
  9171. }
  9172. }
  9173. }
  9174. const prefixes = ["Webkit", "Moz", "ms"];
  9175. const prefixCache = {};
  9176. function autoPrefix(style, rawName) {
  9177. const cached = prefixCache[rawName];
  9178. if (cached) {
  9179. return cached;
  9180. }
  9181. let name = camelize(rawName);
  9182. if (name !== "filter" && name in style) {
  9183. return prefixCache[rawName] = name;
  9184. }
  9185. name = capitalize(name);
  9186. for (let i = 0; i < prefixes.length; i++) {
  9187. const prefixed = prefixes[i] + name;
  9188. if (prefixed in style) {
  9189. return prefixCache[rawName] = prefixed;
  9190. }
  9191. }
  9192. return rawName;
  9193. }
  9194. const xlinkNS = "http://www.w3.org/1999/xlink";
  9195. function patchAttr(el, key, value, isSVG, instance) {
  9196. if (isSVG && key.startsWith("xlink:")) {
  9197. if (value == null) {
  9198. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  9199. } else {
  9200. el.setAttributeNS(xlinkNS, key, value);
  9201. }
  9202. } else {
  9203. const isBoolean = isSpecialBooleanAttr(key);
  9204. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  9205. el.removeAttribute(key);
  9206. } else {
  9207. el.setAttribute(key, isBoolean ? "" : value);
  9208. }
  9209. }
  9210. }
  9211. function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
  9212. if (key === "innerHTML" || key === "textContent") {
  9213. if (prevChildren) {
  9214. unmountChildren(prevChildren, parentComponent, parentSuspense);
  9215. }
  9216. el[key] = value == null ? "" : value;
  9217. return;
  9218. }
  9219. const tag = el.tagName;
  9220. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  9221. !tag.includes("-")) {
  9222. el._value = value;
  9223. const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
  9224. const newValue = value == null ? "" : value;
  9225. if (oldValue !== newValue) {
  9226. el.value = newValue;
  9227. }
  9228. if (value == null) {
  9229. el.removeAttribute(key);
  9230. }
  9231. return;
  9232. }
  9233. let needRemove = false;
  9234. if (value === "" || value == null) {
  9235. const type = typeof el[key];
  9236. if (type === "boolean") {
  9237. value = includeBooleanAttr(value);
  9238. } else if (value == null && type === "string") {
  9239. value = "";
  9240. needRemove = true;
  9241. } else if (type === "number") {
  9242. value = 0;
  9243. needRemove = true;
  9244. }
  9245. }
  9246. try {
  9247. el[key] = value;
  9248. } catch (e) {
  9249. if (!needRemove) {
  9250. warn(
  9251. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  9252. e
  9253. );
  9254. }
  9255. }
  9256. needRemove && el.removeAttribute(key);
  9257. }
  9258. function addEventListener(el, event, handler, options) {
  9259. el.addEventListener(event, handler, options);
  9260. }
  9261. function removeEventListener(el, event, handler, options) {
  9262. el.removeEventListener(event, handler, options);
  9263. }
  9264. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  9265. const invokers = el._vei || (el._vei = {});
  9266. const existingInvoker = invokers[rawName];
  9267. if (nextValue && existingInvoker) {
  9268. existingInvoker.value = nextValue;
  9269. } else {
  9270. const [name, options] = parseName(rawName);
  9271. if (nextValue) {
  9272. const invoker = invokers[rawName] = createInvoker(nextValue, instance);
  9273. addEventListener(el, name, invoker, options);
  9274. } else if (existingInvoker) {
  9275. removeEventListener(el, name, existingInvoker, options);
  9276. invokers[rawName] = void 0;
  9277. }
  9278. }
  9279. }
  9280. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  9281. function parseName(name) {
  9282. let options;
  9283. if (optionsModifierRE.test(name)) {
  9284. options = {};
  9285. let m;
  9286. while (m = name.match(optionsModifierRE)) {
  9287. name = name.slice(0, name.length - m[0].length);
  9288. options[m[0].toLowerCase()] = true;
  9289. }
  9290. }
  9291. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  9292. return [event, options];
  9293. }
  9294. let cachedNow = 0;
  9295. const p = /* @__PURE__ */ Promise.resolve();
  9296. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  9297. function createInvoker(initialValue, instance) {
  9298. const invoker = (e) => {
  9299. if (!e._vts) {
  9300. e._vts = Date.now();
  9301. } else if (e._vts <= invoker.attached) {
  9302. return;
  9303. }
  9304. callWithAsyncErrorHandling(
  9305. patchStopImmediatePropagation(e, invoker.value),
  9306. instance,
  9307. 5,
  9308. [e]
  9309. );
  9310. };
  9311. invoker.value = initialValue;
  9312. invoker.attached = getNow();
  9313. return invoker;
  9314. }
  9315. function patchStopImmediatePropagation(e, value) {
  9316. if (isArray(value)) {
  9317. const originalStop = e.stopImmediatePropagation;
  9318. e.stopImmediatePropagation = () => {
  9319. originalStop.call(e);
  9320. e._stopped = true;
  9321. };
  9322. return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
  9323. } else {
  9324. return value;
  9325. }
  9326. }
  9327. const nativeOnRE = /^on[a-z]/;
  9328. const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
  9329. if (key === "class") {
  9330. patchClass(el, nextValue, isSVG);
  9331. } else if (key === "style") {
  9332. patchStyle(el, prevValue, nextValue);
  9333. } else if (isOn(key)) {
  9334. if (!isModelListener(key)) {
  9335. patchEvent(el, key, prevValue, nextValue, parentComponent);
  9336. }
  9337. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  9338. patchDOMProp(
  9339. el,
  9340. key,
  9341. nextValue,
  9342. prevChildren,
  9343. parentComponent,
  9344. parentSuspense,
  9345. unmountChildren
  9346. );
  9347. } else {
  9348. if (key === "true-value") {
  9349. el._trueValue = nextValue;
  9350. } else if (key === "false-value") {
  9351. el._falseValue = nextValue;
  9352. }
  9353. patchAttr(el, key, nextValue, isSVG);
  9354. }
  9355. };
  9356. function shouldSetAsProp(el, key, value, isSVG) {
  9357. if (isSVG) {
  9358. if (key === "innerHTML" || key === "textContent") {
  9359. return true;
  9360. }
  9361. if (key in el && nativeOnRE.test(key) && isFunction(value)) {
  9362. return true;
  9363. }
  9364. return false;
  9365. }
  9366. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  9367. return false;
  9368. }
  9369. if (key === "form") {
  9370. return false;
  9371. }
  9372. if (key === "list" && el.tagName === "INPUT") {
  9373. return false;
  9374. }
  9375. if (key === "type" && el.tagName === "TEXTAREA") {
  9376. return false;
  9377. }
  9378. if (nativeOnRE.test(key) && isString(value)) {
  9379. return false;
  9380. }
  9381. return key in el;
  9382. }
  9383. function defineCustomElement(options, hydrate2) {
  9384. const Comp = defineComponent(options);
  9385. class VueCustomElement extends VueElement {
  9386. constructor(initialProps) {
  9387. super(Comp, initialProps, hydrate2);
  9388. }
  9389. }
  9390. VueCustomElement.def = Comp;
  9391. return VueCustomElement;
  9392. }
  9393. const defineSSRCustomElement = (options) => {
  9394. return defineCustomElement(options, hydrate);
  9395. };
  9396. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  9397. };
  9398. class VueElement extends BaseClass {
  9399. constructor(_def, _props = {}, hydrate2) {
  9400. super();
  9401. this._def = _def;
  9402. this._props = _props;
  9403. /**
  9404. * @internal
  9405. */
  9406. this._instance = null;
  9407. this._connected = false;
  9408. this._resolved = false;
  9409. this._numberProps = null;
  9410. if (this.shadowRoot && hydrate2) {
  9411. hydrate2(this._createVNode(), this.shadowRoot);
  9412. } else {
  9413. if (this.shadowRoot) {
  9414. warn(
  9415. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  9416. );
  9417. }
  9418. this.attachShadow({ mode: "open" });
  9419. if (!this._def.__asyncLoader) {
  9420. this._resolveProps(this._def);
  9421. }
  9422. }
  9423. }
  9424. connectedCallback() {
  9425. this._connected = true;
  9426. if (!this._instance) {
  9427. if (this._resolved) {
  9428. this._update();
  9429. } else {
  9430. this._resolveDef();
  9431. }
  9432. }
  9433. }
  9434. disconnectedCallback() {
  9435. this._connected = false;
  9436. nextTick(() => {
  9437. if (!this._connected) {
  9438. render(null, this.shadowRoot);
  9439. this._instance = null;
  9440. }
  9441. });
  9442. }
  9443. /**
  9444. * resolve inner component definition (handle possible async component)
  9445. */
  9446. _resolveDef() {
  9447. this._resolved = true;
  9448. for (let i = 0; i < this.attributes.length; i++) {
  9449. this._setAttr(this.attributes[i].name);
  9450. }
  9451. new MutationObserver((mutations) => {
  9452. for (const m of mutations) {
  9453. this._setAttr(m.attributeName);
  9454. }
  9455. }).observe(this, { attributes: true });
  9456. const resolve = (def, isAsync = false) => {
  9457. const { props, styles } = def;
  9458. let numberProps;
  9459. if (props && !isArray(props)) {
  9460. for (const key in props) {
  9461. const opt = props[key];
  9462. if (opt === Number || opt && opt.type === Number) {
  9463. if (key in this._props) {
  9464. this._props[key] = toNumber(this._props[key]);
  9465. }
  9466. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  9467. }
  9468. }
  9469. }
  9470. this._numberProps = numberProps;
  9471. if (isAsync) {
  9472. this._resolveProps(def);
  9473. }
  9474. this._applyStyles(styles);
  9475. this._update();
  9476. };
  9477. const asyncDef = this._def.__asyncLoader;
  9478. if (asyncDef) {
  9479. asyncDef().then((def) => resolve(def, true));
  9480. } else {
  9481. resolve(this._def);
  9482. }
  9483. }
  9484. _resolveProps(def) {
  9485. const { props } = def;
  9486. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  9487. for (const key of Object.keys(this)) {
  9488. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  9489. this._setProp(key, this[key], true, false);
  9490. }
  9491. }
  9492. for (const key of declaredPropKeys.map(camelize)) {
  9493. Object.defineProperty(this, key, {
  9494. get() {
  9495. return this._getProp(key);
  9496. },
  9497. set(val) {
  9498. this._setProp(key, val);
  9499. }
  9500. });
  9501. }
  9502. }
  9503. _setAttr(key) {
  9504. let value = this.getAttribute(key);
  9505. const camelKey = camelize(key);
  9506. if (this._numberProps && this._numberProps[camelKey]) {
  9507. value = toNumber(value);
  9508. }
  9509. this._setProp(camelKey, value, false);
  9510. }
  9511. /**
  9512. * @internal
  9513. */
  9514. _getProp(key) {
  9515. return this._props[key];
  9516. }
  9517. /**
  9518. * @internal
  9519. */
  9520. _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
  9521. if (val !== this._props[key]) {
  9522. this._props[key] = val;
  9523. if (shouldUpdate && this._instance) {
  9524. this._update();
  9525. }
  9526. if (shouldReflect) {
  9527. if (val === true) {
  9528. this.setAttribute(hyphenate(key), "");
  9529. } else if (typeof val === "string" || typeof val === "number") {
  9530. this.setAttribute(hyphenate(key), val + "");
  9531. } else if (!val) {
  9532. this.removeAttribute(hyphenate(key));
  9533. }
  9534. }
  9535. }
  9536. }
  9537. _update() {
  9538. render(this._createVNode(), this.shadowRoot);
  9539. }
  9540. _createVNode() {
  9541. const vnode = createVNode(this._def, extend({}, this._props));
  9542. if (!this._instance) {
  9543. vnode.ce = (instance) => {
  9544. this._instance = instance;
  9545. instance.isCE = true;
  9546. {
  9547. instance.ceReload = (newStyles) => {
  9548. if (this._styles) {
  9549. this._styles.forEach((s) => this.shadowRoot.removeChild(s));
  9550. this._styles.length = 0;
  9551. }
  9552. this._applyStyles(newStyles);
  9553. this._instance = null;
  9554. this._update();
  9555. };
  9556. }
  9557. const dispatch = (event, args) => {
  9558. this.dispatchEvent(
  9559. new CustomEvent(event, {
  9560. detail: args
  9561. })
  9562. );
  9563. };
  9564. instance.emit = (event, ...args) => {
  9565. dispatch(event, args);
  9566. if (hyphenate(event) !== event) {
  9567. dispatch(hyphenate(event), args);
  9568. }
  9569. };
  9570. let parent = this;
  9571. while (parent = parent && (parent.parentNode || parent.host)) {
  9572. if (parent instanceof VueElement) {
  9573. instance.parent = parent._instance;
  9574. instance.provides = parent._instance.provides;
  9575. break;
  9576. }
  9577. }
  9578. };
  9579. }
  9580. return vnode;
  9581. }
  9582. _applyStyles(styles) {
  9583. if (styles) {
  9584. styles.forEach((css) => {
  9585. const s = document.createElement("style");
  9586. s.textContent = css;
  9587. this.shadowRoot.appendChild(s);
  9588. {
  9589. (this._styles || (this._styles = [])).push(s);
  9590. }
  9591. });
  9592. }
  9593. }
  9594. }
  9595. function useCssModule(name = "$style") {
  9596. {
  9597. {
  9598. warn(`useCssModule() is not supported in the global build.`);
  9599. }
  9600. return EMPTY_OBJ;
  9601. }
  9602. }
  9603. function useCssVars(getter) {
  9604. const instance = getCurrentInstance();
  9605. if (!instance) {
  9606. warn(`useCssVars is called without current active component instance.`);
  9607. return;
  9608. }
  9609. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  9610. Array.from(
  9611. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  9612. ).forEach((node) => setVarsOnNode(node, vars));
  9613. };
  9614. const setVars = () => {
  9615. const vars = getter(instance.proxy);
  9616. setVarsOnVNode(instance.subTree, vars);
  9617. updateTeleports(vars);
  9618. };
  9619. watchPostEffect(setVars);
  9620. onMounted(() => {
  9621. const ob = new MutationObserver(setVars);
  9622. ob.observe(instance.subTree.el.parentNode, { childList: true });
  9623. onUnmounted(() => ob.disconnect());
  9624. });
  9625. }
  9626. function setVarsOnVNode(vnode, vars) {
  9627. if (vnode.shapeFlag & 128) {
  9628. const suspense = vnode.suspense;
  9629. vnode = suspense.activeBranch;
  9630. if (suspense.pendingBranch && !suspense.isHydrating) {
  9631. suspense.effects.push(() => {
  9632. setVarsOnVNode(suspense.activeBranch, vars);
  9633. });
  9634. }
  9635. }
  9636. while (vnode.component) {
  9637. vnode = vnode.component.subTree;
  9638. }
  9639. if (vnode.shapeFlag & 1 && vnode.el) {
  9640. setVarsOnNode(vnode.el, vars);
  9641. } else if (vnode.type === Fragment) {
  9642. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  9643. } else if (vnode.type === Static) {
  9644. let { el, anchor } = vnode;
  9645. while (el) {
  9646. setVarsOnNode(el, vars);
  9647. if (el === anchor)
  9648. break;
  9649. el = el.nextSibling;
  9650. }
  9651. }
  9652. }
  9653. function setVarsOnNode(el, vars) {
  9654. if (el.nodeType === 1) {
  9655. const style = el.style;
  9656. for (const key in vars) {
  9657. style.setProperty(`--${key}`, vars[key]);
  9658. }
  9659. }
  9660. }
  9661. const TRANSITION$1 = "transition";
  9662. const ANIMATION = "animation";
  9663. const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
  9664. Transition.displayName = "Transition";
  9665. const DOMTransitionPropsValidators = {
  9666. name: String,
  9667. type: String,
  9668. css: {
  9669. type: Boolean,
  9670. default: true
  9671. },
  9672. duration: [String, Number, Object],
  9673. enterFromClass: String,
  9674. enterActiveClass: String,
  9675. enterToClass: String,
  9676. appearFromClass: String,
  9677. appearActiveClass: String,
  9678. appearToClass: String,
  9679. leaveFromClass: String,
  9680. leaveActiveClass: String,
  9681. leaveToClass: String
  9682. };
  9683. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
  9684. {},
  9685. BaseTransitionPropsValidators,
  9686. DOMTransitionPropsValidators
  9687. );
  9688. const callHook = (hook, args = []) => {
  9689. if (isArray(hook)) {
  9690. hook.forEach((h2) => h2(...args));
  9691. } else if (hook) {
  9692. hook(...args);
  9693. }
  9694. };
  9695. const hasExplicitCallback = (hook) => {
  9696. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  9697. };
  9698. function resolveTransitionProps(rawProps) {
  9699. const baseProps = {};
  9700. for (const key in rawProps) {
  9701. if (!(key in DOMTransitionPropsValidators)) {
  9702. baseProps[key] = rawProps[key];
  9703. }
  9704. }
  9705. if (rawProps.css === false) {
  9706. return baseProps;
  9707. }
  9708. const {
  9709. name = "v",
  9710. type,
  9711. duration,
  9712. enterFromClass = `${name}-enter-from`,
  9713. enterActiveClass = `${name}-enter-active`,
  9714. enterToClass = `${name}-enter-to`,
  9715. appearFromClass = enterFromClass,
  9716. appearActiveClass = enterActiveClass,
  9717. appearToClass = enterToClass,
  9718. leaveFromClass = `${name}-leave-from`,
  9719. leaveActiveClass = `${name}-leave-active`,
  9720. leaveToClass = `${name}-leave-to`
  9721. } = rawProps;
  9722. const durations = normalizeDuration(duration);
  9723. const enterDuration = durations && durations[0];
  9724. const leaveDuration = durations && durations[1];
  9725. const {
  9726. onBeforeEnter,
  9727. onEnter,
  9728. onEnterCancelled,
  9729. onLeave,
  9730. onLeaveCancelled,
  9731. onBeforeAppear = onBeforeEnter,
  9732. onAppear = onEnter,
  9733. onAppearCancelled = onEnterCancelled
  9734. } = baseProps;
  9735. const finishEnter = (el, isAppear, done) => {
  9736. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9737. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  9738. done && done();
  9739. };
  9740. const finishLeave = (el, done) => {
  9741. el._isLeaving = false;
  9742. removeTransitionClass(el, leaveFromClass);
  9743. removeTransitionClass(el, leaveToClass);
  9744. removeTransitionClass(el, leaveActiveClass);
  9745. done && done();
  9746. };
  9747. const makeEnterHook = (isAppear) => {
  9748. return (el, done) => {
  9749. const hook = isAppear ? onAppear : onEnter;
  9750. const resolve = () => finishEnter(el, isAppear, done);
  9751. callHook(hook, [el, resolve]);
  9752. nextFrame(() => {
  9753. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  9754. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9755. if (!hasExplicitCallback(hook)) {
  9756. whenTransitionEnds(el, type, enterDuration, resolve);
  9757. }
  9758. });
  9759. };
  9760. };
  9761. return extend(baseProps, {
  9762. onBeforeEnter(el) {
  9763. callHook(onBeforeEnter, [el]);
  9764. addTransitionClass(el, enterFromClass);
  9765. addTransitionClass(el, enterActiveClass);
  9766. },
  9767. onBeforeAppear(el) {
  9768. callHook(onBeforeAppear, [el]);
  9769. addTransitionClass(el, appearFromClass);
  9770. addTransitionClass(el, appearActiveClass);
  9771. },
  9772. onEnter: makeEnterHook(false),
  9773. onAppear: makeEnterHook(true),
  9774. onLeave(el, done) {
  9775. el._isLeaving = true;
  9776. const resolve = () => finishLeave(el, done);
  9777. addTransitionClass(el, leaveFromClass);
  9778. forceReflow();
  9779. addTransitionClass(el, leaveActiveClass);
  9780. nextFrame(() => {
  9781. if (!el._isLeaving) {
  9782. return;
  9783. }
  9784. removeTransitionClass(el, leaveFromClass);
  9785. addTransitionClass(el, leaveToClass);
  9786. if (!hasExplicitCallback(onLeave)) {
  9787. whenTransitionEnds(el, type, leaveDuration, resolve);
  9788. }
  9789. });
  9790. callHook(onLeave, [el, resolve]);
  9791. },
  9792. onEnterCancelled(el) {
  9793. finishEnter(el, false);
  9794. callHook(onEnterCancelled, [el]);
  9795. },
  9796. onAppearCancelled(el) {
  9797. finishEnter(el, true);
  9798. callHook(onAppearCancelled, [el]);
  9799. },
  9800. onLeaveCancelled(el) {
  9801. finishLeave(el);
  9802. callHook(onLeaveCancelled, [el]);
  9803. }
  9804. });
  9805. }
  9806. function normalizeDuration(duration) {
  9807. if (duration == null) {
  9808. return null;
  9809. } else if (isObject(duration)) {
  9810. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  9811. } else {
  9812. const n = NumberOf(duration);
  9813. return [n, n];
  9814. }
  9815. }
  9816. function NumberOf(val) {
  9817. const res = toNumber(val);
  9818. {
  9819. assertNumber(res, "<transition> explicit duration");
  9820. }
  9821. return res;
  9822. }
  9823. function addTransitionClass(el, cls) {
  9824. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  9825. (el._vtc || (el._vtc = /* @__PURE__ */ new Set())).add(cls);
  9826. }
  9827. function removeTransitionClass(el, cls) {
  9828. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  9829. const { _vtc } = el;
  9830. if (_vtc) {
  9831. _vtc.delete(cls);
  9832. if (!_vtc.size) {
  9833. el._vtc = void 0;
  9834. }
  9835. }
  9836. }
  9837. function nextFrame(cb) {
  9838. requestAnimationFrame(() => {
  9839. requestAnimationFrame(cb);
  9840. });
  9841. }
  9842. let endId = 0;
  9843. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  9844. const id = el._endId = ++endId;
  9845. const resolveIfNotStale = () => {
  9846. if (id === el._endId) {
  9847. resolve();
  9848. }
  9849. };
  9850. if (explicitTimeout) {
  9851. return setTimeout(resolveIfNotStale, explicitTimeout);
  9852. }
  9853. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  9854. if (!type) {
  9855. return resolve();
  9856. }
  9857. const endEvent = type + "end";
  9858. let ended = 0;
  9859. const end = () => {
  9860. el.removeEventListener(endEvent, onEnd);
  9861. resolveIfNotStale();
  9862. };
  9863. const onEnd = (e) => {
  9864. if (e.target === el && ++ended >= propCount) {
  9865. end();
  9866. }
  9867. };
  9868. setTimeout(() => {
  9869. if (ended < propCount) {
  9870. end();
  9871. }
  9872. }, timeout + 1);
  9873. el.addEventListener(endEvent, onEnd);
  9874. }
  9875. function getTransitionInfo(el, expectedType) {
  9876. const styles = window.getComputedStyle(el);
  9877. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  9878. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  9879. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  9880. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  9881. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  9882. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  9883. const animationTimeout = getTimeout(animationDelays, animationDurations);
  9884. let type = null;
  9885. let timeout = 0;
  9886. let propCount = 0;
  9887. if (expectedType === TRANSITION$1) {
  9888. if (transitionTimeout > 0) {
  9889. type = TRANSITION$1;
  9890. timeout = transitionTimeout;
  9891. propCount = transitionDurations.length;
  9892. }
  9893. } else if (expectedType === ANIMATION) {
  9894. if (animationTimeout > 0) {
  9895. type = ANIMATION;
  9896. timeout = animationTimeout;
  9897. propCount = animationDurations.length;
  9898. }
  9899. } else {
  9900. timeout = Math.max(transitionTimeout, animationTimeout);
  9901. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  9902. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  9903. }
  9904. const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
  9905. getStyleProperties(`${TRANSITION$1}Property`).toString()
  9906. );
  9907. return {
  9908. type,
  9909. timeout,
  9910. propCount,
  9911. hasTransform
  9912. };
  9913. }
  9914. function getTimeout(delays, durations) {
  9915. while (delays.length < durations.length) {
  9916. delays = delays.concat(delays);
  9917. }
  9918. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  9919. }
  9920. function toMs(s) {
  9921. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  9922. }
  9923. function forceReflow() {
  9924. return document.body.offsetHeight;
  9925. }
  9926. const positionMap = /* @__PURE__ */ new WeakMap();
  9927. const newPositionMap = /* @__PURE__ */ new WeakMap();
  9928. const TransitionGroupImpl = {
  9929. name: "TransitionGroup",
  9930. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  9931. tag: String,
  9932. moveClass: String
  9933. }),
  9934. setup(props, { slots }) {
  9935. const instance = getCurrentInstance();
  9936. const state = useTransitionState();
  9937. let prevChildren;
  9938. let children;
  9939. onUpdated(() => {
  9940. if (!prevChildren.length) {
  9941. return;
  9942. }
  9943. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  9944. if (!hasCSSTransform(
  9945. prevChildren[0].el,
  9946. instance.vnode.el,
  9947. moveClass
  9948. )) {
  9949. return;
  9950. }
  9951. prevChildren.forEach(callPendingCbs);
  9952. prevChildren.forEach(recordPosition);
  9953. const movedChildren = prevChildren.filter(applyTranslation);
  9954. forceReflow();
  9955. movedChildren.forEach((c) => {
  9956. const el = c.el;
  9957. const style = el.style;
  9958. addTransitionClass(el, moveClass);
  9959. style.transform = style.webkitTransform = style.transitionDuration = "";
  9960. const cb = el._moveCb = (e) => {
  9961. if (e && e.target !== el) {
  9962. return;
  9963. }
  9964. if (!e || /transform$/.test(e.propertyName)) {
  9965. el.removeEventListener("transitionend", cb);
  9966. el._moveCb = null;
  9967. removeTransitionClass(el, moveClass);
  9968. }
  9969. };
  9970. el.addEventListener("transitionend", cb);
  9971. });
  9972. });
  9973. return () => {
  9974. const rawProps = toRaw(props);
  9975. const cssTransitionProps = resolveTransitionProps(rawProps);
  9976. let tag = rawProps.tag || Fragment;
  9977. prevChildren = children;
  9978. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  9979. for (let i = 0; i < children.length; i++) {
  9980. const child = children[i];
  9981. if (child.key != null) {
  9982. setTransitionHooks(
  9983. child,
  9984. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  9985. );
  9986. } else {
  9987. warn(`<TransitionGroup> children must be keyed.`);
  9988. }
  9989. }
  9990. if (prevChildren) {
  9991. for (let i = 0; i < prevChildren.length; i++) {
  9992. const child = prevChildren[i];
  9993. setTransitionHooks(
  9994. child,
  9995. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  9996. );
  9997. positionMap.set(child, child.el.getBoundingClientRect());
  9998. }
  9999. }
  10000. return createVNode(tag, null, children);
  10001. };
  10002. }
  10003. };
  10004. const removeMode = (props) => delete props.mode;
  10005. /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
  10006. const TransitionGroup = TransitionGroupImpl;
  10007. function callPendingCbs(c) {
  10008. const el = c.el;
  10009. if (el._moveCb) {
  10010. el._moveCb();
  10011. }
  10012. if (el._enterCb) {
  10013. el._enterCb();
  10014. }
  10015. }
  10016. function recordPosition(c) {
  10017. newPositionMap.set(c, c.el.getBoundingClientRect());
  10018. }
  10019. function applyTranslation(c) {
  10020. const oldPos = positionMap.get(c);
  10021. const newPos = newPositionMap.get(c);
  10022. const dx = oldPos.left - newPos.left;
  10023. const dy = oldPos.top - newPos.top;
  10024. if (dx || dy) {
  10025. const s = c.el.style;
  10026. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  10027. s.transitionDuration = "0s";
  10028. return c;
  10029. }
  10030. }
  10031. function hasCSSTransform(el, root, moveClass) {
  10032. const clone = el.cloneNode();
  10033. if (el._vtc) {
  10034. el._vtc.forEach((cls) => {
  10035. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  10036. });
  10037. }
  10038. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  10039. clone.style.display = "none";
  10040. const container = root.nodeType === 1 ? root : root.parentNode;
  10041. container.appendChild(clone);
  10042. const { hasTransform } = getTransitionInfo(clone);
  10043. container.removeChild(clone);
  10044. return hasTransform;
  10045. }
  10046. const getModelAssigner = (vnode) => {
  10047. const fn = vnode.props["onUpdate:modelValue"] || false;
  10048. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  10049. };
  10050. function onCompositionStart(e) {
  10051. e.target.composing = true;
  10052. }
  10053. function onCompositionEnd(e) {
  10054. const target = e.target;
  10055. if (target.composing) {
  10056. target.composing = false;
  10057. target.dispatchEvent(new Event("input"));
  10058. }
  10059. }
  10060. const vModelText = {
  10061. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  10062. el._assign = getModelAssigner(vnode);
  10063. const castToNumber = number || vnode.props && vnode.props.type === "number";
  10064. addEventListener(el, lazy ? "change" : "input", (e) => {
  10065. if (e.target.composing)
  10066. return;
  10067. let domValue = el.value;
  10068. if (trim) {
  10069. domValue = domValue.trim();
  10070. }
  10071. if (castToNumber) {
  10072. domValue = looseToNumber(domValue);
  10073. }
  10074. el._assign(domValue);
  10075. });
  10076. if (trim) {
  10077. addEventListener(el, "change", () => {
  10078. el.value = el.value.trim();
  10079. });
  10080. }
  10081. if (!lazy) {
  10082. addEventListener(el, "compositionstart", onCompositionStart);
  10083. addEventListener(el, "compositionend", onCompositionEnd);
  10084. addEventListener(el, "change", onCompositionEnd);
  10085. }
  10086. },
  10087. // set value on mounted so it's after min/max for type="range"
  10088. mounted(el, { value }) {
  10089. el.value = value == null ? "" : value;
  10090. },
  10091. beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
  10092. el._assign = getModelAssigner(vnode);
  10093. if (el.composing)
  10094. return;
  10095. if (document.activeElement === el && el.type !== "range") {
  10096. if (lazy) {
  10097. return;
  10098. }
  10099. if (trim && el.value.trim() === value) {
  10100. return;
  10101. }
  10102. if ((number || el.type === "number") && looseToNumber(el.value) === value) {
  10103. return;
  10104. }
  10105. }
  10106. const newValue = value == null ? "" : value;
  10107. if (el.value !== newValue) {
  10108. el.value = newValue;
  10109. }
  10110. }
  10111. };
  10112. const vModelCheckbox = {
  10113. // #4096 array checkboxes need to be deep traversed
  10114. deep: true,
  10115. created(el, _, vnode) {
  10116. el._assign = getModelAssigner(vnode);
  10117. addEventListener(el, "change", () => {
  10118. const modelValue = el._modelValue;
  10119. const elementValue = getValue(el);
  10120. const checked = el.checked;
  10121. const assign = el._assign;
  10122. if (isArray(modelValue)) {
  10123. const index = looseIndexOf(modelValue, elementValue);
  10124. const found = index !== -1;
  10125. if (checked && !found) {
  10126. assign(modelValue.concat(elementValue));
  10127. } else if (!checked && found) {
  10128. const filtered = [...modelValue];
  10129. filtered.splice(index, 1);
  10130. assign(filtered);
  10131. }
  10132. } else if (isSet(modelValue)) {
  10133. const cloned = new Set(modelValue);
  10134. if (checked) {
  10135. cloned.add(elementValue);
  10136. } else {
  10137. cloned.delete(elementValue);
  10138. }
  10139. assign(cloned);
  10140. } else {
  10141. assign(getCheckboxValue(el, checked));
  10142. }
  10143. });
  10144. },
  10145. // set initial checked on mount to wait for true-value/false-value
  10146. mounted: setChecked,
  10147. beforeUpdate(el, binding, vnode) {
  10148. el._assign = getModelAssigner(vnode);
  10149. setChecked(el, binding, vnode);
  10150. }
  10151. };
  10152. function setChecked(el, { value, oldValue }, vnode) {
  10153. el._modelValue = value;
  10154. if (isArray(value)) {
  10155. el.checked = looseIndexOf(value, vnode.props.value) > -1;
  10156. } else if (isSet(value)) {
  10157. el.checked = value.has(vnode.props.value);
  10158. } else if (value !== oldValue) {
  10159. el.checked = looseEqual(value, getCheckboxValue(el, true));
  10160. }
  10161. }
  10162. const vModelRadio = {
  10163. created(el, { value }, vnode) {
  10164. el.checked = looseEqual(value, vnode.props.value);
  10165. el._assign = getModelAssigner(vnode);
  10166. addEventListener(el, "change", () => {
  10167. el._assign(getValue(el));
  10168. });
  10169. },
  10170. beforeUpdate(el, { value, oldValue }, vnode) {
  10171. el._assign = getModelAssigner(vnode);
  10172. if (value !== oldValue) {
  10173. el.checked = looseEqual(value, vnode.props.value);
  10174. }
  10175. }
  10176. };
  10177. const vModelSelect = {
  10178. // <select multiple> value need to be deep traversed
  10179. deep: true,
  10180. created(el, { value, modifiers: { number } }, vnode) {
  10181. const isSetModel = isSet(value);
  10182. addEventListener(el, "change", () => {
  10183. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  10184. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  10185. );
  10186. el._assign(
  10187. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  10188. );
  10189. });
  10190. el._assign = getModelAssigner(vnode);
  10191. },
  10192. // set value in mounted & updated because <select> relies on its children
  10193. // <option>s.
  10194. mounted(el, { value }) {
  10195. setSelected(el, value);
  10196. },
  10197. beforeUpdate(el, _binding, vnode) {
  10198. el._assign = getModelAssigner(vnode);
  10199. },
  10200. updated(el, { value }) {
  10201. setSelected(el, value);
  10202. }
  10203. };
  10204. function setSelected(el, value) {
  10205. const isMultiple = el.multiple;
  10206. if (isMultiple && !isArray(value) && !isSet(value)) {
  10207. warn(
  10208. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  10209. );
  10210. return;
  10211. }
  10212. for (let i = 0, l = el.options.length; i < l; i++) {
  10213. const option = el.options[i];
  10214. const optionValue = getValue(option);
  10215. if (isMultiple) {
  10216. if (isArray(value)) {
  10217. option.selected = looseIndexOf(value, optionValue) > -1;
  10218. } else {
  10219. option.selected = value.has(optionValue);
  10220. }
  10221. } else {
  10222. if (looseEqual(getValue(option), value)) {
  10223. if (el.selectedIndex !== i)
  10224. el.selectedIndex = i;
  10225. return;
  10226. }
  10227. }
  10228. }
  10229. if (!isMultiple && el.selectedIndex !== -1) {
  10230. el.selectedIndex = -1;
  10231. }
  10232. }
  10233. function getValue(el) {
  10234. return "_value" in el ? el._value : el.value;
  10235. }
  10236. function getCheckboxValue(el, checked) {
  10237. const key = checked ? "_trueValue" : "_falseValue";
  10238. return key in el ? el[key] : checked;
  10239. }
  10240. const vModelDynamic = {
  10241. created(el, binding, vnode) {
  10242. callModelHook(el, binding, vnode, null, "created");
  10243. },
  10244. mounted(el, binding, vnode) {
  10245. callModelHook(el, binding, vnode, null, "mounted");
  10246. },
  10247. beforeUpdate(el, binding, vnode, prevVNode) {
  10248. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  10249. },
  10250. updated(el, binding, vnode, prevVNode) {
  10251. callModelHook(el, binding, vnode, prevVNode, "updated");
  10252. }
  10253. };
  10254. function resolveDynamicModel(tagName, type) {
  10255. switch (tagName) {
  10256. case "SELECT":
  10257. return vModelSelect;
  10258. case "TEXTAREA":
  10259. return vModelText;
  10260. default:
  10261. switch (type) {
  10262. case "checkbox":
  10263. return vModelCheckbox;
  10264. case "radio":
  10265. return vModelRadio;
  10266. default:
  10267. return vModelText;
  10268. }
  10269. }
  10270. }
  10271. function callModelHook(el, binding, vnode, prevVNode, hook) {
  10272. const modelToUse = resolveDynamicModel(
  10273. el.tagName,
  10274. vnode.props && vnode.props.type
  10275. );
  10276. const fn = modelToUse[hook];
  10277. fn && fn(el, binding, vnode, prevVNode);
  10278. }
  10279. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  10280. const modifierGuards = {
  10281. stop: (e) => e.stopPropagation(),
  10282. prevent: (e) => e.preventDefault(),
  10283. self: (e) => e.target !== e.currentTarget,
  10284. ctrl: (e) => !e.ctrlKey,
  10285. shift: (e) => !e.shiftKey,
  10286. alt: (e) => !e.altKey,
  10287. meta: (e) => !e.metaKey,
  10288. left: (e) => "button" in e && e.button !== 0,
  10289. middle: (e) => "button" in e && e.button !== 1,
  10290. right: (e) => "button" in e && e.button !== 2,
  10291. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  10292. };
  10293. const withModifiers = (fn, modifiers) => {
  10294. return (event, ...args) => {
  10295. for (let i = 0; i < modifiers.length; i++) {
  10296. const guard = modifierGuards[modifiers[i]];
  10297. if (guard && guard(event, modifiers))
  10298. return;
  10299. }
  10300. return fn(event, ...args);
  10301. };
  10302. };
  10303. const keyNames = {
  10304. esc: "escape",
  10305. space: " ",
  10306. up: "arrow-up",
  10307. left: "arrow-left",
  10308. right: "arrow-right",
  10309. down: "arrow-down",
  10310. delete: "backspace"
  10311. };
  10312. const withKeys = (fn, modifiers) => {
  10313. return (event) => {
  10314. if (!("key" in event)) {
  10315. return;
  10316. }
  10317. const eventKey = hyphenate(event.key);
  10318. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  10319. return fn(event);
  10320. }
  10321. };
  10322. };
  10323. const vShow = {
  10324. beforeMount(el, { value }, { transition }) {
  10325. el._vod = el.style.display === "none" ? "" : el.style.display;
  10326. if (transition && value) {
  10327. transition.beforeEnter(el);
  10328. } else {
  10329. setDisplay(el, value);
  10330. }
  10331. },
  10332. mounted(el, { value }, { transition }) {
  10333. if (transition && value) {
  10334. transition.enter(el);
  10335. }
  10336. },
  10337. updated(el, { value, oldValue }, { transition }) {
  10338. if (!value === !oldValue)
  10339. return;
  10340. if (transition) {
  10341. if (value) {
  10342. transition.beforeEnter(el);
  10343. setDisplay(el, true);
  10344. transition.enter(el);
  10345. } else {
  10346. transition.leave(el, () => {
  10347. setDisplay(el, false);
  10348. });
  10349. }
  10350. } else {
  10351. setDisplay(el, value);
  10352. }
  10353. },
  10354. beforeUnmount(el, { value }) {
  10355. setDisplay(el, value);
  10356. }
  10357. };
  10358. function setDisplay(el, value) {
  10359. el.style.display = value ? el._vod : "none";
  10360. }
  10361. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  10362. let renderer;
  10363. let enabledHydration = false;
  10364. function ensureRenderer() {
  10365. return renderer || (renderer = createRenderer(rendererOptions));
  10366. }
  10367. function ensureHydrationRenderer() {
  10368. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  10369. enabledHydration = true;
  10370. return renderer;
  10371. }
  10372. const render = (...args) => {
  10373. ensureRenderer().render(...args);
  10374. };
  10375. const hydrate = (...args) => {
  10376. ensureHydrationRenderer().hydrate(...args);
  10377. };
  10378. const createApp = (...args) => {
  10379. const app = ensureRenderer().createApp(...args);
  10380. {
  10381. injectNativeTagCheck(app);
  10382. injectCompilerOptionsCheck(app);
  10383. }
  10384. const { mount } = app;
  10385. app.mount = (containerOrSelector) => {
  10386. const container = normalizeContainer(containerOrSelector);
  10387. if (!container)
  10388. return;
  10389. const component = app._component;
  10390. if (!isFunction(component) && !component.render && !component.template) {
  10391. component.template = container.innerHTML;
  10392. }
  10393. container.innerHTML = "";
  10394. const proxy = mount(container, false, container instanceof SVGElement);
  10395. if (container instanceof Element) {
  10396. container.removeAttribute("v-cloak");
  10397. container.setAttribute("data-v-app", "");
  10398. }
  10399. return proxy;
  10400. };
  10401. return app;
  10402. };
  10403. const createSSRApp = (...args) => {
  10404. const app = ensureHydrationRenderer().createApp(...args);
  10405. {
  10406. injectNativeTagCheck(app);
  10407. injectCompilerOptionsCheck(app);
  10408. }
  10409. const { mount } = app;
  10410. app.mount = (containerOrSelector) => {
  10411. const container = normalizeContainer(containerOrSelector);
  10412. if (container) {
  10413. return mount(container, true, container instanceof SVGElement);
  10414. }
  10415. };
  10416. return app;
  10417. };
  10418. function injectNativeTagCheck(app) {
  10419. Object.defineProperty(app.config, "isNativeTag", {
  10420. value: (tag) => isHTMLTag(tag) || isSVGTag(tag),
  10421. writable: false
  10422. });
  10423. }
  10424. function injectCompilerOptionsCheck(app) {
  10425. if (isRuntimeOnly()) {
  10426. const isCustomElement = app.config.isCustomElement;
  10427. Object.defineProperty(app.config, "isCustomElement", {
  10428. get() {
  10429. return isCustomElement;
  10430. },
  10431. set() {
  10432. warn(
  10433. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  10434. );
  10435. }
  10436. });
  10437. const compilerOptions = app.config.compilerOptions;
  10438. 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.
  10439. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  10440. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  10441. - 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`;
  10442. Object.defineProperty(app.config, "compilerOptions", {
  10443. get() {
  10444. warn(msg);
  10445. return compilerOptions;
  10446. },
  10447. set() {
  10448. warn(msg);
  10449. }
  10450. });
  10451. }
  10452. }
  10453. function normalizeContainer(container) {
  10454. if (isString(container)) {
  10455. const res = document.querySelector(container);
  10456. if (!res) {
  10457. warn(
  10458. `Failed to mount app: mount target selector "${container}" returned null.`
  10459. );
  10460. }
  10461. return res;
  10462. }
  10463. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  10464. warn(
  10465. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  10466. );
  10467. }
  10468. return container;
  10469. }
  10470. const initDirectivesForSSR = NOOP;
  10471. function initDev() {
  10472. {
  10473. {
  10474. console.info(
  10475. `You are running a development build of Vue.
  10476. Make sure to use the production build (*.prod.js) when deploying for production.`
  10477. );
  10478. }
  10479. initCustomFormatter();
  10480. }
  10481. }
  10482. function defaultOnError(error) {
  10483. throw error;
  10484. }
  10485. function defaultOnWarn(msg) {
  10486. console.warn(`[Vue warn] ${msg.message}`);
  10487. }
  10488. function createCompilerError(code, loc, messages, additionalMessage) {
  10489. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  10490. const error = new SyntaxError(String(msg));
  10491. error.code = code;
  10492. error.loc = loc;
  10493. return error;
  10494. }
  10495. const errorMessages = {
  10496. // parse errors
  10497. [0]: "Illegal comment.",
  10498. [1]: "CDATA section is allowed only in XML context.",
  10499. [2]: "Duplicate attribute.",
  10500. [3]: "End tag cannot have attributes.",
  10501. [4]: "Illegal '/' in tags.",
  10502. [5]: "Unexpected EOF in tag.",
  10503. [6]: "Unexpected EOF in CDATA section.",
  10504. [7]: "Unexpected EOF in comment.",
  10505. [8]: "Unexpected EOF in script.",
  10506. [9]: "Unexpected EOF in tag.",
  10507. [10]: "Incorrectly closed comment.",
  10508. [11]: "Incorrectly opened comment.",
  10509. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  10510. [13]: "Attribute value was expected.",
  10511. [14]: "End tag name was expected.",
  10512. [15]: "Whitespace was expected.",
  10513. [16]: "Unexpected '<!--' in comment.",
  10514. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  10515. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  10516. [19]: "Attribute name cannot start with '='.",
  10517. [21]: "'<?' is allowed only in XML context.",
  10518. [20]: `Unexpected null character.`,
  10519. [22]: "Illegal '/' in tags.",
  10520. // Vue-specific parse errors
  10521. [23]: "Invalid end tag.",
  10522. [24]: "Element is missing end tag.",
  10523. [25]: "Interpolation end sign was not found.",
  10524. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  10525. [26]: "Legal directive name was expected.",
  10526. // transform errors
  10527. [28]: `v-if/v-else-if is missing expression.`,
  10528. [29]: `v-if/else branches must use unique keys.`,
  10529. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  10530. [31]: `v-for is missing expression.`,
  10531. [32]: `v-for has invalid expression.`,
  10532. [33]: `<template v-for> key should be placed on the <template> tag.`,
  10533. [34]: `v-bind is missing expression.`,
  10534. [35]: `v-on is missing expression.`,
  10535. [36]: `Unexpected custom directive on <slot> outlet.`,
  10536. [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.`,
  10537. [38]: `Duplicate slot names found. `,
  10538. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  10539. [40]: `v-slot can only be used on components or <template> tags.`,
  10540. [41]: `v-model is missing expression.`,
  10541. [42]: `v-model value must be a valid JavaScript member expression.`,
  10542. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  10543. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  10544. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  10545. [45]: `Error parsing JavaScript expression: `,
  10546. [46]: `<KeepAlive> expects exactly one child component.`,
  10547. // generic errors
  10548. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  10549. [48]: `ES module mode is not supported in this build of compiler.`,
  10550. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  10551. [50]: `"scopeId" option is only supported in module mode.`,
  10552. // deprecations
  10553. [51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
  10554. [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
  10555. // just to fulfill types
  10556. [53]: ``
  10557. };
  10558. const FRAGMENT = Symbol(`Fragment` );
  10559. const TELEPORT = Symbol(`Teleport` );
  10560. const SUSPENSE = Symbol(`Suspense` );
  10561. const KEEP_ALIVE = Symbol(`KeepAlive` );
  10562. const BASE_TRANSITION = Symbol(`BaseTransition` );
  10563. const OPEN_BLOCK = Symbol(`openBlock` );
  10564. const CREATE_BLOCK = Symbol(`createBlock` );
  10565. const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
  10566. const CREATE_VNODE = Symbol(`createVNode` );
  10567. const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
  10568. const CREATE_COMMENT = Symbol(`createCommentVNode` );
  10569. const CREATE_TEXT = Symbol(`createTextVNode` );
  10570. const CREATE_STATIC = Symbol(`createStaticVNode` );
  10571. const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
  10572. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  10573. `resolveDynamicComponent`
  10574. );
  10575. const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
  10576. const RESOLVE_FILTER = Symbol(`resolveFilter` );
  10577. const WITH_DIRECTIVES = Symbol(`withDirectives` );
  10578. const RENDER_LIST = Symbol(`renderList` );
  10579. const RENDER_SLOT = Symbol(`renderSlot` );
  10580. const CREATE_SLOTS = Symbol(`createSlots` );
  10581. const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
  10582. const MERGE_PROPS = Symbol(`mergeProps` );
  10583. const NORMALIZE_CLASS = Symbol(`normalizeClass` );
  10584. const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
  10585. const NORMALIZE_PROPS = Symbol(`normalizeProps` );
  10586. const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
  10587. const TO_HANDLERS = Symbol(`toHandlers` );
  10588. const CAMELIZE = Symbol(`camelize` );
  10589. const CAPITALIZE = Symbol(`capitalize` );
  10590. const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
  10591. const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
  10592. const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
  10593. const POP_SCOPE_ID = Symbol(`popScopeId` );
  10594. const WITH_CTX = Symbol(`withCtx` );
  10595. const UNREF = Symbol(`unref` );
  10596. const IS_REF = Symbol(`isRef` );
  10597. const WITH_MEMO = Symbol(`withMemo` );
  10598. const IS_MEMO_SAME = Symbol(`isMemoSame` );
  10599. const helperNameMap = {
  10600. [FRAGMENT]: `Fragment`,
  10601. [TELEPORT]: `Teleport`,
  10602. [SUSPENSE]: `Suspense`,
  10603. [KEEP_ALIVE]: `KeepAlive`,
  10604. [BASE_TRANSITION]: `BaseTransition`,
  10605. [OPEN_BLOCK]: `openBlock`,
  10606. [CREATE_BLOCK]: `createBlock`,
  10607. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  10608. [CREATE_VNODE]: `createVNode`,
  10609. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  10610. [CREATE_COMMENT]: `createCommentVNode`,
  10611. [CREATE_TEXT]: `createTextVNode`,
  10612. [CREATE_STATIC]: `createStaticVNode`,
  10613. [RESOLVE_COMPONENT]: `resolveComponent`,
  10614. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  10615. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  10616. [RESOLVE_FILTER]: `resolveFilter`,
  10617. [WITH_DIRECTIVES]: `withDirectives`,
  10618. [RENDER_LIST]: `renderList`,
  10619. [RENDER_SLOT]: `renderSlot`,
  10620. [CREATE_SLOTS]: `createSlots`,
  10621. [TO_DISPLAY_STRING]: `toDisplayString`,
  10622. [MERGE_PROPS]: `mergeProps`,
  10623. [NORMALIZE_CLASS]: `normalizeClass`,
  10624. [NORMALIZE_STYLE]: `normalizeStyle`,
  10625. [NORMALIZE_PROPS]: `normalizeProps`,
  10626. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  10627. [TO_HANDLERS]: `toHandlers`,
  10628. [CAMELIZE]: `camelize`,
  10629. [CAPITALIZE]: `capitalize`,
  10630. [TO_HANDLER_KEY]: `toHandlerKey`,
  10631. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  10632. [PUSH_SCOPE_ID]: `pushScopeId`,
  10633. [POP_SCOPE_ID]: `popScopeId`,
  10634. [WITH_CTX]: `withCtx`,
  10635. [UNREF]: `unref`,
  10636. [IS_REF]: `isRef`,
  10637. [WITH_MEMO]: `withMemo`,
  10638. [IS_MEMO_SAME]: `isMemoSame`
  10639. };
  10640. function registerRuntimeHelpers(helpers) {
  10641. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  10642. helperNameMap[s] = helpers[s];
  10643. });
  10644. }
  10645. const locStub = {
  10646. source: "",
  10647. start: { line: 1, column: 1, offset: 0 },
  10648. end: { line: 1, column: 1, offset: 0 }
  10649. };
  10650. function createRoot(children, loc = locStub) {
  10651. return {
  10652. type: 0,
  10653. children,
  10654. helpers: /* @__PURE__ */ new Set(),
  10655. components: [],
  10656. directives: [],
  10657. hoists: [],
  10658. imports: [],
  10659. cached: 0,
  10660. temps: 0,
  10661. codegenNode: void 0,
  10662. loc
  10663. };
  10664. }
  10665. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  10666. if (context) {
  10667. if (isBlock) {
  10668. context.helper(OPEN_BLOCK);
  10669. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  10670. } else {
  10671. context.helper(getVNodeHelper(context.inSSR, isComponent));
  10672. }
  10673. if (directives) {
  10674. context.helper(WITH_DIRECTIVES);
  10675. }
  10676. }
  10677. return {
  10678. type: 13,
  10679. tag,
  10680. props,
  10681. children,
  10682. patchFlag,
  10683. dynamicProps,
  10684. directives,
  10685. isBlock,
  10686. disableTracking,
  10687. isComponent,
  10688. loc
  10689. };
  10690. }
  10691. function createArrayExpression(elements, loc = locStub) {
  10692. return {
  10693. type: 17,
  10694. loc,
  10695. elements
  10696. };
  10697. }
  10698. function createObjectExpression(properties, loc = locStub) {
  10699. return {
  10700. type: 15,
  10701. loc,
  10702. properties
  10703. };
  10704. }
  10705. function createObjectProperty(key, value) {
  10706. return {
  10707. type: 16,
  10708. loc: locStub,
  10709. key: isString(key) ? createSimpleExpression(key, true) : key,
  10710. value
  10711. };
  10712. }
  10713. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  10714. return {
  10715. type: 4,
  10716. loc,
  10717. content,
  10718. isStatic,
  10719. constType: isStatic ? 3 : constType
  10720. };
  10721. }
  10722. function createCompoundExpression(children, loc = locStub) {
  10723. return {
  10724. type: 8,
  10725. loc,
  10726. children
  10727. };
  10728. }
  10729. function createCallExpression(callee, args = [], loc = locStub) {
  10730. return {
  10731. type: 14,
  10732. loc,
  10733. callee,
  10734. arguments: args
  10735. };
  10736. }
  10737. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  10738. return {
  10739. type: 18,
  10740. params,
  10741. returns,
  10742. newline,
  10743. isSlot,
  10744. loc
  10745. };
  10746. }
  10747. function createConditionalExpression(test, consequent, alternate, newline = true) {
  10748. return {
  10749. type: 19,
  10750. test,
  10751. consequent,
  10752. alternate,
  10753. newline,
  10754. loc: locStub
  10755. };
  10756. }
  10757. function createCacheExpression(index, value, isVNode = false) {
  10758. return {
  10759. type: 20,
  10760. index,
  10761. value,
  10762. isVNode,
  10763. loc: locStub
  10764. };
  10765. }
  10766. function createBlockStatement(body) {
  10767. return {
  10768. type: 21,
  10769. body,
  10770. loc: locStub
  10771. };
  10772. }
  10773. function getVNodeHelper(ssr, isComponent) {
  10774. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  10775. }
  10776. function getVNodeBlockHelper(ssr, isComponent) {
  10777. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  10778. }
  10779. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  10780. if (!node.isBlock) {
  10781. node.isBlock = true;
  10782. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  10783. helper(OPEN_BLOCK);
  10784. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  10785. }
  10786. }
  10787. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  10788. const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
  10789. function isCoreComponent(tag) {
  10790. if (isBuiltInType(tag, "Teleport")) {
  10791. return TELEPORT;
  10792. } else if (isBuiltInType(tag, "Suspense")) {
  10793. return SUSPENSE;
  10794. } else if (isBuiltInType(tag, "KeepAlive")) {
  10795. return KEEP_ALIVE;
  10796. } else if (isBuiltInType(tag, "BaseTransition")) {
  10797. return BASE_TRANSITION;
  10798. }
  10799. }
  10800. const nonIdentifierRE = /^\d|[^\$\w]/;
  10801. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  10802. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  10803. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  10804. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  10805. const isMemberExpressionBrowser = (path) => {
  10806. path = path.trim().replace(whitespaceRE, (s) => s.trim());
  10807. let state = 0 /* inMemberExp */;
  10808. let stateStack = [];
  10809. let currentOpenBracketCount = 0;
  10810. let currentOpenParensCount = 0;
  10811. let currentStringType = null;
  10812. for (let i = 0; i < path.length; i++) {
  10813. const char = path.charAt(i);
  10814. switch (state) {
  10815. case 0 /* inMemberExp */:
  10816. if (char === "[") {
  10817. stateStack.push(state);
  10818. state = 1 /* inBrackets */;
  10819. currentOpenBracketCount++;
  10820. } else if (char === "(") {
  10821. stateStack.push(state);
  10822. state = 2 /* inParens */;
  10823. currentOpenParensCount++;
  10824. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  10825. return false;
  10826. }
  10827. break;
  10828. case 1 /* inBrackets */:
  10829. if (char === `'` || char === `"` || char === "`") {
  10830. stateStack.push(state);
  10831. state = 3 /* inString */;
  10832. currentStringType = char;
  10833. } else if (char === `[`) {
  10834. currentOpenBracketCount++;
  10835. } else if (char === `]`) {
  10836. if (!--currentOpenBracketCount) {
  10837. state = stateStack.pop();
  10838. }
  10839. }
  10840. break;
  10841. case 2 /* inParens */:
  10842. if (char === `'` || char === `"` || char === "`") {
  10843. stateStack.push(state);
  10844. state = 3 /* inString */;
  10845. currentStringType = char;
  10846. } else if (char === `(`) {
  10847. currentOpenParensCount++;
  10848. } else if (char === `)`) {
  10849. if (i === path.length - 1) {
  10850. return false;
  10851. }
  10852. if (!--currentOpenParensCount) {
  10853. state = stateStack.pop();
  10854. }
  10855. }
  10856. break;
  10857. case 3 /* inString */:
  10858. if (char === currentStringType) {
  10859. state = stateStack.pop();
  10860. currentStringType = null;
  10861. }
  10862. break;
  10863. }
  10864. }
  10865. return !currentOpenBracketCount && !currentOpenParensCount;
  10866. };
  10867. const isMemberExpression = isMemberExpressionBrowser ;
  10868. function getInnerRange(loc, offset, length) {
  10869. const source = loc.source.slice(offset, offset + length);
  10870. const newLoc = {
  10871. source,
  10872. start: advancePositionWithClone(loc.start, loc.source, offset),
  10873. end: loc.end
  10874. };
  10875. if (length != null) {
  10876. newLoc.end = advancePositionWithClone(
  10877. loc.start,
  10878. loc.source,
  10879. offset + length
  10880. );
  10881. }
  10882. return newLoc;
  10883. }
  10884. function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
  10885. return advancePositionWithMutation(
  10886. extend({}, pos),
  10887. source,
  10888. numberOfCharacters
  10889. );
  10890. }
  10891. function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
  10892. let linesCount = 0;
  10893. let lastNewLinePos = -1;
  10894. for (let i = 0; i < numberOfCharacters; i++) {
  10895. if (source.charCodeAt(i) === 10) {
  10896. linesCount++;
  10897. lastNewLinePos = i;
  10898. }
  10899. }
  10900. pos.offset += numberOfCharacters;
  10901. pos.line += linesCount;
  10902. pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos;
  10903. return pos;
  10904. }
  10905. function assert(condition, msg) {
  10906. if (!condition) {
  10907. throw new Error(msg || `unexpected compiler condition`);
  10908. }
  10909. }
  10910. function findDir(node, name, allowEmpty = false) {
  10911. for (let i = 0; i < node.props.length; i++) {
  10912. const p = node.props[i];
  10913. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  10914. return p;
  10915. }
  10916. }
  10917. }
  10918. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  10919. for (let i = 0; i < node.props.length; i++) {
  10920. const p = node.props[i];
  10921. if (p.type === 6) {
  10922. if (dynamicOnly)
  10923. continue;
  10924. if (p.name === name && (p.value || allowEmpty)) {
  10925. return p;
  10926. }
  10927. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  10928. return p;
  10929. }
  10930. }
  10931. }
  10932. function isStaticArgOf(arg, name) {
  10933. return !!(arg && isStaticExp(arg) && arg.content === name);
  10934. }
  10935. function hasDynamicKeyVBind(node) {
  10936. return node.props.some(
  10937. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  10938. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  10939. !p.arg.isStatic)
  10940. // v-bind:[foo]
  10941. );
  10942. }
  10943. function isText$1(node) {
  10944. return node.type === 5 || node.type === 2;
  10945. }
  10946. function isVSlot(p) {
  10947. return p.type === 7 && p.name === "slot";
  10948. }
  10949. function isTemplateNode(node) {
  10950. return node.type === 1 && node.tagType === 3;
  10951. }
  10952. function isSlotOutlet(node) {
  10953. return node.type === 1 && node.tagType === 2;
  10954. }
  10955. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  10956. function getUnnormalizedProps(props, callPath = []) {
  10957. if (props && !isString(props) && props.type === 14) {
  10958. const callee = props.callee;
  10959. if (!isString(callee) && propsHelperSet.has(callee)) {
  10960. return getUnnormalizedProps(
  10961. props.arguments[0],
  10962. callPath.concat(props)
  10963. );
  10964. }
  10965. }
  10966. return [props, callPath];
  10967. }
  10968. function injectProp(node, prop, context) {
  10969. let propsWithInjection;
  10970. let props = node.type === 13 ? node.props : node.arguments[2];
  10971. let callPath = [];
  10972. let parentCall;
  10973. if (props && !isString(props) && props.type === 14) {
  10974. const ret = getUnnormalizedProps(props);
  10975. props = ret[0];
  10976. callPath = ret[1];
  10977. parentCall = callPath[callPath.length - 1];
  10978. }
  10979. if (props == null || isString(props)) {
  10980. propsWithInjection = createObjectExpression([prop]);
  10981. } else if (props.type === 14) {
  10982. const first = props.arguments[0];
  10983. if (!isString(first) && first.type === 15) {
  10984. if (!hasProp(prop, first)) {
  10985. first.properties.unshift(prop);
  10986. }
  10987. } else {
  10988. if (props.callee === TO_HANDLERS) {
  10989. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  10990. createObjectExpression([prop]),
  10991. props
  10992. ]);
  10993. } else {
  10994. props.arguments.unshift(createObjectExpression([prop]));
  10995. }
  10996. }
  10997. !propsWithInjection && (propsWithInjection = props);
  10998. } else if (props.type === 15) {
  10999. if (!hasProp(prop, props)) {
  11000. props.properties.unshift(prop);
  11001. }
  11002. propsWithInjection = props;
  11003. } else {
  11004. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  11005. createObjectExpression([prop]),
  11006. props
  11007. ]);
  11008. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  11009. parentCall = callPath[callPath.length - 2];
  11010. }
  11011. }
  11012. if (node.type === 13) {
  11013. if (parentCall) {
  11014. parentCall.arguments[0] = propsWithInjection;
  11015. } else {
  11016. node.props = propsWithInjection;
  11017. }
  11018. } else {
  11019. if (parentCall) {
  11020. parentCall.arguments[0] = propsWithInjection;
  11021. } else {
  11022. node.arguments[2] = propsWithInjection;
  11023. }
  11024. }
  11025. }
  11026. function hasProp(prop, props) {
  11027. let result = false;
  11028. if (prop.key.type === 4) {
  11029. const propKeyName = prop.key.content;
  11030. result = props.properties.some(
  11031. (p) => p.key.type === 4 && p.key.content === propKeyName
  11032. );
  11033. }
  11034. return result;
  11035. }
  11036. function toValidAssetId(name, type) {
  11037. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  11038. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  11039. })}`;
  11040. }
  11041. function getMemoedVNodeCall(node) {
  11042. if (node.type === 14 && node.callee === WITH_MEMO) {
  11043. return node.arguments[1].returns;
  11044. } else {
  11045. return node;
  11046. }
  11047. }
  11048. const decodeRE = /&(gt|lt|amp|apos|quot);/g;
  11049. const decodeMap = {
  11050. gt: ">",
  11051. lt: "<",
  11052. amp: "&",
  11053. apos: "'",
  11054. quot: '"'
  11055. };
  11056. const defaultParserOptions = {
  11057. delimiters: [`{{`, `}}`],
  11058. getNamespace: () => 0,
  11059. getTextMode: () => 0,
  11060. isVoidTag: NO,
  11061. isPreTag: NO,
  11062. isCustomElement: NO,
  11063. decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
  11064. onError: defaultOnError,
  11065. onWarn: defaultOnWarn,
  11066. comments: true
  11067. };
  11068. function baseParse(content, options = {}) {
  11069. const context = createParserContext(content, options);
  11070. const start = getCursor(context);
  11071. return createRoot(
  11072. parseChildren(context, 0, []),
  11073. getSelection(context, start)
  11074. );
  11075. }
  11076. function createParserContext(content, rawOptions) {
  11077. const options = extend({}, defaultParserOptions);
  11078. let key;
  11079. for (key in rawOptions) {
  11080. options[key] = rawOptions[key] === void 0 ? defaultParserOptions[key] : rawOptions[key];
  11081. }
  11082. return {
  11083. options,
  11084. column: 1,
  11085. line: 1,
  11086. offset: 0,
  11087. originalSource: content,
  11088. source: content,
  11089. inPre: false,
  11090. inVPre: false,
  11091. onWarn: options.onWarn
  11092. };
  11093. }
  11094. function parseChildren(context, mode, ancestors) {
  11095. const parent = last(ancestors);
  11096. const ns = parent ? parent.ns : 0;
  11097. const nodes = [];
  11098. while (!isEnd(context, mode, ancestors)) {
  11099. const s = context.source;
  11100. let node = void 0;
  11101. if (mode === 0 || mode === 1) {
  11102. if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
  11103. node = parseInterpolation(context, mode);
  11104. } else if (mode === 0 && s[0] === "<") {
  11105. if (s.length === 1) {
  11106. emitError(context, 5, 1);
  11107. } else if (s[1] === "!") {
  11108. if (startsWith(s, "<!--")) {
  11109. node = parseComment(context);
  11110. } else if (startsWith(s, "<!DOCTYPE")) {
  11111. node = parseBogusComment(context);
  11112. } else if (startsWith(s, "<![CDATA[")) {
  11113. if (ns !== 0) {
  11114. node = parseCDATA(context, ancestors);
  11115. } else {
  11116. emitError(context, 1);
  11117. node = parseBogusComment(context);
  11118. }
  11119. } else {
  11120. emitError(context, 11);
  11121. node = parseBogusComment(context);
  11122. }
  11123. } else if (s[1] === "/") {
  11124. if (s.length === 2) {
  11125. emitError(context, 5, 2);
  11126. } else if (s[2] === ">") {
  11127. emitError(context, 14, 2);
  11128. advanceBy(context, 3);
  11129. continue;
  11130. } else if (/[a-z]/i.test(s[2])) {
  11131. emitError(context, 23);
  11132. parseTag(context, TagType.End, parent);
  11133. continue;
  11134. } else {
  11135. emitError(
  11136. context,
  11137. 12,
  11138. 2
  11139. );
  11140. node = parseBogusComment(context);
  11141. }
  11142. } else if (/[a-z]/i.test(s[1])) {
  11143. node = parseElement(context, ancestors);
  11144. } else if (s[1] === "?") {
  11145. emitError(
  11146. context,
  11147. 21,
  11148. 1
  11149. );
  11150. node = parseBogusComment(context);
  11151. } else {
  11152. emitError(context, 12, 1);
  11153. }
  11154. }
  11155. }
  11156. if (!node) {
  11157. node = parseText(context, mode);
  11158. }
  11159. if (isArray(node)) {
  11160. for (let i = 0; i < node.length; i++) {
  11161. pushNode(nodes, node[i]);
  11162. }
  11163. } else {
  11164. pushNode(nodes, node);
  11165. }
  11166. }
  11167. let removedWhitespace = false;
  11168. if (mode !== 2 && mode !== 1) {
  11169. const shouldCondense = context.options.whitespace !== "preserve";
  11170. for (let i = 0; i < nodes.length; i++) {
  11171. const node = nodes[i];
  11172. if (node.type === 2) {
  11173. if (!context.inPre) {
  11174. if (!/[^\t\r\n\f ]/.test(node.content)) {
  11175. const prev = nodes[i - 1];
  11176. const next = nodes[i + 1];
  11177. if (!prev || !next || shouldCondense && (prev.type === 3 && next.type === 3 || prev.type === 3 && next.type === 1 || prev.type === 1 && next.type === 3 || prev.type === 1 && next.type === 1 && /[\r\n]/.test(node.content))) {
  11178. removedWhitespace = true;
  11179. nodes[i] = null;
  11180. } else {
  11181. node.content = " ";
  11182. }
  11183. } else if (shouldCondense) {
  11184. node.content = node.content.replace(/[\t\r\n\f ]+/g, " ");
  11185. }
  11186. } else {
  11187. node.content = node.content.replace(/\r\n/g, "\n");
  11188. }
  11189. } else if (node.type === 3 && !context.options.comments) {
  11190. removedWhitespace = true;
  11191. nodes[i] = null;
  11192. }
  11193. }
  11194. if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
  11195. const first = nodes[0];
  11196. if (first && first.type === 2) {
  11197. first.content = first.content.replace(/^\r?\n/, "");
  11198. }
  11199. }
  11200. }
  11201. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  11202. }
  11203. function pushNode(nodes, node) {
  11204. if (node.type === 2) {
  11205. const prev = last(nodes);
  11206. if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
  11207. prev.content += node.content;
  11208. prev.loc.end = node.loc.end;
  11209. prev.loc.source += node.loc.source;
  11210. return;
  11211. }
  11212. }
  11213. nodes.push(node);
  11214. }
  11215. function parseCDATA(context, ancestors) {
  11216. advanceBy(context, 9);
  11217. const nodes = parseChildren(context, 3, ancestors);
  11218. if (context.source.length === 0) {
  11219. emitError(context, 6);
  11220. } else {
  11221. advanceBy(context, 3);
  11222. }
  11223. return nodes;
  11224. }
  11225. function parseComment(context) {
  11226. const start = getCursor(context);
  11227. let content;
  11228. const match = /--(\!)?>/.exec(context.source);
  11229. if (!match) {
  11230. content = context.source.slice(4);
  11231. advanceBy(context, context.source.length);
  11232. emitError(context, 7);
  11233. } else {
  11234. if (match.index <= 3) {
  11235. emitError(context, 0);
  11236. }
  11237. if (match[1]) {
  11238. emitError(context, 10);
  11239. }
  11240. content = context.source.slice(4, match.index);
  11241. const s = context.source.slice(0, match.index);
  11242. let prevIndex = 1, nestedIndex = 0;
  11243. while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
  11244. advanceBy(context, nestedIndex - prevIndex + 1);
  11245. if (nestedIndex + 4 < s.length) {
  11246. emitError(context, 16);
  11247. }
  11248. prevIndex = nestedIndex + 1;
  11249. }
  11250. advanceBy(context, match.index + match[0].length - prevIndex + 1);
  11251. }
  11252. return {
  11253. type: 3,
  11254. content,
  11255. loc: getSelection(context, start)
  11256. };
  11257. }
  11258. function parseBogusComment(context) {
  11259. const start = getCursor(context);
  11260. const contentStart = context.source[1] === "?" ? 1 : 2;
  11261. let content;
  11262. const closeIndex = context.source.indexOf(">");
  11263. if (closeIndex === -1) {
  11264. content = context.source.slice(contentStart);
  11265. advanceBy(context, context.source.length);
  11266. } else {
  11267. content = context.source.slice(contentStart, closeIndex);
  11268. advanceBy(context, closeIndex + 1);
  11269. }
  11270. return {
  11271. type: 3,
  11272. content,
  11273. loc: getSelection(context, start)
  11274. };
  11275. }
  11276. function parseElement(context, ancestors) {
  11277. const wasInPre = context.inPre;
  11278. const wasInVPre = context.inVPre;
  11279. const parent = last(ancestors);
  11280. const element = parseTag(context, TagType.Start, parent);
  11281. const isPreBoundary = context.inPre && !wasInPre;
  11282. const isVPreBoundary = context.inVPre && !wasInVPre;
  11283. if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
  11284. if (isPreBoundary) {
  11285. context.inPre = false;
  11286. }
  11287. if (isVPreBoundary) {
  11288. context.inVPre = false;
  11289. }
  11290. return element;
  11291. }
  11292. ancestors.push(element);
  11293. const mode = context.options.getTextMode(element, parent);
  11294. const children = parseChildren(context, mode, ancestors);
  11295. ancestors.pop();
  11296. element.children = children;
  11297. if (startsWithEndTagOpen(context.source, element.tag)) {
  11298. parseTag(context, TagType.End, parent);
  11299. } else {
  11300. emitError(context, 24, 0, element.loc.start);
  11301. if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
  11302. const first = children[0];
  11303. if (first && startsWith(first.loc.source, "<!--")) {
  11304. emitError(context, 8);
  11305. }
  11306. }
  11307. }
  11308. element.loc = getSelection(context, element.loc.start);
  11309. if (isPreBoundary) {
  11310. context.inPre = false;
  11311. }
  11312. if (isVPreBoundary) {
  11313. context.inVPre = false;
  11314. }
  11315. return element;
  11316. }
  11317. var TagType = /* @__PURE__ */ ((TagType2) => {
  11318. TagType2[TagType2["Start"] = 0] = "Start";
  11319. TagType2[TagType2["End"] = 1] = "End";
  11320. return TagType2;
  11321. })(TagType || {});
  11322. const isSpecialTemplateDirective = /* @__PURE__ */ makeMap(
  11323. `if,else,else-if,for,slot`
  11324. );
  11325. function parseTag(context, type, parent) {
  11326. const start = getCursor(context);
  11327. const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
  11328. const tag = match[1];
  11329. const ns = context.options.getNamespace(tag, parent);
  11330. advanceBy(context, match[0].length);
  11331. advanceSpaces(context);
  11332. const cursor = getCursor(context);
  11333. const currentSource = context.source;
  11334. if (context.options.isPreTag(tag)) {
  11335. context.inPre = true;
  11336. }
  11337. let props = parseAttributes(context, type);
  11338. if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
  11339. context.inVPre = true;
  11340. extend(context, cursor);
  11341. context.source = currentSource;
  11342. props = parseAttributes(context, type).filter((p) => p.name !== "v-pre");
  11343. }
  11344. let isSelfClosing = false;
  11345. if (context.source.length === 0) {
  11346. emitError(context, 9);
  11347. } else {
  11348. isSelfClosing = startsWith(context.source, "/>");
  11349. if (type === 1 /* End */ && isSelfClosing) {
  11350. emitError(context, 4);
  11351. }
  11352. advanceBy(context, isSelfClosing ? 2 : 1);
  11353. }
  11354. if (type === 1 /* End */) {
  11355. return;
  11356. }
  11357. let tagType = 0;
  11358. if (!context.inVPre) {
  11359. if (tag === "slot") {
  11360. tagType = 2;
  11361. } else if (tag === "template") {
  11362. if (props.some(
  11363. (p) => p.type === 7 && isSpecialTemplateDirective(p.name)
  11364. )) {
  11365. tagType = 3;
  11366. }
  11367. } else if (isComponent(tag, props, context)) {
  11368. tagType = 1;
  11369. }
  11370. }
  11371. return {
  11372. type: 1,
  11373. ns,
  11374. tag,
  11375. tagType,
  11376. props,
  11377. isSelfClosing,
  11378. children: [],
  11379. loc: getSelection(context, start),
  11380. codegenNode: void 0
  11381. // to be created during transform phase
  11382. };
  11383. }
  11384. function isComponent(tag, props, context) {
  11385. const options = context.options;
  11386. if (options.isCustomElement(tag)) {
  11387. return false;
  11388. }
  11389. if (tag === "component" || /^[A-Z]/.test(tag) || isCoreComponent(tag) || options.isBuiltInComponent && options.isBuiltInComponent(tag) || options.isNativeTag && !options.isNativeTag(tag)) {
  11390. return true;
  11391. }
  11392. for (let i = 0; i < props.length; i++) {
  11393. const p = props[i];
  11394. if (p.type === 6) {
  11395. if (p.name === "is" && p.value) {
  11396. if (p.value.content.startsWith("vue:")) {
  11397. return true;
  11398. }
  11399. }
  11400. } else {
  11401. if (p.name === "is") {
  11402. return true;
  11403. } else if (
  11404. // :is on plain element - only treat as component in compat mode
  11405. p.name === "bind" && isStaticArgOf(p.arg, "is") && false
  11406. ) {
  11407. return true;
  11408. }
  11409. }
  11410. }
  11411. }
  11412. function parseAttributes(context, type) {
  11413. const props = [];
  11414. const attributeNames = /* @__PURE__ */ new Set();
  11415. while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
  11416. if (startsWith(context.source, "/")) {
  11417. emitError(context, 22);
  11418. advanceBy(context, 1);
  11419. advanceSpaces(context);
  11420. continue;
  11421. }
  11422. if (type === 1 /* End */) {
  11423. emitError(context, 3);
  11424. }
  11425. const attr = parseAttribute(context, attributeNames);
  11426. if (attr.type === 6 && attr.value && attr.name === "class") {
  11427. attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
  11428. }
  11429. if (type === 0 /* Start */) {
  11430. props.push(attr);
  11431. }
  11432. if (/^[^\t\r\n\f />]/.test(context.source)) {
  11433. emitError(context, 15);
  11434. }
  11435. advanceSpaces(context);
  11436. }
  11437. return props;
  11438. }
  11439. function parseAttribute(context, nameSet) {
  11440. var _a;
  11441. const start = getCursor(context);
  11442. const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
  11443. const name = match[0];
  11444. if (nameSet.has(name)) {
  11445. emitError(context, 2);
  11446. }
  11447. nameSet.add(name);
  11448. if (name[0] === "=") {
  11449. emitError(context, 19);
  11450. }
  11451. {
  11452. const pattern = /["'<]/g;
  11453. let m;
  11454. while (m = pattern.exec(name)) {
  11455. emitError(
  11456. context,
  11457. 17,
  11458. m.index
  11459. );
  11460. }
  11461. }
  11462. advanceBy(context, name.length);
  11463. let value = void 0;
  11464. if (/^[\t\r\n\f ]*=/.test(context.source)) {
  11465. advanceSpaces(context);
  11466. advanceBy(context, 1);
  11467. advanceSpaces(context);
  11468. value = parseAttributeValue(context);
  11469. if (!value) {
  11470. emitError(context, 13);
  11471. }
  11472. }
  11473. const loc = getSelection(context, start);
  11474. if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
  11475. const match2 = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
  11476. name
  11477. );
  11478. let isPropShorthand = startsWith(name, ".");
  11479. let dirName = match2[1] || (isPropShorthand || startsWith(name, ":") ? "bind" : startsWith(name, "@") ? "on" : "slot");
  11480. let arg;
  11481. if (match2[2]) {
  11482. const isSlot = dirName === "slot";
  11483. const startOffset = name.lastIndexOf(
  11484. match2[2],
  11485. name.length - (((_a = match2[3]) == null ? void 0 : _a.length) || 0)
  11486. );
  11487. const loc2 = getSelection(
  11488. context,
  11489. getNewPosition(context, start, startOffset),
  11490. getNewPosition(
  11491. context,
  11492. start,
  11493. startOffset + match2[2].length + (isSlot && match2[3] || "").length
  11494. )
  11495. );
  11496. let content = match2[2];
  11497. let isStatic = true;
  11498. if (content.startsWith("[")) {
  11499. isStatic = false;
  11500. if (!content.endsWith("]")) {
  11501. emitError(
  11502. context,
  11503. 27
  11504. );
  11505. content = content.slice(1);
  11506. } else {
  11507. content = content.slice(1, content.length - 1);
  11508. }
  11509. } else if (isSlot) {
  11510. content += match2[3] || "";
  11511. }
  11512. arg = {
  11513. type: 4,
  11514. content,
  11515. isStatic,
  11516. constType: isStatic ? 3 : 0,
  11517. loc: loc2
  11518. };
  11519. }
  11520. if (value && value.isQuoted) {
  11521. const valueLoc = value.loc;
  11522. valueLoc.start.offset++;
  11523. valueLoc.start.column++;
  11524. valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
  11525. valueLoc.source = valueLoc.source.slice(1, -1);
  11526. }
  11527. const modifiers = match2[3] ? match2[3].slice(1).split(".") : [];
  11528. if (isPropShorthand)
  11529. modifiers.push("prop");
  11530. return {
  11531. type: 7,
  11532. name: dirName,
  11533. exp: value && {
  11534. type: 4,
  11535. content: value.content,
  11536. isStatic: false,
  11537. // Treat as non-constant by default. This can be potentially set to
  11538. // other values by `transformExpression` to make it eligible for hoisting.
  11539. constType: 0,
  11540. loc: value.loc
  11541. },
  11542. arg,
  11543. modifiers,
  11544. loc
  11545. };
  11546. }
  11547. if (!context.inVPre && startsWith(name, "v-")) {
  11548. emitError(context, 26);
  11549. }
  11550. return {
  11551. type: 6,
  11552. name,
  11553. value: value && {
  11554. type: 2,
  11555. content: value.content,
  11556. loc: value.loc
  11557. },
  11558. loc
  11559. };
  11560. }
  11561. function parseAttributeValue(context) {
  11562. const start = getCursor(context);
  11563. let content;
  11564. const quote = context.source[0];
  11565. const isQuoted = quote === `"` || quote === `'`;
  11566. if (isQuoted) {
  11567. advanceBy(context, 1);
  11568. const endIndex = context.source.indexOf(quote);
  11569. if (endIndex === -1) {
  11570. content = parseTextData(
  11571. context,
  11572. context.source.length,
  11573. 4
  11574. );
  11575. } else {
  11576. content = parseTextData(context, endIndex, 4);
  11577. advanceBy(context, 1);
  11578. }
  11579. } else {
  11580. const match = /^[^\t\r\n\f >]+/.exec(context.source);
  11581. if (!match) {
  11582. return void 0;
  11583. }
  11584. const unexpectedChars = /["'<=`]/g;
  11585. let m;
  11586. while (m = unexpectedChars.exec(match[0])) {
  11587. emitError(
  11588. context,
  11589. 18,
  11590. m.index
  11591. );
  11592. }
  11593. content = parseTextData(context, match[0].length, 4);
  11594. }
  11595. return { content, isQuoted, loc: getSelection(context, start) };
  11596. }
  11597. function parseInterpolation(context, mode) {
  11598. const [open, close] = context.options.delimiters;
  11599. const closeIndex = context.source.indexOf(close, open.length);
  11600. if (closeIndex === -1) {
  11601. emitError(context, 25);
  11602. return void 0;
  11603. }
  11604. const start = getCursor(context);
  11605. advanceBy(context, open.length);
  11606. const innerStart = getCursor(context);
  11607. const innerEnd = getCursor(context);
  11608. const rawContentLength = closeIndex - open.length;
  11609. const rawContent = context.source.slice(0, rawContentLength);
  11610. const preTrimContent = parseTextData(context, rawContentLength, mode);
  11611. const content = preTrimContent.trim();
  11612. const startOffset = preTrimContent.indexOf(content);
  11613. if (startOffset > 0) {
  11614. advancePositionWithMutation(innerStart, rawContent, startOffset);
  11615. }
  11616. const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
  11617. advancePositionWithMutation(innerEnd, rawContent, endOffset);
  11618. advanceBy(context, close.length);
  11619. return {
  11620. type: 5,
  11621. content: {
  11622. type: 4,
  11623. isStatic: false,
  11624. // Set `isConstant` to false by default and will decide in transformExpression
  11625. constType: 0,
  11626. content,
  11627. loc: getSelection(context, innerStart, innerEnd)
  11628. },
  11629. loc: getSelection(context, start)
  11630. };
  11631. }
  11632. function parseText(context, mode) {
  11633. const endTokens = mode === 3 ? ["]]>"] : ["<", context.options.delimiters[0]];
  11634. let endIndex = context.source.length;
  11635. for (let i = 0; i < endTokens.length; i++) {
  11636. const index = context.source.indexOf(endTokens[i], 1);
  11637. if (index !== -1 && endIndex > index) {
  11638. endIndex = index;
  11639. }
  11640. }
  11641. const start = getCursor(context);
  11642. const content = parseTextData(context, endIndex, mode);
  11643. return {
  11644. type: 2,
  11645. content,
  11646. loc: getSelection(context, start)
  11647. };
  11648. }
  11649. function parseTextData(context, length, mode) {
  11650. const rawText = context.source.slice(0, length);
  11651. advanceBy(context, length);
  11652. if (mode === 2 || mode === 3 || !rawText.includes("&")) {
  11653. return rawText;
  11654. } else {
  11655. return context.options.decodeEntities(
  11656. rawText,
  11657. mode === 4
  11658. );
  11659. }
  11660. }
  11661. function getCursor(context) {
  11662. const { column, line, offset } = context;
  11663. return { column, line, offset };
  11664. }
  11665. function getSelection(context, start, end) {
  11666. end = end || getCursor(context);
  11667. return {
  11668. start,
  11669. end,
  11670. source: context.originalSource.slice(start.offset, end.offset)
  11671. };
  11672. }
  11673. function last(xs) {
  11674. return xs[xs.length - 1];
  11675. }
  11676. function startsWith(source, searchString) {
  11677. return source.startsWith(searchString);
  11678. }
  11679. function advanceBy(context, numberOfCharacters) {
  11680. const { source } = context;
  11681. advancePositionWithMutation(context, source, numberOfCharacters);
  11682. context.source = source.slice(numberOfCharacters);
  11683. }
  11684. function advanceSpaces(context) {
  11685. const match = /^[\t\r\n\f ]+/.exec(context.source);
  11686. if (match) {
  11687. advanceBy(context, match[0].length);
  11688. }
  11689. }
  11690. function getNewPosition(context, start, numberOfCharacters) {
  11691. return advancePositionWithClone(
  11692. start,
  11693. context.originalSource.slice(start.offset, numberOfCharacters),
  11694. numberOfCharacters
  11695. );
  11696. }
  11697. function emitError(context, code, offset, loc = getCursor(context)) {
  11698. if (offset) {
  11699. loc.offset += offset;
  11700. loc.column += offset;
  11701. }
  11702. context.options.onError(
  11703. createCompilerError(code, {
  11704. start: loc,
  11705. end: loc,
  11706. source: ""
  11707. })
  11708. );
  11709. }
  11710. function isEnd(context, mode, ancestors) {
  11711. const s = context.source;
  11712. switch (mode) {
  11713. case 0:
  11714. if (startsWith(s, "</")) {
  11715. for (let i = ancestors.length - 1; i >= 0; --i) {
  11716. if (startsWithEndTagOpen(s, ancestors[i].tag)) {
  11717. return true;
  11718. }
  11719. }
  11720. }
  11721. break;
  11722. case 1:
  11723. case 2: {
  11724. const parent = last(ancestors);
  11725. if (parent && startsWithEndTagOpen(s, parent.tag)) {
  11726. return true;
  11727. }
  11728. break;
  11729. }
  11730. case 3:
  11731. if (startsWith(s, "]]>")) {
  11732. return true;
  11733. }
  11734. break;
  11735. }
  11736. return !s;
  11737. }
  11738. function startsWithEndTagOpen(source, tag) {
  11739. return startsWith(source, "</") && source.slice(2, 2 + tag.length).toLowerCase() === tag.toLowerCase() && /[\t\r\n\f />]/.test(source[2 + tag.length] || ">");
  11740. }
  11741. function hoistStatic(root, context) {
  11742. walk(
  11743. root,
  11744. context,
  11745. // Root node is unfortunately non-hoistable due to potential parent
  11746. // fallthrough attributes.
  11747. isSingleElementRoot(root, root.children[0])
  11748. );
  11749. }
  11750. function isSingleElementRoot(root, child) {
  11751. const { children } = root;
  11752. return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
  11753. }
  11754. function walk(node, context, doNotHoistNode = false) {
  11755. const { children } = node;
  11756. const originalCount = children.length;
  11757. let hoistedCount = 0;
  11758. for (let i = 0; i < children.length; i++) {
  11759. const child = children[i];
  11760. if (child.type === 1 && child.tagType === 0) {
  11761. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  11762. if (constantType > 0) {
  11763. if (constantType >= 2) {
  11764. child.codegenNode.patchFlag = -1 + (` /* HOISTED */` );
  11765. child.codegenNode = context.hoist(child.codegenNode);
  11766. hoistedCount++;
  11767. continue;
  11768. }
  11769. } else {
  11770. const codegenNode = child.codegenNode;
  11771. if (codegenNode.type === 13) {
  11772. const flag = getPatchFlag(codegenNode);
  11773. if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  11774. const props = getNodeProps(child);
  11775. if (props) {
  11776. codegenNode.props = context.hoist(props);
  11777. }
  11778. }
  11779. if (codegenNode.dynamicProps) {
  11780. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  11781. }
  11782. }
  11783. }
  11784. }
  11785. if (child.type === 1) {
  11786. const isComponent = child.tagType === 1;
  11787. if (isComponent) {
  11788. context.scopes.vSlot++;
  11789. }
  11790. walk(child, context);
  11791. if (isComponent) {
  11792. context.scopes.vSlot--;
  11793. }
  11794. } else if (child.type === 11) {
  11795. walk(child, context, child.children.length === 1);
  11796. } else if (child.type === 9) {
  11797. for (let i2 = 0; i2 < child.branches.length; i2++) {
  11798. walk(
  11799. child.branches[i2],
  11800. context,
  11801. child.branches[i2].children.length === 1
  11802. );
  11803. }
  11804. }
  11805. }
  11806. if (hoistedCount && context.transformHoist) {
  11807. context.transformHoist(children, context, node);
  11808. }
  11809. if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  11810. node.codegenNode.children = context.hoist(
  11811. createArrayExpression(node.codegenNode.children)
  11812. );
  11813. }
  11814. }
  11815. function getConstantType(node, context) {
  11816. const { constantCache } = context;
  11817. switch (node.type) {
  11818. case 1:
  11819. if (node.tagType !== 0) {
  11820. return 0;
  11821. }
  11822. const cached = constantCache.get(node);
  11823. if (cached !== void 0) {
  11824. return cached;
  11825. }
  11826. const codegenNode = node.codegenNode;
  11827. if (codegenNode.type !== 13) {
  11828. return 0;
  11829. }
  11830. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
  11831. return 0;
  11832. }
  11833. const flag = getPatchFlag(codegenNode);
  11834. if (!flag) {
  11835. let returnType2 = 3;
  11836. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  11837. if (generatedPropsType === 0) {
  11838. constantCache.set(node, 0);
  11839. return 0;
  11840. }
  11841. if (generatedPropsType < returnType2) {
  11842. returnType2 = generatedPropsType;
  11843. }
  11844. for (let i = 0; i < node.children.length; i++) {
  11845. const childType = getConstantType(node.children[i], context);
  11846. if (childType === 0) {
  11847. constantCache.set(node, 0);
  11848. return 0;
  11849. }
  11850. if (childType < returnType2) {
  11851. returnType2 = childType;
  11852. }
  11853. }
  11854. if (returnType2 > 1) {
  11855. for (let i = 0; i < node.props.length; i++) {
  11856. const p = node.props[i];
  11857. if (p.type === 7 && p.name === "bind" && p.exp) {
  11858. const expType = getConstantType(p.exp, context);
  11859. if (expType === 0) {
  11860. constantCache.set(node, 0);
  11861. return 0;
  11862. }
  11863. if (expType < returnType2) {
  11864. returnType2 = expType;
  11865. }
  11866. }
  11867. }
  11868. }
  11869. if (codegenNode.isBlock) {
  11870. for (let i = 0; i < node.props.length; i++) {
  11871. const p = node.props[i];
  11872. if (p.type === 7) {
  11873. constantCache.set(node, 0);
  11874. return 0;
  11875. }
  11876. }
  11877. context.removeHelper(OPEN_BLOCK);
  11878. context.removeHelper(
  11879. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  11880. );
  11881. codegenNode.isBlock = false;
  11882. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  11883. }
  11884. constantCache.set(node, returnType2);
  11885. return returnType2;
  11886. } else {
  11887. constantCache.set(node, 0);
  11888. return 0;
  11889. }
  11890. case 2:
  11891. case 3:
  11892. return 3;
  11893. case 9:
  11894. case 11:
  11895. case 10:
  11896. return 0;
  11897. case 5:
  11898. case 12:
  11899. return getConstantType(node.content, context);
  11900. case 4:
  11901. return node.constType;
  11902. case 8:
  11903. let returnType = 3;
  11904. for (let i = 0; i < node.children.length; i++) {
  11905. const child = node.children[i];
  11906. if (isString(child) || isSymbol(child)) {
  11907. continue;
  11908. }
  11909. const childType = getConstantType(child, context);
  11910. if (childType === 0) {
  11911. return 0;
  11912. } else if (childType < returnType) {
  11913. returnType = childType;
  11914. }
  11915. }
  11916. return returnType;
  11917. default:
  11918. return 0;
  11919. }
  11920. }
  11921. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  11922. NORMALIZE_CLASS,
  11923. NORMALIZE_STYLE,
  11924. NORMALIZE_PROPS,
  11925. GUARD_REACTIVE_PROPS
  11926. ]);
  11927. function getConstantTypeOfHelperCall(value, context) {
  11928. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  11929. const arg = value.arguments[0];
  11930. if (arg.type === 4) {
  11931. return getConstantType(arg, context);
  11932. } else if (arg.type === 14) {
  11933. return getConstantTypeOfHelperCall(arg, context);
  11934. }
  11935. }
  11936. return 0;
  11937. }
  11938. function getGeneratedPropsConstantType(node, context) {
  11939. let returnType = 3;
  11940. const props = getNodeProps(node);
  11941. if (props && props.type === 15) {
  11942. const { properties } = props;
  11943. for (let i = 0; i < properties.length; i++) {
  11944. const { key, value } = properties[i];
  11945. const keyType = getConstantType(key, context);
  11946. if (keyType === 0) {
  11947. return keyType;
  11948. }
  11949. if (keyType < returnType) {
  11950. returnType = keyType;
  11951. }
  11952. let valueType;
  11953. if (value.type === 4) {
  11954. valueType = getConstantType(value, context);
  11955. } else if (value.type === 14) {
  11956. valueType = getConstantTypeOfHelperCall(value, context);
  11957. } else {
  11958. valueType = 0;
  11959. }
  11960. if (valueType === 0) {
  11961. return valueType;
  11962. }
  11963. if (valueType < returnType) {
  11964. returnType = valueType;
  11965. }
  11966. }
  11967. }
  11968. return returnType;
  11969. }
  11970. function getNodeProps(node) {
  11971. const codegenNode = node.codegenNode;
  11972. if (codegenNode.type === 13) {
  11973. return codegenNode.props;
  11974. }
  11975. }
  11976. function getPatchFlag(node) {
  11977. const flag = node.patchFlag;
  11978. return flag ? parseInt(flag, 10) : void 0;
  11979. }
  11980. function createTransformContext(root, {
  11981. filename = "",
  11982. prefixIdentifiers = false,
  11983. hoistStatic: hoistStatic2 = false,
  11984. cacheHandlers = false,
  11985. nodeTransforms = [],
  11986. directiveTransforms = {},
  11987. transformHoist = null,
  11988. isBuiltInComponent = NOOP,
  11989. isCustomElement = NOOP,
  11990. expressionPlugins = [],
  11991. scopeId = null,
  11992. slotted = true,
  11993. ssr = false,
  11994. inSSR = false,
  11995. ssrCssVars = ``,
  11996. bindingMetadata = EMPTY_OBJ,
  11997. inline = false,
  11998. isTS = false,
  11999. onError = defaultOnError,
  12000. onWarn = defaultOnWarn,
  12001. compatConfig
  12002. }) {
  12003. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  12004. const context = {
  12005. // options
  12006. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  12007. prefixIdentifiers,
  12008. hoistStatic: hoistStatic2,
  12009. cacheHandlers,
  12010. nodeTransforms,
  12011. directiveTransforms,
  12012. transformHoist,
  12013. isBuiltInComponent,
  12014. isCustomElement,
  12015. expressionPlugins,
  12016. scopeId,
  12017. slotted,
  12018. ssr,
  12019. inSSR,
  12020. ssrCssVars,
  12021. bindingMetadata,
  12022. inline,
  12023. isTS,
  12024. onError,
  12025. onWarn,
  12026. compatConfig,
  12027. // state
  12028. root,
  12029. helpers: /* @__PURE__ */ new Map(),
  12030. components: /* @__PURE__ */ new Set(),
  12031. directives: /* @__PURE__ */ new Set(),
  12032. hoists: [],
  12033. imports: [],
  12034. constantCache: /* @__PURE__ */ new Map(),
  12035. temps: 0,
  12036. cached: 0,
  12037. identifiers: /* @__PURE__ */ Object.create(null),
  12038. scopes: {
  12039. vFor: 0,
  12040. vSlot: 0,
  12041. vPre: 0,
  12042. vOnce: 0
  12043. },
  12044. parent: null,
  12045. currentNode: root,
  12046. childIndex: 0,
  12047. inVOnce: false,
  12048. // methods
  12049. helper(name) {
  12050. const count = context.helpers.get(name) || 0;
  12051. context.helpers.set(name, count + 1);
  12052. return name;
  12053. },
  12054. removeHelper(name) {
  12055. const count = context.helpers.get(name);
  12056. if (count) {
  12057. const currentCount = count - 1;
  12058. if (!currentCount) {
  12059. context.helpers.delete(name);
  12060. } else {
  12061. context.helpers.set(name, currentCount);
  12062. }
  12063. }
  12064. },
  12065. helperString(name) {
  12066. return `_${helperNameMap[context.helper(name)]}`;
  12067. },
  12068. replaceNode(node) {
  12069. {
  12070. if (!context.currentNode) {
  12071. throw new Error(`Node being replaced is already removed.`);
  12072. }
  12073. if (!context.parent) {
  12074. throw new Error(`Cannot replace root node.`);
  12075. }
  12076. }
  12077. context.parent.children[context.childIndex] = context.currentNode = node;
  12078. },
  12079. removeNode(node) {
  12080. if (!context.parent) {
  12081. throw new Error(`Cannot remove root node.`);
  12082. }
  12083. const list = context.parent.children;
  12084. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  12085. if (removalIndex < 0) {
  12086. throw new Error(`node being removed is not a child of current parent`);
  12087. }
  12088. if (!node || node === context.currentNode) {
  12089. context.currentNode = null;
  12090. context.onNodeRemoved();
  12091. } else {
  12092. if (context.childIndex > removalIndex) {
  12093. context.childIndex--;
  12094. context.onNodeRemoved();
  12095. }
  12096. }
  12097. context.parent.children.splice(removalIndex, 1);
  12098. },
  12099. onNodeRemoved: () => {
  12100. },
  12101. addIdentifiers(exp) {
  12102. },
  12103. removeIdentifiers(exp) {
  12104. },
  12105. hoist(exp) {
  12106. if (isString(exp))
  12107. exp = createSimpleExpression(exp);
  12108. context.hoists.push(exp);
  12109. const identifier = createSimpleExpression(
  12110. `_hoisted_${context.hoists.length}`,
  12111. false,
  12112. exp.loc,
  12113. 2
  12114. );
  12115. identifier.hoisted = exp;
  12116. return identifier;
  12117. },
  12118. cache(exp, isVNode = false) {
  12119. return createCacheExpression(context.cached++, exp, isVNode);
  12120. }
  12121. };
  12122. return context;
  12123. }
  12124. function transform(root, options) {
  12125. const context = createTransformContext(root, options);
  12126. traverseNode(root, context);
  12127. if (options.hoistStatic) {
  12128. hoistStatic(root, context);
  12129. }
  12130. if (!options.ssr) {
  12131. createRootCodegen(root, context);
  12132. }
  12133. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  12134. root.components = [...context.components];
  12135. root.directives = [...context.directives];
  12136. root.imports = context.imports;
  12137. root.hoists = context.hoists;
  12138. root.temps = context.temps;
  12139. root.cached = context.cached;
  12140. }
  12141. function createRootCodegen(root, context) {
  12142. const { helper } = context;
  12143. const { children } = root;
  12144. if (children.length === 1) {
  12145. const child = children[0];
  12146. if (isSingleElementRoot(root, child) && child.codegenNode) {
  12147. const codegenNode = child.codegenNode;
  12148. if (codegenNode.type === 13) {
  12149. convertToBlock(codegenNode, context);
  12150. }
  12151. root.codegenNode = codegenNode;
  12152. } else {
  12153. root.codegenNode = child;
  12154. }
  12155. } else if (children.length > 1) {
  12156. let patchFlag = 64;
  12157. let patchFlagText = PatchFlagNames[64];
  12158. if (children.filter((c) => c.type !== 3).length === 1) {
  12159. patchFlag |= 2048;
  12160. patchFlagText += `, ${PatchFlagNames[2048]}`;
  12161. }
  12162. root.codegenNode = createVNodeCall(
  12163. context,
  12164. helper(FRAGMENT),
  12165. void 0,
  12166. root.children,
  12167. patchFlag + (` /* ${patchFlagText} */` ),
  12168. void 0,
  12169. void 0,
  12170. true,
  12171. void 0,
  12172. false
  12173. /* isComponent */
  12174. );
  12175. } else ;
  12176. }
  12177. function traverseChildren(parent, context) {
  12178. let i = 0;
  12179. const nodeRemoved = () => {
  12180. i--;
  12181. };
  12182. for (; i < parent.children.length; i++) {
  12183. const child = parent.children[i];
  12184. if (isString(child))
  12185. continue;
  12186. context.parent = parent;
  12187. context.childIndex = i;
  12188. context.onNodeRemoved = nodeRemoved;
  12189. traverseNode(child, context);
  12190. }
  12191. }
  12192. function traverseNode(node, context) {
  12193. context.currentNode = node;
  12194. const { nodeTransforms } = context;
  12195. const exitFns = [];
  12196. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  12197. const onExit = nodeTransforms[i2](node, context);
  12198. if (onExit) {
  12199. if (isArray(onExit)) {
  12200. exitFns.push(...onExit);
  12201. } else {
  12202. exitFns.push(onExit);
  12203. }
  12204. }
  12205. if (!context.currentNode) {
  12206. return;
  12207. } else {
  12208. node = context.currentNode;
  12209. }
  12210. }
  12211. switch (node.type) {
  12212. case 3:
  12213. if (!context.ssr) {
  12214. context.helper(CREATE_COMMENT);
  12215. }
  12216. break;
  12217. case 5:
  12218. if (!context.ssr) {
  12219. context.helper(TO_DISPLAY_STRING);
  12220. }
  12221. break;
  12222. case 9:
  12223. for (let i2 = 0; i2 < node.branches.length; i2++) {
  12224. traverseNode(node.branches[i2], context);
  12225. }
  12226. break;
  12227. case 10:
  12228. case 11:
  12229. case 1:
  12230. case 0:
  12231. traverseChildren(node, context);
  12232. break;
  12233. }
  12234. context.currentNode = node;
  12235. let i = exitFns.length;
  12236. while (i--) {
  12237. exitFns[i]();
  12238. }
  12239. }
  12240. function createStructuralDirectiveTransform(name, fn) {
  12241. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  12242. return (node, context) => {
  12243. if (node.type === 1) {
  12244. const { props } = node;
  12245. if (node.tagType === 3 && props.some(isVSlot)) {
  12246. return;
  12247. }
  12248. const exitFns = [];
  12249. for (let i = 0; i < props.length; i++) {
  12250. const prop = props[i];
  12251. if (prop.type === 7 && matches(prop.name)) {
  12252. props.splice(i, 1);
  12253. i--;
  12254. const onExit = fn(node, prop, context);
  12255. if (onExit)
  12256. exitFns.push(onExit);
  12257. }
  12258. }
  12259. return exitFns;
  12260. }
  12261. };
  12262. }
  12263. const PURE_ANNOTATION = `/*#__PURE__*/`;
  12264. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  12265. function createCodegenContext(ast, {
  12266. mode = "function",
  12267. prefixIdentifiers = mode === "module",
  12268. sourceMap = false,
  12269. filename = `template.vue.html`,
  12270. scopeId = null,
  12271. optimizeImports = false,
  12272. runtimeGlobalName = `Vue`,
  12273. runtimeModuleName = `vue`,
  12274. ssrRuntimeModuleName = "vue/server-renderer",
  12275. ssr = false,
  12276. isTS = false,
  12277. inSSR = false
  12278. }) {
  12279. const context = {
  12280. mode,
  12281. prefixIdentifiers,
  12282. sourceMap,
  12283. filename,
  12284. scopeId,
  12285. optimizeImports,
  12286. runtimeGlobalName,
  12287. runtimeModuleName,
  12288. ssrRuntimeModuleName,
  12289. ssr,
  12290. isTS,
  12291. inSSR,
  12292. source: ast.loc.source,
  12293. code: ``,
  12294. column: 1,
  12295. line: 1,
  12296. offset: 0,
  12297. indentLevel: 0,
  12298. pure: false,
  12299. map: void 0,
  12300. helper(key) {
  12301. return `_${helperNameMap[key]}`;
  12302. },
  12303. push(code, node) {
  12304. context.code += code;
  12305. },
  12306. indent() {
  12307. newline(++context.indentLevel);
  12308. },
  12309. deindent(withoutNewLine = false) {
  12310. if (withoutNewLine) {
  12311. --context.indentLevel;
  12312. } else {
  12313. newline(--context.indentLevel);
  12314. }
  12315. },
  12316. newline() {
  12317. newline(context.indentLevel);
  12318. }
  12319. };
  12320. function newline(n) {
  12321. context.push("\n" + ` `.repeat(n));
  12322. }
  12323. return context;
  12324. }
  12325. function generate(ast, options = {}) {
  12326. const context = createCodegenContext(ast, options);
  12327. if (options.onContextCreated)
  12328. options.onContextCreated(context);
  12329. const {
  12330. mode,
  12331. push,
  12332. prefixIdentifiers,
  12333. indent,
  12334. deindent,
  12335. newline,
  12336. scopeId,
  12337. ssr
  12338. } = context;
  12339. const helpers = Array.from(ast.helpers);
  12340. const hasHelpers = helpers.length > 0;
  12341. const useWithBlock = !prefixIdentifiers && mode !== "module";
  12342. const isSetupInlined = false;
  12343. const preambleContext = isSetupInlined ? createCodegenContext(ast, options) : context;
  12344. {
  12345. genFunctionPreamble(ast, preambleContext);
  12346. }
  12347. const functionName = ssr ? `ssrRender` : `render`;
  12348. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  12349. const signature = args.join(", ");
  12350. {
  12351. push(`function ${functionName}(${signature}) {`);
  12352. }
  12353. indent();
  12354. if (useWithBlock) {
  12355. push(`with (_ctx) {`);
  12356. indent();
  12357. if (hasHelpers) {
  12358. push(`const { ${helpers.map(aliasHelper).join(", ")} } = _Vue`);
  12359. push(`
  12360. `);
  12361. newline();
  12362. }
  12363. }
  12364. if (ast.components.length) {
  12365. genAssets(ast.components, "component", context);
  12366. if (ast.directives.length || ast.temps > 0) {
  12367. newline();
  12368. }
  12369. }
  12370. if (ast.directives.length) {
  12371. genAssets(ast.directives, "directive", context);
  12372. if (ast.temps > 0) {
  12373. newline();
  12374. }
  12375. }
  12376. if (ast.temps > 0) {
  12377. push(`let `);
  12378. for (let i = 0; i < ast.temps; i++) {
  12379. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  12380. }
  12381. }
  12382. if (ast.components.length || ast.directives.length || ast.temps) {
  12383. push(`
  12384. `);
  12385. newline();
  12386. }
  12387. if (!ssr) {
  12388. push(`return `);
  12389. }
  12390. if (ast.codegenNode) {
  12391. genNode(ast.codegenNode, context);
  12392. } else {
  12393. push(`null`);
  12394. }
  12395. if (useWithBlock) {
  12396. deindent();
  12397. push(`}`);
  12398. }
  12399. deindent();
  12400. push(`}`);
  12401. return {
  12402. ast,
  12403. code: context.code,
  12404. preamble: isSetupInlined ? preambleContext.code : ``,
  12405. // SourceMapGenerator does have toJSON() method but it's not in the types
  12406. map: context.map ? context.map.toJSON() : void 0
  12407. };
  12408. }
  12409. function genFunctionPreamble(ast, context) {
  12410. const {
  12411. ssr,
  12412. prefixIdentifiers,
  12413. push,
  12414. newline,
  12415. runtimeModuleName,
  12416. runtimeGlobalName,
  12417. ssrRuntimeModuleName
  12418. } = context;
  12419. const VueBinding = runtimeGlobalName;
  12420. const helpers = Array.from(ast.helpers);
  12421. if (helpers.length > 0) {
  12422. {
  12423. push(`const _Vue = ${VueBinding}
  12424. `);
  12425. if (ast.hoists.length) {
  12426. const staticHelpers = [
  12427. CREATE_VNODE,
  12428. CREATE_ELEMENT_VNODE,
  12429. CREATE_COMMENT,
  12430. CREATE_TEXT,
  12431. CREATE_STATIC
  12432. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  12433. push(`const { ${staticHelpers} } = _Vue
  12434. `);
  12435. }
  12436. }
  12437. }
  12438. genHoists(ast.hoists, context);
  12439. newline();
  12440. push(`return `);
  12441. }
  12442. function genAssets(assets, type, { helper, push, newline, isTS }) {
  12443. const resolver = helper(
  12444. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  12445. );
  12446. for (let i = 0; i < assets.length; i++) {
  12447. let id = assets[i];
  12448. const maybeSelfReference = id.endsWith("__self");
  12449. if (maybeSelfReference) {
  12450. id = id.slice(0, -6);
  12451. }
  12452. push(
  12453. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  12454. );
  12455. if (i < assets.length - 1) {
  12456. newline();
  12457. }
  12458. }
  12459. }
  12460. function genHoists(hoists, context) {
  12461. if (!hoists.length) {
  12462. return;
  12463. }
  12464. context.pure = true;
  12465. const { push, newline, helper, scopeId, mode } = context;
  12466. newline();
  12467. for (let i = 0; i < hoists.length; i++) {
  12468. const exp = hoists[i];
  12469. if (exp) {
  12470. push(
  12471. `const _hoisted_${i + 1} = ${``}`
  12472. );
  12473. genNode(exp, context);
  12474. newline();
  12475. }
  12476. }
  12477. context.pure = false;
  12478. }
  12479. function isText(n) {
  12480. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  12481. }
  12482. function genNodeListAsArray(nodes, context) {
  12483. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  12484. context.push(`[`);
  12485. multilines && context.indent();
  12486. genNodeList(nodes, context, multilines);
  12487. multilines && context.deindent();
  12488. context.push(`]`);
  12489. }
  12490. function genNodeList(nodes, context, multilines = false, comma = true) {
  12491. const { push, newline } = context;
  12492. for (let i = 0; i < nodes.length; i++) {
  12493. const node = nodes[i];
  12494. if (isString(node)) {
  12495. push(node);
  12496. } else if (isArray(node)) {
  12497. genNodeListAsArray(node, context);
  12498. } else {
  12499. genNode(node, context);
  12500. }
  12501. if (i < nodes.length - 1) {
  12502. if (multilines) {
  12503. comma && push(",");
  12504. newline();
  12505. } else {
  12506. comma && push(", ");
  12507. }
  12508. }
  12509. }
  12510. }
  12511. function genNode(node, context) {
  12512. if (isString(node)) {
  12513. context.push(node);
  12514. return;
  12515. }
  12516. if (isSymbol(node)) {
  12517. context.push(context.helper(node));
  12518. return;
  12519. }
  12520. switch (node.type) {
  12521. case 1:
  12522. case 9:
  12523. case 11:
  12524. assert(
  12525. node.codegenNode != null,
  12526. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  12527. );
  12528. genNode(node.codegenNode, context);
  12529. break;
  12530. case 2:
  12531. genText(node, context);
  12532. break;
  12533. case 4:
  12534. genExpression(node, context);
  12535. break;
  12536. case 5:
  12537. genInterpolation(node, context);
  12538. break;
  12539. case 12:
  12540. genNode(node.codegenNode, context);
  12541. break;
  12542. case 8:
  12543. genCompoundExpression(node, context);
  12544. break;
  12545. case 3:
  12546. genComment(node, context);
  12547. break;
  12548. case 13:
  12549. genVNodeCall(node, context);
  12550. break;
  12551. case 14:
  12552. genCallExpression(node, context);
  12553. break;
  12554. case 15:
  12555. genObjectExpression(node, context);
  12556. break;
  12557. case 17:
  12558. genArrayExpression(node, context);
  12559. break;
  12560. case 18:
  12561. genFunctionExpression(node, context);
  12562. break;
  12563. case 19:
  12564. genConditionalExpression(node, context);
  12565. break;
  12566. case 20:
  12567. genCacheExpression(node, context);
  12568. break;
  12569. case 21:
  12570. genNodeList(node.body, context, true, false);
  12571. break;
  12572. case 22:
  12573. break;
  12574. case 23:
  12575. break;
  12576. case 24:
  12577. break;
  12578. case 25:
  12579. break;
  12580. case 26:
  12581. break;
  12582. case 10:
  12583. break;
  12584. default:
  12585. {
  12586. assert(false, `unhandled codegen node type: ${node.type}`);
  12587. const exhaustiveCheck = node;
  12588. return exhaustiveCheck;
  12589. }
  12590. }
  12591. }
  12592. function genText(node, context) {
  12593. context.push(JSON.stringify(node.content), node);
  12594. }
  12595. function genExpression(node, context) {
  12596. const { content, isStatic } = node;
  12597. context.push(isStatic ? JSON.stringify(content) : content, node);
  12598. }
  12599. function genInterpolation(node, context) {
  12600. const { push, helper, pure } = context;
  12601. if (pure)
  12602. push(PURE_ANNOTATION);
  12603. push(`${helper(TO_DISPLAY_STRING)}(`);
  12604. genNode(node.content, context);
  12605. push(`)`);
  12606. }
  12607. function genCompoundExpression(node, context) {
  12608. for (let i = 0; i < node.children.length; i++) {
  12609. const child = node.children[i];
  12610. if (isString(child)) {
  12611. context.push(child);
  12612. } else {
  12613. genNode(child, context);
  12614. }
  12615. }
  12616. }
  12617. function genExpressionAsPropertyKey(node, context) {
  12618. const { push } = context;
  12619. if (node.type === 8) {
  12620. push(`[`);
  12621. genCompoundExpression(node, context);
  12622. push(`]`);
  12623. } else if (node.isStatic) {
  12624. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  12625. push(text, node);
  12626. } else {
  12627. push(`[${node.content}]`, node);
  12628. }
  12629. }
  12630. function genComment(node, context) {
  12631. const { push, helper, pure } = context;
  12632. if (pure) {
  12633. push(PURE_ANNOTATION);
  12634. }
  12635. push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);
  12636. }
  12637. function genVNodeCall(node, context) {
  12638. const { push, helper, pure } = context;
  12639. const {
  12640. tag,
  12641. props,
  12642. children,
  12643. patchFlag,
  12644. dynamicProps,
  12645. directives,
  12646. isBlock,
  12647. disableTracking,
  12648. isComponent
  12649. } = node;
  12650. if (directives) {
  12651. push(helper(WITH_DIRECTIVES) + `(`);
  12652. }
  12653. if (isBlock) {
  12654. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  12655. }
  12656. if (pure) {
  12657. push(PURE_ANNOTATION);
  12658. }
  12659. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  12660. push(helper(callHelper) + `(`, node);
  12661. genNodeList(
  12662. genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
  12663. context
  12664. );
  12665. push(`)`);
  12666. if (isBlock) {
  12667. push(`)`);
  12668. }
  12669. if (directives) {
  12670. push(`, `);
  12671. genNode(directives, context);
  12672. push(`)`);
  12673. }
  12674. }
  12675. function genNullableArgs(args) {
  12676. let i = args.length;
  12677. while (i--) {
  12678. if (args[i] != null)
  12679. break;
  12680. }
  12681. return args.slice(0, i + 1).map((arg) => arg || `null`);
  12682. }
  12683. function genCallExpression(node, context) {
  12684. const { push, helper, pure } = context;
  12685. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  12686. if (pure) {
  12687. push(PURE_ANNOTATION);
  12688. }
  12689. push(callee + `(`, node);
  12690. genNodeList(node.arguments, context);
  12691. push(`)`);
  12692. }
  12693. function genObjectExpression(node, context) {
  12694. const { push, indent, deindent, newline } = context;
  12695. const { properties } = node;
  12696. if (!properties.length) {
  12697. push(`{}`, node);
  12698. return;
  12699. }
  12700. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  12701. push(multilines ? `{` : `{ `);
  12702. multilines && indent();
  12703. for (let i = 0; i < properties.length; i++) {
  12704. const { key, value } = properties[i];
  12705. genExpressionAsPropertyKey(key, context);
  12706. push(`: `);
  12707. genNode(value, context);
  12708. if (i < properties.length - 1) {
  12709. push(`,`);
  12710. newline();
  12711. }
  12712. }
  12713. multilines && deindent();
  12714. push(multilines ? `}` : ` }`);
  12715. }
  12716. function genArrayExpression(node, context) {
  12717. genNodeListAsArray(node.elements, context);
  12718. }
  12719. function genFunctionExpression(node, context) {
  12720. const { push, indent, deindent } = context;
  12721. const { params, returns, body, newline, isSlot } = node;
  12722. if (isSlot) {
  12723. push(`_${helperNameMap[WITH_CTX]}(`);
  12724. }
  12725. push(`(`, node);
  12726. if (isArray(params)) {
  12727. genNodeList(params, context);
  12728. } else if (params) {
  12729. genNode(params, context);
  12730. }
  12731. push(`) => `);
  12732. if (newline || body) {
  12733. push(`{`);
  12734. indent();
  12735. }
  12736. if (returns) {
  12737. if (newline) {
  12738. push(`return `);
  12739. }
  12740. if (isArray(returns)) {
  12741. genNodeListAsArray(returns, context);
  12742. } else {
  12743. genNode(returns, context);
  12744. }
  12745. } else if (body) {
  12746. genNode(body, context);
  12747. }
  12748. if (newline || body) {
  12749. deindent();
  12750. push(`}`);
  12751. }
  12752. if (isSlot) {
  12753. push(`)`);
  12754. }
  12755. }
  12756. function genConditionalExpression(node, context) {
  12757. const { test, consequent, alternate, newline: needNewline } = node;
  12758. const { push, indent, deindent, newline } = context;
  12759. if (test.type === 4) {
  12760. const needsParens = !isSimpleIdentifier(test.content);
  12761. needsParens && push(`(`);
  12762. genExpression(test, context);
  12763. needsParens && push(`)`);
  12764. } else {
  12765. push(`(`);
  12766. genNode(test, context);
  12767. push(`)`);
  12768. }
  12769. needNewline && indent();
  12770. context.indentLevel++;
  12771. needNewline || push(` `);
  12772. push(`? `);
  12773. genNode(consequent, context);
  12774. context.indentLevel--;
  12775. needNewline && newline();
  12776. needNewline || push(` `);
  12777. push(`: `);
  12778. const isNested = alternate.type === 19;
  12779. if (!isNested) {
  12780. context.indentLevel++;
  12781. }
  12782. genNode(alternate, context);
  12783. if (!isNested) {
  12784. context.indentLevel--;
  12785. }
  12786. needNewline && deindent(
  12787. true
  12788. /* without newline */
  12789. );
  12790. }
  12791. function genCacheExpression(node, context) {
  12792. const { push, helper, indent, deindent, newline } = context;
  12793. push(`_cache[${node.index}] || (`);
  12794. if (node.isVNode) {
  12795. indent();
  12796. push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
  12797. newline();
  12798. }
  12799. push(`_cache[${node.index}] = `);
  12800. genNode(node.value, context);
  12801. if (node.isVNode) {
  12802. push(`,`);
  12803. newline();
  12804. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  12805. newline();
  12806. push(`_cache[${node.index}]`);
  12807. deindent();
  12808. }
  12809. push(`)`);
  12810. }
  12811. const prohibitedKeywordRE = new RegExp(
  12812. "\\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"
  12813. );
  12814. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  12815. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  12816. const exp = node.content;
  12817. if (!exp.trim()) {
  12818. return;
  12819. }
  12820. try {
  12821. new Function(
  12822. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  12823. );
  12824. } catch (e) {
  12825. let message = e.message;
  12826. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  12827. if (keywordMatch) {
  12828. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  12829. }
  12830. context.onError(
  12831. createCompilerError(
  12832. 45,
  12833. node.loc,
  12834. void 0,
  12835. message
  12836. )
  12837. );
  12838. }
  12839. }
  12840. const transformExpression = (node, context) => {
  12841. if (node.type === 5) {
  12842. node.content = processExpression(
  12843. node.content,
  12844. context
  12845. );
  12846. } else if (node.type === 1) {
  12847. for (let i = 0; i < node.props.length; i++) {
  12848. const dir = node.props[i];
  12849. if (dir.type === 7 && dir.name !== "for") {
  12850. const exp = dir.exp;
  12851. const arg = dir.arg;
  12852. if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
  12853. dir.exp = processExpression(
  12854. exp,
  12855. context,
  12856. // slot args must be processed as function params
  12857. dir.name === "slot"
  12858. );
  12859. }
  12860. if (arg && arg.type === 4 && !arg.isStatic) {
  12861. dir.arg = processExpression(arg, context);
  12862. }
  12863. }
  12864. }
  12865. }
  12866. };
  12867. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  12868. {
  12869. {
  12870. validateBrowserExpression(node, context, asParams, asRawStatements);
  12871. }
  12872. return node;
  12873. }
  12874. }
  12875. const transformIf = createStructuralDirectiveTransform(
  12876. /^(if|else|else-if)$/,
  12877. (node, dir, context) => {
  12878. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  12879. const siblings = context.parent.children;
  12880. let i = siblings.indexOf(ifNode);
  12881. let key = 0;
  12882. while (i-- >= 0) {
  12883. const sibling = siblings[i];
  12884. if (sibling && sibling.type === 9) {
  12885. key += sibling.branches.length;
  12886. }
  12887. }
  12888. return () => {
  12889. if (isRoot) {
  12890. ifNode.codegenNode = createCodegenNodeForBranch(
  12891. branch,
  12892. key,
  12893. context
  12894. );
  12895. } else {
  12896. const parentCondition = getParentCondition(ifNode.codegenNode);
  12897. parentCondition.alternate = createCodegenNodeForBranch(
  12898. branch,
  12899. key + ifNode.branches.length - 1,
  12900. context
  12901. );
  12902. }
  12903. };
  12904. });
  12905. }
  12906. );
  12907. function processIf(node, dir, context, processCodegen) {
  12908. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  12909. const loc = dir.exp ? dir.exp.loc : node.loc;
  12910. context.onError(
  12911. createCompilerError(28, dir.loc)
  12912. );
  12913. dir.exp = createSimpleExpression(`true`, false, loc);
  12914. }
  12915. if (dir.exp) {
  12916. validateBrowserExpression(dir.exp, context);
  12917. }
  12918. if (dir.name === "if") {
  12919. const branch = createIfBranch(node, dir);
  12920. const ifNode = {
  12921. type: 9,
  12922. loc: node.loc,
  12923. branches: [branch]
  12924. };
  12925. context.replaceNode(ifNode);
  12926. if (processCodegen) {
  12927. return processCodegen(ifNode, branch, true);
  12928. }
  12929. } else {
  12930. const siblings = context.parent.children;
  12931. const comments = [];
  12932. let i = siblings.indexOf(node);
  12933. while (i-- >= -1) {
  12934. const sibling = siblings[i];
  12935. if (sibling && sibling.type === 3) {
  12936. context.removeNode(sibling);
  12937. comments.unshift(sibling);
  12938. continue;
  12939. }
  12940. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  12941. context.removeNode(sibling);
  12942. continue;
  12943. }
  12944. if (sibling && sibling.type === 9) {
  12945. if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  12946. context.onError(
  12947. createCompilerError(30, node.loc)
  12948. );
  12949. }
  12950. context.removeNode();
  12951. const branch = createIfBranch(node, dir);
  12952. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  12953. !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
  12954. branch.children = [...comments, ...branch.children];
  12955. }
  12956. {
  12957. const key = branch.userKey;
  12958. if (key) {
  12959. sibling.branches.forEach(({ userKey }) => {
  12960. if (isSameKey(userKey, key)) {
  12961. context.onError(
  12962. createCompilerError(
  12963. 29,
  12964. branch.userKey.loc
  12965. )
  12966. );
  12967. }
  12968. });
  12969. }
  12970. }
  12971. sibling.branches.push(branch);
  12972. const onExit = processCodegen && processCodegen(sibling, branch, false);
  12973. traverseNode(branch, context);
  12974. if (onExit)
  12975. onExit();
  12976. context.currentNode = null;
  12977. } else {
  12978. context.onError(
  12979. createCompilerError(30, node.loc)
  12980. );
  12981. }
  12982. break;
  12983. }
  12984. }
  12985. }
  12986. function createIfBranch(node, dir) {
  12987. const isTemplateIf = node.tagType === 3;
  12988. return {
  12989. type: 10,
  12990. loc: node.loc,
  12991. condition: dir.name === "else" ? void 0 : dir.exp,
  12992. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  12993. userKey: findProp(node, `key`),
  12994. isTemplateIf
  12995. };
  12996. }
  12997. function createCodegenNodeForBranch(branch, keyIndex, context) {
  12998. if (branch.condition) {
  12999. return createConditionalExpression(
  13000. branch.condition,
  13001. createChildrenCodegenNode(branch, keyIndex, context),
  13002. // make sure to pass in asBlock: true so that the comment node call
  13003. // closes the current block.
  13004. createCallExpression(context.helper(CREATE_COMMENT), [
  13005. '"v-if"' ,
  13006. "true"
  13007. ])
  13008. );
  13009. } else {
  13010. return createChildrenCodegenNode(branch, keyIndex, context);
  13011. }
  13012. }
  13013. function createChildrenCodegenNode(branch, keyIndex, context) {
  13014. const { helper } = context;
  13015. const keyProperty = createObjectProperty(
  13016. `key`,
  13017. createSimpleExpression(
  13018. `${keyIndex}`,
  13019. false,
  13020. locStub,
  13021. 2
  13022. )
  13023. );
  13024. const { children } = branch;
  13025. const firstChild = children[0];
  13026. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  13027. if (needFragmentWrapper) {
  13028. if (children.length === 1 && firstChild.type === 11) {
  13029. const vnodeCall = firstChild.codegenNode;
  13030. injectProp(vnodeCall, keyProperty, context);
  13031. return vnodeCall;
  13032. } else {
  13033. let patchFlag = 64;
  13034. let patchFlagText = PatchFlagNames[64];
  13035. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  13036. patchFlag |= 2048;
  13037. patchFlagText += `, ${PatchFlagNames[2048]}`;
  13038. }
  13039. return createVNodeCall(
  13040. context,
  13041. helper(FRAGMENT),
  13042. createObjectExpression([keyProperty]),
  13043. children,
  13044. patchFlag + (` /* ${patchFlagText} */` ),
  13045. void 0,
  13046. void 0,
  13047. true,
  13048. false,
  13049. false,
  13050. branch.loc
  13051. );
  13052. }
  13053. } else {
  13054. const ret = firstChild.codegenNode;
  13055. const vnodeCall = getMemoedVNodeCall(ret);
  13056. if (vnodeCall.type === 13) {
  13057. convertToBlock(vnodeCall, context);
  13058. }
  13059. injectProp(vnodeCall, keyProperty, context);
  13060. return ret;
  13061. }
  13062. }
  13063. function isSameKey(a, b) {
  13064. if (!a || a.type !== b.type) {
  13065. return false;
  13066. }
  13067. if (a.type === 6) {
  13068. if (a.value.content !== b.value.content) {
  13069. return false;
  13070. }
  13071. } else {
  13072. const exp = a.exp;
  13073. const branchExp = b.exp;
  13074. if (exp.type !== branchExp.type) {
  13075. return false;
  13076. }
  13077. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  13078. return false;
  13079. }
  13080. }
  13081. return true;
  13082. }
  13083. function getParentCondition(node) {
  13084. while (true) {
  13085. if (node.type === 19) {
  13086. if (node.alternate.type === 19) {
  13087. node = node.alternate;
  13088. } else {
  13089. return node;
  13090. }
  13091. } else if (node.type === 20) {
  13092. node = node.value;
  13093. }
  13094. }
  13095. }
  13096. const transformFor = createStructuralDirectiveTransform(
  13097. "for",
  13098. (node, dir, context) => {
  13099. const { helper, removeHelper } = context;
  13100. return processFor(node, dir, context, (forNode) => {
  13101. const renderExp = createCallExpression(helper(RENDER_LIST), [
  13102. forNode.source
  13103. ]);
  13104. const isTemplate = isTemplateNode(node);
  13105. const memo = findDir(node, "memo");
  13106. const keyProp = findProp(node, `key`);
  13107. const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
  13108. const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
  13109. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  13110. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  13111. forNode.codegenNode = createVNodeCall(
  13112. context,
  13113. helper(FRAGMENT),
  13114. void 0,
  13115. renderExp,
  13116. fragmentFlag + (` /* ${PatchFlagNames[fragmentFlag]} */` ),
  13117. void 0,
  13118. void 0,
  13119. true,
  13120. !isStableFragment,
  13121. false,
  13122. node.loc
  13123. );
  13124. return () => {
  13125. let childBlock;
  13126. const { children } = forNode;
  13127. if (isTemplate) {
  13128. node.children.some((c) => {
  13129. if (c.type === 1) {
  13130. const key = findProp(c, "key");
  13131. if (key) {
  13132. context.onError(
  13133. createCompilerError(
  13134. 33,
  13135. key.loc
  13136. )
  13137. );
  13138. return true;
  13139. }
  13140. }
  13141. });
  13142. }
  13143. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  13144. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  13145. if (slotOutlet) {
  13146. childBlock = slotOutlet.codegenNode;
  13147. if (isTemplate && keyProperty) {
  13148. injectProp(childBlock, keyProperty, context);
  13149. }
  13150. } else if (needFragmentWrapper) {
  13151. childBlock = createVNodeCall(
  13152. context,
  13153. helper(FRAGMENT),
  13154. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  13155. node.children,
  13156. 64 + (` /* ${PatchFlagNames[64]} */` ),
  13157. void 0,
  13158. void 0,
  13159. true,
  13160. void 0,
  13161. false
  13162. /* isComponent */
  13163. );
  13164. } else {
  13165. childBlock = children[0].codegenNode;
  13166. if (isTemplate && keyProperty) {
  13167. injectProp(childBlock, keyProperty, context);
  13168. }
  13169. if (childBlock.isBlock !== !isStableFragment) {
  13170. if (childBlock.isBlock) {
  13171. removeHelper(OPEN_BLOCK);
  13172. removeHelper(
  13173. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  13174. );
  13175. } else {
  13176. removeHelper(
  13177. getVNodeHelper(context.inSSR, childBlock.isComponent)
  13178. );
  13179. }
  13180. }
  13181. childBlock.isBlock = !isStableFragment;
  13182. if (childBlock.isBlock) {
  13183. helper(OPEN_BLOCK);
  13184. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  13185. } else {
  13186. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  13187. }
  13188. }
  13189. if (memo) {
  13190. const loop = createFunctionExpression(
  13191. createForLoopParams(forNode.parseResult, [
  13192. createSimpleExpression(`_cached`)
  13193. ])
  13194. );
  13195. loop.body = createBlockStatement([
  13196. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  13197. createCompoundExpression([
  13198. `if (_cached`,
  13199. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  13200. ` && ${context.helperString(
  13201. IS_MEMO_SAME
  13202. )}(_cached, _memo)) return _cached`
  13203. ]),
  13204. createCompoundExpression([`const _item = `, childBlock]),
  13205. createSimpleExpression(`_item.memo = _memo`),
  13206. createSimpleExpression(`return _item`)
  13207. ]);
  13208. renderExp.arguments.push(
  13209. loop,
  13210. createSimpleExpression(`_cache`),
  13211. createSimpleExpression(String(context.cached++))
  13212. );
  13213. } else {
  13214. renderExp.arguments.push(
  13215. createFunctionExpression(
  13216. createForLoopParams(forNode.parseResult),
  13217. childBlock,
  13218. true
  13219. /* force newline */
  13220. )
  13221. );
  13222. }
  13223. };
  13224. });
  13225. }
  13226. );
  13227. function processFor(node, dir, context, processCodegen) {
  13228. if (!dir.exp) {
  13229. context.onError(
  13230. createCompilerError(31, dir.loc)
  13231. );
  13232. return;
  13233. }
  13234. const parseResult = parseForExpression(
  13235. // can only be simple expression because vFor transform is applied
  13236. // before expression transform.
  13237. dir.exp,
  13238. context
  13239. );
  13240. if (!parseResult) {
  13241. context.onError(
  13242. createCompilerError(32, dir.loc)
  13243. );
  13244. return;
  13245. }
  13246. const { addIdentifiers, removeIdentifiers, scopes } = context;
  13247. const { source, value, key, index } = parseResult;
  13248. const forNode = {
  13249. type: 11,
  13250. loc: dir.loc,
  13251. source,
  13252. valueAlias: value,
  13253. keyAlias: key,
  13254. objectIndexAlias: index,
  13255. parseResult,
  13256. children: isTemplateNode(node) ? node.children : [node]
  13257. };
  13258. context.replaceNode(forNode);
  13259. scopes.vFor++;
  13260. const onExit = processCodegen && processCodegen(forNode);
  13261. return () => {
  13262. scopes.vFor--;
  13263. if (onExit)
  13264. onExit();
  13265. };
  13266. }
  13267. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  13268. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  13269. const stripParensRE = /^\(|\)$/g;
  13270. function parseForExpression(input, context) {
  13271. const loc = input.loc;
  13272. const exp = input.content;
  13273. const inMatch = exp.match(forAliasRE);
  13274. if (!inMatch)
  13275. return;
  13276. const [, LHS, RHS] = inMatch;
  13277. const result = {
  13278. source: createAliasExpression(
  13279. loc,
  13280. RHS.trim(),
  13281. exp.indexOf(RHS, LHS.length)
  13282. ),
  13283. value: void 0,
  13284. key: void 0,
  13285. index: void 0
  13286. };
  13287. {
  13288. validateBrowserExpression(result.source, context);
  13289. }
  13290. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  13291. const trimmedOffset = LHS.indexOf(valueContent);
  13292. const iteratorMatch = valueContent.match(forIteratorRE);
  13293. if (iteratorMatch) {
  13294. valueContent = valueContent.replace(forIteratorRE, "").trim();
  13295. const keyContent = iteratorMatch[1].trim();
  13296. let keyOffset;
  13297. if (keyContent) {
  13298. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  13299. result.key = createAliasExpression(loc, keyContent, keyOffset);
  13300. {
  13301. validateBrowserExpression(
  13302. result.key,
  13303. context,
  13304. true
  13305. );
  13306. }
  13307. }
  13308. if (iteratorMatch[2]) {
  13309. const indexContent = iteratorMatch[2].trim();
  13310. if (indexContent) {
  13311. result.index = createAliasExpression(
  13312. loc,
  13313. indexContent,
  13314. exp.indexOf(
  13315. indexContent,
  13316. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  13317. )
  13318. );
  13319. {
  13320. validateBrowserExpression(
  13321. result.index,
  13322. context,
  13323. true
  13324. );
  13325. }
  13326. }
  13327. }
  13328. }
  13329. if (valueContent) {
  13330. result.value = createAliasExpression(loc, valueContent, trimmedOffset);
  13331. {
  13332. validateBrowserExpression(
  13333. result.value,
  13334. context,
  13335. true
  13336. );
  13337. }
  13338. }
  13339. return result;
  13340. }
  13341. function createAliasExpression(range, content, offset) {
  13342. return createSimpleExpression(
  13343. content,
  13344. false,
  13345. getInnerRange(range, offset, content.length)
  13346. );
  13347. }
  13348. function createForLoopParams({ value, key, index }, memoArgs = []) {
  13349. return createParamsList([value, key, index, ...memoArgs]);
  13350. }
  13351. function createParamsList(args) {
  13352. let i = args.length;
  13353. while (i--) {
  13354. if (args[i])
  13355. break;
  13356. }
  13357. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  13358. }
  13359. const defaultFallback = createSimpleExpression(`undefined`, false);
  13360. const trackSlotScopes = (node, context) => {
  13361. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  13362. const vSlot = findDir(node, "slot");
  13363. if (vSlot) {
  13364. vSlot.exp;
  13365. context.scopes.vSlot++;
  13366. return () => {
  13367. context.scopes.vSlot--;
  13368. };
  13369. }
  13370. }
  13371. };
  13372. const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
  13373. props,
  13374. children,
  13375. false,
  13376. true,
  13377. children.length ? children[0].loc : loc
  13378. );
  13379. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  13380. context.helper(WITH_CTX);
  13381. const { children, loc } = node;
  13382. const slotsProperties = [];
  13383. const dynamicSlots = [];
  13384. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  13385. const onComponentSlot = findDir(node, "slot", true);
  13386. if (onComponentSlot) {
  13387. const { arg, exp } = onComponentSlot;
  13388. if (arg && !isStaticExp(arg)) {
  13389. hasDynamicSlots = true;
  13390. }
  13391. slotsProperties.push(
  13392. createObjectProperty(
  13393. arg || createSimpleExpression("default", true),
  13394. buildSlotFn(exp, children, loc)
  13395. )
  13396. );
  13397. }
  13398. let hasTemplateSlots = false;
  13399. let hasNamedDefaultSlot = false;
  13400. const implicitDefaultChildren = [];
  13401. const seenSlotNames = /* @__PURE__ */ new Set();
  13402. let conditionalBranchIndex = 0;
  13403. for (let i = 0; i < children.length; i++) {
  13404. const slotElement = children[i];
  13405. let slotDir;
  13406. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  13407. if (slotElement.type !== 3) {
  13408. implicitDefaultChildren.push(slotElement);
  13409. }
  13410. continue;
  13411. }
  13412. if (onComponentSlot) {
  13413. context.onError(
  13414. createCompilerError(37, slotDir.loc)
  13415. );
  13416. break;
  13417. }
  13418. hasTemplateSlots = true;
  13419. const { children: slotChildren, loc: slotLoc } = slotElement;
  13420. const {
  13421. arg: slotName = createSimpleExpression(`default`, true),
  13422. exp: slotProps,
  13423. loc: dirLoc
  13424. } = slotDir;
  13425. let staticSlotName;
  13426. if (isStaticExp(slotName)) {
  13427. staticSlotName = slotName ? slotName.content : `default`;
  13428. } else {
  13429. hasDynamicSlots = true;
  13430. }
  13431. const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
  13432. let vIf;
  13433. let vElse;
  13434. let vFor;
  13435. if (vIf = findDir(slotElement, "if")) {
  13436. hasDynamicSlots = true;
  13437. dynamicSlots.push(
  13438. createConditionalExpression(
  13439. vIf.exp,
  13440. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  13441. defaultFallback
  13442. )
  13443. );
  13444. } else if (vElse = findDir(
  13445. slotElement,
  13446. /^else(-if)?$/,
  13447. true
  13448. /* allowEmpty */
  13449. )) {
  13450. let j = i;
  13451. let prev;
  13452. while (j--) {
  13453. prev = children[j];
  13454. if (prev.type !== 3) {
  13455. break;
  13456. }
  13457. }
  13458. if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
  13459. children.splice(i, 1);
  13460. i--;
  13461. let conditional = dynamicSlots[dynamicSlots.length - 1];
  13462. while (conditional.alternate.type === 19) {
  13463. conditional = conditional.alternate;
  13464. }
  13465. conditional.alternate = vElse.exp ? createConditionalExpression(
  13466. vElse.exp,
  13467. buildDynamicSlot(
  13468. slotName,
  13469. slotFunction,
  13470. conditionalBranchIndex++
  13471. ),
  13472. defaultFallback
  13473. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  13474. } else {
  13475. context.onError(
  13476. createCompilerError(30, vElse.loc)
  13477. );
  13478. }
  13479. } else if (vFor = findDir(slotElement, "for")) {
  13480. hasDynamicSlots = true;
  13481. const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
  13482. if (parseResult) {
  13483. dynamicSlots.push(
  13484. createCallExpression(context.helper(RENDER_LIST), [
  13485. parseResult.source,
  13486. createFunctionExpression(
  13487. createForLoopParams(parseResult),
  13488. buildDynamicSlot(slotName, slotFunction),
  13489. true
  13490. /* force newline */
  13491. )
  13492. ])
  13493. );
  13494. } else {
  13495. context.onError(
  13496. createCompilerError(32, vFor.loc)
  13497. );
  13498. }
  13499. } else {
  13500. if (staticSlotName) {
  13501. if (seenSlotNames.has(staticSlotName)) {
  13502. context.onError(
  13503. createCompilerError(
  13504. 38,
  13505. dirLoc
  13506. )
  13507. );
  13508. continue;
  13509. }
  13510. seenSlotNames.add(staticSlotName);
  13511. if (staticSlotName === "default") {
  13512. hasNamedDefaultSlot = true;
  13513. }
  13514. }
  13515. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  13516. }
  13517. }
  13518. if (!onComponentSlot) {
  13519. const buildDefaultSlotProperty = (props, children2) => {
  13520. const fn = buildSlotFn(props, children2, loc);
  13521. return createObjectProperty(`default`, fn);
  13522. };
  13523. if (!hasTemplateSlots) {
  13524. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  13525. } else if (implicitDefaultChildren.length && // #3766
  13526. // with whitespace: 'preserve', whitespaces between slots will end up in
  13527. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  13528. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  13529. if (hasNamedDefaultSlot) {
  13530. context.onError(
  13531. createCompilerError(
  13532. 39,
  13533. implicitDefaultChildren[0].loc
  13534. )
  13535. );
  13536. } else {
  13537. slotsProperties.push(
  13538. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  13539. );
  13540. }
  13541. }
  13542. }
  13543. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  13544. let slots = createObjectExpression(
  13545. slotsProperties.concat(
  13546. createObjectProperty(
  13547. `_`,
  13548. // 2 = compiled but dynamic = can skip normalization, but must run diff
  13549. // 1 = compiled and static = can skip normalization AND diff as optimized
  13550. createSimpleExpression(
  13551. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  13552. false
  13553. )
  13554. )
  13555. ),
  13556. loc
  13557. );
  13558. if (dynamicSlots.length) {
  13559. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  13560. slots,
  13561. createArrayExpression(dynamicSlots)
  13562. ]);
  13563. }
  13564. return {
  13565. slots,
  13566. hasDynamicSlots
  13567. };
  13568. }
  13569. function buildDynamicSlot(name, fn, index) {
  13570. const props = [
  13571. createObjectProperty(`name`, name),
  13572. createObjectProperty(`fn`, fn)
  13573. ];
  13574. if (index != null) {
  13575. props.push(
  13576. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  13577. );
  13578. }
  13579. return createObjectExpression(props);
  13580. }
  13581. function hasForwardedSlots(children) {
  13582. for (let i = 0; i < children.length; i++) {
  13583. const child = children[i];
  13584. switch (child.type) {
  13585. case 1:
  13586. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  13587. return true;
  13588. }
  13589. break;
  13590. case 9:
  13591. if (hasForwardedSlots(child.branches))
  13592. return true;
  13593. break;
  13594. case 10:
  13595. case 11:
  13596. if (hasForwardedSlots(child.children))
  13597. return true;
  13598. break;
  13599. }
  13600. }
  13601. return false;
  13602. }
  13603. function isNonWhitespaceContent(node) {
  13604. if (node.type !== 2 && node.type !== 12)
  13605. return true;
  13606. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  13607. }
  13608. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  13609. const transformElement = (node, context) => {
  13610. return function postTransformElement() {
  13611. node = context.currentNode;
  13612. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  13613. return;
  13614. }
  13615. const { tag, props } = node;
  13616. const isComponent = node.tagType === 1;
  13617. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  13618. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  13619. let vnodeProps;
  13620. let vnodeChildren;
  13621. let vnodePatchFlag;
  13622. let patchFlag = 0;
  13623. let vnodeDynamicProps;
  13624. let dynamicPropNames;
  13625. let vnodeDirectives;
  13626. let shouldUseBlock = (
  13627. // dynamic component may resolve to plain elements
  13628. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  13629. // updates inside get proper isSVG flag at runtime. (#639, #643)
  13630. // This is technically web-specific, but splitting the logic out of core
  13631. // leads to too much unnecessary complexity.
  13632. (tag === "svg" || tag === "foreignObject")
  13633. );
  13634. if (props.length > 0) {
  13635. const propsBuildResult = buildProps(
  13636. node,
  13637. context,
  13638. void 0,
  13639. isComponent,
  13640. isDynamicComponent
  13641. );
  13642. vnodeProps = propsBuildResult.props;
  13643. patchFlag = propsBuildResult.patchFlag;
  13644. dynamicPropNames = propsBuildResult.dynamicPropNames;
  13645. const directives = propsBuildResult.directives;
  13646. vnodeDirectives = directives && directives.length ? createArrayExpression(
  13647. directives.map((dir) => buildDirectiveArgs(dir, context))
  13648. ) : void 0;
  13649. if (propsBuildResult.shouldUseBlock) {
  13650. shouldUseBlock = true;
  13651. }
  13652. }
  13653. if (node.children.length > 0) {
  13654. if (vnodeTag === KEEP_ALIVE) {
  13655. shouldUseBlock = true;
  13656. patchFlag |= 1024;
  13657. if (node.children.length > 1) {
  13658. context.onError(
  13659. createCompilerError(46, {
  13660. start: node.children[0].loc.start,
  13661. end: node.children[node.children.length - 1].loc.end,
  13662. source: ""
  13663. })
  13664. );
  13665. }
  13666. }
  13667. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  13668. vnodeTag !== TELEPORT && // explained above.
  13669. vnodeTag !== KEEP_ALIVE;
  13670. if (shouldBuildAsSlots) {
  13671. const { slots, hasDynamicSlots } = buildSlots(node, context);
  13672. vnodeChildren = slots;
  13673. if (hasDynamicSlots) {
  13674. patchFlag |= 1024;
  13675. }
  13676. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  13677. const child = node.children[0];
  13678. const type = child.type;
  13679. const hasDynamicTextChild = type === 5 || type === 8;
  13680. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  13681. patchFlag |= 1;
  13682. }
  13683. if (hasDynamicTextChild || type === 2) {
  13684. vnodeChildren = child;
  13685. } else {
  13686. vnodeChildren = node.children;
  13687. }
  13688. } else {
  13689. vnodeChildren = node.children;
  13690. }
  13691. }
  13692. if (patchFlag !== 0) {
  13693. {
  13694. if (patchFlag < 0) {
  13695. vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  13696. } else {
  13697. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  13698. vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
  13699. }
  13700. }
  13701. if (dynamicPropNames && dynamicPropNames.length) {
  13702. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  13703. }
  13704. }
  13705. node.codegenNode = createVNodeCall(
  13706. context,
  13707. vnodeTag,
  13708. vnodeProps,
  13709. vnodeChildren,
  13710. vnodePatchFlag,
  13711. vnodeDynamicProps,
  13712. vnodeDirectives,
  13713. !!shouldUseBlock,
  13714. false,
  13715. isComponent,
  13716. node.loc
  13717. );
  13718. };
  13719. };
  13720. function resolveComponentType(node, context, ssr = false) {
  13721. let { tag } = node;
  13722. const isExplicitDynamic = isComponentTag(tag);
  13723. const isProp = findProp(node, "is");
  13724. if (isProp) {
  13725. if (isExplicitDynamic || false) {
  13726. const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp;
  13727. if (exp) {
  13728. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  13729. exp
  13730. ]);
  13731. }
  13732. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  13733. tag = isProp.value.content.slice(4);
  13734. }
  13735. }
  13736. const isDir = !isExplicitDynamic && findDir(node, "is");
  13737. if (isDir && isDir.exp) {
  13738. {
  13739. context.onWarn(
  13740. createCompilerError(52, isDir.loc)
  13741. );
  13742. }
  13743. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  13744. isDir.exp
  13745. ]);
  13746. }
  13747. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  13748. if (builtIn) {
  13749. if (!ssr)
  13750. context.helper(builtIn);
  13751. return builtIn;
  13752. }
  13753. context.helper(RESOLVE_COMPONENT);
  13754. context.components.add(tag);
  13755. return toValidAssetId(tag, `component`);
  13756. }
  13757. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  13758. const { tag, loc: elementLoc, children } = node;
  13759. let properties = [];
  13760. const mergeArgs = [];
  13761. const runtimeDirectives = [];
  13762. const hasChildren = children.length > 0;
  13763. let shouldUseBlock = false;
  13764. let patchFlag = 0;
  13765. let hasRef = false;
  13766. let hasClassBinding = false;
  13767. let hasStyleBinding = false;
  13768. let hasHydrationEventBinding = false;
  13769. let hasDynamicKeys = false;
  13770. let hasVnodeHook = false;
  13771. const dynamicPropNames = [];
  13772. const pushMergeArg = (arg) => {
  13773. if (properties.length) {
  13774. mergeArgs.push(
  13775. createObjectExpression(dedupeProperties(properties), elementLoc)
  13776. );
  13777. properties = [];
  13778. }
  13779. if (arg)
  13780. mergeArgs.push(arg);
  13781. };
  13782. const analyzePatchFlag = ({ key, value }) => {
  13783. if (isStaticExp(key)) {
  13784. const name = key.content;
  13785. const isEventHandler = isOn(name);
  13786. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  13787. // dedicated fast path.
  13788. name.toLowerCase() !== "onclick" && // omit v-model handlers
  13789. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  13790. !isReservedProp(name)) {
  13791. hasHydrationEventBinding = true;
  13792. }
  13793. if (isEventHandler && isReservedProp(name)) {
  13794. hasVnodeHook = true;
  13795. }
  13796. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  13797. return;
  13798. }
  13799. if (name === "ref") {
  13800. hasRef = true;
  13801. } else if (name === "class") {
  13802. hasClassBinding = true;
  13803. } else if (name === "style") {
  13804. hasStyleBinding = true;
  13805. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  13806. dynamicPropNames.push(name);
  13807. }
  13808. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  13809. dynamicPropNames.push(name);
  13810. }
  13811. } else {
  13812. hasDynamicKeys = true;
  13813. }
  13814. };
  13815. for (let i = 0; i < props.length; i++) {
  13816. const prop = props[i];
  13817. if (prop.type === 6) {
  13818. const { loc, name, value } = prop;
  13819. let isStatic = true;
  13820. if (name === "ref") {
  13821. hasRef = true;
  13822. if (context.scopes.vFor > 0) {
  13823. properties.push(
  13824. createObjectProperty(
  13825. createSimpleExpression("ref_for", true),
  13826. createSimpleExpression("true")
  13827. )
  13828. );
  13829. }
  13830. }
  13831. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  13832. continue;
  13833. }
  13834. properties.push(
  13835. createObjectProperty(
  13836. createSimpleExpression(
  13837. name,
  13838. true,
  13839. getInnerRange(loc, 0, name.length)
  13840. ),
  13841. createSimpleExpression(
  13842. value ? value.content : "",
  13843. isStatic,
  13844. value ? value.loc : loc
  13845. )
  13846. )
  13847. );
  13848. } else {
  13849. const { name, arg, exp, loc } = prop;
  13850. const isVBind = name === "bind";
  13851. const isVOn = name === "on";
  13852. if (name === "slot") {
  13853. if (!isComponent) {
  13854. context.onError(
  13855. createCompilerError(40, loc)
  13856. );
  13857. }
  13858. continue;
  13859. }
  13860. if (name === "once" || name === "memo") {
  13861. continue;
  13862. }
  13863. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  13864. continue;
  13865. }
  13866. if (isVOn && ssr) {
  13867. continue;
  13868. }
  13869. if (
  13870. // #938: elements with dynamic keys should be forced into blocks
  13871. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  13872. // before children
  13873. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  13874. ) {
  13875. shouldUseBlock = true;
  13876. }
  13877. if (isVBind && isStaticArgOf(arg, "ref") && context.scopes.vFor > 0) {
  13878. properties.push(
  13879. createObjectProperty(
  13880. createSimpleExpression("ref_for", true),
  13881. createSimpleExpression("true")
  13882. )
  13883. );
  13884. }
  13885. if (!arg && (isVBind || isVOn)) {
  13886. hasDynamicKeys = true;
  13887. if (exp) {
  13888. if (isVBind) {
  13889. pushMergeArg();
  13890. mergeArgs.push(exp);
  13891. } else {
  13892. pushMergeArg({
  13893. type: 14,
  13894. loc,
  13895. callee: context.helper(TO_HANDLERS),
  13896. arguments: isComponent ? [exp] : [exp, `true`]
  13897. });
  13898. }
  13899. } else {
  13900. context.onError(
  13901. createCompilerError(
  13902. isVBind ? 34 : 35,
  13903. loc
  13904. )
  13905. );
  13906. }
  13907. continue;
  13908. }
  13909. const directiveTransform = context.directiveTransforms[name];
  13910. if (directiveTransform) {
  13911. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  13912. !ssr && props2.forEach(analyzePatchFlag);
  13913. if (isVOn && arg && !isStaticExp(arg)) {
  13914. pushMergeArg(createObjectExpression(props2, elementLoc));
  13915. } else {
  13916. properties.push(...props2);
  13917. }
  13918. if (needRuntime) {
  13919. runtimeDirectives.push(prop);
  13920. if (isSymbol(needRuntime)) {
  13921. directiveImportMap.set(prop, needRuntime);
  13922. }
  13923. }
  13924. } else if (!isBuiltInDirective(name)) {
  13925. runtimeDirectives.push(prop);
  13926. if (hasChildren) {
  13927. shouldUseBlock = true;
  13928. }
  13929. }
  13930. }
  13931. }
  13932. let propsExpression = void 0;
  13933. if (mergeArgs.length) {
  13934. pushMergeArg();
  13935. if (mergeArgs.length > 1) {
  13936. propsExpression = createCallExpression(
  13937. context.helper(MERGE_PROPS),
  13938. mergeArgs,
  13939. elementLoc
  13940. );
  13941. } else {
  13942. propsExpression = mergeArgs[0];
  13943. }
  13944. } else if (properties.length) {
  13945. propsExpression = createObjectExpression(
  13946. dedupeProperties(properties),
  13947. elementLoc
  13948. );
  13949. }
  13950. if (hasDynamicKeys) {
  13951. patchFlag |= 16;
  13952. } else {
  13953. if (hasClassBinding && !isComponent) {
  13954. patchFlag |= 2;
  13955. }
  13956. if (hasStyleBinding && !isComponent) {
  13957. patchFlag |= 4;
  13958. }
  13959. if (dynamicPropNames.length) {
  13960. patchFlag |= 8;
  13961. }
  13962. if (hasHydrationEventBinding) {
  13963. patchFlag |= 32;
  13964. }
  13965. }
  13966. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  13967. patchFlag |= 512;
  13968. }
  13969. if (!context.inSSR && propsExpression) {
  13970. switch (propsExpression.type) {
  13971. case 15:
  13972. let classKeyIndex = -1;
  13973. let styleKeyIndex = -1;
  13974. let hasDynamicKey = false;
  13975. for (let i = 0; i < propsExpression.properties.length; i++) {
  13976. const key = propsExpression.properties[i].key;
  13977. if (isStaticExp(key)) {
  13978. if (key.content === "class") {
  13979. classKeyIndex = i;
  13980. } else if (key.content === "style") {
  13981. styleKeyIndex = i;
  13982. }
  13983. } else if (!key.isHandlerKey) {
  13984. hasDynamicKey = true;
  13985. }
  13986. }
  13987. const classProp = propsExpression.properties[classKeyIndex];
  13988. const styleProp = propsExpression.properties[styleKeyIndex];
  13989. if (!hasDynamicKey) {
  13990. if (classProp && !isStaticExp(classProp.value)) {
  13991. classProp.value = createCallExpression(
  13992. context.helper(NORMALIZE_CLASS),
  13993. [classProp.value]
  13994. );
  13995. }
  13996. if (styleProp && // the static style is compiled into an object,
  13997. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  13998. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  13999. // v-bind:style with static literal object
  14000. styleProp.value.type === 17)) {
  14001. styleProp.value = createCallExpression(
  14002. context.helper(NORMALIZE_STYLE),
  14003. [styleProp.value]
  14004. );
  14005. }
  14006. } else {
  14007. propsExpression = createCallExpression(
  14008. context.helper(NORMALIZE_PROPS),
  14009. [propsExpression]
  14010. );
  14011. }
  14012. break;
  14013. case 14:
  14014. break;
  14015. default:
  14016. propsExpression = createCallExpression(
  14017. context.helper(NORMALIZE_PROPS),
  14018. [
  14019. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  14020. propsExpression
  14021. ])
  14022. ]
  14023. );
  14024. break;
  14025. }
  14026. }
  14027. return {
  14028. props: propsExpression,
  14029. directives: runtimeDirectives,
  14030. patchFlag,
  14031. dynamicPropNames,
  14032. shouldUseBlock
  14033. };
  14034. }
  14035. function dedupeProperties(properties) {
  14036. const knownProps = /* @__PURE__ */ new Map();
  14037. const deduped = [];
  14038. for (let i = 0; i < properties.length; i++) {
  14039. const prop = properties[i];
  14040. if (prop.key.type === 8 || !prop.key.isStatic) {
  14041. deduped.push(prop);
  14042. continue;
  14043. }
  14044. const name = prop.key.content;
  14045. const existing = knownProps.get(name);
  14046. if (existing) {
  14047. if (name === "style" || name === "class" || isOn(name)) {
  14048. mergeAsArray(existing, prop);
  14049. }
  14050. } else {
  14051. knownProps.set(name, prop);
  14052. deduped.push(prop);
  14053. }
  14054. }
  14055. return deduped;
  14056. }
  14057. function mergeAsArray(existing, incoming) {
  14058. if (existing.value.type === 17) {
  14059. existing.value.elements.push(incoming.value);
  14060. } else {
  14061. existing.value = createArrayExpression(
  14062. [existing.value, incoming.value],
  14063. existing.loc
  14064. );
  14065. }
  14066. }
  14067. function buildDirectiveArgs(dir, context) {
  14068. const dirArgs = [];
  14069. const runtime = directiveImportMap.get(dir);
  14070. if (runtime) {
  14071. dirArgs.push(context.helperString(runtime));
  14072. } else {
  14073. {
  14074. context.helper(RESOLVE_DIRECTIVE);
  14075. context.directives.add(dir.name);
  14076. dirArgs.push(toValidAssetId(dir.name, `directive`));
  14077. }
  14078. }
  14079. const { loc } = dir;
  14080. if (dir.exp)
  14081. dirArgs.push(dir.exp);
  14082. if (dir.arg) {
  14083. if (!dir.exp) {
  14084. dirArgs.push(`void 0`);
  14085. }
  14086. dirArgs.push(dir.arg);
  14087. }
  14088. if (Object.keys(dir.modifiers).length) {
  14089. if (!dir.arg) {
  14090. if (!dir.exp) {
  14091. dirArgs.push(`void 0`);
  14092. }
  14093. dirArgs.push(`void 0`);
  14094. }
  14095. const trueExpression = createSimpleExpression(`true`, false, loc);
  14096. dirArgs.push(
  14097. createObjectExpression(
  14098. dir.modifiers.map(
  14099. (modifier) => createObjectProperty(modifier, trueExpression)
  14100. ),
  14101. loc
  14102. )
  14103. );
  14104. }
  14105. return createArrayExpression(dirArgs, dir.loc);
  14106. }
  14107. function stringifyDynamicPropNames(props) {
  14108. let propsNamesString = `[`;
  14109. for (let i = 0, l = props.length; i < l; i++) {
  14110. propsNamesString += JSON.stringify(props[i]);
  14111. if (i < l - 1)
  14112. propsNamesString += ", ";
  14113. }
  14114. return propsNamesString + `]`;
  14115. }
  14116. function isComponentTag(tag) {
  14117. return tag === "component" || tag === "Component";
  14118. }
  14119. const transformSlotOutlet = (node, context) => {
  14120. if (isSlotOutlet(node)) {
  14121. const { children, loc } = node;
  14122. const { slotName, slotProps } = processSlotOutlet(node, context);
  14123. const slotArgs = [
  14124. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  14125. slotName,
  14126. "{}",
  14127. "undefined",
  14128. "true"
  14129. ];
  14130. let expectedLen = 2;
  14131. if (slotProps) {
  14132. slotArgs[2] = slotProps;
  14133. expectedLen = 3;
  14134. }
  14135. if (children.length) {
  14136. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  14137. expectedLen = 4;
  14138. }
  14139. if (context.scopeId && !context.slotted) {
  14140. expectedLen = 5;
  14141. }
  14142. slotArgs.splice(expectedLen);
  14143. node.codegenNode = createCallExpression(
  14144. context.helper(RENDER_SLOT),
  14145. slotArgs,
  14146. loc
  14147. );
  14148. }
  14149. };
  14150. function processSlotOutlet(node, context) {
  14151. let slotName = `"default"`;
  14152. let slotProps = void 0;
  14153. const nonNameProps = [];
  14154. for (let i = 0; i < node.props.length; i++) {
  14155. const p = node.props[i];
  14156. if (p.type === 6) {
  14157. if (p.value) {
  14158. if (p.name === "name") {
  14159. slotName = JSON.stringify(p.value.content);
  14160. } else {
  14161. p.name = camelize(p.name);
  14162. nonNameProps.push(p);
  14163. }
  14164. }
  14165. } else {
  14166. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  14167. if (p.exp)
  14168. slotName = p.exp;
  14169. } else {
  14170. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  14171. p.arg.content = camelize(p.arg.content);
  14172. }
  14173. nonNameProps.push(p);
  14174. }
  14175. }
  14176. }
  14177. if (nonNameProps.length > 0) {
  14178. const { props, directives } = buildProps(
  14179. node,
  14180. context,
  14181. nonNameProps,
  14182. false,
  14183. false
  14184. );
  14185. slotProps = props;
  14186. if (directives.length) {
  14187. context.onError(
  14188. createCompilerError(
  14189. 36,
  14190. directives[0].loc
  14191. )
  14192. );
  14193. }
  14194. }
  14195. return {
  14196. slotName,
  14197. slotProps
  14198. };
  14199. }
  14200. const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  14201. const transformOn$1 = (dir, node, context, augmentor) => {
  14202. const { loc, modifiers, arg } = dir;
  14203. if (!dir.exp && !modifiers.length) {
  14204. context.onError(createCompilerError(35, loc));
  14205. }
  14206. let eventName;
  14207. if (arg.type === 4) {
  14208. if (arg.isStatic) {
  14209. let rawName = arg.content;
  14210. if (rawName.startsWith("vnode")) {
  14211. context.onWarn(
  14212. createCompilerError(51, arg.loc)
  14213. );
  14214. }
  14215. if (rawName.startsWith("vue:")) {
  14216. rawName = `vnode-${rawName.slice(4)}`;
  14217. }
  14218. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  14219. // for non-element and vnode lifecycle event listeners, auto convert
  14220. // it to camelCase. See issue #2249
  14221. toHandlerKey(camelize(rawName))
  14222. ) : (
  14223. // preserve case for plain element listeners that have uppercase
  14224. // letters, as these may be custom elements' custom events
  14225. `on:${rawName}`
  14226. );
  14227. eventName = createSimpleExpression(eventString, true, arg.loc);
  14228. } else {
  14229. eventName = createCompoundExpression([
  14230. `${context.helperString(TO_HANDLER_KEY)}(`,
  14231. arg,
  14232. `)`
  14233. ]);
  14234. }
  14235. } else {
  14236. eventName = arg;
  14237. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  14238. eventName.children.push(`)`);
  14239. }
  14240. let exp = dir.exp;
  14241. if (exp && !exp.content.trim()) {
  14242. exp = void 0;
  14243. }
  14244. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  14245. if (exp) {
  14246. const isMemberExp = isMemberExpression(exp.content);
  14247. const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
  14248. const hasMultipleStatements = exp.content.includes(`;`);
  14249. {
  14250. validateBrowserExpression(
  14251. exp,
  14252. context,
  14253. false,
  14254. hasMultipleStatements
  14255. );
  14256. }
  14257. if (isInlineStatement || shouldCache && isMemberExp) {
  14258. exp = createCompoundExpression([
  14259. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  14260. exp,
  14261. hasMultipleStatements ? `}` : `)`
  14262. ]);
  14263. }
  14264. }
  14265. let ret = {
  14266. props: [
  14267. createObjectProperty(
  14268. eventName,
  14269. exp || createSimpleExpression(`() => {}`, false, loc)
  14270. )
  14271. ]
  14272. };
  14273. if (augmentor) {
  14274. ret = augmentor(ret);
  14275. }
  14276. if (shouldCache) {
  14277. ret.props[0].value = context.cache(ret.props[0].value);
  14278. }
  14279. ret.props.forEach((p) => p.key.isHandlerKey = true);
  14280. return ret;
  14281. };
  14282. const transformBind = (dir, _node, context) => {
  14283. const { exp, modifiers, loc } = dir;
  14284. const arg = dir.arg;
  14285. if (arg.type !== 4) {
  14286. arg.children.unshift(`(`);
  14287. arg.children.push(`) || ""`);
  14288. } else if (!arg.isStatic) {
  14289. arg.content = `${arg.content} || ""`;
  14290. }
  14291. if (modifiers.includes("camel")) {
  14292. if (arg.type === 4) {
  14293. if (arg.isStatic) {
  14294. arg.content = camelize(arg.content);
  14295. } else {
  14296. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  14297. }
  14298. } else {
  14299. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  14300. arg.children.push(`)`);
  14301. }
  14302. }
  14303. if (!context.inSSR) {
  14304. if (modifiers.includes("prop")) {
  14305. injectPrefix(arg, ".");
  14306. }
  14307. if (modifiers.includes("attr")) {
  14308. injectPrefix(arg, "^");
  14309. }
  14310. }
  14311. if (!exp || exp.type === 4 && !exp.content.trim()) {
  14312. context.onError(createCompilerError(34, loc));
  14313. return {
  14314. props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
  14315. };
  14316. }
  14317. return {
  14318. props: [createObjectProperty(arg, exp)]
  14319. };
  14320. };
  14321. const injectPrefix = (arg, prefix) => {
  14322. if (arg.type === 4) {
  14323. if (arg.isStatic) {
  14324. arg.content = prefix + arg.content;
  14325. } else {
  14326. arg.content = `\`${prefix}\${${arg.content}}\``;
  14327. }
  14328. } else {
  14329. arg.children.unshift(`'${prefix}' + (`);
  14330. arg.children.push(`)`);
  14331. }
  14332. };
  14333. const transformText = (node, context) => {
  14334. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  14335. return () => {
  14336. const children = node.children;
  14337. let currentContainer = void 0;
  14338. let hasText = false;
  14339. for (let i = 0; i < children.length; i++) {
  14340. const child = children[i];
  14341. if (isText$1(child)) {
  14342. hasText = true;
  14343. for (let j = i + 1; j < children.length; j++) {
  14344. const next = children[j];
  14345. if (isText$1(next)) {
  14346. if (!currentContainer) {
  14347. currentContainer = children[i] = createCompoundExpression(
  14348. [child],
  14349. child.loc
  14350. );
  14351. }
  14352. currentContainer.children.push(` + `, next);
  14353. children.splice(j, 1);
  14354. j--;
  14355. } else {
  14356. currentContainer = void 0;
  14357. break;
  14358. }
  14359. }
  14360. }
  14361. }
  14362. if (!hasText || // if this is a plain element with a single text child, leave it
  14363. // as-is since the runtime has dedicated fast path for this by directly
  14364. // setting textContent of the element.
  14365. // for component root it's always normalized anyway.
  14366. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  14367. // custom directives can potentially add DOM elements arbitrarily,
  14368. // we need to avoid setting textContent of the element at runtime
  14369. // to avoid accidentally overwriting the DOM elements added
  14370. // by the user through custom directives.
  14371. !node.props.find(
  14372. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  14373. ) && // in compat mode, <template> tags with no special directives
  14374. // will be rendered as a fragment so its children must be
  14375. // converted into vnodes.
  14376. true)) {
  14377. return;
  14378. }
  14379. for (let i = 0; i < children.length; i++) {
  14380. const child = children[i];
  14381. if (isText$1(child) || child.type === 8) {
  14382. const callArgs = [];
  14383. if (child.type !== 2 || child.content !== " ") {
  14384. callArgs.push(child);
  14385. }
  14386. if (!context.ssr && getConstantType(child, context) === 0) {
  14387. callArgs.push(
  14388. 1 + (` /* ${PatchFlagNames[1]} */` )
  14389. );
  14390. }
  14391. children[i] = {
  14392. type: 12,
  14393. content: child,
  14394. loc: child.loc,
  14395. codegenNode: createCallExpression(
  14396. context.helper(CREATE_TEXT),
  14397. callArgs
  14398. )
  14399. };
  14400. }
  14401. }
  14402. };
  14403. }
  14404. };
  14405. const seen$1 = /* @__PURE__ */ new WeakSet();
  14406. const transformOnce = (node, context) => {
  14407. if (node.type === 1 && findDir(node, "once", true)) {
  14408. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  14409. return;
  14410. }
  14411. seen$1.add(node);
  14412. context.inVOnce = true;
  14413. context.helper(SET_BLOCK_TRACKING);
  14414. return () => {
  14415. context.inVOnce = false;
  14416. const cur = context.currentNode;
  14417. if (cur.codegenNode) {
  14418. cur.codegenNode = context.cache(
  14419. cur.codegenNode,
  14420. true
  14421. /* isVNode */
  14422. );
  14423. }
  14424. };
  14425. }
  14426. };
  14427. const transformModel$1 = (dir, node, context) => {
  14428. const { exp, arg } = dir;
  14429. if (!exp) {
  14430. context.onError(
  14431. createCompilerError(41, dir.loc)
  14432. );
  14433. return createTransformProps();
  14434. }
  14435. const rawExp = exp.loc.source;
  14436. const expString = exp.type === 4 ? exp.content : rawExp;
  14437. const bindingType = context.bindingMetadata[rawExp];
  14438. if (bindingType === "props" || bindingType === "props-aliased") {
  14439. context.onError(createCompilerError(44, exp.loc));
  14440. return createTransformProps();
  14441. }
  14442. const maybeRef = false;
  14443. if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
  14444. context.onError(
  14445. createCompilerError(42, exp.loc)
  14446. );
  14447. return createTransformProps();
  14448. }
  14449. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  14450. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  14451. let assignmentExp;
  14452. const eventArg = context.isTS ? `($event: any)` : `$event`;
  14453. {
  14454. assignmentExp = createCompoundExpression([
  14455. `${eventArg} => ((`,
  14456. exp,
  14457. `) = $event)`
  14458. ]);
  14459. }
  14460. const props = [
  14461. // modelValue: foo
  14462. createObjectProperty(propName, dir.exp),
  14463. // "onUpdate:modelValue": $event => (foo = $event)
  14464. createObjectProperty(eventName, assignmentExp)
  14465. ];
  14466. if (dir.modifiers.length && node.tagType === 1) {
  14467. const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  14468. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  14469. props.push(
  14470. createObjectProperty(
  14471. modifiersKey,
  14472. createSimpleExpression(
  14473. `{ ${modifiers} }`,
  14474. false,
  14475. dir.loc,
  14476. 2
  14477. )
  14478. )
  14479. );
  14480. }
  14481. return createTransformProps(props);
  14482. };
  14483. function createTransformProps(props = []) {
  14484. return { props };
  14485. }
  14486. const seen = /* @__PURE__ */ new WeakSet();
  14487. const transformMemo = (node, context) => {
  14488. if (node.type === 1) {
  14489. const dir = findDir(node, "memo");
  14490. if (!dir || seen.has(node)) {
  14491. return;
  14492. }
  14493. seen.add(node);
  14494. return () => {
  14495. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  14496. if (codegenNode && codegenNode.type === 13) {
  14497. if (node.tagType !== 1) {
  14498. convertToBlock(codegenNode, context);
  14499. }
  14500. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  14501. dir.exp,
  14502. createFunctionExpression(void 0, codegenNode),
  14503. `_cache`,
  14504. String(context.cached++)
  14505. ]);
  14506. }
  14507. };
  14508. }
  14509. };
  14510. function getBaseTransformPreset(prefixIdentifiers) {
  14511. return [
  14512. [
  14513. transformOnce,
  14514. transformIf,
  14515. transformMemo,
  14516. transformFor,
  14517. ...[],
  14518. ...[transformExpression] ,
  14519. transformSlotOutlet,
  14520. transformElement,
  14521. trackSlotScopes,
  14522. transformText
  14523. ],
  14524. {
  14525. on: transformOn$1,
  14526. bind: transformBind,
  14527. model: transformModel$1
  14528. }
  14529. ];
  14530. }
  14531. function baseCompile(template, options = {}) {
  14532. const onError = options.onError || defaultOnError;
  14533. const isModuleMode = options.mode === "module";
  14534. {
  14535. if (options.prefixIdentifiers === true) {
  14536. onError(createCompilerError(47));
  14537. } else if (isModuleMode) {
  14538. onError(createCompilerError(48));
  14539. }
  14540. }
  14541. const prefixIdentifiers = false;
  14542. if (options.cacheHandlers) {
  14543. onError(createCompilerError(49));
  14544. }
  14545. if (options.scopeId && !isModuleMode) {
  14546. onError(createCompilerError(50));
  14547. }
  14548. const ast = isString(template) ? baseParse(template, options) : template;
  14549. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  14550. transform(
  14551. ast,
  14552. extend({}, options, {
  14553. prefixIdentifiers,
  14554. nodeTransforms: [
  14555. ...nodeTransforms,
  14556. ...options.nodeTransforms || []
  14557. // user transforms
  14558. ],
  14559. directiveTransforms: extend(
  14560. {},
  14561. directiveTransforms,
  14562. options.directiveTransforms || {}
  14563. // user transforms
  14564. )
  14565. })
  14566. );
  14567. return generate(
  14568. ast,
  14569. extend({}, options, {
  14570. prefixIdentifiers
  14571. })
  14572. );
  14573. }
  14574. const noopDirectiveTransform = () => ({ props: [] });
  14575. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  14576. const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
  14577. const V_MODEL_TEXT = Symbol(`vModelText` );
  14578. const V_MODEL_SELECT = Symbol(`vModelSelect` );
  14579. const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
  14580. const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
  14581. const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
  14582. const V_SHOW = Symbol(`vShow` );
  14583. const TRANSITION = Symbol(`Transition` );
  14584. const TRANSITION_GROUP = Symbol(`TransitionGroup` );
  14585. registerRuntimeHelpers({
  14586. [V_MODEL_RADIO]: `vModelRadio`,
  14587. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  14588. [V_MODEL_TEXT]: `vModelText`,
  14589. [V_MODEL_SELECT]: `vModelSelect`,
  14590. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  14591. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  14592. [V_ON_WITH_KEYS]: `withKeys`,
  14593. [V_SHOW]: `vShow`,
  14594. [TRANSITION]: `Transition`,
  14595. [TRANSITION_GROUP]: `TransitionGroup`
  14596. });
  14597. let decoder;
  14598. function decodeHtmlBrowser(raw, asAttr = false) {
  14599. if (!decoder) {
  14600. decoder = document.createElement("div");
  14601. }
  14602. if (asAttr) {
  14603. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  14604. return decoder.children[0].getAttribute("foo");
  14605. } else {
  14606. decoder.innerHTML = raw;
  14607. return decoder.textContent;
  14608. }
  14609. }
  14610. const isRawTextContainer = /* @__PURE__ */ makeMap(
  14611. "style,iframe,script,noscript",
  14612. true
  14613. );
  14614. const parserOptions = {
  14615. isVoidTag,
  14616. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
  14617. isPreTag: (tag) => tag === "pre",
  14618. decodeEntities: decodeHtmlBrowser ,
  14619. isBuiltInComponent: (tag) => {
  14620. if (isBuiltInType(tag, `Transition`)) {
  14621. return TRANSITION;
  14622. } else if (isBuiltInType(tag, `TransitionGroup`)) {
  14623. return TRANSITION_GROUP;
  14624. }
  14625. },
  14626. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  14627. getNamespace(tag, parent) {
  14628. let ns = parent ? parent.ns : 0;
  14629. if (parent && ns === 2) {
  14630. if (parent.tag === "annotation-xml") {
  14631. if (tag === "svg") {
  14632. return 1;
  14633. }
  14634. if (parent.props.some(
  14635. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  14636. )) {
  14637. ns = 0;
  14638. }
  14639. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  14640. ns = 0;
  14641. }
  14642. } else if (parent && ns === 1) {
  14643. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  14644. ns = 0;
  14645. }
  14646. }
  14647. if (ns === 0) {
  14648. if (tag === "svg") {
  14649. return 1;
  14650. }
  14651. if (tag === "math") {
  14652. return 2;
  14653. }
  14654. }
  14655. return ns;
  14656. },
  14657. // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
  14658. getTextMode({ tag, ns }) {
  14659. if (ns === 0) {
  14660. if (tag === "textarea" || tag === "title") {
  14661. return 1;
  14662. }
  14663. if (isRawTextContainer(tag)) {
  14664. return 2;
  14665. }
  14666. }
  14667. return 0;
  14668. }
  14669. };
  14670. const transformStyle = (node) => {
  14671. if (node.type === 1) {
  14672. node.props.forEach((p, i) => {
  14673. if (p.type === 6 && p.name === "style" && p.value) {
  14674. node.props[i] = {
  14675. type: 7,
  14676. name: `bind`,
  14677. arg: createSimpleExpression(`style`, true, p.loc),
  14678. exp: parseInlineCSS(p.value.content, p.loc),
  14679. modifiers: [],
  14680. loc: p.loc
  14681. };
  14682. }
  14683. });
  14684. }
  14685. };
  14686. const parseInlineCSS = (cssText, loc) => {
  14687. const normalized = parseStringStyle(cssText);
  14688. return createSimpleExpression(
  14689. JSON.stringify(normalized),
  14690. false,
  14691. loc,
  14692. 3
  14693. );
  14694. };
  14695. function createDOMCompilerError(code, loc) {
  14696. return createCompilerError(
  14697. code,
  14698. loc,
  14699. DOMErrorMessages
  14700. );
  14701. }
  14702. const DOMErrorMessages = {
  14703. [53]: `v-html is missing expression.`,
  14704. [54]: `v-html will override element children.`,
  14705. [55]: `v-text is missing expression.`,
  14706. [56]: `v-text will override element children.`,
  14707. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  14708. [58]: `v-model argument is not supported on plain elements.`,
  14709. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  14710. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  14711. [61]: `v-show is missing expression.`,
  14712. [62]: `<Transition> expects exactly one child element or component.`,
  14713. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  14714. };
  14715. const transformVHtml = (dir, node, context) => {
  14716. const { exp, loc } = dir;
  14717. if (!exp) {
  14718. context.onError(
  14719. createDOMCompilerError(53, loc)
  14720. );
  14721. }
  14722. if (node.children.length) {
  14723. context.onError(
  14724. createDOMCompilerError(54, loc)
  14725. );
  14726. node.children.length = 0;
  14727. }
  14728. return {
  14729. props: [
  14730. createObjectProperty(
  14731. createSimpleExpression(`innerHTML`, true, loc),
  14732. exp || createSimpleExpression("", true)
  14733. )
  14734. ]
  14735. };
  14736. };
  14737. const transformVText = (dir, node, context) => {
  14738. const { exp, loc } = dir;
  14739. if (!exp) {
  14740. context.onError(
  14741. createDOMCompilerError(55, loc)
  14742. );
  14743. }
  14744. if (node.children.length) {
  14745. context.onError(
  14746. createDOMCompilerError(56, loc)
  14747. );
  14748. node.children.length = 0;
  14749. }
  14750. return {
  14751. props: [
  14752. createObjectProperty(
  14753. createSimpleExpression(`textContent`, true),
  14754. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  14755. context.helperString(TO_DISPLAY_STRING),
  14756. [exp],
  14757. loc
  14758. ) : createSimpleExpression("", true)
  14759. )
  14760. ]
  14761. };
  14762. };
  14763. const transformModel = (dir, node, context) => {
  14764. const baseResult = transformModel$1(dir, node, context);
  14765. if (!baseResult.props.length || node.tagType === 1) {
  14766. return baseResult;
  14767. }
  14768. if (dir.arg) {
  14769. context.onError(
  14770. createDOMCompilerError(
  14771. 58,
  14772. dir.arg.loc
  14773. )
  14774. );
  14775. }
  14776. function checkDuplicatedValue() {
  14777. const value = findProp(node, "value");
  14778. if (value) {
  14779. context.onError(
  14780. createDOMCompilerError(
  14781. 60,
  14782. value.loc
  14783. )
  14784. );
  14785. }
  14786. }
  14787. const { tag } = node;
  14788. const isCustomElement = context.isCustomElement(tag);
  14789. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  14790. let directiveToUse = V_MODEL_TEXT;
  14791. let isInvalidType = false;
  14792. if (tag === "input" || isCustomElement) {
  14793. const type = findProp(node, `type`);
  14794. if (type) {
  14795. if (type.type === 7) {
  14796. directiveToUse = V_MODEL_DYNAMIC;
  14797. } else if (type.value) {
  14798. switch (type.value.content) {
  14799. case "radio":
  14800. directiveToUse = V_MODEL_RADIO;
  14801. break;
  14802. case "checkbox":
  14803. directiveToUse = V_MODEL_CHECKBOX;
  14804. break;
  14805. case "file":
  14806. isInvalidType = true;
  14807. context.onError(
  14808. createDOMCompilerError(
  14809. 59,
  14810. dir.loc
  14811. )
  14812. );
  14813. break;
  14814. default:
  14815. checkDuplicatedValue();
  14816. break;
  14817. }
  14818. }
  14819. } else if (hasDynamicKeyVBind(node)) {
  14820. directiveToUse = V_MODEL_DYNAMIC;
  14821. } else {
  14822. checkDuplicatedValue();
  14823. }
  14824. } else if (tag === "select") {
  14825. directiveToUse = V_MODEL_SELECT;
  14826. } else {
  14827. checkDuplicatedValue();
  14828. }
  14829. if (!isInvalidType) {
  14830. baseResult.needRuntime = context.helper(directiveToUse);
  14831. }
  14832. } else {
  14833. context.onError(
  14834. createDOMCompilerError(
  14835. 57,
  14836. dir.loc
  14837. )
  14838. );
  14839. }
  14840. baseResult.props = baseResult.props.filter(
  14841. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  14842. );
  14843. return baseResult;
  14844. };
  14845. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  14846. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  14847. // event propagation management
  14848. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  14849. );
  14850. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  14851. const isKeyboardEvent = /* @__PURE__ */ makeMap(
  14852. `onkeyup,onkeydown,onkeypress`,
  14853. true
  14854. );
  14855. const resolveModifiers = (key, modifiers, context, loc) => {
  14856. const keyModifiers = [];
  14857. const nonKeyModifiers = [];
  14858. const eventOptionModifiers = [];
  14859. for (let i = 0; i < modifiers.length; i++) {
  14860. const modifier = modifiers[i];
  14861. if (isEventOptionModifier(modifier)) {
  14862. eventOptionModifiers.push(modifier);
  14863. } else {
  14864. if (maybeKeyModifier(modifier)) {
  14865. if (isStaticExp(key)) {
  14866. if (isKeyboardEvent(key.content)) {
  14867. keyModifiers.push(modifier);
  14868. } else {
  14869. nonKeyModifiers.push(modifier);
  14870. }
  14871. } else {
  14872. keyModifiers.push(modifier);
  14873. nonKeyModifiers.push(modifier);
  14874. }
  14875. } else {
  14876. if (isNonKeyModifier(modifier)) {
  14877. nonKeyModifiers.push(modifier);
  14878. } else {
  14879. keyModifiers.push(modifier);
  14880. }
  14881. }
  14882. }
  14883. }
  14884. return {
  14885. keyModifiers,
  14886. nonKeyModifiers,
  14887. eventOptionModifiers
  14888. };
  14889. };
  14890. const transformClick = (key, event) => {
  14891. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  14892. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  14893. `(`,
  14894. key,
  14895. `) === "onClick" ? "${event}" : (`,
  14896. key,
  14897. `)`
  14898. ]) : key;
  14899. };
  14900. const transformOn = (dir, node, context) => {
  14901. return transformOn$1(dir, node, context, (baseResult) => {
  14902. const { modifiers } = dir;
  14903. if (!modifiers.length)
  14904. return baseResult;
  14905. let { key, value: handlerExp } = baseResult.props[0];
  14906. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  14907. if (nonKeyModifiers.includes("right")) {
  14908. key = transformClick(key, `onContextmenu`);
  14909. }
  14910. if (nonKeyModifiers.includes("middle")) {
  14911. key = transformClick(key, `onMouseup`);
  14912. }
  14913. if (nonKeyModifiers.length) {
  14914. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  14915. handlerExp,
  14916. JSON.stringify(nonKeyModifiers)
  14917. ]);
  14918. }
  14919. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  14920. (!isStaticExp(key) || isKeyboardEvent(key.content))) {
  14921. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  14922. handlerExp,
  14923. JSON.stringify(keyModifiers)
  14924. ]);
  14925. }
  14926. if (eventOptionModifiers.length) {
  14927. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  14928. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  14929. }
  14930. return {
  14931. props: [createObjectProperty(key, handlerExp)]
  14932. };
  14933. });
  14934. };
  14935. const transformShow = (dir, node, context) => {
  14936. const { exp, loc } = dir;
  14937. if (!exp) {
  14938. context.onError(
  14939. createDOMCompilerError(61, loc)
  14940. );
  14941. }
  14942. return {
  14943. props: [],
  14944. needRuntime: context.helper(V_SHOW)
  14945. };
  14946. };
  14947. const transformTransition = (node, context) => {
  14948. if (node.type === 1 && node.tagType === 1) {
  14949. const component = context.isBuiltInComponent(node.tag);
  14950. if (component === TRANSITION) {
  14951. return () => {
  14952. if (!node.children.length) {
  14953. return;
  14954. }
  14955. if (hasMultipleChildren(node)) {
  14956. context.onError(
  14957. createDOMCompilerError(
  14958. 62,
  14959. {
  14960. start: node.children[0].loc.start,
  14961. end: node.children[node.children.length - 1].loc.end,
  14962. source: ""
  14963. }
  14964. )
  14965. );
  14966. }
  14967. const child = node.children[0];
  14968. if (child.type === 1) {
  14969. for (const p of child.props) {
  14970. if (p.type === 7 && p.name === "show") {
  14971. node.props.push({
  14972. type: 6,
  14973. name: "persisted",
  14974. value: void 0,
  14975. loc: node.loc
  14976. });
  14977. }
  14978. }
  14979. }
  14980. };
  14981. }
  14982. }
  14983. };
  14984. function hasMultipleChildren(node) {
  14985. const children = node.children = node.children.filter(
  14986. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  14987. );
  14988. const child = children[0];
  14989. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  14990. }
  14991. const ignoreSideEffectTags = (node, context) => {
  14992. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  14993. context.onError(
  14994. createDOMCompilerError(
  14995. 63,
  14996. node.loc
  14997. )
  14998. );
  14999. context.removeNode();
  15000. }
  15001. };
  15002. const DOMNodeTransforms = [
  15003. transformStyle,
  15004. ...[transformTransition]
  15005. ];
  15006. const DOMDirectiveTransforms = {
  15007. cloak: noopDirectiveTransform,
  15008. html: transformVHtml,
  15009. text: transformVText,
  15010. model: transformModel,
  15011. // override compiler-core
  15012. on: transformOn,
  15013. // override compiler-core
  15014. show: transformShow
  15015. };
  15016. function compile(template, options = {}) {
  15017. return baseCompile(
  15018. template,
  15019. extend({}, parserOptions, options, {
  15020. nodeTransforms: [
  15021. // ignore <script> and <tag>
  15022. // this is not put inside DOMNodeTransforms because that list is used
  15023. // by compiler-ssr to generate vnode fallback branches
  15024. ignoreSideEffectTags,
  15025. ...DOMNodeTransforms,
  15026. ...options.nodeTransforms || []
  15027. ],
  15028. directiveTransforms: extend(
  15029. {},
  15030. DOMDirectiveTransforms,
  15031. options.directiveTransforms || {}
  15032. ),
  15033. transformHoist: null
  15034. })
  15035. );
  15036. }
  15037. {
  15038. initDev();
  15039. }
  15040. const compileCache = /* @__PURE__ */ Object.create(null);
  15041. function compileToFunction(template, options) {
  15042. if (!isString(template)) {
  15043. if (template.nodeType) {
  15044. template = template.innerHTML;
  15045. } else {
  15046. warn(`invalid template option: `, template);
  15047. return NOOP;
  15048. }
  15049. }
  15050. const key = template;
  15051. const cached = compileCache[key];
  15052. if (cached) {
  15053. return cached;
  15054. }
  15055. if (template[0] === "#") {
  15056. const el = document.querySelector(template);
  15057. if (!el) {
  15058. warn(`Template element not found or is empty: ${template}`);
  15059. }
  15060. template = el ? el.innerHTML : ``;
  15061. }
  15062. const opts = extend(
  15063. {
  15064. hoistStatic: true,
  15065. onError: onError ,
  15066. onWarn: (e) => onError(e, true)
  15067. },
  15068. options
  15069. );
  15070. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  15071. opts.isCustomElement = (tag) => !!customElements.get(tag);
  15072. }
  15073. const { code } = compile(template, opts);
  15074. function onError(err, asWarning = false) {
  15075. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  15076. const codeFrame = err.loc && generateCodeFrame(
  15077. template,
  15078. err.loc.start.offset,
  15079. err.loc.end.offset
  15080. );
  15081. warn(codeFrame ? `${message}
  15082. ${codeFrame}` : message);
  15083. }
  15084. const render = new Function(code)() ;
  15085. render._rc = true;
  15086. return compileCache[key] = render;
  15087. }
  15088. registerRuntimeCompiler(compileToFunction);
  15089. exports.BaseTransition = BaseTransition;
  15090. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  15091. exports.Comment = Comment;
  15092. exports.EffectScope = EffectScope;
  15093. exports.Fragment = Fragment;
  15094. exports.KeepAlive = KeepAlive;
  15095. exports.ReactiveEffect = ReactiveEffect;
  15096. exports.Static = Static;
  15097. exports.Suspense = Suspense;
  15098. exports.Teleport = Teleport;
  15099. exports.Text = Text;
  15100. exports.Transition = Transition;
  15101. exports.TransitionGroup = TransitionGroup;
  15102. exports.VueElement = VueElement;
  15103. exports.assertNumber = assertNumber;
  15104. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  15105. exports.callWithErrorHandling = callWithErrorHandling;
  15106. exports.camelize = camelize;
  15107. exports.capitalize = capitalize;
  15108. exports.cloneVNode = cloneVNode;
  15109. exports.compatUtils = compatUtils;
  15110. exports.compile = compileToFunction;
  15111. exports.computed = computed;
  15112. exports.createApp = createApp;
  15113. exports.createBlock = createBlock;
  15114. exports.createCommentVNode = createCommentVNode;
  15115. exports.createElementBlock = createElementBlock;
  15116. exports.createElementVNode = createBaseVNode;
  15117. exports.createHydrationRenderer = createHydrationRenderer;
  15118. exports.createPropsRestProxy = createPropsRestProxy;
  15119. exports.createRenderer = createRenderer;
  15120. exports.createSSRApp = createSSRApp;
  15121. exports.createSlots = createSlots;
  15122. exports.createStaticVNode = createStaticVNode;
  15123. exports.createTextVNode = createTextVNode;
  15124. exports.createVNode = createVNode;
  15125. exports.customRef = customRef;
  15126. exports.defineAsyncComponent = defineAsyncComponent;
  15127. exports.defineComponent = defineComponent;
  15128. exports.defineCustomElement = defineCustomElement;
  15129. exports.defineEmits = defineEmits;
  15130. exports.defineExpose = defineExpose;
  15131. exports.defineModel = defineModel;
  15132. exports.defineOptions = defineOptions;
  15133. exports.defineProps = defineProps;
  15134. exports.defineSSRCustomElement = defineSSRCustomElement;
  15135. exports.defineSlots = defineSlots;
  15136. exports.effect = effect;
  15137. exports.effectScope = effectScope;
  15138. exports.getCurrentInstance = getCurrentInstance;
  15139. exports.getCurrentScope = getCurrentScope;
  15140. exports.getTransitionRawChildren = getTransitionRawChildren;
  15141. exports.guardReactiveProps = guardReactiveProps;
  15142. exports.h = h;
  15143. exports.handleError = handleError;
  15144. exports.hasInjectionContext = hasInjectionContext;
  15145. exports.hydrate = hydrate;
  15146. exports.initCustomFormatter = initCustomFormatter;
  15147. exports.initDirectivesForSSR = initDirectivesForSSR;
  15148. exports.inject = inject;
  15149. exports.isMemoSame = isMemoSame;
  15150. exports.isProxy = isProxy;
  15151. exports.isReactive = isReactive;
  15152. exports.isReadonly = isReadonly;
  15153. exports.isRef = isRef;
  15154. exports.isRuntimeOnly = isRuntimeOnly;
  15155. exports.isShallow = isShallow;
  15156. exports.isVNode = isVNode;
  15157. exports.markRaw = markRaw;
  15158. exports.mergeDefaults = mergeDefaults;
  15159. exports.mergeModels = mergeModels;
  15160. exports.mergeProps = mergeProps;
  15161. exports.nextTick = nextTick;
  15162. exports.normalizeClass = normalizeClass;
  15163. exports.normalizeProps = normalizeProps;
  15164. exports.normalizeStyle = normalizeStyle;
  15165. exports.onActivated = onActivated;
  15166. exports.onBeforeMount = onBeforeMount;
  15167. exports.onBeforeUnmount = onBeforeUnmount;
  15168. exports.onBeforeUpdate = onBeforeUpdate;
  15169. exports.onDeactivated = onDeactivated;
  15170. exports.onErrorCaptured = onErrorCaptured;
  15171. exports.onMounted = onMounted;
  15172. exports.onRenderTracked = onRenderTracked;
  15173. exports.onRenderTriggered = onRenderTriggered;
  15174. exports.onScopeDispose = onScopeDispose;
  15175. exports.onServerPrefetch = onServerPrefetch;
  15176. exports.onUnmounted = onUnmounted;
  15177. exports.onUpdated = onUpdated;
  15178. exports.openBlock = openBlock;
  15179. exports.popScopeId = popScopeId;
  15180. exports.provide = provide;
  15181. exports.proxyRefs = proxyRefs;
  15182. exports.pushScopeId = pushScopeId;
  15183. exports.queuePostFlushCb = queuePostFlushCb;
  15184. exports.reactive = reactive;
  15185. exports.readonly = readonly;
  15186. exports.ref = ref;
  15187. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  15188. exports.render = render;
  15189. exports.renderList = renderList;
  15190. exports.renderSlot = renderSlot;
  15191. exports.resolveComponent = resolveComponent;
  15192. exports.resolveDirective = resolveDirective;
  15193. exports.resolveDynamicComponent = resolveDynamicComponent;
  15194. exports.resolveFilter = resolveFilter;
  15195. exports.resolveTransitionHooks = resolveTransitionHooks;
  15196. exports.setBlockTracking = setBlockTracking;
  15197. exports.setDevtoolsHook = setDevtoolsHook;
  15198. exports.setTransitionHooks = setTransitionHooks;
  15199. exports.shallowReactive = shallowReactive;
  15200. exports.shallowReadonly = shallowReadonly;
  15201. exports.shallowRef = shallowRef;
  15202. exports.ssrContextKey = ssrContextKey;
  15203. exports.ssrUtils = ssrUtils;
  15204. exports.stop = stop;
  15205. exports.toDisplayString = toDisplayString;
  15206. exports.toHandlerKey = toHandlerKey;
  15207. exports.toHandlers = toHandlers;
  15208. exports.toRaw = toRaw;
  15209. exports.toRef = toRef;
  15210. exports.toRefs = toRefs;
  15211. exports.toValue = toValue;
  15212. exports.transformVNodeArgs = transformVNodeArgs;
  15213. exports.triggerRef = triggerRef;
  15214. exports.unref = unref;
  15215. exports.useAttrs = useAttrs;
  15216. exports.useCssModule = useCssModule;
  15217. exports.useCssVars = useCssVars;
  15218. exports.useModel = useModel;
  15219. exports.useSSRContext = useSSRContext;
  15220. exports.useSlots = useSlots;
  15221. exports.useTransitionState = useTransitionState;
  15222. exports.vModelCheckbox = vModelCheckbox;
  15223. exports.vModelDynamic = vModelDynamic;
  15224. exports.vModelRadio = vModelRadio;
  15225. exports.vModelSelect = vModelSelect;
  15226. exports.vModelText = vModelText;
  15227. exports.vShow = vShow;
  15228. exports.version = version;
  15229. exports.warn = warn;
  15230. exports.watch = watch;
  15231. exports.watchEffect = watchEffect;
  15232. exports.watchPostEffect = watchPostEffect;
  15233. exports.watchSyncEffect = watchSyncEffect;
  15234. exports.withAsyncContext = withAsyncContext;
  15235. exports.withCtx = withCtx;
  15236. exports.withDefaults = withDefaults;
  15237. exports.withDirectives = withDirectives;
  15238. exports.withKeys = withKeys;
  15239. exports.withMemo = withMemo;
  15240. exports.withModifiers = withModifiers;
  15241. exports.withScopeId = withScopeId;
  15242. return exports;
  15243. })({});