vue.global.js 547 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039
  1. /**
  2. * vue v3.5.12
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. var Vue = (function (exports) {
  7. 'use strict';
  8. /*! #__NO_SIDE_EFFECTS__ */
  9. // @__NO_SIDE_EFFECTS__
  10. function makeMap(str) {
  11. const map = /* @__PURE__ */ Object.create(null);
  12. for (const key of str.split(",")) map[key] = 1;
  13. return (val) => val in map;
  14. }
  15. const EMPTY_OBJ = Object.freeze({}) ;
  16. const EMPTY_ARR = Object.freeze([]) ;
  17. const NOOP = () => {
  18. };
  19. const NO = () => false;
  20. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  21. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  22. const isModelListener = (key) => key.startsWith("onUpdate:");
  23. const extend = Object.assign;
  24. const remove = (arr, el) => {
  25. const i = arr.indexOf(el);
  26. if (i > -1) {
  27. arr.splice(i, 1);
  28. }
  29. };
  30. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  31. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  32. const isArray = Array.isArray;
  33. const isMap = (val) => toTypeString(val) === "[object Map]";
  34. const isSet = (val) => toTypeString(val) === "[object Set]";
  35. const isDate = (val) => toTypeString(val) === "[object Date]";
  36. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  37. const isFunction = (val) => typeof val === "function";
  38. const isString = (val) => typeof val === "string";
  39. const isSymbol = (val) => typeof val === "symbol";
  40. const isObject = (val) => val !== null && typeof val === "object";
  41. const isPromise = (val) => {
  42. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  43. };
  44. const objectToString = Object.prototype.toString;
  45. const toTypeString = (value) => objectToString.call(value);
  46. const toRawType = (value) => {
  47. return toTypeString(value).slice(8, -1);
  48. };
  49. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  50. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  51. const isReservedProp = /* @__PURE__ */ makeMap(
  52. // the leading comma is intentional so empty string "" is also included
  53. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  54. );
  55. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  56. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  57. );
  58. const cacheStringFunction = (fn) => {
  59. const cache = /* @__PURE__ */ Object.create(null);
  60. return (str) => {
  61. const hit = cache[str];
  62. return hit || (cache[str] = fn(str));
  63. };
  64. };
  65. const camelizeRE = /-(\w)/g;
  66. const camelize = cacheStringFunction(
  67. (str) => {
  68. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  69. }
  70. );
  71. const hyphenateRE = /\B([A-Z])/g;
  72. const hyphenate = cacheStringFunction(
  73. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  74. );
  75. const capitalize = cacheStringFunction((str) => {
  76. return str.charAt(0).toUpperCase() + str.slice(1);
  77. });
  78. const toHandlerKey = cacheStringFunction(
  79. (str) => {
  80. const s = str ? `on${capitalize(str)}` : ``;
  81. return s;
  82. }
  83. );
  84. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  85. const invokeArrayFns = (fns, ...arg) => {
  86. for (let i = 0; i < fns.length; i++) {
  87. fns[i](...arg);
  88. }
  89. };
  90. const def = (obj, key, value, writable = false) => {
  91. Object.defineProperty(obj, key, {
  92. configurable: true,
  93. enumerable: false,
  94. writable,
  95. value
  96. });
  97. };
  98. const looseToNumber = (val) => {
  99. const n = parseFloat(val);
  100. return isNaN(n) ? val : n;
  101. };
  102. const toNumber = (val) => {
  103. const n = isString(val) ? Number(val) : NaN;
  104. return isNaN(n) ? val : n;
  105. };
  106. let _globalThis;
  107. const getGlobalThis = () => {
  108. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  109. };
  110. function genCacheKey(source, options) {
  111. return source + JSON.stringify(
  112. options,
  113. (_, val) => typeof val === "function" ? val.toString() : val
  114. );
  115. }
  116. const PatchFlagNames = {
  117. [1]: `TEXT`,
  118. [2]: `CLASS`,
  119. [4]: `STYLE`,
  120. [8]: `PROPS`,
  121. [16]: `FULL_PROPS`,
  122. [32]: `NEED_HYDRATION`,
  123. [64]: `STABLE_FRAGMENT`,
  124. [128]: `KEYED_FRAGMENT`,
  125. [256]: `UNKEYED_FRAGMENT`,
  126. [512]: `NEED_PATCH`,
  127. [1024]: `DYNAMIC_SLOTS`,
  128. [2048]: `DEV_ROOT_FRAGMENT`,
  129. [-1]: `HOISTED`,
  130. [-2]: `BAIL`
  131. };
  132. const slotFlagsText = {
  133. [1]: "STABLE",
  134. [2]: "DYNAMIC",
  135. [3]: "FORWARDED"
  136. };
  137. const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
  138. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  139. const range = 2;
  140. function generateCodeFrame(source, start = 0, end = source.length) {
  141. start = Math.max(0, Math.min(start, source.length));
  142. end = Math.max(0, Math.min(end, source.length));
  143. if (start > end) return "";
  144. let lines = source.split(/(\r?\n)/);
  145. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  146. lines = lines.filter((_, idx) => idx % 2 === 0);
  147. let count = 0;
  148. const res = [];
  149. for (let i = 0; i < lines.length; i++) {
  150. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  151. if (count >= start) {
  152. for (let j = i - range; j <= i + range || end > count; j++) {
  153. if (j < 0 || j >= lines.length) continue;
  154. const line = j + 1;
  155. res.push(
  156. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  157. );
  158. const lineLength = lines[j].length;
  159. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  160. if (j === i) {
  161. const pad = start - (count - (lineLength + newLineSeqLength));
  162. const length = Math.max(
  163. 1,
  164. end > count ? lineLength - pad : end - start
  165. );
  166. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  167. } else if (j > i) {
  168. if (end > count) {
  169. const length = Math.max(Math.min(end - count, lineLength), 1);
  170. res.push(` | ` + "^".repeat(length));
  171. }
  172. count += lineLength + newLineSeqLength;
  173. }
  174. }
  175. break;
  176. }
  177. }
  178. return res.join("\n");
  179. }
  180. function normalizeStyle(value) {
  181. if (isArray(value)) {
  182. const res = {};
  183. for (let i = 0; i < value.length; i++) {
  184. const item = value[i];
  185. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  186. if (normalized) {
  187. for (const key in normalized) {
  188. res[key] = normalized[key];
  189. }
  190. }
  191. }
  192. return res;
  193. } else if (isString(value) || isObject(value)) {
  194. return value;
  195. }
  196. }
  197. const listDelimiterRE = /;(?![^(]*\))/g;
  198. const propertyDelimiterRE = /:([^]+)/;
  199. const styleCommentRE = /\/\*[^]*?\*\//g;
  200. function parseStringStyle(cssText) {
  201. const ret = {};
  202. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  203. if (item) {
  204. const tmp = item.split(propertyDelimiterRE);
  205. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  206. }
  207. });
  208. return ret;
  209. }
  210. function stringifyStyle(styles) {
  211. let ret = "";
  212. if (!styles || isString(styles)) {
  213. return ret;
  214. }
  215. for (const key in styles) {
  216. const value = styles[key];
  217. if (isString(value) || typeof value === "number") {
  218. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  219. ret += `${normalizedKey}:${value};`;
  220. }
  221. }
  222. return ret;
  223. }
  224. function normalizeClass(value) {
  225. let res = "";
  226. if (isString(value)) {
  227. res = value;
  228. } else if (isArray(value)) {
  229. for (let i = 0; i < value.length; i++) {
  230. const normalized = normalizeClass(value[i]);
  231. if (normalized) {
  232. res += normalized + " ";
  233. }
  234. }
  235. } else if (isObject(value)) {
  236. for (const name in value) {
  237. if (value[name]) {
  238. res += name + " ";
  239. }
  240. }
  241. }
  242. return res.trim();
  243. }
  244. function normalizeProps(props) {
  245. if (!props) return null;
  246. let { class: klass, style } = props;
  247. if (klass && !isString(klass)) {
  248. props.class = normalizeClass(klass);
  249. }
  250. if (style) {
  251. props.style = normalizeStyle(style);
  252. }
  253. return props;
  254. }
  255. 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";
  256. 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";
  257. const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
  258. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  259. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  260. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  261. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  262. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  263. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  264. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  265. const isBooleanAttr = /* @__PURE__ */ makeMap(
  266. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  267. );
  268. function includeBooleanAttr(value) {
  269. return !!value || value === "";
  270. }
  271. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  272. `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
  273. );
  274. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  275. `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
  276. );
  277. function isRenderableAttrValue(value) {
  278. if (value == null) {
  279. return false;
  280. }
  281. const type = typeof value;
  282. return type === "string" || type === "number" || type === "boolean";
  283. }
  284. const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
  285. function getEscapedCssVarName(key, doubleEscape) {
  286. return key.replace(
  287. cssVarNameEscapeSymbolsRE,
  288. (s) => `\\${s}`
  289. );
  290. }
  291. function looseCompareArrays(a, b) {
  292. if (a.length !== b.length) return false;
  293. let equal = true;
  294. for (let i = 0; equal && i < a.length; i++) {
  295. equal = looseEqual(a[i], b[i]);
  296. }
  297. return equal;
  298. }
  299. function looseEqual(a, b) {
  300. if (a === b) return true;
  301. let aValidType = isDate(a);
  302. let bValidType = isDate(b);
  303. if (aValidType || bValidType) {
  304. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  305. }
  306. aValidType = isSymbol(a);
  307. bValidType = isSymbol(b);
  308. if (aValidType || bValidType) {
  309. return a === b;
  310. }
  311. aValidType = isArray(a);
  312. bValidType = isArray(b);
  313. if (aValidType || bValidType) {
  314. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  315. }
  316. aValidType = isObject(a);
  317. bValidType = isObject(b);
  318. if (aValidType || bValidType) {
  319. if (!aValidType || !bValidType) {
  320. return false;
  321. }
  322. const aKeysCount = Object.keys(a).length;
  323. const bKeysCount = Object.keys(b).length;
  324. if (aKeysCount !== bKeysCount) {
  325. return false;
  326. }
  327. for (const key in a) {
  328. const aHasKey = a.hasOwnProperty(key);
  329. const bHasKey = b.hasOwnProperty(key);
  330. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  331. return false;
  332. }
  333. }
  334. }
  335. return String(a) === String(b);
  336. }
  337. function looseIndexOf(arr, val) {
  338. return arr.findIndex((item) => looseEqual(item, val));
  339. }
  340. const isRef$1 = (val) => {
  341. return !!(val && val["__v_isRef"] === true);
  342. };
  343. const toDisplayString = (val) => {
  344. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
  345. };
  346. const replacer = (_key, val) => {
  347. if (isRef$1(val)) {
  348. return replacer(_key, val.value);
  349. } else if (isMap(val)) {
  350. return {
  351. [`Map(${val.size})`]: [...val.entries()].reduce(
  352. (entries, [key, val2], i) => {
  353. entries[stringifySymbol(key, i) + " =>"] = val2;
  354. return entries;
  355. },
  356. {}
  357. )
  358. };
  359. } else if (isSet(val)) {
  360. return {
  361. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  362. };
  363. } else if (isSymbol(val)) {
  364. return stringifySymbol(val);
  365. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  366. return String(val);
  367. }
  368. return val;
  369. };
  370. const stringifySymbol = (v, i = "") => {
  371. var _a;
  372. return (
  373. // Symbol.description in es2019+ so we need to cast here to pass
  374. // the lib: es2016 check
  375. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  376. );
  377. };
  378. function warn$2(msg, ...args) {
  379. console.warn(`[Vue warn] ${msg}`, ...args);
  380. }
  381. let activeEffectScope;
  382. class EffectScope {
  383. constructor(detached = false) {
  384. this.detached = detached;
  385. /**
  386. * @internal
  387. */
  388. this._active = true;
  389. /**
  390. * @internal
  391. */
  392. this.effects = [];
  393. /**
  394. * @internal
  395. */
  396. this.cleanups = [];
  397. this._isPaused = false;
  398. this.parent = activeEffectScope;
  399. if (!detached && activeEffectScope) {
  400. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  401. this
  402. ) - 1;
  403. }
  404. }
  405. get active() {
  406. return this._active;
  407. }
  408. pause() {
  409. if (this._active) {
  410. this._isPaused = true;
  411. let i, l;
  412. if (this.scopes) {
  413. for (i = 0, l = this.scopes.length; i < l; i++) {
  414. this.scopes[i].pause();
  415. }
  416. }
  417. for (i = 0, l = this.effects.length; i < l; i++) {
  418. this.effects[i].pause();
  419. }
  420. }
  421. }
  422. /**
  423. * Resumes the effect scope, including all child scopes and effects.
  424. */
  425. resume() {
  426. if (this._active) {
  427. if (this._isPaused) {
  428. this._isPaused = false;
  429. let i, l;
  430. if (this.scopes) {
  431. for (i = 0, l = this.scopes.length; i < l; i++) {
  432. this.scopes[i].resume();
  433. }
  434. }
  435. for (i = 0, l = this.effects.length; i < l; i++) {
  436. this.effects[i].resume();
  437. }
  438. }
  439. }
  440. }
  441. run(fn) {
  442. if (this._active) {
  443. const currentEffectScope = activeEffectScope;
  444. try {
  445. activeEffectScope = this;
  446. return fn();
  447. } finally {
  448. activeEffectScope = currentEffectScope;
  449. }
  450. } else {
  451. warn$2(`cannot run an inactive effect scope.`);
  452. }
  453. }
  454. /**
  455. * This should only be called on non-detached scopes
  456. * @internal
  457. */
  458. on() {
  459. activeEffectScope = this;
  460. }
  461. /**
  462. * This should only be called on non-detached scopes
  463. * @internal
  464. */
  465. off() {
  466. activeEffectScope = this.parent;
  467. }
  468. stop(fromParent) {
  469. if (this._active) {
  470. let i, l;
  471. for (i = 0, l = this.effects.length; i < l; i++) {
  472. this.effects[i].stop();
  473. }
  474. for (i = 0, l = this.cleanups.length; i < l; i++) {
  475. this.cleanups[i]();
  476. }
  477. if (this.scopes) {
  478. for (i = 0, l = this.scopes.length; i < l; i++) {
  479. this.scopes[i].stop(true);
  480. }
  481. }
  482. if (!this.detached && this.parent && !fromParent) {
  483. const last = this.parent.scopes.pop();
  484. if (last && last !== this) {
  485. this.parent.scopes[this.index] = last;
  486. last.index = this.index;
  487. }
  488. }
  489. this.parent = void 0;
  490. this._active = false;
  491. }
  492. }
  493. }
  494. function effectScope(detached) {
  495. return new EffectScope(detached);
  496. }
  497. function getCurrentScope() {
  498. return activeEffectScope;
  499. }
  500. function onScopeDispose(fn, failSilently = false) {
  501. if (activeEffectScope) {
  502. activeEffectScope.cleanups.push(fn);
  503. } else if (!failSilently) {
  504. warn$2(
  505. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  506. );
  507. }
  508. }
  509. let activeSub;
  510. const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
  511. class ReactiveEffect {
  512. constructor(fn) {
  513. this.fn = fn;
  514. /**
  515. * @internal
  516. */
  517. this.deps = void 0;
  518. /**
  519. * @internal
  520. */
  521. this.depsTail = void 0;
  522. /**
  523. * @internal
  524. */
  525. this.flags = 1 | 4;
  526. /**
  527. * @internal
  528. */
  529. this.next = void 0;
  530. /**
  531. * @internal
  532. */
  533. this.cleanup = void 0;
  534. this.scheduler = void 0;
  535. if (activeEffectScope && activeEffectScope.active) {
  536. activeEffectScope.effects.push(this);
  537. }
  538. }
  539. pause() {
  540. this.flags |= 64;
  541. }
  542. resume() {
  543. if (this.flags & 64) {
  544. this.flags &= ~64;
  545. if (pausedQueueEffects.has(this)) {
  546. pausedQueueEffects.delete(this);
  547. this.trigger();
  548. }
  549. }
  550. }
  551. /**
  552. * @internal
  553. */
  554. notify() {
  555. if (this.flags & 2 && !(this.flags & 32)) {
  556. return;
  557. }
  558. if (!(this.flags & 8)) {
  559. batch(this);
  560. }
  561. }
  562. run() {
  563. if (!(this.flags & 1)) {
  564. return this.fn();
  565. }
  566. this.flags |= 2;
  567. cleanupEffect(this);
  568. prepareDeps(this);
  569. const prevEffect = activeSub;
  570. const prevShouldTrack = shouldTrack;
  571. activeSub = this;
  572. shouldTrack = true;
  573. try {
  574. return this.fn();
  575. } finally {
  576. if (activeSub !== this) {
  577. warn$2(
  578. "Active effect was not restored correctly - this is likely a Vue internal bug."
  579. );
  580. }
  581. cleanupDeps(this);
  582. activeSub = prevEffect;
  583. shouldTrack = prevShouldTrack;
  584. this.flags &= ~2;
  585. }
  586. }
  587. stop() {
  588. if (this.flags & 1) {
  589. for (let link = this.deps; link; link = link.nextDep) {
  590. removeSub(link);
  591. }
  592. this.deps = this.depsTail = void 0;
  593. cleanupEffect(this);
  594. this.onStop && this.onStop();
  595. this.flags &= ~1;
  596. }
  597. }
  598. trigger() {
  599. if (this.flags & 64) {
  600. pausedQueueEffects.add(this);
  601. } else if (this.scheduler) {
  602. this.scheduler();
  603. } else {
  604. this.runIfDirty();
  605. }
  606. }
  607. /**
  608. * @internal
  609. */
  610. runIfDirty() {
  611. if (isDirty(this)) {
  612. this.run();
  613. }
  614. }
  615. get dirty() {
  616. return isDirty(this);
  617. }
  618. }
  619. let batchDepth = 0;
  620. let batchedSub;
  621. let batchedComputed;
  622. function batch(sub, isComputed = false) {
  623. sub.flags |= 8;
  624. if (isComputed) {
  625. sub.next = batchedComputed;
  626. batchedComputed = sub;
  627. return;
  628. }
  629. sub.next = batchedSub;
  630. batchedSub = sub;
  631. }
  632. function startBatch() {
  633. batchDepth++;
  634. }
  635. function endBatch() {
  636. if (--batchDepth > 0) {
  637. return;
  638. }
  639. if (batchedComputed) {
  640. let e = batchedComputed;
  641. batchedComputed = void 0;
  642. while (e) {
  643. const next = e.next;
  644. e.next = void 0;
  645. e.flags &= ~8;
  646. e = next;
  647. }
  648. }
  649. let error;
  650. while (batchedSub) {
  651. let e = batchedSub;
  652. batchedSub = void 0;
  653. while (e) {
  654. const next = e.next;
  655. e.next = void 0;
  656. e.flags &= ~8;
  657. if (e.flags & 1) {
  658. try {
  659. ;
  660. e.trigger();
  661. } catch (err) {
  662. if (!error) error = err;
  663. }
  664. }
  665. e = next;
  666. }
  667. }
  668. if (error) throw error;
  669. }
  670. function prepareDeps(sub) {
  671. for (let link = sub.deps; link; link = link.nextDep) {
  672. link.version = -1;
  673. link.prevActiveLink = link.dep.activeLink;
  674. link.dep.activeLink = link;
  675. }
  676. }
  677. function cleanupDeps(sub) {
  678. let head;
  679. let tail = sub.depsTail;
  680. let link = tail;
  681. while (link) {
  682. const prev = link.prevDep;
  683. if (link.version === -1) {
  684. if (link === tail) tail = prev;
  685. removeSub(link);
  686. removeDep(link);
  687. } else {
  688. head = link;
  689. }
  690. link.dep.activeLink = link.prevActiveLink;
  691. link.prevActiveLink = void 0;
  692. link = prev;
  693. }
  694. sub.deps = head;
  695. sub.depsTail = tail;
  696. }
  697. function isDirty(sub) {
  698. for (let link = sub.deps; link; link = link.nextDep) {
  699. if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
  700. return true;
  701. }
  702. }
  703. if (sub._dirty) {
  704. return true;
  705. }
  706. return false;
  707. }
  708. function refreshComputed(computed) {
  709. if (computed.flags & 4 && !(computed.flags & 16)) {
  710. return;
  711. }
  712. computed.flags &= ~16;
  713. if (computed.globalVersion === globalVersion) {
  714. return;
  715. }
  716. computed.globalVersion = globalVersion;
  717. const dep = computed.dep;
  718. computed.flags |= 2;
  719. if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
  720. computed.flags &= ~2;
  721. return;
  722. }
  723. const prevSub = activeSub;
  724. const prevShouldTrack = shouldTrack;
  725. activeSub = computed;
  726. shouldTrack = true;
  727. try {
  728. prepareDeps(computed);
  729. const value = computed.fn(computed._value);
  730. if (dep.version === 0 || hasChanged(value, computed._value)) {
  731. computed._value = value;
  732. dep.version++;
  733. }
  734. } catch (err) {
  735. dep.version++;
  736. throw err;
  737. } finally {
  738. activeSub = prevSub;
  739. shouldTrack = prevShouldTrack;
  740. cleanupDeps(computed);
  741. computed.flags &= ~2;
  742. }
  743. }
  744. function removeSub(link, soft = false) {
  745. const { dep, prevSub, nextSub } = link;
  746. if (prevSub) {
  747. prevSub.nextSub = nextSub;
  748. link.prevSub = void 0;
  749. }
  750. if (nextSub) {
  751. nextSub.prevSub = prevSub;
  752. link.nextSub = void 0;
  753. }
  754. if (dep.subsHead === link) {
  755. dep.subsHead = nextSub;
  756. }
  757. if (dep.subs === link) {
  758. dep.subs = prevSub;
  759. if (!prevSub && dep.computed) {
  760. dep.computed.flags &= ~4;
  761. for (let l = dep.computed.deps; l; l = l.nextDep) {
  762. removeSub(l, true);
  763. }
  764. }
  765. }
  766. if (!soft && !--dep.sc && dep.map) {
  767. dep.map.delete(dep.key);
  768. }
  769. }
  770. function removeDep(link) {
  771. const { prevDep, nextDep } = link;
  772. if (prevDep) {
  773. prevDep.nextDep = nextDep;
  774. link.prevDep = void 0;
  775. }
  776. if (nextDep) {
  777. nextDep.prevDep = prevDep;
  778. link.nextDep = void 0;
  779. }
  780. }
  781. function effect(fn, options) {
  782. if (fn.effect instanceof ReactiveEffect) {
  783. fn = fn.effect.fn;
  784. }
  785. const e = new ReactiveEffect(fn);
  786. if (options) {
  787. extend(e, options);
  788. }
  789. try {
  790. e.run();
  791. } catch (err) {
  792. e.stop();
  793. throw err;
  794. }
  795. const runner = e.run.bind(e);
  796. runner.effect = e;
  797. return runner;
  798. }
  799. function stop(runner) {
  800. runner.effect.stop();
  801. }
  802. let shouldTrack = true;
  803. const trackStack = [];
  804. function pauseTracking() {
  805. trackStack.push(shouldTrack);
  806. shouldTrack = false;
  807. }
  808. function resetTracking() {
  809. const last = trackStack.pop();
  810. shouldTrack = last === void 0 ? true : last;
  811. }
  812. function cleanupEffect(e) {
  813. const { cleanup } = e;
  814. e.cleanup = void 0;
  815. if (cleanup) {
  816. const prevSub = activeSub;
  817. activeSub = void 0;
  818. try {
  819. cleanup();
  820. } finally {
  821. activeSub = prevSub;
  822. }
  823. }
  824. }
  825. let globalVersion = 0;
  826. class Link {
  827. constructor(sub, dep) {
  828. this.sub = sub;
  829. this.dep = dep;
  830. this.version = dep.version;
  831. this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
  832. }
  833. }
  834. class Dep {
  835. constructor(computed) {
  836. this.computed = computed;
  837. this.version = 0;
  838. /**
  839. * Link between this dep and the current active effect
  840. */
  841. this.activeLink = void 0;
  842. /**
  843. * Doubly linked list representing the subscribing effects (tail)
  844. */
  845. this.subs = void 0;
  846. /**
  847. * For object property deps cleanup
  848. */
  849. this.map = void 0;
  850. this.key = void 0;
  851. /**
  852. * Subscriber counter
  853. */
  854. this.sc = 0;
  855. {
  856. this.subsHead = void 0;
  857. }
  858. }
  859. track(debugInfo) {
  860. if (!activeSub || !shouldTrack || activeSub === this.computed) {
  861. return;
  862. }
  863. let link = this.activeLink;
  864. if (link === void 0 || link.sub !== activeSub) {
  865. link = this.activeLink = new Link(activeSub, this);
  866. if (!activeSub.deps) {
  867. activeSub.deps = activeSub.depsTail = link;
  868. } else {
  869. link.prevDep = activeSub.depsTail;
  870. activeSub.depsTail.nextDep = link;
  871. activeSub.depsTail = link;
  872. }
  873. addSub(link);
  874. } else if (link.version === -1) {
  875. link.version = this.version;
  876. if (link.nextDep) {
  877. const next = link.nextDep;
  878. next.prevDep = link.prevDep;
  879. if (link.prevDep) {
  880. link.prevDep.nextDep = next;
  881. }
  882. link.prevDep = activeSub.depsTail;
  883. link.nextDep = void 0;
  884. activeSub.depsTail.nextDep = link;
  885. activeSub.depsTail = link;
  886. if (activeSub.deps === link) {
  887. activeSub.deps = next;
  888. }
  889. }
  890. }
  891. if (activeSub.onTrack) {
  892. activeSub.onTrack(
  893. extend(
  894. {
  895. effect: activeSub
  896. },
  897. debugInfo
  898. )
  899. );
  900. }
  901. return link;
  902. }
  903. trigger(debugInfo) {
  904. this.version++;
  905. globalVersion++;
  906. this.notify(debugInfo);
  907. }
  908. notify(debugInfo) {
  909. startBatch();
  910. try {
  911. if (true) {
  912. for (let head = this.subsHead; head; head = head.nextSub) {
  913. if (head.sub.onTrigger && !(head.sub.flags & 8)) {
  914. head.sub.onTrigger(
  915. extend(
  916. {
  917. effect: head.sub
  918. },
  919. debugInfo
  920. )
  921. );
  922. }
  923. }
  924. }
  925. for (let link = this.subs; link; link = link.prevSub) {
  926. if (link.sub.notify()) {
  927. ;
  928. link.sub.dep.notify();
  929. }
  930. }
  931. } finally {
  932. endBatch();
  933. }
  934. }
  935. }
  936. function addSub(link) {
  937. link.dep.sc++;
  938. if (link.sub.flags & 4) {
  939. const computed = link.dep.computed;
  940. if (computed && !link.dep.subs) {
  941. computed.flags |= 4 | 16;
  942. for (let l = computed.deps; l; l = l.nextDep) {
  943. addSub(l);
  944. }
  945. }
  946. const currentTail = link.dep.subs;
  947. if (currentTail !== link) {
  948. link.prevSub = currentTail;
  949. if (currentTail) currentTail.nextSub = link;
  950. }
  951. if (link.dep.subsHead === void 0) {
  952. link.dep.subsHead = link;
  953. }
  954. link.dep.subs = link;
  955. }
  956. }
  957. const targetMap = /* @__PURE__ */ new WeakMap();
  958. const ITERATE_KEY = Symbol(
  959. "Object iterate"
  960. );
  961. const MAP_KEY_ITERATE_KEY = Symbol(
  962. "Map keys iterate"
  963. );
  964. const ARRAY_ITERATE_KEY = Symbol(
  965. "Array iterate"
  966. );
  967. function track(target, type, key) {
  968. if (shouldTrack && activeSub) {
  969. let depsMap = targetMap.get(target);
  970. if (!depsMap) {
  971. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  972. }
  973. let dep = depsMap.get(key);
  974. if (!dep) {
  975. depsMap.set(key, dep = new Dep());
  976. dep.map = depsMap;
  977. dep.key = key;
  978. }
  979. {
  980. dep.track({
  981. target,
  982. type,
  983. key
  984. });
  985. }
  986. }
  987. }
  988. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  989. const depsMap = targetMap.get(target);
  990. if (!depsMap) {
  991. globalVersion++;
  992. return;
  993. }
  994. const run = (dep) => {
  995. if (dep) {
  996. {
  997. dep.trigger({
  998. target,
  999. type,
  1000. key,
  1001. newValue,
  1002. oldValue,
  1003. oldTarget
  1004. });
  1005. }
  1006. }
  1007. };
  1008. startBatch();
  1009. if (type === "clear") {
  1010. depsMap.forEach(run);
  1011. } else {
  1012. const targetIsArray = isArray(target);
  1013. const isArrayIndex = targetIsArray && isIntegerKey(key);
  1014. if (targetIsArray && key === "length") {
  1015. const newLength = Number(newValue);
  1016. depsMap.forEach((dep, key2) => {
  1017. if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
  1018. run(dep);
  1019. }
  1020. });
  1021. } else {
  1022. if (key !== void 0 || depsMap.has(void 0)) {
  1023. run(depsMap.get(key));
  1024. }
  1025. if (isArrayIndex) {
  1026. run(depsMap.get(ARRAY_ITERATE_KEY));
  1027. }
  1028. switch (type) {
  1029. case "add":
  1030. if (!targetIsArray) {
  1031. run(depsMap.get(ITERATE_KEY));
  1032. if (isMap(target)) {
  1033. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1034. }
  1035. } else if (isArrayIndex) {
  1036. run(depsMap.get("length"));
  1037. }
  1038. break;
  1039. case "delete":
  1040. if (!targetIsArray) {
  1041. run(depsMap.get(ITERATE_KEY));
  1042. if (isMap(target)) {
  1043. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1044. }
  1045. }
  1046. break;
  1047. case "set":
  1048. if (isMap(target)) {
  1049. run(depsMap.get(ITERATE_KEY));
  1050. }
  1051. break;
  1052. }
  1053. }
  1054. }
  1055. endBatch();
  1056. }
  1057. function getDepFromReactive(object, key) {
  1058. const depMap = targetMap.get(object);
  1059. return depMap && depMap.get(key);
  1060. }
  1061. function reactiveReadArray(array) {
  1062. const raw = toRaw(array);
  1063. if (raw === array) return raw;
  1064. track(raw, "iterate", ARRAY_ITERATE_KEY);
  1065. return isShallow(array) ? raw : raw.map(toReactive);
  1066. }
  1067. function shallowReadArray(arr) {
  1068. track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
  1069. return arr;
  1070. }
  1071. const arrayInstrumentations = {
  1072. __proto__: null,
  1073. [Symbol.iterator]() {
  1074. return iterator(this, Symbol.iterator, toReactive);
  1075. },
  1076. concat(...args) {
  1077. return reactiveReadArray(this).concat(
  1078. ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
  1079. );
  1080. },
  1081. entries() {
  1082. return iterator(this, "entries", (value) => {
  1083. value[1] = toReactive(value[1]);
  1084. return value;
  1085. });
  1086. },
  1087. every(fn, thisArg) {
  1088. return apply(this, "every", fn, thisArg, void 0, arguments);
  1089. },
  1090. filter(fn, thisArg) {
  1091. return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
  1092. },
  1093. find(fn, thisArg) {
  1094. return apply(this, "find", fn, thisArg, toReactive, arguments);
  1095. },
  1096. findIndex(fn, thisArg) {
  1097. return apply(this, "findIndex", fn, thisArg, void 0, arguments);
  1098. },
  1099. findLast(fn, thisArg) {
  1100. return apply(this, "findLast", fn, thisArg, toReactive, arguments);
  1101. },
  1102. findLastIndex(fn, thisArg) {
  1103. return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
  1104. },
  1105. // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
  1106. forEach(fn, thisArg) {
  1107. return apply(this, "forEach", fn, thisArg, void 0, arguments);
  1108. },
  1109. includes(...args) {
  1110. return searchProxy(this, "includes", args);
  1111. },
  1112. indexOf(...args) {
  1113. return searchProxy(this, "indexOf", args);
  1114. },
  1115. join(separator) {
  1116. return reactiveReadArray(this).join(separator);
  1117. },
  1118. // keys() iterator only reads `length`, no optimisation required
  1119. lastIndexOf(...args) {
  1120. return searchProxy(this, "lastIndexOf", args);
  1121. },
  1122. map(fn, thisArg) {
  1123. return apply(this, "map", fn, thisArg, void 0, arguments);
  1124. },
  1125. pop() {
  1126. return noTracking(this, "pop");
  1127. },
  1128. push(...args) {
  1129. return noTracking(this, "push", args);
  1130. },
  1131. reduce(fn, ...args) {
  1132. return reduce(this, "reduce", fn, args);
  1133. },
  1134. reduceRight(fn, ...args) {
  1135. return reduce(this, "reduceRight", fn, args);
  1136. },
  1137. shift() {
  1138. return noTracking(this, "shift");
  1139. },
  1140. // slice could use ARRAY_ITERATE but also seems to beg for range tracking
  1141. some(fn, thisArg) {
  1142. return apply(this, "some", fn, thisArg, void 0, arguments);
  1143. },
  1144. splice(...args) {
  1145. return noTracking(this, "splice", args);
  1146. },
  1147. toReversed() {
  1148. return reactiveReadArray(this).toReversed();
  1149. },
  1150. toSorted(comparer) {
  1151. return reactiveReadArray(this).toSorted(comparer);
  1152. },
  1153. toSpliced(...args) {
  1154. return reactiveReadArray(this).toSpliced(...args);
  1155. },
  1156. unshift(...args) {
  1157. return noTracking(this, "unshift", args);
  1158. },
  1159. values() {
  1160. return iterator(this, "values", toReactive);
  1161. }
  1162. };
  1163. function iterator(self, method, wrapValue) {
  1164. const arr = shallowReadArray(self);
  1165. const iter = arr[method]();
  1166. if (arr !== self && !isShallow(self)) {
  1167. iter._next = iter.next;
  1168. iter.next = () => {
  1169. const result = iter._next();
  1170. if (result.value) {
  1171. result.value = wrapValue(result.value);
  1172. }
  1173. return result;
  1174. };
  1175. }
  1176. return iter;
  1177. }
  1178. const arrayProto = Array.prototype;
  1179. function apply(self, method, fn, thisArg, wrappedRetFn, args) {
  1180. const arr = shallowReadArray(self);
  1181. const needsWrap = arr !== self && !isShallow(self);
  1182. const methodFn = arr[method];
  1183. if (methodFn !== arrayProto[method]) {
  1184. const result2 = methodFn.apply(self, args);
  1185. return needsWrap ? toReactive(result2) : result2;
  1186. }
  1187. let wrappedFn = fn;
  1188. if (arr !== self) {
  1189. if (needsWrap) {
  1190. wrappedFn = function(item, index) {
  1191. return fn.call(this, toReactive(item), index, self);
  1192. };
  1193. } else if (fn.length > 2) {
  1194. wrappedFn = function(item, index) {
  1195. return fn.call(this, item, index, self);
  1196. };
  1197. }
  1198. }
  1199. const result = methodFn.call(arr, wrappedFn, thisArg);
  1200. return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
  1201. }
  1202. function reduce(self, method, fn, args) {
  1203. const arr = shallowReadArray(self);
  1204. let wrappedFn = fn;
  1205. if (arr !== self) {
  1206. if (!isShallow(self)) {
  1207. wrappedFn = function(acc, item, index) {
  1208. return fn.call(this, acc, toReactive(item), index, self);
  1209. };
  1210. } else if (fn.length > 3) {
  1211. wrappedFn = function(acc, item, index) {
  1212. return fn.call(this, acc, item, index, self);
  1213. };
  1214. }
  1215. }
  1216. return arr[method](wrappedFn, ...args);
  1217. }
  1218. function searchProxy(self, method, args) {
  1219. const arr = toRaw(self);
  1220. track(arr, "iterate", ARRAY_ITERATE_KEY);
  1221. const res = arr[method](...args);
  1222. if ((res === -1 || res === false) && isProxy(args[0])) {
  1223. args[0] = toRaw(args[0]);
  1224. return arr[method](...args);
  1225. }
  1226. return res;
  1227. }
  1228. function noTracking(self, method, args = []) {
  1229. pauseTracking();
  1230. startBatch();
  1231. const res = toRaw(self)[method].apply(self, args);
  1232. endBatch();
  1233. resetTracking();
  1234. return res;
  1235. }
  1236. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  1237. const builtInSymbols = new Set(
  1238. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1239. );
  1240. function hasOwnProperty(key) {
  1241. if (!isSymbol(key)) key = String(key);
  1242. const obj = toRaw(this);
  1243. track(obj, "has", key);
  1244. return obj.hasOwnProperty(key);
  1245. }
  1246. class BaseReactiveHandler {
  1247. constructor(_isReadonly = false, _isShallow = false) {
  1248. this._isReadonly = _isReadonly;
  1249. this._isShallow = _isShallow;
  1250. }
  1251. get(target, key, receiver) {
  1252. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  1253. if (key === "__v_isReactive") {
  1254. return !isReadonly2;
  1255. } else if (key === "__v_isReadonly") {
  1256. return isReadonly2;
  1257. } else if (key === "__v_isShallow") {
  1258. return isShallow2;
  1259. } else if (key === "__v_raw") {
  1260. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  1261. // this means the receiver is a user proxy of the reactive proxy
  1262. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  1263. return target;
  1264. }
  1265. return;
  1266. }
  1267. const targetIsArray = isArray(target);
  1268. if (!isReadonly2) {
  1269. let fn;
  1270. if (targetIsArray && (fn = arrayInstrumentations[key])) {
  1271. return fn;
  1272. }
  1273. if (key === "hasOwnProperty") {
  1274. return hasOwnProperty;
  1275. }
  1276. }
  1277. const res = Reflect.get(
  1278. target,
  1279. key,
  1280. // if this is a proxy wrapping a ref, return methods using the raw ref
  1281. // as receiver so that we don't have to call `toRaw` on the ref in all
  1282. // its class methods
  1283. isRef(target) ? target : receiver
  1284. );
  1285. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1286. return res;
  1287. }
  1288. if (!isReadonly2) {
  1289. track(target, "get", key);
  1290. }
  1291. if (isShallow2) {
  1292. return res;
  1293. }
  1294. if (isRef(res)) {
  1295. return targetIsArray && isIntegerKey(key) ? res : res.value;
  1296. }
  1297. if (isObject(res)) {
  1298. return isReadonly2 ? readonly(res) : reactive(res);
  1299. }
  1300. return res;
  1301. }
  1302. }
  1303. class MutableReactiveHandler extends BaseReactiveHandler {
  1304. constructor(isShallow2 = false) {
  1305. super(false, isShallow2);
  1306. }
  1307. set(target, key, value, receiver) {
  1308. let oldValue = target[key];
  1309. if (!this._isShallow) {
  1310. const isOldValueReadonly = isReadonly(oldValue);
  1311. if (!isShallow(value) && !isReadonly(value)) {
  1312. oldValue = toRaw(oldValue);
  1313. value = toRaw(value);
  1314. }
  1315. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  1316. if (isOldValueReadonly) {
  1317. return false;
  1318. } else {
  1319. oldValue.value = value;
  1320. return true;
  1321. }
  1322. }
  1323. }
  1324. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  1325. const result = Reflect.set(
  1326. target,
  1327. key,
  1328. value,
  1329. isRef(target) ? target : receiver
  1330. );
  1331. if (target === toRaw(receiver)) {
  1332. if (!hadKey) {
  1333. trigger(target, "add", key, value);
  1334. } else if (hasChanged(value, oldValue)) {
  1335. trigger(target, "set", key, value, oldValue);
  1336. }
  1337. }
  1338. return result;
  1339. }
  1340. deleteProperty(target, key) {
  1341. const hadKey = hasOwn(target, key);
  1342. const oldValue = target[key];
  1343. const result = Reflect.deleteProperty(target, key);
  1344. if (result && hadKey) {
  1345. trigger(target, "delete", key, void 0, oldValue);
  1346. }
  1347. return result;
  1348. }
  1349. has(target, key) {
  1350. const result = Reflect.has(target, key);
  1351. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  1352. track(target, "has", key);
  1353. }
  1354. return result;
  1355. }
  1356. ownKeys(target) {
  1357. track(
  1358. target,
  1359. "iterate",
  1360. isArray(target) ? "length" : ITERATE_KEY
  1361. );
  1362. return Reflect.ownKeys(target);
  1363. }
  1364. }
  1365. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  1366. constructor(isShallow2 = false) {
  1367. super(true, isShallow2);
  1368. }
  1369. set(target, key) {
  1370. {
  1371. warn$2(
  1372. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1373. target
  1374. );
  1375. }
  1376. return true;
  1377. }
  1378. deleteProperty(target, key) {
  1379. {
  1380. warn$2(
  1381. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  1382. target
  1383. );
  1384. }
  1385. return true;
  1386. }
  1387. }
  1388. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  1389. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  1390. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
  1391. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  1392. const toShallow = (value) => value;
  1393. const getProto = (v) => Reflect.getPrototypeOf(v);
  1394. function createIterableMethod(method, isReadonly2, isShallow2) {
  1395. return function(...args) {
  1396. const target = this["__v_raw"];
  1397. const rawTarget = toRaw(target);
  1398. const targetIsMap = isMap(rawTarget);
  1399. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1400. const isKeyOnly = method === "keys" && targetIsMap;
  1401. const innerIterator = target[method](...args);
  1402. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1403. !isReadonly2 && track(
  1404. rawTarget,
  1405. "iterate",
  1406. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1407. );
  1408. return {
  1409. // iterator protocol
  1410. next() {
  1411. const { value, done } = innerIterator.next();
  1412. return done ? { value, done } : {
  1413. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1414. done
  1415. };
  1416. },
  1417. // iterable protocol
  1418. [Symbol.iterator]() {
  1419. return this;
  1420. }
  1421. };
  1422. };
  1423. }
  1424. function createReadonlyMethod(type) {
  1425. return function(...args) {
  1426. {
  1427. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1428. warn$2(
  1429. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1430. toRaw(this)
  1431. );
  1432. }
  1433. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1434. };
  1435. }
  1436. function createInstrumentations(readonly, shallow) {
  1437. const instrumentations = {
  1438. get(key) {
  1439. const target = this["__v_raw"];
  1440. const rawTarget = toRaw(target);
  1441. const rawKey = toRaw(key);
  1442. if (!readonly) {
  1443. if (hasChanged(key, rawKey)) {
  1444. track(rawTarget, "get", key);
  1445. }
  1446. track(rawTarget, "get", rawKey);
  1447. }
  1448. const { has } = getProto(rawTarget);
  1449. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1450. if (has.call(rawTarget, key)) {
  1451. return wrap(target.get(key));
  1452. } else if (has.call(rawTarget, rawKey)) {
  1453. return wrap(target.get(rawKey));
  1454. } else if (target !== rawTarget) {
  1455. target.get(key);
  1456. }
  1457. },
  1458. get size() {
  1459. const target = this["__v_raw"];
  1460. !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
  1461. return Reflect.get(target, "size", target);
  1462. },
  1463. has(key) {
  1464. const target = this["__v_raw"];
  1465. const rawTarget = toRaw(target);
  1466. const rawKey = toRaw(key);
  1467. if (!readonly) {
  1468. if (hasChanged(key, rawKey)) {
  1469. track(rawTarget, "has", key);
  1470. }
  1471. track(rawTarget, "has", rawKey);
  1472. }
  1473. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  1474. },
  1475. forEach(callback, thisArg) {
  1476. const observed = this;
  1477. const target = observed["__v_raw"];
  1478. const rawTarget = toRaw(target);
  1479. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1480. !readonly && track(rawTarget, "iterate", ITERATE_KEY);
  1481. return target.forEach((value, key) => {
  1482. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1483. });
  1484. }
  1485. };
  1486. extend(
  1487. instrumentations,
  1488. readonly ? {
  1489. add: createReadonlyMethod("add"),
  1490. set: createReadonlyMethod("set"),
  1491. delete: createReadonlyMethod("delete"),
  1492. clear: createReadonlyMethod("clear")
  1493. } : {
  1494. add(value) {
  1495. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1496. value = toRaw(value);
  1497. }
  1498. const target = toRaw(this);
  1499. const proto = getProto(target);
  1500. const hadKey = proto.has.call(target, value);
  1501. if (!hadKey) {
  1502. target.add(value);
  1503. trigger(target, "add", value, value);
  1504. }
  1505. return this;
  1506. },
  1507. set(key, value) {
  1508. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1509. value = toRaw(value);
  1510. }
  1511. const target = toRaw(this);
  1512. const { has, get } = getProto(target);
  1513. let hadKey = has.call(target, key);
  1514. if (!hadKey) {
  1515. key = toRaw(key);
  1516. hadKey = has.call(target, key);
  1517. } else {
  1518. checkIdentityKeys(target, has, key);
  1519. }
  1520. const oldValue = get.call(target, key);
  1521. target.set(key, value);
  1522. if (!hadKey) {
  1523. trigger(target, "add", key, value);
  1524. } else if (hasChanged(value, oldValue)) {
  1525. trigger(target, "set", key, value, oldValue);
  1526. }
  1527. return this;
  1528. },
  1529. delete(key) {
  1530. const target = toRaw(this);
  1531. const { has, get } = getProto(target);
  1532. let hadKey = has.call(target, key);
  1533. if (!hadKey) {
  1534. key = toRaw(key);
  1535. hadKey = has.call(target, key);
  1536. } else {
  1537. checkIdentityKeys(target, has, key);
  1538. }
  1539. const oldValue = get ? get.call(target, key) : void 0;
  1540. const result = target.delete(key);
  1541. if (hadKey) {
  1542. trigger(target, "delete", key, void 0, oldValue);
  1543. }
  1544. return result;
  1545. },
  1546. clear() {
  1547. const target = toRaw(this);
  1548. const hadItems = target.size !== 0;
  1549. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1550. const result = target.clear();
  1551. if (hadItems) {
  1552. trigger(
  1553. target,
  1554. "clear",
  1555. void 0,
  1556. void 0,
  1557. oldTarget
  1558. );
  1559. }
  1560. return result;
  1561. }
  1562. }
  1563. );
  1564. const iteratorMethods = [
  1565. "keys",
  1566. "values",
  1567. "entries",
  1568. Symbol.iterator
  1569. ];
  1570. iteratorMethods.forEach((method) => {
  1571. instrumentations[method] = createIterableMethod(method, readonly, shallow);
  1572. });
  1573. return instrumentations;
  1574. }
  1575. function createInstrumentationGetter(isReadonly2, shallow) {
  1576. const instrumentations = createInstrumentations(isReadonly2, shallow);
  1577. return (target, key, receiver) => {
  1578. if (key === "__v_isReactive") {
  1579. return !isReadonly2;
  1580. } else if (key === "__v_isReadonly") {
  1581. return isReadonly2;
  1582. } else if (key === "__v_raw") {
  1583. return target;
  1584. }
  1585. return Reflect.get(
  1586. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1587. key,
  1588. receiver
  1589. );
  1590. };
  1591. }
  1592. const mutableCollectionHandlers = {
  1593. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1594. };
  1595. const shallowCollectionHandlers = {
  1596. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1597. };
  1598. const readonlyCollectionHandlers = {
  1599. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1600. };
  1601. const shallowReadonlyCollectionHandlers = {
  1602. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1603. };
  1604. function checkIdentityKeys(target, has, key) {
  1605. const rawKey = toRaw(key);
  1606. if (rawKey !== key && has.call(target, rawKey)) {
  1607. const type = toRawType(target);
  1608. warn$2(
  1609. `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.`
  1610. );
  1611. }
  1612. }
  1613. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1614. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1615. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1616. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1617. function targetTypeMap(rawType) {
  1618. switch (rawType) {
  1619. case "Object":
  1620. case "Array":
  1621. return 1 /* COMMON */;
  1622. case "Map":
  1623. case "Set":
  1624. case "WeakMap":
  1625. case "WeakSet":
  1626. return 2 /* COLLECTION */;
  1627. default:
  1628. return 0 /* INVALID */;
  1629. }
  1630. }
  1631. function getTargetType(value) {
  1632. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1633. }
  1634. function reactive(target) {
  1635. if (isReadonly(target)) {
  1636. return target;
  1637. }
  1638. return createReactiveObject(
  1639. target,
  1640. false,
  1641. mutableHandlers,
  1642. mutableCollectionHandlers,
  1643. reactiveMap
  1644. );
  1645. }
  1646. function shallowReactive(target) {
  1647. return createReactiveObject(
  1648. target,
  1649. false,
  1650. shallowReactiveHandlers,
  1651. shallowCollectionHandlers,
  1652. shallowReactiveMap
  1653. );
  1654. }
  1655. function readonly(target) {
  1656. return createReactiveObject(
  1657. target,
  1658. true,
  1659. readonlyHandlers,
  1660. readonlyCollectionHandlers,
  1661. readonlyMap
  1662. );
  1663. }
  1664. function shallowReadonly(target) {
  1665. return createReactiveObject(
  1666. target,
  1667. true,
  1668. shallowReadonlyHandlers,
  1669. shallowReadonlyCollectionHandlers,
  1670. shallowReadonlyMap
  1671. );
  1672. }
  1673. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1674. if (!isObject(target)) {
  1675. {
  1676. warn$2(
  1677. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1678. target
  1679. )}`
  1680. );
  1681. }
  1682. return target;
  1683. }
  1684. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1685. return target;
  1686. }
  1687. const existingProxy = proxyMap.get(target);
  1688. if (existingProxy) {
  1689. return existingProxy;
  1690. }
  1691. const targetType = getTargetType(target);
  1692. if (targetType === 0 /* INVALID */) {
  1693. return target;
  1694. }
  1695. const proxy = new Proxy(
  1696. target,
  1697. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1698. );
  1699. proxyMap.set(target, proxy);
  1700. return proxy;
  1701. }
  1702. function isReactive(value) {
  1703. if (isReadonly(value)) {
  1704. return isReactive(value["__v_raw"]);
  1705. }
  1706. return !!(value && value["__v_isReactive"]);
  1707. }
  1708. function isReadonly(value) {
  1709. return !!(value && value["__v_isReadonly"]);
  1710. }
  1711. function isShallow(value) {
  1712. return !!(value && value["__v_isShallow"]);
  1713. }
  1714. function isProxy(value) {
  1715. return value ? !!value["__v_raw"] : false;
  1716. }
  1717. function toRaw(observed) {
  1718. const raw = observed && observed["__v_raw"];
  1719. return raw ? toRaw(raw) : observed;
  1720. }
  1721. function markRaw(value) {
  1722. if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
  1723. def(value, "__v_skip", true);
  1724. }
  1725. return value;
  1726. }
  1727. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1728. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1729. function isRef(r) {
  1730. return r ? r["__v_isRef"] === true : false;
  1731. }
  1732. function ref(value) {
  1733. return createRef(value, false);
  1734. }
  1735. function shallowRef(value) {
  1736. return createRef(value, true);
  1737. }
  1738. function createRef(rawValue, shallow) {
  1739. if (isRef(rawValue)) {
  1740. return rawValue;
  1741. }
  1742. return new RefImpl(rawValue, shallow);
  1743. }
  1744. class RefImpl {
  1745. constructor(value, isShallow2) {
  1746. this.dep = new Dep();
  1747. this["__v_isRef"] = true;
  1748. this["__v_isShallow"] = false;
  1749. this._rawValue = isShallow2 ? value : toRaw(value);
  1750. this._value = isShallow2 ? value : toReactive(value);
  1751. this["__v_isShallow"] = isShallow2;
  1752. }
  1753. get value() {
  1754. {
  1755. this.dep.track({
  1756. target: this,
  1757. type: "get",
  1758. key: "value"
  1759. });
  1760. }
  1761. return this._value;
  1762. }
  1763. set value(newValue) {
  1764. const oldValue = this._rawValue;
  1765. const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
  1766. newValue = useDirectValue ? newValue : toRaw(newValue);
  1767. if (hasChanged(newValue, oldValue)) {
  1768. this._rawValue = newValue;
  1769. this._value = useDirectValue ? newValue : toReactive(newValue);
  1770. {
  1771. this.dep.trigger({
  1772. target: this,
  1773. type: "set",
  1774. key: "value",
  1775. newValue,
  1776. oldValue
  1777. });
  1778. }
  1779. }
  1780. }
  1781. }
  1782. function triggerRef(ref2) {
  1783. if (ref2.dep) {
  1784. {
  1785. ref2.dep.trigger({
  1786. target: ref2,
  1787. type: "set",
  1788. key: "value",
  1789. newValue: ref2._value
  1790. });
  1791. }
  1792. }
  1793. }
  1794. function unref(ref2) {
  1795. return isRef(ref2) ? ref2.value : ref2;
  1796. }
  1797. function toValue(source) {
  1798. return isFunction(source) ? source() : unref(source);
  1799. }
  1800. const shallowUnwrapHandlers = {
  1801. get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
  1802. set: (target, key, value, receiver) => {
  1803. const oldValue = target[key];
  1804. if (isRef(oldValue) && !isRef(value)) {
  1805. oldValue.value = value;
  1806. return true;
  1807. } else {
  1808. return Reflect.set(target, key, value, receiver);
  1809. }
  1810. }
  1811. };
  1812. function proxyRefs(objectWithRefs) {
  1813. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1814. }
  1815. class CustomRefImpl {
  1816. constructor(factory) {
  1817. this["__v_isRef"] = true;
  1818. this._value = void 0;
  1819. const dep = this.dep = new Dep();
  1820. const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
  1821. this._get = get;
  1822. this._set = set;
  1823. }
  1824. get value() {
  1825. return this._value = this._get();
  1826. }
  1827. set value(newVal) {
  1828. this._set(newVal);
  1829. }
  1830. }
  1831. function customRef(factory) {
  1832. return new CustomRefImpl(factory);
  1833. }
  1834. function toRefs(object) {
  1835. if (!isProxy(object)) {
  1836. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1837. }
  1838. const ret = isArray(object) ? new Array(object.length) : {};
  1839. for (const key in object) {
  1840. ret[key] = propertyToRef(object, key);
  1841. }
  1842. return ret;
  1843. }
  1844. class ObjectRefImpl {
  1845. constructor(_object, _key, _defaultValue) {
  1846. this._object = _object;
  1847. this._key = _key;
  1848. this._defaultValue = _defaultValue;
  1849. this["__v_isRef"] = true;
  1850. this._value = void 0;
  1851. }
  1852. get value() {
  1853. const val = this._object[this._key];
  1854. return this._value = val === void 0 ? this._defaultValue : val;
  1855. }
  1856. set value(newVal) {
  1857. this._object[this._key] = newVal;
  1858. }
  1859. get dep() {
  1860. return getDepFromReactive(toRaw(this._object), this._key);
  1861. }
  1862. }
  1863. class GetterRefImpl {
  1864. constructor(_getter) {
  1865. this._getter = _getter;
  1866. this["__v_isRef"] = true;
  1867. this["__v_isReadonly"] = true;
  1868. this._value = void 0;
  1869. }
  1870. get value() {
  1871. return this._value = this._getter();
  1872. }
  1873. }
  1874. function toRef(source, key, defaultValue) {
  1875. if (isRef(source)) {
  1876. return source;
  1877. } else if (isFunction(source)) {
  1878. return new GetterRefImpl(source);
  1879. } else if (isObject(source) && arguments.length > 1) {
  1880. return propertyToRef(source, key, defaultValue);
  1881. } else {
  1882. return ref(source);
  1883. }
  1884. }
  1885. function propertyToRef(source, key, defaultValue) {
  1886. const val = source[key];
  1887. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1888. }
  1889. class ComputedRefImpl {
  1890. constructor(fn, setter, isSSR) {
  1891. this.fn = fn;
  1892. this.setter = setter;
  1893. /**
  1894. * @internal
  1895. */
  1896. this._value = void 0;
  1897. /**
  1898. * @internal
  1899. */
  1900. this.dep = new Dep(this);
  1901. /**
  1902. * @internal
  1903. */
  1904. this.__v_isRef = true;
  1905. // TODO isolatedDeclarations "__v_isReadonly"
  1906. // A computed is also a subscriber that tracks other deps
  1907. /**
  1908. * @internal
  1909. */
  1910. this.deps = void 0;
  1911. /**
  1912. * @internal
  1913. */
  1914. this.depsTail = void 0;
  1915. /**
  1916. * @internal
  1917. */
  1918. this.flags = 16;
  1919. /**
  1920. * @internal
  1921. */
  1922. this.globalVersion = globalVersion - 1;
  1923. /**
  1924. * @internal
  1925. */
  1926. this.next = void 0;
  1927. // for backwards compat
  1928. this.effect = this;
  1929. this["__v_isReadonly"] = !setter;
  1930. this.isSSR = isSSR;
  1931. }
  1932. /**
  1933. * @internal
  1934. */
  1935. notify() {
  1936. this.flags |= 16;
  1937. if (!(this.flags & 8) && // avoid infinite self recursion
  1938. activeSub !== this) {
  1939. batch(this, true);
  1940. return true;
  1941. }
  1942. }
  1943. get value() {
  1944. const link = this.dep.track({
  1945. target: this,
  1946. type: "get",
  1947. key: "value"
  1948. }) ;
  1949. refreshComputed(this);
  1950. if (link) {
  1951. link.version = this.dep.version;
  1952. }
  1953. return this._value;
  1954. }
  1955. set value(newValue) {
  1956. if (this.setter) {
  1957. this.setter(newValue);
  1958. } else {
  1959. warn$2("Write operation failed: computed value is readonly");
  1960. }
  1961. }
  1962. }
  1963. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1964. let getter;
  1965. let setter;
  1966. if (isFunction(getterOrOptions)) {
  1967. getter = getterOrOptions;
  1968. } else {
  1969. getter = getterOrOptions.get;
  1970. setter = getterOrOptions.set;
  1971. }
  1972. const cRef = new ComputedRefImpl(getter, setter, isSSR);
  1973. if (debugOptions && !isSSR) {
  1974. cRef.onTrack = debugOptions.onTrack;
  1975. cRef.onTrigger = debugOptions.onTrigger;
  1976. }
  1977. return cRef;
  1978. }
  1979. const TrackOpTypes = {
  1980. "GET": "get",
  1981. "HAS": "has",
  1982. "ITERATE": "iterate"
  1983. };
  1984. const TriggerOpTypes = {
  1985. "SET": "set",
  1986. "ADD": "add",
  1987. "DELETE": "delete",
  1988. "CLEAR": "clear"
  1989. };
  1990. const INITIAL_WATCHER_VALUE = {};
  1991. const cleanupMap = /* @__PURE__ */ new WeakMap();
  1992. let activeWatcher = void 0;
  1993. function getCurrentWatcher() {
  1994. return activeWatcher;
  1995. }
  1996. function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
  1997. if (owner) {
  1998. let cleanups = cleanupMap.get(owner);
  1999. if (!cleanups) cleanupMap.set(owner, cleanups = []);
  2000. cleanups.push(cleanupFn);
  2001. } else if (!failSilently) {
  2002. warn$2(
  2003. `onWatcherCleanup() was called when there was no active watcher to associate with.`
  2004. );
  2005. }
  2006. }
  2007. function watch$1(source, cb, options = EMPTY_OBJ) {
  2008. const { immediate, deep, once, scheduler, augmentJob, call } = options;
  2009. const warnInvalidSource = (s) => {
  2010. (options.onWarn || warn$2)(
  2011. `Invalid watch source: `,
  2012. s,
  2013. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  2014. );
  2015. };
  2016. const reactiveGetter = (source2) => {
  2017. if (deep) return source2;
  2018. if (isShallow(source2) || deep === false || deep === 0)
  2019. return traverse(source2, 1);
  2020. return traverse(source2);
  2021. };
  2022. let effect;
  2023. let getter;
  2024. let cleanup;
  2025. let boundCleanup;
  2026. let forceTrigger = false;
  2027. let isMultiSource = false;
  2028. if (isRef(source)) {
  2029. getter = () => source.value;
  2030. forceTrigger = isShallow(source);
  2031. } else if (isReactive(source)) {
  2032. getter = () => reactiveGetter(source);
  2033. forceTrigger = true;
  2034. } else if (isArray(source)) {
  2035. isMultiSource = true;
  2036. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  2037. getter = () => source.map((s) => {
  2038. if (isRef(s)) {
  2039. return s.value;
  2040. } else if (isReactive(s)) {
  2041. return reactiveGetter(s);
  2042. } else if (isFunction(s)) {
  2043. return call ? call(s, 2) : s();
  2044. } else {
  2045. warnInvalidSource(s);
  2046. }
  2047. });
  2048. } else if (isFunction(source)) {
  2049. if (cb) {
  2050. getter = call ? () => call(source, 2) : source;
  2051. } else {
  2052. getter = () => {
  2053. if (cleanup) {
  2054. pauseTracking();
  2055. try {
  2056. cleanup();
  2057. } finally {
  2058. resetTracking();
  2059. }
  2060. }
  2061. const currentEffect = activeWatcher;
  2062. activeWatcher = effect;
  2063. try {
  2064. return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
  2065. } finally {
  2066. activeWatcher = currentEffect;
  2067. }
  2068. };
  2069. }
  2070. } else {
  2071. getter = NOOP;
  2072. warnInvalidSource(source);
  2073. }
  2074. if (cb && deep) {
  2075. const baseGetter = getter;
  2076. const depth = deep === true ? Infinity : deep;
  2077. getter = () => traverse(baseGetter(), depth);
  2078. }
  2079. const scope = getCurrentScope();
  2080. const watchHandle = () => {
  2081. effect.stop();
  2082. if (scope) {
  2083. remove(scope.effects, effect);
  2084. }
  2085. };
  2086. if (once && cb) {
  2087. const _cb = cb;
  2088. cb = (...args) => {
  2089. _cb(...args);
  2090. watchHandle();
  2091. };
  2092. }
  2093. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2094. const job = (immediateFirstRun) => {
  2095. if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
  2096. return;
  2097. }
  2098. if (cb) {
  2099. const newValue = effect.run();
  2100. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
  2101. if (cleanup) {
  2102. cleanup();
  2103. }
  2104. const currentWatcher = activeWatcher;
  2105. activeWatcher = effect;
  2106. try {
  2107. const args = [
  2108. newValue,
  2109. // pass undefined as the old value when it's changed for the first time
  2110. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  2111. boundCleanup
  2112. ];
  2113. call ? call(cb, 3, args) : (
  2114. // @ts-expect-error
  2115. cb(...args)
  2116. );
  2117. oldValue = newValue;
  2118. } finally {
  2119. activeWatcher = currentWatcher;
  2120. }
  2121. }
  2122. } else {
  2123. effect.run();
  2124. }
  2125. };
  2126. if (augmentJob) {
  2127. augmentJob(job);
  2128. }
  2129. effect = new ReactiveEffect(getter);
  2130. effect.scheduler = scheduler ? () => scheduler(job, false) : job;
  2131. boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
  2132. cleanup = effect.onStop = () => {
  2133. const cleanups = cleanupMap.get(effect);
  2134. if (cleanups) {
  2135. if (call) {
  2136. call(cleanups, 4);
  2137. } else {
  2138. for (const cleanup2 of cleanups) cleanup2();
  2139. }
  2140. cleanupMap.delete(effect);
  2141. }
  2142. };
  2143. {
  2144. effect.onTrack = options.onTrack;
  2145. effect.onTrigger = options.onTrigger;
  2146. }
  2147. if (cb) {
  2148. if (immediate) {
  2149. job(true);
  2150. } else {
  2151. oldValue = effect.run();
  2152. }
  2153. } else if (scheduler) {
  2154. scheduler(job.bind(null, true), true);
  2155. } else {
  2156. effect.run();
  2157. }
  2158. watchHandle.pause = effect.pause.bind(effect);
  2159. watchHandle.resume = effect.resume.bind(effect);
  2160. watchHandle.stop = watchHandle;
  2161. return watchHandle;
  2162. }
  2163. function traverse(value, depth = Infinity, seen) {
  2164. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  2165. return value;
  2166. }
  2167. seen = seen || /* @__PURE__ */ new Set();
  2168. if (seen.has(value)) {
  2169. return value;
  2170. }
  2171. seen.add(value);
  2172. depth--;
  2173. if (isRef(value)) {
  2174. traverse(value.value, depth, seen);
  2175. } else if (isArray(value)) {
  2176. for (let i = 0; i < value.length; i++) {
  2177. traverse(value[i], depth, seen);
  2178. }
  2179. } else if (isSet(value) || isMap(value)) {
  2180. value.forEach((v) => {
  2181. traverse(v, depth, seen);
  2182. });
  2183. } else if (isPlainObject(value)) {
  2184. for (const key in value) {
  2185. traverse(value[key], depth, seen);
  2186. }
  2187. for (const key of Object.getOwnPropertySymbols(value)) {
  2188. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  2189. traverse(value[key], depth, seen);
  2190. }
  2191. }
  2192. }
  2193. return value;
  2194. }
  2195. const stack$1 = [];
  2196. function pushWarningContext(vnode) {
  2197. stack$1.push(vnode);
  2198. }
  2199. function popWarningContext() {
  2200. stack$1.pop();
  2201. }
  2202. let isWarning = false;
  2203. function warn$1(msg, ...args) {
  2204. if (isWarning) return;
  2205. isWarning = true;
  2206. pauseTracking();
  2207. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  2208. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  2209. const trace = getComponentTrace();
  2210. if (appWarnHandler) {
  2211. callWithErrorHandling(
  2212. appWarnHandler,
  2213. instance,
  2214. 11,
  2215. [
  2216. // eslint-disable-next-line no-restricted-syntax
  2217. msg + args.map((a) => {
  2218. var _a, _b;
  2219. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  2220. }).join(""),
  2221. instance && instance.proxy,
  2222. trace.map(
  2223. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  2224. ).join("\n"),
  2225. trace
  2226. ]
  2227. );
  2228. } else {
  2229. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  2230. if (trace.length && // avoid spamming console during tests
  2231. true) {
  2232. warnArgs.push(`
  2233. `, ...formatTrace(trace));
  2234. }
  2235. console.warn(...warnArgs);
  2236. }
  2237. resetTracking();
  2238. isWarning = false;
  2239. }
  2240. function getComponentTrace() {
  2241. let currentVNode = stack$1[stack$1.length - 1];
  2242. if (!currentVNode) {
  2243. return [];
  2244. }
  2245. const normalizedStack = [];
  2246. while (currentVNode) {
  2247. const last = normalizedStack[0];
  2248. if (last && last.vnode === currentVNode) {
  2249. last.recurseCount++;
  2250. } else {
  2251. normalizedStack.push({
  2252. vnode: currentVNode,
  2253. recurseCount: 0
  2254. });
  2255. }
  2256. const parentInstance = currentVNode.component && currentVNode.component.parent;
  2257. currentVNode = parentInstance && parentInstance.vnode;
  2258. }
  2259. return normalizedStack;
  2260. }
  2261. function formatTrace(trace) {
  2262. const logs = [];
  2263. trace.forEach((entry, i) => {
  2264. logs.push(...i === 0 ? [] : [`
  2265. `], ...formatTraceEntry(entry));
  2266. });
  2267. return logs;
  2268. }
  2269. function formatTraceEntry({ vnode, recurseCount }) {
  2270. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  2271. const isRoot = vnode.component ? vnode.component.parent == null : false;
  2272. const open = ` at <${formatComponentName(
  2273. vnode.component,
  2274. vnode.type,
  2275. isRoot
  2276. )}`;
  2277. const close = `>` + postfix;
  2278. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  2279. }
  2280. function formatProps(props) {
  2281. const res = [];
  2282. const keys = Object.keys(props);
  2283. keys.slice(0, 3).forEach((key) => {
  2284. res.push(...formatProp(key, props[key]));
  2285. });
  2286. if (keys.length > 3) {
  2287. res.push(` ...`);
  2288. }
  2289. return res;
  2290. }
  2291. function formatProp(key, value, raw) {
  2292. if (isString(value)) {
  2293. value = JSON.stringify(value);
  2294. return raw ? value : [`${key}=${value}`];
  2295. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  2296. return raw ? value : [`${key}=${value}`];
  2297. } else if (isRef(value)) {
  2298. value = formatProp(key, toRaw(value.value), true);
  2299. return raw ? value : [`${key}=Ref<`, value, `>`];
  2300. } else if (isFunction(value)) {
  2301. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  2302. } else {
  2303. value = toRaw(value);
  2304. return raw ? value : [`${key}=`, value];
  2305. }
  2306. }
  2307. function assertNumber(val, type) {
  2308. if (val === void 0) {
  2309. return;
  2310. } else if (typeof val !== "number") {
  2311. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  2312. } else if (isNaN(val)) {
  2313. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  2314. }
  2315. }
  2316. const ErrorCodes = {
  2317. "SETUP_FUNCTION": 0,
  2318. "0": "SETUP_FUNCTION",
  2319. "RENDER_FUNCTION": 1,
  2320. "1": "RENDER_FUNCTION",
  2321. "NATIVE_EVENT_HANDLER": 5,
  2322. "5": "NATIVE_EVENT_HANDLER",
  2323. "COMPONENT_EVENT_HANDLER": 6,
  2324. "6": "COMPONENT_EVENT_HANDLER",
  2325. "VNODE_HOOK": 7,
  2326. "7": "VNODE_HOOK",
  2327. "DIRECTIVE_HOOK": 8,
  2328. "8": "DIRECTIVE_HOOK",
  2329. "TRANSITION_HOOK": 9,
  2330. "9": "TRANSITION_HOOK",
  2331. "APP_ERROR_HANDLER": 10,
  2332. "10": "APP_ERROR_HANDLER",
  2333. "APP_WARN_HANDLER": 11,
  2334. "11": "APP_WARN_HANDLER",
  2335. "FUNCTION_REF": 12,
  2336. "12": "FUNCTION_REF",
  2337. "ASYNC_COMPONENT_LOADER": 13,
  2338. "13": "ASYNC_COMPONENT_LOADER",
  2339. "SCHEDULER": 14,
  2340. "14": "SCHEDULER",
  2341. "COMPONENT_UPDATE": 15,
  2342. "15": "COMPONENT_UPDATE",
  2343. "APP_UNMOUNT_CLEANUP": 16,
  2344. "16": "APP_UNMOUNT_CLEANUP"
  2345. };
  2346. const ErrorTypeStrings$1 = {
  2347. ["sp"]: "serverPrefetch hook",
  2348. ["bc"]: "beforeCreate hook",
  2349. ["c"]: "created hook",
  2350. ["bm"]: "beforeMount hook",
  2351. ["m"]: "mounted hook",
  2352. ["bu"]: "beforeUpdate hook",
  2353. ["u"]: "updated",
  2354. ["bum"]: "beforeUnmount hook",
  2355. ["um"]: "unmounted hook",
  2356. ["a"]: "activated hook",
  2357. ["da"]: "deactivated hook",
  2358. ["ec"]: "errorCaptured hook",
  2359. ["rtc"]: "renderTracked hook",
  2360. ["rtg"]: "renderTriggered hook",
  2361. [0]: "setup function",
  2362. [1]: "render function",
  2363. [2]: "watcher getter",
  2364. [3]: "watcher callback",
  2365. [4]: "watcher cleanup function",
  2366. [5]: "native event handler",
  2367. [6]: "component event handler",
  2368. [7]: "vnode hook",
  2369. [8]: "directive hook",
  2370. [9]: "transition hook",
  2371. [10]: "app errorHandler",
  2372. [11]: "app warnHandler",
  2373. [12]: "ref function",
  2374. [13]: "async component loader",
  2375. [14]: "scheduler flush",
  2376. [15]: "component update",
  2377. [16]: "app unmount cleanup function"
  2378. };
  2379. function callWithErrorHandling(fn, instance, type, args) {
  2380. try {
  2381. return args ? fn(...args) : fn();
  2382. } catch (err) {
  2383. handleError(err, instance, type);
  2384. }
  2385. }
  2386. function callWithAsyncErrorHandling(fn, instance, type, args) {
  2387. if (isFunction(fn)) {
  2388. const res = callWithErrorHandling(fn, instance, type, args);
  2389. if (res && isPromise(res)) {
  2390. res.catch((err) => {
  2391. handleError(err, instance, type);
  2392. });
  2393. }
  2394. return res;
  2395. }
  2396. if (isArray(fn)) {
  2397. const values = [];
  2398. for (let i = 0; i < fn.length; i++) {
  2399. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  2400. }
  2401. return values;
  2402. } else {
  2403. warn$1(
  2404. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  2405. );
  2406. }
  2407. }
  2408. function handleError(err, instance, type, throwInDev = true) {
  2409. const contextVNode = instance ? instance.vnode : null;
  2410. const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
  2411. if (instance) {
  2412. let cur = instance.parent;
  2413. const exposedInstance = instance.proxy;
  2414. const errorInfo = ErrorTypeStrings$1[type] ;
  2415. while (cur) {
  2416. const errorCapturedHooks = cur.ec;
  2417. if (errorCapturedHooks) {
  2418. for (let i = 0; i < errorCapturedHooks.length; i++) {
  2419. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  2420. return;
  2421. }
  2422. }
  2423. }
  2424. cur = cur.parent;
  2425. }
  2426. if (errorHandler) {
  2427. pauseTracking();
  2428. callWithErrorHandling(errorHandler, null, 10, [
  2429. err,
  2430. exposedInstance,
  2431. errorInfo
  2432. ]);
  2433. resetTracking();
  2434. return;
  2435. }
  2436. }
  2437. logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
  2438. }
  2439. function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
  2440. {
  2441. const info = ErrorTypeStrings$1[type];
  2442. if (contextVNode) {
  2443. pushWarningContext(contextVNode);
  2444. }
  2445. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  2446. if (contextVNode) {
  2447. popWarningContext();
  2448. }
  2449. if (throwInDev) {
  2450. throw err;
  2451. } else {
  2452. console.error(err);
  2453. }
  2454. }
  2455. }
  2456. const queue = [];
  2457. let flushIndex = -1;
  2458. const pendingPostFlushCbs = [];
  2459. let activePostFlushCbs = null;
  2460. let postFlushIndex = 0;
  2461. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  2462. let currentFlushPromise = null;
  2463. const RECURSION_LIMIT = 100;
  2464. function nextTick(fn) {
  2465. const p = currentFlushPromise || resolvedPromise;
  2466. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  2467. }
  2468. function findInsertionIndex(id) {
  2469. let start = flushIndex + 1;
  2470. let end = queue.length;
  2471. while (start < end) {
  2472. const middle = start + end >>> 1;
  2473. const middleJob = queue[middle];
  2474. const middleJobId = getId(middleJob);
  2475. if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
  2476. start = middle + 1;
  2477. } else {
  2478. end = middle;
  2479. }
  2480. }
  2481. return start;
  2482. }
  2483. function queueJob(job) {
  2484. if (!(job.flags & 1)) {
  2485. const jobId = getId(job);
  2486. const lastJob = queue[queue.length - 1];
  2487. if (!lastJob || // fast path when the job id is larger than the tail
  2488. !(job.flags & 2) && jobId >= getId(lastJob)) {
  2489. queue.push(job);
  2490. } else {
  2491. queue.splice(findInsertionIndex(jobId), 0, job);
  2492. }
  2493. job.flags |= 1;
  2494. queueFlush();
  2495. }
  2496. }
  2497. function queueFlush() {
  2498. if (!currentFlushPromise) {
  2499. currentFlushPromise = resolvedPromise.then(flushJobs);
  2500. }
  2501. }
  2502. function queuePostFlushCb(cb) {
  2503. if (!isArray(cb)) {
  2504. if (activePostFlushCbs && cb.id === -1) {
  2505. activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
  2506. } else if (!(cb.flags & 1)) {
  2507. pendingPostFlushCbs.push(cb);
  2508. cb.flags |= 1;
  2509. }
  2510. } else {
  2511. pendingPostFlushCbs.push(...cb);
  2512. }
  2513. queueFlush();
  2514. }
  2515. function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
  2516. {
  2517. seen = seen || /* @__PURE__ */ new Map();
  2518. }
  2519. for (; i < queue.length; i++) {
  2520. const cb = queue[i];
  2521. if (cb && cb.flags & 2) {
  2522. if (instance && cb.id !== instance.uid) {
  2523. continue;
  2524. }
  2525. if (checkRecursiveUpdates(seen, cb)) {
  2526. continue;
  2527. }
  2528. queue.splice(i, 1);
  2529. i--;
  2530. if (cb.flags & 4) {
  2531. cb.flags &= ~1;
  2532. }
  2533. cb();
  2534. if (!(cb.flags & 4)) {
  2535. cb.flags &= ~1;
  2536. }
  2537. }
  2538. }
  2539. }
  2540. function flushPostFlushCbs(seen) {
  2541. if (pendingPostFlushCbs.length) {
  2542. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  2543. (a, b) => getId(a) - getId(b)
  2544. );
  2545. pendingPostFlushCbs.length = 0;
  2546. if (activePostFlushCbs) {
  2547. activePostFlushCbs.push(...deduped);
  2548. return;
  2549. }
  2550. activePostFlushCbs = deduped;
  2551. {
  2552. seen = seen || /* @__PURE__ */ new Map();
  2553. }
  2554. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  2555. const cb = activePostFlushCbs[postFlushIndex];
  2556. if (checkRecursiveUpdates(seen, cb)) {
  2557. continue;
  2558. }
  2559. if (cb.flags & 4) {
  2560. cb.flags &= ~1;
  2561. }
  2562. if (!(cb.flags & 8)) cb();
  2563. cb.flags &= ~1;
  2564. }
  2565. activePostFlushCbs = null;
  2566. postFlushIndex = 0;
  2567. }
  2568. }
  2569. const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
  2570. function flushJobs(seen) {
  2571. {
  2572. seen = seen || /* @__PURE__ */ new Map();
  2573. }
  2574. const check = (job) => checkRecursiveUpdates(seen, job) ;
  2575. try {
  2576. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  2577. const job = queue[flushIndex];
  2578. if (job && !(job.flags & 8)) {
  2579. if (check(job)) {
  2580. continue;
  2581. }
  2582. if (job.flags & 4) {
  2583. job.flags &= ~1;
  2584. }
  2585. callWithErrorHandling(
  2586. job,
  2587. job.i,
  2588. job.i ? 15 : 14
  2589. );
  2590. if (!(job.flags & 4)) {
  2591. job.flags &= ~1;
  2592. }
  2593. }
  2594. }
  2595. } finally {
  2596. for (; flushIndex < queue.length; flushIndex++) {
  2597. const job = queue[flushIndex];
  2598. if (job) {
  2599. job.flags &= ~1;
  2600. }
  2601. }
  2602. flushIndex = -1;
  2603. queue.length = 0;
  2604. flushPostFlushCbs(seen);
  2605. currentFlushPromise = null;
  2606. if (queue.length || pendingPostFlushCbs.length) {
  2607. flushJobs(seen);
  2608. }
  2609. }
  2610. }
  2611. function checkRecursiveUpdates(seen, fn) {
  2612. const count = seen.get(fn) || 0;
  2613. if (count > RECURSION_LIMIT) {
  2614. const instance = fn.i;
  2615. const componentName = instance && getComponentName(instance.type);
  2616. handleError(
  2617. `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.`,
  2618. null,
  2619. 10
  2620. );
  2621. return true;
  2622. }
  2623. seen.set(fn, count + 1);
  2624. return false;
  2625. }
  2626. let isHmrUpdating = false;
  2627. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2628. {
  2629. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2630. createRecord: tryWrap(createRecord),
  2631. rerender: tryWrap(rerender),
  2632. reload: tryWrap(reload)
  2633. };
  2634. }
  2635. const map = /* @__PURE__ */ new Map();
  2636. function registerHMR(instance) {
  2637. const id = instance.type.__hmrId;
  2638. let record = map.get(id);
  2639. if (!record) {
  2640. createRecord(id, instance.type);
  2641. record = map.get(id);
  2642. }
  2643. record.instances.add(instance);
  2644. }
  2645. function unregisterHMR(instance) {
  2646. map.get(instance.type.__hmrId).instances.delete(instance);
  2647. }
  2648. function createRecord(id, initialDef) {
  2649. if (map.has(id)) {
  2650. return false;
  2651. }
  2652. map.set(id, {
  2653. initialDef: normalizeClassComponent(initialDef),
  2654. instances: /* @__PURE__ */ new Set()
  2655. });
  2656. return true;
  2657. }
  2658. function normalizeClassComponent(component) {
  2659. return isClassComponent(component) ? component.__vccOpts : component;
  2660. }
  2661. function rerender(id, newRender) {
  2662. const record = map.get(id);
  2663. if (!record) {
  2664. return;
  2665. }
  2666. record.initialDef.render = newRender;
  2667. [...record.instances].forEach((instance) => {
  2668. if (newRender) {
  2669. instance.render = newRender;
  2670. normalizeClassComponent(instance.type).render = newRender;
  2671. }
  2672. instance.renderCache = [];
  2673. isHmrUpdating = true;
  2674. instance.update();
  2675. isHmrUpdating = false;
  2676. });
  2677. }
  2678. function reload(id, newComp) {
  2679. const record = map.get(id);
  2680. if (!record) return;
  2681. newComp = normalizeClassComponent(newComp);
  2682. updateComponentDef(record.initialDef, newComp);
  2683. const instances = [...record.instances];
  2684. for (let i = 0; i < instances.length; i++) {
  2685. const instance = instances[i];
  2686. const oldComp = normalizeClassComponent(instance.type);
  2687. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2688. if (!dirtyInstances) {
  2689. if (oldComp !== record.initialDef) {
  2690. updateComponentDef(oldComp, newComp);
  2691. }
  2692. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2693. }
  2694. dirtyInstances.add(instance);
  2695. instance.appContext.propsCache.delete(instance.type);
  2696. instance.appContext.emitsCache.delete(instance.type);
  2697. instance.appContext.optionsCache.delete(instance.type);
  2698. if (instance.ceReload) {
  2699. dirtyInstances.add(instance);
  2700. instance.ceReload(newComp.styles);
  2701. dirtyInstances.delete(instance);
  2702. } else if (instance.parent) {
  2703. queueJob(() => {
  2704. isHmrUpdating = true;
  2705. instance.parent.update();
  2706. isHmrUpdating = false;
  2707. dirtyInstances.delete(instance);
  2708. });
  2709. } else if (instance.appContext.reload) {
  2710. instance.appContext.reload();
  2711. } else if (typeof window !== "undefined") {
  2712. window.location.reload();
  2713. } else {
  2714. console.warn(
  2715. "[HMR] Root or manually mounted instance modified. Full reload required."
  2716. );
  2717. }
  2718. if (instance.root.ce && instance !== instance.root) {
  2719. instance.root.ce._removeChildStyle(oldComp);
  2720. }
  2721. }
  2722. queuePostFlushCb(() => {
  2723. hmrDirtyComponents.clear();
  2724. });
  2725. }
  2726. function updateComponentDef(oldComp, newComp) {
  2727. extend(oldComp, newComp);
  2728. for (const key in oldComp) {
  2729. if (key !== "__file" && !(key in newComp)) {
  2730. delete oldComp[key];
  2731. }
  2732. }
  2733. }
  2734. function tryWrap(fn) {
  2735. return (id, arg) => {
  2736. try {
  2737. return fn(id, arg);
  2738. } catch (e) {
  2739. console.error(e);
  2740. console.warn(
  2741. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2742. );
  2743. }
  2744. };
  2745. }
  2746. let devtools$1;
  2747. let buffer = [];
  2748. let devtoolsNotInstalled = false;
  2749. function emit$1(event, ...args) {
  2750. if (devtools$1) {
  2751. devtools$1.emit(event, ...args);
  2752. } else if (!devtoolsNotInstalled) {
  2753. buffer.push({ event, args });
  2754. }
  2755. }
  2756. function setDevtoolsHook$1(hook, target) {
  2757. var _a, _b;
  2758. devtools$1 = hook;
  2759. if (devtools$1) {
  2760. devtools$1.enabled = true;
  2761. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2762. buffer = [];
  2763. } else if (
  2764. // handle late devtools injection - only do this if we are in an actual
  2765. // browser environment to avoid the timer handle stalling test runner exit
  2766. // (#4815)
  2767. typeof window !== "undefined" && // some envs mock window but not fully
  2768. window.HTMLElement && // also exclude jsdom
  2769. // eslint-disable-next-line no-restricted-syntax
  2770. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2771. ) {
  2772. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2773. replay.push((newHook) => {
  2774. setDevtoolsHook$1(newHook, target);
  2775. });
  2776. setTimeout(() => {
  2777. if (!devtools$1) {
  2778. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2779. devtoolsNotInstalled = true;
  2780. buffer = [];
  2781. }
  2782. }, 3e3);
  2783. } else {
  2784. devtoolsNotInstalled = true;
  2785. buffer = [];
  2786. }
  2787. }
  2788. function devtoolsInitApp(app, version) {
  2789. emit$1("app:init" /* APP_INIT */, app, version, {
  2790. Fragment,
  2791. Text,
  2792. Comment,
  2793. Static
  2794. });
  2795. }
  2796. function devtoolsUnmountApp(app) {
  2797. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2798. }
  2799. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
  2800. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2801. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2802. "component:removed" /* COMPONENT_REMOVED */
  2803. );
  2804. const devtoolsComponentRemoved = (component) => {
  2805. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2806. !devtools$1.cleanupBuffer(component)) {
  2807. _devtoolsComponentRemoved(component);
  2808. }
  2809. };
  2810. /*! #__NO_SIDE_EFFECTS__ */
  2811. // @__NO_SIDE_EFFECTS__
  2812. function createDevtoolsComponentHook(hook) {
  2813. return (component) => {
  2814. emit$1(
  2815. hook,
  2816. component.appContext.app,
  2817. component.uid,
  2818. component.parent ? component.parent.uid : void 0,
  2819. component
  2820. );
  2821. };
  2822. }
  2823. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
  2824. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
  2825. function createDevtoolsPerformanceHook(hook) {
  2826. return (component, type, time) => {
  2827. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2828. };
  2829. }
  2830. function devtoolsComponentEmit(component, event, params) {
  2831. emit$1(
  2832. "component:emit" /* COMPONENT_EMIT */,
  2833. component.appContext.app,
  2834. component,
  2835. event,
  2836. params
  2837. );
  2838. }
  2839. let currentRenderingInstance = null;
  2840. let currentScopeId = null;
  2841. function setCurrentRenderingInstance(instance) {
  2842. const prev = currentRenderingInstance;
  2843. currentRenderingInstance = instance;
  2844. currentScopeId = instance && instance.type.__scopeId || null;
  2845. return prev;
  2846. }
  2847. function pushScopeId(id) {
  2848. currentScopeId = id;
  2849. }
  2850. function popScopeId() {
  2851. currentScopeId = null;
  2852. }
  2853. const withScopeId = (_id) => withCtx;
  2854. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2855. if (!ctx) return fn;
  2856. if (fn._n) {
  2857. return fn;
  2858. }
  2859. const renderFnWithContext = (...args) => {
  2860. if (renderFnWithContext._d) {
  2861. setBlockTracking(-1);
  2862. }
  2863. const prevInstance = setCurrentRenderingInstance(ctx);
  2864. let res;
  2865. try {
  2866. res = fn(...args);
  2867. } finally {
  2868. setCurrentRenderingInstance(prevInstance);
  2869. if (renderFnWithContext._d) {
  2870. setBlockTracking(1);
  2871. }
  2872. }
  2873. {
  2874. devtoolsComponentUpdated(ctx);
  2875. }
  2876. return res;
  2877. };
  2878. renderFnWithContext._n = true;
  2879. renderFnWithContext._c = true;
  2880. renderFnWithContext._d = true;
  2881. return renderFnWithContext;
  2882. }
  2883. function validateDirectiveName(name) {
  2884. if (isBuiltInDirective(name)) {
  2885. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2886. }
  2887. }
  2888. function withDirectives(vnode, directives) {
  2889. if (currentRenderingInstance === null) {
  2890. warn$1(`withDirectives can only be used inside render functions.`);
  2891. return vnode;
  2892. }
  2893. const instance = getComponentPublicInstance(currentRenderingInstance);
  2894. const bindings = vnode.dirs || (vnode.dirs = []);
  2895. for (let i = 0; i < directives.length; i++) {
  2896. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  2897. if (dir) {
  2898. if (isFunction(dir)) {
  2899. dir = {
  2900. mounted: dir,
  2901. updated: dir
  2902. };
  2903. }
  2904. if (dir.deep) {
  2905. traverse(value);
  2906. }
  2907. bindings.push({
  2908. dir,
  2909. instance,
  2910. value,
  2911. oldValue: void 0,
  2912. arg,
  2913. modifiers
  2914. });
  2915. }
  2916. }
  2917. return vnode;
  2918. }
  2919. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  2920. const bindings = vnode.dirs;
  2921. const oldBindings = prevVNode && prevVNode.dirs;
  2922. for (let i = 0; i < bindings.length; i++) {
  2923. const binding = bindings[i];
  2924. if (oldBindings) {
  2925. binding.oldValue = oldBindings[i].value;
  2926. }
  2927. let hook = binding.dir[name];
  2928. if (hook) {
  2929. pauseTracking();
  2930. callWithAsyncErrorHandling(hook, instance, 8, [
  2931. vnode.el,
  2932. binding,
  2933. vnode,
  2934. prevVNode
  2935. ]);
  2936. resetTracking();
  2937. }
  2938. }
  2939. }
  2940. const TeleportEndKey = Symbol("_vte");
  2941. const isTeleport = (type) => type.__isTeleport;
  2942. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  2943. const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
  2944. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  2945. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  2946. const resolveTarget = (props, select) => {
  2947. const targetSelector = props && props.to;
  2948. if (isString(targetSelector)) {
  2949. if (!select) {
  2950. warn$1(
  2951. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  2952. );
  2953. return null;
  2954. } else {
  2955. const target = select(targetSelector);
  2956. if (!target && !isTeleportDisabled(props)) {
  2957. warn$1(
  2958. `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.`
  2959. );
  2960. }
  2961. return target;
  2962. }
  2963. } else {
  2964. if (!targetSelector && !isTeleportDisabled(props)) {
  2965. warn$1(`Invalid Teleport target: ${targetSelector}`);
  2966. }
  2967. return targetSelector;
  2968. }
  2969. };
  2970. const TeleportImpl = {
  2971. name: "Teleport",
  2972. __isTeleport: true,
  2973. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  2974. const {
  2975. mc: mountChildren,
  2976. pc: patchChildren,
  2977. pbc: patchBlockChildren,
  2978. o: { insert, querySelector, createText, createComment }
  2979. } = internals;
  2980. const disabled = isTeleportDisabled(n2.props);
  2981. let { shapeFlag, children, dynamicChildren } = n2;
  2982. if (isHmrUpdating) {
  2983. optimized = false;
  2984. dynamicChildren = null;
  2985. }
  2986. if (n1 == null) {
  2987. const placeholder = n2.el = createComment("teleport start") ;
  2988. const mainAnchor = n2.anchor = createComment("teleport end") ;
  2989. insert(placeholder, container, anchor);
  2990. insert(mainAnchor, container, anchor);
  2991. const mount = (container2, anchor2) => {
  2992. if (shapeFlag & 16) {
  2993. if (parentComponent && parentComponent.isCE) {
  2994. parentComponent.ce._teleportTarget = container2;
  2995. }
  2996. mountChildren(
  2997. children,
  2998. container2,
  2999. anchor2,
  3000. parentComponent,
  3001. parentSuspense,
  3002. namespace,
  3003. slotScopeIds,
  3004. optimized
  3005. );
  3006. }
  3007. };
  3008. const mountToTarget = () => {
  3009. const target = n2.target = resolveTarget(n2.props, querySelector);
  3010. const targetAnchor = prepareAnchor(target, n2, createText, insert);
  3011. if (target) {
  3012. if (namespace !== "svg" && isTargetSVG(target)) {
  3013. namespace = "svg";
  3014. } else if (namespace !== "mathml" && isTargetMathML(target)) {
  3015. namespace = "mathml";
  3016. }
  3017. if (!disabled) {
  3018. mount(target, targetAnchor);
  3019. updateCssVars(n2, false);
  3020. }
  3021. } else if (!disabled) {
  3022. warn$1(
  3023. "Invalid Teleport target on mount:",
  3024. target,
  3025. `(${typeof target})`
  3026. );
  3027. }
  3028. };
  3029. if (disabled) {
  3030. mount(container, mainAnchor);
  3031. updateCssVars(n2, true);
  3032. }
  3033. if (isTeleportDeferred(n2.props)) {
  3034. queuePostRenderEffect(mountToTarget, parentSuspense);
  3035. } else {
  3036. mountToTarget();
  3037. }
  3038. } else {
  3039. n2.el = n1.el;
  3040. n2.targetStart = n1.targetStart;
  3041. const mainAnchor = n2.anchor = n1.anchor;
  3042. const target = n2.target = n1.target;
  3043. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  3044. const wasDisabled = isTeleportDisabled(n1.props);
  3045. const currentContainer = wasDisabled ? container : target;
  3046. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  3047. if (namespace === "svg" || isTargetSVG(target)) {
  3048. namespace = "svg";
  3049. } else if (namespace === "mathml" || isTargetMathML(target)) {
  3050. namespace = "mathml";
  3051. }
  3052. if (dynamicChildren) {
  3053. patchBlockChildren(
  3054. n1.dynamicChildren,
  3055. dynamicChildren,
  3056. currentContainer,
  3057. parentComponent,
  3058. parentSuspense,
  3059. namespace,
  3060. slotScopeIds
  3061. );
  3062. traverseStaticChildren(n1, n2, true);
  3063. } else if (!optimized) {
  3064. patchChildren(
  3065. n1,
  3066. n2,
  3067. currentContainer,
  3068. currentAnchor,
  3069. parentComponent,
  3070. parentSuspense,
  3071. namespace,
  3072. slotScopeIds,
  3073. false
  3074. );
  3075. }
  3076. if (disabled) {
  3077. if (!wasDisabled) {
  3078. moveTeleport(
  3079. n2,
  3080. container,
  3081. mainAnchor,
  3082. internals,
  3083. 1
  3084. );
  3085. } else {
  3086. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  3087. n2.props.to = n1.props.to;
  3088. }
  3089. }
  3090. } else {
  3091. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  3092. const nextTarget = n2.target = resolveTarget(
  3093. n2.props,
  3094. querySelector
  3095. );
  3096. if (nextTarget) {
  3097. moveTeleport(
  3098. n2,
  3099. nextTarget,
  3100. null,
  3101. internals,
  3102. 0
  3103. );
  3104. } else {
  3105. warn$1(
  3106. "Invalid Teleport target on update:",
  3107. target,
  3108. `(${typeof target})`
  3109. );
  3110. }
  3111. } else if (wasDisabled) {
  3112. moveTeleport(
  3113. n2,
  3114. target,
  3115. targetAnchor,
  3116. internals,
  3117. 1
  3118. );
  3119. }
  3120. }
  3121. updateCssVars(n2, disabled);
  3122. }
  3123. },
  3124. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  3125. const {
  3126. shapeFlag,
  3127. children,
  3128. anchor,
  3129. targetStart,
  3130. targetAnchor,
  3131. target,
  3132. props
  3133. } = vnode;
  3134. if (target) {
  3135. hostRemove(targetStart);
  3136. hostRemove(targetAnchor);
  3137. }
  3138. doRemove && hostRemove(anchor);
  3139. if (shapeFlag & 16) {
  3140. const shouldRemove = doRemove || !isTeleportDisabled(props);
  3141. for (let i = 0; i < children.length; i++) {
  3142. const child = children[i];
  3143. unmount(
  3144. child,
  3145. parentComponent,
  3146. parentSuspense,
  3147. shouldRemove,
  3148. !!child.dynamicChildren
  3149. );
  3150. }
  3151. }
  3152. },
  3153. move: moveTeleport,
  3154. hydrate: hydrateTeleport
  3155. };
  3156. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  3157. if (moveType === 0) {
  3158. insert(vnode.targetAnchor, container, parentAnchor);
  3159. }
  3160. const { el, anchor, shapeFlag, children, props } = vnode;
  3161. const isReorder = moveType === 2;
  3162. if (isReorder) {
  3163. insert(el, container, parentAnchor);
  3164. }
  3165. if (!isReorder || isTeleportDisabled(props)) {
  3166. if (shapeFlag & 16) {
  3167. for (let i = 0; i < children.length; i++) {
  3168. move(
  3169. children[i],
  3170. container,
  3171. parentAnchor,
  3172. 2
  3173. );
  3174. }
  3175. }
  3176. }
  3177. if (isReorder) {
  3178. insert(anchor, container, parentAnchor);
  3179. }
  3180. }
  3181. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  3182. o: { nextSibling, parentNode, querySelector, insert, createText }
  3183. }, hydrateChildren) {
  3184. const target = vnode.target = resolveTarget(
  3185. vnode.props,
  3186. querySelector
  3187. );
  3188. if (target) {
  3189. const disabled = isTeleportDisabled(vnode.props);
  3190. const targetNode = target._lpa || target.firstChild;
  3191. if (vnode.shapeFlag & 16) {
  3192. if (disabled) {
  3193. vnode.anchor = hydrateChildren(
  3194. nextSibling(node),
  3195. vnode,
  3196. parentNode(node),
  3197. parentComponent,
  3198. parentSuspense,
  3199. slotScopeIds,
  3200. optimized
  3201. );
  3202. vnode.targetStart = targetNode;
  3203. vnode.targetAnchor = targetNode && nextSibling(targetNode);
  3204. } else {
  3205. vnode.anchor = nextSibling(node);
  3206. let targetAnchor = targetNode;
  3207. while (targetAnchor) {
  3208. if (targetAnchor && targetAnchor.nodeType === 8) {
  3209. if (targetAnchor.data === "teleport start anchor") {
  3210. vnode.targetStart = targetAnchor;
  3211. } else if (targetAnchor.data === "teleport anchor") {
  3212. vnode.targetAnchor = targetAnchor;
  3213. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  3214. break;
  3215. }
  3216. }
  3217. targetAnchor = nextSibling(targetAnchor);
  3218. }
  3219. if (!vnode.targetAnchor) {
  3220. prepareAnchor(target, vnode, createText, insert);
  3221. }
  3222. hydrateChildren(
  3223. targetNode && nextSibling(targetNode),
  3224. vnode,
  3225. target,
  3226. parentComponent,
  3227. parentSuspense,
  3228. slotScopeIds,
  3229. optimized
  3230. );
  3231. }
  3232. }
  3233. updateCssVars(vnode, disabled);
  3234. }
  3235. return vnode.anchor && nextSibling(vnode.anchor);
  3236. }
  3237. const Teleport = TeleportImpl;
  3238. function updateCssVars(vnode, isDisabled) {
  3239. const ctx = vnode.ctx;
  3240. if (ctx && ctx.ut) {
  3241. let node, anchor;
  3242. if (isDisabled) {
  3243. node = vnode.el;
  3244. anchor = vnode.anchor;
  3245. } else {
  3246. node = vnode.targetStart;
  3247. anchor = vnode.targetAnchor;
  3248. }
  3249. while (node && node !== anchor) {
  3250. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  3251. node = node.nextSibling;
  3252. }
  3253. ctx.ut();
  3254. }
  3255. }
  3256. function prepareAnchor(target, vnode, createText, insert) {
  3257. const targetStart = vnode.targetStart = createText("");
  3258. const targetAnchor = vnode.targetAnchor = createText("");
  3259. targetStart[TeleportEndKey] = targetAnchor;
  3260. if (target) {
  3261. insert(targetStart, target);
  3262. insert(targetAnchor, target);
  3263. }
  3264. return targetAnchor;
  3265. }
  3266. const leaveCbKey = Symbol("_leaveCb");
  3267. const enterCbKey$1 = Symbol("_enterCb");
  3268. function useTransitionState() {
  3269. const state = {
  3270. isMounted: false,
  3271. isLeaving: false,
  3272. isUnmounting: false,
  3273. leavingVNodes: /* @__PURE__ */ new Map()
  3274. };
  3275. onMounted(() => {
  3276. state.isMounted = true;
  3277. });
  3278. onBeforeUnmount(() => {
  3279. state.isUnmounting = true;
  3280. });
  3281. return state;
  3282. }
  3283. const TransitionHookValidator = [Function, Array];
  3284. const BaseTransitionPropsValidators = {
  3285. mode: String,
  3286. appear: Boolean,
  3287. persisted: Boolean,
  3288. // enter
  3289. onBeforeEnter: TransitionHookValidator,
  3290. onEnter: TransitionHookValidator,
  3291. onAfterEnter: TransitionHookValidator,
  3292. onEnterCancelled: TransitionHookValidator,
  3293. // leave
  3294. onBeforeLeave: TransitionHookValidator,
  3295. onLeave: TransitionHookValidator,
  3296. onAfterLeave: TransitionHookValidator,
  3297. onLeaveCancelled: TransitionHookValidator,
  3298. // appear
  3299. onBeforeAppear: TransitionHookValidator,
  3300. onAppear: TransitionHookValidator,
  3301. onAfterAppear: TransitionHookValidator,
  3302. onAppearCancelled: TransitionHookValidator
  3303. };
  3304. const recursiveGetSubtree = (instance) => {
  3305. const subTree = instance.subTree;
  3306. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  3307. };
  3308. const BaseTransitionImpl = {
  3309. name: `BaseTransition`,
  3310. props: BaseTransitionPropsValidators,
  3311. setup(props, { slots }) {
  3312. const instance = getCurrentInstance();
  3313. const state = useTransitionState();
  3314. return () => {
  3315. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3316. if (!children || !children.length) {
  3317. return;
  3318. }
  3319. const child = findNonCommentChild(children);
  3320. const rawProps = toRaw(props);
  3321. const { mode } = rawProps;
  3322. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3323. warn$1(`invalid <transition> mode: ${mode}`);
  3324. }
  3325. if (state.isLeaving) {
  3326. return emptyPlaceholder(child);
  3327. }
  3328. const innerChild = getInnerChild$1(child);
  3329. if (!innerChild) {
  3330. return emptyPlaceholder(child);
  3331. }
  3332. let enterHooks = resolveTransitionHooks(
  3333. innerChild,
  3334. rawProps,
  3335. state,
  3336. instance,
  3337. // #11061, ensure enterHooks is fresh after clone
  3338. (hooks) => enterHooks = hooks
  3339. );
  3340. if (innerChild.type !== Comment) {
  3341. setTransitionHooks(innerChild, enterHooks);
  3342. }
  3343. const oldChild = instance.subTree;
  3344. const oldInnerChild = oldChild && getInnerChild$1(oldChild);
  3345. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
  3346. const leavingHooks = resolveTransitionHooks(
  3347. oldInnerChild,
  3348. rawProps,
  3349. state,
  3350. instance
  3351. );
  3352. setTransitionHooks(oldInnerChild, leavingHooks);
  3353. if (mode === "out-in" && innerChild.type !== Comment) {
  3354. state.isLeaving = true;
  3355. leavingHooks.afterLeave = () => {
  3356. state.isLeaving = false;
  3357. if (!(instance.job.flags & 8)) {
  3358. instance.update();
  3359. }
  3360. delete leavingHooks.afterLeave;
  3361. };
  3362. return emptyPlaceholder(child);
  3363. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3364. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3365. const leavingVNodesCache = getLeavingNodesForType(
  3366. state,
  3367. oldInnerChild
  3368. );
  3369. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3370. el[leaveCbKey] = () => {
  3371. earlyRemove();
  3372. el[leaveCbKey] = void 0;
  3373. delete enterHooks.delayedLeave;
  3374. };
  3375. enterHooks.delayedLeave = delayedLeave;
  3376. };
  3377. }
  3378. }
  3379. return child;
  3380. };
  3381. }
  3382. };
  3383. function findNonCommentChild(children) {
  3384. let child = children[0];
  3385. if (children.length > 1) {
  3386. let hasFound = false;
  3387. for (const c of children) {
  3388. if (c.type !== Comment) {
  3389. if (hasFound) {
  3390. warn$1(
  3391. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3392. );
  3393. break;
  3394. }
  3395. child = c;
  3396. hasFound = true;
  3397. }
  3398. }
  3399. }
  3400. return child;
  3401. }
  3402. const BaseTransition = BaseTransitionImpl;
  3403. function getLeavingNodesForType(state, vnode) {
  3404. const { leavingVNodes } = state;
  3405. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3406. if (!leavingVNodesCache) {
  3407. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3408. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3409. }
  3410. return leavingVNodesCache;
  3411. }
  3412. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  3413. const {
  3414. appear,
  3415. mode,
  3416. persisted = false,
  3417. onBeforeEnter,
  3418. onEnter,
  3419. onAfterEnter,
  3420. onEnterCancelled,
  3421. onBeforeLeave,
  3422. onLeave,
  3423. onAfterLeave,
  3424. onLeaveCancelled,
  3425. onBeforeAppear,
  3426. onAppear,
  3427. onAfterAppear,
  3428. onAppearCancelled
  3429. } = props;
  3430. const key = String(vnode.key);
  3431. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3432. const callHook = (hook, args) => {
  3433. hook && callWithAsyncErrorHandling(
  3434. hook,
  3435. instance,
  3436. 9,
  3437. args
  3438. );
  3439. };
  3440. const callAsyncHook = (hook, args) => {
  3441. const done = args[1];
  3442. callHook(hook, args);
  3443. if (isArray(hook)) {
  3444. if (hook.every((hook2) => hook2.length <= 1)) done();
  3445. } else if (hook.length <= 1) {
  3446. done();
  3447. }
  3448. };
  3449. const hooks = {
  3450. mode,
  3451. persisted,
  3452. beforeEnter(el) {
  3453. let hook = onBeforeEnter;
  3454. if (!state.isMounted) {
  3455. if (appear) {
  3456. hook = onBeforeAppear || onBeforeEnter;
  3457. } else {
  3458. return;
  3459. }
  3460. }
  3461. if (el[leaveCbKey]) {
  3462. el[leaveCbKey](
  3463. true
  3464. /* cancelled */
  3465. );
  3466. }
  3467. const leavingVNode = leavingVNodesCache[key];
  3468. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3469. leavingVNode.el[leaveCbKey]();
  3470. }
  3471. callHook(hook, [el]);
  3472. },
  3473. enter(el) {
  3474. let hook = onEnter;
  3475. let afterHook = onAfterEnter;
  3476. let cancelHook = onEnterCancelled;
  3477. if (!state.isMounted) {
  3478. if (appear) {
  3479. hook = onAppear || onEnter;
  3480. afterHook = onAfterAppear || onAfterEnter;
  3481. cancelHook = onAppearCancelled || onEnterCancelled;
  3482. } else {
  3483. return;
  3484. }
  3485. }
  3486. let called = false;
  3487. const done = el[enterCbKey$1] = (cancelled) => {
  3488. if (called) return;
  3489. called = true;
  3490. if (cancelled) {
  3491. callHook(cancelHook, [el]);
  3492. } else {
  3493. callHook(afterHook, [el]);
  3494. }
  3495. if (hooks.delayedLeave) {
  3496. hooks.delayedLeave();
  3497. }
  3498. el[enterCbKey$1] = void 0;
  3499. };
  3500. if (hook) {
  3501. callAsyncHook(hook, [el, done]);
  3502. } else {
  3503. done();
  3504. }
  3505. },
  3506. leave(el, remove) {
  3507. const key2 = String(vnode.key);
  3508. if (el[enterCbKey$1]) {
  3509. el[enterCbKey$1](
  3510. true
  3511. /* cancelled */
  3512. );
  3513. }
  3514. if (state.isUnmounting) {
  3515. return remove();
  3516. }
  3517. callHook(onBeforeLeave, [el]);
  3518. let called = false;
  3519. const done = el[leaveCbKey] = (cancelled) => {
  3520. if (called) return;
  3521. called = true;
  3522. remove();
  3523. if (cancelled) {
  3524. callHook(onLeaveCancelled, [el]);
  3525. } else {
  3526. callHook(onAfterLeave, [el]);
  3527. }
  3528. el[leaveCbKey] = void 0;
  3529. if (leavingVNodesCache[key2] === vnode) {
  3530. delete leavingVNodesCache[key2];
  3531. }
  3532. };
  3533. leavingVNodesCache[key2] = vnode;
  3534. if (onLeave) {
  3535. callAsyncHook(onLeave, [el, done]);
  3536. } else {
  3537. done();
  3538. }
  3539. },
  3540. clone(vnode2) {
  3541. const hooks2 = resolveTransitionHooks(
  3542. vnode2,
  3543. props,
  3544. state,
  3545. instance,
  3546. postClone
  3547. );
  3548. if (postClone) postClone(hooks2);
  3549. return hooks2;
  3550. }
  3551. };
  3552. return hooks;
  3553. }
  3554. function emptyPlaceholder(vnode) {
  3555. if (isKeepAlive(vnode)) {
  3556. vnode = cloneVNode(vnode);
  3557. vnode.children = null;
  3558. return vnode;
  3559. }
  3560. }
  3561. function getInnerChild$1(vnode) {
  3562. if (!isKeepAlive(vnode)) {
  3563. if (isTeleport(vnode.type) && vnode.children) {
  3564. return findNonCommentChild(vnode.children);
  3565. }
  3566. return vnode;
  3567. }
  3568. if (vnode.component) {
  3569. return vnode.component.subTree;
  3570. }
  3571. const { shapeFlag, children } = vnode;
  3572. if (children) {
  3573. if (shapeFlag & 16) {
  3574. return children[0];
  3575. }
  3576. if (shapeFlag & 32 && isFunction(children.default)) {
  3577. return children.default();
  3578. }
  3579. }
  3580. }
  3581. function setTransitionHooks(vnode, hooks) {
  3582. if (vnode.shapeFlag & 6 && vnode.component) {
  3583. vnode.transition = hooks;
  3584. setTransitionHooks(vnode.component.subTree, hooks);
  3585. } else if (vnode.shapeFlag & 128) {
  3586. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3587. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3588. } else {
  3589. vnode.transition = hooks;
  3590. }
  3591. }
  3592. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3593. let ret = [];
  3594. let keyedFragmentCount = 0;
  3595. for (let i = 0; i < children.length; i++) {
  3596. let child = children[i];
  3597. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3598. if (child.type === Fragment) {
  3599. if (child.patchFlag & 128) keyedFragmentCount++;
  3600. ret = ret.concat(
  3601. getTransitionRawChildren(child.children, keepComment, key)
  3602. );
  3603. } else if (keepComment || child.type !== Comment) {
  3604. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3605. }
  3606. }
  3607. if (keyedFragmentCount > 1) {
  3608. for (let i = 0; i < ret.length; i++) {
  3609. ret[i].patchFlag = -2;
  3610. }
  3611. }
  3612. return ret;
  3613. }
  3614. /*! #__NO_SIDE_EFFECTS__ */
  3615. // @__NO_SIDE_EFFECTS__
  3616. function defineComponent(options, extraOptions) {
  3617. return isFunction(options) ? (
  3618. // #8236: extend call and options.name access are considered side-effects
  3619. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3620. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3621. ) : options;
  3622. }
  3623. function useId() {
  3624. const i = getCurrentInstance();
  3625. if (i) {
  3626. return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
  3627. } else {
  3628. warn$1(
  3629. `useId() is called when there is no active component instance to be associated with.`
  3630. );
  3631. }
  3632. return "";
  3633. }
  3634. function markAsyncBoundary(instance) {
  3635. instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
  3636. }
  3637. const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
  3638. function useTemplateRef(key) {
  3639. const i = getCurrentInstance();
  3640. const r = shallowRef(null);
  3641. if (i) {
  3642. const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
  3643. let desc;
  3644. if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
  3645. warn$1(`useTemplateRef('${key}') already exists.`);
  3646. } else {
  3647. Object.defineProperty(refs, key, {
  3648. enumerable: true,
  3649. get: () => r.value,
  3650. set: (val) => r.value = val
  3651. });
  3652. }
  3653. } else {
  3654. warn$1(
  3655. `useTemplateRef() is called when there is no active component instance to be associated with.`
  3656. );
  3657. }
  3658. const ret = readonly(r) ;
  3659. {
  3660. knownTemplateRefs.add(ret);
  3661. }
  3662. return ret;
  3663. }
  3664. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  3665. if (isArray(rawRef)) {
  3666. rawRef.forEach(
  3667. (r, i) => setRef(
  3668. r,
  3669. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  3670. parentSuspense,
  3671. vnode,
  3672. isUnmount
  3673. )
  3674. );
  3675. return;
  3676. }
  3677. if (isAsyncWrapper(vnode) && !isUnmount) {
  3678. return;
  3679. }
  3680. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  3681. const value = isUnmount ? null : refValue;
  3682. const { i: owner, r: ref } = rawRef;
  3683. if (!owner) {
  3684. warn$1(
  3685. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  3686. );
  3687. return;
  3688. }
  3689. const oldRef = oldRawRef && oldRawRef.r;
  3690. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  3691. const setupState = owner.setupState;
  3692. const rawSetupState = toRaw(setupState);
  3693. const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
  3694. {
  3695. if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
  3696. warn$1(
  3697. `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
  3698. );
  3699. }
  3700. if (knownTemplateRefs.has(rawSetupState[key])) {
  3701. return false;
  3702. }
  3703. }
  3704. return hasOwn(rawSetupState, key);
  3705. };
  3706. if (oldRef != null && oldRef !== ref) {
  3707. if (isString(oldRef)) {
  3708. refs[oldRef] = null;
  3709. if (canSetSetupRef(oldRef)) {
  3710. setupState[oldRef] = null;
  3711. }
  3712. } else if (isRef(oldRef)) {
  3713. oldRef.value = null;
  3714. }
  3715. }
  3716. if (isFunction(ref)) {
  3717. callWithErrorHandling(ref, owner, 12, [value, refs]);
  3718. } else {
  3719. const _isString = isString(ref);
  3720. const _isRef = isRef(ref);
  3721. if (_isString || _isRef) {
  3722. const doSet = () => {
  3723. if (rawRef.f) {
  3724. const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
  3725. if (isUnmount) {
  3726. isArray(existing) && remove(existing, refValue);
  3727. } else {
  3728. if (!isArray(existing)) {
  3729. if (_isString) {
  3730. refs[ref] = [refValue];
  3731. if (canSetSetupRef(ref)) {
  3732. setupState[ref] = refs[ref];
  3733. }
  3734. } else {
  3735. ref.value = [refValue];
  3736. if (rawRef.k) refs[rawRef.k] = ref.value;
  3737. }
  3738. } else if (!existing.includes(refValue)) {
  3739. existing.push(refValue);
  3740. }
  3741. }
  3742. } else if (_isString) {
  3743. refs[ref] = value;
  3744. if (canSetSetupRef(ref)) {
  3745. setupState[ref] = value;
  3746. }
  3747. } else if (_isRef) {
  3748. ref.value = value;
  3749. if (rawRef.k) refs[rawRef.k] = value;
  3750. } else {
  3751. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  3752. }
  3753. };
  3754. if (value) {
  3755. doSet.id = -1;
  3756. queuePostRenderEffect(doSet, parentSuspense);
  3757. } else {
  3758. doSet();
  3759. }
  3760. } else {
  3761. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  3762. }
  3763. }
  3764. }
  3765. let hasLoggedMismatchError = false;
  3766. const logMismatchError = () => {
  3767. if (hasLoggedMismatchError) {
  3768. return;
  3769. }
  3770. console.error("Hydration completed but contains mismatches.");
  3771. hasLoggedMismatchError = true;
  3772. };
  3773. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  3774. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  3775. const getContainerType = (container) => {
  3776. if (container.nodeType !== 1) return void 0;
  3777. if (isSVGContainer(container)) return "svg";
  3778. if (isMathMLContainer(container)) return "mathml";
  3779. return void 0;
  3780. };
  3781. const isComment = (node) => node.nodeType === 8;
  3782. function createHydrationFunctions(rendererInternals) {
  3783. const {
  3784. mt: mountComponent,
  3785. p: patch,
  3786. o: {
  3787. patchProp,
  3788. createText,
  3789. nextSibling,
  3790. parentNode,
  3791. remove,
  3792. insert,
  3793. createComment
  3794. }
  3795. } = rendererInternals;
  3796. const hydrate = (vnode, container) => {
  3797. if (!container.hasChildNodes()) {
  3798. warn$1(
  3799. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  3800. );
  3801. patch(null, vnode, container);
  3802. flushPostFlushCbs();
  3803. container._vnode = vnode;
  3804. return;
  3805. }
  3806. hydrateNode(container.firstChild, vnode, null, null, null);
  3807. flushPostFlushCbs();
  3808. container._vnode = vnode;
  3809. };
  3810. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  3811. optimized = optimized || !!vnode.dynamicChildren;
  3812. const isFragmentStart = isComment(node) && node.data === "[";
  3813. const onMismatch = () => handleMismatch(
  3814. node,
  3815. vnode,
  3816. parentComponent,
  3817. parentSuspense,
  3818. slotScopeIds,
  3819. isFragmentStart
  3820. );
  3821. const { type, ref, shapeFlag, patchFlag } = vnode;
  3822. let domType = node.nodeType;
  3823. vnode.el = node;
  3824. {
  3825. def(node, "__vnode", vnode, true);
  3826. def(node, "__vueParentComponent", parentComponent, true);
  3827. }
  3828. if (patchFlag === -2) {
  3829. optimized = false;
  3830. vnode.dynamicChildren = null;
  3831. }
  3832. let nextNode = null;
  3833. switch (type) {
  3834. case Text:
  3835. if (domType !== 3) {
  3836. if (vnode.children === "") {
  3837. insert(vnode.el = createText(""), parentNode(node), node);
  3838. nextNode = node;
  3839. } else {
  3840. nextNode = onMismatch();
  3841. }
  3842. } else {
  3843. if (node.data !== vnode.children) {
  3844. warn$1(
  3845. `Hydration text mismatch in`,
  3846. node.parentNode,
  3847. `
  3848. - rendered on server: ${JSON.stringify(
  3849. node.data
  3850. )}
  3851. - expected on client: ${JSON.stringify(vnode.children)}`
  3852. );
  3853. logMismatchError();
  3854. node.data = vnode.children;
  3855. }
  3856. nextNode = nextSibling(node);
  3857. }
  3858. break;
  3859. case Comment:
  3860. if (isTemplateNode(node)) {
  3861. nextNode = nextSibling(node);
  3862. replaceNode(
  3863. vnode.el = node.content.firstChild,
  3864. node,
  3865. parentComponent
  3866. );
  3867. } else if (domType !== 8 || isFragmentStart) {
  3868. nextNode = onMismatch();
  3869. } else {
  3870. nextNode = nextSibling(node);
  3871. }
  3872. break;
  3873. case Static:
  3874. if (isFragmentStart) {
  3875. node = nextSibling(node);
  3876. domType = node.nodeType;
  3877. }
  3878. if (domType === 1 || domType === 3) {
  3879. nextNode = node;
  3880. const needToAdoptContent = !vnode.children.length;
  3881. for (let i = 0; i < vnode.staticCount; i++) {
  3882. if (needToAdoptContent)
  3883. vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
  3884. if (i === vnode.staticCount - 1) {
  3885. vnode.anchor = nextNode;
  3886. }
  3887. nextNode = nextSibling(nextNode);
  3888. }
  3889. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  3890. } else {
  3891. onMismatch();
  3892. }
  3893. break;
  3894. case Fragment:
  3895. if (!isFragmentStart) {
  3896. nextNode = onMismatch();
  3897. } else {
  3898. nextNode = hydrateFragment(
  3899. node,
  3900. vnode,
  3901. parentComponent,
  3902. parentSuspense,
  3903. slotScopeIds,
  3904. optimized
  3905. );
  3906. }
  3907. break;
  3908. default:
  3909. if (shapeFlag & 1) {
  3910. if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  3911. nextNode = onMismatch();
  3912. } else {
  3913. nextNode = hydrateElement(
  3914. node,
  3915. vnode,
  3916. parentComponent,
  3917. parentSuspense,
  3918. slotScopeIds,
  3919. optimized
  3920. );
  3921. }
  3922. } else if (shapeFlag & 6) {
  3923. vnode.slotScopeIds = slotScopeIds;
  3924. const container = parentNode(node);
  3925. if (isFragmentStart) {
  3926. nextNode = locateClosingAnchor(node);
  3927. } else if (isComment(node) && node.data === "teleport start") {
  3928. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  3929. } else {
  3930. nextNode = nextSibling(node);
  3931. }
  3932. mountComponent(
  3933. vnode,
  3934. container,
  3935. null,
  3936. parentComponent,
  3937. parentSuspense,
  3938. getContainerType(container),
  3939. optimized
  3940. );
  3941. if (isAsyncWrapper(vnode)) {
  3942. let subTree;
  3943. if (isFragmentStart) {
  3944. subTree = createVNode(Fragment);
  3945. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  3946. } else {
  3947. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  3948. }
  3949. subTree.el = node;
  3950. vnode.component.subTree = subTree;
  3951. }
  3952. } else if (shapeFlag & 64) {
  3953. if (domType !== 8) {
  3954. nextNode = onMismatch();
  3955. } else {
  3956. nextNode = vnode.type.hydrate(
  3957. node,
  3958. vnode,
  3959. parentComponent,
  3960. parentSuspense,
  3961. slotScopeIds,
  3962. optimized,
  3963. rendererInternals,
  3964. hydrateChildren
  3965. );
  3966. }
  3967. } else if (shapeFlag & 128) {
  3968. nextNode = vnode.type.hydrate(
  3969. node,
  3970. vnode,
  3971. parentComponent,
  3972. parentSuspense,
  3973. getContainerType(parentNode(node)),
  3974. slotScopeIds,
  3975. optimized,
  3976. rendererInternals,
  3977. hydrateNode
  3978. );
  3979. } else {
  3980. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  3981. }
  3982. }
  3983. if (ref != null) {
  3984. setRef(ref, null, parentSuspense, vnode);
  3985. }
  3986. return nextNode;
  3987. };
  3988. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  3989. optimized = optimized || !!vnode.dynamicChildren;
  3990. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  3991. const forcePatch = type === "input" || type === "option";
  3992. {
  3993. if (dirs) {
  3994. invokeDirectiveHook(vnode, null, parentComponent, "created");
  3995. }
  3996. let needCallTransitionHooks = false;
  3997. if (isTemplateNode(el)) {
  3998. needCallTransitionHooks = needTransition(
  3999. null,
  4000. // no need check parentSuspense in hydration
  4001. transition
  4002. ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  4003. const content = el.content.firstChild;
  4004. if (needCallTransitionHooks) {
  4005. transition.beforeEnter(content);
  4006. }
  4007. replaceNode(content, el, parentComponent);
  4008. vnode.el = el = content;
  4009. }
  4010. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  4011. !(props && (props.innerHTML || props.textContent))) {
  4012. let next = hydrateChildren(
  4013. el.firstChild,
  4014. vnode,
  4015. el,
  4016. parentComponent,
  4017. parentSuspense,
  4018. slotScopeIds,
  4019. optimized
  4020. );
  4021. let hasWarned = false;
  4022. while (next) {
  4023. if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
  4024. if (!hasWarned) {
  4025. warn$1(
  4026. `Hydration children mismatch on`,
  4027. el,
  4028. `
  4029. Server rendered element contains more child nodes than client vdom.`
  4030. );
  4031. hasWarned = true;
  4032. }
  4033. logMismatchError();
  4034. }
  4035. const cur = next;
  4036. next = next.nextSibling;
  4037. remove(cur);
  4038. }
  4039. } else if (shapeFlag & 8) {
  4040. let clientText = vnode.children;
  4041. if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
  4042. clientText = clientText.slice(1);
  4043. }
  4044. if (el.textContent !== clientText) {
  4045. if (!isMismatchAllowed(el, 0 /* TEXT */)) {
  4046. warn$1(
  4047. `Hydration text content mismatch on`,
  4048. el,
  4049. `
  4050. - rendered on server: ${el.textContent}
  4051. - expected on client: ${vnode.children}`
  4052. );
  4053. logMismatchError();
  4054. }
  4055. el.textContent = vnode.children;
  4056. }
  4057. }
  4058. if (props) {
  4059. {
  4060. const isCustomElement = el.tagName.includes("-");
  4061. for (const key in props) {
  4062. if (// #11189 skip if this node has directives that have created hooks
  4063. // as it could have mutated the DOM in any possible way
  4064. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  4065. logMismatchError();
  4066. }
  4067. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  4068. key[0] === "." || isCustomElement) {
  4069. patchProp(el, key, null, props[key], void 0, parentComponent);
  4070. }
  4071. }
  4072. }
  4073. }
  4074. let vnodeHooks;
  4075. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  4076. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4077. }
  4078. if (dirs) {
  4079. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4080. }
  4081. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  4082. queueEffectWithSuspense(() => {
  4083. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4084. needCallTransitionHooks && transition.enter(el);
  4085. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4086. }, parentSuspense);
  4087. }
  4088. }
  4089. return el.nextSibling;
  4090. };
  4091. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4092. optimized = optimized || !!parentVNode.dynamicChildren;
  4093. const children = parentVNode.children;
  4094. const l = children.length;
  4095. let hasWarned = false;
  4096. for (let i = 0; i < l; i++) {
  4097. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  4098. const isText = vnode.type === Text;
  4099. if (node) {
  4100. if (isText && !optimized) {
  4101. if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
  4102. insert(
  4103. createText(
  4104. node.data.slice(vnode.children.length)
  4105. ),
  4106. container,
  4107. nextSibling(node)
  4108. );
  4109. node.data = vnode.children;
  4110. }
  4111. }
  4112. node = hydrateNode(
  4113. node,
  4114. vnode,
  4115. parentComponent,
  4116. parentSuspense,
  4117. slotScopeIds,
  4118. optimized
  4119. );
  4120. } else if (isText && !vnode.children) {
  4121. insert(vnode.el = createText(""), container);
  4122. } else {
  4123. if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
  4124. if (!hasWarned) {
  4125. warn$1(
  4126. `Hydration children mismatch on`,
  4127. container,
  4128. `
  4129. Server rendered element contains fewer child nodes than client vdom.`
  4130. );
  4131. hasWarned = true;
  4132. }
  4133. logMismatchError();
  4134. }
  4135. patch(
  4136. null,
  4137. vnode,
  4138. container,
  4139. null,
  4140. parentComponent,
  4141. parentSuspense,
  4142. getContainerType(container),
  4143. slotScopeIds
  4144. );
  4145. }
  4146. }
  4147. return node;
  4148. };
  4149. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4150. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  4151. if (fragmentSlotScopeIds) {
  4152. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4153. }
  4154. const container = parentNode(node);
  4155. const next = hydrateChildren(
  4156. nextSibling(node),
  4157. vnode,
  4158. container,
  4159. parentComponent,
  4160. parentSuspense,
  4161. slotScopeIds,
  4162. optimized
  4163. );
  4164. if (next && isComment(next) && next.data === "]") {
  4165. return nextSibling(vnode.anchor = next);
  4166. } else {
  4167. logMismatchError();
  4168. insert(vnode.anchor = createComment(`]`), container, next);
  4169. return next;
  4170. }
  4171. };
  4172. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  4173. if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
  4174. warn$1(
  4175. `Hydration node mismatch:
  4176. - rendered on server:`,
  4177. node,
  4178. node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  4179. `
  4180. - expected on client:`,
  4181. vnode.type
  4182. );
  4183. logMismatchError();
  4184. }
  4185. vnode.el = null;
  4186. if (isFragment) {
  4187. const end = locateClosingAnchor(node);
  4188. while (true) {
  4189. const next2 = nextSibling(node);
  4190. if (next2 && next2 !== end) {
  4191. remove(next2);
  4192. } else {
  4193. break;
  4194. }
  4195. }
  4196. }
  4197. const next = nextSibling(node);
  4198. const container = parentNode(node);
  4199. remove(node);
  4200. patch(
  4201. null,
  4202. vnode,
  4203. container,
  4204. next,
  4205. parentComponent,
  4206. parentSuspense,
  4207. getContainerType(container),
  4208. slotScopeIds
  4209. );
  4210. return next;
  4211. };
  4212. const locateClosingAnchor = (node, open = "[", close = "]") => {
  4213. let match = 0;
  4214. while (node) {
  4215. node = nextSibling(node);
  4216. if (node && isComment(node)) {
  4217. if (node.data === open) match++;
  4218. if (node.data === close) {
  4219. if (match === 0) {
  4220. return nextSibling(node);
  4221. } else {
  4222. match--;
  4223. }
  4224. }
  4225. }
  4226. }
  4227. return node;
  4228. };
  4229. const replaceNode = (newNode, oldNode, parentComponent) => {
  4230. const parentNode2 = oldNode.parentNode;
  4231. if (parentNode2) {
  4232. parentNode2.replaceChild(newNode, oldNode);
  4233. }
  4234. let parent = parentComponent;
  4235. while (parent) {
  4236. if (parent.vnode.el === oldNode) {
  4237. parent.vnode.el = parent.subTree.el = newNode;
  4238. }
  4239. parent = parent.parent;
  4240. }
  4241. };
  4242. const isTemplateNode = (node) => {
  4243. return node.nodeType === 1 && node.tagName === "TEMPLATE";
  4244. };
  4245. return [hydrate, hydrateNode];
  4246. }
  4247. function propHasMismatch(el, key, clientValue, vnode, instance) {
  4248. let mismatchType;
  4249. let mismatchKey;
  4250. let actual;
  4251. let expected;
  4252. if (key === "class") {
  4253. actual = el.getAttribute("class");
  4254. expected = normalizeClass(clientValue);
  4255. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  4256. mismatchType = 2 /* CLASS */;
  4257. mismatchKey = `class`;
  4258. }
  4259. } else if (key === "style") {
  4260. actual = el.getAttribute("style") || "";
  4261. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  4262. const actualMap = toStyleMap(actual);
  4263. const expectedMap = toStyleMap(expected);
  4264. if (vnode.dirs) {
  4265. for (const { dir, value } of vnode.dirs) {
  4266. if (dir.name === "show" && !value) {
  4267. expectedMap.set("display", "none");
  4268. }
  4269. }
  4270. }
  4271. if (instance) {
  4272. resolveCssVars(instance, vnode, expectedMap);
  4273. }
  4274. if (!isMapEqual(actualMap, expectedMap)) {
  4275. mismatchType = 3 /* STYLE */;
  4276. mismatchKey = "style";
  4277. }
  4278. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  4279. if (isBooleanAttr(key)) {
  4280. actual = el.hasAttribute(key);
  4281. expected = includeBooleanAttr(clientValue);
  4282. } else if (clientValue == null) {
  4283. actual = el.hasAttribute(key);
  4284. expected = false;
  4285. } else {
  4286. if (el.hasAttribute(key)) {
  4287. actual = el.getAttribute(key);
  4288. } else if (key === "value" && el.tagName === "TEXTAREA") {
  4289. actual = el.value;
  4290. } else {
  4291. actual = false;
  4292. }
  4293. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  4294. }
  4295. if (actual !== expected) {
  4296. mismatchType = 4 /* ATTRIBUTE */;
  4297. mismatchKey = key;
  4298. }
  4299. }
  4300. if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
  4301. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  4302. const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
  4303. const postSegment = `
  4304. - rendered on server: ${format(actual)}
  4305. - expected on client: ${format(expected)}
  4306. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  4307. You should fix the source of the mismatch.`;
  4308. {
  4309. warn$1(preSegment, el, postSegment);
  4310. }
  4311. return true;
  4312. }
  4313. return false;
  4314. }
  4315. function toClassSet(str) {
  4316. return new Set(str.trim().split(/\s+/));
  4317. }
  4318. function isSetEqual(a, b) {
  4319. if (a.size !== b.size) {
  4320. return false;
  4321. }
  4322. for (const s of a) {
  4323. if (!b.has(s)) {
  4324. return false;
  4325. }
  4326. }
  4327. return true;
  4328. }
  4329. function toStyleMap(str) {
  4330. const styleMap = /* @__PURE__ */ new Map();
  4331. for (const item of str.split(";")) {
  4332. let [key, value] = item.split(":");
  4333. key = key.trim();
  4334. value = value && value.trim();
  4335. if (key && value) {
  4336. styleMap.set(key, value);
  4337. }
  4338. }
  4339. return styleMap;
  4340. }
  4341. function isMapEqual(a, b) {
  4342. if (a.size !== b.size) {
  4343. return false;
  4344. }
  4345. for (const [key, value] of a) {
  4346. if (value !== b.get(key)) {
  4347. return false;
  4348. }
  4349. }
  4350. return true;
  4351. }
  4352. function resolveCssVars(instance, vnode, expectedMap) {
  4353. const root = instance.subTree;
  4354. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  4355. const cssVars = instance.getCssVars();
  4356. for (const key in cssVars) {
  4357. expectedMap.set(
  4358. `--${getEscapedCssVarName(key)}`,
  4359. String(cssVars[key])
  4360. );
  4361. }
  4362. }
  4363. if (vnode === root && instance.parent) {
  4364. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  4365. }
  4366. }
  4367. const allowMismatchAttr = "data-allow-mismatch";
  4368. const MismatchTypeString = {
  4369. [0 /* TEXT */]: "text",
  4370. [1 /* CHILDREN */]: "children",
  4371. [2 /* CLASS */]: "class",
  4372. [3 /* STYLE */]: "style",
  4373. [4 /* ATTRIBUTE */]: "attribute"
  4374. };
  4375. function isMismatchAllowed(el, allowedType) {
  4376. if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
  4377. while (el && !el.hasAttribute(allowMismatchAttr)) {
  4378. el = el.parentElement;
  4379. }
  4380. }
  4381. const allowedAttr = el && el.getAttribute(allowMismatchAttr);
  4382. if (allowedAttr == null) {
  4383. return false;
  4384. } else if (allowedAttr === "") {
  4385. return true;
  4386. } else {
  4387. const list = allowedAttr.split(",");
  4388. if (allowedType === 0 /* TEXT */ && list.includes("children")) {
  4389. return true;
  4390. }
  4391. return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
  4392. }
  4393. }
  4394. const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
  4395. const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
  4396. const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
  4397. const id = requestIdleCallback(hydrate, { timeout });
  4398. return () => cancelIdleCallback(id);
  4399. };
  4400. function elementIsVisibleInViewport(el) {
  4401. const { top, left, bottom, right } = el.getBoundingClientRect();
  4402. const { innerHeight, innerWidth } = window;
  4403. return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
  4404. }
  4405. const hydrateOnVisible = (opts) => (hydrate, forEach) => {
  4406. const ob = new IntersectionObserver((entries) => {
  4407. for (const e of entries) {
  4408. if (!e.isIntersecting) continue;
  4409. ob.disconnect();
  4410. hydrate();
  4411. break;
  4412. }
  4413. }, opts);
  4414. forEach((el) => {
  4415. if (!(el instanceof Element)) return;
  4416. if (elementIsVisibleInViewport(el)) {
  4417. hydrate();
  4418. ob.disconnect();
  4419. return false;
  4420. }
  4421. ob.observe(el);
  4422. });
  4423. return () => ob.disconnect();
  4424. };
  4425. const hydrateOnMediaQuery = (query) => (hydrate) => {
  4426. if (query) {
  4427. const mql = matchMedia(query);
  4428. if (mql.matches) {
  4429. hydrate();
  4430. } else {
  4431. mql.addEventListener("change", hydrate, { once: true });
  4432. return () => mql.removeEventListener("change", hydrate);
  4433. }
  4434. }
  4435. };
  4436. const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
  4437. if (isString(interactions)) interactions = [interactions];
  4438. let hasHydrated = false;
  4439. const doHydrate = (e) => {
  4440. if (!hasHydrated) {
  4441. hasHydrated = true;
  4442. teardown();
  4443. hydrate();
  4444. e.target.dispatchEvent(new e.constructor(e.type, e));
  4445. }
  4446. };
  4447. const teardown = () => {
  4448. forEach((el) => {
  4449. for (const i of interactions) {
  4450. el.removeEventListener(i, doHydrate);
  4451. }
  4452. });
  4453. };
  4454. forEach((el) => {
  4455. for (const i of interactions) {
  4456. el.addEventListener(i, doHydrate, { once: true });
  4457. }
  4458. });
  4459. return teardown;
  4460. };
  4461. function forEachElement(node, cb) {
  4462. if (isComment(node) && node.data === "[") {
  4463. let depth = 1;
  4464. let next = node.nextSibling;
  4465. while (next) {
  4466. if (next.nodeType === 1) {
  4467. const result = cb(next);
  4468. if (result === false) {
  4469. break;
  4470. }
  4471. } else if (isComment(next)) {
  4472. if (next.data === "]") {
  4473. if (--depth === 0) break;
  4474. } else if (next.data === "[") {
  4475. depth++;
  4476. }
  4477. }
  4478. next = next.nextSibling;
  4479. }
  4480. } else {
  4481. cb(node);
  4482. }
  4483. }
  4484. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  4485. /*! #__NO_SIDE_EFFECTS__ */
  4486. // @__NO_SIDE_EFFECTS__
  4487. function defineAsyncComponent(source) {
  4488. if (isFunction(source)) {
  4489. source = { loader: source };
  4490. }
  4491. const {
  4492. loader,
  4493. loadingComponent,
  4494. errorComponent,
  4495. delay = 200,
  4496. hydrate: hydrateStrategy,
  4497. timeout,
  4498. // undefined = never times out
  4499. suspensible = true,
  4500. onError: userOnError
  4501. } = source;
  4502. let pendingRequest = null;
  4503. let resolvedComp;
  4504. let retries = 0;
  4505. const retry = () => {
  4506. retries++;
  4507. pendingRequest = null;
  4508. return load();
  4509. };
  4510. const load = () => {
  4511. let thisRequest;
  4512. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  4513. err = err instanceof Error ? err : new Error(String(err));
  4514. if (userOnError) {
  4515. return new Promise((resolve, reject) => {
  4516. const userRetry = () => resolve(retry());
  4517. const userFail = () => reject(err);
  4518. userOnError(err, userRetry, userFail, retries + 1);
  4519. });
  4520. } else {
  4521. throw err;
  4522. }
  4523. }).then((comp) => {
  4524. if (thisRequest !== pendingRequest && pendingRequest) {
  4525. return pendingRequest;
  4526. }
  4527. if (!comp) {
  4528. warn$1(
  4529. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  4530. );
  4531. }
  4532. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  4533. comp = comp.default;
  4534. }
  4535. if (comp && !isObject(comp) && !isFunction(comp)) {
  4536. throw new Error(`Invalid async component load result: ${comp}`);
  4537. }
  4538. resolvedComp = comp;
  4539. return comp;
  4540. }));
  4541. };
  4542. return defineComponent({
  4543. name: "AsyncComponentWrapper",
  4544. __asyncLoader: load,
  4545. __asyncHydrate(el, instance, hydrate) {
  4546. const doHydrate = hydrateStrategy ? () => {
  4547. const teardown = hydrateStrategy(
  4548. hydrate,
  4549. (cb) => forEachElement(el, cb)
  4550. );
  4551. if (teardown) {
  4552. (instance.bum || (instance.bum = [])).push(teardown);
  4553. }
  4554. } : hydrate;
  4555. if (resolvedComp) {
  4556. doHydrate();
  4557. } else {
  4558. load().then(() => !instance.isUnmounted && doHydrate());
  4559. }
  4560. },
  4561. get __asyncResolved() {
  4562. return resolvedComp;
  4563. },
  4564. setup() {
  4565. const instance = currentInstance;
  4566. markAsyncBoundary(instance);
  4567. if (resolvedComp) {
  4568. return () => createInnerComp(resolvedComp, instance);
  4569. }
  4570. const onError = (err) => {
  4571. pendingRequest = null;
  4572. handleError(
  4573. err,
  4574. instance,
  4575. 13,
  4576. !errorComponent
  4577. );
  4578. };
  4579. if (suspensible && instance.suspense || false) {
  4580. return load().then((comp) => {
  4581. return () => createInnerComp(comp, instance);
  4582. }).catch((err) => {
  4583. onError(err);
  4584. return () => errorComponent ? createVNode(errorComponent, {
  4585. error: err
  4586. }) : null;
  4587. });
  4588. }
  4589. const loaded = ref(false);
  4590. const error = ref();
  4591. const delayed = ref(!!delay);
  4592. if (delay) {
  4593. setTimeout(() => {
  4594. delayed.value = false;
  4595. }, delay);
  4596. }
  4597. if (timeout != null) {
  4598. setTimeout(() => {
  4599. if (!loaded.value && !error.value) {
  4600. const err = new Error(
  4601. `Async component timed out after ${timeout}ms.`
  4602. );
  4603. onError(err);
  4604. error.value = err;
  4605. }
  4606. }, timeout);
  4607. }
  4608. load().then(() => {
  4609. loaded.value = true;
  4610. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  4611. instance.parent.update();
  4612. }
  4613. }).catch((err) => {
  4614. onError(err);
  4615. error.value = err;
  4616. });
  4617. return () => {
  4618. if (loaded.value && resolvedComp) {
  4619. return createInnerComp(resolvedComp, instance);
  4620. } else if (error.value && errorComponent) {
  4621. return createVNode(errorComponent, {
  4622. error: error.value
  4623. });
  4624. } else if (loadingComponent && !delayed.value) {
  4625. return createVNode(loadingComponent);
  4626. }
  4627. };
  4628. }
  4629. });
  4630. }
  4631. function createInnerComp(comp, parent) {
  4632. const { ref: ref2, props, children, ce } = parent.vnode;
  4633. const vnode = createVNode(comp, props, children);
  4634. vnode.ref = ref2;
  4635. vnode.ce = ce;
  4636. delete parent.vnode.ce;
  4637. return vnode;
  4638. }
  4639. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  4640. const KeepAliveImpl = {
  4641. name: `KeepAlive`,
  4642. // Marker for special handling inside the renderer. We are not using a ===
  4643. // check directly on KeepAlive in the renderer, because importing it directly
  4644. // would prevent it from being tree-shaken.
  4645. __isKeepAlive: true,
  4646. props: {
  4647. include: [String, RegExp, Array],
  4648. exclude: [String, RegExp, Array],
  4649. max: [String, Number]
  4650. },
  4651. setup(props, { slots }) {
  4652. const instance = getCurrentInstance();
  4653. const sharedContext = instance.ctx;
  4654. const cache = /* @__PURE__ */ new Map();
  4655. const keys = /* @__PURE__ */ new Set();
  4656. let current = null;
  4657. {
  4658. instance.__v_cache = cache;
  4659. }
  4660. const parentSuspense = instance.suspense;
  4661. const {
  4662. renderer: {
  4663. p: patch,
  4664. m: move,
  4665. um: _unmount,
  4666. o: { createElement }
  4667. }
  4668. } = sharedContext;
  4669. const storageContainer = createElement("div");
  4670. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  4671. const instance2 = vnode.component;
  4672. move(vnode, container, anchor, 0, parentSuspense);
  4673. patch(
  4674. instance2.vnode,
  4675. vnode,
  4676. container,
  4677. anchor,
  4678. instance2,
  4679. parentSuspense,
  4680. namespace,
  4681. vnode.slotScopeIds,
  4682. optimized
  4683. );
  4684. queuePostRenderEffect(() => {
  4685. instance2.isDeactivated = false;
  4686. if (instance2.a) {
  4687. invokeArrayFns(instance2.a);
  4688. }
  4689. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  4690. if (vnodeHook) {
  4691. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4692. }
  4693. }, parentSuspense);
  4694. {
  4695. devtoolsComponentAdded(instance2);
  4696. }
  4697. };
  4698. sharedContext.deactivate = (vnode) => {
  4699. const instance2 = vnode.component;
  4700. invalidateMount(instance2.m);
  4701. invalidateMount(instance2.a);
  4702. move(vnode, storageContainer, null, 1, parentSuspense);
  4703. queuePostRenderEffect(() => {
  4704. if (instance2.da) {
  4705. invokeArrayFns(instance2.da);
  4706. }
  4707. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  4708. if (vnodeHook) {
  4709. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4710. }
  4711. instance2.isDeactivated = true;
  4712. }, parentSuspense);
  4713. {
  4714. devtoolsComponentAdded(instance2);
  4715. }
  4716. };
  4717. function unmount(vnode) {
  4718. resetShapeFlag(vnode);
  4719. _unmount(vnode, instance, parentSuspense, true);
  4720. }
  4721. function pruneCache(filter) {
  4722. cache.forEach((vnode, key) => {
  4723. const name = getComponentName(vnode.type);
  4724. if (name && !filter(name)) {
  4725. pruneCacheEntry(key);
  4726. }
  4727. });
  4728. }
  4729. function pruneCacheEntry(key) {
  4730. const cached = cache.get(key);
  4731. if (cached && (!current || !isSameVNodeType(cached, current))) {
  4732. unmount(cached);
  4733. } else if (current) {
  4734. resetShapeFlag(current);
  4735. }
  4736. cache.delete(key);
  4737. keys.delete(key);
  4738. }
  4739. watch(
  4740. () => [props.include, props.exclude],
  4741. ([include, exclude]) => {
  4742. include && pruneCache((name) => matches(include, name));
  4743. exclude && pruneCache((name) => !matches(exclude, name));
  4744. },
  4745. // prune post-render after `current` has been updated
  4746. { flush: "post", deep: true }
  4747. );
  4748. let pendingCacheKey = null;
  4749. const cacheSubtree = () => {
  4750. if (pendingCacheKey != null) {
  4751. if (isSuspense(instance.subTree.type)) {
  4752. queuePostRenderEffect(() => {
  4753. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4754. }, instance.subTree.suspense);
  4755. } else {
  4756. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4757. }
  4758. }
  4759. };
  4760. onMounted(cacheSubtree);
  4761. onUpdated(cacheSubtree);
  4762. onBeforeUnmount(() => {
  4763. cache.forEach((cached) => {
  4764. const { subTree, suspense } = instance;
  4765. const vnode = getInnerChild(subTree);
  4766. if (cached.type === vnode.type && cached.key === vnode.key) {
  4767. resetShapeFlag(vnode);
  4768. const da = vnode.component.da;
  4769. da && queuePostRenderEffect(da, suspense);
  4770. return;
  4771. }
  4772. unmount(cached);
  4773. });
  4774. });
  4775. return () => {
  4776. pendingCacheKey = null;
  4777. if (!slots.default) {
  4778. return current = null;
  4779. }
  4780. const children = slots.default();
  4781. const rawVNode = children[0];
  4782. if (children.length > 1) {
  4783. {
  4784. warn$1(`KeepAlive should contain exactly one component child.`);
  4785. }
  4786. current = null;
  4787. return children;
  4788. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  4789. current = null;
  4790. return rawVNode;
  4791. }
  4792. let vnode = getInnerChild(rawVNode);
  4793. if (vnode.type === Comment) {
  4794. current = null;
  4795. return vnode;
  4796. }
  4797. const comp = vnode.type;
  4798. const name = getComponentName(
  4799. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  4800. );
  4801. const { include, exclude, max } = props;
  4802. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  4803. vnode.shapeFlag &= ~256;
  4804. current = vnode;
  4805. return rawVNode;
  4806. }
  4807. const key = vnode.key == null ? comp : vnode.key;
  4808. const cachedVNode = cache.get(key);
  4809. if (vnode.el) {
  4810. vnode = cloneVNode(vnode);
  4811. if (rawVNode.shapeFlag & 128) {
  4812. rawVNode.ssContent = vnode;
  4813. }
  4814. }
  4815. pendingCacheKey = key;
  4816. if (cachedVNode) {
  4817. vnode.el = cachedVNode.el;
  4818. vnode.component = cachedVNode.component;
  4819. if (vnode.transition) {
  4820. setTransitionHooks(vnode, vnode.transition);
  4821. }
  4822. vnode.shapeFlag |= 512;
  4823. keys.delete(key);
  4824. keys.add(key);
  4825. } else {
  4826. keys.add(key);
  4827. if (max && keys.size > parseInt(max, 10)) {
  4828. pruneCacheEntry(keys.values().next().value);
  4829. }
  4830. }
  4831. vnode.shapeFlag |= 256;
  4832. current = vnode;
  4833. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  4834. };
  4835. }
  4836. };
  4837. const KeepAlive = KeepAliveImpl;
  4838. function matches(pattern, name) {
  4839. if (isArray(pattern)) {
  4840. return pattern.some((p) => matches(p, name));
  4841. } else if (isString(pattern)) {
  4842. return pattern.split(",").includes(name);
  4843. } else if (isRegExp(pattern)) {
  4844. pattern.lastIndex = 0;
  4845. return pattern.test(name);
  4846. }
  4847. return false;
  4848. }
  4849. function onActivated(hook, target) {
  4850. registerKeepAliveHook(hook, "a", target);
  4851. }
  4852. function onDeactivated(hook, target) {
  4853. registerKeepAliveHook(hook, "da", target);
  4854. }
  4855. function registerKeepAliveHook(hook, type, target = currentInstance) {
  4856. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  4857. let current = target;
  4858. while (current) {
  4859. if (current.isDeactivated) {
  4860. return;
  4861. }
  4862. current = current.parent;
  4863. }
  4864. return hook();
  4865. });
  4866. injectHook(type, wrappedHook, target);
  4867. if (target) {
  4868. let current = target.parent;
  4869. while (current && current.parent) {
  4870. if (isKeepAlive(current.parent.vnode)) {
  4871. injectToKeepAliveRoot(wrappedHook, type, target, current);
  4872. }
  4873. current = current.parent;
  4874. }
  4875. }
  4876. }
  4877. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  4878. const injected = injectHook(
  4879. type,
  4880. hook,
  4881. keepAliveRoot,
  4882. true
  4883. /* prepend */
  4884. );
  4885. onUnmounted(() => {
  4886. remove(keepAliveRoot[type], injected);
  4887. }, target);
  4888. }
  4889. function resetShapeFlag(vnode) {
  4890. vnode.shapeFlag &= ~256;
  4891. vnode.shapeFlag &= ~512;
  4892. }
  4893. function getInnerChild(vnode) {
  4894. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  4895. }
  4896. function injectHook(type, hook, target = currentInstance, prepend = false) {
  4897. if (target) {
  4898. const hooks = target[type] || (target[type] = []);
  4899. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  4900. pauseTracking();
  4901. const reset = setCurrentInstance(target);
  4902. const res = callWithAsyncErrorHandling(hook, target, type, args);
  4903. reset();
  4904. resetTracking();
  4905. return res;
  4906. });
  4907. if (prepend) {
  4908. hooks.unshift(wrappedHook);
  4909. } else {
  4910. hooks.push(wrappedHook);
  4911. }
  4912. return wrappedHook;
  4913. } else {
  4914. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  4915. warn$1(
  4916. `${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.` )
  4917. );
  4918. }
  4919. }
  4920. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  4921. if (!isInSSRComponentSetup || lifecycle === "sp") {
  4922. injectHook(lifecycle, (...args) => hook(...args), target);
  4923. }
  4924. };
  4925. const onBeforeMount = createHook("bm");
  4926. const onMounted = createHook("m");
  4927. const onBeforeUpdate = createHook(
  4928. "bu"
  4929. );
  4930. const onUpdated = createHook("u");
  4931. const onBeforeUnmount = createHook(
  4932. "bum"
  4933. );
  4934. const onUnmounted = createHook("um");
  4935. const onServerPrefetch = createHook(
  4936. "sp"
  4937. );
  4938. const onRenderTriggered = createHook("rtg");
  4939. const onRenderTracked = createHook("rtc");
  4940. function onErrorCaptured(hook, target = currentInstance) {
  4941. injectHook("ec", hook, target);
  4942. }
  4943. const COMPONENTS = "components";
  4944. const DIRECTIVES = "directives";
  4945. function resolveComponent(name, maybeSelfReference) {
  4946. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  4947. }
  4948. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  4949. function resolveDynamicComponent(component) {
  4950. if (isString(component)) {
  4951. return resolveAsset(COMPONENTS, component, false) || component;
  4952. } else {
  4953. return component || NULL_DYNAMIC_COMPONENT;
  4954. }
  4955. }
  4956. function resolveDirective(name) {
  4957. return resolveAsset(DIRECTIVES, name);
  4958. }
  4959. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  4960. const instance = currentRenderingInstance || currentInstance;
  4961. if (instance) {
  4962. const Component = instance.type;
  4963. if (type === COMPONENTS) {
  4964. const selfName = getComponentName(
  4965. Component,
  4966. false
  4967. );
  4968. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  4969. return Component;
  4970. }
  4971. }
  4972. const res = (
  4973. // local registration
  4974. // check instance[type] first which is resolved for options API
  4975. resolve(instance[type] || Component[type], name) || // global registration
  4976. resolve(instance.appContext[type], name)
  4977. );
  4978. if (!res && maybeSelfReference) {
  4979. return Component;
  4980. }
  4981. if (warnMissing && !res) {
  4982. const extra = type === COMPONENTS ? `
  4983. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  4984. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  4985. }
  4986. return res;
  4987. } else {
  4988. warn$1(
  4989. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  4990. );
  4991. }
  4992. }
  4993. function resolve(registry, name) {
  4994. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  4995. }
  4996. function renderList(source, renderItem, cache, index) {
  4997. let ret;
  4998. const cached = cache && cache[index];
  4999. const sourceIsArray = isArray(source);
  5000. if (sourceIsArray || isString(source)) {
  5001. const sourceIsReactiveArray = sourceIsArray && isReactive(source);
  5002. let needsWrap = false;
  5003. if (sourceIsReactiveArray) {
  5004. needsWrap = !isShallow(source);
  5005. source = shallowReadArray(source);
  5006. }
  5007. ret = new Array(source.length);
  5008. for (let i = 0, l = source.length; i < l; i++) {
  5009. ret[i] = renderItem(
  5010. needsWrap ? toReactive(source[i]) : source[i],
  5011. i,
  5012. void 0,
  5013. cached && cached[i]
  5014. );
  5015. }
  5016. } else if (typeof source === "number") {
  5017. if (!Number.isInteger(source)) {
  5018. warn$1(`The v-for range expect an integer value but got ${source}.`);
  5019. }
  5020. ret = new Array(source);
  5021. for (let i = 0; i < source; i++) {
  5022. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  5023. }
  5024. } else if (isObject(source)) {
  5025. if (source[Symbol.iterator]) {
  5026. ret = Array.from(
  5027. source,
  5028. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  5029. );
  5030. } else {
  5031. const keys = Object.keys(source);
  5032. ret = new Array(keys.length);
  5033. for (let i = 0, l = keys.length; i < l; i++) {
  5034. const key = keys[i];
  5035. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  5036. }
  5037. }
  5038. } else {
  5039. ret = [];
  5040. }
  5041. if (cache) {
  5042. cache[index] = ret;
  5043. }
  5044. return ret;
  5045. }
  5046. function createSlots(slots, dynamicSlots) {
  5047. for (let i = 0; i < dynamicSlots.length; i++) {
  5048. const slot = dynamicSlots[i];
  5049. if (isArray(slot)) {
  5050. for (let j = 0; j < slot.length; j++) {
  5051. slots[slot[j].name] = slot[j].fn;
  5052. }
  5053. } else if (slot) {
  5054. slots[slot.name] = slot.key ? (...args) => {
  5055. const res = slot.fn(...args);
  5056. if (res) res.key = slot.key;
  5057. return res;
  5058. } : slot.fn;
  5059. }
  5060. }
  5061. return slots;
  5062. }
  5063. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  5064. if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
  5065. if (name !== "default") props.name = name;
  5066. return openBlock(), createBlock(
  5067. Fragment,
  5068. null,
  5069. [createVNode("slot", props, fallback && fallback())],
  5070. 64
  5071. );
  5072. }
  5073. let slot = slots[name];
  5074. if (slot && slot.length > 1) {
  5075. warn$1(
  5076. `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.`
  5077. );
  5078. slot = () => [];
  5079. }
  5080. if (slot && slot._c) {
  5081. slot._d = false;
  5082. }
  5083. openBlock();
  5084. const validSlotContent = slot && ensureValidVNode(slot(props));
  5085. const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
  5086. // key attached in the `createSlots` helper, respect that
  5087. validSlotContent && validSlotContent.key;
  5088. const rendered = createBlock(
  5089. Fragment,
  5090. {
  5091. key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
  5092. (!validSlotContent && fallback ? "_fb" : "")
  5093. },
  5094. validSlotContent || (fallback ? fallback() : []),
  5095. validSlotContent && slots._ === 1 ? 64 : -2
  5096. );
  5097. if (!noSlotted && rendered.scopeId) {
  5098. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  5099. }
  5100. if (slot && slot._c) {
  5101. slot._d = true;
  5102. }
  5103. return rendered;
  5104. }
  5105. function ensureValidVNode(vnodes) {
  5106. return vnodes.some((child) => {
  5107. if (!isVNode(child)) return true;
  5108. if (child.type === Comment) return false;
  5109. if (child.type === Fragment && !ensureValidVNode(child.children))
  5110. return false;
  5111. return true;
  5112. }) ? vnodes : null;
  5113. }
  5114. function toHandlers(obj, preserveCaseIfNecessary) {
  5115. const ret = {};
  5116. if (!isObject(obj)) {
  5117. warn$1(`v-on with no argument expects an object value.`);
  5118. return ret;
  5119. }
  5120. for (const key in obj) {
  5121. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  5122. }
  5123. return ret;
  5124. }
  5125. const getPublicInstance = (i) => {
  5126. if (!i) return null;
  5127. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  5128. return getPublicInstance(i.parent);
  5129. };
  5130. const publicPropertiesMap = (
  5131. // Move PURE marker to new line to workaround compiler discarding it
  5132. // due to type annotation
  5133. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  5134. $: (i) => i,
  5135. $el: (i) => i.vnode.el,
  5136. $data: (i) => i.data,
  5137. $props: (i) => shallowReadonly(i.props) ,
  5138. $attrs: (i) => shallowReadonly(i.attrs) ,
  5139. $slots: (i) => shallowReadonly(i.slots) ,
  5140. $refs: (i) => shallowReadonly(i.refs) ,
  5141. $parent: (i) => getPublicInstance(i.parent),
  5142. $root: (i) => getPublicInstance(i.root),
  5143. $host: (i) => i.ce,
  5144. $emit: (i) => i.emit,
  5145. $options: (i) => resolveMergedOptions(i) ,
  5146. $forceUpdate: (i) => i.f || (i.f = () => {
  5147. queueJob(i.update);
  5148. }),
  5149. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  5150. $watch: (i) => instanceWatch.bind(i)
  5151. })
  5152. );
  5153. const isReservedPrefix = (key) => key === "_" || key === "$";
  5154. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  5155. const PublicInstanceProxyHandlers = {
  5156. get({ _: instance }, key) {
  5157. if (key === "__v_skip") {
  5158. return true;
  5159. }
  5160. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  5161. if (key === "__isVue") {
  5162. return true;
  5163. }
  5164. let normalizedProps;
  5165. if (key[0] !== "$") {
  5166. const n = accessCache[key];
  5167. if (n !== void 0) {
  5168. switch (n) {
  5169. case 1 /* SETUP */:
  5170. return setupState[key];
  5171. case 2 /* DATA */:
  5172. return data[key];
  5173. case 4 /* CONTEXT */:
  5174. return ctx[key];
  5175. case 3 /* PROPS */:
  5176. return props[key];
  5177. }
  5178. } else if (hasSetupBinding(setupState, key)) {
  5179. accessCache[key] = 1 /* SETUP */;
  5180. return setupState[key];
  5181. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5182. accessCache[key] = 2 /* DATA */;
  5183. return data[key];
  5184. } else if (
  5185. // only cache other properties when instance has declared (thus stable)
  5186. // props
  5187. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  5188. ) {
  5189. accessCache[key] = 3 /* PROPS */;
  5190. return props[key];
  5191. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5192. accessCache[key] = 4 /* CONTEXT */;
  5193. return ctx[key];
  5194. } else if (shouldCacheAccess) {
  5195. accessCache[key] = 0 /* OTHER */;
  5196. }
  5197. }
  5198. const publicGetter = publicPropertiesMap[key];
  5199. let cssModule, globalProperties;
  5200. if (publicGetter) {
  5201. if (key === "$attrs") {
  5202. track(instance.attrs, "get", "");
  5203. markAttrsAccessed();
  5204. } else if (key === "$slots") {
  5205. track(instance, "get", key);
  5206. }
  5207. return publicGetter(instance);
  5208. } else if (
  5209. // css module (injected by vue-loader)
  5210. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  5211. ) {
  5212. return cssModule;
  5213. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5214. accessCache[key] = 4 /* CONTEXT */;
  5215. return ctx[key];
  5216. } else if (
  5217. // global properties
  5218. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  5219. ) {
  5220. {
  5221. return globalProperties[key];
  5222. }
  5223. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  5224. // to infinite warning loop
  5225. key.indexOf("__v") !== 0)) {
  5226. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  5227. warn$1(
  5228. `Property ${JSON.stringify(
  5229. key
  5230. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  5231. );
  5232. } else if (instance === currentRenderingInstance) {
  5233. warn$1(
  5234. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  5235. );
  5236. }
  5237. }
  5238. },
  5239. set({ _: instance }, key, value) {
  5240. const { data, setupState, ctx } = instance;
  5241. if (hasSetupBinding(setupState, key)) {
  5242. setupState[key] = value;
  5243. return true;
  5244. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  5245. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  5246. return false;
  5247. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5248. data[key] = value;
  5249. return true;
  5250. } else if (hasOwn(instance.props, key)) {
  5251. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  5252. return false;
  5253. }
  5254. if (key[0] === "$" && key.slice(1) in instance) {
  5255. warn$1(
  5256. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  5257. );
  5258. return false;
  5259. } else {
  5260. if (key in instance.appContext.config.globalProperties) {
  5261. Object.defineProperty(ctx, key, {
  5262. enumerable: true,
  5263. configurable: true,
  5264. value
  5265. });
  5266. } else {
  5267. ctx[key] = value;
  5268. }
  5269. }
  5270. return true;
  5271. },
  5272. has({
  5273. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  5274. }, key) {
  5275. let normalizedProps;
  5276. 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);
  5277. },
  5278. defineProperty(target, key, descriptor) {
  5279. if (descriptor.get != null) {
  5280. target._.accessCache[key] = 0;
  5281. } else if (hasOwn(descriptor, "value")) {
  5282. this.set(target, key, descriptor.value, null);
  5283. }
  5284. return Reflect.defineProperty(target, key, descriptor);
  5285. }
  5286. };
  5287. {
  5288. PublicInstanceProxyHandlers.ownKeys = (target) => {
  5289. warn$1(
  5290. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  5291. );
  5292. return Reflect.ownKeys(target);
  5293. };
  5294. }
  5295. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
  5296. get(target, key) {
  5297. if (key === Symbol.unscopables) {
  5298. return;
  5299. }
  5300. return PublicInstanceProxyHandlers.get(target, key, target);
  5301. },
  5302. has(_, key) {
  5303. const has = key[0] !== "_" && !isGloballyAllowed(key);
  5304. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  5305. warn$1(
  5306. `Property ${JSON.stringify(
  5307. key
  5308. )} should not start with _ which is a reserved prefix for Vue internals.`
  5309. );
  5310. }
  5311. return has;
  5312. }
  5313. });
  5314. function createDevRenderContext(instance) {
  5315. const target = {};
  5316. Object.defineProperty(target, `_`, {
  5317. configurable: true,
  5318. enumerable: false,
  5319. get: () => instance
  5320. });
  5321. Object.keys(publicPropertiesMap).forEach((key) => {
  5322. Object.defineProperty(target, key, {
  5323. configurable: true,
  5324. enumerable: false,
  5325. get: () => publicPropertiesMap[key](instance),
  5326. // intercepted by the proxy so no need for implementation,
  5327. // but needed to prevent set errors
  5328. set: NOOP
  5329. });
  5330. });
  5331. return target;
  5332. }
  5333. function exposePropsOnRenderContext(instance) {
  5334. const {
  5335. ctx,
  5336. propsOptions: [propsOptions]
  5337. } = instance;
  5338. if (propsOptions) {
  5339. Object.keys(propsOptions).forEach((key) => {
  5340. Object.defineProperty(ctx, key, {
  5341. enumerable: true,
  5342. configurable: true,
  5343. get: () => instance.props[key],
  5344. set: NOOP
  5345. });
  5346. });
  5347. }
  5348. }
  5349. function exposeSetupStateOnRenderContext(instance) {
  5350. const { ctx, setupState } = instance;
  5351. Object.keys(toRaw(setupState)).forEach((key) => {
  5352. if (!setupState.__isScriptSetup) {
  5353. if (isReservedPrefix(key[0])) {
  5354. warn$1(
  5355. `setup() return property ${JSON.stringify(
  5356. key
  5357. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  5358. );
  5359. return;
  5360. }
  5361. Object.defineProperty(ctx, key, {
  5362. enumerable: true,
  5363. configurable: true,
  5364. get: () => setupState[key],
  5365. set: NOOP
  5366. });
  5367. }
  5368. });
  5369. }
  5370. const warnRuntimeUsage = (method) => warn$1(
  5371. `${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.`
  5372. );
  5373. function defineProps() {
  5374. {
  5375. warnRuntimeUsage(`defineProps`);
  5376. }
  5377. return null;
  5378. }
  5379. function defineEmits() {
  5380. {
  5381. warnRuntimeUsage(`defineEmits`);
  5382. }
  5383. return null;
  5384. }
  5385. function defineExpose(exposed) {
  5386. {
  5387. warnRuntimeUsage(`defineExpose`);
  5388. }
  5389. }
  5390. function defineOptions(options) {
  5391. {
  5392. warnRuntimeUsage(`defineOptions`);
  5393. }
  5394. }
  5395. function defineSlots() {
  5396. {
  5397. warnRuntimeUsage(`defineSlots`);
  5398. }
  5399. return null;
  5400. }
  5401. function defineModel() {
  5402. {
  5403. warnRuntimeUsage("defineModel");
  5404. }
  5405. }
  5406. function withDefaults(props, defaults) {
  5407. {
  5408. warnRuntimeUsage(`withDefaults`);
  5409. }
  5410. return null;
  5411. }
  5412. function useSlots() {
  5413. return getContext().slots;
  5414. }
  5415. function useAttrs() {
  5416. return getContext().attrs;
  5417. }
  5418. function getContext() {
  5419. const i = getCurrentInstance();
  5420. if (!i) {
  5421. warn$1(`useContext() called without active instance.`);
  5422. }
  5423. return i.setupContext || (i.setupContext = createSetupContext(i));
  5424. }
  5425. function normalizePropsOrEmits(props) {
  5426. return isArray(props) ? props.reduce(
  5427. (normalized, p) => (normalized[p] = null, normalized),
  5428. {}
  5429. ) : props;
  5430. }
  5431. function mergeDefaults(raw, defaults) {
  5432. const props = normalizePropsOrEmits(raw);
  5433. for (const key in defaults) {
  5434. if (key.startsWith("__skip")) continue;
  5435. let opt = props[key];
  5436. if (opt) {
  5437. if (isArray(opt) || isFunction(opt)) {
  5438. opt = props[key] = { type: opt, default: defaults[key] };
  5439. } else {
  5440. opt.default = defaults[key];
  5441. }
  5442. } else if (opt === null) {
  5443. opt = props[key] = { default: defaults[key] };
  5444. } else {
  5445. warn$1(`props default key "${key}" has no corresponding declaration.`);
  5446. }
  5447. if (opt && defaults[`__skip_${key}`]) {
  5448. opt.skipFactory = true;
  5449. }
  5450. }
  5451. return props;
  5452. }
  5453. function mergeModels(a, b) {
  5454. if (!a || !b) return a || b;
  5455. if (isArray(a) && isArray(b)) return a.concat(b);
  5456. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  5457. }
  5458. function createPropsRestProxy(props, excludedKeys) {
  5459. const ret = {};
  5460. for (const key in props) {
  5461. if (!excludedKeys.includes(key)) {
  5462. Object.defineProperty(ret, key, {
  5463. enumerable: true,
  5464. get: () => props[key]
  5465. });
  5466. }
  5467. }
  5468. return ret;
  5469. }
  5470. function withAsyncContext(getAwaitable) {
  5471. const ctx = getCurrentInstance();
  5472. if (!ctx) {
  5473. warn$1(
  5474. `withAsyncContext called without active current instance. This is likely a bug.`
  5475. );
  5476. }
  5477. let awaitable = getAwaitable();
  5478. unsetCurrentInstance();
  5479. if (isPromise(awaitable)) {
  5480. awaitable = awaitable.catch((e) => {
  5481. setCurrentInstance(ctx);
  5482. throw e;
  5483. });
  5484. }
  5485. return [awaitable, () => setCurrentInstance(ctx)];
  5486. }
  5487. function createDuplicateChecker() {
  5488. const cache = /* @__PURE__ */ Object.create(null);
  5489. return (type, key) => {
  5490. if (cache[key]) {
  5491. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  5492. } else {
  5493. cache[key] = type;
  5494. }
  5495. };
  5496. }
  5497. let shouldCacheAccess = true;
  5498. function applyOptions(instance) {
  5499. const options = resolveMergedOptions(instance);
  5500. const publicThis = instance.proxy;
  5501. const ctx = instance.ctx;
  5502. shouldCacheAccess = false;
  5503. if (options.beforeCreate) {
  5504. callHook$1(options.beforeCreate, instance, "bc");
  5505. }
  5506. const {
  5507. // state
  5508. data: dataOptions,
  5509. computed: computedOptions,
  5510. methods,
  5511. watch: watchOptions,
  5512. provide: provideOptions,
  5513. inject: injectOptions,
  5514. // lifecycle
  5515. created,
  5516. beforeMount,
  5517. mounted,
  5518. beforeUpdate,
  5519. updated,
  5520. activated,
  5521. deactivated,
  5522. beforeDestroy,
  5523. beforeUnmount,
  5524. destroyed,
  5525. unmounted,
  5526. render,
  5527. renderTracked,
  5528. renderTriggered,
  5529. errorCaptured,
  5530. serverPrefetch,
  5531. // public API
  5532. expose,
  5533. inheritAttrs,
  5534. // assets
  5535. components,
  5536. directives,
  5537. filters
  5538. } = options;
  5539. const checkDuplicateProperties = createDuplicateChecker() ;
  5540. {
  5541. const [propsOptions] = instance.propsOptions;
  5542. if (propsOptions) {
  5543. for (const key in propsOptions) {
  5544. checkDuplicateProperties("Props" /* PROPS */, key);
  5545. }
  5546. }
  5547. }
  5548. if (injectOptions) {
  5549. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  5550. }
  5551. if (methods) {
  5552. for (const key in methods) {
  5553. const methodHandler = methods[key];
  5554. if (isFunction(methodHandler)) {
  5555. {
  5556. Object.defineProperty(ctx, key, {
  5557. value: methodHandler.bind(publicThis),
  5558. configurable: true,
  5559. enumerable: true,
  5560. writable: true
  5561. });
  5562. }
  5563. {
  5564. checkDuplicateProperties("Methods" /* METHODS */, key);
  5565. }
  5566. } else {
  5567. warn$1(
  5568. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  5569. );
  5570. }
  5571. }
  5572. }
  5573. if (dataOptions) {
  5574. if (!isFunction(dataOptions)) {
  5575. warn$1(
  5576. `The data option must be a function. Plain object usage is no longer supported.`
  5577. );
  5578. }
  5579. const data = dataOptions.call(publicThis, publicThis);
  5580. if (isPromise(data)) {
  5581. warn$1(
  5582. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  5583. );
  5584. }
  5585. if (!isObject(data)) {
  5586. warn$1(`data() should return an object.`);
  5587. } else {
  5588. instance.data = reactive(data);
  5589. {
  5590. for (const key in data) {
  5591. checkDuplicateProperties("Data" /* DATA */, key);
  5592. if (!isReservedPrefix(key[0])) {
  5593. Object.defineProperty(ctx, key, {
  5594. configurable: true,
  5595. enumerable: true,
  5596. get: () => data[key],
  5597. set: NOOP
  5598. });
  5599. }
  5600. }
  5601. }
  5602. }
  5603. }
  5604. shouldCacheAccess = true;
  5605. if (computedOptions) {
  5606. for (const key in computedOptions) {
  5607. const opt = computedOptions[key];
  5608. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  5609. if (get === NOOP) {
  5610. warn$1(`Computed property "${key}" has no getter.`);
  5611. }
  5612. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  5613. warn$1(
  5614. `Write operation failed: computed property "${key}" is readonly.`
  5615. );
  5616. } ;
  5617. const c = computed({
  5618. get,
  5619. set
  5620. });
  5621. Object.defineProperty(ctx, key, {
  5622. enumerable: true,
  5623. configurable: true,
  5624. get: () => c.value,
  5625. set: (v) => c.value = v
  5626. });
  5627. {
  5628. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  5629. }
  5630. }
  5631. }
  5632. if (watchOptions) {
  5633. for (const key in watchOptions) {
  5634. createWatcher(watchOptions[key], ctx, publicThis, key);
  5635. }
  5636. }
  5637. if (provideOptions) {
  5638. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  5639. Reflect.ownKeys(provides).forEach((key) => {
  5640. provide(key, provides[key]);
  5641. });
  5642. }
  5643. if (created) {
  5644. callHook$1(created, instance, "c");
  5645. }
  5646. function registerLifecycleHook(register, hook) {
  5647. if (isArray(hook)) {
  5648. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  5649. } else if (hook) {
  5650. register(hook.bind(publicThis));
  5651. }
  5652. }
  5653. registerLifecycleHook(onBeforeMount, beforeMount);
  5654. registerLifecycleHook(onMounted, mounted);
  5655. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  5656. registerLifecycleHook(onUpdated, updated);
  5657. registerLifecycleHook(onActivated, activated);
  5658. registerLifecycleHook(onDeactivated, deactivated);
  5659. registerLifecycleHook(onErrorCaptured, errorCaptured);
  5660. registerLifecycleHook(onRenderTracked, renderTracked);
  5661. registerLifecycleHook(onRenderTriggered, renderTriggered);
  5662. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  5663. registerLifecycleHook(onUnmounted, unmounted);
  5664. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  5665. if (isArray(expose)) {
  5666. if (expose.length) {
  5667. const exposed = instance.exposed || (instance.exposed = {});
  5668. expose.forEach((key) => {
  5669. Object.defineProperty(exposed, key, {
  5670. get: () => publicThis[key],
  5671. set: (val) => publicThis[key] = val
  5672. });
  5673. });
  5674. } else if (!instance.exposed) {
  5675. instance.exposed = {};
  5676. }
  5677. }
  5678. if (render && instance.render === NOOP) {
  5679. instance.render = render;
  5680. }
  5681. if (inheritAttrs != null) {
  5682. instance.inheritAttrs = inheritAttrs;
  5683. }
  5684. if (components) instance.components = components;
  5685. if (directives) instance.directives = directives;
  5686. }
  5687. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  5688. if (isArray(injectOptions)) {
  5689. injectOptions = normalizeInject(injectOptions);
  5690. }
  5691. for (const key in injectOptions) {
  5692. const opt = injectOptions[key];
  5693. let injected;
  5694. if (isObject(opt)) {
  5695. if ("default" in opt) {
  5696. injected = inject(
  5697. opt.from || key,
  5698. opt.default,
  5699. true
  5700. );
  5701. } else {
  5702. injected = inject(opt.from || key);
  5703. }
  5704. } else {
  5705. injected = inject(opt);
  5706. }
  5707. if (isRef(injected)) {
  5708. Object.defineProperty(ctx, key, {
  5709. enumerable: true,
  5710. configurable: true,
  5711. get: () => injected.value,
  5712. set: (v) => injected.value = v
  5713. });
  5714. } else {
  5715. ctx[key] = injected;
  5716. }
  5717. {
  5718. checkDuplicateProperties("Inject" /* INJECT */, key);
  5719. }
  5720. }
  5721. }
  5722. function callHook$1(hook, instance, type) {
  5723. callWithAsyncErrorHandling(
  5724. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  5725. instance,
  5726. type
  5727. );
  5728. }
  5729. function createWatcher(raw, ctx, publicThis, key) {
  5730. let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  5731. if (isString(raw)) {
  5732. const handler = ctx[raw];
  5733. if (isFunction(handler)) {
  5734. {
  5735. watch(getter, handler);
  5736. }
  5737. } else {
  5738. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  5739. }
  5740. } else if (isFunction(raw)) {
  5741. {
  5742. watch(getter, raw.bind(publicThis));
  5743. }
  5744. } else if (isObject(raw)) {
  5745. if (isArray(raw)) {
  5746. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  5747. } else {
  5748. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  5749. if (isFunction(handler)) {
  5750. watch(getter, handler, raw);
  5751. } else {
  5752. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  5753. }
  5754. }
  5755. } else {
  5756. warn$1(`Invalid watch option: "${key}"`, raw);
  5757. }
  5758. }
  5759. function resolveMergedOptions(instance) {
  5760. const base = instance.type;
  5761. const { mixins, extends: extendsOptions } = base;
  5762. const {
  5763. mixins: globalMixins,
  5764. optionsCache: cache,
  5765. config: { optionMergeStrategies }
  5766. } = instance.appContext;
  5767. const cached = cache.get(base);
  5768. let resolved;
  5769. if (cached) {
  5770. resolved = cached;
  5771. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  5772. {
  5773. resolved = base;
  5774. }
  5775. } else {
  5776. resolved = {};
  5777. if (globalMixins.length) {
  5778. globalMixins.forEach(
  5779. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  5780. );
  5781. }
  5782. mergeOptions(resolved, base, optionMergeStrategies);
  5783. }
  5784. if (isObject(base)) {
  5785. cache.set(base, resolved);
  5786. }
  5787. return resolved;
  5788. }
  5789. function mergeOptions(to, from, strats, asMixin = false) {
  5790. const { mixins, extends: extendsOptions } = from;
  5791. if (extendsOptions) {
  5792. mergeOptions(to, extendsOptions, strats, true);
  5793. }
  5794. if (mixins) {
  5795. mixins.forEach(
  5796. (m) => mergeOptions(to, m, strats, true)
  5797. );
  5798. }
  5799. for (const key in from) {
  5800. if (asMixin && key === "expose") {
  5801. warn$1(
  5802. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  5803. );
  5804. } else {
  5805. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  5806. to[key] = strat ? strat(to[key], from[key]) : from[key];
  5807. }
  5808. }
  5809. return to;
  5810. }
  5811. const internalOptionMergeStrats = {
  5812. data: mergeDataFn,
  5813. props: mergeEmitsOrPropsOptions,
  5814. emits: mergeEmitsOrPropsOptions,
  5815. // objects
  5816. methods: mergeObjectOptions,
  5817. computed: mergeObjectOptions,
  5818. // lifecycle
  5819. beforeCreate: mergeAsArray$1,
  5820. created: mergeAsArray$1,
  5821. beforeMount: mergeAsArray$1,
  5822. mounted: mergeAsArray$1,
  5823. beforeUpdate: mergeAsArray$1,
  5824. updated: mergeAsArray$1,
  5825. beforeDestroy: mergeAsArray$1,
  5826. beforeUnmount: mergeAsArray$1,
  5827. destroyed: mergeAsArray$1,
  5828. unmounted: mergeAsArray$1,
  5829. activated: mergeAsArray$1,
  5830. deactivated: mergeAsArray$1,
  5831. errorCaptured: mergeAsArray$1,
  5832. serverPrefetch: mergeAsArray$1,
  5833. // assets
  5834. components: mergeObjectOptions,
  5835. directives: mergeObjectOptions,
  5836. // watch
  5837. watch: mergeWatchOptions,
  5838. // provide / inject
  5839. provide: mergeDataFn,
  5840. inject: mergeInject
  5841. };
  5842. function mergeDataFn(to, from) {
  5843. if (!from) {
  5844. return to;
  5845. }
  5846. if (!to) {
  5847. return from;
  5848. }
  5849. return function mergedDataFn() {
  5850. return (extend)(
  5851. isFunction(to) ? to.call(this, this) : to,
  5852. isFunction(from) ? from.call(this, this) : from
  5853. );
  5854. };
  5855. }
  5856. function mergeInject(to, from) {
  5857. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  5858. }
  5859. function normalizeInject(raw) {
  5860. if (isArray(raw)) {
  5861. const res = {};
  5862. for (let i = 0; i < raw.length; i++) {
  5863. res[raw[i]] = raw[i];
  5864. }
  5865. return res;
  5866. }
  5867. return raw;
  5868. }
  5869. function mergeAsArray$1(to, from) {
  5870. return to ? [...new Set([].concat(to, from))] : from;
  5871. }
  5872. function mergeObjectOptions(to, from) {
  5873. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  5874. }
  5875. function mergeEmitsOrPropsOptions(to, from) {
  5876. if (to) {
  5877. if (isArray(to) && isArray(from)) {
  5878. return [.../* @__PURE__ */ new Set([...to, ...from])];
  5879. }
  5880. return extend(
  5881. /* @__PURE__ */ Object.create(null),
  5882. normalizePropsOrEmits(to),
  5883. normalizePropsOrEmits(from != null ? from : {})
  5884. );
  5885. } else {
  5886. return from;
  5887. }
  5888. }
  5889. function mergeWatchOptions(to, from) {
  5890. if (!to) return from;
  5891. if (!from) return to;
  5892. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  5893. for (const key in from) {
  5894. merged[key] = mergeAsArray$1(to[key], from[key]);
  5895. }
  5896. return merged;
  5897. }
  5898. function createAppContext() {
  5899. return {
  5900. app: null,
  5901. config: {
  5902. isNativeTag: NO,
  5903. performance: false,
  5904. globalProperties: {},
  5905. optionMergeStrategies: {},
  5906. errorHandler: void 0,
  5907. warnHandler: void 0,
  5908. compilerOptions: {}
  5909. },
  5910. mixins: [],
  5911. components: {},
  5912. directives: {},
  5913. provides: /* @__PURE__ */ Object.create(null),
  5914. optionsCache: /* @__PURE__ */ new WeakMap(),
  5915. propsCache: /* @__PURE__ */ new WeakMap(),
  5916. emitsCache: /* @__PURE__ */ new WeakMap()
  5917. };
  5918. }
  5919. let uid$1 = 0;
  5920. function createAppAPI(render, hydrate) {
  5921. return function createApp(rootComponent, rootProps = null) {
  5922. if (!isFunction(rootComponent)) {
  5923. rootComponent = extend({}, rootComponent);
  5924. }
  5925. if (rootProps != null && !isObject(rootProps)) {
  5926. warn$1(`root props passed to app.mount() must be an object.`);
  5927. rootProps = null;
  5928. }
  5929. const context = createAppContext();
  5930. const installedPlugins = /* @__PURE__ */ new WeakSet();
  5931. const pluginCleanupFns = [];
  5932. let isMounted = false;
  5933. const app = context.app = {
  5934. _uid: uid$1++,
  5935. _component: rootComponent,
  5936. _props: rootProps,
  5937. _container: null,
  5938. _context: context,
  5939. _instance: null,
  5940. version,
  5941. get config() {
  5942. return context.config;
  5943. },
  5944. set config(v) {
  5945. {
  5946. warn$1(
  5947. `app.config cannot be replaced. Modify individual options instead.`
  5948. );
  5949. }
  5950. },
  5951. use(plugin, ...options) {
  5952. if (installedPlugins.has(plugin)) {
  5953. warn$1(`Plugin has already been applied to target app.`);
  5954. } else if (plugin && isFunction(plugin.install)) {
  5955. installedPlugins.add(plugin);
  5956. plugin.install(app, ...options);
  5957. } else if (isFunction(plugin)) {
  5958. installedPlugins.add(plugin);
  5959. plugin(app, ...options);
  5960. } else {
  5961. warn$1(
  5962. `A plugin must either be a function or an object with an "install" function.`
  5963. );
  5964. }
  5965. return app;
  5966. },
  5967. mixin(mixin) {
  5968. {
  5969. if (!context.mixins.includes(mixin)) {
  5970. context.mixins.push(mixin);
  5971. } else {
  5972. warn$1(
  5973. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  5974. );
  5975. }
  5976. }
  5977. return app;
  5978. },
  5979. component(name, component) {
  5980. {
  5981. validateComponentName(name, context.config);
  5982. }
  5983. if (!component) {
  5984. return context.components[name];
  5985. }
  5986. if (context.components[name]) {
  5987. warn$1(`Component "${name}" has already been registered in target app.`);
  5988. }
  5989. context.components[name] = component;
  5990. return app;
  5991. },
  5992. directive(name, directive) {
  5993. {
  5994. validateDirectiveName(name);
  5995. }
  5996. if (!directive) {
  5997. return context.directives[name];
  5998. }
  5999. if (context.directives[name]) {
  6000. warn$1(`Directive "${name}" has already been registered in target app.`);
  6001. }
  6002. context.directives[name] = directive;
  6003. return app;
  6004. },
  6005. mount(rootContainer, isHydrate, namespace) {
  6006. if (!isMounted) {
  6007. if (rootContainer.__vue_app__) {
  6008. warn$1(
  6009. `There is already an app instance mounted on the host container.
  6010. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  6011. );
  6012. }
  6013. const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
  6014. vnode.appContext = context;
  6015. if (namespace === true) {
  6016. namespace = "svg";
  6017. } else if (namespace === false) {
  6018. namespace = void 0;
  6019. }
  6020. {
  6021. context.reload = () => {
  6022. render(
  6023. cloneVNode(vnode),
  6024. rootContainer,
  6025. namespace
  6026. );
  6027. };
  6028. }
  6029. if (isHydrate && hydrate) {
  6030. hydrate(vnode, rootContainer);
  6031. } else {
  6032. render(vnode, rootContainer, namespace);
  6033. }
  6034. isMounted = true;
  6035. app._container = rootContainer;
  6036. rootContainer.__vue_app__ = app;
  6037. {
  6038. app._instance = vnode.component;
  6039. devtoolsInitApp(app, version);
  6040. }
  6041. return getComponentPublicInstance(vnode.component);
  6042. } else {
  6043. warn$1(
  6044. `App has already been mounted.
  6045. 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)\``
  6046. );
  6047. }
  6048. },
  6049. onUnmount(cleanupFn) {
  6050. if (typeof cleanupFn !== "function") {
  6051. warn$1(
  6052. `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
  6053. );
  6054. }
  6055. pluginCleanupFns.push(cleanupFn);
  6056. },
  6057. unmount() {
  6058. if (isMounted) {
  6059. callWithAsyncErrorHandling(
  6060. pluginCleanupFns,
  6061. app._instance,
  6062. 16
  6063. );
  6064. render(null, app._container);
  6065. {
  6066. app._instance = null;
  6067. devtoolsUnmountApp(app);
  6068. }
  6069. delete app._container.__vue_app__;
  6070. } else {
  6071. warn$1(`Cannot unmount an app that is not mounted.`);
  6072. }
  6073. },
  6074. provide(key, value) {
  6075. if (key in context.provides) {
  6076. warn$1(
  6077. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  6078. );
  6079. }
  6080. context.provides[key] = value;
  6081. return app;
  6082. },
  6083. runWithContext(fn) {
  6084. const lastApp = currentApp;
  6085. currentApp = app;
  6086. try {
  6087. return fn();
  6088. } finally {
  6089. currentApp = lastApp;
  6090. }
  6091. }
  6092. };
  6093. return app;
  6094. };
  6095. }
  6096. let currentApp = null;
  6097. function provide(key, value) {
  6098. if (!currentInstance) {
  6099. {
  6100. warn$1(`provide() can only be used inside setup().`);
  6101. }
  6102. } else {
  6103. let provides = currentInstance.provides;
  6104. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  6105. if (parentProvides === provides) {
  6106. provides = currentInstance.provides = Object.create(parentProvides);
  6107. }
  6108. provides[key] = value;
  6109. }
  6110. }
  6111. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  6112. const instance = currentInstance || currentRenderingInstance;
  6113. if (instance || currentApp) {
  6114. const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  6115. if (provides && key in provides) {
  6116. return provides[key];
  6117. } else if (arguments.length > 1) {
  6118. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  6119. } else {
  6120. warn$1(`injection "${String(key)}" not found.`);
  6121. }
  6122. } else {
  6123. warn$1(`inject() can only be used inside setup() or functional components.`);
  6124. }
  6125. }
  6126. function hasInjectionContext() {
  6127. return !!(currentInstance || currentRenderingInstance || currentApp);
  6128. }
  6129. const internalObjectProto = {};
  6130. const createInternalObject = () => Object.create(internalObjectProto);
  6131. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  6132. function initProps(instance, rawProps, isStateful, isSSR = false) {
  6133. const props = {};
  6134. const attrs = createInternalObject();
  6135. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  6136. setFullProps(instance, rawProps, props, attrs);
  6137. for (const key in instance.propsOptions[0]) {
  6138. if (!(key in props)) {
  6139. props[key] = void 0;
  6140. }
  6141. }
  6142. {
  6143. validateProps(rawProps || {}, props, instance);
  6144. }
  6145. if (isStateful) {
  6146. instance.props = isSSR ? props : shallowReactive(props);
  6147. } else {
  6148. if (!instance.type.props) {
  6149. instance.props = attrs;
  6150. } else {
  6151. instance.props = props;
  6152. }
  6153. }
  6154. instance.attrs = attrs;
  6155. }
  6156. function isInHmrContext(instance) {
  6157. while (instance) {
  6158. if (instance.type.__hmrId) return true;
  6159. instance = instance.parent;
  6160. }
  6161. }
  6162. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  6163. const {
  6164. props,
  6165. attrs,
  6166. vnode: { patchFlag }
  6167. } = instance;
  6168. const rawCurrentProps = toRaw(props);
  6169. const [options] = instance.propsOptions;
  6170. let hasAttrsChanged = false;
  6171. if (
  6172. // always force full diff in dev
  6173. // - #1942 if hmr is enabled with sfc component
  6174. // - vite#872 non-sfc component used by sfc component
  6175. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  6176. ) {
  6177. if (patchFlag & 8) {
  6178. const propsToUpdate = instance.vnode.dynamicProps;
  6179. for (let i = 0; i < propsToUpdate.length; i++) {
  6180. let key = propsToUpdate[i];
  6181. if (isEmitListener(instance.emitsOptions, key)) {
  6182. continue;
  6183. }
  6184. const value = rawProps[key];
  6185. if (options) {
  6186. if (hasOwn(attrs, key)) {
  6187. if (value !== attrs[key]) {
  6188. attrs[key] = value;
  6189. hasAttrsChanged = true;
  6190. }
  6191. } else {
  6192. const camelizedKey = camelize(key);
  6193. props[camelizedKey] = resolvePropValue(
  6194. options,
  6195. rawCurrentProps,
  6196. camelizedKey,
  6197. value,
  6198. instance,
  6199. false
  6200. );
  6201. }
  6202. } else {
  6203. if (value !== attrs[key]) {
  6204. attrs[key] = value;
  6205. hasAttrsChanged = true;
  6206. }
  6207. }
  6208. }
  6209. }
  6210. } else {
  6211. if (setFullProps(instance, rawProps, props, attrs)) {
  6212. hasAttrsChanged = true;
  6213. }
  6214. let kebabKey;
  6215. for (const key in rawCurrentProps) {
  6216. if (!rawProps || // for camelCase
  6217. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  6218. // and converted to camelCase (#955)
  6219. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  6220. if (options) {
  6221. if (rawPrevProps && // for camelCase
  6222. (rawPrevProps[key] !== void 0 || // for kebab-case
  6223. rawPrevProps[kebabKey] !== void 0)) {
  6224. props[key] = resolvePropValue(
  6225. options,
  6226. rawCurrentProps,
  6227. key,
  6228. void 0,
  6229. instance,
  6230. true
  6231. );
  6232. }
  6233. } else {
  6234. delete props[key];
  6235. }
  6236. }
  6237. }
  6238. if (attrs !== rawCurrentProps) {
  6239. for (const key in attrs) {
  6240. if (!rawProps || !hasOwn(rawProps, key) && true) {
  6241. delete attrs[key];
  6242. hasAttrsChanged = true;
  6243. }
  6244. }
  6245. }
  6246. }
  6247. if (hasAttrsChanged) {
  6248. trigger(instance.attrs, "set", "");
  6249. }
  6250. {
  6251. validateProps(rawProps || {}, props, instance);
  6252. }
  6253. }
  6254. function setFullProps(instance, rawProps, props, attrs) {
  6255. const [options, needCastKeys] = instance.propsOptions;
  6256. let hasAttrsChanged = false;
  6257. let rawCastValues;
  6258. if (rawProps) {
  6259. for (let key in rawProps) {
  6260. if (isReservedProp(key)) {
  6261. continue;
  6262. }
  6263. const value = rawProps[key];
  6264. let camelKey;
  6265. if (options && hasOwn(options, camelKey = camelize(key))) {
  6266. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  6267. props[camelKey] = value;
  6268. } else {
  6269. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  6270. }
  6271. } else if (!isEmitListener(instance.emitsOptions, key)) {
  6272. if (!(key in attrs) || value !== attrs[key]) {
  6273. attrs[key] = value;
  6274. hasAttrsChanged = true;
  6275. }
  6276. }
  6277. }
  6278. }
  6279. if (needCastKeys) {
  6280. const rawCurrentProps = toRaw(props);
  6281. const castValues = rawCastValues || EMPTY_OBJ;
  6282. for (let i = 0; i < needCastKeys.length; i++) {
  6283. const key = needCastKeys[i];
  6284. props[key] = resolvePropValue(
  6285. options,
  6286. rawCurrentProps,
  6287. key,
  6288. castValues[key],
  6289. instance,
  6290. !hasOwn(castValues, key)
  6291. );
  6292. }
  6293. }
  6294. return hasAttrsChanged;
  6295. }
  6296. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  6297. const opt = options[key];
  6298. if (opt != null) {
  6299. const hasDefault = hasOwn(opt, "default");
  6300. if (hasDefault && value === void 0) {
  6301. const defaultValue = opt.default;
  6302. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  6303. const { propsDefaults } = instance;
  6304. if (key in propsDefaults) {
  6305. value = propsDefaults[key];
  6306. } else {
  6307. const reset = setCurrentInstance(instance);
  6308. value = propsDefaults[key] = defaultValue.call(
  6309. null,
  6310. props
  6311. );
  6312. reset();
  6313. }
  6314. } else {
  6315. value = defaultValue;
  6316. }
  6317. if (instance.ce) {
  6318. instance.ce._setProp(key, value);
  6319. }
  6320. }
  6321. if (opt[0 /* shouldCast */]) {
  6322. if (isAbsent && !hasDefault) {
  6323. value = false;
  6324. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  6325. value = true;
  6326. }
  6327. }
  6328. }
  6329. return value;
  6330. }
  6331. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  6332. function normalizePropsOptions(comp, appContext, asMixin = false) {
  6333. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  6334. const cached = cache.get(comp);
  6335. if (cached) {
  6336. return cached;
  6337. }
  6338. const raw = comp.props;
  6339. const normalized = {};
  6340. const needCastKeys = [];
  6341. let hasExtends = false;
  6342. if (!isFunction(comp)) {
  6343. const extendProps = (raw2) => {
  6344. hasExtends = true;
  6345. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  6346. extend(normalized, props);
  6347. if (keys) needCastKeys.push(...keys);
  6348. };
  6349. if (!asMixin && appContext.mixins.length) {
  6350. appContext.mixins.forEach(extendProps);
  6351. }
  6352. if (comp.extends) {
  6353. extendProps(comp.extends);
  6354. }
  6355. if (comp.mixins) {
  6356. comp.mixins.forEach(extendProps);
  6357. }
  6358. }
  6359. if (!raw && !hasExtends) {
  6360. if (isObject(comp)) {
  6361. cache.set(comp, EMPTY_ARR);
  6362. }
  6363. return EMPTY_ARR;
  6364. }
  6365. if (isArray(raw)) {
  6366. for (let i = 0; i < raw.length; i++) {
  6367. if (!isString(raw[i])) {
  6368. warn$1(`props must be strings when using array syntax.`, raw[i]);
  6369. }
  6370. const normalizedKey = camelize(raw[i]);
  6371. if (validatePropName(normalizedKey)) {
  6372. normalized[normalizedKey] = EMPTY_OBJ;
  6373. }
  6374. }
  6375. } else if (raw) {
  6376. if (!isObject(raw)) {
  6377. warn$1(`invalid props options`, raw);
  6378. }
  6379. for (const key in raw) {
  6380. const normalizedKey = camelize(key);
  6381. if (validatePropName(normalizedKey)) {
  6382. const opt = raw[key];
  6383. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  6384. const propType = prop.type;
  6385. let shouldCast = false;
  6386. let shouldCastTrue = true;
  6387. if (isArray(propType)) {
  6388. for (let index = 0; index < propType.length; ++index) {
  6389. const type = propType[index];
  6390. const typeName = isFunction(type) && type.name;
  6391. if (typeName === "Boolean") {
  6392. shouldCast = true;
  6393. break;
  6394. } else if (typeName === "String") {
  6395. shouldCastTrue = false;
  6396. }
  6397. }
  6398. } else {
  6399. shouldCast = isFunction(propType) && propType.name === "Boolean";
  6400. }
  6401. prop[0 /* shouldCast */] = shouldCast;
  6402. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  6403. if (shouldCast || hasOwn(prop, "default")) {
  6404. needCastKeys.push(normalizedKey);
  6405. }
  6406. }
  6407. }
  6408. }
  6409. const res = [normalized, needCastKeys];
  6410. if (isObject(comp)) {
  6411. cache.set(comp, res);
  6412. }
  6413. return res;
  6414. }
  6415. function validatePropName(key) {
  6416. if (key[0] !== "$" && !isReservedProp(key)) {
  6417. return true;
  6418. } else {
  6419. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  6420. }
  6421. return false;
  6422. }
  6423. function getType(ctor) {
  6424. if (ctor === null) {
  6425. return "null";
  6426. }
  6427. if (typeof ctor === "function") {
  6428. return ctor.name || "";
  6429. } else if (typeof ctor === "object") {
  6430. const name = ctor.constructor && ctor.constructor.name;
  6431. return name || "";
  6432. }
  6433. return "";
  6434. }
  6435. function validateProps(rawProps, props, instance) {
  6436. const resolvedValues = toRaw(props);
  6437. const options = instance.propsOptions[0];
  6438. const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
  6439. for (const key in options) {
  6440. let opt = options[key];
  6441. if (opt == null) continue;
  6442. validateProp(
  6443. key,
  6444. resolvedValues[key],
  6445. opt,
  6446. shallowReadonly(resolvedValues) ,
  6447. !camelizePropsKey.includes(key)
  6448. );
  6449. }
  6450. }
  6451. function validateProp(name, value, prop, props, isAbsent) {
  6452. const { type, required, validator, skipCheck } = prop;
  6453. if (required && isAbsent) {
  6454. warn$1('Missing required prop: "' + name + '"');
  6455. return;
  6456. }
  6457. if (value == null && !required) {
  6458. return;
  6459. }
  6460. if (type != null && type !== true && !skipCheck) {
  6461. let isValid = false;
  6462. const types = isArray(type) ? type : [type];
  6463. const expectedTypes = [];
  6464. for (let i = 0; i < types.length && !isValid; i++) {
  6465. const { valid, expectedType } = assertType(value, types[i]);
  6466. expectedTypes.push(expectedType || "");
  6467. isValid = valid;
  6468. }
  6469. if (!isValid) {
  6470. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  6471. return;
  6472. }
  6473. }
  6474. if (validator && !validator(value, props)) {
  6475. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  6476. }
  6477. }
  6478. const isSimpleType = /* @__PURE__ */ makeMap(
  6479. "String,Number,Boolean,Function,Symbol,BigInt"
  6480. );
  6481. function assertType(value, type) {
  6482. let valid;
  6483. const expectedType = getType(type);
  6484. if (expectedType === "null") {
  6485. valid = value === null;
  6486. } else if (isSimpleType(expectedType)) {
  6487. const t = typeof value;
  6488. valid = t === expectedType.toLowerCase();
  6489. if (!valid && t === "object") {
  6490. valid = value instanceof type;
  6491. }
  6492. } else if (expectedType === "Object") {
  6493. valid = isObject(value);
  6494. } else if (expectedType === "Array") {
  6495. valid = isArray(value);
  6496. } else {
  6497. valid = value instanceof type;
  6498. }
  6499. return {
  6500. valid,
  6501. expectedType
  6502. };
  6503. }
  6504. function getInvalidTypeMessage(name, value, expectedTypes) {
  6505. if (expectedTypes.length === 0) {
  6506. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  6507. }
  6508. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  6509. const expectedType = expectedTypes[0];
  6510. const receivedType = toRawType(value);
  6511. const expectedValue = styleValue(value, expectedType);
  6512. const receivedValue = styleValue(value, receivedType);
  6513. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  6514. message += ` with value ${expectedValue}`;
  6515. }
  6516. message += `, got ${receivedType} `;
  6517. if (isExplicable(receivedType)) {
  6518. message += `with value ${receivedValue}.`;
  6519. }
  6520. return message;
  6521. }
  6522. function styleValue(value, type) {
  6523. if (type === "String") {
  6524. return `"${value}"`;
  6525. } else if (type === "Number") {
  6526. return `${Number(value)}`;
  6527. } else {
  6528. return `${value}`;
  6529. }
  6530. }
  6531. function isExplicable(type) {
  6532. const explicitTypes = ["string", "number", "boolean"];
  6533. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  6534. }
  6535. function isBoolean(...args) {
  6536. return args.some((elem) => elem.toLowerCase() === "boolean");
  6537. }
  6538. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  6539. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  6540. const normalizeSlot = (key, rawSlot, ctx) => {
  6541. if (rawSlot._n) {
  6542. return rawSlot;
  6543. }
  6544. const normalized = withCtx((...args) => {
  6545. if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
  6546. warn$1(
  6547. `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.`
  6548. );
  6549. }
  6550. return normalizeSlotValue(rawSlot(...args));
  6551. }, ctx);
  6552. normalized._c = false;
  6553. return normalized;
  6554. };
  6555. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  6556. const ctx = rawSlots._ctx;
  6557. for (const key in rawSlots) {
  6558. if (isInternalKey(key)) continue;
  6559. const value = rawSlots[key];
  6560. if (isFunction(value)) {
  6561. slots[key] = normalizeSlot(key, value, ctx);
  6562. } else if (value != null) {
  6563. {
  6564. warn$1(
  6565. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  6566. );
  6567. }
  6568. const normalized = normalizeSlotValue(value);
  6569. slots[key] = () => normalized;
  6570. }
  6571. }
  6572. };
  6573. const normalizeVNodeSlots = (instance, children) => {
  6574. if (!isKeepAlive(instance.vnode) && true) {
  6575. warn$1(
  6576. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  6577. );
  6578. }
  6579. const normalized = normalizeSlotValue(children);
  6580. instance.slots.default = () => normalized;
  6581. };
  6582. const assignSlots = (slots, children, optimized) => {
  6583. for (const key in children) {
  6584. if (optimized || key !== "_") {
  6585. slots[key] = children[key];
  6586. }
  6587. }
  6588. };
  6589. const initSlots = (instance, children, optimized) => {
  6590. const slots = instance.slots = createInternalObject();
  6591. if (instance.vnode.shapeFlag & 32) {
  6592. const type = children._;
  6593. if (type) {
  6594. assignSlots(slots, children, optimized);
  6595. if (optimized) {
  6596. def(slots, "_", type, true);
  6597. }
  6598. } else {
  6599. normalizeObjectSlots(children, slots);
  6600. }
  6601. } else if (children) {
  6602. normalizeVNodeSlots(instance, children);
  6603. }
  6604. };
  6605. const updateSlots = (instance, children, optimized) => {
  6606. const { vnode, slots } = instance;
  6607. let needDeletionCheck = true;
  6608. let deletionComparisonTarget = EMPTY_OBJ;
  6609. if (vnode.shapeFlag & 32) {
  6610. const type = children._;
  6611. if (type) {
  6612. if (isHmrUpdating) {
  6613. assignSlots(slots, children, optimized);
  6614. trigger(instance, "set", "$slots");
  6615. } else if (optimized && type === 1) {
  6616. needDeletionCheck = false;
  6617. } else {
  6618. assignSlots(slots, children, optimized);
  6619. }
  6620. } else {
  6621. needDeletionCheck = !children.$stable;
  6622. normalizeObjectSlots(children, slots);
  6623. }
  6624. deletionComparisonTarget = children;
  6625. } else if (children) {
  6626. normalizeVNodeSlots(instance, children);
  6627. deletionComparisonTarget = { default: 1 };
  6628. }
  6629. if (needDeletionCheck) {
  6630. for (const key in slots) {
  6631. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  6632. delete slots[key];
  6633. }
  6634. }
  6635. }
  6636. };
  6637. let supported;
  6638. let perf;
  6639. function startMeasure(instance, type) {
  6640. if (instance.appContext.config.performance && isSupported()) {
  6641. perf.mark(`vue-${type}-${instance.uid}`);
  6642. }
  6643. {
  6644. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6645. }
  6646. }
  6647. function endMeasure(instance, type) {
  6648. if (instance.appContext.config.performance && isSupported()) {
  6649. const startTag = `vue-${type}-${instance.uid}`;
  6650. const endTag = startTag + `:end`;
  6651. perf.mark(endTag);
  6652. perf.measure(
  6653. `<${formatComponentName(instance, instance.type)}> ${type}`,
  6654. startTag,
  6655. endTag
  6656. );
  6657. perf.clearMarks(startTag);
  6658. perf.clearMarks(endTag);
  6659. }
  6660. {
  6661. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6662. }
  6663. }
  6664. function isSupported() {
  6665. if (supported !== void 0) {
  6666. return supported;
  6667. }
  6668. if (typeof window !== "undefined" && window.performance) {
  6669. supported = true;
  6670. perf = window.performance;
  6671. } else {
  6672. supported = false;
  6673. }
  6674. return supported;
  6675. }
  6676. const queuePostRenderEffect = queueEffectWithSuspense ;
  6677. function createRenderer(options) {
  6678. return baseCreateRenderer(options);
  6679. }
  6680. function createHydrationRenderer(options) {
  6681. return baseCreateRenderer(options, createHydrationFunctions);
  6682. }
  6683. function baseCreateRenderer(options, createHydrationFns) {
  6684. const target = getGlobalThis();
  6685. target.__VUE__ = true;
  6686. {
  6687. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6688. }
  6689. const {
  6690. insert: hostInsert,
  6691. remove: hostRemove,
  6692. patchProp: hostPatchProp,
  6693. createElement: hostCreateElement,
  6694. createText: hostCreateText,
  6695. createComment: hostCreateComment,
  6696. setText: hostSetText,
  6697. setElementText: hostSetElementText,
  6698. parentNode: hostParentNode,
  6699. nextSibling: hostNextSibling,
  6700. setScopeId: hostSetScopeId = NOOP,
  6701. insertStaticContent: hostInsertStaticContent
  6702. } = options;
  6703. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6704. if (n1 === n2) {
  6705. return;
  6706. }
  6707. if (n1 && !isSameVNodeType(n1, n2)) {
  6708. anchor = getNextHostNode(n1);
  6709. unmount(n1, parentComponent, parentSuspense, true);
  6710. n1 = null;
  6711. }
  6712. if (n2.patchFlag === -2) {
  6713. optimized = false;
  6714. n2.dynamicChildren = null;
  6715. }
  6716. const { type, ref, shapeFlag } = n2;
  6717. switch (type) {
  6718. case Text:
  6719. processText(n1, n2, container, anchor);
  6720. break;
  6721. case Comment:
  6722. processCommentNode(n1, n2, container, anchor);
  6723. break;
  6724. case Static:
  6725. if (n1 == null) {
  6726. mountStaticNode(n2, container, anchor, namespace);
  6727. } else {
  6728. patchStaticNode(n1, n2, container, namespace);
  6729. }
  6730. break;
  6731. case Fragment:
  6732. processFragment(
  6733. n1,
  6734. n2,
  6735. container,
  6736. anchor,
  6737. parentComponent,
  6738. parentSuspense,
  6739. namespace,
  6740. slotScopeIds,
  6741. optimized
  6742. );
  6743. break;
  6744. default:
  6745. if (shapeFlag & 1) {
  6746. processElement(
  6747. n1,
  6748. n2,
  6749. container,
  6750. anchor,
  6751. parentComponent,
  6752. parentSuspense,
  6753. namespace,
  6754. slotScopeIds,
  6755. optimized
  6756. );
  6757. } else if (shapeFlag & 6) {
  6758. processComponent(
  6759. n1,
  6760. n2,
  6761. container,
  6762. anchor,
  6763. parentComponent,
  6764. parentSuspense,
  6765. namespace,
  6766. slotScopeIds,
  6767. optimized
  6768. );
  6769. } else if (shapeFlag & 64) {
  6770. type.process(
  6771. n1,
  6772. n2,
  6773. container,
  6774. anchor,
  6775. parentComponent,
  6776. parentSuspense,
  6777. namespace,
  6778. slotScopeIds,
  6779. optimized,
  6780. internals
  6781. );
  6782. } else if (shapeFlag & 128) {
  6783. type.process(
  6784. n1,
  6785. n2,
  6786. container,
  6787. anchor,
  6788. parentComponent,
  6789. parentSuspense,
  6790. namespace,
  6791. slotScopeIds,
  6792. optimized,
  6793. internals
  6794. );
  6795. } else {
  6796. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  6797. }
  6798. }
  6799. if (ref != null && parentComponent) {
  6800. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6801. }
  6802. };
  6803. const processText = (n1, n2, container, anchor) => {
  6804. if (n1 == null) {
  6805. hostInsert(
  6806. n2.el = hostCreateText(n2.children),
  6807. container,
  6808. anchor
  6809. );
  6810. } else {
  6811. const el = n2.el = n1.el;
  6812. if (n2.children !== n1.children) {
  6813. hostSetText(el, n2.children);
  6814. }
  6815. }
  6816. };
  6817. const processCommentNode = (n1, n2, container, anchor) => {
  6818. if (n1 == null) {
  6819. hostInsert(
  6820. n2.el = hostCreateComment(n2.children || ""),
  6821. container,
  6822. anchor
  6823. );
  6824. } else {
  6825. n2.el = n1.el;
  6826. }
  6827. };
  6828. const mountStaticNode = (n2, container, anchor, namespace) => {
  6829. [n2.el, n2.anchor] = hostInsertStaticContent(
  6830. n2.children,
  6831. container,
  6832. anchor,
  6833. namespace,
  6834. n2.el,
  6835. n2.anchor
  6836. );
  6837. };
  6838. const patchStaticNode = (n1, n2, container, namespace) => {
  6839. if (n2.children !== n1.children) {
  6840. const anchor = hostNextSibling(n1.anchor);
  6841. removeStaticNode(n1);
  6842. [n2.el, n2.anchor] = hostInsertStaticContent(
  6843. n2.children,
  6844. container,
  6845. anchor,
  6846. namespace
  6847. );
  6848. } else {
  6849. n2.el = n1.el;
  6850. n2.anchor = n1.anchor;
  6851. }
  6852. };
  6853. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  6854. let next;
  6855. while (el && el !== anchor) {
  6856. next = hostNextSibling(el);
  6857. hostInsert(el, container, nextSibling);
  6858. el = next;
  6859. }
  6860. hostInsert(anchor, container, nextSibling);
  6861. };
  6862. const removeStaticNode = ({ el, anchor }) => {
  6863. let next;
  6864. while (el && el !== anchor) {
  6865. next = hostNextSibling(el);
  6866. hostRemove(el);
  6867. el = next;
  6868. }
  6869. hostRemove(anchor);
  6870. };
  6871. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6872. if (n2.type === "svg") {
  6873. namespace = "svg";
  6874. } else if (n2.type === "math") {
  6875. namespace = "mathml";
  6876. }
  6877. if (n1 == null) {
  6878. mountElement(
  6879. n2,
  6880. container,
  6881. anchor,
  6882. parentComponent,
  6883. parentSuspense,
  6884. namespace,
  6885. slotScopeIds,
  6886. optimized
  6887. );
  6888. } else {
  6889. patchElement(
  6890. n1,
  6891. n2,
  6892. parentComponent,
  6893. parentSuspense,
  6894. namespace,
  6895. slotScopeIds,
  6896. optimized
  6897. );
  6898. }
  6899. };
  6900. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6901. let el;
  6902. let vnodeHook;
  6903. const { props, shapeFlag, transition, dirs } = vnode;
  6904. el = vnode.el = hostCreateElement(
  6905. vnode.type,
  6906. namespace,
  6907. props && props.is,
  6908. props
  6909. );
  6910. if (shapeFlag & 8) {
  6911. hostSetElementText(el, vnode.children);
  6912. } else if (shapeFlag & 16) {
  6913. mountChildren(
  6914. vnode.children,
  6915. el,
  6916. null,
  6917. parentComponent,
  6918. parentSuspense,
  6919. resolveChildrenNamespace(vnode, namespace),
  6920. slotScopeIds,
  6921. optimized
  6922. );
  6923. }
  6924. if (dirs) {
  6925. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6926. }
  6927. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6928. if (props) {
  6929. for (const key in props) {
  6930. if (key !== "value" && !isReservedProp(key)) {
  6931. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  6932. }
  6933. }
  6934. if ("value" in props) {
  6935. hostPatchProp(el, "value", null, props.value, namespace);
  6936. }
  6937. if (vnodeHook = props.onVnodeBeforeMount) {
  6938. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6939. }
  6940. }
  6941. {
  6942. def(el, "__vnode", vnode, true);
  6943. def(el, "__vueParentComponent", parentComponent, true);
  6944. }
  6945. if (dirs) {
  6946. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6947. }
  6948. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  6949. if (needCallTransitionHooks) {
  6950. transition.beforeEnter(el);
  6951. }
  6952. hostInsert(el, container, anchor);
  6953. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6954. queuePostRenderEffect(() => {
  6955. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6956. needCallTransitionHooks && transition.enter(el);
  6957. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6958. }, parentSuspense);
  6959. }
  6960. };
  6961. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6962. if (scopeId) {
  6963. hostSetScopeId(el, scopeId);
  6964. }
  6965. if (slotScopeIds) {
  6966. for (let i = 0; i < slotScopeIds.length; i++) {
  6967. hostSetScopeId(el, slotScopeIds[i]);
  6968. }
  6969. }
  6970. if (parentComponent) {
  6971. let subTree = parentComponent.subTree;
  6972. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  6973. subTree = filterSingleRoot(subTree.children) || subTree;
  6974. }
  6975. if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
  6976. const parentVNode = parentComponent.vnode;
  6977. setScopeId(
  6978. el,
  6979. parentVNode,
  6980. parentVNode.scopeId,
  6981. parentVNode.slotScopeIds,
  6982. parentComponent.parent
  6983. );
  6984. }
  6985. }
  6986. };
  6987. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  6988. for (let i = start; i < children.length; i++) {
  6989. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  6990. patch(
  6991. null,
  6992. child,
  6993. container,
  6994. anchor,
  6995. parentComponent,
  6996. parentSuspense,
  6997. namespace,
  6998. slotScopeIds,
  6999. optimized
  7000. );
  7001. }
  7002. };
  7003. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7004. const el = n2.el = n1.el;
  7005. {
  7006. el.__vnode = n2;
  7007. }
  7008. let { patchFlag, dynamicChildren, dirs } = n2;
  7009. patchFlag |= n1.patchFlag & 16;
  7010. const oldProps = n1.props || EMPTY_OBJ;
  7011. const newProps = n2.props || EMPTY_OBJ;
  7012. let vnodeHook;
  7013. parentComponent && toggleRecurse(parentComponent, false);
  7014. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  7015. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7016. }
  7017. if (dirs) {
  7018. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  7019. }
  7020. parentComponent && toggleRecurse(parentComponent, true);
  7021. if (isHmrUpdating) {
  7022. patchFlag = 0;
  7023. optimized = false;
  7024. dynamicChildren = null;
  7025. }
  7026. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  7027. hostSetElementText(el, "");
  7028. }
  7029. if (dynamicChildren) {
  7030. patchBlockChildren(
  7031. n1.dynamicChildren,
  7032. dynamicChildren,
  7033. el,
  7034. parentComponent,
  7035. parentSuspense,
  7036. resolveChildrenNamespace(n2, namespace),
  7037. slotScopeIds
  7038. );
  7039. {
  7040. traverseStaticChildren(n1, n2);
  7041. }
  7042. } else if (!optimized) {
  7043. patchChildren(
  7044. n1,
  7045. n2,
  7046. el,
  7047. null,
  7048. parentComponent,
  7049. parentSuspense,
  7050. resolveChildrenNamespace(n2, namespace),
  7051. slotScopeIds,
  7052. false
  7053. );
  7054. }
  7055. if (patchFlag > 0) {
  7056. if (patchFlag & 16) {
  7057. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7058. } else {
  7059. if (patchFlag & 2) {
  7060. if (oldProps.class !== newProps.class) {
  7061. hostPatchProp(el, "class", null, newProps.class, namespace);
  7062. }
  7063. }
  7064. if (patchFlag & 4) {
  7065. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  7066. }
  7067. if (patchFlag & 8) {
  7068. const propsToUpdate = n2.dynamicProps;
  7069. for (let i = 0; i < propsToUpdate.length; i++) {
  7070. const key = propsToUpdate[i];
  7071. const prev = oldProps[key];
  7072. const next = newProps[key];
  7073. if (next !== prev || key === "value") {
  7074. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7075. }
  7076. }
  7077. }
  7078. }
  7079. if (patchFlag & 1) {
  7080. if (n1.children !== n2.children) {
  7081. hostSetElementText(el, n2.children);
  7082. }
  7083. }
  7084. } else if (!optimized && dynamicChildren == null) {
  7085. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7086. }
  7087. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  7088. queuePostRenderEffect(() => {
  7089. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7090. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  7091. }, parentSuspense);
  7092. }
  7093. };
  7094. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  7095. for (let i = 0; i < newChildren.length; i++) {
  7096. const oldVNode = oldChildren[i];
  7097. const newVNode = newChildren[i];
  7098. const container = (
  7099. // oldVNode may be an errored async setup() component inside Suspense
  7100. // which will not have a mounted element
  7101. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  7102. // of the Fragment itself so it can move its children.
  7103. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  7104. // which also requires the correct parent container
  7105. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  7106. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  7107. // In other cases, the parent container is not actually used so we
  7108. // just pass the block element here to avoid a DOM parentNode call.
  7109. fallbackContainer
  7110. )
  7111. );
  7112. patch(
  7113. oldVNode,
  7114. newVNode,
  7115. container,
  7116. null,
  7117. parentComponent,
  7118. parentSuspense,
  7119. namespace,
  7120. slotScopeIds,
  7121. true
  7122. );
  7123. }
  7124. };
  7125. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  7126. if (oldProps !== newProps) {
  7127. if (oldProps !== EMPTY_OBJ) {
  7128. for (const key in oldProps) {
  7129. if (!isReservedProp(key) && !(key in newProps)) {
  7130. hostPatchProp(
  7131. el,
  7132. key,
  7133. oldProps[key],
  7134. null,
  7135. namespace,
  7136. parentComponent
  7137. );
  7138. }
  7139. }
  7140. }
  7141. for (const key in newProps) {
  7142. if (isReservedProp(key)) continue;
  7143. const next = newProps[key];
  7144. const prev = oldProps[key];
  7145. if (next !== prev && key !== "value") {
  7146. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7147. }
  7148. }
  7149. if ("value" in newProps) {
  7150. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  7151. }
  7152. }
  7153. };
  7154. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7155. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  7156. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  7157. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  7158. if (
  7159. // #5523 dev root fragment may inherit directives
  7160. isHmrUpdating || patchFlag & 2048
  7161. ) {
  7162. patchFlag = 0;
  7163. optimized = false;
  7164. dynamicChildren = null;
  7165. }
  7166. if (fragmentSlotScopeIds) {
  7167. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  7168. }
  7169. if (n1 == null) {
  7170. hostInsert(fragmentStartAnchor, container, anchor);
  7171. hostInsert(fragmentEndAnchor, container, anchor);
  7172. mountChildren(
  7173. // #10007
  7174. // such fragment like `<></>` will be compiled into
  7175. // a fragment which doesn't have a children.
  7176. // In this case fallback to an empty array
  7177. n2.children || [],
  7178. container,
  7179. fragmentEndAnchor,
  7180. parentComponent,
  7181. parentSuspense,
  7182. namespace,
  7183. slotScopeIds,
  7184. optimized
  7185. );
  7186. } else {
  7187. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  7188. // of renderSlot() with no valid children
  7189. n1.dynamicChildren) {
  7190. patchBlockChildren(
  7191. n1.dynamicChildren,
  7192. dynamicChildren,
  7193. container,
  7194. parentComponent,
  7195. parentSuspense,
  7196. namespace,
  7197. slotScopeIds
  7198. );
  7199. {
  7200. traverseStaticChildren(n1, n2);
  7201. }
  7202. } else {
  7203. patchChildren(
  7204. n1,
  7205. n2,
  7206. container,
  7207. fragmentEndAnchor,
  7208. parentComponent,
  7209. parentSuspense,
  7210. namespace,
  7211. slotScopeIds,
  7212. optimized
  7213. );
  7214. }
  7215. }
  7216. };
  7217. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7218. n2.slotScopeIds = slotScopeIds;
  7219. if (n1 == null) {
  7220. if (n2.shapeFlag & 512) {
  7221. parentComponent.ctx.activate(
  7222. n2,
  7223. container,
  7224. anchor,
  7225. namespace,
  7226. optimized
  7227. );
  7228. } else {
  7229. mountComponent(
  7230. n2,
  7231. container,
  7232. anchor,
  7233. parentComponent,
  7234. parentSuspense,
  7235. namespace,
  7236. optimized
  7237. );
  7238. }
  7239. } else {
  7240. updateComponent(n1, n2, optimized);
  7241. }
  7242. };
  7243. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  7244. const instance = (initialVNode.component = createComponentInstance(
  7245. initialVNode,
  7246. parentComponent,
  7247. parentSuspense
  7248. ));
  7249. if (instance.type.__hmrId) {
  7250. registerHMR(instance);
  7251. }
  7252. {
  7253. pushWarningContext(initialVNode);
  7254. startMeasure(instance, `mount`);
  7255. }
  7256. if (isKeepAlive(initialVNode)) {
  7257. instance.ctx.renderer = internals;
  7258. }
  7259. {
  7260. {
  7261. startMeasure(instance, `init`);
  7262. }
  7263. setupComponent(instance, false, optimized);
  7264. {
  7265. endMeasure(instance, `init`);
  7266. }
  7267. }
  7268. if (instance.asyncDep) {
  7269. if (isHmrUpdating) initialVNode.el = null;
  7270. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  7271. if (!initialVNode.el) {
  7272. const placeholder = instance.subTree = createVNode(Comment);
  7273. processCommentNode(null, placeholder, container, anchor);
  7274. }
  7275. } else {
  7276. setupRenderEffect(
  7277. instance,
  7278. initialVNode,
  7279. container,
  7280. anchor,
  7281. parentSuspense,
  7282. namespace,
  7283. optimized
  7284. );
  7285. }
  7286. {
  7287. popWarningContext();
  7288. endMeasure(instance, `mount`);
  7289. }
  7290. };
  7291. const updateComponent = (n1, n2, optimized) => {
  7292. const instance = n2.component = n1.component;
  7293. if (shouldUpdateComponent(n1, n2, optimized)) {
  7294. if (instance.asyncDep && !instance.asyncResolved) {
  7295. {
  7296. pushWarningContext(n2);
  7297. }
  7298. updateComponentPreRender(instance, n2, optimized);
  7299. {
  7300. popWarningContext();
  7301. }
  7302. return;
  7303. } else {
  7304. instance.next = n2;
  7305. instance.update();
  7306. }
  7307. } else {
  7308. n2.el = n1.el;
  7309. instance.vnode = n2;
  7310. }
  7311. };
  7312. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  7313. const componentUpdateFn = () => {
  7314. if (!instance.isMounted) {
  7315. let vnodeHook;
  7316. const { el, props } = initialVNode;
  7317. const { bm, m, parent, root, type } = instance;
  7318. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  7319. toggleRecurse(instance, false);
  7320. if (bm) {
  7321. invokeArrayFns(bm);
  7322. }
  7323. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  7324. invokeVNodeHook(vnodeHook, parent, initialVNode);
  7325. }
  7326. toggleRecurse(instance, true);
  7327. if (el && hydrateNode) {
  7328. const hydrateSubTree = () => {
  7329. {
  7330. startMeasure(instance, `render`);
  7331. }
  7332. instance.subTree = renderComponentRoot(instance);
  7333. {
  7334. endMeasure(instance, `render`);
  7335. }
  7336. {
  7337. startMeasure(instance, `hydrate`);
  7338. }
  7339. hydrateNode(
  7340. el,
  7341. instance.subTree,
  7342. instance,
  7343. parentSuspense,
  7344. null
  7345. );
  7346. {
  7347. endMeasure(instance, `hydrate`);
  7348. }
  7349. };
  7350. if (isAsyncWrapperVNode && type.__asyncHydrate) {
  7351. type.__asyncHydrate(
  7352. el,
  7353. instance,
  7354. hydrateSubTree
  7355. );
  7356. } else {
  7357. hydrateSubTree();
  7358. }
  7359. } else {
  7360. if (root.ce) {
  7361. root.ce._injectChildStyle(type);
  7362. }
  7363. {
  7364. startMeasure(instance, `render`);
  7365. }
  7366. const subTree = instance.subTree = renderComponentRoot(instance);
  7367. {
  7368. endMeasure(instance, `render`);
  7369. }
  7370. {
  7371. startMeasure(instance, `patch`);
  7372. }
  7373. patch(
  7374. null,
  7375. subTree,
  7376. container,
  7377. anchor,
  7378. instance,
  7379. parentSuspense,
  7380. namespace
  7381. );
  7382. {
  7383. endMeasure(instance, `patch`);
  7384. }
  7385. initialVNode.el = subTree.el;
  7386. }
  7387. if (m) {
  7388. queuePostRenderEffect(m, parentSuspense);
  7389. }
  7390. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  7391. const scopedInitialVNode = initialVNode;
  7392. queuePostRenderEffect(
  7393. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  7394. parentSuspense
  7395. );
  7396. }
  7397. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  7398. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  7399. }
  7400. instance.isMounted = true;
  7401. {
  7402. devtoolsComponentAdded(instance);
  7403. }
  7404. initialVNode = container = anchor = null;
  7405. } else {
  7406. let { next, bu, u, parent, vnode } = instance;
  7407. {
  7408. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  7409. if (nonHydratedAsyncRoot) {
  7410. if (next) {
  7411. next.el = vnode.el;
  7412. updateComponentPreRender(instance, next, optimized);
  7413. }
  7414. nonHydratedAsyncRoot.asyncDep.then(() => {
  7415. if (!instance.isUnmounted) {
  7416. componentUpdateFn();
  7417. }
  7418. });
  7419. return;
  7420. }
  7421. }
  7422. let originNext = next;
  7423. let vnodeHook;
  7424. {
  7425. pushWarningContext(next || instance.vnode);
  7426. }
  7427. toggleRecurse(instance, false);
  7428. if (next) {
  7429. next.el = vnode.el;
  7430. updateComponentPreRender(instance, next, optimized);
  7431. } else {
  7432. next = vnode;
  7433. }
  7434. if (bu) {
  7435. invokeArrayFns(bu);
  7436. }
  7437. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  7438. invokeVNodeHook(vnodeHook, parent, next, vnode);
  7439. }
  7440. toggleRecurse(instance, true);
  7441. {
  7442. startMeasure(instance, `render`);
  7443. }
  7444. const nextTree = renderComponentRoot(instance);
  7445. {
  7446. endMeasure(instance, `render`);
  7447. }
  7448. const prevTree = instance.subTree;
  7449. instance.subTree = nextTree;
  7450. {
  7451. startMeasure(instance, `patch`);
  7452. }
  7453. patch(
  7454. prevTree,
  7455. nextTree,
  7456. // parent may have changed if it's in a teleport
  7457. hostParentNode(prevTree.el),
  7458. // anchor may have changed if it's in a fragment
  7459. getNextHostNode(prevTree),
  7460. instance,
  7461. parentSuspense,
  7462. namespace
  7463. );
  7464. {
  7465. endMeasure(instance, `patch`);
  7466. }
  7467. next.el = nextTree.el;
  7468. if (originNext === null) {
  7469. updateHOCHostEl(instance, nextTree.el);
  7470. }
  7471. if (u) {
  7472. queuePostRenderEffect(u, parentSuspense);
  7473. }
  7474. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  7475. queuePostRenderEffect(
  7476. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  7477. parentSuspense
  7478. );
  7479. }
  7480. {
  7481. devtoolsComponentUpdated(instance);
  7482. }
  7483. {
  7484. popWarningContext();
  7485. }
  7486. }
  7487. };
  7488. instance.scope.on();
  7489. const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
  7490. instance.scope.off();
  7491. const update = instance.update = effect.run.bind(effect);
  7492. const job = instance.job = effect.runIfDirty.bind(effect);
  7493. job.i = instance;
  7494. job.id = instance.uid;
  7495. effect.scheduler = () => queueJob(job);
  7496. toggleRecurse(instance, true);
  7497. {
  7498. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  7499. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  7500. }
  7501. update();
  7502. };
  7503. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  7504. nextVNode.component = instance;
  7505. const prevProps = instance.vnode.props;
  7506. instance.vnode = nextVNode;
  7507. instance.next = null;
  7508. updateProps(instance, nextVNode.props, prevProps, optimized);
  7509. updateSlots(instance, nextVNode.children, optimized);
  7510. pauseTracking();
  7511. flushPreFlushCbs(instance);
  7512. resetTracking();
  7513. };
  7514. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  7515. const c1 = n1 && n1.children;
  7516. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  7517. const c2 = n2.children;
  7518. const { patchFlag, shapeFlag } = n2;
  7519. if (patchFlag > 0) {
  7520. if (patchFlag & 128) {
  7521. patchKeyedChildren(
  7522. c1,
  7523. c2,
  7524. container,
  7525. anchor,
  7526. parentComponent,
  7527. parentSuspense,
  7528. namespace,
  7529. slotScopeIds,
  7530. optimized
  7531. );
  7532. return;
  7533. } else if (patchFlag & 256) {
  7534. patchUnkeyedChildren(
  7535. c1,
  7536. c2,
  7537. container,
  7538. anchor,
  7539. parentComponent,
  7540. parentSuspense,
  7541. namespace,
  7542. slotScopeIds,
  7543. optimized
  7544. );
  7545. return;
  7546. }
  7547. }
  7548. if (shapeFlag & 8) {
  7549. if (prevShapeFlag & 16) {
  7550. unmountChildren(c1, parentComponent, parentSuspense);
  7551. }
  7552. if (c2 !== c1) {
  7553. hostSetElementText(container, c2);
  7554. }
  7555. } else {
  7556. if (prevShapeFlag & 16) {
  7557. if (shapeFlag & 16) {
  7558. patchKeyedChildren(
  7559. c1,
  7560. c2,
  7561. container,
  7562. anchor,
  7563. parentComponent,
  7564. parentSuspense,
  7565. namespace,
  7566. slotScopeIds,
  7567. optimized
  7568. );
  7569. } else {
  7570. unmountChildren(c1, parentComponent, parentSuspense, true);
  7571. }
  7572. } else {
  7573. if (prevShapeFlag & 8) {
  7574. hostSetElementText(container, "");
  7575. }
  7576. if (shapeFlag & 16) {
  7577. mountChildren(
  7578. c2,
  7579. container,
  7580. anchor,
  7581. parentComponent,
  7582. parentSuspense,
  7583. namespace,
  7584. slotScopeIds,
  7585. optimized
  7586. );
  7587. }
  7588. }
  7589. }
  7590. };
  7591. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7592. c1 = c1 || EMPTY_ARR;
  7593. c2 = c2 || EMPTY_ARR;
  7594. const oldLength = c1.length;
  7595. const newLength = c2.length;
  7596. const commonLength = Math.min(oldLength, newLength);
  7597. let i;
  7598. for (i = 0; i < commonLength; i++) {
  7599. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7600. patch(
  7601. c1[i],
  7602. nextChild,
  7603. container,
  7604. null,
  7605. parentComponent,
  7606. parentSuspense,
  7607. namespace,
  7608. slotScopeIds,
  7609. optimized
  7610. );
  7611. }
  7612. if (oldLength > newLength) {
  7613. unmountChildren(
  7614. c1,
  7615. parentComponent,
  7616. parentSuspense,
  7617. true,
  7618. false,
  7619. commonLength
  7620. );
  7621. } else {
  7622. mountChildren(
  7623. c2,
  7624. container,
  7625. anchor,
  7626. parentComponent,
  7627. parentSuspense,
  7628. namespace,
  7629. slotScopeIds,
  7630. optimized,
  7631. commonLength
  7632. );
  7633. }
  7634. };
  7635. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7636. let i = 0;
  7637. const l2 = c2.length;
  7638. let e1 = c1.length - 1;
  7639. let e2 = l2 - 1;
  7640. while (i <= e1 && i <= e2) {
  7641. const n1 = c1[i];
  7642. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7643. if (isSameVNodeType(n1, n2)) {
  7644. patch(
  7645. n1,
  7646. n2,
  7647. container,
  7648. null,
  7649. parentComponent,
  7650. parentSuspense,
  7651. namespace,
  7652. slotScopeIds,
  7653. optimized
  7654. );
  7655. } else {
  7656. break;
  7657. }
  7658. i++;
  7659. }
  7660. while (i <= e1 && i <= e2) {
  7661. const n1 = c1[e1];
  7662. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7663. if (isSameVNodeType(n1, n2)) {
  7664. patch(
  7665. n1,
  7666. n2,
  7667. container,
  7668. null,
  7669. parentComponent,
  7670. parentSuspense,
  7671. namespace,
  7672. slotScopeIds,
  7673. optimized
  7674. );
  7675. } else {
  7676. break;
  7677. }
  7678. e1--;
  7679. e2--;
  7680. }
  7681. if (i > e1) {
  7682. if (i <= e2) {
  7683. const nextPos = e2 + 1;
  7684. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7685. while (i <= e2) {
  7686. patch(
  7687. null,
  7688. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  7689. container,
  7690. anchor,
  7691. parentComponent,
  7692. parentSuspense,
  7693. namespace,
  7694. slotScopeIds,
  7695. optimized
  7696. );
  7697. i++;
  7698. }
  7699. }
  7700. } else if (i > e2) {
  7701. while (i <= e1) {
  7702. unmount(c1[i], parentComponent, parentSuspense, true);
  7703. i++;
  7704. }
  7705. } else {
  7706. const s1 = i;
  7707. const s2 = i;
  7708. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  7709. for (i = s2; i <= e2; i++) {
  7710. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7711. if (nextChild.key != null) {
  7712. if (keyToNewIndexMap.has(nextChild.key)) {
  7713. warn$1(
  7714. `Duplicate keys found during update:`,
  7715. JSON.stringify(nextChild.key),
  7716. `Make sure keys are unique.`
  7717. );
  7718. }
  7719. keyToNewIndexMap.set(nextChild.key, i);
  7720. }
  7721. }
  7722. let j;
  7723. let patched = 0;
  7724. const toBePatched = e2 - s2 + 1;
  7725. let moved = false;
  7726. let maxNewIndexSoFar = 0;
  7727. const newIndexToOldIndexMap = new Array(toBePatched);
  7728. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  7729. for (i = s1; i <= e1; i++) {
  7730. const prevChild = c1[i];
  7731. if (patched >= toBePatched) {
  7732. unmount(prevChild, parentComponent, parentSuspense, true);
  7733. continue;
  7734. }
  7735. let newIndex;
  7736. if (prevChild.key != null) {
  7737. newIndex = keyToNewIndexMap.get(prevChild.key);
  7738. } else {
  7739. for (j = s2; j <= e2; j++) {
  7740. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7741. newIndex = j;
  7742. break;
  7743. }
  7744. }
  7745. }
  7746. if (newIndex === void 0) {
  7747. unmount(prevChild, parentComponent, parentSuspense, true);
  7748. } else {
  7749. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7750. if (newIndex >= maxNewIndexSoFar) {
  7751. maxNewIndexSoFar = newIndex;
  7752. } else {
  7753. moved = true;
  7754. }
  7755. patch(
  7756. prevChild,
  7757. c2[newIndex],
  7758. container,
  7759. null,
  7760. parentComponent,
  7761. parentSuspense,
  7762. namespace,
  7763. slotScopeIds,
  7764. optimized
  7765. );
  7766. patched++;
  7767. }
  7768. }
  7769. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7770. j = increasingNewIndexSequence.length - 1;
  7771. for (i = toBePatched - 1; i >= 0; i--) {
  7772. const nextIndex = s2 + i;
  7773. const nextChild = c2[nextIndex];
  7774. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  7775. if (newIndexToOldIndexMap[i] === 0) {
  7776. patch(
  7777. null,
  7778. nextChild,
  7779. container,
  7780. anchor,
  7781. parentComponent,
  7782. parentSuspense,
  7783. namespace,
  7784. slotScopeIds,
  7785. optimized
  7786. );
  7787. } else if (moved) {
  7788. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7789. move(nextChild, container, anchor, 2);
  7790. } else {
  7791. j--;
  7792. }
  7793. }
  7794. }
  7795. }
  7796. };
  7797. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  7798. const { el, type, transition, children, shapeFlag } = vnode;
  7799. if (shapeFlag & 6) {
  7800. move(vnode.component.subTree, container, anchor, moveType);
  7801. return;
  7802. }
  7803. if (shapeFlag & 128) {
  7804. vnode.suspense.move(container, anchor, moveType);
  7805. return;
  7806. }
  7807. if (shapeFlag & 64) {
  7808. type.move(vnode, container, anchor, internals);
  7809. return;
  7810. }
  7811. if (type === Fragment) {
  7812. hostInsert(el, container, anchor);
  7813. for (let i = 0; i < children.length; i++) {
  7814. move(children[i], container, anchor, moveType);
  7815. }
  7816. hostInsert(vnode.anchor, container, anchor);
  7817. return;
  7818. }
  7819. if (type === Static) {
  7820. moveStaticNode(vnode, container, anchor);
  7821. return;
  7822. }
  7823. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  7824. if (needTransition2) {
  7825. if (moveType === 0) {
  7826. transition.beforeEnter(el);
  7827. hostInsert(el, container, anchor);
  7828. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7829. } else {
  7830. const { leave, delayLeave, afterLeave } = transition;
  7831. const remove2 = () => hostInsert(el, container, anchor);
  7832. const performLeave = () => {
  7833. leave(el, () => {
  7834. remove2();
  7835. afterLeave && afterLeave();
  7836. });
  7837. };
  7838. if (delayLeave) {
  7839. delayLeave(el, remove2, performLeave);
  7840. } else {
  7841. performLeave();
  7842. }
  7843. }
  7844. } else {
  7845. hostInsert(el, container, anchor);
  7846. }
  7847. };
  7848. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  7849. const {
  7850. type,
  7851. props,
  7852. ref,
  7853. children,
  7854. dynamicChildren,
  7855. shapeFlag,
  7856. patchFlag,
  7857. dirs,
  7858. cacheIndex
  7859. } = vnode;
  7860. if (patchFlag === -2) {
  7861. optimized = false;
  7862. }
  7863. if (ref != null) {
  7864. setRef(ref, null, parentSuspense, vnode, true);
  7865. }
  7866. if (cacheIndex != null) {
  7867. parentComponent.renderCache[cacheIndex] = void 0;
  7868. }
  7869. if (shapeFlag & 256) {
  7870. parentComponent.ctx.deactivate(vnode);
  7871. return;
  7872. }
  7873. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  7874. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  7875. let vnodeHook;
  7876. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  7877. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7878. }
  7879. if (shapeFlag & 6) {
  7880. unmountComponent(vnode.component, parentSuspense, doRemove);
  7881. } else {
  7882. if (shapeFlag & 128) {
  7883. vnode.suspense.unmount(parentSuspense, doRemove);
  7884. return;
  7885. }
  7886. if (shouldInvokeDirs) {
  7887. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  7888. }
  7889. if (shapeFlag & 64) {
  7890. vnode.type.remove(
  7891. vnode,
  7892. parentComponent,
  7893. parentSuspense,
  7894. internals,
  7895. doRemove
  7896. );
  7897. } else if (dynamicChildren && // #5154
  7898. // when v-once is used inside a block, setBlockTracking(-1) marks the
  7899. // parent block with hasOnce: true
  7900. // so that it doesn't take the fast path during unmount - otherwise
  7901. // components nested in v-once are never unmounted.
  7902. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7903. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7904. unmountChildren(
  7905. dynamicChildren,
  7906. parentComponent,
  7907. parentSuspense,
  7908. false,
  7909. true
  7910. );
  7911. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7912. unmountChildren(children, parentComponent, parentSuspense);
  7913. }
  7914. if (doRemove) {
  7915. remove(vnode);
  7916. }
  7917. }
  7918. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7919. queuePostRenderEffect(() => {
  7920. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7921. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  7922. }, parentSuspense);
  7923. }
  7924. };
  7925. const remove = (vnode) => {
  7926. const { type, el, anchor, transition } = vnode;
  7927. if (type === Fragment) {
  7928. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  7929. vnode.children.forEach((child) => {
  7930. if (child.type === Comment) {
  7931. hostRemove(child.el);
  7932. } else {
  7933. remove(child);
  7934. }
  7935. });
  7936. } else {
  7937. removeFragment(el, anchor);
  7938. }
  7939. return;
  7940. }
  7941. if (type === Static) {
  7942. removeStaticNode(vnode);
  7943. return;
  7944. }
  7945. const performRemove = () => {
  7946. hostRemove(el);
  7947. if (transition && !transition.persisted && transition.afterLeave) {
  7948. transition.afterLeave();
  7949. }
  7950. };
  7951. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  7952. const { leave, delayLeave } = transition;
  7953. const performLeave = () => leave(el, performRemove);
  7954. if (delayLeave) {
  7955. delayLeave(vnode.el, performRemove, performLeave);
  7956. } else {
  7957. performLeave();
  7958. }
  7959. } else {
  7960. performRemove();
  7961. }
  7962. };
  7963. const removeFragment = (cur, end) => {
  7964. let next;
  7965. while (cur !== end) {
  7966. next = hostNextSibling(cur);
  7967. hostRemove(cur);
  7968. cur = next;
  7969. }
  7970. hostRemove(end);
  7971. };
  7972. const unmountComponent = (instance, parentSuspense, doRemove) => {
  7973. if (instance.type.__hmrId) {
  7974. unregisterHMR(instance);
  7975. }
  7976. const { bum, scope, job, subTree, um, m, a } = instance;
  7977. invalidateMount(m);
  7978. invalidateMount(a);
  7979. if (bum) {
  7980. invokeArrayFns(bum);
  7981. }
  7982. scope.stop();
  7983. if (job) {
  7984. job.flags |= 8;
  7985. unmount(subTree, instance, parentSuspense, doRemove);
  7986. }
  7987. if (um) {
  7988. queuePostRenderEffect(um, parentSuspense);
  7989. }
  7990. queuePostRenderEffect(() => {
  7991. instance.isUnmounted = true;
  7992. }, parentSuspense);
  7993. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  7994. parentSuspense.deps--;
  7995. if (parentSuspense.deps === 0) {
  7996. parentSuspense.resolve();
  7997. }
  7998. }
  7999. {
  8000. devtoolsComponentRemoved(instance);
  8001. }
  8002. };
  8003. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  8004. for (let i = start; i < children.length; i++) {
  8005. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  8006. }
  8007. };
  8008. const getNextHostNode = (vnode) => {
  8009. if (vnode.shapeFlag & 6) {
  8010. return getNextHostNode(vnode.component.subTree);
  8011. }
  8012. if (vnode.shapeFlag & 128) {
  8013. return vnode.suspense.next();
  8014. }
  8015. const el = hostNextSibling(vnode.anchor || vnode.el);
  8016. const teleportEnd = el && el[TeleportEndKey];
  8017. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  8018. };
  8019. let isFlushing = false;
  8020. const render = (vnode, container, namespace) => {
  8021. if (vnode == null) {
  8022. if (container._vnode) {
  8023. unmount(container._vnode, null, null, true);
  8024. }
  8025. } else {
  8026. patch(
  8027. container._vnode || null,
  8028. vnode,
  8029. container,
  8030. null,
  8031. null,
  8032. null,
  8033. namespace
  8034. );
  8035. }
  8036. container._vnode = vnode;
  8037. if (!isFlushing) {
  8038. isFlushing = true;
  8039. flushPreFlushCbs();
  8040. flushPostFlushCbs();
  8041. isFlushing = false;
  8042. }
  8043. };
  8044. const internals = {
  8045. p: patch,
  8046. um: unmount,
  8047. m: move,
  8048. r: remove,
  8049. mt: mountComponent,
  8050. mc: mountChildren,
  8051. pc: patchChildren,
  8052. pbc: patchBlockChildren,
  8053. n: getNextHostNode,
  8054. o: options
  8055. };
  8056. let hydrate;
  8057. let hydrateNode;
  8058. if (createHydrationFns) {
  8059. [hydrate, hydrateNode] = createHydrationFns(
  8060. internals
  8061. );
  8062. }
  8063. return {
  8064. render,
  8065. hydrate,
  8066. createApp: createAppAPI(render, hydrate)
  8067. };
  8068. }
  8069. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  8070. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  8071. }
  8072. function toggleRecurse({ effect, job }, allowed) {
  8073. if (allowed) {
  8074. effect.flags |= 32;
  8075. job.flags |= 4;
  8076. } else {
  8077. effect.flags &= ~32;
  8078. job.flags &= ~4;
  8079. }
  8080. }
  8081. function needTransition(parentSuspense, transition) {
  8082. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  8083. }
  8084. function traverseStaticChildren(n1, n2, shallow = false) {
  8085. const ch1 = n1.children;
  8086. const ch2 = n2.children;
  8087. if (isArray(ch1) && isArray(ch2)) {
  8088. for (let i = 0; i < ch1.length; i++) {
  8089. const c1 = ch1[i];
  8090. let c2 = ch2[i];
  8091. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  8092. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  8093. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  8094. c2.el = c1.el;
  8095. }
  8096. if (!shallow && c2.patchFlag !== -2)
  8097. traverseStaticChildren(c1, c2);
  8098. }
  8099. if (c2.type === Text) {
  8100. c2.el = c1.el;
  8101. }
  8102. if (c2.type === Comment && !c2.el) {
  8103. c2.el = c1.el;
  8104. }
  8105. }
  8106. }
  8107. }
  8108. function getSequence(arr) {
  8109. const p = arr.slice();
  8110. const result = [0];
  8111. let i, j, u, v, c;
  8112. const len = arr.length;
  8113. for (i = 0; i < len; i++) {
  8114. const arrI = arr[i];
  8115. if (arrI !== 0) {
  8116. j = result[result.length - 1];
  8117. if (arr[j] < arrI) {
  8118. p[i] = j;
  8119. result.push(i);
  8120. continue;
  8121. }
  8122. u = 0;
  8123. v = result.length - 1;
  8124. while (u < v) {
  8125. c = u + v >> 1;
  8126. if (arr[result[c]] < arrI) {
  8127. u = c + 1;
  8128. } else {
  8129. v = c;
  8130. }
  8131. }
  8132. if (arrI < arr[result[u]]) {
  8133. if (u > 0) {
  8134. p[i] = result[u - 1];
  8135. }
  8136. result[u] = i;
  8137. }
  8138. }
  8139. }
  8140. u = result.length;
  8141. v = result[u - 1];
  8142. while (u-- > 0) {
  8143. result[u] = v;
  8144. v = p[v];
  8145. }
  8146. return result;
  8147. }
  8148. function locateNonHydratedAsyncRoot(instance) {
  8149. const subComponent = instance.subTree.component;
  8150. if (subComponent) {
  8151. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  8152. return subComponent;
  8153. } else {
  8154. return locateNonHydratedAsyncRoot(subComponent);
  8155. }
  8156. }
  8157. }
  8158. function invalidateMount(hooks) {
  8159. if (hooks) {
  8160. for (let i = 0; i < hooks.length; i++)
  8161. hooks[i].flags |= 8;
  8162. }
  8163. }
  8164. const ssrContextKey = Symbol.for("v-scx");
  8165. const useSSRContext = () => {
  8166. {
  8167. warn$1(`useSSRContext() is not supported in the global build.`);
  8168. }
  8169. };
  8170. function watchEffect(effect, options) {
  8171. return doWatch(effect, null, options);
  8172. }
  8173. function watchPostEffect(effect, options) {
  8174. return doWatch(
  8175. effect,
  8176. null,
  8177. extend({}, options, { flush: "post" })
  8178. );
  8179. }
  8180. function watchSyncEffect(effect, options) {
  8181. return doWatch(
  8182. effect,
  8183. null,
  8184. extend({}, options, { flush: "sync" })
  8185. );
  8186. }
  8187. function watch(source, cb, options) {
  8188. if (!isFunction(cb)) {
  8189. warn$1(
  8190. `\`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.`
  8191. );
  8192. }
  8193. return doWatch(source, cb, options);
  8194. }
  8195. function doWatch(source, cb, options = EMPTY_OBJ) {
  8196. const { immediate, deep, flush, once } = options;
  8197. if (!cb) {
  8198. if (immediate !== void 0) {
  8199. warn$1(
  8200. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  8201. );
  8202. }
  8203. if (deep !== void 0) {
  8204. warn$1(
  8205. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  8206. );
  8207. }
  8208. if (once !== void 0) {
  8209. warn$1(
  8210. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  8211. );
  8212. }
  8213. }
  8214. const baseWatchOptions = extend({}, options);
  8215. baseWatchOptions.onWarn = warn$1;
  8216. const instance = currentInstance;
  8217. baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
  8218. let isPre = false;
  8219. if (flush === "post") {
  8220. baseWatchOptions.scheduler = (job) => {
  8221. queuePostRenderEffect(job, instance && instance.suspense);
  8222. };
  8223. } else if (flush !== "sync") {
  8224. isPre = true;
  8225. baseWatchOptions.scheduler = (job, isFirstRun) => {
  8226. if (isFirstRun) {
  8227. job();
  8228. } else {
  8229. queueJob(job);
  8230. }
  8231. };
  8232. }
  8233. baseWatchOptions.augmentJob = (job) => {
  8234. if (cb) {
  8235. job.flags |= 4;
  8236. }
  8237. if (isPre) {
  8238. job.flags |= 2;
  8239. if (instance) {
  8240. job.id = instance.uid;
  8241. job.i = instance;
  8242. }
  8243. }
  8244. };
  8245. const watchHandle = watch$1(source, cb, baseWatchOptions);
  8246. return watchHandle;
  8247. }
  8248. function instanceWatch(source, value, options) {
  8249. const publicThis = this.proxy;
  8250. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  8251. let cb;
  8252. if (isFunction(value)) {
  8253. cb = value;
  8254. } else {
  8255. cb = value.handler;
  8256. options = value;
  8257. }
  8258. const reset = setCurrentInstance(this);
  8259. const res = doWatch(getter, cb.bind(publicThis), options);
  8260. reset();
  8261. return res;
  8262. }
  8263. function createPathGetter(ctx, path) {
  8264. const segments = path.split(".");
  8265. return () => {
  8266. let cur = ctx;
  8267. for (let i = 0; i < segments.length && cur; i++) {
  8268. cur = cur[segments[i]];
  8269. }
  8270. return cur;
  8271. };
  8272. }
  8273. function useModel(props, name, options = EMPTY_OBJ) {
  8274. const i = getCurrentInstance();
  8275. if (!i) {
  8276. warn$1(`useModel() called without active instance.`);
  8277. return ref();
  8278. }
  8279. const camelizedName = camelize(name);
  8280. if (!i.propsOptions[0][camelizedName]) {
  8281. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  8282. return ref();
  8283. }
  8284. const hyphenatedName = hyphenate(name);
  8285. const modifiers = getModelModifiers(props, camelizedName);
  8286. const res = customRef((track, trigger) => {
  8287. let localValue;
  8288. let prevSetValue = EMPTY_OBJ;
  8289. let prevEmittedValue;
  8290. watchSyncEffect(() => {
  8291. const propValue = props[camelizedName];
  8292. if (hasChanged(localValue, propValue)) {
  8293. localValue = propValue;
  8294. trigger();
  8295. }
  8296. });
  8297. return {
  8298. get() {
  8299. track();
  8300. return options.get ? options.get(localValue) : localValue;
  8301. },
  8302. set(value) {
  8303. const emittedValue = options.set ? options.set(value) : value;
  8304. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  8305. return;
  8306. }
  8307. const rawProps = i.vnode.props;
  8308. if (!(rawProps && // check if parent has passed v-model
  8309. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
  8310. localValue = value;
  8311. trigger();
  8312. }
  8313. i.emit(`update:${name}`, emittedValue);
  8314. if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
  8315. trigger();
  8316. }
  8317. prevSetValue = value;
  8318. prevEmittedValue = emittedValue;
  8319. }
  8320. };
  8321. });
  8322. res[Symbol.iterator] = () => {
  8323. let i2 = 0;
  8324. return {
  8325. next() {
  8326. if (i2 < 2) {
  8327. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  8328. } else {
  8329. return { done: true };
  8330. }
  8331. }
  8332. };
  8333. };
  8334. return res;
  8335. }
  8336. const getModelModifiers = (props, modelName) => {
  8337. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  8338. };
  8339. function emit(instance, event, ...rawArgs) {
  8340. if (instance.isUnmounted) return;
  8341. const props = instance.vnode.props || EMPTY_OBJ;
  8342. {
  8343. const {
  8344. emitsOptions,
  8345. propsOptions: [propsOptions]
  8346. } = instance;
  8347. if (emitsOptions) {
  8348. if (!(event in emitsOptions) && true) {
  8349. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  8350. warn$1(
  8351. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  8352. );
  8353. }
  8354. } else {
  8355. const validator = emitsOptions[event];
  8356. if (isFunction(validator)) {
  8357. const isValid = validator(...rawArgs);
  8358. if (!isValid) {
  8359. warn$1(
  8360. `Invalid event arguments: event validation failed for event "${event}".`
  8361. );
  8362. }
  8363. }
  8364. }
  8365. }
  8366. }
  8367. let args = rawArgs;
  8368. const isModelListener = event.startsWith("update:");
  8369. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  8370. if (modifiers) {
  8371. if (modifiers.trim) {
  8372. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  8373. }
  8374. if (modifiers.number) {
  8375. args = rawArgs.map(looseToNumber);
  8376. }
  8377. }
  8378. {
  8379. devtoolsComponentEmit(instance, event, args);
  8380. }
  8381. {
  8382. const lowerCaseEvent = event.toLowerCase();
  8383. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  8384. warn$1(
  8385. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  8386. instance,
  8387. instance.type
  8388. )} 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(
  8389. event
  8390. )}" instead of "${event}".`
  8391. );
  8392. }
  8393. }
  8394. let handlerName;
  8395. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  8396. props[handlerName = toHandlerKey(camelize(event))];
  8397. if (!handler && isModelListener) {
  8398. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  8399. }
  8400. if (handler) {
  8401. callWithAsyncErrorHandling(
  8402. handler,
  8403. instance,
  8404. 6,
  8405. args
  8406. );
  8407. }
  8408. const onceHandler = props[handlerName + `Once`];
  8409. if (onceHandler) {
  8410. if (!instance.emitted) {
  8411. instance.emitted = {};
  8412. } else if (instance.emitted[handlerName]) {
  8413. return;
  8414. }
  8415. instance.emitted[handlerName] = true;
  8416. callWithAsyncErrorHandling(
  8417. onceHandler,
  8418. instance,
  8419. 6,
  8420. args
  8421. );
  8422. }
  8423. }
  8424. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  8425. const cache = appContext.emitsCache;
  8426. const cached = cache.get(comp);
  8427. if (cached !== void 0) {
  8428. return cached;
  8429. }
  8430. const raw = comp.emits;
  8431. let normalized = {};
  8432. let hasExtends = false;
  8433. if (!isFunction(comp)) {
  8434. const extendEmits = (raw2) => {
  8435. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  8436. if (normalizedFromExtend) {
  8437. hasExtends = true;
  8438. extend(normalized, normalizedFromExtend);
  8439. }
  8440. };
  8441. if (!asMixin && appContext.mixins.length) {
  8442. appContext.mixins.forEach(extendEmits);
  8443. }
  8444. if (comp.extends) {
  8445. extendEmits(comp.extends);
  8446. }
  8447. if (comp.mixins) {
  8448. comp.mixins.forEach(extendEmits);
  8449. }
  8450. }
  8451. if (!raw && !hasExtends) {
  8452. if (isObject(comp)) {
  8453. cache.set(comp, null);
  8454. }
  8455. return null;
  8456. }
  8457. if (isArray(raw)) {
  8458. raw.forEach((key) => normalized[key] = null);
  8459. } else {
  8460. extend(normalized, raw);
  8461. }
  8462. if (isObject(comp)) {
  8463. cache.set(comp, normalized);
  8464. }
  8465. return normalized;
  8466. }
  8467. function isEmitListener(options, key) {
  8468. if (!options || !isOn(key)) {
  8469. return false;
  8470. }
  8471. key = key.slice(2).replace(/Once$/, "");
  8472. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  8473. }
  8474. let accessedAttrs = false;
  8475. function markAttrsAccessed() {
  8476. accessedAttrs = true;
  8477. }
  8478. function renderComponentRoot(instance) {
  8479. const {
  8480. type: Component,
  8481. vnode,
  8482. proxy,
  8483. withProxy,
  8484. propsOptions: [propsOptions],
  8485. slots,
  8486. attrs,
  8487. emit,
  8488. render,
  8489. renderCache,
  8490. props,
  8491. data,
  8492. setupState,
  8493. ctx,
  8494. inheritAttrs
  8495. } = instance;
  8496. const prev = setCurrentRenderingInstance(instance);
  8497. let result;
  8498. let fallthroughAttrs;
  8499. {
  8500. accessedAttrs = false;
  8501. }
  8502. try {
  8503. if (vnode.shapeFlag & 4) {
  8504. const proxyToUse = withProxy || proxy;
  8505. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  8506. get(target, key, receiver) {
  8507. warn$1(
  8508. `Property '${String(
  8509. key
  8510. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  8511. );
  8512. return Reflect.get(target, key, receiver);
  8513. }
  8514. }) : proxyToUse;
  8515. result = normalizeVNode(
  8516. render.call(
  8517. thisProxy,
  8518. proxyToUse,
  8519. renderCache,
  8520. true ? shallowReadonly(props) : props,
  8521. setupState,
  8522. data,
  8523. ctx
  8524. )
  8525. );
  8526. fallthroughAttrs = attrs;
  8527. } else {
  8528. const render2 = Component;
  8529. if (attrs === props) {
  8530. markAttrsAccessed();
  8531. }
  8532. result = normalizeVNode(
  8533. render2.length > 1 ? render2(
  8534. true ? shallowReadonly(props) : props,
  8535. true ? {
  8536. get attrs() {
  8537. markAttrsAccessed();
  8538. return shallowReadonly(attrs);
  8539. },
  8540. slots,
  8541. emit
  8542. } : { attrs, slots, emit }
  8543. ) : render2(
  8544. true ? shallowReadonly(props) : props,
  8545. null
  8546. )
  8547. );
  8548. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  8549. }
  8550. } catch (err) {
  8551. blockStack.length = 0;
  8552. handleError(err, instance, 1);
  8553. result = createVNode(Comment);
  8554. }
  8555. let root = result;
  8556. let setRoot = void 0;
  8557. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  8558. [root, setRoot] = getChildRoot(result);
  8559. }
  8560. if (fallthroughAttrs && inheritAttrs !== false) {
  8561. const keys = Object.keys(fallthroughAttrs);
  8562. const { shapeFlag } = root;
  8563. if (keys.length) {
  8564. if (shapeFlag & (1 | 6)) {
  8565. if (propsOptions && keys.some(isModelListener)) {
  8566. fallthroughAttrs = filterModelListeners(
  8567. fallthroughAttrs,
  8568. propsOptions
  8569. );
  8570. }
  8571. root = cloneVNode(root, fallthroughAttrs, false, true);
  8572. } else if (!accessedAttrs && root.type !== Comment) {
  8573. const allAttrs = Object.keys(attrs);
  8574. const eventAttrs = [];
  8575. const extraAttrs = [];
  8576. for (let i = 0, l = allAttrs.length; i < l; i++) {
  8577. const key = allAttrs[i];
  8578. if (isOn(key)) {
  8579. if (!isModelListener(key)) {
  8580. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  8581. }
  8582. } else {
  8583. extraAttrs.push(key);
  8584. }
  8585. }
  8586. if (extraAttrs.length) {
  8587. warn$1(
  8588. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  8589. );
  8590. }
  8591. if (eventAttrs.length) {
  8592. warn$1(
  8593. `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.`
  8594. );
  8595. }
  8596. }
  8597. }
  8598. }
  8599. if (vnode.dirs) {
  8600. if (!isElementRoot(root)) {
  8601. warn$1(
  8602. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  8603. );
  8604. }
  8605. root = cloneVNode(root, null, false, true);
  8606. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  8607. }
  8608. if (vnode.transition) {
  8609. if (!isElementRoot(root)) {
  8610. warn$1(
  8611. `Component inside <Transition> renders non-element root node that cannot be animated.`
  8612. );
  8613. }
  8614. setTransitionHooks(root, vnode.transition);
  8615. }
  8616. if (setRoot) {
  8617. setRoot(root);
  8618. } else {
  8619. result = root;
  8620. }
  8621. setCurrentRenderingInstance(prev);
  8622. return result;
  8623. }
  8624. const getChildRoot = (vnode) => {
  8625. const rawChildren = vnode.children;
  8626. const dynamicChildren = vnode.dynamicChildren;
  8627. const childRoot = filterSingleRoot(rawChildren, false);
  8628. if (!childRoot) {
  8629. return [vnode, void 0];
  8630. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  8631. return getChildRoot(childRoot);
  8632. }
  8633. const index = rawChildren.indexOf(childRoot);
  8634. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  8635. const setRoot = (updatedRoot) => {
  8636. rawChildren[index] = updatedRoot;
  8637. if (dynamicChildren) {
  8638. if (dynamicIndex > -1) {
  8639. dynamicChildren[dynamicIndex] = updatedRoot;
  8640. } else if (updatedRoot.patchFlag > 0) {
  8641. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  8642. }
  8643. }
  8644. };
  8645. return [normalizeVNode(childRoot), setRoot];
  8646. };
  8647. function filterSingleRoot(children, recurse = true) {
  8648. let singleRoot;
  8649. for (let i = 0; i < children.length; i++) {
  8650. const child = children[i];
  8651. if (isVNode(child)) {
  8652. if (child.type !== Comment || child.children === "v-if") {
  8653. if (singleRoot) {
  8654. return;
  8655. } else {
  8656. singleRoot = child;
  8657. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  8658. return filterSingleRoot(singleRoot.children);
  8659. }
  8660. }
  8661. }
  8662. } else {
  8663. return;
  8664. }
  8665. }
  8666. return singleRoot;
  8667. }
  8668. const getFunctionalFallthrough = (attrs) => {
  8669. let res;
  8670. for (const key in attrs) {
  8671. if (key === "class" || key === "style" || isOn(key)) {
  8672. (res || (res = {}))[key] = attrs[key];
  8673. }
  8674. }
  8675. return res;
  8676. };
  8677. const filterModelListeners = (attrs, props) => {
  8678. const res = {};
  8679. for (const key in attrs) {
  8680. if (!isModelListener(key) || !(key.slice(9) in props)) {
  8681. res[key] = attrs[key];
  8682. }
  8683. }
  8684. return res;
  8685. };
  8686. const isElementRoot = (vnode) => {
  8687. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  8688. };
  8689. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  8690. const { props: prevProps, children: prevChildren, component } = prevVNode;
  8691. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  8692. const emits = component.emitsOptions;
  8693. if ((prevChildren || nextChildren) && isHmrUpdating) {
  8694. return true;
  8695. }
  8696. if (nextVNode.dirs || nextVNode.transition) {
  8697. return true;
  8698. }
  8699. if (optimized && patchFlag >= 0) {
  8700. if (patchFlag & 1024) {
  8701. return true;
  8702. }
  8703. if (patchFlag & 16) {
  8704. if (!prevProps) {
  8705. return !!nextProps;
  8706. }
  8707. return hasPropsChanged(prevProps, nextProps, emits);
  8708. } else if (patchFlag & 8) {
  8709. const dynamicProps = nextVNode.dynamicProps;
  8710. for (let i = 0; i < dynamicProps.length; i++) {
  8711. const key = dynamicProps[i];
  8712. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  8713. return true;
  8714. }
  8715. }
  8716. }
  8717. } else {
  8718. if (prevChildren || nextChildren) {
  8719. if (!nextChildren || !nextChildren.$stable) {
  8720. return true;
  8721. }
  8722. }
  8723. if (prevProps === nextProps) {
  8724. return false;
  8725. }
  8726. if (!prevProps) {
  8727. return !!nextProps;
  8728. }
  8729. if (!nextProps) {
  8730. return true;
  8731. }
  8732. return hasPropsChanged(prevProps, nextProps, emits);
  8733. }
  8734. return false;
  8735. }
  8736. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  8737. const nextKeys = Object.keys(nextProps);
  8738. if (nextKeys.length !== Object.keys(prevProps).length) {
  8739. return true;
  8740. }
  8741. for (let i = 0; i < nextKeys.length; i++) {
  8742. const key = nextKeys[i];
  8743. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  8744. return true;
  8745. }
  8746. }
  8747. return false;
  8748. }
  8749. function updateHOCHostEl({ vnode, parent }, el) {
  8750. while (parent) {
  8751. const root = parent.subTree;
  8752. if (root.suspense && root.suspense.activeBranch === vnode) {
  8753. root.el = vnode.el;
  8754. }
  8755. if (root === vnode) {
  8756. (vnode = parent.vnode).el = el;
  8757. parent = parent.parent;
  8758. } else {
  8759. break;
  8760. }
  8761. }
  8762. }
  8763. const isSuspense = (type) => type.__isSuspense;
  8764. let suspenseId = 0;
  8765. const SuspenseImpl = {
  8766. name: "Suspense",
  8767. // In order to make Suspense tree-shakable, we need to avoid importing it
  8768. // directly in the renderer. The renderer checks for the __isSuspense flag
  8769. // on a vnode's type and calls the `process` method, passing in renderer
  8770. // internals.
  8771. __isSuspense: true,
  8772. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8773. if (n1 == null) {
  8774. mountSuspense(
  8775. n2,
  8776. container,
  8777. anchor,
  8778. parentComponent,
  8779. parentSuspense,
  8780. namespace,
  8781. slotScopeIds,
  8782. optimized,
  8783. rendererInternals
  8784. );
  8785. } else {
  8786. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  8787. n2.suspense = n1.suspense;
  8788. n2.suspense.vnode = n2;
  8789. n2.el = n1.el;
  8790. return;
  8791. }
  8792. patchSuspense(
  8793. n1,
  8794. n2,
  8795. container,
  8796. anchor,
  8797. parentComponent,
  8798. namespace,
  8799. slotScopeIds,
  8800. optimized,
  8801. rendererInternals
  8802. );
  8803. }
  8804. },
  8805. hydrate: hydrateSuspense,
  8806. normalize: normalizeSuspenseChildren
  8807. };
  8808. const Suspense = SuspenseImpl ;
  8809. function triggerEvent(vnode, name) {
  8810. const eventListener = vnode.props && vnode.props[name];
  8811. if (isFunction(eventListener)) {
  8812. eventListener();
  8813. }
  8814. }
  8815. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8816. const {
  8817. p: patch,
  8818. o: { createElement }
  8819. } = rendererInternals;
  8820. const hiddenContainer = createElement("div");
  8821. const suspense = vnode.suspense = createSuspenseBoundary(
  8822. vnode,
  8823. parentSuspense,
  8824. parentComponent,
  8825. container,
  8826. hiddenContainer,
  8827. anchor,
  8828. namespace,
  8829. slotScopeIds,
  8830. optimized,
  8831. rendererInternals
  8832. );
  8833. patch(
  8834. null,
  8835. suspense.pendingBranch = vnode.ssContent,
  8836. hiddenContainer,
  8837. null,
  8838. parentComponent,
  8839. suspense,
  8840. namespace,
  8841. slotScopeIds
  8842. );
  8843. if (suspense.deps > 0) {
  8844. triggerEvent(vnode, "onPending");
  8845. triggerEvent(vnode, "onFallback");
  8846. patch(
  8847. null,
  8848. vnode.ssFallback,
  8849. container,
  8850. anchor,
  8851. parentComponent,
  8852. null,
  8853. // fallback tree will not have suspense context
  8854. namespace,
  8855. slotScopeIds
  8856. );
  8857. setActiveBranch(suspense, vnode.ssFallback);
  8858. } else {
  8859. suspense.resolve(false, true);
  8860. }
  8861. }
  8862. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  8863. const suspense = n2.suspense = n1.suspense;
  8864. suspense.vnode = n2;
  8865. n2.el = n1.el;
  8866. const newBranch = n2.ssContent;
  8867. const newFallback = n2.ssFallback;
  8868. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  8869. if (pendingBranch) {
  8870. suspense.pendingBranch = newBranch;
  8871. if (isSameVNodeType(newBranch, pendingBranch)) {
  8872. patch(
  8873. pendingBranch,
  8874. newBranch,
  8875. suspense.hiddenContainer,
  8876. null,
  8877. parentComponent,
  8878. suspense,
  8879. namespace,
  8880. slotScopeIds,
  8881. optimized
  8882. );
  8883. if (suspense.deps <= 0) {
  8884. suspense.resolve();
  8885. } else if (isInFallback) {
  8886. if (!isHydrating) {
  8887. patch(
  8888. activeBranch,
  8889. newFallback,
  8890. container,
  8891. anchor,
  8892. parentComponent,
  8893. null,
  8894. // fallback tree will not have suspense context
  8895. namespace,
  8896. slotScopeIds,
  8897. optimized
  8898. );
  8899. setActiveBranch(suspense, newFallback);
  8900. }
  8901. }
  8902. } else {
  8903. suspense.pendingId = suspenseId++;
  8904. if (isHydrating) {
  8905. suspense.isHydrating = false;
  8906. suspense.activeBranch = pendingBranch;
  8907. } else {
  8908. unmount(pendingBranch, parentComponent, suspense);
  8909. }
  8910. suspense.deps = 0;
  8911. suspense.effects.length = 0;
  8912. suspense.hiddenContainer = createElement("div");
  8913. if (isInFallback) {
  8914. patch(
  8915. null,
  8916. newBranch,
  8917. suspense.hiddenContainer,
  8918. null,
  8919. parentComponent,
  8920. suspense,
  8921. namespace,
  8922. slotScopeIds,
  8923. optimized
  8924. );
  8925. if (suspense.deps <= 0) {
  8926. suspense.resolve();
  8927. } else {
  8928. patch(
  8929. activeBranch,
  8930. newFallback,
  8931. container,
  8932. anchor,
  8933. parentComponent,
  8934. null,
  8935. // fallback tree will not have suspense context
  8936. namespace,
  8937. slotScopeIds,
  8938. optimized
  8939. );
  8940. setActiveBranch(suspense, newFallback);
  8941. }
  8942. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  8943. patch(
  8944. activeBranch,
  8945. newBranch,
  8946. container,
  8947. anchor,
  8948. parentComponent,
  8949. suspense,
  8950. namespace,
  8951. slotScopeIds,
  8952. optimized
  8953. );
  8954. suspense.resolve(true);
  8955. } else {
  8956. patch(
  8957. null,
  8958. newBranch,
  8959. suspense.hiddenContainer,
  8960. null,
  8961. parentComponent,
  8962. suspense,
  8963. namespace,
  8964. slotScopeIds,
  8965. optimized
  8966. );
  8967. if (suspense.deps <= 0) {
  8968. suspense.resolve();
  8969. }
  8970. }
  8971. }
  8972. } else {
  8973. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  8974. patch(
  8975. activeBranch,
  8976. newBranch,
  8977. container,
  8978. anchor,
  8979. parentComponent,
  8980. suspense,
  8981. namespace,
  8982. slotScopeIds,
  8983. optimized
  8984. );
  8985. setActiveBranch(suspense, newBranch);
  8986. } else {
  8987. triggerEvent(n2, "onPending");
  8988. suspense.pendingBranch = newBranch;
  8989. if (newBranch.shapeFlag & 512) {
  8990. suspense.pendingId = newBranch.component.suspenseId;
  8991. } else {
  8992. suspense.pendingId = suspenseId++;
  8993. }
  8994. patch(
  8995. null,
  8996. newBranch,
  8997. suspense.hiddenContainer,
  8998. null,
  8999. parentComponent,
  9000. suspense,
  9001. namespace,
  9002. slotScopeIds,
  9003. optimized
  9004. );
  9005. if (suspense.deps <= 0) {
  9006. suspense.resolve();
  9007. } else {
  9008. const { timeout, pendingId } = suspense;
  9009. if (timeout > 0) {
  9010. setTimeout(() => {
  9011. if (suspense.pendingId === pendingId) {
  9012. suspense.fallback(newFallback);
  9013. }
  9014. }, timeout);
  9015. } else if (timeout === 0) {
  9016. suspense.fallback(newFallback);
  9017. }
  9018. }
  9019. }
  9020. }
  9021. }
  9022. let hasWarned = false;
  9023. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  9024. if (!hasWarned) {
  9025. hasWarned = true;
  9026. console[console.info ? "info" : "log"](
  9027. `<Suspense> is an experimental feature and its API will likely change.`
  9028. );
  9029. }
  9030. const {
  9031. p: patch,
  9032. m: move,
  9033. um: unmount,
  9034. n: next,
  9035. o: { parentNode, remove }
  9036. } = rendererInternals;
  9037. let parentSuspenseId;
  9038. const isSuspensible = isVNodeSuspensible(vnode);
  9039. if (isSuspensible) {
  9040. if (parentSuspense && parentSuspense.pendingBranch) {
  9041. parentSuspenseId = parentSuspense.pendingId;
  9042. parentSuspense.deps++;
  9043. }
  9044. }
  9045. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  9046. {
  9047. assertNumber(timeout, `Suspense timeout`);
  9048. }
  9049. const initialAnchor = anchor;
  9050. const suspense = {
  9051. vnode,
  9052. parent: parentSuspense,
  9053. parentComponent,
  9054. namespace,
  9055. container,
  9056. hiddenContainer,
  9057. deps: 0,
  9058. pendingId: suspenseId++,
  9059. timeout: typeof timeout === "number" ? timeout : -1,
  9060. activeBranch: null,
  9061. pendingBranch: null,
  9062. isInFallback: !isHydrating,
  9063. isHydrating,
  9064. isUnmounted: false,
  9065. effects: [],
  9066. resolve(resume = false, sync = false) {
  9067. {
  9068. if (!resume && !suspense.pendingBranch) {
  9069. throw new Error(
  9070. `suspense.resolve() is called without a pending branch.`
  9071. );
  9072. }
  9073. if (suspense.isUnmounted) {
  9074. throw new Error(
  9075. `suspense.resolve() is called on an already unmounted suspense boundary.`
  9076. );
  9077. }
  9078. }
  9079. const {
  9080. vnode: vnode2,
  9081. activeBranch,
  9082. pendingBranch,
  9083. pendingId,
  9084. effects,
  9085. parentComponent: parentComponent2,
  9086. container: container2
  9087. } = suspense;
  9088. let delayEnter = false;
  9089. if (suspense.isHydrating) {
  9090. suspense.isHydrating = false;
  9091. } else if (!resume) {
  9092. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  9093. if (delayEnter) {
  9094. activeBranch.transition.afterLeave = () => {
  9095. if (pendingId === suspense.pendingId) {
  9096. move(
  9097. pendingBranch,
  9098. container2,
  9099. anchor === initialAnchor ? next(activeBranch) : anchor,
  9100. 0
  9101. );
  9102. queuePostFlushCb(effects);
  9103. }
  9104. };
  9105. }
  9106. if (activeBranch) {
  9107. if (parentNode(activeBranch.el) === container2) {
  9108. anchor = next(activeBranch);
  9109. }
  9110. unmount(activeBranch, parentComponent2, suspense, true);
  9111. }
  9112. if (!delayEnter) {
  9113. move(pendingBranch, container2, anchor, 0);
  9114. }
  9115. }
  9116. setActiveBranch(suspense, pendingBranch);
  9117. suspense.pendingBranch = null;
  9118. suspense.isInFallback = false;
  9119. let parent = suspense.parent;
  9120. let hasUnresolvedAncestor = false;
  9121. while (parent) {
  9122. if (parent.pendingBranch) {
  9123. parent.effects.push(...effects);
  9124. hasUnresolvedAncestor = true;
  9125. break;
  9126. }
  9127. parent = parent.parent;
  9128. }
  9129. if (!hasUnresolvedAncestor && !delayEnter) {
  9130. queuePostFlushCb(effects);
  9131. }
  9132. suspense.effects = [];
  9133. if (isSuspensible) {
  9134. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  9135. parentSuspense.deps--;
  9136. if (parentSuspense.deps === 0 && !sync) {
  9137. parentSuspense.resolve();
  9138. }
  9139. }
  9140. }
  9141. triggerEvent(vnode2, "onResolve");
  9142. },
  9143. fallback(fallbackVNode) {
  9144. if (!suspense.pendingBranch) {
  9145. return;
  9146. }
  9147. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  9148. triggerEvent(vnode2, "onFallback");
  9149. const anchor2 = next(activeBranch);
  9150. const mountFallback = () => {
  9151. if (!suspense.isInFallback) {
  9152. return;
  9153. }
  9154. patch(
  9155. null,
  9156. fallbackVNode,
  9157. container2,
  9158. anchor2,
  9159. parentComponent2,
  9160. null,
  9161. // fallback tree will not have suspense context
  9162. namespace2,
  9163. slotScopeIds,
  9164. optimized
  9165. );
  9166. setActiveBranch(suspense, fallbackVNode);
  9167. };
  9168. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  9169. if (delayEnter) {
  9170. activeBranch.transition.afterLeave = mountFallback;
  9171. }
  9172. suspense.isInFallback = true;
  9173. unmount(
  9174. activeBranch,
  9175. parentComponent2,
  9176. null,
  9177. // no suspense so unmount hooks fire now
  9178. true
  9179. // shouldRemove
  9180. );
  9181. if (!delayEnter) {
  9182. mountFallback();
  9183. }
  9184. },
  9185. move(container2, anchor2, type) {
  9186. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  9187. suspense.container = container2;
  9188. },
  9189. next() {
  9190. return suspense.activeBranch && next(suspense.activeBranch);
  9191. },
  9192. registerDep(instance, setupRenderEffect, optimized2) {
  9193. const isInPendingSuspense = !!suspense.pendingBranch;
  9194. if (isInPendingSuspense) {
  9195. suspense.deps++;
  9196. }
  9197. const hydratedEl = instance.vnode.el;
  9198. instance.asyncDep.catch((err) => {
  9199. handleError(err, instance, 0);
  9200. }).then((asyncSetupResult) => {
  9201. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  9202. return;
  9203. }
  9204. instance.asyncResolved = true;
  9205. const { vnode: vnode2 } = instance;
  9206. {
  9207. pushWarningContext(vnode2);
  9208. }
  9209. handleSetupResult(instance, asyncSetupResult, false);
  9210. if (hydratedEl) {
  9211. vnode2.el = hydratedEl;
  9212. }
  9213. const placeholder = !hydratedEl && instance.subTree.el;
  9214. setupRenderEffect(
  9215. instance,
  9216. vnode2,
  9217. // component may have been moved before resolve.
  9218. // if this is not a hydration, instance.subTree will be the comment
  9219. // placeholder.
  9220. parentNode(hydratedEl || instance.subTree.el),
  9221. // anchor will not be used if this is hydration, so only need to
  9222. // consider the comment placeholder case.
  9223. hydratedEl ? null : next(instance.subTree),
  9224. suspense,
  9225. namespace,
  9226. optimized2
  9227. );
  9228. if (placeholder) {
  9229. remove(placeholder);
  9230. }
  9231. updateHOCHostEl(instance, vnode2.el);
  9232. {
  9233. popWarningContext();
  9234. }
  9235. if (isInPendingSuspense && --suspense.deps === 0) {
  9236. suspense.resolve();
  9237. }
  9238. });
  9239. },
  9240. unmount(parentSuspense2, doRemove) {
  9241. suspense.isUnmounted = true;
  9242. if (suspense.activeBranch) {
  9243. unmount(
  9244. suspense.activeBranch,
  9245. parentComponent,
  9246. parentSuspense2,
  9247. doRemove
  9248. );
  9249. }
  9250. if (suspense.pendingBranch) {
  9251. unmount(
  9252. suspense.pendingBranch,
  9253. parentComponent,
  9254. parentSuspense2,
  9255. doRemove
  9256. );
  9257. }
  9258. }
  9259. };
  9260. return suspense;
  9261. }
  9262. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  9263. const suspense = vnode.suspense = createSuspenseBoundary(
  9264. vnode,
  9265. parentSuspense,
  9266. parentComponent,
  9267. node.parentNode,
  9268. // eslint-disable-next-line no-restricted-globals
  9269. document.createElement("div"),
  9270. null,
  9271. namespace,
  9272. slotScopeIds,
  9273. optimized,
  9274. rendererInternals,
  9275. true
  9276. );
  9277. const result = hydrateNode(
  9278. node,
  9279. suspense.pendingBranch = vnode.ssContent,
  9280. parentComponent,
  9281. suspense,
  9282. slotScopeIds,
  9283. optimized
  9284. );
  9285. if (suspense.deps === 0) {
  9286. suspense.resolve(false, true);
  9287. }
  9288. return result;
  9289. }
  9290. function normalizeSuspenseChildren(vnode) {
  9291. const { shapeFlag, children } = vnode;
  9292. const isSlotChildren = shapeFlag & 32;
  9293. vnode.ssContent = normalizeSuspenseSlot(
  9294. isSlotChildren ? children.default : children
  9295. );
  9296. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  9297. }
  9298. function normalizeSuspenseSlot(s) {
  9299. let block;
  9300. if (isFunction(s)) {
  9301. const trackBlock = isBlockTreeEnabled && s._c;
  9302. if (trackBlock) {
  9303. s._d = false;
  9304. openBlock();
  9305. }
  9306. s = s();
  9307. if (trackBlock) {
  9308. s._d = true;
  9309. block = currentBlock;
  9310. closeBlock();
  9311. }
  9312. }
  9313. if (isArray(s)) {
  9314. const singleChild = filterSingleRoot(s);
  9315. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  9316. warn$1(`<Suspense> slots expect a single root node.`);
  9317. }
  9318. s = singleChild;
  9319. }
  9320. s = normalizeVNode(s);
  9321. if (block && !s.dynamicChildren) {
  9322. s.dynamicChildren = block.filter((c) => c !== s);
  9323. }
  9324. return s;
  9325. }
  9326. function queueEffectWithSuspense(fn, suspense) {
  9327. if (suspense && suspense.pendingBranch) {
  9328. if (isArray(fn)) {
  9329. suspense.effects.push(...fn);
  9330. } else {
  9331. suspense.effects.push(fn);
  9332. }
  9333. } else {
  9334. queuePostFlushCb(fn);
  9335. }
  9336. }
  9337. function setActiveBranch(suspense, branch) {
  9338. suspense.activeBranch = branch;
  9339. const { vnode, parentComponent } = suspense;
  9340. let el = branch.el;
  9341. while (!el && branch.component) {
  9342. branch = branch.component.subTree;
  9343. el = branch.el;
  9344. }
  9345. vnode.el = el;
  9346. if (parentComponent && parentComponent.subTree === vnode) {
  9347. parentComponent.vnode.el = el;
  9348. updateHOCHostEl(parentComponent, el);
  9349. }
  9350. }
  9351. function isVNodeSuspensible(vnode) {
  9352. const suspensible = vnode.props && vnode.props.suspensible;
  9353. return suspensible != null && suspensible !== false;
  9354. }
  9355. const Fragment = Symbol.for("v-fgt");
  9356. const Text = Symbol.for("v-txt");
  9357. const Comment = Symbol.for("v-cmt");
  9358. const Static = Symbol.for("v-stc");
  9359. const blockStack = [];
  9360. let currentBlock = null;
  9361. function openBlock(disableTracking = false) {
  9362. blockStack.push(currentBlock = disableTracking ? null : []);
  9363. }
  9364. function closeBlock() {
  9365. blockStack.pop();
  9366. currentBlock = blockStack[blockStack.length - 1] || null;
  9367. }
  9368. let isBlockTreeEnabled = 1;
  9369. function setBlockTracking(value) {
  9370. isBlockTreeEnabled += value;
  9371. if (value < 0 && currentBlock) {
  9372. currentBlock.hasOnce = true;
  9373. }
  9374. }
  9375. function setupBlock(vnode) {
  9376. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  9377. closeBlock();
  9378. if (isBlockTreeEnabled > 0 && currentBlock) {
  9379. currentBlock.push(vnode);
  9380. }
  9381. return vnode;
  9382. }
  9383. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  9384. return setupBlock(
  9385. createBaseVNode(
  9386. type,
  9387. props,
  9388. children,
  9389. patchFlag,
  9390. dynamicProps,
  9391. shapeFlag,
  9392. true
  9393. )
  9394. );
  9395. }
  9396. function createBlock(type, props, children, patchFlag, dynamicProps) {
  9397. return setupBlock(
  9398. createVNode(
  9399. type,
  9400. props,
  9401. children,
  9402. patchFlag,
  9403. dynamicProps,
  9404. true
  9405. )
  9406. );
  9407. }
  9408. function isVNode(value) {
  9409. return value ? value.__v_isVNode === true : false;
  9410. }
  9411. function isSameVNodeType(n1, n2) {
  9412. if (n2.shapeFlag & 6 && n1.component) {
  9413. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  9414. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  9415. n1.shapeFlag &= ~256;
  9416. n2.shapeFlag &= ~512;
  9417. return false;
  9418. }
  9419. }
  9420. return n1.type === n2.type && n1.key === n2.key;
  9421. }
  9422. let vnodeArgsTransformer;
  9423. function transformVNodeArgs(transformer) {
  9424. vnodeArgsTransformer = transformer;
  9425. }
  9426. const createVNodeWithArgsTransform = (...args) => {
  9427. return _createVNode(
  9428. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  9429. );
  9430. };
  9431. const normalizeKey = ({ key }) => key != null ? key : null;
  9432. const normalizeRef = ({
  9433. ref,
  9434. ref_key,
  9435. ref_for
  9436. }) => {
  9437. if (typeof ref === "number") {
  9438. ref = "" + ref;
  9439. }
  9440. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  9441. };
  9442. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  9443. const vnode = {
  9444. __v_isVNode: true,
  9445. __v_skip: true,
  9446. type,
  9447. props,
  9448. key: props && normalizeKey(props),
  9449. ref: props && normalizeRef(props),
  9450. scopeId: currentScopeId,
  9451. slotScopeIds: null,
  9452. children,
  9453. component: null,
  9454. suspense: null,
  9455. ssContent: null,
  9456. ssFallback: null,
  9457. dirs: null,
  9458. transition: null,
  9459. el: null,
  9460. anchor: null,
  9461. target: null,
  9462. targetStart: null,
  9463. targetAnchor: null,
  9464. staticCount: 0,
  9465. shapeFlag,
  9466. patchFlag,
  9467. dynamicProps,
  9468. dynamicChildren: null,
  9469. appContext: null,
  9470. ctx: currentRenderingInstance
  9471. };
  9472. if (needFullChildrenNormalization) {
  9473. normalizeChildren(vnode, children);
  9474. if (shapeFlag & 128) {
  9475. type.normalize(vnode);
  9476. }
  9477. } else if (children) {
  9478. vnode.shapeFlag |= isString(children) ? 8 : 16;
  9479. }
  9480. if (vnode.key !== vnode.key) {
  9481. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  9482. }
  9483. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  9484. !isBlockNode && // has current parent block
  9485. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  9486. // component nodes also should always be patched, because even if the
  9487. // component doesn't need to update, it needs to persist the instance on to
  9488. // the next vnode so that it can be properly unmounted later.
  9489. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  9490. // vnode should not be considered dynamic due to handler caching.
  9491. vnode.patchFlag !== 32) {
  9492. currentBlock.push(vnode);
  9493. }
  9494. return vnode;
  9495. }
  9496. const createVNode = createVNodeWithArgsTransform ;
  9497. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  9498. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  9499. if (!type) {
  9500. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  9501. }
  9502. type = Comment;
  9503. }
  9504. if (isVNode(type)) {
  9505. const cloned = cloneVNode(
  9506. type,
  9507. props,
  9508. true
  9509. /* mergeRef: true */
  9510. );
  9511. if (children) {
  9512. normalizeChildren(cloned, children);
  9513. }
  9514. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  9515. if (cloned.shapeFlag & 6) {
  9516. currentBlock[currentBlock.indexOf(type)] = cloned;
  9517. } else {
  9518. currentBlock.push(cloned);
  9519. }
  9520. }
  9521. cloned.patchFlag = -2;
  9522. return cloned;
  9523. }
  9524. if (isClassComponent(type)) {
  9525. type = type.__vccOpts;
  9526. }
  9527. if (props) {
  9528. props = guardReactiveProps(props);
  9529. let { class: klass, style } = props;
  9530. if (klass && !isString(klass)) {
  9531. props.class = normalizeClass(klass);
  9532. }
  9533. if (isObject(style)) {
  9534. if (isProxy(style) && !isArray(style)) {
  9535. style = extend({}, style);
  9536. }
  9537. props.style = normalizeStyle(style);
  9538. }
  9539. }
  9540. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  9541. if (shapeFlag & 4 && isProxy(type)) {
  9542. type = toRaw(type);
  9543. warn$1(
  9544. `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
  9545. `
  9546. Component that was made reactive: `,
  9547. type
  9548. );
  9549. }
  9550. return createBaseVNode(
  9551. type,
  9552. props,
  9553. children,
  9554. patchFlag,
  9555. dynamicProps,
  9556. shapeFlag,
  9557. isBlockNode,
  9558. true
  9559. );
  9560. }
  9561. function guardReactiveProps(props) {
  9562. if (!props) return null;
  9563. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  9564. }
  9565. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  9566. const { props, ref, patchFlag, children, transition } = vnode;
  9567. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  9568. const cloned = {
  9569. __v_isVNode: true,
  9570. __v_skip: true,
  9571. type: vnode.type,
  9572. props: mergedProps,
  9573. key: mergedProps && normalizeKey(mergedProps),
  9574. ref: extraProps && extraProps.ref ? (
  9575. // #2078 in the case of <component :is="vnode" ref="extra"/>
  9576. // if the vnode itself already has a ref, cloneVNode will need to merge
  9577. // the refs so the single vnode can be set on multiple refs
  9578. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  9579. ) : ref,
  9580. scopeId: vnode.scopeId,
  9581. slotScopeIds: vnode.slotScopeIds,
  9582. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  9583. target: vnode.target,
  9584. targetStart: vnode.targetStart,
  9585. targetAnchor: vnode.targetAnchor,
  9586. staticCount: vnode.staticCount,
  9587. shapeFlag: vnode.shapeFlag,
  9588. // if the vnode is cloned with extra props, we can no longer assume its
  9589. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  9590. // note: preserve flag for fragments since they use the flag for children
  9591. // fast paths only.
  9592. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  9593. dynamicProps: vnode.dynamicProps,
  9594. dynamicChildren: vnode.dynamicChildren,
  9595. appContext: vnode.appContext,
  9596. dirs: vnode.dirs,
  9597. transition,
  9598. // These should technically only be non-null on mounted VNodes. However,
  9599. // they *should* be copied for kept-alive vnodes. So we just always copy
  9600. // them since them being non-null during a mount doesn't affect the logic as
  9601. // they will simply be overwritten.
  9602. component: vnode.component,
  9603. suspense: vnode.suspense,
  9604. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  9605. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  9606. el: vnode.el,
  9607. anchor: vnode.anchor,
  9608. ctx: vnode.ctx,
  9609. ce: vnode.ce
  9610. };
  9611. if (transition && cloneTransition) {
  9612. setTransitionHooks(
  9613. cloned,
  9614. transition.clone(cloned)
  9615. );
  9616. }
  9617. return cloned;
  9618. }
  9619. function deepCloneVNode(vnode) {
  9620. const cloned = cloneVNode(vnode);
  9621. if (isArray(vnode.children)) {
  9622. cloned.children = vnode.children.map(deepCloneVNode);
  9623. }
  9624. return cloned;
  9625. }
  9626. function createTextVNode(text = " ", flag = 0) {
  9627. return createVNode(Text, null, text, flag);
  9628. }
  9629. function createStaticVNode(content, numberOfNodes) {
  9630. const vnode = createVNode(Static, null, content);
  9631. vnode.staticCount = numberOfNodes;
  9632. return vnode;
  9633. }
  9634. function createCommentVNode(text = "", asBlock = false) {
  9635. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  9636. }
  9637. function normalizeVNode(child) {
  9638. if (child == null || typeof child === "boolean") {
  9639. return createVNode(Comment);
  9640. } else if (isArray(child)) {
  9641. return createVNode(
  9642. Fragment,
  9643. null,
  9644. // #3666, avoid reference pollution when reusing vnode
  9645. child.slice()
  9646. );
  9647. } else if (isVNode(child)) {
  9648. return cloneIfMounted(child);
  9649. } else {
  9650. return createVNode(Text, null, String(child));
  9651. }
  9652. }
  9653. function cloneIfMounted(child) {
  9654. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  9655. }
  9656. function normalizeChildren(vnode, children) {
  9657. let type = 0;
  9658. const { shapeFlag } = vnode;
  9659. if (children == null) {
  9660. children = null;
  9661. } else if (isArray(children)) {
  9662. type = 16;
  9663. } else if (typeof children === "object") {
  9664. if (shapeFlag & (1 | 64)) {
  9665. const slot = children.default;
  9666. if (slot) {
  9667. slot._c && (slot._d = false);
  9668. normalizeChildren(vnode, slot());
  9669. slot._c && (slot._d = true);
  9670. }
  9671. return;
  9672. } else {
  9673. type = 32;
  9674. const slotFlag = children._;
  9675. if (!slotFlag && !isInternalObject(children)) {
  9676. children._ctx = currentRenderingInstance;
  9677. } else if (slotFlag === 3 && currentRenderingInstance) {
  9678. if (currentRenderingInstance.slots._ === 1) {
  9679. children._ = 1;
  9680. } else {
  9681. children._ = 2;
  9682. vnode.patchFlag |= 1024;
  9683. }
  9684. }
  9685. }
  9686. } else if (isFunction(children)) {
  9687. children = { default: children, _ctx: currentRenderingInstance };
  9688. type = 32;
  9689. } else {
  9690. children = String(children);
  9691. if (shapeFlag & 64) {
  9692. type = 16;
  9693. children = [createTextVNode(children)];
  9694. } else {
  9695. type = 8;
  9696. }
  9697. }
  9698. vnode.children = children;
  9699. vnode.shapeFlag |= type;
  9700. }
  9701. function mergeProps(...args) {
  9702. const ret = {};
  9703. for (let i = 0; i < args.length; i++) {
  9704. const toMerge = args[i];
  9705. for (const key in toMerge) {
  9706. if (key === "class") {
  9707. if (ret.class !== toMerge.class) {
  9708. ret.class = normalizeClass([ret.class, toMerge.class]);
  9709. }
  9710. } else if (key === "style") {
  9711. ret.style = normalizeStyle([ret.style, toMerge.style]);
  9712. } else if (isOn(key)) {
  9713. const existing = ret[key];
  9714. const incoming = toMerge[key];
  9715. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  9716. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  9717. }
  9718. } else if (key !== "") {
  9719. ret[key] = toMerge[key];
  9720. }
  9721. }
  9722. }
  9723. return ret;
  9724. }
  9725. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  9726. callWithAsyncErrorHandling(hook, instance, 7, [
  9727. vnode,
  9728. prevVNode
  9729. ]);
  9730. }
  9731. const emptyAppContext = createAppContext();
  9732. let uid = 0;
  9733. function createComponentInstance(vnode, parent, suspense) {
  9734. const type = vnode.type;
  9735. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  9736. const instance = {
  9737. uid: uid++,
  9738. vnode,
  9739. type,
  9740. parent,
  9741. appContext,
  9742. root: null,
  9743. // to be immediately set
  9744. next: null,
  9745. subTree: null,
  9746. // will be set synchronously right after creation
  9747. effect: null,
  9748. update: null,
  9749. // will be set synchronously right after creation
  9750. job: null,
  9751. scope: new EffectScope(
  9752. true
  9753. /* detached */
  9754. ),
  9755. render: null,
  9756. proxy: null,
  9757. exposed: null,
  9758. exposeProxy: null,
  9759. withProxy: null,
  9760. provides: parent ? parent.provides : Object.create(appContext.provides),
  9761. ids: parent ? parent.ids : ["", 0, 0],
  9762. accessCache: null,
  9763. renderCache: [],
  9764. // local resolved assets
  9765. components: null,
  9766. directives: null,
  9767. // resolved props and emits options
  9768. propsOptions: normalizePropsOptions(type, appContext),
  9769. emitsOptions: normalizeEmitsOptions(type, appContext),
  9770. // emit
  9771. emit: null,
  9772. // to be set immediately
  9773. emitted: null,
  9774. // props default value
  9775. propsDefaults: EMPTY_OBJ,
  9776. // inheritAttrs
  9777. inheritAttrs: type.inheritAttrs,
  9778. // state
  9779. ctx: EMPTY_OBJ,
  9780. data: EMPTY_OBJ,
  9781. props: EMPTY_OBJ,
  9782. attrs: EMPTY_OBJ,
  9783. slots: EMPTY_OBJ,
  9784. refs: EMPTY_OBJ,
  9785. setupState: EMPTY_OBJ,
  9786. setupContext: null,
  9787. // suspense related
  9788. suspense,
  9789. suspenseId: suspense ? suspense.pendingId : 0,
  9790. asyncDep: null,
  9791. asyncResolved: false,
  9792. // lifecycle hooks
  9793. // not using enums here because it results in computed properties
  9794. isMounted: false,
  9795. isUnmounted: false,
  9796. isDeactivated: false,
  9797. bc: null,
  9798. c: null,
  9799. bm: null,
  9800. m: null,
  9801. bu: null,
  9802. u: null,
  9803. um: null,
  9804. bum: null,
  9805. da: null,
  9806. a: null,
  9807. rtg: null,
  9808. rtc: null,
  9809. ec: null,
  9810. sp: null
  9811. };
  9812. {
  9813. instance.ctx = createDevRenderContext(instance);
  9814. }
  9815. instance.root = parent ? parent.root : instance;
  9816. instance.emit = emit.bind(null, instance);
  9817. if (vnode.ce) {
  9818. vnode.ce(instance);
  9819. }
  9820. return instance;
  9821. }
  9822. let currentInstance = null;
  9823. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  9824. let internalSetCurrentInstance;
  9825. let setInSSRSetupState;
  9826. {
  9827. internalSetCurrentInstance = (i) => {
  9828. currentInstance = i;
  9829. };
  9830. setInSSRSetupState = (v) => {
  9831. isInSSRComponentSetup = v;
  9832. };
  9833. }
  9834. const setCurrentInstance = (instance) => {
  9835. const prev = currentInstance;
  9836. internalSetCurrentInstance(instance);
  9837. instance.scope.on();
  9838. return () => {
  9839. instance.scope.off();
  9840. internalSetCurrentInstance(prev);
  9841. };
  9842. };
  9843. const unsetCurrentInstance = () => {
  9844. currentInstance && currentInstance.scope.off();
  9845. internalSetCurrentInstance(null);
  9846. };
  9847. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  9848. function validateComponentName(name, { isNativeTag }) {
  9849. if (isBuiltInTag(name) || isNativeTag(name)) {
  9850. warn$1(
  9851. "Do not use built-in or reserved HTML elements as component id: " + name
  9852. );
  9853. }
  9854. }
  9855. function isStatefulComponent(instance) {
  9856. return instance.vnode.shapeFlag & 4;
  9857. }
  9858. let isInSSRComponentSetup = false;
  9859. function setupComponent(instance, isSSR = false, optimized = false) {
  9860. isSSR && setInSSRSetupState(isSSR);
  9861. const { props, children } = instance.vnode;
  9862. const isStateful = isStatefulComponent(instance);
  9863. initProps(instance, props, isStateful, isSSR);
  9864. initSlots(instance, children, optimized);
  9865. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  9866. isSSR && setInSSRSetupState(false);
  9867. return setupResult;
  9868. }
  9869. function setupStatefulComponent(instance, isSSR) {
  9870. var _a;
  9871. const Component = instance.type;
  9872. {
  9873. if (Component.name) {
  9874. validateComponentName(Component.name, instance.appContext.config);
  9875. }
  9876. if (Component.components) {
  9877. const names = Object.keys(Component.components);
  9878. for (let i = 0; i < names.length; i++) {
  9879. validateComponentName(names[i], instance.appContext.config);
  9880. }
  9881. }
  9882. if (Component.directives) {
  9883. const names = Object.keys(Component.directives);
  9884. for (let i = 0; i < names.length; i++) {
  9885. validateDirectiveName(names[i]);
  9886. }
  9887. }
  9888. if (Component.compilerOptions && isRuntimeOnly()) {
  9889. warn$1(
  9890. `"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.`
  9891. );
  9892. }
  9893. }
  9894. instance.accessCache = /* @__PURE__ */ Object.create(null);
  9895. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  9896. {
  9897. exposePropsOnRenderContext(instance);
  9898. }
  9899. const { setup } = Component;
  9900. if (setup) {
  9901. pauseTracking();
  9902. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  9903. const reset = setCurrentInstance(instance);
  9904. const setupResult = callWithErrorHandling(
  9905. setup,
  9906. instance,
  9907. 0,
  9908. [
  9909. shallowReadonly(instance.props) ,
  9910. setupContext
  9911. ]
  9912. );
  9913. const isAsyncSetup = isPromise(setupResult);
  9914. resetTracking();
  9915. reset();
  9916. if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
  9917. markAsyncBoundary(instance);
  9918. }
  9919. if (isAsyncSetup) {
  9920. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  9921. if (isSSR) {
  9922. return setupResult.then((resolvedResult) => {
  9923. handleSetupResult(instance, resolvedResult, isSSR);
  9924. }).catch((e) => {
  9925. handleError(e, instance, 0);
  9926. });
  9927. } else {
  9928. instance.asyncDep = setupResult;
  9929. if (!instance.suspense) {
  9930. const name = (_a = Component.name) != null ? _a : "Anonymous";
  9931. warn$1(
  9932. `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.`
  9933. );
  9934. }
  9935. }
  9936. } else {
  9937. handleSetupResult(instance, setupResult, isSSR);
  9938. }
  9939. } else {
  9940. finishComponentSetup(instance, isSSR);
  9941. }
  9942. }
  9943. function handleSetupResult(instance, setupResult, isSSR) {
  9944. if (isFunction(setupResult)) {
  9945. {
  9946. instance.render = setupResult;
  9947. }
  9948. } else if (isObject(setupResult)) {
  9949. if (isVNode(setupResult)) {
  9950. warn$1(
  9951. `setup() should not return VNodes directly - return a render function instead.`
  9952. );
  9953. }
  9954. {
  9955. instance.devtoolsRawSetupState = setupResult;
  9956. }
  9957. instance.setupState = proxyRefs(setupResult);
  9958. {
  9959. exposeSetupStateOnRenderContext(instance);
  9960. }
  9961. } else if (setupResult !== void 0) {
  9962. warn$1(
  9963. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  9964. );
  9965. }
  9966. finishComponentSetup(instance, isSSR);
  9967. }
  9968. let compile$1;
  9969. let installWithProxy;
  9970. function registerRuntimeCompiler(_compile) {
  9971. compile$1 = _compile;
  9972. installWithProxy = (i) => {
  9973. if (i.render._rc) {
  9974. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  9975. }
  9976. };
  9977. }
  9978. const isRuntimeOnly = () => !compile$1;
  9979. function finishComponentSetup(instance, isSSR, skipOptions) {
  9980. const Component = instance.type;
  9981. if (!instance.render) {
  9982. if (!isSSR && compile$1 && !Component.render) {
  9983. const template = Component.template || resolveMergedOptions(instance).template;
  9984. if (template) {
  9985. {
  9986. startMeasure(instance, `compile`);
  9987. }
  9988. const { isCustomElement, compilerOptions } = instance.appContext.config;
  9989. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  9990. const finalCompilerOptions = extend(
  9991. extend(
  9992. {
  9993. isCustomElement,
  9994. delimiters
  9995. },
  9996. compilerOptions
  9997. ),
  9998. componentCompilerOptions
  9999. );
  10000. Component.render = compile$1(template, finalCompilerOptions);
  10001. {
  10002. endMeasure(instance, `compile`);
  10003. }
  10004. }
  10005. }
  10006. instance.render = Component.render || NOOP;
  10007. if (installWithProxy) {
  10008. installWithProxy(instance);
  10009. }
  10010. }
  10011. {
  10012. const reset = setCurrentInstance(instance);
  10013. pauseTracking();
  10014. try {
  10015. applyOptions(instance);
  10016. } finally {
  10017. resetTracking();
  10018. reset();
  10019. }
  10020. }
  10021. if (!Component.render && instance.render === NOOP && !isSSR) {
  10022. if (!compile$1 && Component.template) {
  10023. warn$1(
  10024. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
  10025. );
  10026. } else {
  10027. warn$1(`Component is missing template or render function: `, Component);
  10028. }
  10029. }
  10030. }
  10031. const attrsProxyHandlers = {
  10032. get(target, key) {
  10033. markAttrsAccessed();
  10034. track(target, "get", "");
  10035. return target[key];
  10036. },
  10037. set() {
  10038. warn$1(`setupContext.attrs is readonly.`);
  10039. return false;
  10040. },
  10041. deleteProperty() {
  10042. warn$1(`setupContext.attrs is readonly.`);
  10043. return false;
  10044. }
  10045. } ;
  10046. function getSlotsProxy(instance) {
  10047. return new Proxy(instance.slots, {
  10048. get(target, key) {
  10049. track(instance, "get", "$slots");
  10050. return target[key];
  10051. }
  10052. });
  10053. }
  10054. function createSetupContext(instance) {
  10055. const expose = (exposed) => {
  10056. {
  10057. if (instance.exposed) {
  10058. warn$1(`expose() should be called only once per setup().`);
  10059. }
  10060. if (exposed != null) {
  10061. let exposedType = typeof exposed;
  10062. if (exposedType === "object") {
  10063. if (isArray(exposed)) {
  10064. exposedType = "array";
  10065. } else if (isRef(exposed)) {
  10066. exposedType = "ref";
  10067. }
  10068. }
  10069. if (exposedType !== "object") {
  10070. warn$1(
  10071. `expose() should be passed a plain object, received ${exposedType}.`
  10072. );
  10073. }
  10074. }
  10075. }
  10076. instance.exposed = exposed || {};
  10077. };
  10078. {
  10079. let attrsProxy;
  10080. let slotsProxy;
  10081. return Object.freeze({
  10082. get attrs() {
  10083. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  10084. },
  10085. get slots() {
  10086. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  10087. },
  10088. get emit() {
  10089. return (event, ...args) => instance.emit(event, ...args);
  10090. },
  10091. expose
  10092. });
  10093. }
  10094. }
  10095. function getComponentPublicInstance(instance) {
  10096. if (instance.exposed) {
  10097. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  10098. get(target, key) {
  10099. if (key in target) {
  10100. return target[key];
  10101. } else if (key in publicPropertiesMap) {
  10102. return publicPropertiesMap[key](instance);
  10103. }
  10104. },
  10105. has(target, key) {
  10106. return key in target || key in publicPropertiesMap;
  10107. }
  10108. }));
  10109. } else {
  10110. return instance.proxy;
  10111. }
  10112. }
  10113. const classifyRE = /(?:^|[-_])(\w)/g;
  10114. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  10115. function getComponentName(Component, includeInferred = true) {
  10116. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  10117. }
  10118. function formatComponentName(instance, Component, isRoot = false) {
  10119. let name = getComponentName(Component);
  10120. if (!name && Component.__file) {
  10121. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  10122. if (match) {
  10123. name = match[1];
  10124. }
  10125. }
  10126. if (!name && instance && instance.parent) {
  10127. const inferFromRegistry = (registry) => {
  10128. for (const key in registry) {
  10129. if (registry[key] === Component) {
  10130. return key;
  10131. }
  10132. }
  10133. };
  10134. name = inferFromRegistry(
  10135. instance.components || instance.parent.type.components
  10136. ) || inferFromRegistry(instance.appContext.components);
  10137. }
  10138. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  10139. }
  10140. function isClassComponent(value) {
  10141. return isFunction(value) && "__vccOpts" in value;
  10142. }
  10143. const computed = (getterOrOptions, debugOptions) => {
  10144. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  10145. {
  10146. const i = getCurrentInstance();
  10147. if (i && i.appContext.config.warnRecursiveComputed) {
  10148. c._warnRecursive = true;
  10149. }
  10150. }
  10151. return c;
  10152. };
  10153. function h(type, propsOrChildren, children) {
  10154. const l = arguments.length;
  10155. if (l === 2) {
  10156. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  10157. if (isVNode(propsOrChildren)) {
  10158. return createVNode(type, null, [propsOrChildren]);
  10159. }
  10160. return createVNode(type, propsOrChildren);
  10161. } else {
  10162. return createVNode(type, null, propsOrChildren);
  10163. }
  10164. } else {
  10165. if (l > 3) {
  10166. children = Array.prototype.slice.call(arguments, 2);
  10167. } else if (l === 3 && isVNode(children)) {
  10168. children = [children];
  10169. }
  10170. return createVNode(type, propsOrChildren, children);
  10171. }
  10172. }
  10173. function initCustomFormatter() {
  10174. if (typeof window === "undefined") {
  10175. return;
  10176. }
  10177. const vueStyle = { style: "color:#3ba776" };
  10178. const numberStyle = { style: "color:#1677ff" };
  10179. const stringStyle = { style: "color:#f5222d" };
  10180. const keywordStyle = { style: "color:#eb2f96" };
  10181. const formatter = {
  10182. __vue_custom_formatter: true,
  10183. header(obj) {
  10184. if (!isObject(obj)) {
  10185. return null;
  10186. }
  10187. if (obj.__isVue) {
  10188. return ["div", vueStyle, `VueInstance`];
  10189. } else if (isRef(obj)) {
  10190. return [
  10191. "div",
  10192. {},
  10193. ["span", vueStyle, genRefFlag(obj)],
  10194. "<",
  10195. // avoid debugger accessing value affecting behavior
  10196. formatValue("_value" in obj ? obj._value : obj),
  10197. `>`
  10198. ];
  10199. } else if (isReactive(obj)) {
  10200. return [
  10201. "div",
  10202. {},
  10203. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  10204. "<",
  10205. formatValue(obj),
  10206. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  10207. ];
  10208. } else if (isReadonly(obj)) {
  10209. return [
  10210. "div",
  10211. {},
  10212. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  10213. "<",
  10214. formatValue(obj),
  10215. ">"
  10216. ];
  10217. }
  10218. return null;
  10219. },
  10220. hasBody(obj) {
  10221. return obj && obj.__isVue;
  10222. },
  10223. body(obj) {
  10224. if (obj && obj.__isVue) {
  10225. return [
  10226. "div",
  10227. {},
  10228. ...formatInstance(obj.$)
  10229. ];
  10230. }
  10231. }
  10232. };
  10233. function formatInstance(instance) {
  10234. const blocks = [];
  10235. if (instance.type.props && instance.props) {
  10236. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  10237. }
  10238. if (instance.setupState !== EMPTY_OBJ) {
  10239. blocks.push(createInstanceBlock("setup", instance.setupState));
  10240. }
  10241. if (instance.data !== EMPTY_OBJ) {
  10242. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  10243. }
  10244. const computed = extractKeys(instance, "computed");
  10245. if (computed) {
  10246. blocks.push(createInstanceBlock("computed", computed));
  10247. }
  10248. const injected = extractKeys(instance, "inject");
  10249. if (injected) {
  10250. blocks.push(createInstanceBlock("injected", injected));
  10251. }
  10252. blocks.push([
  10253. "div",
  10254. {},
  10255. [
  10256. "span",
  10257. {
  10258. style: keywordStyle.style + ";opacity:0.66"
  10259. },
  10260. "$ (internal): "
  10261. ],
  10262. ["object", { object: instance }]
  10263. ]);
  10264. return blocks;
  10265. }
  10266. function createInstanceBlock(type, target) {
  10267. target = extend({}, target);
  10268. if (!Object.keys(target).length) {
  10269. return ["span", {}];
  10270. }
  10271. return [
  10272. "div",
  10273. { style: "line-height:1.25em;margin-bottom:0.6em" },
  10274. [
  10275. "div",
  10276. {
  10277. style: "color:#476582"
  10278. },
  10279. type
  10280. ],
  10281. [
  10282. "div",
  10283. {
  10284. style: "padding-left:1.25em"
  10285. },
  10286. ...Object.keys(target).map((key) => {
  10287. return [
  10288. "div",
  10289. {},
  10290. ["span", keywordStyle, key + ": "],
  10291. formatValue(target[key], false)
  10292. ];
  10293. })
  10294. ]
  10295. ];
  10296. }
  10297. function formatValue(v, asRaw = true) {
  10298. if (typeof v === "number") {
  10299. return ["span", numberStyle, v];
  10300. } else if (typeof v === "string") {
  10301. return ["span", stringStyle, JSON.stringify(v)];
  10302. } else if (typeof v === "boolean") {
  10303. return ["span", keywordStyle, v];
  10304. } else if (isObject(v)) {
  10305. return ["object", { object: asRaw ? toRaw(v) : v }];
  10306. } else {
  10307. return ["span", stringStyle, String(v)];
  10308. }
  10309. }
  10310. function extractKeys(instance, type) {
  10311. const Comp = instance.type;
  10312. if (isFunction(Comp)) {
  10313. return;
  10314. }
  10315. const extracted = {};
  10316. for (const key in instance.ctx) {
  10317. if (isKeyOfType(Comp, key, type)) {
  10318. extracted[key] = instance.ctx[key];
  10319. }
  10320. }
  10321. return extracted;
  10322. }
  10323. function isKeyOfType(Comp, key, type) {
  10324. const opts = Comp[type];
  10325. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  10326. return true;
  10327. }
  10328. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  10329. return true;
  10330. }
  10331. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  10332. return true;
  10333. }
  10334. }
  10335. function genRefFlag(v) {
  10336. if (isShallow(v)) {
  10337. return `ShallowRef`;
  10338. }
  10339. if (v.effect) {
  10340. return `ComputedRef`;
  10341. }
  10342. return `Ref`;
  10343. }
  10344. if (window.devtoolsFormatters) {
  10345. window.devtoolsFormatters.push(formatter);
  10346. } else {
  10347. window.devtoolsFormatters = [formatter];
  10348. }
  10349. }
  10350. function withMemo(memo, render, cache, index) {
  10351. const cached = cache[index];
  10352. if (cached && isMemoSame(cached, memo)) {
  10353. return cached;
  10354. }
  10355. const ret = render();
  10356. ret.memo = memo.slice();
  10357. ret.cacheIndex = index;
  10358. return cache[index] = ret;
  10359. }
  10360. function isMemoSame(cached, memo) {
  10361. const prev = cached.memo;
  10362. if (prev.length != memo.length) {
  10363. return false;
  10364. }
  10365. for (let i = 0; i < prev.length; i++) {
  10366. if (hasChanged(prev[i], memo[i])) {
  10367. return false;
  10368. }
  10369. }
  10370. if (isBlockTreeEnabled > 0 && currentBlock) {
  10371. currentBlock.push(cached);
  10372. }
  10373. return true;
  10374. }
  10375. const version = "3.5.12";
  10376. const warn = warn$1 ;
  10377. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  10378. const devtools = devtools$1 ;
  10379. const setDevtoolsHook = setDevtoolsHook$1 ;
  10380. const ssrUtils = null;
  10381. const resolveFilter = null;
  10382. const compatUtils = null;
  10383. const DeprecationTypes = null;
  10384. let policy = void 0;
  10385. const tt = typeof window !== "undefined" && window.trustedTypes;
  10386. if (tt) {
  10387. try {
  10388. policy = /* @__PURE__ */ tt.createPolicy("vue", {
  10389. createHTML: (val) => val
  10390. });
  10391. } catch (e) {
  10392. warn(`Error creating trusted types policy: ${e}`);
  10393. }
  10394. }
  10395. const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
  10396. const svgNS = "http://www.w3.org/2000/svg";
  10397. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  10398. const doc = typeof document !== "undefined" ? document : null;
  10399. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  10400. const nodeOps = {
  10401. insert: (child, parent, anchor) => {
  10402. parent.insertBefore(child, anchor || null);
  10403. },
  10404. remove: (child) => {
  10405. const parent = child.parentNode;
  10406. if (parent) {
  10407. parent.removeChild(child);
  10408. }
  10409. },
  10410. createElement: (tag, namespace, is, props) => {
  10411. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  10412. if (tag === "select" && props && props.multiple != null) {
  10413. el.setAttribute("multiple", props.multiple);
  10414. }
  10415. return el;
  10416. },
  10417. createText: (text) => doc.createTextNode(text),
  10418. createComment: (text) => doc.createComment(text),
  10419. setText: (node, text) => {
  10420. node.nodeValue = text;
  10421. },
  10422. setElementText: (el, text) => {
  10423. el.textContent = text;
  10424. },
  10425. parentNode: (node) => node.parentNode,
  10426. nextSibling: (node) => node.nextSibling,
  10427. querySelector: (selector) => doc.querySelector(selector),
  10428. setScopeId(el, id) {
  10429. el.setAttribute(id, "");
  10430. },
  10431. // __UNSAFE__
  10432. // Reason: innerHTML.
  10433. // Static content here can only come from compiled templates.
  10434. // As long as the user only uses trusted templates, this is safe.
  10435. insertStaticContent(content, parent, anchor, namespace, start, end) {
  10436. const before = anchor ? anchor.previousSibling : parent.lastChild;
  10437. if (start && (start === end || start.nextSibling)) {
  10438. while (true) {
  10439. parent.insertBefore(start.cloneNode(true), anchor);
  10440. if (start === end || !(start = start.nextSibling)) break;
  10441. }
  10442. } else {
  10443. templateContainer.innerHTML = unsafeToTrustedHTML(
  10444. namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
  10445. );
  10446. const template = templateContainer.content;
  10447. if (namespace === "svg" || namespace === "mathml") {
  10448. const wrapper = template.firstChild;
  10449. while (wrapper.firstChild) {
  10450. template.appendChild(wrapper.firstChild);
  10451. }
  10452. template.removeChild(wrapper);
  10453. }
  10454. parent.insertBefore(template, anchor);
  10455. }
  10456. return [
  10457. // first
  10458. before ? before.nextSibling : parent.firstChild,
  10459. // last
  10460. anchor ? anchor.previousSibling : parent.lastChild
  10461. ];
  10462. }
  10463. };
  10464. const TRANSITION$1 = "transition";
  10465. const ANIMATION = "animation";
  10466. const vtcKey = Symbol("_vtc");
  10467. const DOMTransitionPropsValidators = {
  10468. name: String,
  10469. type: String,
  10470. css: {
  10471. type: Boolean,
  10472. default: true
  10473. },
  10474. duration: [String, Number, Object],
  10475. enterFromClass: String,
  10476. enterActiveClass: String,
  10477. enterToClass: String,
  10478. appearFromClass: String,
  10479. appearActiveClass: String,
  10480. appearToClass: String,
  10481. leaveFromClass: String,
  10482. leaveActiveClass: String,
  10483. leaveToClass: String
  10484. };
  10485. const TransitionPropsValidators = /* @__PURE__ */ extend(
  10486. {},
  10487. BaseTransitionPropsValidators,
  10488. DOMTransitionPropsValidators
  10489. );
  10490. const decorate$1 = (t) => {
  10491. t.displayName = "Transition";
  10492. t.props = TransitionPropsValidators;
  10493. return t;
  10494. };
  10495. const Transition = /* @__PURE__ */ decorate$1(
  10496. (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
  10497. );
  10498. const callHook = (hook, args = []) => {
  10499. if (isArray(hook)) {
  10500. hook.forEach((h2) => h2(...args));
  10501. } else if (hook) {
  10502. hook(...args);
  10503. }
  10504. };
  10505. const hasExplicitCallback = (hook) => {
  10506. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  10507. };
  10508. function resolveTransitionProps(rawProps) {
  10509. const baseProps = {};
  10510. for (const key in rawProps) {
  10511. if (!(key in DOMTransitionPropsValidators)) {
  10512. baseProps[key] = rawProps[key];
  10513. }
  10514. }
  10515. if (rawProps.css === false) {
  10516. return baseProps;
  10517. }
  10518. const {
  10519. name = "v",
  10520. type,
  10521. duration,
  10522. enterFromClass = `${name}-enter-from`,
  10523. enterActiveClass = `${name}-enter-active`,
  10524. enterToClass = `${name}-enter-to`,
  10525. appearFromClass = enterFromClass,
  10526. appearActiveClass = enterActiveClass,
  10527. appearToClass = enterToClass,
  10528. leaveFromClass = `${name}-leave-from`,
  10529. leaveActiveClass = `${name}-leave-active`,
  10530. leaveToClass = `${name}-leave-to`
  10531. } = rawProps;
  10532. const durations = normalizeDuration(duration);
  10533. const enterDuration = durations && durations[0];
  10534. const leaveDuration = durations && durations[1];
  10535. const {
  10536. onBeforeEnter,
  10537. onEnter,
  10538. onEnterCancelled,
  10539. onLeave,
  10540. onLeaveCancelled,
  10541. onBeforeAppear = onBeforeEnter,
  10542. onAppear = onEnter,
  10543. onAppearCancelled = onEnterCancelled
  10544. } = baseProps;
  10545. const finishEnter = (el, isAppear, done) => {
  10546. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10547. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  10548. done && done();
  10549. };
  10550. const finishLeave = (el, done) => {
  10551. el._isLeaving = false;
  10552. removeTransitionClass(el, leaveFromClass);
  10553. removeTransitionClass(el, leaveToClass);
  10554. removeTransitionClass(el, leaveActiveClass);
  10555. done && done();
  10556. };
  10557. const makeEnterHook = (isAppear) => {
  10558. return (el, done) => {
  10559. const hook = isAppear ? onAppear : onEnter;
  10560. const resolve = () => finishEnter(el, isAppear, done);
  10561. callHook(hook, [el, resolve]);
  10562. nextFrame(() => {
  10563. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  10564. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10565. if (!hasExplicitCallback(hook)) {
  10566. whenTransitionEnds(el, type, enterDuration, resolve);
  10567. }
  10568. });
  10569. };
  10570. };
  10571. return extend(baseProps, {
  10572. onBeforeEnter(el) {
  10573. callHook(onBeforeEnter, [el]);
  10574. addTransitionClass(el, enterFromClass);
  10575. addTransitionClass(el, enterActiveClass);
  10576. },
  10577. onBeforeAppear(el) {
  10578. callHook(onBeforeAppear, [el]);
  10579. addTransitionClass(el, appearFromClass);
  10580. addTransitionClass(el, appearActiveClass);
  10581. },
  10582. onEnter: makeEnterHook(false),
  10583. onAppear: makeEnterHook(true),
  10584. onLeave(el, done) {
  10585. el._isLeaving = true;
  10586. const resolve = () => finishLeave(el, done);
  10587. addTransitionClass(el, leaveFromClass);
  10588. addTransitionClass(el, leaveActiveClass);
  10589. forceReflow();
  10590. nextFrame(() => {
  10591. if (!el._isLeaving) {
  10592. return;
  10593. }
  10594. removeTransitionClass(el, leaveFromClass);
  10595. addTransitionClass(el, leaveToClass);
  10596. if (!hasExplicitCallback(onLeave)) {
  10597. whenTransitionEnds(el, type, leaveDuration, resolve);
  10598. }
  10599. });
  10600. callHook(onLeave, [el, resolve]);
  10601. },
  10602. onEnterCancelled(el) {
  10603. finishEnter(el, false);
  10604. callHook(onEnterCancelled, [el]);
  10605. },
  10606. onAppearCancelled(el) {
  10607. finishEnter(el, true);
  10608. callHook(onAppearCancelled, [el]);
  10609. },
  10610. onLeaveCancelled(el) {
  10611. finishLeave(el);
  10612. callHook(onLeaveCancelled, [el]);
  10613. }
  10614. });
  10615. }
  10616. function normalizeDuration(duration) {
  10617. if (duration == null) {
  10618. return null;
  10619. } else if (isObject(duration)) {
  10620. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  10621. } else {
  10622. const n = NumberOf(duration);
  10623. return [n, n];
  10624. }
  10625. }
  10626. function NumberOf(val) {
  10627. const res = toNumber(val);
  10628. {
  10629. assertNumber(res, "<transition> explicit duration");
  10630. }
  10631. return res;
  10632. }
  10633. function addTransitionClass(el, cls) {
  10634. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  10635. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  10636. }
  10637. function removeTransitionClass(el, cls) {
  10638. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  10639. const _vtc = el[vtcKey];
  10640. if (_vtc) {
  10641. _vtc.delete(cls);
  10642. if (!_vtc.size) {
  10643. el[vtcKey] = void 0;
  10644. }
  10645. }
  10646. }
  10647. function nextFrame(cb) {
  10648. requestAnimationFrame(() => {
  10649. requestAnimationFrame(cb);
  10650. });
  10651. }
  10652. let endId = 0;
  10653. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  10654. const id = el._endId = ++endId;
  10655. const resolveIfNotStale = () => {
  10656. if (id === el._endId) {
  10657. resolve();
  10658. }
  10659. };
  10660. if (explicitTimeout != null) {
  10661. return setTimeout(resolveIfNotStale, explicitTimeout);
  10662. }
  10663. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  10664. if (!type) {
  10665. return resolve();
  10666. }
  10667. const endEvent = type + "end";
  10668. let ended = 0;
  10669. const end = () => {
  10670. el.removeEventListener(endEvent, onEnd);
  10671. resolveIfNotStale();
  10672. };
  10673. const onEnd = (e) => {
  10674. if (e.target === el && ++ended >= propCount) {
  10675. end();
  10676. }
  10677. };
  10678. setTimeout(() => {
  10679. if (ended < propCount) {
  10680. end();
  10681. }
  10682. }, timeout + 1);
  10683. el.addEventListener(endEvent, onEnd);
  10684. }
  10685. function getTransitionInfo(el, expectedType) {
  10686. const styles = window.getComputedStyle(el);
  10687. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  10688. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  10689. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  10690. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  10691. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  10692. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  10693. const animationTimeout = getTimeout(animationDelays, animationDurations);
  10694. let type = null;
  10695. let timeout = 0;
  10696. let propCount = 0;
  10697. if (expectedType === TRANSITION$1) {
  10698. if (transitionTimeout > 0) {
  10699. type = TRANSITION$1;
  10700. timeout = transitionTimeout;
  10701. propCount = transitionDurations.length;
  10702. }
  10703. } else if (expectedType === ANIMATION) {
  10704. if (animationTimeout > 0) {
  10705. type = ANIMATION;
  10706. timeout = animationTimeout;
  10707. propCount = animationDurations.length;
  10708. }
  10709. } else {
  10710. timeout = Math.max(transitionTimeout, animationTimeout);
  10711. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  10712. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  10713. }
  10714. const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
  10715. getStyleProperties(`${TRANSITION$1}Property`).toString()
  10716. );
  10717. return {
  10718. type,
  10719. timeout,
  10720. propCount,
  10721. hasTransform
  10722. };
  10723. }
  10724. function getTimeout(delays, durations) {
  10725. while (delays.length < durations.length) {
  10726. delays = delays.concat(delays);
  10727. }
  10728. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  10729. }
  10730. function toMs(s) {
  10731. if (s === "auto") return 0;
  10732. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  10733. }
  10734. function forceReflow() {
  10735. return document.body.offsetHeight;
  10736. }
  10737. function patchClass(el, value, isSVG) {
  10738. const transitionClasses = el[vtcKey];
  10739. if (transitionClasses) {
  10740. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  10741. }
  10742. if (value == null) {
  10743. el.removeAttribute("class");
  10744. } else if (isSVG) {
  10745. el.setAttribute("class", value);
  10746. } else {
  10747. el.className = value;
  10748. }
  10749. }
  10750. const vShowOriginalDisplay = Symbol("_vod");
  10751. const vShowHidden = Symbol("_vsh");
  10752. const vShow = {
  10753. beforeMount(el, { value }, { transition }) {
  10754. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  10755. if (transition && value) {
  10756. transition.beforeEnter(el);
  10757. } else {
  10758. setDisplay(el, value);
  10759. }
  10760. },
  10761. mounted(el, { value }, { transition }) {
  10762. if (transition && value) {
  10763. transition.enter(el);
  10764. }
  10765. },
  10766. updated(el, { value, oldValue }, { transition }) {
  10767. if (!value === !oldValue) return;
  10768. if (transition) {
  10769. if (value) {
  10770. transition.beforeEnter(el);
  10771. setDisplay(el, true);
  10772. transition.enter(el);
  10773. } else {
  10774. transition.leave(el, () => {
  10775. setDisplay(el, false);
  10776. });
  10777. }
  10778. } else {
  10779. setDisplay(el, value);
  10780. }
  10781. },
  10782. beforeUnmount(el, { value }) {
  10783. setDisplay(el, value);
  10784. }
  10785. };
  10786. {
  10787. vShow.name = "show";
  10788. }
  10789. function setDisplay(el, value) {
  10790. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  10791. el[vShowHidden] = !value;
  10792. }
  10793. const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
  10794. function useCssVars(getter) {
  10795. const instance = getCurrentInstance();
  10796. if (!instance) {
  10797. warn(`useCssVars is called without current active component instance.`);
  10798. return;
  10799. }
  10800. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  10801. Array.from(
  10802. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  10803. ).forEach((node) => setVarsOnNode(node, vars));
  10804. };
  10805. {
  10806. instance.getCssVars = () => getter(instance.proxy);
  10807. }
  10808. const setVars = () => {
  10809. const vars = getter(instance.proxy);
  10810. if (instance.ce) {
  10811. setVarsOnNode(instance.ce, vars);
  10812. } else {
  10813. setVarsOnVNode(instance.subTree, vars);
  10814. }
  10815. updateTeleports(vars);
  10816. };
  10817. onBeforeMount(() => {
  10818. watchPostEffect(setVars);
  10819. });
  10820. onMounted(() => {
  10821. const ob = new MutationObserver(setVars);
  10822. ob.observe(instance.subTree.el.parentNode, { childList: true });
  10823. onUnmounted(() => ob.disconnect());
  10824. });
  10825. }
  10826. function setVarsOnVNode(vnode, vars) {
  10827. if (vnode.shapeFlag & 128) {
  10828. const suspense = vnode.suspense;
  10829. vnode = suspense.activeBranch;
  10830. if (suspense.pendingBranch && !suspense.isHydrating) {
  10831. suspense.effects.push(() => {
  10832. setVarsOnVNode(suspense.activeBranch, vars);
  10833. });
  10834. }
  10835. }
  10836. while (vnode.component) {
  10837. vnode = vnode.component.subTree;
  10838. }
  10839. if (vnode.shapeFlag & 1 && vnode.el) {
  10840. setVarsOnNode(vnode.el, vars);
  10841. } else if (vnode.type === Fragment) {
  10842. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  10843. } else if (vnode.type === Static) {
  10844. let { el, anchor } = vnode;
  10845. while (el) {
  10846. setVarsOnNode(el, vars);
  10847. if (el === anchor) break;
  10848. el = el.nextSibling;
  10849. }
  10850. }
  10851. }
  10852. function setVarsOnNode(el, vars) {
  10853. if (el.nodeType === 1) {
  10854. const style = el.style;
  10855. let cssText = "";
  10856. for (const key in vars) {
  10857. style.setProperty(`--${key}`, vars[key]);
  10858. cssText += `--${key}: ${vars[key]};`;
  10859. }
  10860. style[CSS_VAR_TEXT] = cssText;
  10861. }
  10862. }
  10863. const displayRE = /(^|;)\s*display\s*:/;
  10864. function patchStyle(el, prev, next) {
  10865. const style = el.style;
  10866. const isCssString = isString(next);
  10867. let hasControlledDisplay = false;
  10868. if (next && !isCssString) {
  10869. if (prev) {
  10870. if (!isString(prev)) {
  10871. for (const key in prev) {
  10872. if (next[key] == null) {
  10873. setStyle(style, key, "");
  10874. }
  10875. }
  10876. } else {
  10877. for (const prevStyle of prev.split(";")) {
  10878. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  10879. if (next[key] == null) {
  10880. setStyle(style, key, "");
  10881. }
  10882. }
  10883. }
  10884. }
  10885. for (const key in next) {
  10886. if (key === "display") {
  10887. hasControlledDisplay = true;
  10888. }
  10889. setStyle(style, key, next[key]);
  10890. }
  10891. } else {
  10892. if (isCssString) {
  10893. if (prev !== next) {
  10894. const cssVarText = style[CSS_VAR_TEXT];
  10895. if (cssVarText) {
  10896. next += ";" + cssVarText;
  10897. }
  10898. style.cssText = next;
  10899. hasControlledDisplay = displayRE.test(next);
  10900. }
  10901. } else if (prev) {
  10902. el.removeAttribute("style");
  10903. }
  10904. }
  10905. if (vShowOriginalDisplay in el) {
  10906. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  10907. if (el[vShowHidden]) {
  10908. style.display = "none";
  10909. }
  10910. }
  10911. }
  10912. const semicolonRE = /[^\\];\s*$/;
  10913. const importantRE = /\s*!important$/;
  10914. function setStyle(style, name, val) {
  10915. if (isArray(val)) {
  10916. val.forEach((v) => setStyle(style, name, v));
  10917. } else {
  10918. if (val == null) val = "";
  10919. {
  10920. if (semicolonRE.test(val)) {
  10921. warn(
  10922. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  10923. );
  10924. }
  10925. }
  10926. if (name.startsWith("--")) {
  10927. style.setProperty(name, val);
  10928. } else {
  10929. const prefixed = autoPrefix(style, name);
  10930. if (importantRE.test(val)) {
  10931. style.setProperty(
  10932. hyphenate(prefixed),
  10933. val.replace(importantRE, ""),
  10934. "important"
  10935. );
  10936. } else {
  10937. style[prefixed] = val;
  10938. }
  10939. }
  10940. }
  10941. }
  10942. const prefixes = ["Webkit", "Moz", "ms"];
  10943. const prefixCache = {};
  10944. function autoPrefix(style, rawName) {
  10945. const cached = prefixCache[rawName];
  10946. if (cached) {
  10947. return cached;
  10948. }
  10949. let name = camelize(rawName);
  10950. if (name !== "filter" && name in style) {
  10951. return prefixCache[rawName] = name;
  10952. }
  10953. name = capitalize(name);
  10954. for (let i = 0; i < prefixes.length; i++) {
  10955. const prefixed = prefixes[i] + name;
  10956. if (prefixed in style) {
  10957. return prefixCache[rawName] = prefixed;
  10958. }
  10959. }
  10960. return rawName;
  10961. }
  10962. const xlinkNS = "http://www.w3.org/1999/xlink";
  10963. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  10964. if (isSVG && key.startsWith("xlink:")) {
  10965. if (value == null) {
  10966. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  10967. } else {
  10968. el.setAttributeNS(xlinkNS, key, value);
  10969. }
  10970. } else {
  10971. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  10972. el.removeAttribute(key);
  10973. } else {
  10974. el.setAttribute(
  10975. key,
  10976. isBoolean ? "" : isSymbol(value) ? String(value) : value
  10977. );
  10978. }
  10979. }
  10980. }
  10981. function patchDOMProp(el, key, value, parentComponent, attrName) {
  10982. if (key === "innerHTML" || key === "textContent") {
  10983. if (value != null) {
  10984. el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
  10985. }
  10986. return;
  10987. }
  10988. const tag = el.tagName;
  10989. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  10990. !tag.includes("-")) {
  10991. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  10992. const newValue = value == null ? (
  10993. // #11647: value should be set as empty string for null and undefined,
  10994. // but <input type="checkbox"> should be set as 'on'.
  10995. el.type === "checkbox" ? "on" : ""
  10996. ) : String(value);
  10997. if (oldValue !== newValue || !("_value" in el)) {
  10998. el.value = newValue;
  10999. }
  11000. if (value == null) {
  11001. el.removeAttribute(key);
  11002. }
  11003. el._value = value;
  11004. return;
  11005. }
  11006. let needRemove = false;
  11007. if (value === "" || value == null) {
  11008. const type = typeof el[key];
  11009. if (type === "boolean") {
  11010. value = includeBooleanAttr(value);
  11011. } else if (value == null && type === "string") {
  11012. value = "";
  11013. needRemove = true;
  11014. } else if (type === "number") {
  11015. value = 0;
  11016. needRemove = true;
  11017. }
  11018. }
  11019. try {
  11020. el[key] = value;
  11021. } catch (e) {
  11022. if (!needRemove) {
  11023. warn(
  11024. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  11025. e
  11026. );
  11027. }
  11028. }
  11029. needRemove && el.removeAttribute(attrName || key);
  11030. }
  11031. function addEventListener(el, event, handler, options) {
  11032. el.addEventListener(event, handler, options);
  11033. }
  11034. function removeEventListener(el, event, handler, options) {
  11035. el.removeEventListener(event, handler, options);
  11036. }
  11037. const veiKey = Symbol("_vei");
  11038. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  11039. const invokers = el[veiKey] || (el[veiKey] = {});
  11040. const existingInvoker = invokers[rawName];
  11041. if (nextValue && existingInvoker) {
  11042. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  11043. } else {
  11044. const [name, options] = parseName(rawName);
  11045. if (nextValue) {
  11046. const invoker = invokers[rawName] = createInvoker(
  11047. sanitizeEventValue(nextValue, rawName) ,
  11048. instance
  11049. );
  11050. addEventListener(el, name, invoker, options);
  11051. } else if (existingInvoker) {
  11052. removeEventListener(el, name, existingInvoker, options);
  11053. invokers[rawName] = void 0;
  11054. }
  11055. }
  11056. }
  11057. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  11058. function parseName(name) {
  11059. let options;
  11060. if (optionsModifierRE.test(name)) {
  11061. options = {};
  11062. let m;
  11063. while (m = name.match(optionsModifierRE)) {
  11064. name = name.slice(0, name.length - m[0].length);
  11065. options[m[0].toLowerCase()] = true;
  11066. }
  11067. }
  11068. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  11069. return [event, options];
  11070. }
  11071. let cachedNow = 0;
  11072. const p = /* @__PURE__ */ Promise.resolve();
  11073. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  11074. function createInvoker(initialValue, instance) {
  11075. const invoker = (e) => {
  11076. if (!e._vts) {
  11077. e._vts = Date.now();
  11078. } else if (e._vts <= invoker.attached) {
  11079. return;
  11080. }
  11081. callWithAsyncErrorHandling(
  11082. patchStopImmediatePropagation(e, invoker.value),
  11083. instance,
  11084. 5,
  11085. [e]
  11086. );
  11087. };
  11088. invoker.value = initialValue;
  11089. invoker.attached = getNow();
  11090. return invoker;
  11091. }
  11092. function sanitizeEventValue(value, propName) {
  11093. if (isFunction(value) || isArray(value)) {
  11094. return value;
  11095. }
  11096. warn(
  11097. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  11098. Expected function or array of functions, received type ${typeof value}.`
  11099. );
  11100. return NOOP;
  11101. }
  11102. function patchStopImmediatePropagation(e, value) {
  11103. if (isArray(value)) {
  11104. const originalStop = e.stopImmediatePropagation;
  11105. e.stopImmediatePropagation = () => {
  11106. originalStop.call(e);
  11107. e._stopped = true;
  11108. };
  11109. return value.map(
  11110. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  11111. );
  11112. } else {
  11113. return value;
  11114. }
  11115. }
  11116. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  11117. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  11118. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  11119. const isSVG = namespace === "svg";
  11120. if (key === "class") {
  11121. patchClass(el, nextValue, isSVG);
  11122. } else if (key === "style") {
  11123. patchStyle(el, prevValue, nextValue);
  11124. } else if (isOn(key)) {
  11125. if (!isModelListener(key)) {
  11126. patchEvent(el, key, prevValue, nextValue, parentComponent);
  11127. }
  11128. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  11129. patchDOMProp(el, key, nextValue);
  11130. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  11131. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  11132. }
  11133. } else if (
  11134. // #11081 force set props for possible async custom element
  11135. el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
  11136. ) {
  11137. patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
  11138. } else {
  11139. if (key === "true-value") {
  11140. el._trueValue = nextValue;
  11141. } else if (key === "false-value") {
  11142. el._falseValue = nextValue;
  11143. }
  11144. patchAttr(el, key, nextValue, isSVG);
  11145. }
  11146. };
  11147. function shouldSetAsProp(el, key, value, isSVG) {
  11148. if (isSVG) {
  11149. if (key === "innerHTML" || key === "textContent") {
  11150. return true;
  11151. }
  11152. if (key in el && isNativeOn(key) && isFunction(value)) {
  11153. return true;
  11154. }
  11155. return false;
  11156. }
  11157. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  11158. return false;
  11159. }
  11160. if (key === "form") {
  11161. return false;
  11162. }
  11163. if (key === "list" && el.tagName === "INPUT") {
  11164. return false;
  11165. }
  11166. if (key === "type" && el.tagName === "TEXTAREA") {
  11167. return false;
  11168. }
  11169. if (key === "width" || key === "height") {
  11170. const tag = el.tagName;
  11171. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  11172. return false;
  11173. }
  11174. }
  11175. if (isNativeOn(key) && isString(value)) {
  11176. return false;
  11177. }
  11178. return key in el;
  11179. }
  11180. const REMOVAL = {};
  11181. /*! #__NO_SIDE_EFFECTS__ */
  11182. // @__NO_SIDE_EFFECTS__
  11183. function defineCustomElement(options, extraOptions, _createApp) {
  11184. const Comp = defineComponent(options, extraOptions);
  11185. if (isPlainObject(Comp)) extend(Comp, extraOptions);
  11186. class VueCustomElement extends VueElement {
  11187. constructor(initialProps) {
  11188. super(Comp, initialProps, _createApp);
  11189. }
  11190. }
  11191. VueCustomElement.def = Comp;
  11192. return VueCustomElement;
  11193. }
  11194. /*! #__NO_SIDE_EFFECTS__ */
  11195. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  11196. return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
  11197. };
  11198. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  11199. };
  11200. class VueElement extends BaseClass {
  11201. constructor(_def, _props = {}, _createApp = createApp) {
  11202. super();
  11203. this._def = _def;
  11204. this._props = _props;
  11205. this._createApp = _createApp;
  11206. this._isVueCE = true;
  11207. /**
  11208. * @internal
  11209. */
  11210. this._instance = null;
  11211. /**
  11212. * @internal
  11213. */
  11214. this._app = null;
  11215. /**
  11216. * @internal
  11217. */
  11218. this._nonce = this._def.nonce;
  11219. this._connected = false;
  11220. this._resolved = false;
  11221. this._numberProps = null;
  11222. this._styleChildren = /* @__PURE__ */ new WeakSet();
  11223. this._ob = null;
  11224. if (this.shadowRoot && _createApp !== createApp) {
  11225. this._root = this.shadowRoot;
  11226. } else {
  11227. if (this.shadowRoot) {
  11228. warn(
  11229. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  11230. );
  11231. }
  11232. if (_def.shadowRoot !== false) {
  11233. this.attachShadow({ mode: "open" });
  11234. this._root = this.shadowRoot;
  11235. } else {
  11236. this._root = this;
  11237. }
  11238. }
  11239. if (!this._def.__asyncLoader) {
  11240. this._resolveProps(this._def);
  11241. }
  11242. }
  11243. connectedCallback() {
  11244. if (!this.isConnected) return;
  11245. if (!this.shadowRoot) {
  11246. this._parseSlots();
  11247. }
  11248. this._connected = true;
  11249. let parent = this;
  11250. while (parent = parent && (parent.parentNode || parent.host)) {
  11251. if (parent instanceof VueElement) {
  11252. this._parent = parent;
  11253. break;
  11254. }
  11255. }
  11256. if (!this._instance) {
  11257. if (this._resolved) {
  11258. this._setParent();
  11259. this._update();
  11260. } else {
  11261. if (parent && parent._pendingResolve) {
  11262. this._pendingResolve = parent._pendingResolve.then(() => {
  11263. this._pendingResolve = void 0;
  11264. this._resolveDef();
  11265. });
  11266. } else {
  11267. this._resolveDef();
  11268. }
  11269. }
  11270. }
  11271. }
  11272. _setParent(parent = this._parent) {
  11273. if (parent) {
  11274. this._instance.parent = parent._instance;
  11275. this._instance.provides = parent._instance.provides;
  11276. }
  11277. }
  11278. disconnectedCallback() {
  11279. this._connected = false;
  11280. nextTick(() => {
  11281. if (!this._connected) {
  11282. if (this._ob) {
  11283. this._ob.disconnect();
  11284. this._ob = null;
  11285. }
  11286. this._app && this._app.unmount();
  11287. if (this._instance) this._instance.ce = void 0;
  11288. this._app = this._instance = null;
  11289. }
  11290. });
  11291. }
  11292. /**
  11293. * resolve inner component definition (handle possible async component)
  11294. */
  11295. _resolveDef() {
  11296. if (this._pendingResolve) {
  11297. return;
  11298. }
  11299. for (let i = 0; i < this.attributes.length; i++) {
  11300. this._setAttr(this.attributes[i].name);
  11301. }
  11302. this._ob = new MutationObserver((mutations) => {
  11303. for (const m of mutations) {
  11304. this._setAttr(m.attributeName);
  11305. }
  11306. });
  11307. this._ob.observe(this, { attributes: true });
  11308. const resolve = (def, isAsync = false) => {
  11309. this._resolved = true;
  11310. this._pendingResolve = void 0;
  11311. const { props, styles } = def;
  11312. let numberProps;
  11313. if (props && !isArray(props)) {
  11314. for (const key in props) {
  11315. const opt = props[key];
  11316. if (opt === Number || opt && opt.type === Number) {
  11317. if (key in this._props) {
  11318. this._props[key] = toNumber(this._props[key]);
  11319. }
  11320. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  11321. }
  11322. }
  11323. }
  11324. this._numberProps = numberProps;
  11325. if (isAsync) {
  11326. this._resolveProps(def);
  11327. }
  11328. if (this.shadowRoot) {
  11329. this._applyStyles(styles);
  11330. } else if (styles) {
  11331. warn(
  11332. "Custom element style injection is not supported when using shadowRoot: false"
  11333. );
  11334. }
  11335. this._mount(def);
  11336. };
  11337. const asyncDef = this._def.__asyncLoader;
  11338. if (asyncDef) {
  11339. this._pendingResolve = asyncDef().then(
  11340. (def) => resolve(this._def = def, true)
  11341. );
  11342. } else {
  11343. resolve(this._def);
  11344. }
  11345. }
  11346. _mount(def) {
  11347. if (!def.name) {
  11348. def.name = "VueElement";
  11349. }
  11350. this._app = this._createApp(def);
  11351. if (def.configureApp) {
  11352. def.configureApp(this._app);
  11353. }
  11354. this._app._ceVNode = this._createVNode();
  11355. this._app.mount(this._root);
  11356. const exposed = this._instance && this._instance.exposed;
  11357. if (!exposed) return;
  11358. for (const key in exposed) {
  11359. if (!hasOwn(this, key)) {
  11360. Object.defineProperty(this, key, {
  11361. // unwrap ref to be consistent with public instance behavior
  11362. get: () => unref(exposed[key])
  11363. });
  11364. } else {
  11365. warn(`Exposed property "${key}" already exists on custom element.`);
  11366. }
  11367. }
  11368. }
  11369. _resolveProps(def) {
  11370. const { props } = def;
  11371. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  11372. for (const key of Object.keys(this)) {
  11373. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  11374. this._setProp(key, this[key]);
  11375. }
  11376. }
  11377. for (const key of declaredPropKeys.map(camelize)) {
  11378. Object.defineProperty(this, key, {
  11379. get() {
  11380. return this._getProp(key);
  11381. },
  11382. set(val) {
  11383. this._setProp(key, val, true, true);
  11384. }
  11385. });
  11386. }
  11387. }
  11388. _setAttr(key) {
  11389. if (key.startsWith("data-v-")) return;
  11390. const has = this.hasAttribute(key);
  11391. let value = has ? this.getAttribute(key) : REMOVAL;
  11392. const camelKey = camelize(key);
  11393. if (has && this._numberProps && this._numberProps[camelKey]) {
  11394. value = toNumber(value);
  11395. }
  11396. this._setProp(camelKey, value, false, true);
  11397. }
  11398. /**
  11399. * @internal
  11400. */
  11401. _getProp(key) {
  11402. return this._props[key];
  11403. }
  11404. /**
  11405. * @internal
  11406. */
  11407. _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
  11408. if (val !== this._props[key]) {
  11409. if (val === REMOVAL) {
  11410. delete this._props[key];
  11411. } else {
  11412. this._props[key] = val;
  11413. if (key === "key" && this._app) {
  11414. this._app._ceVNode.key = val;
  11415. }
  11416. }
  11417. if (shouldUpdate && this._instance) {
  11418. this._update();
  11419. }
  11420. if (shouldReflect) {
  11421. if (val === true) {
  11422. this.setAttribute(hyphenate(key), "");
  11423. } else if (typeof val === "string" || typeof val === "number") {
  11424. this.setAttribute(hyphenate(key), val + "");
  11425. } else if (!val) {
  11426. this.removeAttribute(hyphenate(key));
  11427. }
  11428. }
  11429. }
  11430. }
  11431. _update() {
  11432. render(this._createVNode(), this._root);
  11433. }
  11434. _createVNode() {
  11435. const baseProps = {};
  11436. if (!this.shadowRoot) {
  11437. baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
  11438. }
  11439. const vnode = createVNode(this._def, extend(baseProps, this._props));
  11440. if (!this._instance) {
  11441. vnode.ce = (instance) => {
  11442. this._instance = instance;
  11443. instance.ce = this;
  11444. instance.isCE = true;
  11445. {
  11446. instance.ceReload = (newStyles) => {
  11447. if (this._styles) {
  11448. this._styles.forEach((s) => this._root.removeChild(s));
  11449. this._styles.length = 0;
  11450. }
  11451. this._applyStyles(newStyles);
  11452. this._instance = null;
  11453. this._update();
  11454. };
  11455. }
  11456. const dispatch = (event, args) => {
  11457. this.dispatchEvent(
  11458. new CustomEvent(
  11459. event,
  11460. isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
  11461. )
  11462. );
  11463. };
  11464. instance.emit = (event, ...args) => {
  11465. dispatch(event, args);
  11466. if (hyphenate(event) !== event) {
  11467. dispatch(hyphenate(event), args);
  11468. }
  11469. };
  11470. this._setParent();
  11471. };
  11472. }
  11473. return vnode;
  11474. }
  11475. _applyStyles(styles, owner) {
  11476. if (!styles) return;
  11477. if (owner) {
  11478. if (owner === this._def || this._styleChildren.has(owner)) {
  11479. return;
  11480. }
  11481. this._styleChildren.add(owner);
  11482. }
  11483. const nonce = this._nonce;
  11484. for (let i = styles.length - 1; i >= 0; i--) {
  11485. const s = document.createElement("style");
  11486. if (nonce) s.setAttribute("nonce", nonce);
  11487. s.textContent = styles[i];
  11488. this.shadowRoot.prepend(s);
  11489. {
  11490. if (owner) {
  11491. if (owner.__hmrId) {
  11492. if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
  11493. let entry = this._childStyles.get(owner.__hmrId);
  11494. if (!entry) {
  11495. this._childStyles.set(owner.__hmrId, entry = []);
  11496. }
  11497. entry.push(s);
  11498. }
  11499. } else {
  11500. (this._styles || (this._styles = [])).push(s);
  11501. }
  11502. }
  11503. }
  11504. }
  11505. /**
  11506. * Only called when shadowRoot is false
  11507. */
  11508. _parseSlots() {
  11509. const slots = this._slots = {};
  11510. let n;
  11511. while (n = this.firstChild) {
  11512. const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
  11513. (slots[slotName] || (slots[slotName] = [])).push(n);
  11514. this.removeChild(n);
  11515. }
  11516. }
  11517. /**
  11518. * Only called when shadowRoot is false
  11519. */
  11520. _renderSlots() {
  11521. const outlets = (this._teleportTarget || this).querySelectorAll("slot");
  11522. const scopeId = this._instance.type.__scopeId;
  11523. for (let i = 0; i < outlets.length; i++) {
  11524. const o = outlets[i];
  11525. const slotName = o.getAttribute("name") || "default";
  11526. const content = this._slots[slotName];
  11527. const parent = o.parentNode;
  11528. if (content) {
  11529. for (const n of content) {
  11530. if (scopeId && n.nodeType === 1) {
  11531. const id = scopeId + "-s";
  11532. const walker = document.createTreeWalker(n, 1);
  11533. n.setAttribute(id, "");
  11534. let child;
  11535. while (child = walker.nextNode()) {
  11536. child.setAttribute(id, "");
  11537. }
  11538. }
  11539. parent.insertBefore(n, o);
  11540. }
  11541. } else {
  11542. while (o.firstChild) parent.insertBefore(o.firstChild, o);
  11543. }
  11544. parent.removeChild(o);
  11545. }
  11546. }
  11547. /**
  11548. * @internal
  11549. */
  11550. _injectChildStyle(comp) {
  11551. this._applyStyles(comp.styles, comp);
  11552. }
  11553. /**
  11554. * @internal
  11555. */
  11556. _removeChildStyle(comp) {
  11557. {
  11558. this._styleChildren.delete(comp);
  11559. if (this._childStyles && comp.__hmrId) {
  11560. const oldStyles = this._childStyles.get(comp.__hmrId);
  11561. if (oldStyles) {
  11562. oldStyles.forEach((s) => this._root.removeChild(s));
  11563. oldStyles.length = 0;
  11564. }
  11565. }
  11566. }
  11567. }
  11568. }
  11569. function useHost(caller) {
  11570. const instance = getCurrentInstance();
  11571. const el = instance && instance.ce;
  11572. if (el) {
  11573. return el;
  11574. } else {
  11575. if (!instance) {
  11576. warn(
  11577. `${caller || "useHost"} called without an active component instance.`
  11578. );
  11579. } else {
  11580. warn(
  11581. `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
  11582. );
  11583. }
  11584. }
  11585. return null;
  11586. }
  11587. function useShadowRoot() {
  11588. const el = useHost("useShadowRoot") ;
  11589. return el && el.shadowRoot;
  11590. }
  11591. function useCssModule(name = "$style") {
  11592. {
  11593. {
  11594. warn(`useCssModule() is not supported in the global build.`);
  11595. }
  11596. return EMPTY_OBJ;
  11597. }
  11598. }
  11599. const positionMap = /* @__PURE__ */ new WeakMap();
  11600. const newPositionMap = /* @__PURE__ */ new WeakMap();
  11601. const moveCbKey = Symbol("_moveCb");
  11602. const enterCbKey = Symbol("_enterCb");
  11603. const decorate = (t) => {
  11604. delete t.props.mode;
  11605. return t;
  11606. };
  11607. const TransitionGroupImpl = /* @__PURE__ */ decorate({
  11608. name: "TransitionGroup",
  11609. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  11610. tag: String,
  11611. moveClass: String
  11612. }),
  11613. setup(props, { slots }) {
  11614. const instance = getCurrentInstance();
  11615. const state = useTransitionState();
  11616. let prevChildren;
  11617. let children;
  11618. onUpdated(() => {
  11619. if (!prevChildren.length) {
  11620. return;
  11621. }
  11622. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  11623. if (!hasCSSTransform(
  11624. prevChildren[0].el,
  11625. instance.vnode.el,
  11626. moveClass
  11627. )) {
  11628. return;
  11629. }
  11630. prevChildren.forEach(callPendingCbs);
  11631. prevChildren.forEach(recordPosition);
  11632. const movedChildren = prevChildren.filter(applyTranslation);
  11633. forceReflow();
  11634. movedChildren.forEach((c) => {
  11635. const el = c.el;
  11636. const style = el.style;
  11637. addTransitionClass(el, moveClass);
  11638. style.transform = style.webkitTransform = style.transitionDuration = "";
  11639. const cb = el[moveCbKey] = (e) => {
  11640. if (e && e.target !== el) {
  11641. return;
  11642. }
  11643. if (!e || /transform$/.test(e.propertyName)) {
  11644. el.removeEventListener("transitionend", cb);
  11645. el[moveCbKey] = null;
  11646. removeTransitionClass(el, moveClass);
  11647. }
  11648. };
  11649. el.addEventListener("transitionend", cb);
  11650. });
  11651. });
  11652. return () => {
  11653. const rawProps = toRaw(props);
  11654. const cssTransitionProps = resolveTransitionProps(rawProps);
  11655. let tag = rawProps.tag || Fragment;
  11656. prevChildren = [];
  11657. if (children) {
  11658. for (let i = 0; i < children.length; i++) {
  11659. const child = children[i];
  11660. if (child.el && child.el instanceof Element) {
  11661. prevChildren.push(child);
  11662. setTransitionHooks(
  11663. child,
  11664. resolveTransitionHooks(
  11665. child,
  11666. cssTransitionProps,
  11667. state,
  11668. instance
  11669. )
  11670. );
  11671. positionMap.set(
  11672. child,
  11673. child.el.getBoundingClientRect()
  11674. );
  11675. }
  11676. }
  11677. }
  11678. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  11679. for (let i = 0; i < children.length; i++) {
  11680. const child = children[i];
  11681. if (child.key != null) {
  11682. setTransitionHooks(
  11683. child,
  11684. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  11685. );
  11686. } else if (child.type !== Text) {
  11687. warn(`<TransitionGroup> children must be keyed.`);
  11688. }
  11689. }
  11690. return createVNode(tag, null, children);
  11691. };
  11692. }
  11693. });
  11694. const TransitionGroup = TransitionGroupImpl;
  11695. function callPendingCbs(c) {
  11696. const el = c.el;
  11697. if (el[moveCbKey]) {
  11698. el[moveCbKey]();
  11699. }
  11700. if (el[enterCbKey]) {
  11701. el[enterCbKey]();
  11702. }
  11703. }
  11704. function recordPosition(c) {
  11705. newPositionMap.set(c, c.el.getBoundingClientRect());
  11706. }
  11707. function applyTranslation(c) {
  11708. const oldPos = positionMap.get(c);
  11709. const newPos = newPositionMap.get(c);
  11710. const dx = oldPos.left - newPos.left;
  11711. const dy = oldPos.top - newPos.top;
  11712. if (dx || dy) {
  11713. const s = c.el.style;
  11714. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  11715. s.transitionDuration = "0s";
  11716. return c;
  11717. }
  11718. }
  11719. function hasCSSTransform(el, root, moveClass) {
  11720. const clone = el.cloneNode();
  11721. const _vtc = el[vtcKey];
  11722. if (_vtc) {
  11723. _vtc.forEach((cls) => {
  11724. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  11725. });
  11726. }
  11727. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  11728. clone.style.display = "none";
  11729. const container = root.nodeType === 1 ? root : root.parentNode;
  11730. container.appendChild(clone);
  11731. const { hasTransform } = getTransitionInfo(clone);
  11732. container.removeChild(clone);
  11733. return hasTransform;
  11734. }
  11735. const getModelAssigner = (vnode) => {
  11736. const fn = vnode.props["onUpdate:modelValue"] || false;
  11737. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  11738. };
  11739. function onCompositionStart(e) {
  11740. e.target.composing = true;
  11741. }
  11742. function onCompositionEnd(e) {
  11743. const target = e.target;
  11744. if (target.composing) {
  11745. target.composing = false;
  11746. target.dispatchEvent(new Event("input"));
  11747. }
  11748. }
  11749. const assignKey = Symbol("_assign");
  11750. const vModelText = {
  11751. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  11752. el[assignKey] = getModelAssigner(vnode);
  11753. const castToNumber = number || vnode.props && vnode.props.type === "number";
  11754. addEventListener(el, lazy ? "change" : "input", (e) => {
  11755. if (e.target.composing) return;
  11756. let domValue = el.value;
  11757. if (trim) {
  11758. domValue = domValue.trim();
  11759. }
  11760. if (castToNumber) {
  11761. domValue = looseToNumber(domValue);
  11762. }
  11763. el[assignKey](domValue);
  11764. });
  11765. if (trim) {
  11766. addEventListener(el, "change", () => {
  11767. el.value = el.value.trim();
  11768. });
  11769. }
  11770. if (!lazy) {
  11771. addEventListener(el, "compositionstart", onCompositionStart);
  11772. addEventListener(el, "compositionend", onCompositionEnd);
  11773. addEventListener(el, "change", onCompositionEnd);
  11774. }
  11775. },
  11776. // set value on mounted so it's after min/max for type="range"
  11777. mounted(el, { value }) {
  11778. el.value = value == null ? "" : value;
  11779. },
  11780. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  11781. el[assignKey] = getModelAssigner(vnode);
  11782. if (el.composing) return;
  11783. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  11784. const newValue = value == null ? "" : value;
  11785. if (elValue === newValue) {
  11786. return;
  11787. }
  11788. if (document.activeElement === el && el.type !== "range") {
  11789. if (lazy && value === oldValue) {
  11790. return;
  11791. }
  11792. if (trim && el.value.trim() === newValue) {
  11793. return;
  11794. }
  11795. }
  11796. el.value = newValue;
  11797. }
  11798. };
  11799. const vModelCheckbox = {
  11800. // #4096 array checkboxes need to be deep traversed
  11801. deep: true,
  11802. created(el, _, vnode) {
  11803. el[assignKey] = getModelAssigner(vnode);
  11804. addEventListener(el, "change", () => {
  11805. const modelValue = el._modelValue;
  11806. const elementValue = getValue(el);
  11807. const checked = el.checked;
  11808. const assign = el[assignKey];
  11809. if (isArray(modelValue)) {
  11810. const index = looseIndexOf(modelValue, elementValue);
  11811. const found = index !== -1;
  11812. if (checked && !found) {
  11813. assign(modelValue.concat(elementValue));
  11814. } else if (!checked && found) {
  11815. const filtered = [...modelValue];
  11816. filtered.splice(index, 1);
  11817. assign(filtered);
  11818. }
  11819. } else if (isSet(modelValue)) {
  11820. const cloned = new Set(modelValue);
  11821. if (checked) {
  11822. cloned.add(elementValue);
  11823. } else {
  11824. cloned.delete(elementValue);
  11825. }
  11826. assign(cloned);
  11827. } else {
  11828. assign(getCheckboxValue(el, checked));
  11829. }
  11830. });
  11831. },
  11832. // set initial checked on mount to wait for true-value/false-value
  11833. mounted: setChecked,
  11834. beforeUpdate(el, binding, vnode) {
  11835. el[assignKey] = getModelAssigner(vnode);
  11836. setChecked(el, binding, vnode);
  11837. }
  11838. };
  11839. function setChecked(el, { value, oldValue }, vnode) {
  11840. el._modelValue = value;
  11841. let checked;
  11842. if (isArray(value)) {
  11843. checked = looseIndexOf(value, vnode.props.value) > -1;
  11844. } else if (isSet(value)) {
  11845. checked = value.has(vnode.props.value);
  11846. } else {
  11847. if (value === oldValue) return;
  11848. checked = looseEqual(value, getCheckboxValue(el, true));
  11849. }
  11850. if (el.checked !== checked) {
  11851. el.checked = checked;
  11852. }
  11853. }
  11854. const vModelRadio = {
  11855. created(el, { value }, vnode) {
  11856. el.checked = looseEqual(value, vnode.props.value);
  11857. el[assignKey] = getModelAssigner(vnode);
  11858. addEventListener(el, "change", () => {
  11859. el[assignKey](getValue(el));
  11860. });
  11861. },
  11862. beforeUpdate(el, { value, oldValue }, vnode) {
  11863. el[assignKey] = getModelAssigner(vnode);
  11864. if (value !== oldValue) {
  11865. el.checked = looseEqual(value, vnode.props.value);
  11866. }
  11867. }
  11868. };
  11869. const vModelSelect = {
  11870. // <select multiple> value need to be deep traversed
  11871. deep: true,
  11872. created(el, { value, modifiers: { number } }, vnode) {
  11873. const isSetModel = isSet(value);
  11874. addEventListener(el, "change", () => {
  11875. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  11876. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  11877. );
  11878. el[assignKey](
  11879. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  11880. );
  11881. el._assigning = true;
  11882. nextTick(() => {
  11883. el._assigning = false;
  11884. });
  11885. });
  11886. el[assignKey] = getModelAssigner(vnode);
  11887. },
  11888. // set value in mounted & updated because <select> relies on its children
  11889. // <option>s.
  11890. mounted(el, { value }) {
  11891. setSelected(el, value);
  11892. },
  11893. beforeUpdate(el, _binding, vnode) {
  11894. el[assignKey] = getModelAssigner(vnode);
  11895. },
  11896. updated(el, { value }) {
  11897. if (!el._assigning) {
  11898. setSelected(el, value);
  11899. }
  11900. }
  11901. };
  11902. function setSelected(el, value) {
  11903. const isMultiple = el.multiple;
  11904. const isArrayValue = isArray(value);
  11905. if (isMultiple && !isArrayValue && !isSet(value)) {
  11906. warn(
  11907. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  11908. );
  11909. return;
  11910. }
  11911. for (let i = 0, l = el.options.length; i < l; i++) {
  11912. const option = el.options[i];
  11913. const optionValue = getValue(option);
  11914. if (isMultiple) {
  11915. if (isArrayValue) {
  11916. const optionType = typeof optionValue;
  11917. if (optionType === "string" || optionType === "number") {
  11918. option.selected = value.some((v) => String(v) === String(optionValue));
  11919. } else {
  11920. option.selected = looseIndexOf(value, optionValue) > -1;
  11921. }
  11922. } else {
  11923. option.selected = value.has(optionValue);
  11924. }
  11925. } else if (looseEqual(getValue(option), value)) {
  11926. if (el.selectedIndex !== i) el.selectedIndex = i;
  11927. return;
  11928. }
  11929. }
  11930. if (!isMultiple && el.selectedIndex !== -1) {
  11931. el.selectedIndex = -1;
  11932. }
  11933. }
  11934. function getValue(el) {
  11935. return "_value" in el ? el._value : el.value;
  11936. }
  11937. function getCheckboxValue(el, checked) {
  11938. const key = checked ? "_trueValue" : "_falseValue";
  11939. return key in el ? el[key] : checked;
  11940. }
  11941. const vModelDynamic = {
  11942. created(el, binding, vnode) {
  11943. callModelHook(el, binding, vnode, null, "created");
  11944. },
  11945. mounted(el, binding, vnode) {
  11946. callModelHook(el, binding, vnode, null, "mounted");
  11947. },
  11948. beforeUpdate(el, binding, vnode, prevVNode) {
  11949. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  11950. },
  11951. updated(el, binding, vnode, prevVNode) {
  11952. callModelHook(el, binding, vnode, prevVNode, "updated");
  11953. }
  11954. };
  11955. function resolveDynamicModel(tagName, type) {
  11956. switch (tagName) {
  11957. case "SELECT":
  11958. return vModelSelect;
  11959. case "TEXTAREA":
  11960. return vModelText;
  11961. default:
  11962. switch (type) {
  11963. case "checkbox":
  11964. return vModelCheckbox;
  11965. case "radio":
  11966. return vModelRadio;
  11967. default:
  11968. return vModelText;
  11969. }
  11970. }
  11971. }
  11972. function callModelHook(el, binding, vnode, prevVNode, hook) {
  11973. const modelToUse = resolveDynamicModel(
  11974. el.tagName,
  11975. vnode.props && vnode.props.type
  11976. );
  11977. const fn = modelToUse[hook];
  11978. fn && fn(el, binding, vnode, prevVNode);
  11979. }
  11980. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  11981. const modifierGuards = {
  11982. stop: (e) => e.stopPropagation(),
  11983. prevent: (e) => e.preventDefault(),
  11984. self: (e) => e.target !== e.currentTarget,
  11985. ctrl: (e) => !e.ctrlKey,
  11986. shift: (e) => !e.shiftKey,
  11987. alt: (e) => !e.altKey,
  11988. meta: (e) => !e.metaKey,
  11989. left: (e) => "button" in e && e.button !== 0,
  11990. middle: (e) => "button" in e && e.button !== 1,
  11991. right: (e) => "button" in e && e.button !== 2,
  11992. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  11993. };
  11994. const withModifiers = (fn, modifiers) => {
  11995. const cache = fn._withMods || (fn._withMods = {});
  11996. const cacheKey = modifiers.join(".");
  11997. return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
  11998. for (let i = 0; i < modifiers.length; i++) {
  11999. const guard = modifierGuards[modifiers[i]];
  12000. if (guard && guard(event, modifiers)) return;
  12001. }
  12002. return fn(event, ...args);
  12003. });
  12004. };
  12005. const keyNames = {
  12006. esc: "escape",
  12007. space: " ",
  12008. up: "arrow-up",
  12009. left: "arrow-left",
  12010. right: "arrow-right",
  12011. down: "arrow-down",
  12012. delete: "backspace"
  12013. };
  12014. const withKeys = (fn, modifiers) => {
  12015. const cache = fn._withKeys || (fn._withKeys = {});
  12016. const cacheKey = modifiers.join(".");
  12017. return cache[cacheKey] || (cache[cacheKey] = (event) => {
  12018. if (!("key" in event)) {
  12019. return;
  12020. }
  12021. const eventKey = hyphenate(event.key);
  12022. if (modifiers.some(
  12023. (k) => k === eventKey || keyNames[k] === eventKey
  12024. )) {
  12025. return fn(event);
  12026. }
  12027. });
  12028. };
  12029. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  12030. let renderer;
  12031. let enabledHydration = false;
  12032. function ensureRenderer() {
  12033. return renderer || (renderer = createRenderer(rendererOptions));
  12034. }
  12035. function ensureHydrationRenderer() {
  12036. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  12037. enabledHydration = true;
  12038. return renderer;
  12039. }
  12040. const render = (...args) => {
  12041. ensureRenderer().render(...args);
  12042. };
  12043. const hydrate = (...args) => {
  12044. ensureHydrationRenderer().hydrate(...args);
  12045. };
  12046. const createApp = (...args) => {
  12047. const app = ensureRenderer().createApp(...args);
  12048. {
  12049. injectNativeTagCheck(app);
  12050. injectCompilerOptionsCheck(app);
  12051. }
  12052. const { mount } = app;
  12053. app.mount = (containerOrSelector) => {
  12054. const container = normalizeContainer(containerOrSelector);
  12055. if (!container) return;
  12056. const component = app._component;
  12057. if (!isFunction(component) && !component.render && !component.template) {
  12058. component.template = container.innerHTML;
  12059. }
  12060. if (container.nodeType === 1) {
  12061. container.textContent = "";
  12062. }
  12063. const proxy = mount(container, false, resolveRootNamespace(container));
  12064. if (container instanceof Element) {
  12065. container.removeAttribute("v-cloak");
  12066. container.setAttribute("data-v-app", "");
  12067. }
  12068. return proxy;
  12069. };
  12070. return app;
  12071. };
  12072. const createSSRApp = (...args) => {
  12073. const app = ensureHydrationRenderer().createApp(...args);
  12074. {
  12075. injectNativeTagCheck(app);
  12076. injectCompilerOptionsCheck(app);
  12077. }
  12078. const { mount } = app;
  12079. app.mount = (containerOrSelector) => {
  12080. const container = normalizeContainer(containerOrSelector);
  12081. if (container) {
  12082. return mount(container, true, resolveRootNamespace(container));
  12083. }
  12084. };
  12085. return app;
  12086. };
  12087. function resolveRootNamespace(container) {
  12088. if (container instanceof SVGElement) {
  12089. return "svg";
  12090. }
  12091. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  12092. return "mathml";
  12093. }
  12094. }
  12095. function injectNativeTagCheck(app) {
  12096. Object.defineProperty(app.config, "isNativeTag", {
  12097. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  12098. writable: false
  12099. });
  12100. }
  12101. function injectCompilerOptionsCheck(app) {
  12102. if (isRuntimeOnly()) {
  12103. const isCustomElement = app.config.isCustomElement;
  12104. Object.defineProperty(app.config, "isCustomElement", {
  12105. get() {
  12106. return isCustomElement;
  12107. },
  12108. set() {
  12109. warn(
  12110. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  12111. );
  12112. }
  12113. });
  12114. const compilerOptions = app.config.compilerOptions;
  12115. 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.
  12116. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  12117. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  12118. - 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`;
  12119. Object.defineProperty(app.config, "compilerOptions", {
  12120. get() {
  12121. warn(msg);
  12122. return compilerOptions;
  12123. },
  12124. set() {
  12125. warn(msg);
  12126. }
  12127. });
  12128. }
  12129. }
  12130. function normalizeContainer(container) {
  12131. if (isString(container)) {
  12132. const res = document.querySelector(container);
  12133. if (!res) {
  12134. warn(
  12135. `Failed to mount app: mount target selector "${container}" returned null.`
  12136. );
  12137. }
  12138. return res;
  12139. }
  12140. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  12141. warn(
  12142. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  12143. );
  12144. }
  12145. return container;
  12146. }
  12147. const initDirectivesForSSR = NOOP;
  12148. function initDev() {
  12149. {
  12150. {
  12151. console.info(
  12152. `You are running a development build of Vue.
  12153. Make sure to use the production build (*.prod.js) when deploying for production.`
  12154. );
  12155. }
  12156. initCustomFormatter();
  12157. }
  12158. }
  12159. const FRAGMENT = Symbol(`Fragment` );
  12160. const TELEPORT = Symbol(`Teleport` );
  12161. const SUSPENSE = Symbol(`Suspense` );
  12162. const KEEP_ALIVE = Symbol(`KeepAlive` );
  12163. const BASE_TRANSITION = Symbol(
  12164. `BaseTransition`
  12165. );
  12166. const OPEN_BLOCK = Symbol(`openBlock` );
  12167. const CREATE_BLOCK = Symbol(`createBlock` );
  12168. const CREATE_ELEMENT_BLOCK = Symbol(
  12169. `createElementBlock`
  12170. );
  12171. const CREATE_VNODE = Symbol(`createVNode` );
  12172. const CREATE_ELEMENT_VNODE = Symbol(
  12173. `createElementVNode`
  12174. );
  12175. const CREATE_COMMENT = Symbol(
  12176. `createCommentVNode`
  12177. );
  12178. const CREATE_TEXT = Symbol(
  12179. `createTextVNode`
  12180. );
  12181. const CREATE_STATIC = Symbol(
  12182. `createStaticVNode`
  12183. );
  12184. const RESOLVE_COMPONENT = Symbol(
  12185. `resolveComponent`
  12186. );
  12187. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  12188. `resolveDynamicComponent`
  12189. );
  12190. const RESOLVE_DIRECTIVE = Symbol(
  12191. `resolveDirective`
  12192. );
  12193. const RESOLVE_FILTER = Symbol(
  12194. `resolveFilter`
  12195. );
  12196. const WITH_DIRECTIVES = Symbol(
  12197. `withDirectives`
  12198. );
  12199. const RENDER_LIST = Symbol(`renderList` );
  12200. const RENDER_SLOT = Symbol(`renderSlot` );
  12201. const CREATE_SLOTS = Symbol(`createSlots` );
  12202. const TO_DISPLAY_STRING = Symbol(
  12203. `toDisplayString`
  12204. );
  12205. const MERGE_PROPS = Symbol(`mergeProps` );
  12206. const NORMALIZE_CLASS = Symbol(
  12207. `normalizeClass`
  12208. );
  12209. const NORMALIZE_STYLE = Symbol(
  12210. `normalizeStyle`
  12211. );
  12212. const NORMALIZE_PROPS = Symbol(
  12213. `normalizeProps`
  12214. );
  12215. const GUARD_REACTIVE_PROPS = Symbol(
  12216. `guardReactiveProps`
  12217. );
  12218. const TO_HANDLERS = Symbol(`toHandlers` );
  12219. const CAMELIZE = Symbol(`camelize` );
  12220. const CAPITALIZE = Symbol(`capitalize` );
  12221. const TO_HANDLER_KEY = Symbol(
  12222. `toHandlerKey`
  12223. );
  12224. const SET_BLOCK_TRACKING = Symbol(
  12225. `setBlockTracking`
  12226. );
  12227. const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
  12228. const POP_SCOPE_ID = Symbol(`popScopeId` );
  12229. const WITH_CTX = Symbol(`withCtx` );
  12230. const UNREF = Symbol(`unref` );
  12231. const IS_REF = Symbol(`isRef` );
  12232. const WITH_MEMO = Symbol(`withMemo` );
  12233. const IS_MEMO_SAME = Symbol(`isMemoSame` );
  12234. const helperNameMap = {
  12235. [FRAGMENT]: `Fragment`,
  12236. [TELEPORT]: `Teleport`,
  12237. [SUSPENSE]: `Suspense`,
  12238. [KEEP_ALIVE]: `KeepAlive`,
  12239. [BASE_TRANSITION]: `BaseTransition`,
  12240. [OPEN_BLOCK]: `openBlock`,
  12241. [CREATE_BLOCK]: `createBlock`,
  12242. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  12243. [CREATE_VNODE]: `createVNode`,
  12244. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  12245. [CREATE_COMMENT]: `createCommentVNode`,
  12246. [CREATE_TEXT]: `createTextVNode`,
  12247. [CREATE_STATIC]: `createStaticVNode`,
  12248. [RESOLVE_COMPONENT]: `resolveComponent`,
  12249. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  12250. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  12251. [RESOLVE_FILTER]: `resolveFilter`,
  12252. [WITH_DIRECTIVES]: `withDirectives`,
  12253. [RENDER_LIST]: `renderList`,
  12254. [RENDER_SLOT]: `renderSlot`,
  12255. [CREATE_SLOTS]: `createSlots`,
  12256. [TO_DISPLAY_STRING]: `toDisplayString`,
  12257. [MERGE_PROPS]: `mergeProps`,
  12258. [NORMALIZE_CLASS]: `normalizeClass`,
  12259. [NORMALIZE_STYLE]: `normalizeStyle`,
  12260. [NORMALIZE_PROPS]: `normalizeProps`,
  12261. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  12262. [TO_HANDLERS]: `toHandlers`,
  12263. [CAMELIZE]: `camelize`,
  12264. [CAPITALIZE]: `capitalize`,
  12265. [TO_HANDLER_KEY]: `toHandlerKey`,
  12266. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  12267. [PUSH_SCOPE_ID]: `pushScopeId`,
  12268. [POP_SCOPE_ID]: `popScopeId`,
  12269. [WITH_CTX]: `withCtx`,
  12270. [UNREF]: `unref`,
  12271. [IS_REF]: `isRef`,
  12272. [WITH_MEMO]: `withMemo`,
  12273. [IS_MEMO_SAME]: `isMemoSame`
  12274. };
  12275. function registerRuntimeHelpers(helpers) {
  12276. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  12277. helperNameMap[s] = helpers[s];
  12278. });
  12279. }
  12280. const locStub = {
  12281. start: { line: 1, column: 1, offset: 0 },
  12282. end: { line: 1, column: 1, offset: 0 },
  12283. source: ""
  12284. };
  12285. function createRoot(children, source = "") {
  12286. return {
  12287. type: 0,
  12288. source,
  12289. children,
  12290. helpers: /* @__PURE__ */ new Set(),
  12291. components: [],
  12292. directives: [],
  12293. hoists: [],
  12294. imports: [],
  12295. cached: [],
  12296. temps: 0,
  12297. codegenNode: void 0,
  12298. loc: locStub
  12299. };
  12300. }
  12301. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  12302. if (context) {
  12303. if (isBlock) {
  12304. context.helper(OPEN_BLOCK);
  12305. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  12306. } else {
  12307. context.helper(getVNodeHelper(context.inSSR, isComponent));
  12308. }
  12309. if (directives) {
  12310. context.helper(WITH_DIRECTIVES);
  12311. }
  12312. }
  12313. return {
  12314. type: 13,
  12315. tag,
  12316. props,
  12317. children,
  12318. patchFlag,
  12319. dynamicProps,
  12320. directives,
  12321. isBlock,
  12322. disableTracking,
  12323. isComponent,
  12324. loc
  12325. };
  12326. }
  12327. function createArrayExpression(elements, loc = locStub) {
  12328. return {
  12329. type: 17,
  12330. loc,
  12331. elements
  12332. };
  12333. }
  12334. function createObjectExpression(properties, loc = locStub) {
  12335. return {
  12336. type: 15,
  12337. loc,
  12338. properties
  12339. };
  12340. }
  12341. function createObjectProperty(key, value) {
  12342. return {
  12343. type: 16,
  12344. loc: locStub,
  12345. key: isString(key) ? createSimpleExpression(key, true) : key,
  12346. value
  12347. };
  12348. }
  12349. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  12350. return {
  12351. type: 4,
  12352. loc,
  12353. content,
  12354. isStatic,
  12355. constType: isStatic ? 3 : constType
  12356. };
  12357. }
  12358. function createCompoundExpression(children, loc = locStub) {
  12359. return {
  12360. type: 8,
  12361. loc,
  12362. children
  12363. };
  12364. }
  12365. function createCallExpression(callee, args = [], loc = locStub) {
  12366. return {
  12367. type: 14,
  12368. loc,
  12369. callee,
  12370. arguments: args
  12371. };
  12372. }
  12373. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  12374. return {
  12375. type: 18,
  12376. params,
  12377. returns,
  12378. newline,
  12379. isSlot,
  12380. loc
  12381. };
  12382. }
  12383. function createConditionalExpression(test, consequent, alternate, newline = true) {
  12384. return {
  12385. type: 19,
  12386. test,
  12387. consequent,
  12388. alternate,
  12389. newline,
  12390. loc: locStub
  12391. };
  12392. }
  12393. function createCacheExpression(index, value, needPauseTracking = false) {
  12394. return {
  12395. type: 20,
  12396. index,
  12397. value,
  12398. needPauseTracking,
  12399. needArraySpread: false,
  12400. loc: locStub
  12401. };
  12402. }
  12403. function createBlockStatement(body) {
  12404. return {
  12405. type: 21,
  12406. body,
  12407. loc: locStub
  12408. };
  12409. }
  12410. function getVNodeHelper(ssr, isComponent) {
  12411. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  12412. }
  12413. function getVNodeBlockHelper(ssr, isComponent) {
  12414. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  12415. }
  12416. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  12417. if (!node.isBlock) {
  12418. node.isBlock = true;
  12419. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  12420. helper(OPEN_BLOCK);
  12421. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  12422. }
  12423. }
  12424. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  12425. const defaultDelimitersClose = new Uint8Array([125, 125]);
  12426. function isTagStartChar(c) {
  12427. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  12428. }
  12429. function isWhitespace(c) {
  12430. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  12431. }
  12432. function isEndOfTagSection(c) {
  12433. return c === 47 || c === 62 || isWhitespace(c);
  12434. }
  12435. function toCharCodes(str) {
  12436. const ret = new Uint8Array(str.length);
  12437. for (let i = 0; i < str.length; i++) {
  12438. ret[i] = str.charCodeAt(i);
  12439. }
  12440. return ret;
  12441. }
  12442. const Sequences = {
  12443. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  12444. // CDATA[
  12445. CdataEnd: new Uint8Array([93, 93, 62]),
  12446. // ]]>
  12447. CommentEnd: new Uint8Array([45, 45, 62]),
  12448. // `-->`
  12449. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  12450. // `<\/script`
  12451. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  12452. // `</style`
  12453. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  12454. // `</title`
  12455. TextareaEnd: new Uint8Array([
  12456. 60,
  12457. 47,
  12458. 116,
  12459. 101,
  12460. 120,
  12461. 116,
  12462. 97,
  12463. 114,
  12464. 101,
  12465. 97
  12466. ])
  12467. // `</textarea
  12468. };
  12469. class Tokenizer {
  12470. constructor(stack, cbs) {
  12471. this.stack = stack;
  12472. this.cbs = cbs;
  12473. /** The current state the tokenizer is in. */
  12474. this.state = 1;
  12475. /** The read buffer. */
  12476. this.buffer = "";
  12477. /** The beginning of the section that is currently being read. */
  12478. this.sectionStart = 0;
  12479. /** The index within the buffer that we are currently looking at. */
  12480. this.index = 0;
  12481. /** The start of the last entity. */
  12482. this.entityStart = 0;
  12483. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  12484. this.baseState = 1;
  12485. /** For special parsing behavior inside of script and style tags. */
  12486. this.inRCDATA = false;
  12487. /** For disabling RCDATA tags handling */
  12488. this.inXML = false;
  12489. /** For disabling interpolation parsing in v-pre */
  12490. this.inVPre = false;
  12491. /** Record newline positions for fast line / column calculation */
  12492. this.newlines = [];
  12493. this.mode = 0;
  12494. this.delimiterOpen = defaultDelimitersOpen;
  12495. this.delimiterClose = defaultDelimitersClose;
  12496. this.delimiterIndex = -1;
  12497. this.currentSequence = void 0;
  12498. this.sequenceIndex = 0;
  12499. }
  12500. get inSFCRoot() {
  12501. return this.mode === 2 && this.stack.length === 0;
  12502. }
  12503. reset() {
  12504. this.state = 1;
  12505. this.mode = 0;
  12506. this.buffer = "";
  12507. this.sectionStart = 0;
  12508. this.index = 0;
  12509. this.baseState = 1;
  12510. this.inRCDATA = false;
  12511. this.currentSequence = void 0;
  12512. this.newlines.length = 0;
  12513. this.delimiterOpen = defaultDelimitersOpen;
  12514. this.delimiterClose = defaultDelimitersClose;
  12515. }
  12516. /**
  12517. * Generate Position object with line / column information using recorded
  12518. * newline positions. We know the index is always going to be an already
  12519. * processed index, so all the newlines up to this index should have been
  12520. * recorded.
  12521. */
  12522. getPos(index) {
  12523. let line = 1;
  12524. let column = index + 1;
  12525. for (let i = this.newlines.length - 1; i >= 0; i--) {
  12526. const newlineIndex = this.newlines[i];
  12527. if (index > newlineIndex) {
  12528. line = i + 2;
  12529. column = index - newlineIndex;
  12530. break;
  12531. }
  12532. }
  12533. return {
  12534. column,
  12535. line,
  12536. offset: index
  12537. };
  12538. }
  12539. peek() {
  12540. return this.buffer.charCodeAt(this.index + 1);
  12541. }
  12542. stateText(c) {
  12543. if (c === 60) {
  12544. if (this.index > this.sectionStart) {
  12545. this.cbs.ontext(this.sectionStart, this.index);
  12546. }
  12547. this.state = 5;
  12548. this.sectionStart = this.index;
  12549. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  12550. this.state = 2;
  12551. this.delimiterIndex = 0;
  12552. this.stateInterpolationOpen(c);
  12553. }
  12554. }
  12555. stateInterpolationOpen(c) {
  12556. if (c === this.delimiterOpen[this.delimiterIndex]) {
  12557. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  12558. const start = this.index + 1 - this.delimiterOpen.length;
  12559. if (start > this.sectionStart) {
  12560. this.cbs.ontext(this.sectionStart, start);
  12561. }
  12562. this.state = 3;
  12563. this.sectionStart = start;
  12564. } else {
  12565. this.delimiterIndex++;
  12566. }
  12567. } else if (this.inRCDATA) {
  12568. this.state = 32;
  12569. this.stateInRCDATA(c);
  12570. } else {
  12571. this.state = 1;
  12572. this.stateText(c);
  12573. }
  12574. }
  12575. stateInterpolation(c) {
  12576. if (c === this.delimiterClose[0]) {
  12577. this.state = 4;
  12578. this.delimiterIndex = 0;
  12579. this.stateInterpolationClose(c);
  12580. }
  12581. }
  12582. stateInterpolationClose(c) {
  12583. if (c === this.delimiterClose[this.delimiterIndex]) {
  12584. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  12585. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  12586. if (this.inRCDATA) {
  12587. this.state = 32;
  12588. } else {
  12589. this.state = 1;
  12590. }
  12591. this.sectionStart = this.index + 1;
  12592. } else {
  12593. this.delimiterIndex++;
  12594. }
  12595. } else {
  12596. this.state = 3;
  12597. this.stateInterpolation(c);
  12598. }
  12599. }
  12600. stateSpecialStartSequence(c) {
  12601. const isEnd = this.sequenceIndex === this.currentSequence.length;
  12602. const isMatch = isEnd ? (
  12603. // If we are at the end of the sequence, make sure the tag name has ended
  12604. isEndOfTagSection(c)
  12605. ) : (
  12606. // Otherwise, do a case-insensitive comparison
  12607. (c | 32) === this.currentSequence[this.sequenceIndex]
  12608. );
  12609. if (!isMatch) {
  12610. this.inRCDATA = false;
  12611. } else if (!isEnd) {
  12612. this.sequenceIndex++;
  12613. return;
  12614. }
  12615. this.sequenceIndex = 0;
  12616. this.state = 6;
  12617. this.stateInTagName(c);
  12618. }
  12619. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  12620. stateInRCDATA(c) {
  12621. if (this.sequenceIndex === this.currentSequence.length) {
  12622. if (c === 62 || isWhitespace(c)) {
  12623. const endOfText = this.index - this.currentSequence.length;
  12624. if (this.sectionStart < endOfText) {
  12625. const actualIndex = this.index;
  12626. this.index = endOfText;
  12627. this.cbs.ontext(this.sectionStart, endOfText);
  12628. this.index = actualIndex;
  12629. }
  12630. this.sectionStart = endOfText + 2;
  12631. this.stateInClosingTagName(c);
  12632. this.inRCDATA = false;
  12633. return;
  12634. }
  12635. this.sequenceIndex = 0;
  12636. }
  12637. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  12638. this.sequenceIndex += 1;
  12639. } else if (this.sequenceIndex === 0) {
  12640. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  12641. if (!this.inVPre && c === this.delimiterOpen[0]) {
  12642. this.state = 2;
  12643. this.delimiterIndex = 0;
  12644. this.stateInterpolationOpen(c);
  12645. }
  12646. } else if (this.fastForwardTo(60)) {
  12647. this.sequenceIndex = 1;
  12648. }
  12649. } else {
  12650. this.sequenceIndex = Number(c === 60);
  12651. }
  12652. }
  12653. stateCDATASequence(c) {
  12654. if (c === Sequences.Cdata[this.sequenceIndex]) {
  12655. if (++this.sequenceIndex === Sequences.Cdata.length) {
  12656. this.state = 28;
  12657. this.currentSequence = Sequences.CdataEnd;
  12658. this.sequenceIndex = 0;
  12659. this.sectionStart = this.index + 1;
  12660. }
  12661. } else {
  12662. this.sequenceIndex = 0;
  12663. this.state = 23;
  12664. this.stateInDeclaration(c);
  12665. }
  12666. }
  12667. /**
  12668. * When we wait for one specific character, we can speed things up
  12669. * by skipping through the buffer until we find it.
  12670. *
  12671. * @returns Whether the character was found.
  12672. */
  12673. fastForwardTo(c) {
  12674. while (++this.index < this.buffer.length) {
  12675. const cc = this.buffer.charCodeAt(this.index);
  12676. if (cc === 10) {
  12677. this.newlines.push(this.index);
  12678. }
  12679. if (cc === c) {
  12680. return true;
  12681. }
  12682. }
  12683. this.index = this.buffer.length - 1;
  12684. return false;
  12685. }
  12686. /**
  12687. * Comments and CDATA end with `-->` and `]]>`.
  12688. *
  12689. * Their common qualities are:
  12690. * - Their end sequences have a distinct character they start with.
  12691. * - That character is then repeated, so we have to check multiple repeats.
  12692. * - All characters but the start character of the sequence can be skipped.
  12693. */
  12694. stateInCommentLike(c) {
  12695. if (c === this.currentSequence[this.sequenceIndex]) {
  12696. if (++this.sequenceIndex === this.currentSequence.length) {
  12697. if (this.currentSequence === Sequences.CdataEnd) {
  12698. this.cbs.oncdata(this.sectionStart, this.index - 2);
  12699. } else {
  12700. this.cbs.oncomment(this.sectionStart, this.index - 2);
  12701. }
  12702. this.sequenceIndex = 0;
  12703. this.sectionStart = this.index + 1;
  12704. this.state = 1;
  12705. }
  12706. } else if (this.sequenceIndex === 0) {
  12707. if (this.fastForwardTo(this.currentSequence[0])) {
  12708. this.sequenceIndex = 1;
  12709. }
  12710. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  12711. this.sequenceIndex = 0;
  12712. }
  12713. }
  12714. startSpecial(sequence, offset) {
  12715. this.enterRCDATA(sequence, offset);
  12716. this.state = 31;
  12717. }
  12718. enterRCDATA(sequence, offset) {
  12719. this.inRCDATA = true;
  12720. this.currentSequence = sequence;
  12721. this.sequenceIndex = offset;
  12722. }
  12723. stateBeforeTagName(c) {
  12724. if (c === 33) {
  12725. this.state = 22;
  12726. this.sectionStart = this.index + 1;
  12727. } else if (c === 63) {
  12728. this.state = 24;
  12729. this.sectionStart = this.index + 1;
  12730. } else if (isTagStartChar(c)) {
  12731. this.sectionStart = this.index;
  12732. if (this.mode === 0) {
  12733. this.state = 6;
  12734. } else if (this.inSFCRoot) {
  12735. this.state = 34;
  12736. } else if (!this.inXML) {
  12737. if (c === 116) {
  12738. this.state = 30;
  12739. } else {
  12740. this.state = c === 115 ? 29 : 6;
  12741. }
  12742. } else {
  12743. this.state = 6;
  12744. }
  12745. } else if (c === 47) {
  12746. this.state = 8;
  12747. } else {
  12748. this.state = 1;
  12749. this.stateText(c);
  12750. }
  12751. }
  12752. stateInTagName(c) {
  12753. if (isEndOfTagSection(c)) {
  12754. this.handleTagName(c);
  12755. }
  12756. }
  12757. stateInSFCRootTagName(c) {
  12758. if (isEndOfTagSection(c)) {
  12759. const tag = this.buffer.slice(this.sectionStart, this.index);
  12760. if (tag !== "template") {
  12761. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  12762. }
  12763. this.handleTagName(c);
  12764. }
  12765. }
  12766. handleTagName(c) {
  12767. this.cbs.onopentagname(this.sectionStart, this.index);
  12768. this.sectionStart = -1;
  12769. this.state = 11;
  12770. this.stateBeforeAttrName(c);
  12771. }
  12772. stateBeforeClosingTagName(c) {
  12773. if (isWhitespace(c)) ; else if (c === 62) {
  12774. {
  12775. this.cbs.onerr(14, this.index);
  12776. }
  12777. this.state = 1;
  12778. this.sectionStart = this.index + 1;
  12779. } else {
  12780. this.state = isTagStartChar(c) ? 9 : 27;
  12781. this.sectionStart = this.index;
  12782. }
  12783. }
  12784. stateInClosingTagName(c) {
  12785. if (c === 62 || isWhitespace(c)) {
  12786. this.cbs.onclosetag(this.sectionStart, this.index);
  12787. this.sectionStart = -1;
  12788. this.state = 10;
  12789. this.stateAfterClosingTagName(c);
  12790. }
  12791. }
  12792. stateAfterClosingTagName(c) {
  12793. if (c === 62) {
  12794. this.state = 1;
  12795. this.sectionStart = this.index + 1;
  12796. }
  12797. }
  12798. stateBeforeAttrName(c) {
  12799. if (c === 62) {
  12800. this.cbs.onopentagend(this.index);
  12801. if (this.inRCDATA) {
  12802. this.state = 32;
  12803. } else {
  12804. this.state = 1;
  12805. }
  12806. this.sectionStart = this.index + 1;
  12807. } else if (c === 47) {
  12808. this.state = 7;
  12809. if (this.peek() !== 62) {
  12810. this.cbs.onerr(22, this.index);
  12811. }
  12812. } else if (c === 60 && this.peek() === 47) {
  12813. this.cbs.onopentagend(this.index);
  12814. this.state = 5;
  12815. this.sectionStart = this.index;
  12816. } else if (!isWhitespace(c)) {
  12817. if (c === 61) {
  12818. this.cbs.onerr(
  12819. 19,
  12820. this.index
  12821. );
  12822. }
  12823. this.handleAttrStart(c);
  12824. }
  12825. }
  12826. handleAttrStart(c) {
  12827. if (c === 118 && this.peek() === 45) {
  12828. this.state = 13;
  12829. this.sectionStart = this.index;
  12830. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  12831. this.cbs.ondirname(this.index, this.index + 1);
  12832. this.state = 14;
  12833. this.sectionStart = this.index + 1;
  12834. } else {
  12835. this.state = 12;
  12836. this.sectionStart = this.index;
  12837. }
  12838. }
  12839. stateInSelfClosingTag(c) {
  12840. if (c === 62) {
  12841. this.cbs.onselfclosingtag(this.index);
  12842. this.state = 1;
  12843. this.sectionStart = this.index + 1;
  12844. this.inRCDATA = false;
  12845. } else if (!isWhitespace(c)) {
  12846. this.state = 11;
  12847. this.stateBeforeAttrName(c);
  12848. }
  12849. }
  12850. stateInAttrName(c) {
  12851. if (c === 61 || isEndOfTagSection(c)) {
  12852. this.cbs.onattribname(this.sectionStart, this.index);
  12853. this.handleAttrNameEnd(c);
  12854. } else if (c === 34 || c === 39 || c === 60) {
  12855. this.cbs.onerr(
  12856. 17,
  12857. this.index
  12858. );
  12859. }
  12860. }
  12861. stateInDirName(c) {
  12862. if (c === 61 || isEndOfTagSection(c)) {
  12863. this.cbs.ondirname(this.sectionStart, this.index);
  12864. this.handleAttrNameEnd(c);
  12865. } else if (c === 58) {
  12866. this.cbs.ondirname(this.sectionStart, this.index);
  12867. this.state = 14;
  12868. this.sectionStart = this.index + 1;
  12869. } else if (c === 46) {
  12870. this.cbs.ondirname(this.sectionStart, this.index);
  12871. this.state = 16;
  12872. this.sectionStart = this.index + 1;
  12873. }
  12874. }
  12875. stateInDirArg(c) {
  12876. if (c === 61 || isEndOfTagSection(c)) {
  12877. this.cbs.ondirarg(this.sectionStart, this.index);
  12878. this.handleAttrNameEnd(c);
  12879. } else if (c === 91) {
  12880. this.state = 15;
  12881. } else if (c === 46) {
  12882. this.cbs.ondirarg(this.sectionStart, this.index);
  12883. this.state = 16;
  12884. this.sectionStart = this.index + 1;
  12885. }
  12886. }
  12887. stateInDynamicDirArg(c) {
  12888. if (c === 93) {
  12889. this.state = 14;
  12890. } else if (c === 61 || isEndOfTagSection(c)) {
  12891. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  12892. this.handleAttrNameEnd(c);
  12893. {
  12894. this.cbs.onerr(
  12895. 27,
  12896. this.index
  12897. );
  12898. }
  12899. }
  12900. }
  12901. stateInDirModifier(c) {
  12902. if (c === 61 || isEndOfTagSection(c)) {
  12903. this.cbs.ondirmodifier(this.sectionStart, this.index);
  12904. this.handleAttrNameEnd(c);
  12905. } else if (c === 46) {
  12906. this.cbs.ondirmodifier(this.sectionStart, this.index);
  12907. this.sectionStart = this.index + 1;
  12908. }
  12909. }
  12910. handleAttrNameEnd(c) {
  12911. this.sectionStart = this.index;
  12912. this.state = 17;
  12913. this.cbs.onattribnameend(this.index);
  12914. this.stateAfterAttrName(c);
  12915. }
  12916. stateAfterAttrName(c) {
  12917. if (c === 61) {
  12918. this.state = 18;
  12919. } else if (c === 47 || c === 62) {
  12920. this.cbs.onattribend(0, this.sectionStart);
  12921. this.sectionStart = -1;
  12922. this.state = 11;
  12923. this.stateBeforeAttrName(c);
  12924. } else if (!isWhitespace(c)) {
  12925. this.cbs.onattribend(0, this.sectionStart);
  12926. this.handleAttrStart(c);
  12927. }
  12928. }
  12929. stateBeforeAttrValue(c) {
  12930. if (c === 34) {
  12931. this.state = 19;
  12932. this.sectionStart = this.index + 1;
  12933. } else if (c === 39) {
  12934. this.state = 20;
  12935. this.sectionStart = this.index + 1;
  12936. } else if (!isWhitespace(c)) {
  12937. this.sectionStart = this.index;
  12938. this.state = 21;
  12939. this.stateInAttrValueNoQuotes(c);
  12940. }
  12941. }
  12942. handleInAttrValue(c, quote) {
  12943. if (c === quote || this.fastForwardTo(quote)) {
  12944. this.cbs.onattribdata(this.sectionStart, this.index);
  12945. this.sectionStart = -1;
  12946. this.cbs.onattribend(
  12947. quote === 34 ? 3 : 2,
  12948. this.index + 1
  12949. );
  12950. this.state = 11;
  12951. }
  12952. }
  12953. stateInAttrValueDoubleQuotes(c) {
  12954. this.handleInAttrValue(c, 34);
  12955. }
  12956. stateInAttrValueSingleQuotes(c) {
  12957. this.handleInAttrValue(c, 39);
  12958. }
  12959. stateInAttrValueNoQuotes(c) {
  12960. if (isWhitespace(c) || c === 62) {
  12961. this.cbs.onattribdata(this.sectionStart, this.index);
  12962. this.sectionStart = -1;
  12963. this.cbs.onattribend(1, this.index);
  12964. this.state = 11;
  12965. this.stateBeforeAttrName(c);
  12966. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  12967. this.cbs.onerr(
  12968. 18,
  12969. this.index
  12970. );
  12971. } else ;
  12972. }
  12973. stateBeforeDeclaration(c) {
  12974. if (c === 91) {
  12975. this.state = 26;
  12976. this.sequenceIndex = 0;
  12977. } else {
  12978. this.state = c === 45 ? 25 : 23;
  12979. }
  12980. }
  12981. stateInDeclaration(c) {
  12982. if (c === 62 || this.fastForwardTo(62)) {
  12983. this.state = 1;
  12984. this.sectionStart = this.index + 1;
  12985. }
  12986. }
  12987. stateInProcessingInstruction(c) {
  12988. if (c === 62 || this.fastForwardTo(62)) {
  12989. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  12990. this.state = 1;
  12991. this.sectionStart = this.index + 1;
  12992. }
  12993. }
  12994. stateBeforeComment(c) {
  12995. if (c === 45) {
  12996. this.state = 28;
  12997. this.currentSequence = Sequences.CommentEnd;
  12998. this.sequenceIndex = 2;
  12999. this.sectionStart = this.index + 1;
  13000. } else {
  13001. this.state = 23;
  13002. }
  13003. }
  13004. stateInSpecialComment(c) {
  13005. if (c === 62 || this.fastForwardTo(62)) {
  13006. this.cbs.oncomment(this.sectionStart, this.index);
  13007. this.state = 1;
  13008. this.sectionStart = this.index + 1;
  13009. }
  13010. }
  13011. stateBeforeSpecialS(c) {
  13012. if (c === Sequences.ScriptEnd[3]) {
  13013. this.startSpecial(Sequences.ScriptEnd, 4);
  13014. } else if (c === Sequences.StyleEnd[3]) {
  13015. this.startSpecial(Sequences.StyleEnd, 4);
  13016. } else {
  13017. this.state = 6;
  13018. this.stateInTagName(c);
  13019. }
  13020. }
  13021. stateBeforeSpecialT(c) {
  13022. if (c === Sequences.TitleEnd[3]) {
  13023. this.startSpecial(Sequences.TitleEnd, 4);
  13024. } else if (c === Sequences.TextareaEnd[3]) {
  13025. this.startSpecial(Sequences.TextareaEnd, 4);
  13026. } else {
  13027. this.state = 6;
  13028. this.stateInTagName(c);
  13029. }
  13030. }
  13031. startEntity() {
  13032. }
  13033. stateInEntity() {
  13034. }
  13035. /**
  13036. * Iterates through the buffer, calling the function corresponding to the current state.
  13037. *
  13038. * States that are more likely to be hit are higher up, as a performance improvement.
  13039. */
  13040. parse(input) {
  13041. this.buffer = input;
  13042. while (this.index < this.buffer.length) {
  13043. const c = this.buffer.charCodeAt(this.index);
  13044. if (c === 10) {
  13045. this.newlines.push(this.index);
  13046. }
  13047. switch (this.state) {
  13048. case 1: {
  13049. this.stateText(c);
  13050. break;
  13051. }
  13052. case 2: {
  13053. this.stateInterpolationOpen(c);
  13054. break;
  13055. }
  13056. case 3: {
  13057. this.stateInterpolation(c);
  13058. break;
  13059. }
  13060. case 4: {
  13061. this.stateInterpolationClose(c);
  13062. break;
  13063. }
  13064. case 31: {
  13065. this.stateSpecialStartSequence(c);
  13066. break;
  13067. }
  13068. case 32: {
  13069. this.stateInRCDATA(c);
  13070. break;
  13071. }
  13072. case 26: {
  13073. this.stateCDATASequence(c);
  13074. break;
  13075. }
  13076. case 19: {
  13077. this.stateInAttrValueDoubleQuotes(c);
  13078. break;
  13079. }
  13080. case 12: {
  13081. this.stateInAttrName(c);
  13082. break;
  13083. }
  13084. case 13: {
  13085. this.stateInDirName(c);
  13086. break;
  13087. }
  13088. case 14: {
  13089. this.stateInDirArg(c);
  13090. break;
  13091. }
  13092. case 15: {
  13093. this.stateInDynamicDirArg(c);
  13094. break;
  13095. }
  13096. case 16: {
  13097. this.stateInDirModifier(c);
  13098. break;
  13099. }
  13100. case 28: {
  13101. this.stateInCommentLike(c);
  13102. break;
  13103. }
  13104. case 27: {
  13105. this.stateInSpecialComment(c);
  13106. break;
  13107. }
  13108. case 11: {
  13109. this.stateBeforeAttrName(c);
  13110. break;
  13111. }
  13112. case 6: {
  13113. this.stateInTagName(c);
  13114. break;
  13115. }
  13116. case 34: {
  13117. this.stateInSFCRootTagName(c);
  13118. break;
  13119. }
  13120. case 9: {
  13121. this.stateInClosingTagName(c);
  13122. break;
  13123. }
  13124. case 5: {
  13125. this.stateBeforeTagName(c);
  13126. break;
  13127. }
  13128. case 17: {
  13129. this.stateAfterAttrName(c);
  13130. break;
  13131. }
  13132. case 20: {
  13133. this.stateInAttrValueSingleQuotes(c);
  13134. break;
  13135. }
  13136. case 18: {
  13137. this.stateBeforeAttrValue(c);
  13138. break;
  13139. }
  13140. case 8: {
  13141. this.stateBeforeClosingTagName(c);
  13142. break;
  13143. }
  13144. case 10: {
  13145. this.stateAfterClosingTagName(c);
  13146. break;
  13147. }
  13148. case 29: {
  13149. this.stateBeforeSpecialS(c);
  13150. break;
  13151. }
  13152. case 30: {
  13153. this.stateBeforeSpecialT(c);
  13154. break;
  13155. }
  13156. case 21: {
  13157. this.stateInAttrValueNoQuotes(c);
  13158. break;
  13159. }
  13160. case 7: {
  13161. this.stateInSelfClosingTag(c);
  13162. break;
  13163. }
  13164. case 23: {
  13165. this.stateInDeclaration(c);
  13166. break;
  13167. }
  13168. case 22: {
  13169. this.stateBeforeDeclaration(c);
  13170. break;
  13171. }
  13172. case 25: {
  13173. this.stateBeforeComment(c);
  13174. break;
  13175. }
  13176. case 24: {
  13177. this.stateInProcessingInstruction(c);
  13178. break;
  13179. }
  13180. case 33: {
  13181. this.stateInEntity();
  13182. break;
  13183. }
  13184. }
  13185. this.index++;
  13186. }
  13187. this.cleanup();
  13188. this.finish();
  13189. }
  13190. /**
  13191. * Remove data that has already been consumed from the buffer.
  13192. */
  13193. cleanup() {
  13194. if (this.sectionStart !== this.index) {
  13195. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  13196. this.cbs.ontext(this.sectionStart, this.index);
  13197. this.sectionStart = this.index;
  13198. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  13199. this.cbs.onattribdata(this.sectionStart, this.index);
  13200. this.sectionStart = this.index;
  13201. }
  13202. }
  13203. }
  13204. finish() {
  13205. this.handleTrailingData();
  13206. this.cbs.onend();
  13207. }
  13208. /** Handle any trailing data. */
  13209. handleTrailingData() {
  13210. const endIndex = this.buffer.length;
  13211. if (this.sectionStart >= endIndex) {
  13212. return;
  13213. }
  13214. if (this.state === 28) {
  13215. if (this.currentSequence === Sequences.CdataEnd) {
  13216. this.cbs.oncdata(this.sectionStart, endIndex);
  13217. } else {
  13218. this.cbs.oncomment(this.sectionStart, endIndex);
  13219. }
  13220. } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else {
  13221. this.cbs.ontext(this.sectionStart, endIndex);
  13222. }
  13223. }
  13224. emitCodePoint(cp, consumed) {
  13225. }
  13226. }
  13227. function defaultOnError(error) {
  13228. throw error;
  13229. }
  13230. function defaultOnWarn(msg) {
  13231. console.warn(`[Vue warn] ${msg.message}`);
  13232. }
  13233. function createCompilerError(code, loc, messages, additionalMessage) {
  13234. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  13235. const error = new SyntaxError(String(msg));
  13236. error.code = code;
  13237. error.loc = loc;
  13238. return error;
  13239. }
  13240. const errorMessages = {
  13241. // parse errors
  13242. [0]: "Illegal comment.",
  13243. [1]: "CDATA section is allowed only in XML context.",
  13244. [2]: "Duplicate attribute.",
  13245. [3]: "End tag cannot have attributes.",
  13246. [4]: "Illegal '/' in tags.",
  13247. [5]: "Unexpected EOF in tag.",
  13248. [6]: "Unexpected EOF in CDATA section.",
  13249. [7]: "Unexpected EOF in comment.",
  13250. [8]: "Unexpected EOF in script.",
  13251. [9]: "Unexpected EOF in tag.",
  13252. [10]: "Incorrectly closed comment.",
  13253. [11]: "Incorrectly opened comment.",
  13254. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  13255. [13]: "Attribute value was expected.",
  13256. [14]: "End tag name was expected.",
  13257. [15]: "Whitespace was expected.",
  13258. [16]: "Unexpected '<!--' in comment.",
  13259. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  13260. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  13261. [19]: "Attribute name cannot start with '='.",
  13262. [21]: "'<?' is allowed only in XML context.",
  13263. [20]: `Unexpected null character.`,
  13264. [22]: "Illegal '/' in tags.",
  13265. // Vue-specific parse errors
  13266. [23]: "Invalid end tag.",
  13267. [24]: "Element is missing end tag.",
  13268. [25]: "Interpolation end sign was not found.",
  13269. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  13270. [26]: "Legal directive name was expected.",
  13271. // transform errors
  13272. [28]: `v-if/v-else-if is missing expression.`,
  13273. [29]: `v-if/else branches must use unique keys.`,
  13274. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  13275. [31]: `v-for is missing expression.`,
  13276. [32]: `v-for has invalid expression.`,
  13277. [33]: `<template v-for> key should be placed on the <template> tag.`,
  13278. [34]: `v-bind is missing expression.`,
  13279. [52]: `v-bind with same-name shorthand only allows static argument.`,
  13280. [35]: `v-on is missing expression.`,
  13281. [36]: `Unexpected custom directive on <slot> outlet.`,
  13282. [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.`,
  13283. [38]: `Duplicate slot names found. `,
  13284. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  13285. [40]: `v-slot can only be used on components or <template> tags.`,
  13286. [41]: `v-model is missing expression.`,
  13287. [42]: `v-model value must be a valid JavaScript member expression.`,
  13288. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  13289. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  13290. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  13291. [45]: `Error parsing JavaScript expression: `,
  13292. [46]: `<KeepAlive> expects exactly one child component.`,
  13293. [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`,
  13294. // generic errors
  13295. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  13296. [48]: `ES module mode is not supported in this build of compiler.`,
  13297. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  13298. [50]: `"scopeId" option is only supported in module mode.`,
  13299. // just to fulfill types
  13300. [53]: ``
  13301. };
  13302. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  13303. function isCoreComponent(tag) {
  13304. switch (tag) {
  13305. case "Teleport":
  13306. case "teleport":
  13307. return TELEPORT;
  13308. case "Suspense":
  13309. case "suspense":
  13310. return SUSPENSE;
  13311. case "KeepAlive":
  13312. case "keep-alive":
  13313. return KEEP_ALIVE;
  13314. case "BaseTransition":
  13315. case "base-transition":
  13316. return BASE_TRANSITION;
  13317. }
  13318. }
  13319. const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
  13320. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  13321. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  13322. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  13323. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  13324. const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
  13325. const isMemberExpressionBrowser = (exp) => {
  13326. const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
  13327. let state = 0 /* inMemberExp */;
  13328. let stateStack = [];
  13329. let currentOpenBracketCount = 0;
  13330. let currentOpenParensCount = 0;
  13331. let currentStringType = null;
  13332. for (let i = 0; i < path.length; i++) {
  13333. const char = path.charAt(i);
  13334. switch (state) {
  13335. case 0 /* inMemberExp */:
  13336. if (char === "[") {
  13337. stateStack.push(state);
  13338. state = 1 /* inBrackets */;
  13339. currentOpenBracketCount++;
  13340. } else if (char === "(") {
  13341. stateStack.push(state);
  13342. state = 2 /* inParens */;
  13343. currentOpenParensCount++;
  13344. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  13345. return false;
  13346. }
  13347. break;
  13348. case 1 /* inBrackets */:
  13349. if (char === `'` || char === `"` || char === "`") {
  13350. stateStack.push(state);
  13351. state = 3 /* inString */;
  13352. currentStringType = char;
  13353. } else if (char === `[`) {
  13354. currentOpenBracketCount++;
  13355. } else if (char === `]`) {
  13356. if (!--currentOpenBracketCount) {
  13357. state = stateStack.pop();
  13358. }
  13359. }
  13360. break;
  13361. case 2 /* inParens */:
  13362. if (char === `'` || char === `"` || char === "`") {
  13363. stateStack.push(state);
  13364. state = 3 /* inString */;
  13365. currentStringType = char;
  13366. } else if (char === `(`) {
  13367. currentOpenParensCount++;
  13368. } else if (char === `)`) {
  13369. if (i === path.length - 1) {
  13370. return false;
  13371. }
  13372. if (!--currentOpenParensCount) {
  13373. state = stateStack.pop();
  13374. }
  13375. }
  13376. break;
  13377. case 3 /* inString */:
  13378. if (char === currentStringType) {
  13379. state = stateStack.pop();
  13380. currentStringType = null;
  13381. }
  13382. break;
  13383. }
  13384. }
  13385. return !currentOpenBracketCount && !currentOpenParensCount;
  13386. };
  13387. const isMemberExpression = isMemberExpressionBrowser ;
  13388. const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  13389. const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
  13390. const isFnExpression = isFnExpressionBrowser ;
  13391. function assert(condition, msg) {
  13392. if (!condition) {
  13393. throw new Error(msg || `unexpected compiler condition`);
  13394. }
  13395. }
  13396. function findDir(node, name, allowEmpty = false) {
  13397. for (let i = 0; i < node.props.length; i++) {
  13398. const p = node.props[i];
  13399. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  13400. return p;
  13401. }
  13402. }
  13403. }
  13404. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  13405. for (let i = 0; i < node.props.length; i++) {
  13406. const p = node.props[i];
  13407. if (p.type === 6) {
  13408. if (dynamicOnly) continue;
  13409. if (p.name === name && (p.value || allowEmpty)) {
  13410. return p;
  13411. }
  13412. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  13413. return p;
  13414. }
  13415. }
  13416. }
  13417. function isStaticArgOf(arg, name) {
  13418. return !!(arg && isStaticExp(arg) && arg.content === name);
  13419. }
  13420. function hasDynamicKeyVBind(node) {
  13421. return node.props.some(
  13422. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  13423. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  13424. !p.arg.isStatic)
  13425. // v-bind:[foo]
  13426. );
  13427. }
  13428. function isText$1(node) {
  13429. return node.type === 5 || node.type === 2;
  13430. }
  13431. function isVSlot(p) {
  13432. return p.type === 7 && p.name === "slot";
  13433. }
  13434. function isTemplateNode(node) {
  13435. return node.type === 1 && node.tagType === 3;
  13436. }
  13437. function isSlotOutlet(node) {
  13438. return node.type === 1 && node.tagType === 2;
  13439. }
  13440. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  13441. function getUnnormalizedProps(props, callPath = []) {
  13442. if (props && !isString(props) && props.type === 14) {
  13443. const callee = props.callee;
  13444. if (!isString(callee) && propsHelperSet.has(callee)) {
  13445. return getUnnormalizedProps(
  13446. props.arguments[0],
  13447. callPath.concat(props)
  13448. );
  13449. }
  13450. }
  13451. return [props, callPath];
  13452. }
  13453. function injectProp(node, prop, context) {
  13454. let propsWithInjection;
  13455. let props = node.type === 13 ? node.props : node.arguments[2];
  13456. let callPath = [];
  13457. let parentCall;
  13458. if (props && !isString(props) && props.type === 14) {
  13459. const ret = getUnnormalizedProps(props);
  13460. props = ret[0];
  13461. callPath = ret[1];
  13462. parentCall = callPath[callPath.length - 1];
  13463. }
  13464. if (props == null || isString(props)) {
  13465. propsWithInjection = createObjectExpression([prop]);
  13466. } else if (props.type === 14) {
  13467. const first = props.arguments[0];
  13468. if (!isString(first) && first.type === 15) {
  13469. if (!hasProp(prop, first)) {
  13470. first.properties.unshift(prop);
  13471. }
  13472. } else {
  13473. if (props.callee === TO_HANDLERS) {
  13474. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  13475. createObjectExpression([prop]),
  13476. props
  13477. ]);
  13478. } else {
  13479. props.arguments.unshift(createObjectExpression([prop]));
  13480. }
  13481. }
  13482. !propsWithInjection && (propsWithInjection = props);
  13483. } else if (props.type === 15) {
  13484. if (!hasProp(prop, props)) {
  13485. props.properties.unshift(prop);
  13486. }
  13487. propsWithInjection = props;
  13488. } else {
  13489. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  13490. createObjectExpression([prop]),
  13491. props
  13492. ]);
  13493. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  13494. parentCall = callPath[callPath.length - 2];
  13495. }
  13496. }
  13497. if (node.type === 13) {
  13498. if (parentCall) {
  13499. parentCall.arguments[0] = propsWithInjection;
  13500. } else {
  13501. node.props = propsWithInjection;
  13502. }
  13503. } else {
  13504. if (parentCall) {
  13505. parentCall.arguments[0] = propsWithInjection;
  13506. } else {
  13507. node.arguments[2] = propsWithInjection;
  13508. }
  13509. }
  13510. }
  13511. function hasProp(prop, props) {
  13512. let result = false;
  13513. if (prop.key.type === 4) {
  13514. const propKeyName = prop.key.content;
  13515. result = props.properties.some(
  13516. (p) => p.key.type === 4 && p.key.content === propKeyName
  13517. );
  13518. }
  13519. return result;
  13520. }
  13521. function toValidAssetId(name, type) {
  13522. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  13523. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  13524. })}`;
  13525. }
  13526. function getMemoedVNodeCall(node) {
  13527. if (node.type === 14 && node.callee === WITH_MEMO) {
  13528. return node.arguments[1].returns;
  13529. } else {
  13530. return node;
  13531. }
  13532. }
  13533. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
  13534. const defaultParserOptions = {
  13535. parseMode: "base",
  13536. ns: 0,
  13537. delimiters: [`{{`, `}}`],
  13538. getNamespace: () => 0,
  13539. isVoidTag: NO,
  13540. isPreTag: NO,
  13541. isIgnoreNewlineTag: NO,
  13542. isCustomElement: NO,
  13543. onError: defaultOnError,
  13544. onWarn: defaultOnWarn,
  13545. comments: true,
  13546. prefixIdentifiers: false
  13547. };
  13548. let currentOptions = defaultParserOptions;
  13549. let currentRoot = null;
  13550. let currentInput = "";
  13551. let currentOpenTag = null;
  13552. let currentProp = null;
  13553. let currentAttrValue = "";
  13554. let currentAttrStartIndex = -1;
  13555. let currentAttrEndIndex = -1;
  13556. let inPre = 0;
  13557. let inVPre = false;
  13558. let currentVPreBoundary = null;
  13559. const stack = [];
  13560. const tokenizer = new Tokenizer(stack, {
  13561. onerr: emitError,
  13562. ontext(start, end) {
  13563. onText(getSlice(start, end), start, end);
  13564. },
  13565. ontextentity(char, start, end) {
  13566. onText(char, start, end);
  13567. },
  13568. oninterpolation(start, end) {
  13569. if (inVPre) {
  13570. return onText(getSlice(start, end), start, end);
  13571. }
  13572. let innerStart = start + tokenizer.delimiterOpen.length;
  13573. let innerEnd = end - tokenizer.delimiterClose.length;
  13574. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  13575. innerStart++;
  13576. }
  13577. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  13578. innerEnd--;
  13579. }
  13580. let exp = getSlice(innerStart, innerEnd);
  13581. if (exp.includes("&")) {
  13582. {
  13583. exp = currentOptions.decodeEntities(exp, false);
  13584. }
  13585. }
  13586. addNode({
  13587. type: 5,
  13588. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  13589. loc: getLoc(start, end)
  13590. });
  13591. },
  13592. onopentagname(start, end) {
  13593. const name = getSlice(start, end);
  13594. currentOpenTag = {
  13595. type: 1,
  13596. tag: name,
  13597. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  13598. tagType: 0,
  13599. // will be refined on tag close
  13600. props: [],
  13601. children: [],
  13602. loc: getLoc(start - 1, end),
  13603. codegenNode: void 0
  13604. };
  13605. },
  13606. onopentagend(end) {
  13607. endOpenTag(end);
  13608. },
  13609. onclosetag(start, end) {
  13610. const name = getSlice(start, end);
  13611. if (!currentOptions.isVoidTag(name)) {
  13612. let found = false;
  13613. for (let i = 0; i < stack.length; i++) {
  13614. const e = stack[i];
  13615. if (e.tag.toLowerCase() === name.toLowerCase()) {
  13616. found = true;
  13617. if (i > 0) {
  13618. emitError(24, stack[0].loc.start.offset);
  13619. }
  13620. for (let j = 0; j <= i; j++) {
  13621. const el = stack.shift();
  13622. onCloseTag(el, end, j < i);
  13623. }
  13624. break;
  13625. }
  13626. }
  13627. if (!found) {
  13628. emitError(23, backTrack(start, 60));
  13629. }
  13630. }
  13631. },
  13632. onselfclosingtag(end) {
  13633. const name = currentOpenTag.tag;
  13634. currentOpenTag.isSelfClosing = true;
  13635. endOpenTag(end);
  13636. if (stack[0] && stack[0].tag === name) {
  13637. onCloseTag(stack.shift(), end);
  13638. }
  13639. },
  13640. onattribname(start, end) {
  13641. currentProp = {
  13642. type: 6,
  13643. name: getSlice(start, end),
  13644. nameLoc: getLoc(start, end),
  13645. value: void 0,
  13646. loc: getLoc(start)
  13647. };
  13648. },
  13649. ondirname(start, end) {
  13650. const raw = getSlice(start, end);
  13651. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  13652. if (!inVPre && name === "") {
  13653. emitError(26, start);
  13654. }
  13655. if (inVPre || name === "") {
  13656. currentProp = {
  13657. type: 6,
  13658. name: raw,
  13659. nameLoc: getLoc(start, end),
  13660. value: void 0,
  13661. loc: getLoc(start)
  13662. };
  13663. } else {
  13664. currentProp = {
  13665. type: 7,
  13666. name,
  13667. rawName: raw,
  13668. exp: void 0,
  13669. arg: void 0,
  13670. modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
  13671. loc: getLoc(start)
  13672. };
  13673. if (name === "pre") {
  13674. inVPre = tokenizer.inVPre = true;
  13675. currentVPreBoundary = currentOpenTag;
  13676. const props = currentOpenTag.props;
  13677. for (let i = 0; i < props.length; i++) {
  13678. if (props[i].type === 7) {
  13679. props[i] = dirToAttr(props[i]);
  13680. }
  13681. }
  13682. }
  13683. }
  13684. },
  13685. ondirarg(start, end) {
  13686. if (start === end) return;
  13687. const arg = getSlice(start, end);
  13688. if (inVPre) {
  13689. currentProp.name += arg;
  13690. setLocEnd(currentProp.nameLoc, end);
  13691. } else {
  13692. const isStatic = arg[0] !== `[`;
  13693. currentProp.arg = createExp(
  13694. isStatic ? arg : arg.slice(1, -1),
  13695. isStatic,
  13696. getLoc(start, end),
  13697. isStatic ? 3 : 0
  13698. );
  13699. }
  13700. },
  13701. ondirmodifier(start, end) {
  13702. const mod = getSlice(start, end);
  13703. if (inVPre) {
  13704. currentProp.name += "." + mod;
  13705. setLocEnd(currentProp.nameLoc, end);
  13706. } else if (currentProp.name === "slot") {
  13707. const arg = currentProp.arg;
  13708. if (arg) {
  13709. arg.content += "." + mod;
  13710. setLocEnd(arg.loc, end);
  13711. }
  13712. } else {
  13713. const exp = createSimpleExpression(mod, true, getLoc(start, end));
  13714. currentProp.modifiers.push(exp);
  13715. }
  13716. },
  13717. onattribdata(start, end) {
  13718. currentAttrValue += getSlice(start, end);
  13719. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  13720. currentAttrEndIndex = end;
  13721. },
  13722. onattribentity(char, start, end) {
  13723. currentAttrValue += char;
  13724. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  13725. currentAttrEndIndex = end;
  13726. },
  13727. onattribnameend(end) {
  13728. const start = currentProp.loc.start.offset;
  13729. const name = getSlice(start, end);
  13730. if (currentProp.type === 7) {
  13731. currentProp.rawName = name;
  13732. }
  13733. if (currentOpenTag.props.some(
  13734. (p) => (p.type === 7 ? p.rawName : p.name) === name
  13735. )) {
  13736. emitError(2, start);
  13737. }
  13738. },
  13739. onattribend(quote, end) {
  13740. if (currentOpenTag && currentProp) {
  13741. setLocEnd(currentProp.loc, end);
  13742. if (quote !== 0) {
  13743. if (currentAttrValue.includes("&")) {
  13744. currentAttrValue = currentOptions.decodeEntities(
  13745. currentAttrValue,
  13746. true
  13747. );
  13748. }
  13749. if (currentProp.type === 6) {
  13750. if (currentProp.name === "class") {
  13751. currentAttrValue = condense(currentAttrValue).trim();
  13752. }
  13753. if (quote === 1 && !currentAttrValue) {
  13754. emitError(13, end);
  13755. }
  13756. currentProp.value = {
  13757. type: 2,
  13758. content: currentAttrValue,
  13759. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  13760. };
  13761. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  13762. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  13763. }
  13764. } else {
  13765. let expParseMode = 0 /* Normal */;
  13766. currentProp.exp = createExp(
  13767. currentAttrValue,
  13768. false,
  13769. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  13770. 0,
  13771. expParseMode
  13772. );
  13773. if (currentProp.name === "for") {
  13774. currentProp.forParseResult = parseForExpression(currentProp.exp);
  13775. }
  13776. }
  13777. }
  13778. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  13779. currentOpenTag.props.push(currentProp);
  13780. }
  13781. }
  13782. currentAttrValue = "";
  13783. currentAttrStartIndex = currentAttrEndIndex = -1;
  13784. },
  13785. oncomment(start, end) {
  13786. if (currentOptions.comments) {
  13787. addNode({
  13788. type: 3,
  13789. content: getSlice(start, end),
  13790. loc: getLoc(start - 4, end + 3)
  13791. });
  13792. }
  13793. },
  13794. onend() {
  13795. const end = currentInput.length;
  13796. if (tokenizer.state !== 1) {
  13797. switch (tokenizer.state) {
  13798. case 5:
  13799. case 8:
  13800. emitError(5, end);
  13801. break;
  13802. case 3:
  13803. case 4:
  13804. emitError(
  13805. 25,
  13806. tokenizer.sectionStart
  13807. );
  13808. break;
  13809. case 28:
  13810. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  13811. emitError(6, end);
  13812. } else {
  13813. emitError(7, end);
  13814. }
  13815. break;
  13816. case 6:
  13817. case 7:
  13818. case 9:
  13819. case 11:
  13820. case 12:
  13821. case 13:
  13822. case 14:
  13823. case 15:
  13824. case 16:
  13825. case 17:
  13826. case 18:
  13827. case 19:
  13828. // "
  13829. case 20:
  13830. // '
  13831. case 21:
  13832. emitError(9, end);
  13833. break;
  13834. }
  13835. }
  13836. for (let index = 0; index < stack.length; index++) {
  13837. onCloseTag(stack[index], end - 1);
  13838. emitError(24, stack[index].loc.start.offset);
  13839. }
  13840. },
  13841. oncdata(start, end) {
  13842. if (stack[0].ns !== 0) {
  13843. onText(getSlice(start, end), start, end);
  13844. } else {
  13845. emitError(1, start - 9);
  13846. }
  13847. },
  13848. onprocessinginstruction(start) {
  13849. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  13850. emitError(
  13851. 21,
  13852. start - 1
  13853. );
  13854. }
  13855. }
  13856. });
  13857. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  13858. const stripParensRE = /^\(|\)$/g;
  13859. function parseForExpression(input) {
  13860. const loc = input.loc;
  13861. const exp = input.content;
  13862. const inMatch = exp.match(forAliasRE);
  13863. if (!inMatch) return;
  13864. const [, LHS, RHS] = inMatch;
  13865. const createAliasExpression = (content, offset, asParam = false) => {
  13866. const start = loc.start.offset + offset;
  13867. const end = start + content.length;
  13868. return createExp(
  13869. content,
  13870. false,
  13871. getLoc(start, end),
  13872. 0,
  13873. asParam ? 1 /* Params */ : 0 /* Normal */
  13874. );
  13875. };
  13876. const result = {
  13877. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  13878. value: void 0,
  13879. key: void 0,
  13880. index: void 0,
  13881. finalized: false
  13882. };
  13883. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  13884. const trimmedOffset = LHS.indexOf(valueContent);
  13885. const iteratorMatch = valueContent.match(forIteratorRE);
  13886. if (iteratorMatch) {
  13887. valueContent = valueContent.replace(forIteratorRE, "").trim();
  13888. const keyContent = iteratorMatch[1].trim();
  13889. let keyOffset;
  13890. if (keyContent) {
  13891. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  13892. result.key = createAliasExpression(keyContent, keyOffset, true);
  13893. }
  13894. if (iteratorMatch[2]) {
  13895. const indexContent = iteratorMatch[2].trim();
  13896. if (indexContent) {
  13897. result.index = createAliasExpression(
  13898. indexContent,
  13899. exp.indexOf(
  13900. indexContent,
  13901. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  13902. ),
  13903. true
  13904. );
  13905. }
  13906. }
  13907. }
  13908. if (valueContent) {
  13909. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  13910. }
  13911. return result;
  13912. }
  13913. function getSlice(start, end) {
  13914. return currentInput.slice(start, end);
  13915. }
  13916. function endOpenTag(end) {
  13917. if (tokenizer.inSFCRoot) {
  13918. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  13919. }
  13920. addNode(currentOpenTag);
  13921. const { tag, ns } = currentOpenTag;
  13922. if (ns === 0 && currentOptions.isPreTag(tag)) {
  13923. inPre++;
  13924. }
  13925. if (currentOptions.isVoidTag(tag)) {
  13926. onCloseTag(currentOpenTag, end);
  13927. } else {
  13928. stack.unshift(currentOpenTag);
  13929. if (ns === 1 || ns === 2) {
  13930. tokenizer.inXML = true;
  13931. }
  13932. }
  13933. currentOpenTag = null;
  13934. }
  13935. function onText(content, start, end) {
  13936. {
  13937. const tag = stack[0] && stack[0].tag;
  13938. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  13939. content = currentOptions.decodeEntities(content, false);
  13940. }
  13941. }
  13942. const parent = stack[0] || currentRoot;
  13943. const lastNode = parent.children[parent.children.length - 1];
  13944. if (lastNode && lastNode.type === 2) {
  13945. lastNode.content += content;
  13946. setLocEnd(lastNode.loc, end);
  13947. } else {
  13948. parent.children.push({
  13949. type: 2,
  13950. content,
  13951. loc: getLoc(start, end)
  13952. });
  13953. }
  13954. }
  13955. function onCloseTag(el, end, isImplied = false) {
  13956. if (isImplied) {
  13957. setLocEnd(el.loc, backTrack(end, 60));
  13958. } else {
  13959. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  13960. }
  13961. if (tokenizer.inSFCRoot) {
  13962. if (el.children.length) {
  13963. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  13964. } else {
  13965. el.innerLoc.end = extend({}, el.innerLoc.start);
  13966. }
  13967. el.innerLoc.source = getSlice(
  13968. el.innerLoc.start.offset,
  13969. el.innerLoc.end.offset
  13970. );
  13971. }
  13972. const { tag, ns, children } = el;
  13973. if (!inVPre) {
  13974. if (tag === "slot") {
  13975. el.tagType = 2;
  13976. } else if (isFragmentTemplate(el)) {
  13977. el.tagType = 3;
  13978. } else if (isComponent(el)) {
  13979. el.tagType = 1;
  13980. }
  13981. }
  13982. if (!tokenizer.inRCDATA) {
  13983. el.children = condenseWhitespace(children);
  13984. }
  13985. if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
  13986. const first = children[0];
  13987. if (first && first.type === 2) {
  13988. first.content = first.content.replace(/^\r?\n/, "");
  13989. }
  13990. }
  13991. if (ns === 0 && currentOptions.isPreTag(tag)) {
  13992. inPre--;
  13993. }
  13994. if (currentVPreBoundary === el) {
  13995. inVPre = tokenizer.inVPre = false;
  13996. currentVPreBoundary = null;
  13997. }
  13998. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  13999. tokenizer.inXML = false;
  14000. }
  14001. }
  14002. function lookAhead(index, c) {
  14003. let i = index;
  14004. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
  14005. return i;
  14006. }
  14007. function backTrack(index, c) {
  14008. let i = index;
  14009. while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
  14010. return i;
  14011. }
  14012. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  14013. function isFragmentTemplate({ tag, props }) {
  14014. if (tag === "template") {
  14015. for (let i = 0; i < props.length; i++) {
  14016. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  14017. return true;
  14018. }
  14019. }
  14020. }
  14021. return false;
  14022. }
  14023. function isComponent({ tag, props }) {
  14024. if (currentOptions.isCustomElement(tag)) {
  14025. return false;
  14026. }
  14027. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  14028. return true;
  14029. }
  14030. for (let i = 0; i < props.length; i++) {
  14031. const p = props[i];
  14032. if (p.type === 6) {
  14033. if (p.name === "is" && p.value) {
  14034. if (p.value.content.startsWith("vue:")) {
  14035. return true;
  14036. }
  14037. }
  14038. }
  14039. }
  14040. return false;
  14041. }
  14042. function isUpperCase(c) {
  14043. return c > 64 && c < 91;
  14044. }
  14045. const windowsNewlineRE = /\r\n/g;
  14046. function condenseWhitespace(nodes, tag) {
  14047. const shouldCondense = currentOptions.whitespace !== "preserve";
  14048. let removedWhitespace = false;
  14049. for (let i = 0; i < nodes.length; i++) {
  14050. const node = nodes[i];
  14051. if (node.type === 2) {
  14052. if (!inPre) {
  14053. if (isAllWhitespace(node.content)) {
  14054. const prev = nodes[i - 1] && nodes[i - 1].type;
  14055. const next = nodes[i + 1] && nodes[i + 1].type;
  14056. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  14057. removedWhitespace = true;
  14058. nodes[i] = null;
  14059. } else {
  14060. node.content = " ";
  14061. }
  14062. } else if (shouldCondense) {
  14063. node.content = condense(node.content);
  14064. }
  14065. } else {
  14066. node.content = node.content.replace(windowsNewlineRE, "\n");
  14067. }
  14068. }
  14069. }
  14070. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  14071. }
  14072. function isAllWhitespace(str) {
  14073. for (let i = 0; i < str.length; i++) {
  14074. if (!isWhitespace(str.charCodeAt(i))) {
  14075. return false;
  14076. }
  14077. }
  14078. return true;
  14079. }
  14080. function hasNewlineChar(str) {
  14081. for (let i = 0; i < str.length; i++) {
  14082. const c = str.charCodeAt(i);
  14083. if (c === 10 || c === 13) {
  14084. return true;
  14085. }
  14086. }
  14087. return false;
  14088. }
  14089. function condense(str) {
  14090. let ret = "";
  14091. let prevCharIsWhitespace = false;
  14092. for (let i = 0; i < str.length; i++) {
  14093. if (isWhitespace(str.charCodeAt(i))) {
  14094. if (!prevCharIsWhitespace) {
  14095. ret += " ";
  14096. prevCharIsWhitespace = true;
  14097. }
  14098. } else {
  14099. ret += str[i];
  14100. prevCharIsWhitespace = false;
  14101. }
  14102. }
  14103. return ret;
  14104. }
  14105. function addNode(node) {
  14106. (stack[0] || currentRoot).children.push(node);
  14107. }
  14108. function getLoc(start, end) {
  14109. return {
  14110. start: tokenizer.getPos(start),
  14111. // @ts-expect-error allow late attachment
  14112. end: end == null ? end : tokenizer.getPos(end),
  14113. // @ts-expect-error allow late attachment
  14114. source: end == null ? end : getSlice(start, end)
  14115. };
  14116. }
  14117. function cloneLoc(loc) {
  14118. return getLoc(loc.start.offset, loc.end.offset);
  14119. }
  14120. function setLocEnd(loc, end) {
  14121. loc.end = tokenizer.getPos(end);
  14122. loc.source = getSlice(loc.start.offset, end);
  14123. }
  14124. function dirToAttr(dir) {
  14125. const attr = {
  14126. type: 6,
  14127. name: dir.rawName,
  14128. nameLoc: getLoc(
  14129. dir.loc.start.offset,
  14130. dir.loc.start.offset + dir.rawName.length
  14131. ),
  14132. value: void 0,
  14133. loc: dir.loc
  14134. };
  14135. if (dir.exp) {
  14136. const loc = dir.exp.loc;
  14137. if (loc.end.offset < dir.loc.end.offset) {
  14138. loc.start.offset--;
  14139. loc.start.column--;
  14140. loc.end.offset++;
  14141. loc.end.column++;
  14142. }
  14143. attr.value = {
  14144. type: 2,
  14145. content: dir.exp.content,
  14146. loc
  14147. };
  14148. }
  14149. return attr;
  14150. }
  14151. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  14152. const exp = createSimpleExpression(content, isStatic, loc, constType);
  14153. return exp;
  14154. }
  14155. function emitError(code, index, message) {
  14156. currentOptions.onError(
  14157. createCompilerError(code, getLoc(index, index), void 0, message)
  14158. );
  14159. }
  14160. function reset() {
  14161. tokenizer.reset();
  14162. currentOpenTag = null;
  14163. currentProp = null;
  14164. currentAttrValue = "";
  14165. currentAttrStartIndex = -1;
  14166. currentAttrEndIndex = -1;
  14167. stack.length = 0;
  14168. }
  14169. function baseParse(input, options) {
  14170. reset();
  14171. currentInput = input;
  14172. currentOptions = extend({}, defaultParserOptions);
  14173. if (options) {
  14174. let key;
  14175. for (key in options) {
  14176. if (options[key] != null) {
  14177. currentOptions[key] = options[key];
  14178. }
  14179. }
  14180. }
  14181. {
  14182. if (!currentOptions.decodeEntities) {
  14183. throw new Error(
  14184. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  14185. );
  14186. }
  14187. }
  14188. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  14189. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  14190. const delimiters = options && options.delimiters;
  14191. if (delimiters) {
  14192. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  14193. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  14194. }
  14195. const root = currentRoot = createRoot([], input);
  14196. tokenizer.parse(currentInput);
  14197. root.loc = getLoc(0, input.length);
  14198. root.children = condenseWhitespace(root.children);
  14199. currentRoot = null;
  14200. return root;
  14201. }
  14202. function cacheStatic(root, context) {
  14203. walk(
  14204. root,
  14205. void 0,
  14206. context,
  14207. // Root node is unfortunately non-hoistable due to potential parent
  14208. // fallthrough attributes.
  14209. isSingleElementRoot(root, root.children[0])
  14210. );
  14211. }
  14212. function isSingleElementRoot(root, child) {
  14213. const { children } = root;
  14214. return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
  14215. }
  14216. function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
  14217. const { children } = node;
  14218. const toCache = [];
  14219. for (let i = 0; i < children.length; i++) {
  14220. const child = children[i];
  14221. if (child.type === 1 && child.tagType === 0) {
  14222. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  14223. if (constantType > 0) {
  14224. if (constantType >= 2) {
  14225. child.codegenNode.patchFlag = -1;
  14226. toCache.push(child);
  14227. continue;
  14228. }
  14229. } else {
  14230. const codegenNode = child.codegenNode;
  14231. if (codegenNode.type === 13) {
  14232. const flag = codegenNode.patchFlag;
  14233. if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  14234. const props = getNodeProps(child);
  14235. if (props) {
  14236. codegenNode.props = context.hoist(props);
  14237. }
  14238. }
  14239. if (codegenNode.dynamicProps) {
  14240. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  14241. }
  14242. }
  14243. }
  14244. } else if (child.type === 12) {
  14245. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  14246. if (constantType >= 2) {
  14247. toCache.push(child);
  14248. continue;
  14249. }
  14250. }
  14251. if (child.type === 1) {
  14252. const isComponent = child.tagType === 1;
  14253. if (isComponent) {
  14254. context.scopes.vSlot++;
  14255. }
  14256. walk(child, node, context, false, inFor);
  14257. if (isComponent) {
  14258. context.scopes.vSlot--;
  14259. }
  14260. } else if (child.type === 11) {
  14261. walk(child, node, context, child.children.length === 1, true);
  14262. } else if (child.type === 9) {
  14263. for (let i2 = 0; i2 < child.branches.length; i2++) {
  14264. walk(
  14265. child.branches[i2],
  14266. node,
  14267. context,
  14268. child.branches[i2].children.length === 1,
  14269. inFor
  14270. );
  14271. }
  14272. }
  14273. }
  14274. let cachedAsArray = false;
  14275. if (toCache.length === children.length && node.type === 1) {
  14276. if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  14277. node.codegenNode.children = getCacheExpression(
  14278. createArrayExpression(node.codegenNode.children)
  14279. );
  14280. cachedAsArray = true;
  14281. } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
  14282. const slot = getSlotNode(node.codegenNode, "default");
  14283. if (slot) {
  14284. slot.returns = getCacheExpression(
  14285. createArrayExpression(slot.returns)
  14286. );
  14287. cachedAsArray = true;
  14288. }
  14289. } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) {
  14290. const slotName = findDir(node, "slot", true);
  14291. const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
  14292. if (slot) {
  14293. slot.returns = getCacheExpression(
  14294. createArrayExpression(slot.returns)
  14295. );
  14296. cachedAsArray = true;
  14297. }
  14298. }
  14299. }
  14300. if (!cachedAsArray) {
  14301. for (const child of toCache) {
  14302. child.codegenNode = context.cache(child.codegenNode);
  14303. }
  14304. }
  14305. function getCacheExpression(value) {
  14306. const exp = context.cache(value);
  14307. if (inFor && context.hmr) {
  14308. exp.needArraySpread = true;
  14309. }
  14310. return exp;
  14311. }
  14312. function getSlotNode(node2, name) {
  14313. if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
  14314. const slot = node2.children.properties.find(
  14315. (p) => p.key === name || p.key.content === name
  14316. );
  14317. return slot && slot.value;
  14318. }
  14319. }
  14320. if (toCache.length && context.transformHoist) {
  14321. context.transformHoist(children, context, node);
  14322. }
  14323. }
  14324. function getConstantType(node, context) {
  14325. const { constantCache } = context;
  14326. switch (node.type) {
  14327. case 1:
  14328. if (node.tagType !== 0) {
  14329. return 0;
  14330. }
  14331. const cached = constantCache.get(node);
  14332. if (cached !== void 0) {
  14333. return cached;
  14334. }
  14335. const codegenNode = node.codegenNode;
  14336. if (codegenNode.type !== 13) {
  14337. return 0;
  14338. }
  14339. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
  14340. return 0;
  14341. }
  14342. if (codegenNode.patchFlag === void 0) {
  14343. let returnType2 = 3;
  14344. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  14345. if (generatedPropsType === 0) {
  14346. constantCache.set(node, 0);
  14347. return 0;
  14348. }
  14349. if (generatedPropsType < returnType2) {
  14350. returnType2 = generatedPropsType;
  14351. }
  14352. for (let i = 0; i < node.children.length; i++) {
  14353. const childType = getConstantType(node.children[i], context);
  14354. if (childType === 0) {
  14355. constantCache.set(node, 0);
  14356. return 0;
  14357. }
  14358. if (childType < returnType2) {
  14359. returnType2 = childType;
  14360. }
  14361. }
  14362. if (returnType2 > 1) {
  14363. for (let i = 0; i < node.props.length; i++) {
  14364. const p = node.props[i];
  14365. if (p.type === 7 && p.name === "bind" && p.exp) {
  14366. const expType = getConstantType(p.exp, context);
  14367. if (expType === 0) {
  14368. constantCache.set(node, 0);
  14369. return 0;
  14370. }
  14371. if (expType < returnType2) {
  14372. returnType2 = expType;
  14373. }
  14374. }
  14375. }
  14376. }
  14377. if (codegenNode.isBlock) {
  14378. for (let i = 0; i < node.props.length; i++) {
  14379. const p = node.props[i];
  14380. if (p.type === 7) {
  14381. constantCache.set(node, 0);
  14382. return 0;
  14383. }
  14384. }
  14385. context.removeHelper(OPEN_BLOCK);
  14386. context.removeHelper(
  14387. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  14388. );
  14389. codegenNode.isBlock = false;
  14390. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  14391. }
  14392. constantCache.set(node, returnType2);
  14393. return returnType2;
  14394. } else {
  14395. constantCache.set(node, 0);
  14396. return 0;
  14397. }
  14398. case 2:
  14399. case 3:
  14400. return 3;
  14401. case 9:
  14402. case 11:
  14403. case 10:
  14404. return 0;
  14405. case 5:
  14406. case 12:
  14407. return getConstantType(node.content, context);
  14408. case 4:
  14409. return node.constType;
  14410. case 8:
  14411. let returnType = 3;
  14412. for (let i = 0; i < node.children.length; i++) {
  14413. const child = node.children[i];
  14414. if (isString(child) || isSymbol(child)) {
  14415. continue;
  14416. }
  14417. const childType = getConstantType(child, context);
  14418. if (childType === 0) {
  14419. return 0;
  14420. } else if (childType < returnType) {
  14421. returnType = childType;
  14422. }
  14423. }
  14424. return returnType;
  14425. case 20:
  14426. return 2;
  14427. default:
  14428. return 0;
  14429. }
  14430. }
  14431. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  14432. NORMALIZE_CLASS,
  14433. NORMALIZE_STYLE,
  14434. NORMALIZE_PROPS,
  14435. GUARD_REACTIVE_PROPS
  14436. ]);
  14437. function getConstantTypeOfHelperCall(value, context) {
  14438. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  14439. const arg = value.arguments[0];
  14440. if (arg.type === 4) {
  14441. return getConstantType(arg, context);
  14442. } else if (arg.type === 14) {
  14443. return getConstantTypeOfHelperCall(arg, context);
  14444. }
  14445. }
  14446. return 0;
  14447. }
  14448. function getGeneratedPropsConstantType(node, context) {
  14449. let returnType = 3;
  14450. const props = getNodeProps(node);
  14451. if (props && props.type === 15) {
  14452. const { properties } = props;
  14453. for (let i = 0; i < properties.length; i++) {
  14454. const { key, value } = properties[i];
  14455. const keyType = getConstantType(key, context);
  14456. if (keyType === 0) {
  14457. return keyType;
  14458. }
  14459. if (keyType < returnType) {
  14460. returnType = keyType;
  14461. }
  14462. let valueType;
  14463. if (value.type === 4) {
  14464. valueType = getConstantType(value, context);
  14465. } else if (value.type === 14) {
  14466. valueType = getConstantTypeOfHelperCall(value, context);
  14467. } else {
  14468. valueType = 0;
  14469. }
  14470. if (valueType === 0) {
  14471. return valueType;
  14472. }
  14473. if (valueType < returnType) {
  14474. returnType = valueType;
  14475. }
  14476. }
  14477. }
  14478. return returnType;
  14479. }
  14480. function getNodeProps(node) {
  14481. const codegenNode = node.codegenNode;
  14482. if (codegenNode.type === 13) {
  14483. return codegenNode.props;
  14484. }
  14485. }
  14486. function createTransformContext(root, {
  14487. filename = "",
  14488. prefixIdentifiers = false,
  14489. hoistStatic = false,
  14490. hmr = false,
  14491. cacheHandlers = false,
  14492. nodeTransforms = [],
  14493. directiveTransforms = {},
  14494. transformHoist = null,
  14495. isBuiltInComponent = NOOP,
  14496. isCustomElement = NOOP,
  14497. expressionPlugins = [],
  14498. scopeId = null,
  14499. slotted = true,
  14500. ssr = false,
  14501. inSSR = false,
  14502. ssrCssVars = ``,
  14503. bindingMetadata = EMPTY_OBJ,
  14504. inline = false,
  14505. isTS = false,
  14506. onError = defaultOnError,
  14507. onWarn = defaultOnWarn,
  14508. compatConfig
  14509. }) {
  14510. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  14511. const context = {
  14512. // options
  14513. filename,
  14514. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  14515. prefixIdentifiers,
  14516. hoistStatic,
  14517. hmr,
  14518. cacheHandlers,
  14519. nodeTransforms,
  14520. directiveTransforms,
  14521. transformHoist,
  14522. isBuiltInComponent,
  14523. isCustomElement,
  14524. expressionPlugins,
  14525. scopeId,
  14526. slotted,
  14527. ssr,
  14528. inSSR,
  14529. ssrCssVars,
  14530. bindingMetadata,
  14531. inline,
  14532. isTS,
  14533. onError,
  14534. onWarn,
  14535. compatConfig,
  14536. // state
  14537. root,
  14538. helpers: /* @__PURE__ */ new Map(),
  14539. components: /* @__PURE__ */ new Set(),
  14540. directives: /* @__PURE__ */ new Set(),
  14541. hoists: [],
  14542. imports: [],
  14543. cached: [],
  14544. constantCache: /* @__PURE__ */ new WeakMap(),
  14545. temps: 0,
  14546. identifiers: /* @__PURE__ */ Object.create(null),
  14547. scopes: {
  14548. vFor: 0,
  14549. vSlot: 0,
  14550. vPre: 0,
  14551. vOnce: 0
  14552. },
  14553. parent: null,
  14554. grandParent: null,
  14555. currentNode: root,
  14556. childIndex: 0,
  14557. inVOnce: false,
  14558. // methods
  14559. helper(name) {
  14560. const count = context.helpers.get(name) || 0;
  14561. context.helpers.set(name, count + 1);
  14562. return name;
  14563. },
  14564. removeHelper(name) {
  14565. const count = context.helpers.get(name);
  14566. if (count) {
  14567. const currentCount = count - 1;
  14568. if (!currentCount) {
  14569. context.helpers.delete(name);
  14570. } else {
  14571. context.helpers.set(name, currentCount);
  14572. }
  14573. }
  14574. },
  14575. helperString(name) {
  14576. return `_${helperNameMap[context.helper(name)]}`;
  14577. },
  14578. replaceNode(node) {
  14579. {
  14580. if (!context.currentNode) {
  14581. throw new Error(`Node being replaced is already removed.`);
  14582. }
  14583. if (!context.parent) {
  14584. throw new Error(`Cannot replace root node.`);
  14585. }
  14586. }
  14587. context.parent.children[context.childIndex] = context.currentNode = node;
  14588. },
  14589. removeNode(node) {
  14590. if (!context.parent) {
  14591. throw new Error(`Cannot remove root node.`);
  14592. }
  14593. const list = context.parent.children;
  14594. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  14595. if (removalIndex < 0) {
  14596. throw new Error(`node being removed is not a child of current parent`);
  14597. }
  14598. if (!node || node === context.currentNode) {
  14599. context.currentNode = null;
  14600. context.onNodeRemoved();
  14601. } else {
  14602. if (context.childIndex > removalIndex) {
  14603. context.childIndex--;
  14604. context.onNodeRemoved();
  14605. }
  14606. }
  14607. context.parent.children.splice(removalIndex, 1);
  14608. },
  14609. onNodeRemoved: NOOP,
  14610. addIdentifiers(exp) {
  14611. },
  14612. removeIdentifiers(exp) {
  14613. },
  14614. hoist(exp) {
  14615. if (isString(exp)) exp = createSimpleExpression(exp);
  14616. context.hoists.push(exp);
  14617. const identifier = createSimpleExpression(
  14618. `_hoisted_${context.hoists.length}`,
  14619. false,
  14620. exp.loc,
  14621. 2
  14622. );
  14623. identifier.hoisted = exp;
  14624. return identifier;
  14625. },
  14626. cache(exp, isVNode = false) {
  14627. const cacheExp = createCacheExpression(
  14628. context.cached.length,
  14629. exp,
  14630. isVNode
  14631. );
  14632. context.cached.push(cacheExp);
  14633. return cacheExp;
  14634. }
  14635. };
  14636. return context;
  14637. }
  14638. function transform(root, options) {
  14639. const context = createTransformContext(root, options);
  14640. traverseNode(root, context);
  14641. if (options.hoistStatic) {
  14642. cacheStatic(root, context);
  14643. }
  14644. if (!options.ssr) {
  14645. createRootCodegen(root, context);
  14646. }
  14647. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  14648. root.components = [...context.components];
  14649. root.directives = [...context.directives];
  14650. root.imports = context.imports;
  14651. root.hoists = context.hoists;
  14652. root.temps = context.temps;
  14653. root.cached = context.cached;
  14654. root.transformed = true;
  14655. }
  14656. function createRootCodegen(root, context) {
  14657. const { helper } = context;
  14658. const { children } = root;
  14659. if (children.length === 1) {
  14660. const child = children[0];
  14661. if (isSingleElementRoot(root, child) && child.codegenNode) {
  14662. const codegenNode = child.codegenNode;
  14663. if (codegenNode.type === 13) {
  14664. convertToBlock(codegenNode, context);
  14665. }
  14666. root.codegenNode = codegenNode;
  14667. } else {
  14668. root.codegenNode = child;
  14669. }
  14670. } else if (children.length > 1) {
  14671. let patchFlag = 64;
  14672. if (children.filter((c) => c.type !== 3).length === 1) {
  14673. patchFlag |= 2048;
  14674. }
  14675. root.codegenNode = createVNodeCall(
  14676. context,
  14677. helper(FRAGMENT),
  14678. void 0,
  14679. root.children,
  14680. patchFlag,
  14681. void 0,
  14682. void 0,
  14683. true,
  14684. void 0,
  14685. false
  14686. );
  14687. } else ;
  14688. }
  14689. function traverseChildren(parent, context) {
  14690. let i = 0;
  14691. const nodeRemoved = () => {
  14692. i--;
  14693. };
  14694. for (; i < parent.children.length; i++) {
  14695. const child = parent.children[i];
  14696. if (isString(child)) continue;
  14697. context.grandParent = context.parent;
  14698. context.parent = parent;
  14699. context.childIndex = i;
  14700. context.onNodeRemoved = nodeRemoved;
  14701. traverseNode(child, context);
  14702. }
  14703. }
  14704. function traverseNode(node, context) {
  14705. context.currentNode = node;
  14706. const { nodeTransforms } = context;
  14707. const exitFns = [];
  14708. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  14709. const onExit = nodeTransforms[i2](node, context);
  14710. if (onExit) {
  14711. if (isArray(onExit)) {
  14712. exitFns.push(...onExit);
  14713. } else {
  14714. exitFns.push(onExit);
  14715. }
  14716. }
  14717. if (!context.currentNode) {
  14718. return;
  14719. } else {
  14720. node = context.currentNode;
  14721. }
  14722. }
  14723. switch (node.type) {
  14724. case 3:
  14725. if (!context.ssr) {
  14726. context.helper(CREATE_COMMENT);
  14727. }
  14728. break;
  14729. case 5:
  14730. if (!context.ssr) {
  14731. context.helper(TO_DISPLAY_STRING);
  14732. }
  14733. break;
  14734. // for container types, further traverse downwards
  14735. case 9:
  14736. for (let i2 = 0; i2 < node.branches.length; i2++) {
  14737. traverseNode(node.branches[i2], context);
  14738. }
  14739. break;
  14740. case 10:
  14741. case 11:
  14742. case 1:
  14743. case 0:
  14744. traverseChildren(node, context);
  14745. break;
  14746. }
  14747. context.currentNode = node;
  14748. let i = exitFns.length;
  14749. while (i--) {
  14750. exitFns[i]();
  14751. }
  14752. }
  14753. function createStructuralDirectiveTransform(name, fn) {
  14754. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  14755. return (node, context) => {
  14756. if (node.type === 1) {
  14757. const { props } = node;
  14758. if (node.tagType === 3 && props.some(isVSlot)) {
  14759. return;
  14760. }
  14761. const exitFns = [];
  14762. for (let i = 0; i < props.length; i++) {
  14763. const prop = props[i];
  14764. if (prop.type === 7 && matches(prop.name)) {
  14765. props.splice(i, 1);
  14766. i--;
  14767. const onExit = fn(node, prop, context);
  14768. if (onExit) exitFns.push(onExit);
  14769. }
  14770. }
  14771. return exitFns;
  14772. }
  14773. };
  14774. }
  14775. const PURE_ANNOTATION = `/*@__PURE__*/`;
  14776. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  14777. function createCodegenContext(ast, {
  14778. mode = "function",
  14779. prefixIdentifiers = mode === "module",
  14780. sourceMap = false,
  14781. filename = `template.vue.html`,
  14782. scopeId = null,
  14783. optimizeImports = false,
  14784. runtimeGlobalName = `Vue`,
  14785. runtimeModuleName = `vue`,
  14786. ssrRuntimeModuleName = "vue/server-renderer",
  14787. ssr = false,
  14788. isTS = false,
  14789. inSSR = false
  14790. }) {
  14791. const context = {
  14792. mode,
  14793. prefixIdentifiers,
  14794. sourceMap,
  14795. filename,
  14796. scopeId,
  14797. optimizeImports,
  14798. runtimeGlobalName,
  14799. runtimeModuleName,
  14800. ssrRuntimeModuleName,
  14801. ssr,
  14802. isTS,
  14803. inSSR,
  14804. source: ast.source,
  14805. code: ``,
  14806. column: 1,
  14807. line: 1,
  14808. offset: 0,
  14809. indentLevel: 0,
  14810. pure: false,
  14811. map: void 0,
  14812. helper(key) {
  14813. return `_${helperNameMap[key]}`;
  14814. },
  14815. push(code, newlineIndex = -2 /* None */, node) {
  14816. context.code += code;
  14817. },
  14818. indent() {
  14819. newline(++context.indentLevel);
  14820. },
  14821. deindent(withoutNewLine = false) {
  14822. if (withoutNewLine) {
  14823. --context.indentLevel;
  14824. } else {
  14825. newline(--context.indentLevel);
  14826. }
  14827. },
  14828. newline() {
  14829. newline(context.indentLevel);
  14830. }
  14831. };
  14832. function newline(n) {
  14833. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  14834. }
  14835. return context;
  14836. }
  14837. function generate(ast, options = {}) {
  14838. const context = createCodegenContext(ast, options);
  14839. if (options.onContextCreated) options.onContextCreated(context);
  14840. const {
  14841. mode,
  14842. push,
  14843. prefixIdentifiers,
  14844. indent,
  14845. deindent,
  14846. newline,
  14847. scopeId,
  14848. ssr
  14849. } = context;
  14850. const helpers = Array.from(ast.helpers);
  14851. const hasHelpers = helpers.length > 0;
  14852. const useWithBlock = !prefixIdentifiers && mode !== "module";
  14853. const preambleContext = context;
  14854. {
  14855. genFunctionPreamble(ast, preambleContext);
  14856. }
  14857. const functionName = ssr ? `ssrRender` : `render`;
  14858. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  14859. const signature = args.join(", ");
  14860. {
  14861. push(`function ${functionName}(${signature}) {`);
  14862. }
  14863. indent();
  14864. if (useWithBlock) {
  14865. push(`with (_ctx) {`);
  14866. indent();
  14867. if (hasHelpers) {
  14868. push(
  14869. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  14870. `,
  14871. -1 /* End */
  14872. );
  14873. newline();
  14874. }
  14875. }
  14876. if (ast.components.length) {
  14877. genAssets(ast.components, "component", context);
  14878. if (ast.directives.length || ast.temps > 0) {
  14879. newline();
  14880. }
  14881. }
  14882. if (ast.directives.length) {
  14883. genAssets(ast.directives, "directive", context);
  14884. if (ast.temps > 0) {
  14885. newline();
  14886. }
  14887. }
  14888. if (ast.temps > 0) {
  14889. push(`let `);
  14890. for (let i = 0; i < ast.temps; i++) {
  14891. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  14892. }
  14893. }
  14894. if (ast.components.length || ast.directives.length || ast.temps) {
  14895. push(`
  14896. `, 0 /* Start */);
  14897. newline();
  14898. }
  14899. if (!ssr) {
  14900. push(`return `);
  14901. }
  14902. if (ast.codegenNode) {
  14903. genNode(ast.codegenNode, context);
  14904. } else {
  14905. push(`null`);
  14906. }
  14907. if (useWithBlock) {
  14908. deindent();
  14909. push(`}`);
  14910. }
  14911. deindent();
  14912. push(`}`);
  14913. return {
  14914. ast,
  14915. code: context.code,
  14916. preamble: ``,
  14917. map: context.map ? context.map.toJSON() : void 0
  14918. };
  14919. }
  14920. function genFunctionPreamble(ast, context) {
  14921. const {
  14922. ssr,
  14923. prefixIdentifiers,
  14924. push,
  14925. newline,
  14926. runtimeModuleName,
  14927. runtimeGlobalName,
  14928. ssrRuntimeModuleName
  14929. } = context;
  14930. const VueBinding = runtimeGlobalName;
  14931. const helpers = Array.from(ast.helpers);
  14932. if (helpers.length > 0) {
  14933. {
  14934. push(`const _Vue = ${VueBinding}
  14935. `, -1 /* End */);
  14936. if (ast.hoists.length) {
  14937. const staticHelpers = [
  14938. CREATE_VNODE,
  14939. CREATE_ELEMENT_VNODE,
  14940. CREATE_COMMENT,
  14941. CREATE_TEXT,
  14942. CREATE_STATIC
  14943. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  14944. push(`const { ${staticHelpers} } = _Vue
  14945. `, -1 /* End */);
  14946. }
  14947. }
  14948. }
  14949. genHoists(ast.hoists, context);
  14950. newline();
  14951. push(`return `);
  14952. }
  14953. function genAssets(assets, type, { helper, push, newline, isTS }) {
  14954. const resolver = helper(
  14955. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  14956. );
  14957. for (let i = 0; i < assets.length; i++) {
  14958. let id = assets[i];
  14959. const maybeSelfReference = id.endsWith("__self");
  14960. if (maybeSelfReference) {
  14961. id = id.slice(0, -6);
  14962. }
  14963. push(
  14964. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  14965. );
  14966. if (i < assets.length - 1) {
  14967. newline();
  14968. }
  14969. }
  14970. }
  14971. function genHoists(hoists, context) {
  14972. if (!hoists.length) {
  14973. return;
  14974. }
  14975. context.pure = true;
  14976. const { push, newline } = context;
  14977. newline();
  14978. for (let i = 0; i < hoists.length; i++) {
  14979. const exp = hoists[i];
  14980. if (exp) {
  14981. push(`const _hoisted_${i + 1} = `);
  14982. genNode(exp, context);
  14983. newline();
  14984. }
  14985. }
  14986. context.pure = false;
  14987. }
  14988. function isText(n) {
  14989. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  14990. }
  14991. function genNodeListAsArray(nodes, context) {
  14992. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  14993. context.push(`[`);
  14994. multilines && context.indent();
  14995. genNodeList(nodes, context, multilines);
  14996. multilines && context.deindent();
  14997. context.push(`]`);
  14998. }
  14999. function genNodeList(nodes, context, multilines = false, comma = true) {
  15000. const { push, newline } = context;
  15001. for (let i = 0; i < nodes.length; i++) {
  15002. const node = nodes[i];
  15003. if (isString(node)) {
  15004. push(node, -3 /* Unknown */);
  15005. } else if (isArray(node)) {
  15006. genNodeListAsArray(node, context);
  15007. } else {
  15008. genNode(node, context);
  15009. }
  15010. if (i < nodes.length - 1) {
  15011. if (multilines) {
  15012. comma && push(",");
  15013. newline();
  15014. } else {
  15015. comma && push(", ");
  15016. }
  15017. }
  15018. }
  15019. }
  15020. function genNode(node, context) {
  15021. if (isString(node)) {
  15022. context.push(node, -3 /* Unknown */);
  15023. return;
  15024. }
  15025. if (isSymbol(node)) {
  15026. context.push(context.helper(node));
  15027. return;
  15028. }
  15029. switch (node.type) {
  15030. case 1:
  15031. case 9:
  15032. case 11:
  15033. assert(
  15034. node.codegenNode != null,
  15035. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  15036. );
  15037. genNode(node.codegenNode, context);
  15038. break;
  15039. case 2:
  15040. genText(node, context);
  15041. break;
  15042. case 4:
  15043. genExpression(node, context);
  15044. break;
  15045. case 5:
  15046. genInterpolation(node, context);
  15047. break;
  15048. case 12:
  15049. genNode(node.codegenNode, context);
  15050. break;
  15051. case 8:
  15052. genCompoundExpression(node, context);
  15053. break;
  15054. case 3:
  15055. genComment(node, context);
  15056. break;
  15057. case 13:
  15058. genVNodeCall(node, context);
  15059. break;
  15060. case 14:
  15061. genCallExpression(node, context);
  15062. break;
  15063. case 15:
  15064. genObjectExpression(node, context);
  15065. break;
  15066. case 17:
  15067. genArrayExpression(node, context);
  15068. break;
  15069. case 18:
  15070. genFunctionExpression(node, context);
  15071. break;
  15072. case 19:
  15073. genConditionalExpression(node, context);
  15074. break;
  15075. case 20:
  15076. genCacheExpression(node, context);
  15077. break;
  15078. case 21:
  15079. genNodeList(node.body, context, true, false);
  15080. break;
  15081. // SSR only types
  15082. case 22:
  15083. break;
  15084. case 23:
  15085. break;
  15086. case 24:
  15087. break;
  15088. case 25:
  15089. break;
  15090. case 26:
  15091. break;
  15092. /* v8 ignore start */
  15093. case 10:
  15094. break;
  15095. default:
  15096. {
  15097. assert(false, `unhandled codegen node type: ${node.type}`);
  15098. const exhaustiveCheck = node;
  15099. return exhaustiveCheck;
  15100. }
  15101. }
  15102. }
  15103. function genText(node, context) {
  15104. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  15105. }
  15106. function genExpression(node, context) {
  15107. const { content, isStatic } = node;
  15108. context.push(
  15109. isStatic ? JSON.stringify(content) : content,
  15110. -3 /* Unknown */,
  15111. node
  15112. );
  15113. }
  15114. function genInterpolation(node, context) {
  15115. const { push, helper, pure } = context;
  15116. if (pure) push(PURE_ANNOTATION);
  15117. push(`${helper(TO_DISPLAY_STRING)}(`);
  15118. genNode(node.content, context);
  15119. push(`)`);
  15120. }
  15121. function genCompoundExpression(node, context) {
  15122. for (let i = 0; i < node.children.length; i++) {
  15123. const child = node.children[i];
  15124. if (isString(child)) {
  15125. context.push(child, -3 /* Unknown */);
  15126. } else {
  15127. genNode(child, context);
  15128. }
  15129. }
  15130. }
  15131. function genExpressionAsPropertyKey(node, context) {
  15132. const { push } = context;
  15133. if (node.type === 8) {
  15134. push(`[`);
  15135. genCompoundExpression(node, context);
  15136. push(`]`);
  15137. } else if (node.isStatic) {
  15138. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  15139. push(text, -2 /* None */, node);
  15140. } else {
  15141. push(`[${node.content}]`, -3 /* Unknown */, node);
  15142. }
  15143. }
  15144. function genComment(node, context) {
  15145. const { push, helper, pure } = context;
  15146. if (pure) {
  15147. push(PURE_ANNOTATION);
  15148. }
  15149. push(
  15150. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  15151. -3 /* Unknown */,
  15152. node
  15153. );
  15154. }
  15155. function genVNodeCall(node, context) {
  15156. const { push, helper, pure } = context;
  15157. const {
  15158. tag,
  15159. props,
  15160. children,
  15161. patchFlag,
  15162. dynamicProps,
  15163. directives,
  15164. isBlock,
  15165. disableTracking,
  15166. isComponent
  15167. } = node;
  15168. let patchFlagString;
  15169. if (patchFlag) {
  15170. {
  15171. if (patchFlag < 0) {
  15172. patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  15173. } else {
  15174. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  15175. patchFlagString = patchFlag + ` /* ${flagNames} */`;
  15176. }
  15177. }
  15178. }
  15179. if (directives) {
  15180. push(helper(WITH_DIRECTIVES) + `(`);
  15181. }
  15182. if (isBlock) {
  15183. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  15184. }
  15185. if (pure) {
  15186. push(PURE_ANNOTATION);
  15187. }
  15188. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  15189. push(helper(callHelper) + `(`, -2 /* None */, node);
  15190. genNodeList(
  15191. genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
  15192. context
  15193. );
  15194. push(`)`);
  15195. if (isBlock) {
  15196. push(`)`);
  15197. }
  15198. if (directives) {
  15199. push(`, `);
  15200. genNode(directives, context);
  15201. push(`)`);
  15202. }
  15203. }
  15204. function genNullableArgs(args) {
  15205. let i = args.length;
  15206. while (i--) {
  15207. if (args[i] != null) break;
  15208. }
  15209. return args.slice(0, i + 1).map((arg) => arg || `null`);
  15210. }
  15211. function genCallExpression(node, context) {
  15212. const { push, helper, pure } = context;
  15213. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  15214. if (pure) {
  15215. push(PURE_ANNOTATION);
  15216. }
  15217. push(callee + `(`, -2 /* None */, node);
  15218. genNodeList(node.arguments, context);
  15219. push(`)`);
  15220. }
  15221. function genObjectExpression(node, context) {
  15222. const { push, indent, deindent, newline } = context;
  15223. const { properties } = node;
  15224. if (!properties.length) {
  15225. push(`{}`, -2 /* None */, node);
  15226. return;
  15227. }
  15228. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  15229. push(multilines ? `{` : `{ `);
  15230. multilines && indent();
  15231. for (let i = 0; i < properties.length; i++) {
  15232. const { key, value } = properties[i];
  15233. genExpressionAsPropertyKey(key, context);
  15234. push(`: `);
  15235. genNode(value, context);
  15236. if (i < properties.length - 1) {
  15237. push(`,`);
  15238. newline();
  15239. }
  15240. }
  15241. multilines && deindent();
  15242. push(multilines ? `}` : ` }`);
  15243. }
  15244. function genArrayExpression(node, context) {
  15245. genNodeListAsArray(node.elements, context);
  15246. }
  15247. function genFunctionExpression(node, context) {
  15248. const { push, indent, deindent } = context;
  15249. const { params, returns, body, newline, isSlot } = node;
  15250. if (isSlot) {
  15251. push(`_${helperNameMap[WITH_CTX]}(`);
  15252. }
  15253. push(`(`, -2 /* None */, node);
  15254. if (isArray(params)) {
  15255. genNodeList(params, context);
  15256. } else if (params) {
  15257. genNode(params, context);
  15258. }
  15259. push(`) => `);
  15260. if (newline || body) {
  15261. push(`{`);
  15262. indent();
  15263. }
  15264. if (returns) {
  15265. if (newline) {
  15266. push(`return `);
  15267. }
  15268. if (isArray(returns)) {
  15269. genNodeListAsArray(returns, context);
  15270. } else {
  15271. genNode(returns, context);
  15272. }
  15273. } else if (body) {
  15274. genNode(body, context);
  15275. }
  15276. if (newline || body) {
  15277. deindent();
  15278. push(`}`);
  15279. }
  15280. if (isSlot) {
  15281. push(`)`);
  15282. }
  15283. }
  15284. function genConditionalExpression(node, context) {
  15285. const { test, consequent, alternate, newline: needNewline } = node;
  15286. const { push, indent, deindent, newline } = context;
  15287. if (test.type === 4) {
  15288. const needsParens = !isSimpleIdentifier(test.content);
  15289. needsParens && push(`(`);
  15290. genExpression(test, context);
  15291. needsParens && push(`)`);
  15292. } else {
  15293. push(`(`);
  15294. genNode(test, context);
  15295. push(`)`);
  15296. }
  15297. needNewline && indent();
  15298. context.indentLevel++;
  15299. needNewline || push(` `);
  15300. push(`? `);
  15301. genNode(consequent, context);
  15302. context.indentLevel--;
  15303. needNewline && newline();
  15304. needNewline || push(` `);
  15305. push(`: `);
  15306. const isNested = alternate.type === 19;
  15307. if (!isNested) {
  15308. context.indentLevel++;
  15309. }
  15310. genNode(alternate, context);
  15311. if (!isNested) {
  15312. context.indentLevel--;
  15313. }
  15314. needNewline && deindent(
  15315. true
  15316. /* without newline */
  15317. );
  15318. }
  15319. function genCacheExpression(node, context) {
  15320. const { push, helper, indent, deindent, newline } = context;
  15321. const { needPauseTracking, needArraySpread } = node;
  15322. if (needArraySpread) {
  15323. push(`[...(`);
  15324. }
  15325. push(`_cache[${node.index}] || (`);
  15326. if (needPauseTracking) {
  15327. indent();
  15328. push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
  15329. newline();
  15330. push(`(`);
  15331. }
  15332. push(`_cache[${node.index}] = `);
  15333. genNode(node.value, context);
  15334. if (needPauseTracking) {
  15335. push(`).cacheIndex = ${node.index},`);
  15336. newline();
  15337. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  15338. newline();
  15339. push(`_cache[${node.index}]`);
  15340. deindent();
  15341. }
  15342. push(`)`);
  15343. if (needArraySpread) {
  15344. push(`)]`);
  15345. }
  15346. }
  15347. const prohibitedKeywordRE = new RegExp(
  15348. "\\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"
  15349. );
  15350. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  15351. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  15352. const exp = node.content;
  15353. if (!exp.trim()) {
  15354. return;
  15355. }
  15356. try {
  15357. new Function(
  15358. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  15359. );
  15360. } catch (e) {
  15361. let message = e.message;
  15362. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  15363. if (keywordMatch) {
  15364. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  15365. }
  15366. context.onError(
  15367. createCompilerError(
  15368. 45,
  15369. node.loc,
  15370. void 0,
  15371. message
  15372. )
  15373. );
  15374. }
  15375. }
  15376. const transformExpression = (node, context) => {
  15377. if (node.type === 5) {
  15378. node.content = processExpression(
  15379. node.content,
  15380. context
  15381. );
  15382. } else if (node.type === 1) {
  15383. for (let i = 0; i < node.props.length; i++) {
  15384. const dir = node.props[i];
  15385. if (dir.type === 7 && dir.name !== "for") {
  15386. const exp = dir.exp;
  15387. const arg = dir.arg;
  15388. if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
  15389. dir.exp = processExpression(
  15390. exp,
  15391. context,
  15392. // slot args must be processed as function params
  15393. dir.name === "slot"
  15394. );
  15395. }
  15396. if (arg && arg.type === 4 && !arg.isStatic) {
  15397. dir.arg = processExpression(arg, context);
  15398. }
  15399. }
  15400. }
  15401. }
  15402. };
  15403. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  15404. {
  15405. {
  15406. validateBrowserExpression(node, context, asParams, asRawStatements);
  15407. }
  15408. return node;
  15409. }
  15410. }
  15411. const transformIf = createStructuralDirectiveTransform(
  15412. /^(if|else|else-if)$/,
  15413. (node, dir, context) => {
  15414. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  15415. const siblings = context.parent.children;
  15416. let i = siblings.indexOf(ifNode);
  15417. let key = 0;
  15418. while (i-- >= 0) {
  15419. const sibling = siblings[i];
  15420. if (sibling && sibling.type === 9) {
  15421. key += sibling.branches.length;
  15422. }
  15423. }
  15424. return () => {
  15425. if (isRoot) {
  15426. ifNode.codegenNode = createCodegenNodeForBranch(
  15427. branch,
  15428. key,
  15429. context
  15430. );
  15431. } else {
  15432. const parentCondition = getParentCondition(ifNode.codegenNode);
  15433. parentCondition.alternate = createCodegenNodeForBranch(
  15434. branch,
  15435. key + ifNode.branches.length - 1,
  15436. context
  15437. );
  15438. }
  15439. };
  15440. });
  15441. }
  15442. );
  15443. function processIf(node, dir, context, processCodegen) {
  15444. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  15445. const loc = dir.exp ? dir.exp.loc : node.loc;
  15446. context.onError(
  15447. createCompilerError(28, dir.loc)
  15448. );
  15449. dir.exp = createSimpleExpression(`true`, false, loc);
  15450. }
  15451. if (dir.exp) {
  15452. validateBrowserExpression(dir.exp, context);
  15453. }
  15454. if (dir.name === "if") {
  15455. const branch = createIfBranch(node, dir);
  15456. const ifNode = {
  15457. type: 9,
  15458. loc: cloneLoc(node.loc),
  15459. branches: [branch]
  15460. };
  15461. context.replaceNode(ifNode);
  15462. if (processCodegen) {
  15463. return processCodegen(ifNode, branch, true);
  15464. }
  15465. } else {
  15466. const siblings = context.parent.children;
  15467. const comments = [];
  15468. let i = siblings.indexOf(node);
  15469. while (i-- >= -1) {
  15470. const sibling = siblings[i];
  15471. if (sibling && sibling.type === 3) {
  15472. context.removeNode(sibling);
  15473. comments.unshift(sibling);
  15474. continue;
  15475. }
  15476. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  15477. context.removeNode(sibling);
  15478. continue;
  15479. }
  15480. if (sibling && sibling.type === 9) {
  15481. if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  15482. context.onError(
  15483. createCompilerError(30, node.loc)
  15484. );
  15485. }
  15486. context.removeNode();
  15487. const branch = createIfBranch(node, dir);
  15488. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  15489. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  15490. branch.children = [...comments, ...branch.children];
  15491. }
  15492. {
  15493. const key = branch.userKey;
  15494. if (key) {
  15495. sibling.branches.forEach(({ userKey }) => {
  15496. if (isSameKey(userKey, key)) {
  15497. context.onError(
  15498. createCompilerError(
  15499. 29,
  15500. branch.userKey.loc
  15501. )
  15502. );
  15503. }
  15504. });
  15505. }
  15506. }
  15507. sibling.branches.push(branch);
  15508. const onExit = processCodegen && processCodegen(sibling, branch, false);
  15509. traverseNode(branch, context);
  15510. if (onExit) onExit();
  15511. context.currentNode = null;
  15512. } else {
  15513. context.onError(
  15514. createCompilerError(30, node.loc)
  15515. );
  15516. }
  15517. break;
  15518. }
  15519. }
  15520. }
  15521. function createIfBranch(node, dir) {
  15522. const isTemplateIf = node.tagType === 3;
  15523. return {
  15524. type: 10,
  15525. loc: node.loc,
  15526. condition: dir.name === "else" ? void 0 : dir.exp,
  15527. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  15528. userKey: findProp(node, `key`),
  15529. isTemplateIf
  15530. };
  15531. }
  15532. function createCodegenNodeForBranch(branch, keyIndex, context) {
  15533. if (branch.condition) {
  15534. return createConditionalExpression(
  15535. branch.condition,
  15536. createChildrenCodegenNode(branch, keyIndex, context),
  15537. // make sure to pass in asBlock: true so that the comment node call
  15538. // closes the current block.
  15539. createCallExpression(context.helper(CREATE_COMMENT), [
  15540. '"v-if"' ,
  15541. "true"
  15542. ])
  15543. );
  15544. } else {
  15545. return createChildrenCodegenNode(branch, keyIndex, context);
  15546. }
  15547. }
  15548. function createChildrenCodegenNode(branch, keyIndex, context) {
  15549. const { helper } = context;
  15550. const keyProperty = createObjectProperty(
  15551. `key`,
  15552. createSimpleExpression(
  15553. `${keyIndex}`,
  15554. false,
  15555. locStub,
  15556. 2
  15557. )
  15558. );
  15559. const { children } = branch;
  15560. const firstChild = children[0];
  15561. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  15562. if (needFragmentWrapper) {
  15563. if (children.length === 1 && firstChild.type === 11) {
  15564. const vnodeCall = firstChild.codegenNode;
  15565. injectProp(vnodeCall, keyProperty, context);
  15566. return vnodeCall;
  15567. } else {
  15568. let patchFlag = 64;
  15569. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  15570. patchFlag |= 2048;
  15571. }
  15572. return createVNodeCall(
  15573. context,
  15574. helper(FRAGMENT),
  15575. createObjectExpression([keyProperty]),
  15576. children,
  15577. patchFlag,
  15578. void 0,
  15579. void 0,
  15580. true,
  15581. false,
  15582. false,
  15583. branch.loc
  15584. );
  15585. }
  15586. } else {
  15587. const ret = firstChild.codegenNode;
  15588. const vnodeCall = getMemoedVNodeCall(ret);
  15589. if (vnodeCall.type === 13) {
  15590. convertToBlock(vnodeCall, context);
  15591. }
  15592. injectProp(vnodeCall, keyProperty, context);
  15593. return ret;
  15594. }
  15595. }
  15596. function isSameKey(a, b) {
  15597. if (!a || a.type !== b.type) {
  15598. return false;
  15599. }
  15600. if (a.type === 6) {
  15601. if (a.value.content !== b.value.content) {
  15602. return false;
  15603. }
  15604. } else {
  15605. const exp = a.exp;
  15606. const branchExp = b.exp;
  15607. if (exp.type !== branchExp.type) {
  15608. return false;
  15609. }
  15610. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  15611. return false;
  15612. }
  15613. }
  15614. return true;
  15615. }
  15616. function getParentCondition(node) {
  15617. while (true) {
  15618. if (node.type === 19) {
  15619. if (node.alternate.type === 19) {
  15620. node = node.alternate;
  15621. } else {
  15622. return node;
  15623. }
  15624. } else if (node.type === 20) {
  15625. node = node.value;
  15626. }
  15627. }
  15628. }
  15629. const transformBind = (dir, _node, context) => {
  15630. const { modifiers, loc } = dir;
  15631. const arg = dir.arg;
  15632. let { exp } = dir;
  15633. if (exp && exp.type === 4 && !exp.content.trim()) {
  15634. {
  15635. exp = void 0;
  15636. }
  15637. }
  15638. if (!exp) {
  15639. if (arg.type !== 4 || !arg.isStatic) {
  15640. context.onError(
  15641. createCompilerError(
  15642. 52,
  15643. arg.loc
  15644. )
  15645. );
  15646. return {
  15647. props: [
  15648. createObjectProperty(arg, createSimpleExpression("", true, loc))
  15649. ]
  15650. };
  15651. }
  15652. transformBindShorthand(dir);
  15653. exp = dir.exp;
  15654. }
  15655. if (arg.type !== 4) {
  15656. arg.children.unshift(`(`);
  15657. arg.children.push(`) || ""`);
  15658. } else if (!arg.isStatic) {
  15659. arg.content = `${arg.content} || ""`;
  15660. }
  15661. if (modifiers.some((mod) => mod.content === "camel")) {
  15662. if (arg.type === 4) {
  15663. if (arg.isStatic) {
  15664. arg.content = camelize(arg.content);
  15665. } else {
  15666. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  15667. }
  15668. } else {
  15669. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  15670. arg.children.push(`)`);
  15671. }
  15672. }
  15673. if (!context.inSSR) {
  15674. if (modifiers.some((mod) => mod.content === "prop")) {
  15675. injectPrefix(arg, ".");
  15676. }
  15677. if (modifiers.some((mod) => mod.content === "attr")) {
  15678. injectPrefix(arg, "^");
  15679. }
  15680. }
  15681. return {
  15682. props: [createObjectProperty(arg, exp)]
  15683. };
  15684. };
  15685. const transformBindShorthand = (dir, context) => {
  15686. const arg = dir.arg;
  15687. const propName = camelize(arg.content);
  15688. dir.exp = createSimpleExpression(propName, false, arg.loc);
  15689. };
  15690. const injectPrefix = (arg, prefix) => {
  15691. if (arg.type === 4) {
  15692. if (arg.isStatic) {
  15693. arg.content = prefix + arg.content;
  15694. } else {
  15695. arg.content = `\`${prefix}\${${arg.content}}\``;
  15696. }
  15697. } else {
  15698. arg.children.unshift(`'${prefix}' + (`);
  15699. arg.children.push(`)`);
  15700. }
  15701. };
  15702. const transformFor = createStructuralDirectiveTransform(
  15703. "for",
  15704. (node, dir, context) => {
  15705. const { helper, removeHelper } = context;
  15706. return processFor(node, dir, context, (forNode) => {
  15707. const renderExp = createCallExpression(helper(RENDER_LIST), [
  15708. forNode.source
  15709. ]);
  15710. const isTemplate = isTemplateNode(node);
  15711. const memo = findDir(node, "memo");
  15712. const keyProp = findProp(node, `key`, false, true);
  15713. if (keyProp && keyProp.type === 7 && !keyProp.exp) {
  15714. transformBindShorthand(keyProp);
  15715. }
  15716. const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
  15717. const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
  15718. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  15719. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  15720. forNode.codegenNode = createVNodeCall(
  15721. context,
  15722. helper(FRAGMENT),
  15723. void 0,
  15724. renderExp,
  15725. fragmentFlag,
  15726. void 0,
  15727. void 0,
  15728. true,
  15729. !isStableFragment,
  15730. false,
  15731. node.loc
  15732. );
  15733. return () => {
  15734. let childBlock;
  15735. const { children } = forNode;
  15736. if (isTemplate) {
  15737. node.children.some((c) => {
  15738. if (c.type === 1) {
  15739. const key = findProp(c, "key");
  15740. if (key) {
  15741. context.onError(
  15742. createCompilerError(
  15743. 33,
  15744. key.loc
  15745. )
  15746. );
  15747. return true;
  15748. }
  15749. }
  15750. });
  15751. }
  15752. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  15753. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  15754. if (slotOutlet) {
  15755. childBlock = slotOutlet.codegenNode;
  15756. if (isTemplate && keyProperty) {
  15757. injectProp(childBlock, keyProperty, context);
  15758. }
  15759. } else if (needFragmentWrapper) {
  15760. childBlock = createVNodeCall(
  15761. context,
  15762. helper(FRAGMENT),
  15763. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  15764. node.children,
  15765. 64,
  15766. void 0,
  15767. void 0,
  15768. true,
  15769. void 0,
  15770. false
  15771. );
  15772. } else {
  15773. childBlock = children[0].codegenNode;
  15774. if (isTemplate && keyProperty) {
  15775. injectProp(childBlock, keyProperty, context);
  15776. }
  15777. if (childBlock.isBlock !== !isStableFragment) {
  15778. if (childBlock.isBlock) {
  15779. removeHelper(OPEN_BLOCK);
  15780. removeHelper(
  15781. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  15782. );
  15783. } else {
  15784. removeHelper(
  15785. getVNodeHelper(context.inSSR, childBlock.isComponent)
  15786. );
  15787. }
  15788. }
  15789. childBlock.isBlock = !isStableFragment;
  15790. if (childBlock.isBlock) {
  15791. helper(OPEN_BLOCK);
  15792. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  15793. } else {
  15794. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  15795. }
  15796. }
  15797. if (memo) {
  15798. const loop = createFunctionExpression(
  15799. createForLoopParams(forNode.parseResult, [
  15800. createSimpleExpression(`_cached`)
  15801. ])
  15802. );
  15803. loop.body = createBlockStatement([
  15804. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  15805. createCompoundExpression([
  15806. `if (_cached`,
  15807. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  15808. ` && ${context.helperString(
  15809. IS_MEMO_SAME
  15810. )}(_cached, _memo)) return _cached`
  15811. ]),
  15812. createCompoundExpression([`const _item = `, childBlock]),
  15813. createSimpleExpression(`_item.memo = _memo`),
  15814. createSimpleExpression(`return _item`)
  15815. ]);
  15816. renderExp.arguments.push(
  15817. loop,
  15818. createSimpleExpression(`_cache`),
  15819. createSimpleExpression(String(context.cached.length))
  15820. );
  15821. context.cached.push(null);
  15822. } else {
  15823. renderExp.arguments.push(
  15824. createFunctionExpression(
  15825. createForLoopParams(forNode.parseResult),
  15826. childBlock,
  15827. true
  15828. )
  15829. );
  15830. }
  15831. };
  15832. });
  15833. }
  15834. );
  15835. function processFor(node, dir, context, processCodegen) {
  15836. if (!dir.exp) {
  15837. context.onError(
  15838. createCompilerError(31, dir.loc)
  15839. );
  15840. return;
  15841. }
  15842. const parseResult = dir.forParseResult;
  15843. if (!parseResult) {
  15844. context.onError(
  15845. createCompilerError(32, dir.loc)
  15846. );
  15847. return;
  15848. }
  15849. finalizeForParseResult(parseResult, context);
  15850. const { addIdentifiers, removeIdentifiers, scopes } = context;
  15851. const { source, value, key, index } = parseResult;
  15852. const forNode = {
  15853. type: 11,
  15854. loc: dir.loc,
  15855. source,
  15856. valueAlias: value,
  15857. keyAlias: key,
  15858. objectIndexAlias: index,
  15859. parseResult,
  15860. children: isTemplateNode(node) ? node.children : [node]
  15861. };
  15862. context.replaceNode(forNode);
  15863. scopes.vFor++;
  15864. const onExit = processCodegen && processCodegen(forNode);
  15865. return () => {
  15866. scopes.vFor--;
  15867. if (onExit) onExit();
  15868. };
  15869. }
  15870. function finalizeForParseResult(result, context) {
  15871. if (result.finalized) return;
  15872. {
  15873. validateBrowserExpression(result.source, context);
  15874. if (result.key) {
  15875. validateBrowserExpression(
  15876. result.key,
  15877. context,
  15878. true
  15879. );
  15880. }
  15881. if (result.index) {
  15882. validateBrowserExpression(
  15883. result.index,
  15884. context,
  15885. true
  15886. );
  15887. }
  15888. if (result.value) {
  15889. validateBrowserExpression(
  15890. result.value,
  15891. context,
  15892. true
  15893. );
  15894. }
  15895. }
  15896. result.finalized = true;
  15897. }
  15898. function createForLoopParams({ value, key, index }, memoArgs = []) {
  15899. return createParamsList([value, key, index, ...memoArgs]);
  15900. }
  15901. function createParamsList(args) {
  15902. let i = args.length;
  15903. while (i--) {
  15904. if (args[i]) break;
  15905. }
  15906. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  15907. }
  15908. const defaultFallback = createSimpleExpression(`undefined`, false);
  15909. const trackSlotScopes = (node, context) => {
  15910. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  15911. const vSlot = findDir(node, "slot");
  15912. if (vSlot) {
  15913. vSlot.exp;
  15914. context.scopes.vSlot++;
  15915. return () => {
  15916. context.scopes.vSlot--;
  15917. };
  15918. }
  15919. }
  15920. };
  15921. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  15922. props,
  15923. children,
  15924. false,
  15925. true,
  15926. children.length ? children[0].loc : loc
  15927. );
  15928. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  15929. context.helper(WITH_CTX);
  15930. const { children, loc } = node;
  15931. const slotsProperties = [];
  15932. const dynamicSlots = [];
  15933. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  15934. const onComponentSlot = findDir(node, "slot", true);
  15935. if (onComponentSlot) {
  15936. const { arg, exp } = onComponentSlot;
  15937. if (arg && !isStaticExp(arg)) {
  15938. hasDynamicSlots = true;
  15939. }
  15940. slotsProperties.push(
  15941. createObjectProperty(
  15942. arg || createSimpleExpression("default", true),
  15943. buildSlotFn(exp, void 0, children, loc)
  15944. )
  15945. );
  15946. }
  15947. let hasTemplateSlots = false;
  15948. let hasNamedDefaultSlot = false;
  15949. const implicitDefaultChildren = [];
  15950. const seenSlotNames = /* @__PURE__ */ new Set();
  15951. let conditionalBranchIndex = 0;
  15952. for (let i = 0; i < children.length; i++) {
  15953. const slotElement = children[i];
  15954. let slotDir;
  15955. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  15956. if (slotElement.type !== 3) {
  15957. implicitDefaultChildren.push(slotElement);
  15958. }
  15959. continue;
  15960. }
  15961. if (onComponentSlot) {
  15962. context.onError(
  15963. createCompilerError(37, slotDir.loc)
  15964. );
  15965. break;
  15966. }
  15967. hasTemplateSlots = true;
  15968. const { children: slotChildren, loc: slotLoc } = slotElement;
  15969. const {
  15970. arg: slotName = createSimpleExpression(`default`, true),
  15971. exp: slotProps,
  15972. loc: dirLoc
  15973. } = slotDir;
  15974. let staticSlotName;
  15975. if (isStaticExp(slotName)) {
  15976. staticSlotName = slotName ? slotName.content : `default`;
  15977. } else {
  15978. hasDynamicSlots = true;
  15979. }
  15980. const vFor = findDir(slotElement, "for");
  15981. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  15982. let vIf;
  15983. let vElse;
  15984. if (vIf = findDir(slotElement, "if")) {
  15985. hasDynamicSlots = true;
  15986. dynamicSlots.push(
  15987. createConditionalExpression(
  15988. vIf.exp,
  15989. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  15990. defaultFallback
  15991. )
  15992. );
  15993. } else if (vElse = findDir(
  15994. slotElement,
  15995. /^else(-if)?$/,
  15996. true
  15997. /* allowEmpty */
  15998. )) {
  15999. let j = i;
  16000. let prev;
  16001. while (j--) {
  16002. prev = children[j];
  16003. if (prev.type !== 3) {
  16004. break;
  16005. }
  16006. }
  16007. if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
  16008. let conditional = dynamicSlots[dynamicSlots.length - 1];
  16009. while (conditional.alternate.type === 19) {
  16010. conditional = conditional.alternate;
  16011. }
  16012. conditional.alternate = vElse.exp ? createConditionalExpression(
  16013. vElse.exp,
  16014. buildDynamicSlot(
  16015. slotName,
  16016. slotFunction,
  16017. conditionalBranchIndex++
  16018. ),
  16019. defaultFallback
  16020. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  16021. } else {
  16022. context.onError(
  16023. createCompilerError(30, vElse.loc)
  16024. );
  16025. }
  16026. } else if (vFor) {
  16027. hasDynamicSlots = true;
  16028. const parseResult = vFor.forParseResult;
  16029. if (parseResult) {
  16030. finalizeForParseResult(parseResult, context);
  16031. dynamicSlots.push(
  16032. createCallExpression(context.helper(RENDER_LIST), [
  16033. parseResult.source,
  16034. createFunctionExpression(
  16035. createForLoopParams(parseResult),
  16036. buildDynamicSlot(slotName, slotFunction),
  16037. true
  16038. )
  16039. ])
  16040. );
  16041. } else {
  16042. context.onError(
  16043. createCompilerError(
  16044. 32,
  16045. vFor.loc
  16046. )
  16047. );
  16048. }
  16049. } else {
  16050. if (staticSlotName) {
  16051. if (seenSlotNames.has(staticSlotName)) {
  16052. context.onError(
  16053. createCompilerError(
  16054. 38,
  16055. dirLoc
  16056. )
  16057. );
  16058. continue;
  16059. }
  16060. seenSlotNames.add(staticSlotName);
  16061. if (staticSlotName === "default") {
  16062. hasNamedDefaultSlot = true;
  16063. }
  16064. }
  16065. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  16066. }
  16067. }
  16068. if (!onComponentSlot) {
  16069. const buildDefaultSlotProperty = (props, children2) => {
  16070. const fn = buildSlotFn(props, void 0, children2, loc);
  16071. return createObjectProperty(`default`, fn);
  16072. };
  16073. if (!hasTemplateSlots) {
  16074. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  16075. } else if (implicitDefaultChildren.length && // #3766
  16076. // with whitespace: 'preserve', whitespaces between slots will end up in
  16077. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  16078. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  16079. if (hasNamedDefaultSlot) {
  16080. context.onError(
  16081. createCompilerError(
  16082. 39,
  16083. implicitDefaultChildren[0].loc
  16084. )
  16085. );
  16086. } else {
  16087. slotsProperties.push(
  16088. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  16089. );
  16090. }
  16091. }
  16092. }
  16093. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  16094. let slots = createObjectExpression(
  16095. slotsProperties.concat(
  16096. createObjectProperty(
  16097. `_`,
  16098. // 2 = compiled but dynamic = can skip normalization, but must run diff
  16099. // 1 = compiled and static = can skip normalization AND diff as optimized
  16100. createSimpleExpression(
  16101. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  16102. false
  16103. )
  16104. )
  16105. ),
  16106. loc
  16107. );
  16108. if (dynamicSlots.length) {
  16109. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  16110. slots,
  16111. createArrayExpression(dynamicSlots)
  16112. ]);
  16113. }
  16114. return {
  16115. slots,
  16116. hasDynamicSlots
  16117. };
  16118. }
  16119. function buildDynamicSlot(name, fn, index) {
  16120. const props = [
  16121. createObjectProperty(`name`, name),
  16122. createObjectProperty(`fn`, fn)
  16123. ];
  16124. if (index != null) {
  16125. props.push(
  16126. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  16127. );
  16128. }
  16129. return createObjectExpression(props);
  16130. }
  16131. function hasForwardedSlots(children) {
  16132. for (let i = 0; i < children.length; i++) {
  16133. const child = children[i];
  16134. switch (child.type) {
  16135. case 1:
  16136. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  16137. return true;
  16138. }
  16139. break;
  16140. case 9:
  16141. if (hasForwardedSlots(child.branches)) return true;
  16142. break;
  16143. case 10:
  16144. case 11:
  16145. if (hasForwardedSlots(child.children)) return true;
  16146. break;
  16147. }
  16148. }
  16149. return false;
  16150. }
  16151. function isNonWhitespaceContent(node) {
  16152. if (node.type !== 2 && node.type !== 12)
  16153. return true;
  16154. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  16155. }
  16156. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  16157. const transformElement = (node, context) => {
  16158. return function postTransformElement() {
  16159. node = context.currentNode;
  16160. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  16161. return;
  16162. }
  16163. const { tag, props } = node;
  16164. const isComponent = node.tagType === 1;
  16165. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  16166. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  16167. let vnodeProps;
  16168. let vnodeChildren;
  16169. let patchFlag = 0;
  16170. let vnodeDynamicProps;
  16171. let dynamicPropNames;
  16172. let vnodeDirectives;
  16173. let shouldUseBlock = (
  16174. // dynamic component may resolve to plain elements
  16175. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  16176. // updates inside get proper isSVG flag at runtime. (#639, #643)
  16177. // This is technically web-specific, but splitting the logic out of core
  16178. // leads to too much unnecessary complexity.
  16179. (tag === "svg" || tag === "foreignObject" || tag === "math")
  16180. );
  16181. if (props.length > 0) {
  16182. const propsBuildResult = buildProps(
  16183. node,
  16184. context,
  16185. void 0,
  16186. isComponent,
  16187. isDynamicComponent
  16188. );
  16189. vnodeProps = propsBuildResult.props;
  16190. patchFlag = propsBuildResult.patchFlag;
  16191. dynamicPropNames = propsBuildResult.dynamicPropNames;
  16192. const directives = propsBuildResult.directives;
  16193. vnodeDirectives = directives && directives.length ? createArrayExpression(
  16194. directives.map((dir) => buildDirectiveArgs(dir, context))
  16195. ) : void 0;
  16196. if (propsBuildResult.shouldUseBlock) {
  16197. shouldUseBlock = true;
  16198. }
  16199. }
  16200. if (node.children.length > 0) {
  16201. if (vnodeTag === KEEP_ALIVE) {
  16202. shouldUseBlock = true;
  16203. patchFlag |= 1024;
  16204. if (node.children.length > 1) {
  16205. context.onError(
  16206. createCompilerError(46, {
  16207. start: node.children[0].loc.start,
  16208. end: node.children[node.children.length - 1].loc.end,
  16209. source: ""
  16210. })
  16211. );
  16212. }
  16213. }
  16214. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  16215. vnodeTag !== TELEPORT && // explained above.
  16216. vnodeTag !== KEEP_ALIVE;
  16217. if (shouldBuildAsSlots) {
  16218. const { slots, hasDynamicSlots } = buildSlots(node, context);
  16219. vnodeChildren = slots;
  16220. if (hasDynamicSlots) {
  16221. patchFlag |= 1024;
  16222. }
  16223. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  16224. const child = node.children[0];
  16225. const type = child.type;
  16226. const hasDynamicTextChild = type === 5 || type === 8;
  16227. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  16228. patchFlag |= 1;
  16229. }
  16230. if (hasDynamicTextChild || type === 2) {
  16231. vnodeChildren = child;
  16232. } else {
  16233. vnodeChildren = node.children;
  16234. }
  16235. } else {
  16236. vnodeChildren = node.children;
  16237. }
  16238. }
  16239. if (dynamicPropNames && dynamicPropNames.length) {
  16240. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  16241. }
  16242. node.codegenNode = createVNodeCall(
  16243. context,
  16244. vnodeTag,
  16245. vnodeProps,
  16246. vnodeChildren,
  16247. patchFlag === 0 ? void 0 : patchFlag,
  16248. vnodeDynamicProps,
  16249. vnodeDirectives,
  16250. !!shouldUseBlock,
  16251. false,
  16252. isComponent,
  16253. node.loc
  16254. );
  16255. };
  16256. };
  16257. function resolveComponentType(node, context, ssr = false) {
  16258. let { tag } = node;
  16259. const isExplicitDynamic = isComponentTag(tag);
  16260. const isProp = findProp(
  16261. node,
  16262. "is",
  16263. false,
  16264. true
  16265. /* allow empty */
  16266. );
  16267. if (isProp) {
  16268. if (isExplicitDynamic || false) {
  16269. let exp;
  16270. if (isProp.type === 6) {
  16271. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  16272. } else {
  16273. exp = isProp.exp;
  16274. if (!exp) {
  16275. exp = createSimpleExpression(`is`, false, isProp.arg.loc);
  16276. }
  16277. }
  16278. if (exp) {
  16279. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  16280. exp
  16281. ]);
  16282. }
  16283. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  16284. tag = isProp.value.content.slice(4);
  16285. }
  16286. }
  16287. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  16288. if (builtIn) {
  16289. if (!ssr) context.helper(builtIn);
  16290. return builtIn;
  16291. }
  16292. context.helper(RESOLVE_COMPONENT);
  16293. context.components.add(tag);
  16294. return toValidAssetId(tag, `component`);
  16295. }
  16296. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  16297. const { tag, loc: elementLoc, children } = node;
  16298. let properties = [];
  16299. const mergeArgs = [];
  16300. const runtimeDirectives = [];
  16301. const hasChildren = children.length > 0;
  16302. let shouldUseBlock = false;
  16303. let patchFlag = 0;
  16304. let hasRef = false;
  16305. let hasClassBinding = false;
  16306. let hasStyleBinding = false;
  16307. let hasHydrationEventBinding = false;
  16308. let hasDynamicKeys = false;
  16309. let hasVnodeHook = false;
  16310. const dynamicPropNames = [];
  16311. const pushMergeArg = (arg) => {
  16312. if (properties.length) {
  16313. mergeArgs.push(
  16314. createObjectExpression(dedupeProperties(properties), elementLoc)
  16315. );
  16316. properties = [];
  16317. }
  16318. if (arg) mergeArgs.push(arg);
  16319. };
  16320. const pushRefVForMarker = () => {
  16321. if (context.scopes.vFor > 0) {
  16322. properties.push(
  16323. createObjectProperty(
  16324. createSimpleExpression("ref_for", true),
  16325. createSimpleExpression("true")
  16326. )
  16327. );
  16328. }
  16329. };
  16330. const analyzePatchFlag = ({ key, value }) => {
  16331. if (isStaticExp(key)) {
  16332. const name = key.content;
  16333. const isEventHandler = isOn(name);
  16334. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  16335. // dedicated fast path.
  16336. name.toLowerCase() !== "onclick" && // omit v-model handlers
  16337. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  16338. !isReservedProp(name)) {
  16339. hasHydrationEventBinding = true;
  16340. }
  16341. if (isEventHandler && isReservedProp(name)) {
  16342. hasVnodeHook = true;
  16343. }
  16344. if (isEventHandler && value.type === 14) {
  16345. value = value.arguments[0];
  16346. }
  16347. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  16348. return;
  16349. }
  16350. if (name === "ref") {
  16351. hasRef = true;
  16352. } else if (name === "class") {
  16353. hasClassBinding = true;
  16354. } else if (name === "style") {
  16355. hasStyleBinding = true;
  16356. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  16357. dynamicPropNames.push(name);
  16358. }
  16359. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  16360. dynamicPropNames.push(name);
  16361. }
  16362. } else {
  16363. hasDynamicKeys = true;
  16364. }
  16365. };
  16366. for (let i = 0; i < props.length; i++) {
  16367. const prop = props[i];
  16368. if (prop.type === 6) {
  16369. const { loc, name, nameLoc, value } = prop;
  16370. let isStatic = true;
  16371. if (name === "ref") {
  16372. hasRef = true;
  16373. pushRefVForMarker();
  16374. }
  16375. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  16376. continue;
  16377. }
  16378. properties.push(
  16379. createObjectProperty(
  16380. createSimpleExpression(name, true, nameLoc),
  16381. createSimpleExpression(
  16382. value ? value.content : "",
  16383. isStatic,
  16384. value ? value.loc : loc
  16385. )
  16386. )
  16387. );
  16388. } else {
  16389. const { name, arg, exp, loc, modifiers } = prop;
  16390. const isVBind = name === "bind";
  16391. const isVOn = name === "on";
  16392. if (name === "slot") {
  16393. if (!isComponent) {
  16394. context.onError(
  16395. createCompilerError(40, loc)
  16396. );
  16397. }
  16398. continue;
  16399. }
  16400. if (name === "once" || name === "memo") {
  16401. continue;
  16402. }
  16403. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  16404. continue;
  16405. }
  16406. if (isVOn && ssr) {
  16407. continue;
  16408. }
  16409. if (
  16410. // #938: elements with dynamic keys should be forced into blocks
  16411. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  16412. // before children
  16413. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  16414. ) {
  16415. shouldUseBlock = true;
  16416. }
  16417. if (isVBind && isStaticArgOf(arg, "ref")) {
  16418. pushRefVForMarker();
  16419. }
  16420. if (!arg && (isVBind || isVOn)) {
  16421. hasDynamicKeys = true;
  16422. if (exp) {
  16423. if (isVBind) {
  16424. pushRefVForMarker();
  16425. pushMergeArg();
  16426. mergeArgs.push(exp);
  16427. } else {
  16428. pushMergeArg({
  16429. type: 14,
  16430. loc,
  16431. callee: context.helper(TO_HANDLERS),
  16432. arguments: isComponent ? [exp] : [exp, `true`]
  16433. });
  16434. }
  16435. } else {
  16436. context.onError(
  16437. createCompilerError(
  16438. isVBind ? 34 : 35,
  16439. loc
  16440. )
  16441. );
  16442. }
  16443. continue;
  16444. }
  16445. if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
  16446. patchFlag |= 32;
  16447. }
  16448. const directiveTransform = context.directiveTransforms[name];
  16449. if (directiveTransform) {
  16450. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  16451. !ssr && props2.forEach(analyzePatchFlag);
  16452. if (isVOn && arg && !isStaticExp(arg)) {
  16453. pushMergeArg(createObjectExpression(props2, elementLoc));
  16454. } else {
  16455. properties.push(...props2);
  16456. }
  16457. if (needRuntime) {
  16458. runtimeDirectives.push(prop);
  16459. if (isSymbol(needRuntime)) {
  16460. directiveImportMap.set(prop, needRuntime);
  16461. }
  16462. }
  16463. } else if (!isBuiltInDirective(name)) {
  16464. runtimeDirectives.push(prop);
  16465. if (hasChildren) {
  16466. shouldUseBlock = true;
  16467. }
  16468. }
  16469. }
  16470. }
  16471. let propsExpression = void 0;
  16472. if (mergeArgs.length) {
  16473. pushMergeArg();
  16474. if (mergeArgs.length > 1) {
  16475. propsExpression = createCallExpression(
  16476. context.helper(MERGE_PROPS),
  16477. mergeArgs,
  16478. elementLoc
  16479. );
  16480. } else {
  16481. propsExpression = mergeArgs[0];
  16482. }
  16483. } else if (properties.length) {
  16484. propsExpression = createObjectExpression(
  16485. dedupeProperties(properties),
  16486. elementLoc
  16487. );
  16488. }
  16489. if (hasDynamicKeys) {
  16490. patchFlag |= 16;
  16491. } else {
  16492. if (hasClassBinding && !isComponent) {
  16493. patchFlag |= 2;
  16494. }
  16495. if (hasStyleBinding && !isComponent) {
  16496. patchFlag |= 4;
  16497. }
  16498. if (dynamicPropNames.length) {
  16499. patchFlag |= 8;
  16500. }
  16501. if (hasHydrationEventBinding) {
  16502. patchFlag |= 32;
  16503. }
  16504. }
  16505. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  16506. patchFlag |= 512;
  16507. }
  16508. if (!context.inSSR && propsExpression) {
  16509. switch (propsExpression.type) {
  16510. case 15:
  16511. let classKeyIndex = -1;
  16512. let styleKeyIndex = -1;
  16513. let hasDynamicKey = false;
  16514. for (let i = 0; i < propsExpression.properties.length; i++) {
  16515. const key = propsExpression.properties[i].key;
  16516. if (isStaticExp(key)) {
  16517. if (key.content === "class") {
  16518. classKeyIndex = i;
  16519. } else if (key.content === "style") {
  16520. styleKeyIndex = i;
  16521. }
  16522. } else if (!key.isHandlerKey) {
  16523. hasDynamicKey = true;
  16524. }
  16525. }
  16526. const classProp = propsExpression.properties[classKeyIndex];
  16527. const styleProp = propsExpression.properties[styleKeyIndex];
  16528. if (!hasDynamicKey) {
  16529. if (classProp && !isStaticExp(classProp.value)) {
  16530. classProp.value = createCallExpression(
  16531. context.helper(NORMALIZE_CLASS),
  16532. [classProp.value]
  16533. );
  16534. }
  16535. if (styleProp && // the static style is compiled into an object,
  16536. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  16537. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  16538. // v-bind:style with static literal object
  16539. styleProp.value.type === 17)) {
  16540. styleProp.value = createCallExpression(
  16541. context.helper(NORMALIZE_STYLE),
  16542. [styleProp.value]
  16543. );
  16544. }
  16545. } else {
  16546. propsExpression = createCallExpression(
  16547. context.helper(NORMALIZE_PROPS),
  16548. [propsExpression]
  16549. );
  16550. }
  16551. break;
  16552. case 14:
  16553. break;
  16554. default:
  16555. propsExpression = createCallExpression(
  16556. context.helper(NORMALIZE_PROPS),
  16557. [
  16558. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  16559. propsExpression
  16560. ])
  16561. ]
  16562. );
  16563. break;
  16564. }
  16565. }
  16566. return {
  16567. props: propsExpression,
  16568. directives: runtimeDirectives,
  16569. patchFlag,
  16570. dynamicPropNames,
  16571. shouldUseBlock
  16572. };
  16573. }
  16574. function dedupeProperties(properties) {
  16575. const knownProps = /* @__PURE__ */ new Map();
  16576. const deduped = [];
  16577. for (let i = 0; i < properties.length; i++) {
  16578. const prop = properties[i];
  16579. if (prop.key.type === 8 || !prop.key.isStatic) {
  16580. deduped.push(prop);
  16581. continue;
  16582. }
  16583. const name = prop.key.content;
  16584. const existing = knownProps.get(name);
  16585. if (existing) {
  16586. if (name === "style" || name === "class" || isOn(name)) {
  16587. mergeAsArray(existing, prop);
  16588. }
  16589. } else {
  16590. knownProps.set(name, prop);
  16591. deduped.push(prop);
  16592. }
  16593. }
  16594. return deduped;
  16595. }
  16596. function mergeAsArray(existing, incoming) {
  16597. if (existing.value.type === 17) {
  16598. existing.value.elements.push(incoming.value);
  16599. } else {
  16600. existing.value = createArrayExpression(
  16601. [existing.value, incoming.value],
  16602. existing.loc
  16603. );
  16604. }
  16605. }
  16606. function buildDirectiveArgs(dir, context) {
  16607. const dirArgs = [];
  16608. const runtime = directiveImportMap.get(dir);
  16609. if (runtime) {
  16610. dirArgs.push(context.helperString(runtime));
  16611. } else {
  16612. {
  16613. context.helper(RESOLVE_DIRECTIVE);
  16614. context.directives.add(dir.name);
  16615. dirArgs.push(toValidAssetId(dir.name, `directive`));
  16616. }
  16617. }
  16618. const { loc } = dir;
  16619. if (dir.exp) dirArgs.push(dir.exp);
  16620. if (dir.arg) {
  16621. if (!dir.exp) {
  16622. dirArgs.push(`void 0`);
  16623. }
  16624. dirArgs.push(dir.arg);
  16625. }
  16626. if (Object.keys(dir.modifiers).length) {
  16627. if (!dir.arg) {
  16628. if (!dir.exp) {
  16629. dirArgs.push(`void 0`);
  16630. }
  16631. dirArgs.push(`void 0`);
  16632. }
  16633. const trueExpression = createSimpleExpression(`true`, false, loc);
  16634. dirArgs.push(
  16635. createObjectExpression(
  16636. dir.modifiers.map(
  16637. (modifier) => createObjectProperty(modifier, trueExpression)
  16638. ),
  16639. loc
  16640. )
  16641. );
  16642. }
  16643. return createArrayExpression(dirArgs, dir.loc);
  16644. }
  16645. function stringifyDynamicPropNames(props) {
  16646. let propsNamesString = `[`;
  16647. for (let i = 0, l = props.length; i < l; i++) {
  16648. propsNamesString += JSON.stringify(props[i]);
  16649. if (i < l - 1) propsNamesString += ", ";
  16650. }
  16651. return propsNamesString + `]`;
  16652. }
  16653. function isComponentTag(tag) {
  16654. return tag === "component" || tag === "Component";
  16655. }
  16656. const transformSlotOutlet = (node, context) => {
  16657. if (isSlotOutlet(node)) {
  16658. const { children, loc } = node;
  16659. const { slotName, slotProps } = processSlotOutlet(node, context);
  16660. const slotArgs = [
  16661. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  16662. slotName,
  16663. "{}",
  16664. "undefined",
  16665. "true"
  16666. ];
  16667. let expectedLen = 2;
  16668. if (slotProps) {
  16669. slotArgs[2] = slotProps;
  16670. expectedLen = 3;
  16671. }
  16672. if (children.length) {
  16673. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  16674. expectedLen = 4;
  16675. }
  16676. if (context.scopeId && !context.slotted) {
  16677. expectedLen = 5;
  16678. }
  16679. slotArgs.splice(expectedLen);
  16680. node.codegenNode = createCallExpression(
  16681. context.helper(RENDER_SLOT),
  16682. slotArgs,
  16683. loc
  16684. );
  16685. }
  16686. };
  16687. function processSlotOutlet(node, context) {
  16688. let slotName = `"default"`;
  16689. let slotProps = void 0;
  16690. const nonNameProps = [];
  16691. for (let i = 0; i < node.props.length; i++) {
  16692. const p = node.props[i];
  16693. if (p.type === 6) {
  16694. if (p.value) {
  16695. if (p.name === "name") {
  16696. slotName = JSON.stringify(p.value.content);
  16697. } else {
  16698. p.name = camelize(p.name);
  16699. nonNameProps.push(p);
  16700. }
  16701. }
  16702. } else {
  16703. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  16704. if (p.exp) {
  16705. slotName = p.exp;
  16706. } else if (p.arg && p.arg.type === 4) {
  16707. const name = camelize(p.arg.content);
  16708. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  16709. }
  16710. } else {
  16711. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  16712. p.arg.content = camelize(p.arg.content);
  16713. }
  16714. nonNameProps.push(p);
  16715. }
  16716. }
  16717. }
  16718. if (nonNameProps.length > 0) {
  16719. const { props, directives } = buildProps(
  16720. node,
  16721. context,
  16722. nonNameProps,
  16723. false,
  16724. false
  16725. );
  16726. slotProps = props;
  16727. if (directives.length) {
  16728. context.onError(
  16729. createCompilerError(
  16730. 36,
  16731. directives[0].loc
  16732. )
  16733. );
  16734. }
  16735. }
  16736. return {
  16737. slotName,
  16738. slotProps
  16739. };
  16740. }
  16741. const transformOn$1 = (dir, node, context, augmentor) => {
  16742. const { loc, modifiers, arg } = dir;
  16743. if (!dir.exp && !modifiers.length) {
  16744. context.onError(createCompilerError(35, loc));
  16745. }
  16746. let eventName;
  16747. if (arg.type === 4) {
  16748. if (arg.isStatic) {
  16749. let rawName = arg.content;
  16750. if (rawName.startsWith("vnode")) {
  16751. context.onError(createCompilerError(51, arg.loc));
  16752. }
  16753. if (rawName.startsWith("vue:")) {
  16754. rawName = `vnode-${rawName.slice(4)}`;
  16755. }
  16756. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  16757. // for non-element and vnode lifecycle event listeners, auto convert
  16758. // it to camelCase. See issue #2249
  16759. toHandlerKey(camelize(rawName))
  16760. ) : (
  16761. // preserve case for plain element listeners that have uppercase
  16762. // letters, as these may be custom elements' custom events
  16763. `on:${rawName}`
  16764. );
  16765. eventName = createSimpleExpression(eventString, true, arg.loc);
  16766. } else {
  16767. eventName = createCompoundExpression([
  16768. `${context.helperString(TO_HANDLER_KEY)}(`,
  16769. arg,
  16770. `)`
  16771. ]);
  16772. }
  16773. } else {
  16774. eventName = arg;
  16775. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  16776. eventName.children.push(`)`);
  16777. }
  16778. let exp = dir.exp;
  16779. if (exp && !exp.content.trim()) {
  16780. exp = void 0;
  16781. }
  16782. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  16783. if (exp) {
  16784. const isMemberExp = isMemberExpression(exp);
  16785. const isInlineStatement = !(isMemberExp || isFnExpression(exp));
  16786. const hasMultipleStatements = exp.content.includes(`;`);
  16787. {
  16788. validateBrowserExpression(
  16789. exp,
  16790. context,
  16791. false,
  16792. hasMultipleStatements
  16793. );
  16794. }
  16795. if (isInlineStatement || shouldCache && isMemberExp) {
  16796. exp = createCompoundExpression([
  16797. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  16798. exp,
  16799. hasMultipleStatements ? `}` : `)`
  16800. ]);
  16801. }
  16802. }
  16803. let ret = {
  16804. props: [
  16805. createObjectProperty(
  16806. eventName,
  16807. exp || createSimpleExpression(`() => {}`, false, loc)
  16808. )
  16809. ]
  16810. };
  16811. if (augmentor) {
  16812. ret = augmentor(ret);
  16813. }
  16814. if (shouldCache) {
  16815. ret.props[0].value = context.cache(ret.props[0].value);
  16816. }
  16817. ret.props.forEach((p) => p.key.isHandlerKey = true);
  16818. return ret;
  16819. };
  16820. const transformText = (node, context) => {
  16821. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  16822. return () => {
  16823. const children = node.children;
  16824. let currentContainer = void 0;
  16825. let hasText = false;
  16826. for (let i = 0; i < children.length; i++) {
  16827. const child = children[i];
  16828. if (isText$1(child)) {
  16829. hasText = true;
  16830. for (let j = i + 1; j < children.length; j++) {
  16831. const next = children[j];
  16832. if (isText$1(next)) {
  16833. if (!currentContainer) {
  16834. currentContainer = children[i] = createCompoundExpression(
  16835. [child],
  16836. child.loc
  16837. );
  16838. }
  16839. currentContainer.children.push(` + `, next);
  16840. children.splice(j, 1);
  16841. j--;
  16842. } else {
  16843. currentContainer = void 0;
  16844. break;
  16845. }
  16846. }
  16847. }
  16848. }
  16849. if (!hasText || // if this is a plain element with a single text child, leave it
  16850. // as-is since the runtime has dedicated fast path for this by directly
  16851. // setting textContent of the element.
  16852. // for component root it's always normalized anyway.
  16853. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  16854. // custom directives can potentially add DOM elements arbitrarily,
  16855. // we need to avoid setting textContent of the element at runtime
  16856. // to avoid accidentally overwriting the DOM elements added
  16857. // by the user through custom directives.
  16858. !node.props.find(
  16859. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  16860. ) && // in compat mode, <template> tags with no special directives
  16861. // will be rendered as a fragment so its children must be
  16862. // converted into vnodes.
  16863. true)) {
  16864. return;
  16865. }
  16866. for (let i = 0; i < children.length; i++) {
  16867. const child = children[i];
  16868. if (isText$1(child) || child.type === 8) {
  16869. const callArgs = [];
  16870. if (child.type !== 2 || child.content !== " ") {
  16871. callArgs.push(child);
  16872. }
  16873. if (!context.ssr && getConstantType(child, context) === 0) {
  16874. callArgs.push(
  16875. 1 + (` /* ${PatchFlagNames[1]} */` )
  16876. );
  16877. }
  16878. children[i] = {
  16879. type: 12,
  16880. content: child,
  16881. loc: child.loc,
  16882. codegenNode: createCallExpression(
  16883. context.helper(CREATE_TEXT),
  16884. callArgs
  16885. )
  16886. };
  16887. }
  16888. }
  16889. };
  16890. }
  16891. };
  16892. const seen$1 = /* @__PURE__ */ new WeakSet();
  16893. const transformOnce = (node, context) => {
  16894. if (node.type === 1 && findDir(node, "once", true)) {
  16895. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  16896. return;
  16897. }
  16898. seen$1.add(node);
  16899. context.inVOnce = true;
  16900. context.helper(SET_BLOCK_TRACKING);
  16901. return () => {
  16902. context.inVOnce = false;
  16903. const cur = context.currentNode;
  16904. if (cur.codegenNode) {
  16905. cur.codegenNode = context.cache(
  16906. cur.codegenNode,
  16907. true
  16908. /* isVNode */
  16909. );
  16910. }
  16911. };
  16912. }
  16913. };
  16914. const transformModel$1 = (dir, node, context) => {
  16915. const { exp, arg } = dir;
  16916. if (!exp) {
  16917. context.onError(
  16918. createCompilerError(41, dir.loc)
  16919. );
  16920. return createTransformProps();
  16921. }
  16922. const rawExp = exp.loc.source.trim();
  16923. const expString = exp.type === 4 ? exp.content : rawExp;
  16924. const bindingType = context.bindingMetadata[rawExp];
  16925. if (bindingType === "props" || bindingType === "props-aliased") {
  16926. context.onError(createCompilerError(44, exp.loc));
  16927. return createTransformProps();
  16928. }
  16929. const maybeRef = false;
  16930. if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
  16931. context.onError(
  16932. createCompilerError(42, exp.loc)
  16933. );
  16934. return createTransformProps();
  16935. }
  16936. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  16937. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  16938. let assignmentExp;
  16939. const eventArg = context.isTS ? `($event: any)` : `$event`;
  16940. {
  16941. assignmentExp = createCompoundExpression([
  16942. `${eventArg} => ((`,
  16943. exp,
  16944. `) = $event)`
  16945. ]);
  16946. }
  16947. const props = [
  16948. // modelValue: foo
  16949. createObjectProperty(propName, dir.exp),
  16950. // "onUpdate:modelValue": $event => (foo = $event)
  16951. createObjectProperty(eventName, assignmentExp)
  16952. ];
  16953. if (dir.modifiers.length && node.tagType === 1) {
  16954. const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  16955. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  16956. props.push(
  16957. createObjectProperty(
  16958. modifiersKey,
  16959. createSimpleExpression(
  16960. `{ ${modifiers} }`,
  16961. false,
  16962. dir.loc,
  16963. 2
  16964. )
  16965. )
  16966. );
  16967. }
  16968. return createTransformProps(props);
  16969. };
  16970. function createTransformProps(props = []) {
  16971. return { props };
  16972. }
  16973. const seen = /* @__PURE__ */ new WeakSet();
  16974. const transformMemo = (node, context) => {
  16975. if (node.type === 1) {
  16976. const dir = findDir(node, "memo");
  16977. if (!dir || seen.has(node)) {
  16978. return;
  16979. }
  16980. seen.add(node);
  16981. return () => {
  16982. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  16983. if (codegenNode && codegenNode.type === 13) {
  16984. if (node.tagType !== 1) {
  16985. convertToBlock(codegenNode, context);
  16986. }
  16987. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  16988. dir.exp,
  16989. createFunctionExpression(void 0, codegenNode),
  16990. `_cache`,
  16991. String(context.cached.length)
  16992. ]);
  16993. context.cached.push(null);
  16994. }
  16995. };
  16996. }
  16997. };
  16998. function getBaseTransformPreset(prefixIdentifiers) {
  16999. return [
  17000. [
  17001. transformOnce,
  17002. transformIf,
  17003. transformMemo,
  17004. transformFor,
  17005. ...[],
  17006. ...[transformExpression] ,
  17007. transformSlotOutlet,
  17008. transformElement,
  17009. trackSlotScopes,
  17010. transformText
  17011. ],
  17012. {
  17013. on: transformOn$1,
  17014. bind: transformBind,
  17015. model: transformModel$1
  17016. }
  17017. ];
  17018. }
  17019. function baseCompile(source, options = {}) {
  17020. const onError = options.onError || defaultOnError;
  17021. const isModuleMode = options.mode === "module";
  17022. {
  17023. if (options.prefixIdentifiers === true) {
  17024. onError(createCompilerError(47));
  17025. } else if (isModuleMode) {
  17026. onError(createCompilerError(48));
  17027. }
  17028. }
  17029. const prefixIdentifiers = false;
  17030. if (options.cacheHandlers) {
  17031. onError(createCompilerError(49));
  17032. }
  17033. if (options.scopeId && !isModuleMode) {
  17034. onError(createCompilerError(50));
  17035. }
  17036. const resolvedOptions = extend({}, options, {
  17037. prefixIdentifiers
  17038. });
  17039. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  17040. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  17041. transform(
  17042. ast,
  17043. extend({}, resolvedOptions, {
  17044. nodeTransforms: [
  17045. ...nodeTransforms,
  17046. ...options.nodeTransforms || []
  17047. // user transforms
  17048. ],
  17049. directiveTransforms: extend(
  17050. {},
  17051. directiveTransforms,
  17052. options.directiveTransforms || {}
  17053. // user transforms
  17054. )
  17055. })
  17056. );
  17057. return generate(ast, resolvedOptions);
  17058. }
  17059. const noopDirectiveTransform = () => ({ props: [] });
  17060. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  17061. const V_MODEL_CHECKBOX = Symbol(
  17062. `vModelCheckbox`
  17063. );
  17064. const V_MODEL_TEXT = Symbol(`vModelText` );
  17065. const V_MODEL_SELECT = Symbol(
  17066. `vModelSelect`
  17067. );
  17068. const V_MODEL_DYNAMIC = Symbol(
  17069. `vModelDynamic`
  17070. );
  17071. const V_ON_WITH_MODIFIERS = Symbol(
  17072. `vOnModifiersGuard`
  17073. );
  17074. const V_ON_WITH_KEYS = Symbol(
  17075. `vOnKeysGuard`
  17076. );
  17077. const V_SHOW = Symbol(`vShow` );
  17078. const TRANSITION = Symbol(`Transition` );
  17079. const TRANSITION_GROUP = Symbol(
  17080. `TransitionGroup`
  17081. );
  17082. registerRuntimeHelpers({
  17083. [V_MODEL_RADIO]: `vModelRadio`,
  17084. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  17085. [V_MODEL_TEXT]: `vModelText`,
  17086. [V_MODEL_SELECT]: `vModelSelect`,
  17087. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  17088. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  17089. [V_ON_WITH_KEYS]: `withKeys`,
  17090. [V_SHOW]: `vShow`,
  17091. [TRANSITION]: `Transition`,
  17092. [TRANSITION_GROUP]: `TransitionGroup`
  17093. });
  17094. let decoder;
  17095. function decodeHtmlBrowser(raw, asAttr = false) {
  17096. if (!decoder) {
  17097. decoder = document.createElement("div");
  17098. }
  17099. if (asAttr) {
  17100. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  17101. return decoder.children[0].getAttribute("foo");
  17102. } else {
  17103. decoder.innerHTML = raw;
  17104. return decoder.textContent;
  17105. }
  17106. }
  17107. const parserOptions = {
  17108. parseMode: "html",
  17109. isVoidTag,
  17110. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  17111. isPreTag: (tag) => tag === "pre",
  17112. isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
  17113. decodeEntities: decodeHtmlBrowser ,
  17114. isBuiltInComponent: (tag) => {
  17115. if (tag === "Transition" || tag === "transition") {
  17116. return TRANSITION;
  17117. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  17118. return TRANSITION_GROUP;
  17119. }
  17120. },
  17121. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  17122. getNamespace(tag, parent, rootNamespace) {
  17123. let ns = parent ? parent.ns : rootNamespace;
  17124. if (parent && ns === 2) {
  17125. if (parent.tag === "annotation-xml") {
  17126. if (tag === "svg") {
  17127. return 1;
  17128. }
  17129. if (parent.props.some(
  17130. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  17131. )) {
  17132. ns = 0;
  17133. }
  17134. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  17135. ns = 0;
  17136. }
  17137. } else if (parent && ns === 1) {
  17138. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  17139. ns = 0;
  17140. }
  17141. }
  17142. if (ns === 0) {
  17143. if (tag === "svg") {
  17144. return 1;
  17145. }
  17146. if (tag === "math") {
  17147. return 2;
  17148. }
  17149. }
  17150. return ns;
  17151. }
  17152. };
  17153. const transformStyle = (node) => {
  17154. if (node.type === 1) {
  17155. node.props.forEach((p, i) => {
  17156. if (p.type === 6 && p.name === "style" && p.value) {
  17157. node.props[i] = {
  17158. type: 7,
  17159. name: `bind`,
  17160. arg: createSimpleExpression(`style`, true, p.loc),
  17161. exp: parseInlineCSS(p.value.content, p.loc),
  17162. modifiers: [],
  17163. loc: p.loc
  17164. };
  17165. }
  17166. });
  17167. }
  17168. };
  17169. const parseInlineCSS = (cssText, loc) => {
  17170. const normalized = parseStringStyle(cssText);
  17171. return createSimpleExpression(
  17172. JSON.stringify(normalized),
  17173. false,
  17174. loc,
  17175. 3
  17176. );
  17177. };
  17178. function createDOMCompilerError(code, loc) {
  17179. return createCompilerError(
  17180. code,
  17181. loc,
  17182. DOMErrorMessages
  17183. );
  17184. }
  17185. const DOMErrorMessages = {
  17186. [53]: `v-html is missing expression.`,
  17187. [54]: `v-html will override element children.`,
  17188. [55]: `v-text is missing expression.`,
  17189. [56]: `v-text will override element children.`,
  17190. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  17191. [58]: `v-model argument is not supported on plain elements.`,
  17192. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  17193. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  17194. [61]: `v-show is missing expression.`,
  17195. [62]: `<Transition> expects exactly one child element or component.`,
  17196. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  17197. };
  17198. const transformVHtml = (dir, node, context) => {
  17199. const { exp, loc } = dir;
  17200. if (!exp) {
  17201. context.onError(
  17202. createDOMCompilerError(53, loc)
  17203. );
  17204. }
  17205. if (node.children.length) {
  17206. context.onError(
  17207. createDOMCompilerError(54, loc)
  17208. );
  17209. node.children.length = 0;
  17210. }
  17211. return {
  17212. props: [
  17213. createObjectProperty(
  17214. createSimpleExpression(`innerHTML`, true, loc),
  17215. exp || createSimpleExpression("", true)
  17216. )
  17217. ]
  17218. };
  17219. };
  17220. const transformVText = (dir, node, context) => {
  17221. const { exp, loc } = dir;
  17222. if (!exp) {
  17223. context.onError(
  17224. createDOMCompilerError(55, loc)
  17225. );
  17226. }
  17227. if (node.children.length) {
  17228. context.onError(
  17229. createDOMCompilerError(56, loc)
  17230. );
  17231. node.children.length = 0;
  17232. }
  17233. return {
  17234. props: [
  17235. createObjectProperty(
  17236. createSimpleExpression(`textContent`, true),
  17237. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  17238. context.helperString(TO_DISPLAY_STRING),
  17239. [exp],
  17240. loc
  17241. ) : createSimpleExpression("", true)
  17242. )
  17243. ]
  17244. };
  17245. };
  17246. const transformModel = (dir, node, context) => {
  17247. const baseResult = transformModel$1(dir, node, context);
  17248. if (!baseResult.props.length || node.tagType === 1) {
  17249. return baseResult;
  17250. }
  17251. if (dir.arg) {
  17252. context.onError(
  17253. createDOMCompilerError(
  17254. 58,
  17255. dir.arg.loc
  17256. )
  17257. );
  17258. }
  17259. function checkDuplicatedValue() {
  17260. const value = findDir(node, "bind");
  17261. if (value && isStaticArgOf(value.arg, "value")) {
  17262. context.onError(
  17263. createDOMCompilerError(
  17264. 60,
  17265. value.loc
  17266. )
  17267. );
  17268. }
  17269. }
  17270. const { tag } = node;
  17271. const isCustomElement = context.isCustomElement(tag);
  17272. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  17273. let directiveToUse = V_MODEL_TEXT;
  17274. let isInvalidType = false;
  17275. if (tag === "input" || isCustomElement) {
  17276. const type = findProp(node, `type`);
  17277. if (type) {
  17278. if (type.type === 7) {
  17279. directiveToUse = V_MODEL_DYNAMIC;
  17280. } else if (type.value) {
  17281. switch (type.value.content) {
  17282. case "radio":
  17283. directiveToUse = V_MODEL_RADIO;
  17284. break;
  17285. case "checkbox":
  17286. directiveToUse = V_MODEL_CHECKBOX;
  17287. break;
  17288. case "file":
  17289. isInvalidType = true;
  17290. context.onError(
  17291. createDOMCompilerError(
  17292. 59,
  17293. dir.loc
  17294. )
  17295. );
  17296. break;
  17297. default:
  17298. checkDuplicatedValue();
  17299. break;
  17300. }
  17301. }
  17302. } else if (hasDynamicKeyVBind(node)) {
  17303. directiveToUse = V_MODEL_DYNAMIC;
  17304. } else {
  17305. checkDuplicatedValue();
  17306. }
  17307. } else if (tag === "select") {
  17308. directiveToUse = V_MODEL_SELECT;
  17309. } else {
  17310. checkDuplicatedValue();
  17311. }
  17312. if (!isInvalidType) {
  17313. baseResult.needRuntime = context.helper(directiveToUse);
  17314. }
  17315. } else {
  17316. context.onError(
  17317. createDOMCompilerError(
  17318. 57,
  17319. dir.loc
  17320. )
  17321. );
  17322. }
  17323. baseResult.props = baseResult.props.filter(
  17324. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  17325. );
  17326. return baseResult;
  17327. };
  17328. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  17329. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  17330. // event propagation management
  17331. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  17332. );
  17333. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  17334. const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
  17335. const resolveModifiers = (key, modifiers, context, loc) => {
  17336. const keyModifiers = [];
  17337. const nonKeyModifiers = [];
  17338. const eventOptionModifiers = [];
  17339. for (let i = 0; i < modifiers.length; i++) {
  17340. const modifier = modifiers[i].content;
  17341. if (isEventOptionModifier(modifier)) {
  17342. eventOptionModifiers.push(modifier);
  17343. } else {
  17344. if (maybeKeyModifier(modifier)) {
  17345. if (isStaticExp(key)) {
  17346. if (isKeyboardEvent(key.content.toLowerCase())) {
  17347. keyModifiers.push(modifier);
  17348. } else {
  17349. nonKeyModifiers.push(modifier);
  17350. }
  17351. } else {
  17352. keyModifiers.push(modifier);
  17353. nonKeyModifiers.push(modifier);
  17354. }
  17355. } else {
  17356. if (isNonKeyModifier(modifier)) {
  17357. nonKeyModifiers.push(modifier);
  17358. } else {
  17359. keyModifiers.push(modifier);
  17360. }
  17361. }
  17362. }
  17363. }
  17364. return {
  17365. keyModifiers,
  17366. nonKeyModifiers,
  17367. eventOptionModifiers
  17368. };
  17369. };
  17370. const transformClick = (key, event) => {
  17371. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  17372. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  17373. `(`,
  17374. key,
  17375. `) === "onClick" ? "${event}" : (`,
  17376. key,
  17377. `)`
  17378. ]) : key;
  17379. };
  17380. const transformOn = (dir, node, context) => {
  17381. return transformOn$1(dir, node, context, (baseResult) => {
  17382. const { modifiers } = dir;
  17383. if (!modifiers.length) return baseResult;
  17384. let { key, value: handlerExp } = baseResult.props[0];
  17385. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  17386. if (nonKeyModifiers.includes("right")) {
  17387. key = transformClick(key, `onContextmenu`);
  17388. }
  17389. if (nonKeyModifiers.includes("middle")) {
  17390. key = transformClick(key, `onMouseup`);
  17391. }
  17392. if (nonKeyModifiers.length) {
  17393. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  17394. handlerExp,
  17395. JSON.stringify(nonKeyModifiers)
  17396. ]);
  17397. }
  17398. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  17399. (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
  17400. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  17401. handlerExp,
  17402. JSON.stringify(keyModifiers)
  17403. ]);
  17404. }
  17405. if (eventOptionModifiers.length) {
  17406. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  17407. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  17408. }
  17409. return {
  17410. props: [createObjectProperty(key, handlerExp)]
  17411. };
  17412. });
  17413. };
  17414. const transformShow = (dir, node, context) => {
  17415. const { exp, loc } = dir;
  17416. if (!exp) {
  17417. context.onError(
  17418. createDOMCompilerError(61, loc)
  17419. );
  17420. }
  17421. return {
  17422. props: [],
  17423. needRuntime: context.helper(V_SHOW)
  17424. };
  17425. };
  17426. const transformTransition = (node, context) => {
  17427. if (node.type === 1 && node.tagType === 1) {
  17428. const component = context.isBuiltInComponent(node.tag);
  17429. if (component === TRANSITION) {
  17430. return () => {
  17431. if (!node.children.length) {
  17432. return;
  17433. }
  17434. if (hasMultipleChildren(node)) {
  17435. context.onError(
  17436. createDOMCompilerError(
  17437. 62,
  17438. {
  17439. start: node.children[0].loc.start,
  17440. end: node.children[node.children.length - 1].loc.end,
  17441. source: ""
  17442. }
  17443. )
  17444. );
  17445. }
  17446. const child = node.children[0];
  17447. if (child.type === 1) {
  17448. for (const p of child.props) {
  17449. if (p.type === 7 && p.name === "show") {
  17450. node.props.push({
  17451. type: 6,
  17452. name: "persisted",
  17453. nameLoc: node.loc,
  17454. value: void 0,
  17455. loc: node.loc
  17456. });
  17457. }
  17458. }
  17459. }
  17460. };
  17461. }
  17462. }
  17463. };
  17464. function hasMultipleChildren(node) {
  17465. const children = node.children = node.children.filter(
  17466. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  17467. );
  17468. const child = children[0];
  17469. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  17470. }
  17471. const ignoreSideEffectTags = (node, context) => {
  17472. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  17473. context.onError(
  17474. createDOMCompilerError(
  17475. 63,
  17476. node.loc
  17477. )
  17478. );
  17479. context.removeNode();
  17480. }
  17481. };
  17482. function isValidHTMLNesting(parent, child) {
  17483. if (parent in onlyValidChildren) {
  17484. return onlyValidChildren[parent].has(child);
  17485. }
  17486. if (child in onlyValidParents) {
  17487. return onlyValidParents[child].has(parent);
  17488. }
  17489. if (parent in knownInvalidChildren) {
  17490. if (knownInvalidChildren[parent].has(child)) return false;
  17491. }
  17492. if (child in knownInvalidParents) {
  17493. if (knownInvalidParents[child].has(parent)) return false;
  17494. }
  17495. return true;
  17496. }
  17497. const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
  17498. const emptySet = /* @__PURE__ */ new Set([]);
  17499. const onlyValidChildren = {
  17500. head: /* @__PURE__ */ new Set([
  17501. "base",
  17502. "basefront",
  17503. "bgsound",
  17504. "link",
  17505. "meta",
  17506. "title",
  17507. "noscript",
  17508. "noframes",
  17509. "style",
  17510. "script",
  17511. "template"
  17512. ]),
  17513. optgroup: /* @__PURE__ */ new Set(["option"]),
  17514. select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
  17515. // table
  17516. table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
  17517. tr: /* @__PURE__ */ new Set(["td", "th"]),
  17518. colgroup: /* @__PURE__ */ new Set(["col"]),
  17519. tbody: /* @__PURE__ */ new Set(["tr"]),
  17520. thead: /* @__PURE__ */ new Set(["tr"]),
  17521. tfoot: /* @__PURE__ */ new Set(["tr"]),
  17522. // these elements can not have any children elements
  17523. script: emptySet,
  17524. iframe: emptySet,
  17525. option: emptySet,
  17526. textarea: emptySet,
  17527. style: emptySet,
  17528. title: emptySet
  17529. };
  17530. const onlyValidParents = {
  17531. // sections
  17532. html: emptySet,
  17533. body: /* @__PURE__ */ new Set(["html"]),
  17534. head: /* @__PURE__ */ new Set(["html"]),
  17535. // table
  17536. td: /* @__PURE__ */ new Set(["tr"]),
  17537. colgroup: /* @__PURE__ */ new Set(["table"]),
  17538. caption: /* @__PURE__ */ new Set(["table"]),
  17539. tbody: /* @__PURE__ */ new Set(["table"]),
  17540. tfoot: /* @__PURE__ */ new Set(["table"]),
  17541. col: /* @__PURE__ */ new Set(["colgroup"]),
  17542. th: /* @__PURE__ */ new Set(["tr"]),
  17543. thead: /* @__PURE__ */ new Set(["table"]),
  17544. tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
  17545. // data list
  17546. dd: /* @__PURE__ */ new Set(["dl", "div"]),
  17547. dt: /* @__PURE__ */ new Set(["dl", "div"]),
  17548. // other
  17549. figcaption: /* @__PURE__ */ new Set(["figure"]),
  17550. // li: new Set(["ul", "ol"]),
  17551. summary: /* @__PURE__ */ new Set(["details"]),
  17552. area: /* @__PURE__ */ new Set(["map"])
  17553. };
  17554. const knownInvalidChildren = {
  17555. p: /* @__PURE__ */ new Set([
  17556. "address",
  17557. "article",
  17558. "aside",
  17559. "blockquote",
  17560. "center",
  17561. "details",
  17562. "dialog",
  17563. "dir",
  17564. "div",
  17565. "dl",
  17566. "fieldset",
  17567. "figure",
  17568. "footer",
  17569. "form",
  17570. "h1",
  17571. "h2",
  17572. "h3",
  17573. "h4",
  17574. "h5",
  17575. "h6",
  17576. "header",
  17577. "hgroup",
  17578. "hr",
  17579. "li",
  17580. "main",
  17581. "nav",
  17582. "menu",
  17583. "ol",
  17584. "p",
  17585. "pre",
  17586. "section",
  17587. "table",
  17588. "ul"
  17589. ]),
  17590. svg: /* @__PURE__ */ new Set([
  17591. "b",
  17592. "blockquote",
  17593. "br",
  17594. "code",
  17595. "dd",
  17596. "div",
  17597. "dl",
  17598. "dt",
  17599. "em",
  17600. "embed",
  17601. "h1",
  17602. "h2",
  17603. "h3",
  17604. "h4",
  17605. "h5",
  17606. "h6",
  17607. "hr",
  17608. "i",
  17609. "img",
  17610. "li",
  17611. "menu",
  17612. "meta",
  17613. "ol",
  17614. "p",
  17615. "pre",
  17616. "ruby",
  17617. "s",
  17618. "small",
  17619. "span",
  17620. "strong",
  17621. "sub",
  17622. "sup",
  17623. "table",
  17624. "u",
  17625. "ul",
  17626. "var"
  17627. ])
  17628. };
  17629. const knownInvalidParents = {
  17630. a: /* @__PURE__ */ new Set(["a"]),
  17631. button: /* @__PURE__ */ new Set(["button"]),
  17632. dd: /* @__PURE__ */ new Set(["dd", "dt"]),
  17633. dt: /* @__PURE__ */ new Set(["dd", "dt"]),
  17634. form: /* @__PURE__ */ new Set(["form"]),
  17635. li: /* @__PURE__ */ new Set(["li"]),
  17636. h1: headings,
  17637. h2: headings,
  17638. h3: headings,
  17639. h4: headings,
  17640. h5: headings,
  17641. h6: headings
  17642. };
  17643. const validateHtmlNesting = (node, context) => {
  17644. if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
  17645. const error = new SyntaxError(
  17646. `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
  17647. );
  17648. error.loc = node.loc;
  17649. context.onWarn(error);
  17650. }
  17651. };
  17652. const DOMNodeTransforms = [
  17653. transformStyle,
  17654. ...[transformTransition, validateHtmlNesting]
  17655. ];
  17656. const DOMDirectiveTransforms = {
  17657. cloak: noopDirectiveTransform,
  17658. html: transformVHtml,
  17659. text: transformVText,
  17660. model: transformModel,
  17661. // override compiler-core
  17662. on: transformOn,
  17663. // override compiler-core
  17664. show: transformShow
  17665. };
  17666. function compile(src, options = {}) {
  17667. return baseCompile(
  17668. src,
  17669. extend({}, parserOptions, options, {
  17670. nodeTransforms: [
  17671. // ignore <script> and <tag>
  17672. // this is not put inside DOMNodeTransforms because that list is used
  17673. // by compiler-ssr to generate vnode fallback branches
  17674. ignoreSideEffectTags,
  17675. ...DOMNodeTransforms,
  17676. ...options.nodeTransforms || []
  17677. ],
  17678. directiveTransforms: extend(
  17679. {},
  17680. DOMDirectiveTransforms,
  17681. options.directiveTransforms || {}
  17682. ),
  17683. transformHoist: null
  17684. })
  17685. );
  17686. }
  17687. {
  17688. initDev();
  17689. }
  17690. const compileCache = /* @__PURE__ */ Object.create(null);
  17691. function compileToFunction(template, options) {
  17692. if (!isString(template)) {
  17693. if (template.nodeType) {
  17694. template = template.innerHTML;
  17695. } else {
  17696. warn(`invalid template option: `, template);
  17697. return NOOP;
  17698. }
  17699. }
  17700. const key = genCacheKey(template, options);
  17701. const cached = compileCache[key];
  17702. if (cached) {
  17703. return cached;
  17704. }
  17705. if (template[0] === "#") {
  17706. const el = document.querySelector(template);
  17707. if (!el) {
  17708. warn(`Template element not found or is empty: ${template}`);
  17709. }
  17710. template = el ? el.innerHTML : ``;
  17711. }
  17712. const opts = extend(
  17713. {
  17714. hoistStatic: true,
  17715. onError: onError ,
  17716. onWarn: (e) => onError(e, true)
  17717. },
  17718. options
  17719. );
  17720. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  17721. opts.isCustomElement = (tag) => !!customElements.get(tag);
  17722. }
  17723. const { code } = compile(template, opts);
  17724. function onError(err, asWarning = false) {
  17725. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  17726. const codeFrame = err.loc && generateCodeFrame(
  17727. template,
  17728. err.loc.start.offset,
  17729. err.loc.end.offset
  17730. );
  17731. warn(codeFrame ? `${message}
  17732. ${codeFrame}` : message);
  17733. }
  17734. const render = new Function(code)() ;
  17735. render._rc = true;
  17736. return compileCache[key] = render;
  17737. }
  17738. registerRuntimeCompiler(compileToFunction);
  17739. exports.BaseTransition = BaseTransition;
  17740. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  17741. exports.Comment = Comment;
  17742. exports.DeprecationTypes = DeprecationTypes;
  17743. exports.EffectScope = EffectScope;
  17744. exports.ErrorCodes = ErrorCodes;
  17745. exports.ErrorTypeStrings = ErrorTypeStrings;
  17746. exports.Fragment = Fragment;
  17747. exports.KeepAlive = KeepAlive;
  17748. exports.ReactiveEffect = ReactiveEffect;
  17749. exports.Static = Static;
  17750. exports.Suspense = Suspense;
  17751. exports.Teleport = Teleport;
  17752. exports.Text = Text;
  17753. exports.TrackOpTypes = TrackOpTypes;
  17754. exports.Transition = Transition;
  17755. exports.TransitionGroup = TransitionGroup;
  17756. exports.TriggerOpTypes = TriggerOpTypes;
  17757. exports.VueElement = VueElement;
  17758. exports.assertNumber = assertNumber;
  17759. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  17760. exports.callWithErrorHandling = callWithErrorHandling;
  17761. exports.camelize = camelize;
  17762. exports.capitalize = capitalize;
  17763. exports.cloneVNode = cloneVNode;
  17764. exports.compatUtils = compatUtils;
  17765. exports.compile = compileToFunction;
  17766. exports.computed = computed;
  17767. exports.createApp = createApp;
  17768. exports.createBlock = createBlock;
  17769. exports.createCommentVNode = createCommentVNode;
  17770. exports.createElementBlock = createElementBlock;
  17771. exports.createElementVNode = createBaseVNode;
  17772. exports.createHydrationRenderer = createHydrationRenderer;
  17773. exports.createPropsRestProxy = createPropsRestProxy;
  17774. exports.createRenderer = createRenderer;
  17775. exports.createSSRApp = createSSRApp;
  17776. exports.createSlots = createSlots;
  17777. exports.createStaticVNode = createStaticVNode;
  17778. exports.createTextVNode = createTextVNode;
  17779. exports.createVNode = createVNode;
  17780. exports.customRef = customRef;
  17781. exports.defineAsyncComponent = defineAsyncComponent;
  17782. exports.defineComponent = defineComponent;
  17783. exports.defineCustomElement = defineCustomElement;
  17784. exports.defineEmits = defineEmits;
  17785. exports.defineExpose = defineExpose;
  17786. exports.defineModel = defineModel;
  17787. exports.defineOptions = defineOptions;
  17788. exports.defineProps = defineProps;
  17789. exports.defineSSRCustomElement = defineSSRCustomElement;
  17790. exports.defineSlots = defineSlots;
  17791. exports.devtools = devtools;
  17792. exports.effect = effect;
  17793. exports.effectScope = effectScope;
  17794. exports.getCurrentInstance = getCurrentInstance;
  17795. exports.getCurrentScope = getCurrentScope;
  17796. exports.getCurrentWatcher = getCurrentWatcher;
  17797. exports.getTransitionRawChildren = getTransitionRawChildren;
  17798. exports.guardReactiveProps = guardReactiveProps;
  17799. exports.h = h;
  17800. exports.handleError = handleError;
  17801. exports.hasInjectionContext = hasInjectionContext;
  17802. exports.hydrate = hydrate;
  17803. exports.hydrateOnIdle = hydrateOnIdle;
  17804. exports.hydrateOnInteraction = hydrateOnInteraction;
  17805. exports.hydrateOnMediaQuery = hydrateOnMediaQuery;
  17806. exports.hydrateOnVisible = hydrateOnVisible;
  17807. exports.initCustomFormatter = initCustomFormatter;
  17808. exports.initDirectivesForSSR = initDirectivesForSSR;
  17809. exports.inject = inject;
  17810. exports.isMemoSame = isMemoSame;
  17811. exports.isProxy = isProxy;
  17812. exports.isReactive = isReactive;
  17813. exports.isReadonly = isReadonly;
  17814. exports.isRef = isRef;
  17815. exports.isRuntimeOnly = isRuntimeOnly;
  17816. exports.isShallow = isShallow;
  17817. exports.isVNode = isVNode;
  17818. exports.markRaw = markRaw;
  17819. exports.mergeDefaults = mergeDefaults;
  17820. exports.mergeModels = mergeModels;
  17821. exports.mergeProps = mergeProps;
  17822. exports.nextTick = nextTick;
  17823. exports.normalizeClass = normalizeClass;
  17824. exports.normalizeProps = normalizeProps;
  17825. exports.normalizeStyle = normalizeStyle;
  17826. exports.onActivated = onActivated;
  17827. exports.onBeforeMount = onBeforeMount;
  17828. exports.onBeforeUnmount = onBeforeUnmount;
  17829. exports.onBeforeUpdate = onBeforeUpdate;
  17830. exports.onDeactivated = onDeactivated;
  17831. exports.onErrorCaptured = onErrorCaptured;
  17832. exports.onMounted = onMounted;
  17833. exports.onRenderTracked = onRenderTracked;
  17834. exports.onRenderTriggered = onRenderTriggered;
  17835. exports.onScopeDispose = onScopeDispose;
  17836. exports.onServerPrefetch = onServerPrefetch;
  17837. exports.onUnmounted = onUnmounted;
  17838. exports.onUpdated = onUpdated;
  17839. exports.onWatcherCleanup = onWatcherCleanup;
  17840. exports.openBlock = openBlock;
  17841. exports.popScopeId = popScopeId;
  17842. exports.provide = provide;
  17843. exports.proxyRefs = proxyRefs;
  17844. exports.pushScopeId = pushScopeId;
  17845. exports.queuePostFlushCb = queuePostFlushCb;
  17846. exports.reactive = reactive;
  17847. exports.readonly = readonly;
  17848. exports.ref = ref;
  17849. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  17850. exports.render = render;
  17851. exports.renderList = renderList;
  17852. exports.renderSlot = renderSlot;
  17853. exports.resolveComponent = resolveComponent;
  17854. exports.resolveDirective = resolveDirective;
  17855. exports.resolveDynamicComponent = resolveDynamicComponent;
  17856. exports.resolveFilter = resolveFilter;
  17857. exports.resolveTransitionHooks = resolveTransitionHooks;
  17858. exports.setBlockTracking = setBlockTracking;
  17859. exports.setDevtoolsHook = setDevtoolsHook;
  17860. exports.setTransitionHooks = setTransitionHooks;
  17861. exports.shallowReactive = shallowReactive;
  17862. exports.shallowReadonly = shallowReadonly;
  17863. exports.shallowRef = shallowRef;
  17864. exports.ssrContextKey = ssrContextKey;
  17865. exports.ssrUtils = ssrUtils;
  17866. exports.stop = stop;
  17867. exports.toDisplayString = toDisplayString;
  17868. exports.toHandlerKey = toHandlerKey;
  17869. exports.toHandlers = toHandlers;
  17870. exports.toRaw = toRaw;
  17871. exports.toRef = toRef;
  17872. exports.toRefs = toRefs;
  17873. exports.toValue = toValue;
  17874. exports.transformVNodeArgs = transformVNodeArgs;
  17875. exports.triggerRef = triggerRef;
  17876. exports.unref = unref;
  17877. exports.useAttrs = useAttrs;
  17878. exports.useCssModule = useCssModule;
  17879. exports.useCssVars = useCssVars;
  17880. exports.useHost = useHost;
  17881. exports.useId = useId;
  17882. exports.useModel = useModel;
  17883. exports.useSSRContext = useSSRContext;
  17884. exports.useShadowRoot = useShadowRoot;
  17885. exports.useSlots = useSlots;
  17886. exports.useTemplateRef = useTemplateRef;
  17887. exports.useTransitionState = useTransitionState;
  17888. exports.vModelCheckbox = vModelCheckbox;
  17889. exports.vModelDynamic = vModelDynamic;
  17890. exports.vModelRadio = vModelRadio;
  17891. exports.vModelSelect = vModelSelect;
  17892. exports.vModelText = vModelText;
  17893. exports.vShow = vShow;
  17894. exports.version = version;
  17895. exports.warn = warn;
  17896. exports.watch = watch;
  17897. exports.watchEffect = watchEffect;
  17898. exports.watchPostEffect = watchPostEffect;
  17899. exports.watchSyncEffect = watchSyncEffect;
  17900. exports.withAsyncContext = withAsyncContext;
  17901. exports.withCtx = withCtx;
  17902. exports.withDefaults = withDefaults;
  17903. exports.withDirectives = withDirectives;
  17904. exports.withKeys = withKeys;
  17905. exports.withMemo = withMemo;
  17906. exports.withModifiers = withModifiers;
  17907. exports.withScopeId = withScopeId;
  17908. return exports;
  17909. })({});