vue.global.js 513 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760
  1. /**
  2. * vue v3.4.38
  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, expectsLowerCase) {
  11. const set = new Set(str.split(","));
  12. return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
  13. }
  14. const EMPTY_OBJ = Object.freeze({}) ;
  15. const EMPTY_ARR = Object.freeze([]) ;
  16. const NOOP = () => {
  17. };
  18. const NO = () => false;
  19. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  20. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  21. const isModelListener = (key) => key.startsWith("onUpdate:");
  22. const extend = Object.assign;
  23. const remove = (arr, el) => {
  24. const i = arr.indexOf(el);
  25. if (i > -1) {
  26. arr.splice(i, 1);
  27. }
  28. };
  29. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  30. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  31. const isArray = Array.isArray;
  32. const isMap = (val) => toTypeString(val) === "[object Map]";
  33. const isSet = (val) => toTypeString(val) === "[object Set]";
  34. const isDate = (val) => toTypeString(val) === "[object Date]";
  35. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  36. const isFunction = (val) => typeof val === "function";
  37. const isString = (val) => typeof val === "string";
  38. const isSymbol = (val) => typeof val === "symbol";
  39. const isObject = (val) => val !== null && typeof val === "object";
  40. const isPromise = (val) => {
  41. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  42. };
  43. const objectToString = Object.prototype.toString;
  44. const toTypeString = (value) => objectToString.call(value);
  45. const toRawType = (value) => {
  46. return toTypeString(value).slice(8, -1);
  47. };
  48. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  49. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  50. const isReservedProp = /* @__PURE__ */ makeMap(
  51. // the leading comma is intentional so empty string "" is also included
  52. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  53. );
  54. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  55. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  56. );
  57. const cacheStringFunction = (fn) => {
  58. const cache = /* @__PURE__ */ Object.create(null);
  59. return (str) => {
  60. const hit = cache[str];
  61. return hit || (cache[str] = fn(str));
  62. };
  63. };
  64. const camelizeRE = /-(\w)/g;
  65. const camelize = cacheStringFunction((str) => {
  66. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  67. });
  68. const hyphenateRE = /\B([A-Z])/g;
  69. const hyphenate = cacheStringFunction(
  70. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  71. );
  72. const capitalize = cacheStringFunction((str) => {
  73. return str.charAt(0).toUpperCase() + str.slice(1);
  74. });
  75. const toHandlerKey = cacheStringFunction((str) => {
  76. const s = str ? `on${capitalize(str)}` : ``;
  77. return s;
  78. });
  79. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  80. const invokeArrayFns = (fns, ...arg) => {
  81. for (let i = 0; i < fns.length; i++) {
  82. fns[i](...arg);
  83. }
  84. };
  85. const def = (obj, key, value, writable = false) => {
  86. Object.defineProperty(obj, key, {
  87. configurable: true,
  88. enumerable: false,
  89. writable,
  90. value
  91. });
  92. };
  93. const looseToNumber = (val) => {
  94. const n = parseFloat(val);
  95. return isNaN(n) ? val : n;
  96. };
  97. const toNumber = (val) => {
  98. const n = isString(val) ? Number(val) : NaN;
  99. return isNaN(n) ? val : n;
  100. };
  101. let _globalThis;
  102. const getGlobalThis = () => {
  103. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  104. };
  105. const PatchFlagNames = {
  106. [1]: `TEXT`,
  107. [2]: `CLASS`,
  108. [4]: `STYLE`,
  109. [8]: `PROPS`,
  110. [16]: `FULL_PROPS`,
  111. [32]: `NEED_HYDRATION`,
  112. [64]: `STABLE_FRAGMENT`,
  113. [128]: `KEYED_FRAGMENT`,
  114. [256]: `UNKEYED_FRAGMENT`,
  115. [512]: `NEED_PATCH`,
  116. [1024]: `DYNAMIC_SLOTS`,
  117. [2048]: `DEV_ROOT_FRAGMENT`,
  118. [-1]: `HOISTED`,
  119. [-2]: `BAIL`
  120. };
  121. const slotFlagsText = {
  122. [1]: "STABLE",
  123. [2]: "DYNAMIC",
  124. [3]: "FORWARDED"
  125. };
  126. 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";
  127. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  128. const range = 2;
  129. function generateCodeFrame(source, start = 0, end = source.length) {
  130. start = Math.max(0, Math.min(start, source.length));
  131. end = Math.max(0, Math.min(end, source.length));
  132. if (start > end) return "";
  133. let lines = source.split(/(\r?\n)/);
  134. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  135. lines = lines.filter((_, idx) => idx % 2 === 0);
  136. let count = 0;
  137. const res = [];
  138. for (let i = 0; i < lines.length; i++) {
  139. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  140. if (count >= start) {
  141. for (let j = i - range; j <= i + range || end > count; j++) {
  142. if (j < 0 || j >= lines.length) continue;
  143. const line = j + 1;
  144. res.push(
  145. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  146. );
  147. const lineLength = lines[j].length;
  148. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  149. if (j === i) {
  150. const pad = start - (count - (lineLength + newLineSeqLength));
  151. const length = Math.max(
  152. 1,
  153. end > count ? lineLength - pad : end - start
  154. );
  155. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  156. } else if (j > i) {
  157. if (end > count) {
  158. const length = Math.max(Math.min(end - count, lineLength), 1);
  159. res.push(` | ` + "^".repeat(length));
  160. }
  161. count += lineLength + newLineSeqLength;
  162. }
  163. }
  164. break;
  165. }
  166. }
  167. return res.join("\n");
  168. }
  169. function normalizeStyle(value) {
  170. if (isArray(value)) {
  171. const res = {};
  172. for (let i = 0; i < value.length; i++) {
  173. const item = value[i];
  174. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  175. if (normalized) {
  176. for (const key in normalized) {
  177. res[key] = normalized[key];
  178. }
  179. }
  180. }
  181. return res;
  182. } else if (isString(value) || isObject(value)) {
  183. return value;
  184. }
  185. }
  186. const listDelimiterRE = /;(?![^(]*\))/g;
  187. const propertyDelimiterRE = /:([^]+)/;
  188. const styleCommentRE = /\/\*[^]*?\*\//g;
  189. function parseStringStyle(cssText) {
  190. const ret = {};
  191. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  192. if (item) {
  193. const tmp = item.split(propertyDelimiterRE);
  194. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  195. }
  196. });
  197. return ret;
  198. }
  199. function stringifyStyle(styles) {
  200. let ret = "";
  201. if (!styles || isString(styles)) {
  202. return ret;
  203. }
  204. for (const key in styles) {
  205. const value = styles[key];
  206. if (isString(value) || typeof value === "number") {
  207. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  208. ret += `${normalizedKey}:${value};`;
  209. }
  210. }
  211. return ret;
  212. }
  213. function normalizeClass(value) {
  214. let res = "";
  215. if (isString(value)) {
  216. res = value;
  217. } else if (isArray(value)) {
  218. for (let i = 0; i < value.length; i++) {
  219. const normalized = normalizeClass(value[i]);
  220. if (normalized) {
  221. res += normalized + " ";
  222. }
  223. }
  224. } else if (isObject(value)) {
  225. for (const name in value) {
  226. if (value[name]) {
  227. res += name + " ";
  228. }
  229. }
  230. }
  231. return res.trim();
  232. }
  233. function normalizeProps(props) {
  234. if (!props) return null;
  235. let { class: klass, style } = props;
  236. if (klass && !isString(klass)) {
  237. props.class = normalizeClass(klass);
  238. }
  239. if (style) {
  240. props.style = normalizeStyle(style);
  241. }
  242. return props;
  243. }
  244. 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";
  245. 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";
  246. 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";
  247. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  248. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  249. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  250. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  251. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  252. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  253. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  254. const isBooleanAttr = /* @__PURE__ */ makeMap(
  255. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  256. );
  257. function includeBooleanAttr(value) {
  258. return !!value || value === "";
  259. }
  260. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  261. `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`
  262. );
  263. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  264. `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`
  265. );
  266. function isRenderableAttrValue(value) {
  267. if (value == null) {
  268. return false;
  269. }
  270. const type = typeof value;
  271. return type === "string" || type === "number" || type === "boolean";
  272. }
  273. function looseCompareArrays(a, b) {
  274. if (a.length !== b.length) return false;
  275. let equal = true;
  276. for (let i = 0; equal && i < a.length; i++) {
  277. equal = looseEqual(a[i], b[i]);
  278. }
  279. return equal;
  280. }
  281. function looseEqual(a, b) {
  282. if (a === b) return true;
  283. let aValidType = isDate(a);
  284. let bValidType = isDate(b);
  285. if (aValidType || bValidType) {
  286. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  287. }
  288. aValidType = isSymbol(a);
  289. bValidType = isSymbol(b);
  290. if (aValidType || bValidType) {
  291. return a === b;
  292. }
  293. aValidType = isArray(a);
  294. bValidType = isArray(b);
  295. if (aValidType || bValidType) {
  296. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  297. }
  298. aValidType = isObject(a);
  299. bValidType = isObject(b);
  300. if (aValidType || bValidType) {
  301. if (!aValidType || !bValidType) {
  302. return false;
  303. }
  304. const aKeysCount = Object.keys(a).length;
  305. const bKeysCount = Object.keys(b).length;
  306. if (aKeysCount !== bKeysCount) {
  307. return false;
  308. }
  309. for (const key in a) {
  310. const aHasKey = a.hasOwnProperty(key);
  311. const bHasKey = b.hasOwnProperty(key);
  312. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  313. return false;
  314. }
  315. }
  316. }
  317. return String(a) === String(b);
  318. }
  319. function looseIndexOf(arr, val) {
  320. return arr.findIndex((item) => looseEqual(item, val));
  321. }
  322. const isRef$1 = (val) => {
  323. return !!(val && val.__v_isRef === true);
  324. };
  325. const toDisplayString = (val) => {
  326. 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);
  327. };
  328. const replacer = (_key, val) => {
  329. if (isRef$1(val)) {
  330. return replacer(_key, val.value);
  331. } else if (isMap(val)) {
  332. return {
  333. [`Map(${val.size})`]: [...val.entries()].reduce(
  334. (entries, [key, val2], i) => {
  335. entries[stringifySymbol(key, i) + " =>"] = val2;
  336. return entries;
  337. },
  338. {}
  339. )
  340. };
  341. } else if (isSet(val)) {
  342. return {
  343. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  344. };
  345. } else if (isSymbol(val)) {
  346. return stringifySymbol(val);
  347. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  348. return String(val);
  349. }
  350. return val;
  351. };
  352. const stringifySymbol = (v, i = "") => {
  353. var _a;
  354. return (
  355. // Symbol.description in es2019+ so we need to cast here to pass
  356. // the lib: es2016 check
  357. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  358. );
  359. };
  360. function warn$2(msg, ...args) {
  361. console.warn(`[Vue warn] ${msg}`, ...args);
  362. }
  363. let activeEffectScope;
  364. class EffectScope {
  365. constructor(detached = false) {
  366. this.detached = detached;
  367. /**
  368. * @internal
  369. */
  370. this._active = true;
  371. /**
  372. * @internal
  373. */
  374. this.effects = [];
  375. /**
  376. * @internal
  377. */
  378. this.cleanups = [];
  379. this.parent = activeEffectScope;
  380. if (!detached && activeEffectScope) {
  381. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  382. this
  383. ) - 1;
  384. }
  385. }
  386. get active() {
  387. return this._active;
  388. }
  389. run(fn) {
  390. if (this._active) {
  391. const currentEffectScope = activeEffectScope;
  392. try {
  393. activeEffectScope = this;
  394. return fn();
  395. } finally {
  396. activeEffectScope = currentEffectScope;
  397. }
  398. } else {
  399. warn$2(`cannot run an inactive effect scope.`);
  400. }
  401. }
  402. /**
  403. * This should only be called on non-detached scopes
  404. * @internal
  405. */
  406. on() {
  407. activeEffectScope = this;
  408. }
  409. /**
  410. * This should only be called on non-detached scopes
  411. * @internal
  412. */
  413. off() {
  414. activeEffectScope = this.parent;
  415. }
  416. stop(fromParent) {
  417. if (this._active) {
  418. let i, l;
  419. for (i = 0, l = this.effects.length; i < l; i++) {
  420. this.effects[i].stop();
  421. }
  422. for (i = 0, l = this.cleanups.length; i < l; i++) {
  423. this.cleanups[i]();
  424. }
  425. if (this.scopes) {
  426. for (i = 0, l = this.scopes.length; i < l; i++) {
  427. this.scopes[i].stop(true);
  428. }
  429. }
  430. if (!this.detached && this.parent && !fromParent) {
  431. const last = this.parent.scopes.pop();
  432. if (last && last !== this) {
  433. this.parent.scopes[this.index] = last;
  434. last.index = this.index;
  435. }
  436. }
  437. this.parent = void 0;
  438. this._active = false;
  439. }
  440. }
  441. }
  442. function effectScope(detached) {
  443. return new EffectScope(detached);
  444. }
  445. function recordEffectScope(effect, scope = activeEffectScope) {
  446. if (scope && scope.active) {
  447. scope.effects.push(effect);
  448. }
  449. }
  450. function getCurrentScope() {
  451. return activeEffectScope;
  452. }
  453. function onScopeDispose(fn) {
  454. if (activeEffectScope) {
  455. activeEffectScope.cleanups.push(fn);
  456. } else {
  457. warn$2(
  458. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  459. );
  460. }
  461. }
  462. let activeEffect;
  463. class ReactiveEffect {
  464. constructor(fn, trigger, scheduler, scope) {
  465. this.fn = fn;
  466. this.trigger = trigger;
  467. this.scheduler = scheduler;
  468. this.active = true;
  469. this.deps = [];
  470. /**
  471. * @internal
  472. */
  473. this._dirtyLevel = 4;
  474. /**
  475. * @internal
  476. */
  477. this._trackId = 0;
  478. /**
  479. * @internal
  480. */
  481. this._runnings = 0;
  482. /**
  483. * @internal
  484. */
  485. this._shouldSchedule = false;
  486. /**
  487. * @internal
  488. */
  489. this._depsLength = 0;
  490. recordEffectScope(this, scope);
  491. }
  492. get dirty() {
  493. if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
  494. this._dirtyLevel = 1;
  495. pauseTracking();
  496. for (let i = 0; i < this._depsLength; i++) {
  497. const dep = this.deps[i];
  498. if (dep.computed) {
  499. triggerComputed(dep.computed);
  500. if (this._dirtyLevel >= 4) {
  501. break;
  502. }
  503. }
  504. }
  505. if (this._dirtyLevel === 1) {
  506. this._dirtyLevel = 0;
  507. }
  508. resetTracking();
  509. }
  510. return this._dirtyLevel >= 4;
  511. }
  512. set dirty(v) {
  513. this._dirtyLevel = v ? 4 : 0;
  514. }
  515. run() {
  516. this._dirtyLevel = 0;
  517. if (!this.active) {
  518. return this.fn();
  519. }
  520. let lastShouldTrack = shouldTrack;
  521. let lastEffect = activeEffect;
  522. try {
  523. shouldTrack = true;
  524. activeEffect = this;
  525. this._runnings++;
  526. preCleanupEffect(this);
  527. return this.fn();
  528. } finally {
  529. postCleanupEffect(this);
  530. this._runnings--;
  531. activeEffect = lastEffect;
  532. shouldTrack = lastShouldTrack;
  533. }
  534. }
  535. stop() {
  536. if (this.active) {
  537. preCleanupEffect(this);
  538. postCleanupEffect(this);
  539. this.onStop && this.onStop();
  540. this.active = false;
  541. }
  542. }
  543. }
  544. function triggerComputed(computed) {
  545. return computed.value;
  546. }
  547. function preCleanupEffect(effect2) {
  548. effect2._trackId++;
  549. effect2._depsLength = 0;
  550. }
  551. function postCleanupEffect(effect2) {
  552. if (effect2.deps.length > effect2._depsLength) {
  553. for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
  554. cleanupDepEffect(effect2.deps[i], effect2);
  555. }
  556. effect2.deps.length = effect2._depsLength;
  557. }
  558. }
  559. function cleanupDepEffect(dep, effect2) {
  560. const trackId = dep.get(effect2);
  561. if (trackId !== void 0 && effect2._trackId !== trackId) {
  562. dep.delete(effect2);
  563. if (dep.size === 0) {
  564. dep.cleanup();
  565. }
  566. }
  567. }
  568. function effect(fn, options) {
  569. if (fn.effect instanceof ReactiveEffect) {
  570. fn = fn.effect.fn;
  571. }
  572. const _effect = new ReactiveEffect(fn, NOOP, () => {
  573. if (_effect.dirty) {
  574. _effect.run();
  575. }
  576. });
  577. if (options) {
  578. extend(_effect, options);
  579. if (options.scope) recordEffectScope(_effect, options.scope);
  580. }
  581. if (!options || !options.lazy) {
  582. _effect.run();
  583. }
  584. const runner = _effect.run.bind(_effect);
  585. runner.effect = _effect;
  586. return runner;
  587. }
  588. function stop(runner) {
  589. runner.effect.stop();
  590. }
  591. let shouldTrack = true;
  592. let pauseScheduleStack = 0;
  593. const trackStack = [];
  594. function pauseTracking() {
  595. trackStack.push(shouldTrack);
  596. shouldTrack = false;
  597. }
  598. function resetTracking() {
  599. const last = trackStack.pop();
  600. shouldTrack = last === void 0 ? true : last;
  601. }
  602. function pauseScheduling() {
  603. pauseScheduleStack++;
  604. }
  605. function resetScheduling() {
  606. pauseScheduleStack--;
  607. while (!pauseScheduleStack && queueEffectSchedulers.length) {
  608. queueEffectSchedulers.shift()();
  609. }
  610. }
  611. function trackEffect(effect2, dep, debuggerEventExtraInfo) {
  612. var _a;
  613. if (dep.get(effect2) !== effect2._trackId) {
  614. dep.set(effect2, effect2._trackId);
  615. const oldDep = effect2.deps[effect2._depsLength];
  616. if (oldDep !== dep) {
  617. if (oldDep) {
  618. cleanupDepEffect(oldDep, effect2);
  619. }
  620. effect2.deps[effect2._depsLength++] = dep;
  621. } else {
  622. effect2._depsLength++;
  623. }
  624. {
  625. (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  626. }
  627. }
  628. }
  629. const queueEffectSchedulers = [];
  630. function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
  631. var _a;
  632. pauseScheduling();
  633. for (const effect2 of dep.keys()) {
  634. let tracking;
  635. if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  636. effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
  637. effect2._dirtyLevel = dirtyLevel;
  638. }
  639. if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  640. {
  641. (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  642. }
  643. effect2.trigger();
  644. if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
  645. effect2._shouldSchedule = false;
  646. if (effect2.scheduler) {
  647. queueEffectSchedulers.push(effect2.scheduler);
  648. }
  649. }
  650. }
  651. }
  652. resetScheduling();
  653. }
  654. const createDep = (cleanup, computed) => {
  655. const dep = /* @__PURE__ */ new Map();
  656. dep.cleanup = cleanup;
  657. dep.computed = computed;
  658. return dep;
  659. };
  660. const targetMap = /* @__PURE__ */ new WeakMap();
  661. const ITERATE_KEY = Symbol("iterate" );
  662. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
  663. function track(target, type, key) {
  664. if (shouldTrack && activeEffect) {
  665. let depsMap = targetMap.get(target);
  666. if (!depsMap) {
  667. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  668. }
  669. let dep = depsMap.get(key);
  670. if (!dep) {
  671. depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
  672. }
  673. trackEffect(
  674. activeEffect,
  675. dep,
  676. {
  677. target,
  678. type,
  679. key
  680. }
  681. );
  682. }
  683. }
  684. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  685. const depsMap = targetMap.get(target);
  686. if (!depsMap) {
  687. return;
  688. }
  689. let deps = [];
  690. if (type === "clear") {
  691. deps = [...depsMap.values()];
  692. } else if (key === "length" && isArray(target)) {
  693. const newLength = Number(newValue);
  694. depsMap.forEach((dep, key2) => {
  695. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  696. deps.push(dep);
  697. }
  698. });
  699. } else {
  700. if (key !== void 0) {
  701. deps.push(depsMap.get(key));
  702. }
  703. switch (type) {
  704. case "add":
  705. if (!isArray(target)) {
  706. deps.push(depsMap.get(ITERATE_KEY));
  707. if (isMap(target)) {
  708. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  709. }
  710. } else if (isIntegerKey(key)) {
  711. deps.push(depsMap.get("length"));
  712. }
  713. break;
  714. case "delete":
  715. if (!isArray(target)) {
  716. deps.push(depsMap.get(ITERATE_KEY));
  717. if (isMap(target)) {
  718. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  719. }
  720. }
  721. break;
  722. case "set":
  723. if (isMap(target)) {
  724. deps.push(depsMap.get(ITERATE_KEY));
  725. }
  726. break;
  727. }
  728. }
  729. pauseScheduling();
  730. for (const dep of deps) {
  731. if (dep) {
  732. triggerEffects(
  733. dep,
  734. 4,
  735. {
  736. target,
  737. type,
  738. key,
  739. newValue,
  740. oldValue,
  741. oldTarget
  742. }
  743. );
  744. }
  745. }
  746. resetScheduling();
  747. }
  748. function getDepFromReactive(object, key) {
  749. const depsMap = targetMap.get(object);
  750. return depsMap && depsMap.get(key);
  751. }
  752. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  753. const builtInSymbols = new Set(
  754. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  755. );
  756. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  757. function createArrayInstrumentations() {
  758. const instrumentations = {};
  759. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  760. instrumentations[key] = function(...args) {
  761. const arr = toRaw(this);
  762. for (let i = 0, l = this.length; i < l; i++) {
  763. track(arr, "get", i + "");
  764. }
  765. const res = arr[key](...args);
  766. if (res === -1 || res === false) {
  767. return arr[key](...args.map(toRaw));
  768. } else {
  769. return res;
  770. }
  771. };
  772. });
  773. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  774. instrumentations[key] = function(...args) {
  775. pauseTracking();
  776. pauseScheduling();
  777. const res = toRaw(this)[key].apply(this, args);
  778. resetScheduling();
  779. resetTracking();
  780. return res;
  781. };
  782. });
  783. return instrumentations;
  784. }
  785. function hasOwnProperty(key) {
  786. if (!isSymbol(key)) key = String(key);
  787. const obj = toRaw(this);
  788. track(obj, "has", key);
  789. return obj.hasOwnProperty(key);
  790. }
  791. class BaseReactiveHandler {
  792. constructor(_isReadonly = false, _isShallow = false) {
  793. this._isReadonly = _isReadonly;
  794. this._isShallow = _isShallow;
  795. }
  796. get(target, key, receiver) {
  797. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  798. if (key === "__v_isReactive") {
  799. return !isReadonly2;
  800. } else if (key === "__v_isReadonly") {
  801. return isReadonly2;
  802. } else if (key === "__v_isShallow") {
  803. return isShallow2;
  804. } else if (key === "__v_raw") {
  805. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  806. // this means the receiver is a user proxy of the reactive proxy
  807. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  808. return target;
  809. }
  810. return;
  811. }
  812. const targetIsArray = isArray(target);
  813. if (!isReadonly2) {
  814. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  815. return Reflect.get(arrayInstrumentations, key, receiver);
  816. }
  817. if (key === "hasOwnProperty") {
  818. return hasOwnProperty;
  819. }
  820. }
  821. const res = Reflect.get(target, key, receiver);
  822. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  823. return res;
  824. }
  825. if (!isReadonly2) {
  826. track(target, "get", key);
  827. }
  828. if (isShallow2) {
  829. return res;
  830. }
  831. if (isRef(res)) {
  832. return targetIsArray && isIntegerKey(key) ? res : res.value;
  833. }
  834. if (isObject(res)) {
  835. return isReadonly2 ? readonly(res) : reactive(res);
  836. }
  837. return res;
  838. }
  839. }
  840. class MutableReactiveHandler extends BaseReactiveHandler {
  841. constructor(isShallow2 = false) {
  842. super(false, isShallow2);
  843. }
  844. set(target, key, value, receiver) {
  845. let oldValue = target[key];
  846. if (!this._isShallow) {
  847. const isOldValueReadonly = isReadonly(oldValue);
  848. if (!isShallow(value) && !isReadonly(value)) {
  849. oldValue = toRaw(oldValue);
  850. value = toRaw(value);
  851. }
  852. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  853. if (isOldValueReadonly) {
  854. return false;
  855. } else {
  856. oldValue.value = value;
  857. return true;
  858. }
  859. }
  860. }
  861. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  862. const result = Reflect.set(target, key, value, receiver);
  863. if (target === toRaw(receiver)) {
  864. if (!hadKey) {
  865. trigger(target, "add", key, value);
  866. } else if (hasChanged(value, oldValue)) {
  867. trigger(target, "set", key, value, oldValue);
  868. }
  869. }
  870. return result;
  871. }
  872. deleteProperty(target, key) {
  873. const hadKey = hasOwn(target, key);
  874. const oldValue = target[key];
  875. const result = Reflect.deleteProperty(target, key);
  876. if (result && hadKey) {
  877. trigger(target, "delete", key, void 0, oldValue);
  878. }
  879. return result;
  880. }
  881. has(target, key) {
  882. const result = Reflect.has(target, key);
  883. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  884. track(target, "has", key);
  885. }
  886. return result;
  887. }
  888. ownKeys(target) {
  889. track(
  890. target,
  891. "iterate",
  892. isArray(target) ? "length" : ITERATE_KEY
  893. );
  894. return Reflect.ownKeys(target);
  895. }
  896. }
  897. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  898. constructor(isShallow2 = false) {
  899. super(true, isShallow2);
  900. }
  901. set(target, key) {
  902. {
  903. warn$2(
  904. `Set operation on key "${String(key)}" failed: target is readonly.`,
  905. target
  906. );
  907. }
  908. return true;
  909. }
  910. deleteProperty(target, key) {
  911. {
  912. warn$2(
  913. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  914. target
  915. );
  916. }
  917. return true;
  918. }
  919. }
  920. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  921. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  922. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
  923. true
  924. );
  925. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  926. const toShallow = (value) => value;
  927. const getProto = (v) => Reflect.getPrototypeOf(v);
  928. function get(target, key, isReadonly2 = false, isShallow2 = false) {
  929. target = target["__v_raw"];
  930. const rawTarget = toRaw(target);
  931. const rawKey = toRaw(key);
  932. if (!isReadonly2) {
  933. if (hasChanged(key, rawKey)) {
  934. track(rawTarget, "get", key);
  935. }
  936. track(rawTarget, "get", rawKey);
  937. }
  938. const { has: has2 } = getProto(rawTarget);
  939. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  940. if (has2.call(rawTarget, key)) {
  941. return wrap(target.get(key));
  942. } else if (has2.call(rawTarget, rawKey)) {
  943. return wrap(target.get(rawKey));
  944. } else if (target !== rawTarget) {
  945. target.get(key);
  946. }
  947. }
  948. function has(key, isReadonly2 = false) {
  949. const target = this["__v_raw"];
  950. const rawTarget = toRaw(target);
  951. const rawKey = toRaw(key);
  952. if (!isReadonly2) {
  953. if (hasChanged(key, rawKey)) {
  954. track(rawTarget, "has", key);
  955. }
  956. track(rawTarget, "has", rawKey);
  957. }
  958. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  959. }
  960. function size(target, isReadonly2 = false) {
  961. target = target["__v_raw"];
  962. !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
  963. return Reflect.get(target, "size", target);
  964. }
  965. function add(value, _isShallow = false) {
  966. if (!_isShallow && !isShallow(value) && !isReadonly(value)) {
  967. value = toRaw(value);
  968. }
  969. const target = toRaw(this);
  970. const proto = getProto(target);
  971. const hadKey = proto.has.call(target, value);
  972. if (!hadKey) {
  973. target.add(value);
  974. trigger(target, "add", value, value);
  975. }
  976. return this;
  977. }
  978. function set(key, value, _isShallow = false) {
  979. if (!_isShallow && !isShallow(value) && !isReadonly(value)) {
  980. value = toRaw(value);
  981. }
  982. const target = toRaw(this);
  983. const { has: has2, get: get2 } = getProto(target);
  984. let hadKey = has2.call(target, key);
  985. if (!hadKey) {
  986. key = toRaw(key);
  987. hadKey = has2.call(target, key);
  988. } else {
  989. checkIdentityKeys(target, has2, key);
  990. }
  991. const oldValue = get2.call(target, key);
  992. target.set(key, value);
  993. if (!hadKey) {
  994. trigger(target, "add", key, value);
  995. } else if (hasChanged(value, oldValue)) {
  996. trigger(target, "set", key, value, oldValue);
  997. }
  998. return this;
  999. }
  1000. function deleteEntry(key) {
  1001. const target = toRaw(this);
  1002. const { has: has2, get: get2 } = getProto(target);
  1003. let hadKey = has2.call(target, key);
  1004. if (!hadKey) {
  1005. key = toRaw(key);
  1006. hadKey = has2.call(target, key);
  1007. } else {
  1008. checkIdentityKeys(target, has2, key);
  1009. }
  1010. const oldValue = get2 ? get2.call(target, key) : void 0;
  1011. const result = target.delete(key);
  1012. if (hadKey) {
  1013. trigger(target, "delete", key, void 0, oldValue);
  1014. }
  1015. return result;
  1016. }
  1017. function clear() {
  1018. const target = toRaw(this);
  1019. const hadItems = target.size !== 0;
  1020. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1021. const result = target.clear();
  1022. if (hadItems) {
  1023. trigger(target, "clear", void 0, void 0, oldTarget);
  1024. }
  1025. return result;
  1026. }
  1027. function createForEach(isReadonly2, isShallow2) {
  1028. return function forEach(callback, thisArg) {
  1029. const observed = this;
  1030. const target = observed["__v_raw"];
  1031. const rawTarget = toRaw(target);
  1032. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1033. !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
  1034. return target.forEach((value, key) => {
  1035. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1036. });
  1037. };
  1038. }
  1039. function createIterableMethod(method, isReadonly2, isShallow2) {
  1040. return function(...args) {
  1041. const target = this["__v_raw"];
  1042. const rawTarget = toRaw(target);
  1043. const targetIsMap = isMap(rawTarget);
  1044. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1045. const isKeyOnly = method === "keys" && targetIsMap;
  1046. const innerIterator = target[method](...args);
  1047. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1048. !isReadonly2 && track(
  1049. rawTarget,
  1050. "iterate",
  1051. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1052. );
  1053. return {
  1054. // iterator protocol
  1055. next() {
  1056. const { value, done } = innerIterator.next();
  1057. return done ? { value, done } : {
  1058. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1059. done
  1060. };
  1061. },
  1062. // iterable protocol
  1063. [Symbol.iterator]() {
  1064. return this;
  1065. }
  1066. };
  1067. };
  1068. }
  1069. function createReadonlyMethod(type) {
  1070. return function(...args) {
  1071. {
  1072. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1073. warn$2(
  1074. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1075. toRaw(this)
  1076. );
  1077. }
  1078. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1079. };
  1080. }
  1081. function createInstrumentations() {
  1082. const mutableInstrumentations2 = {
  1083. get(key) {
  1084. return get(this, key);
  1085. },
  1086. get size() {
  1087. return size(this);
  1088. },
  1089. has,
  1090. add,
  1091. set,
  1092. delete: deleteEntry,
  1093. clear,
  1094. forEach: createForEach(false, false)
  1095. };
  1096. const shallowInstrumentations2 = {
  1097. get(key) {
  1098. return get(this, key, false, true);
  1099. },
  1100. get size() {
  1101. return size(this);
  1102. },
  1103. has,
  1104. add(value) {
  1105. return add.call(this, value, true);
  1106. },
  1107. set(key, value) {
  1108. return set.call(this, key, value, true);
  1109. },
  1110. delete: deleteEntry,
  1111. clear,
  1112. forEach: createForEach(false, true)
  1113. };
  1114. const readonlyInstrumentations2 = {
  1115. get(key) {
  1116. return get(this, key, true);
  1117. },
  1118. get size() {
  1119. return size(this, true);
  1120. },
  1121. has(key) {
  1122. return has.call(this, key, true);
  1123. },
  1124. add: createReadonlyMethod("add"),
  1125. set: createReadonlyMethod("set"),
  1126. delete: createReadonlyMethod("delete"),
  1127. clear: createReadonlyMethod("clear"),
  1128. forEach: createForEach(true, false)
  1129. };
  1130. const shallowReadonlyInstrumentations2 = {
  1131. get(key) {
  1132. return get(this, key, true, true);
  1133. },
  1134. get size() {
  1135. return size(this, true);
  1136. },
  1137. has(key) {
  1138. return has.call(this, key, true);
  1139. },
  1140. add: createReadonlyMethod("add"),
  1141. set: createReadonlyMethod("set"),
  1142. delete: createReadonlyMethod("delete"),
  1143. clear: createReadonlyMethod("clear"),
  1144. forEach: createForEach(true, true)
  1145. };
  1146. const iteratorMethods = [
  1147. "keys",
  1148. "values",
  1149. "entries",
  1150. Symbol.iterator
  1151. ];
  1152. iteratorMethods.forEach((method) => {
  1153. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  1154. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  1155. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  1156. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1157. method,
  1158. true,
  1159. true
  1160. );
  1161. });
  1162. return [
  1163. mutableInstrumentations2,
  1164. readonlyInstrumentations2,
  1165. shallowInstrumentations2,
  1166. shallowReadonlyInstrumentations2
  1167. ];
  1168. }
  1169. const [
  1170. mutableInstrumentations,
  1171. readonlyInstrumentations,
  1172. shallowInstrumentations,
  1173. shallowReadonlyInstrumentations
  1174. ] = /* @__PURE__ */ createInstrumentations();
  1175. function createInstrumentationGetter(isReadonly2, shallow) {
  1176. const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
  1177. return (target, key, receiver) => {
  1178. if (key === "__v_isReactive") {
  1179. return !isReadonly2;
  1180. } else if (key === "__v_isReadonly") {
  1181. return isReadonly2;
  1182. } else if (key === "__v_raw") {
  1183. return target;
  1184. }
  1185. return Reflect.get(
  1186. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1187. key,
  1188. receiver
  1189. );
  1190. };
  1191. }
  1192. const mutableCollectionHandlers = {
  1193. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1194. };
  1195. const shallowCollectionHandlers = {
  1196. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1197. };
  1198. const readonlyCollectionHandlers = {
  1199. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1200. };
  1201. const shallowReadonlyCollectionHandlers = {
  1202. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1203. };
  1204. function checkIdentityKeys(target, has2, key) {
  1205. const rawKey = toRaw(key);
  1206. if (rawKey !== key && has2.call(target, rawKey)) {
  1207. const type = toRawType(target);
  1208. warn$2(
  1209. `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.`
  1210. );
  1211. }
  1212. }
  1213. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1214. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1215. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1216. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1217. function targetTypeMap(rawType) {
  1218. switch (rawType) {
  1219. case "Object":
  1220. case "Array":
  1221. return 1 /* COMMON */;
  1222. case "Map":
  1223. case "Set":
  1224. case "WeakMap":
  1225. case "WeakSet":
  1226. return 2 /* COLLECTION */;
  1227. default:
  1228. return 0 /* INVALID */;
  1229. }
  1230. }
  1231. function getTargetType(value) {
  1232. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1233. }
  1234. function reactive(target) {
  1235. if (isReadonly(target)) {
  1236. return target;
  1237. }
  1238. return createReactiveObject(
  1239. target,
  1240. false,
  1241. mutableHandlers,
  1242. mutableCollectionHandlers,
  1243. reactiveMap
  1244. );
  1245. }
  1246. function shallowReactive(target) {
  1247. return createReactiveObject(
  1248. target,
  1249. false,
  1250. shallowReactiveHandlers,
  1251. shallowCollectionHandlers,
  1252. shallowReactiveMap
  1253. );
  1254. }
  1255. function readonly(target) {
  1256. return createReactiveObject(
  1257. target,
  1258. true,
  1259. readonlyHandlers,
  1260. readonlyCollectionHandlers,
  1261. readonlyMap
  1262. );
  1263. }
  1264. function shallowReadonly(target) {
  1265. return createReactiveObject(
  1266. target,
  1267. true,
  1268. shallowReadonlyHandlers,
  1269. shallowReadonlyCollectionHandlers,
  1270. shallowReadonlyMap
  1271. );
  1272. }
  1273. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1274. if (!isObject(target)) {
  1275. {
  1276. warn$2(
  1277. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1278. target
  1279. )}`
  1280. );
  1281. }
  1282. return target;
  1283. }
  1284. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1285. return target;
  1286. }
  1287. const existingProxy = proxyMap.get(target);
  1288. if (existingProxy) {
  1289. return existingProxy;
  1290. }
  1291. const targetType = getTargetType(target);
  1292. if (targetType === 0 /* INVALID */) {
  1293. return target;
  1294. }
  1295. const proxy = new Proxy(
  1296. target,
  1297. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1298. );
  1299. proxyMap.set(target, proxy);
  1300. return proxy;
  1301. }
  1302. function isReactive(value) {
  1303. if (isReadonly(value)) {
  1304. return isReactive(value["__v_raw"]);
  1305. }
  1306. return !!(value && value["__v_isReactive"]);
  1307. }
  1308. function isReadonly(value) {
  1309. return !!(value && value["__v_isReadonly"]);
  1310. }
  1311. function isShallow(value) {
  1312. return !!(value && value["__v_isShallow"]);
  1313. }
  1314. function isProxy(value) {
  1315. return value ? !!value["__v_raw"] : false;
  1316. }
  1317. function toRaw(observed) {
  1318. const raw = observed && observed["__v_raw"];
  1319. return raw ? toRaw(raw) : observed;
  1320. }
  1321. function markRaw(value) {
  1322. if (Object.isExtensible(value)) {
  1323. def(value, "__v_skip", true);
  1324. }
  1325. return value;
  1326. }
  1327. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1328. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1329. const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
  1330. class ComputedRefImpl {
  1331. constructor(getter, _setter, isReadonly, isSSR) {
  1332. this.getter = getter;
  1333. this._setter = _setter;
  1334. this.dep = void 0;
  1335. this.__v_isRef = true;
  1336. this["__v_isReadonly"] = false;
  1337. this.effect = new ReactiveEffect(
  1338. () => getter(this._value),
  1339. () => triggerRefValue(
  1340. this,
  1341. this.effect._dirtyLevel === 2 ? 2 : 3
  1342. )
  1343. );
  1344. this.effect.computed = this;
  1345. this.effect.active = this._cacheable = !isSSR;
  1346. this["__v_isReadonly"] = isReadonly;
  1347. }
  1348. get value() {
  1349. const self = toRaw(this);
  1350. if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
  1351. triggerRefValue(self, 4);
  1352. }
  1353. trackRefValue(self);
  1354. if (self.effect._dirtyLevel >= 2) {
  1355. if (this._warnRecursive) {
  1356. warn$2(COMPUTED_SIDE_EFFECT_WARN, `
  1357. getter: `, this.getter);
  1358. }
  1359. triggerRefValue(self, 2);
  1360. }
  1361. return self._value;
  1362. }
  1363. set value(newValue) {
  1364. this._setter(newValue);
  1365. }
  1366. // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
  1367. get _dirty() {
  1368. return this.effect.dirty;
  1369. }
  1370. set _dirty(v) {
  1371. this.effect.dirty = v;
  1372. }
  1373. // #endregion
  1374. }
  1375. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1376. let getter;
  1377. let setter;
  1378. const onlyGetter = isFunction(getterOrOptions);
  1379. if (onlyGetter) {
  1380. getter = getterOrOptions;
  1381. setter = () => {
  1382. warn$2("Write operation failed: computed value is readonly");
  1383. } ;
  1384. } else {
  1385. getter = getterOrOptions.get;
  1386. setter = getterOrOptions.set;
  1387. }
  1388. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1389. if (debugOptions && !isSSR) {
  1390. cRef.effect.onTrack = debugOptions.onTrack;
  1391. cRef.effect.onTrigger = debugOptions.onTrigger;
  1392. }
  1393. return cRef;
  1394. }
  1395. function trackRefValue(ref2) {
  1396. var _a;
  1397. if (shouldTrack && activeEffect) {
  1398. ref2 = toRaw(ref2);
  1399. trackEffect(
  1400. activeEffect,
  1401. (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
  1402. () => ref2.dep = void 0,
  1403. ref2 instanceof ComputedRefImpl ? ref2 : void 0
  1404. ),
  1405. {
  1406. target: ref2,
  1407. type: "get",
  1408. key: "value"
  1409. }
  1410. );
  1411. }
  1412. }
  1413. function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
  1414. ref2 = toRaw(ref2);
  1415. const dep = ref2.dep;
  1416. if (dep) {
  1417. triggerEffects(
  1418. dep,
  1419. dirtyLevel,
  1420. {
  1421. target: ref2,
  1422. type: "set",
  1423. key: "value",
  1424. newValue: newVal,
  1425. oldValue: oldVal
  1426. }
  1427. );
  1428. }
  1429. }
  1430. function isRef(r) {
  1431. return !!(r && r.__v_isRef === true);
  1432. }
  1433. function ref(value) {
  1434. return createRef(value, false);
  1435. }
  1436. function shallowRef(value) {
  1437. return createRef(value, true);
  1438. }
  1439. function createRef(rawValue, shallow) {
  1440. if (isRef(rawValue)) {
  1441. return rawValue;
  1442. }
  1443. return new RefImpl(rawValue, shallow);
  1444. }
  1445. class RefImpl {
  1446. constructor(value, __v_isShallow) {
  1447. this.__v_isShallow = __v_isShallow;
  1448. this.dep = void 0;
  1449. this.__v_isRef = true;
  1450. this._rawValue = __v_isShallow ? value : toRaw(value);
  1451. this._value = __v_isShallow ? value : toReactive(value);
  1452. }
  1453. get value() {
  1454. trackRefValue(this);
  1455. return this._value;
  1456. }
  1457. set value(newVal) {
  1458. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1459. newVal = useDirectValue ? newVal : toRaw(newVal);
  1460. if (hasChanged(newVal, this._rawValue)) {
  1461. const oldVal = this._rawValue;
  1462. this._rawValue = newVal;
  1463. this._value = useDirectValue ? newVal : toReactive(newVal);
  1464. triggerRefValue(this, 4, newVal, oldVal);
  1465. }
  1466. }
  1467. }
  1468. function triggerRef(ref2) {
  1469. triggerRefValue(ref2, 4, ref2.value );
  1470. }
  1471. function unref(ref2) {
  1472. return isRef(ref2) ? ref2.value : ref2;
  1473. }
  1474. function toValue(source) {
  1475. return isFunction(source) ? source() : unref(source);
  1476. }
  1477. const shallowUnwrapHandlers = {
  1478. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1479. set: (target, key, value, receiver) => {
  1480. const oldValue = target[key];
  1481. if (isRef(oldValue) && !isRef(value)) {
  1482. oldValue.value = value;
  1483. return true;
  1484. } else {
  1485. return Reflect.set(target, key, value, receiver);
  1486. }
  1487. }
  1488. };
  1489. function proxyRefs(objectWithRefs) {
  1490. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1491. }
  1492. class CustomRefImpl {
  1493. constructor(factory) {
  1494. this.dep = void 0;
  1495. this.__v_isRef = true;
  1496. const { get, set } = factory(
  1497. () => trackRefValue(this),
  1498. () => triggerRefValue(this)
  1499. );
  1500. this._get = get;
  1501. this._set = set;
  1502. }
  1503. get value() {
  1504. return this._get();
  1505. }
  1506. set value(newVal) {
  1507. this._set(newVal);
  1508. }
  1509. }
  1510. function customRef(factory) {
  1511. return new CustomRefImpl(factory);
  1512. }
  1513. function toRefs(object) {
  1514. if (!isProxy(object)) {
  1515. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1516. }
  1517. const ret = isArray(object) ? new Array(object.length) : {};
  1518. for (const key in object) {
  1519. ret[key] = propertyToRef(object, key);
  1520. }
  1521. return ret;
  1522. }
  1523. class ObjectRefImpl {
  1524. constructor(_object, _key, _defaultValue) {
  1525. this._object = _object;
  1526. this._key = _key;
  1527. this._defaultValue = _defaultValue;
  1528. this.__v_isRef = true;
  1529. }
  1530. get value() {
  1531. const val = this._object[this._key];
  1532. return val === void 0 ? this._defaultValue : val;
  1533. }
  1534. set value(newVal) {
  1535. this._object[this._key] = newVal;
  1536. }
  1537. get dep() {
  1538. return getDepFromReactive(toRaw(this._object), this._key);
  1539. }
  1540. }
  1541. class GetterRefImpl {
  1542. constructor(_getter) {
  1543. this._getter = _getter;
  1544. this.__v_isRef = true;
  1545. this.__v_isReadonly = true;
  1546. }
  1547. get value() {
  1548. return this._getter();
  1549. }
  1550. }
  1551. function toRef(source, key, defaultValue) {
  1552. if (isRef(source)) {
  1553. return source;
  1554. } else if (isFunction(source)) {
  1555. return new GetterRefImpl(source);
  1556. } else if (isObject(source) && arguments.length > 1) {
  1557. return propertyToRef(source, key, defaultValue);
  1558. } else {
  1559. return ref(source);
  1560. }
  1561. }
  1562. function propertyToRef(source, key, defaultValue) {
  1563. const val = source[key];
  1564. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1565. }
  1566. const TrackOpTypes = {
  1567. "GET": "get",
  1568. "HAS": "has",
  1569. "ITERATE": "iterate"
  1570. };
  1571. const TriggerOpTypes = {
  1572. "SET": "set",
  1573. "ADD": "add",
  1574. "DELETE": "delete",
  1575. "CLEAR": "clear"
  1576. };
  1577. const stack$1 = [];
  1578. function pushWarningContext(vnode) {
  1579. stack$1.push(vnode);
  1580. }
  1581. function popWarningContext() {
  1582. stack$1.pop();
  1583. }
  1584. let isWarning = false;
  1585. function warn$1(msg, ...args) {
  1586. if (isWarning) return;
  1587. isWarning = true;
  1588. pauseTracking();
  1589. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  1590. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1591. const trace = getComponentTrace();
  1592. if (appWarnHandler) {
  1593. callWithErrorHandling(
  1594. appWarnHandler,
  1595. instance,
  1596. 11,
  1597. [
  1598. // eslint-disable-next-line no-restricted-syntax
  1599. msg + args.map((a) => {
  1600. var _a, _b;
  1601. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  1602. }).join(""),
  1603. instance && instance.proxy,
  1604. trace.map(
  1605. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  1606. ).join("\n"),
  1607. trace
  1608. ]
  1609. );
  1610. } else {
  1611. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1612. if (trace.length && // avoid spamming console during tests
  1613. true) {
  1614. warnArgs.push(`
  1615. `, ...formatTrace(trace));
  1616. }
  1617. console.warn(...warnArgs);
  1618. }
  1619. resetTracking();
  1620. isWarning = false;
  1621. }
  1622. function getComponentTrace() {
  1623. let currentVNode = stack$1[stack$1.length - 1];
  1624. if (!currentVNode) {
  1625. return [];
  1626. }
  1627. const normalizedStack = [];
  1628. while (currentVNode) {
  1629. const last = normalizedStack[0];
  1630. if (last && last.vnode === currentVNode) {
  1631. last.recurseCount++;
  1632. } else {
  1633. normalizedStack.push({
  1634. vnode: currentVNode,
  1635. recurseCount: 0
  1636. });
  1637. }
  1638. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1639. currentVNode = parentInstance && parentInstance.vnode;
  1640. }
  1641. return normalizedStack;
  1642. }
  1643. function formatTrace(trace) {
  1644. const logs = [];
  1645. trace.forEach((entry, i) => {
  1646. logs.push(...i === 0 ? [] : [`
  1647. `], ...formatTraceEntry(entry));
  1648. });
  1649. return logs;
  1650. }
  1651. function formatTraceEntry({ vnode, recurseCount }) {
  1652. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1653. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1654. const open = ` at <${formatComponentName(
  1655. vnode.component,
  1656. vnode.type,
  1657. isRoot
  1658. )}`;
  1659. const close = `>` + postfix;
  1660. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1661. }
  1662. function formatProps(props) {
  1663. const res = [];
  1664. const keys = Object.keys(props);
  1665. keys.slice(0, 3).forEach((key) => {
  1666. res.push(...formatProp(key, props[key]));
  1667. });
  1668. if (keys.length > 3) {
  1669. res.push(` ...`);
  1670. }
  1671. return res;
  1672. }
  1673. function formatProp(key, value, raw) {
  1674. if (isString(value)) {
  1675. value = JSON.stringify(value);
  1676. return raw ? value : [`${key}=${value}`];
  1677. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1678. return raw ? value : [`${key}=${value}`];
  1679. } else if (isRef(value)) {
  1680. value = formatProp(key, toRaw(value.value), true);
  1681. return raw ? value : [`${key}=Ref<`, value, `>`];
  1682. } else if (isFunction(value)) {
  1683. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1684. } else {
  1685. value = toRaw(value);
  1686. return raw ? value : [`${key}=`, value];
  1687. }
  1688. }
  1689. function assertNumber(val, type) {
  1690. if (val === void 0) {
  1691. return;
  1692. } else if (typeof val !== "number") {
  1693. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  1694. } else if (isNaN(val)) {
  1695. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  1696. }
  1697. }
  1698. const ErrorCodes = {
  1699. "SETUP_FUNCTION": 0,
  1700. "0": "SETUP_FUNCTION",
  1701. "RENDER_FUNCTION": 1,
  1702. "1": "RENDER_FUNCTION",
  1703. "WATCH_GETTER": 2,
  1704. "2": "WATCH_GETTER",
  1705. "WATCH_CALLBACK": 3,
  1706. "3": "WATCH_CALLBACK",
  1707. "WATCH_CLEANUP": 4,
  1708. "4": "WATCH_CLEANUP",
  1709. "NATIVE_EVENT_HANDLER": 5,
  1710. "5": "NATIVE_EVENT_HANDLER",
  1711. "COMPONENT_EVENT_HANDLER": 6,
  1712. "6": "COMPONENT_EVENT_HANDLER",
  1713. "VNODE_HOOK": 7,
  1714. "7": "VNODE_HOOK",
  1715. "DIRECTIVE_HOOK": 8,
  1716. "8": "DIRECTIVE_HOOK",
  1717. "TRANSITION_HOOK": 9,
  1718. "9": "TRANSITION_HOOK",
  1719. "APP_ERROR_HANDLER": 10,
  1720. "10": "APP_ERROR_HANDLER",
  1721. "APP_WARN_HANDLER": 11,
  1722. "11": "APP_WARN_HANDLER",
  1723. "FUNCTION_REF": 12,
  1724. "12": "FUNCTION_REF",
  1725. "ASYNC_COMPONENT_LOADER": 13,
  1726. "13": "ASYNC_COMPONENT_LOADER",
  1727. "SCHEDULER": 14,
  1728. "14": "SCHEDULER",
  1729. "COMPONENT_UPDATE": 15,
  1730. "15": "COMPONENT_UPDATE"
  1731. };
  1732. const ErrorTypeStrings$1 = {
  1733. ["sp"]: "serverPrefetch hook",
  1734. ["bc"]: "beforeCreate hook",
  1735. ["c"]: "created hook",
  1736. ["bm"]: "beforeMount hook",
  1737. ["m"]: "mounted hook",
  1738. ["bu"]: "beforeUpdate hook",
  1739. ["u"]: "updated",
  1740. ["bum"]: "beforeUnmount hook",
  1741. ["um"]: "unmounted hook",
  1742. ["a"]: "activated hook",
  1743. ["da"]: "deactivated hook",
  1744. ["ec"]: "errorCaptured hook",
  1745. ["rtc"]: "renderTracked hook",
  1746. ["rtg"]: "renderTriggered hook",
  1747. [0]: "setup function",
  1748. [1]: "render function",
  1749. [2]: "watcher getter",
  1750. [3]: "watcher callback",
  1751. [4]: "watcher cleanup function",
  1752. [5]: "native event handler",
  1753. [6]: "component event handler",
  1754. [7]: "vnode hook",
  1755. [8]: "directive hook",
  1756. [9]: "transition hook",
  1757. [10]: "app errorHandler",
  1758. [11]: "app warnHandler",
  1759. [12]: "ref function",
  1760. [13]: "async component loader",
  1761. [14]: "scheduler flush",
  1762. [15]: "component update"
  1763. };
  1764. function callWithErrorHandling(fn, instance, type, args) {
  1765. try {
  1766. return args ? fn(...args) : fn();
  1767. } catch (err) {
  1768. handleError(err, instance, type);
  1769. }
  1770. }
  1771. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1772. if (isFunction(fn)) {
  1773. const res = callWithErrorHandling(fn, instance, type, args);
  1774. if (res && isPromise(res)) {
  1775. res.catch((err) => {
  1776. handleError(err, instance, type);
  1777. });
  1778. }
  1779. return res;
  1780. }
  1781. if (isArray(fn)) {
  1782. const values = [];
  1783. for (let i = 0; i < fn.length; i++) {
  1784. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1785. }
  1786. return values;
  1787. } else {
  1788. warn$1(
  1789. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  1790. );
  1791. }
  1792. }
  1793. function handleError(err, instance, type, throwInDev = true) {
  1794. const contextVNode = instance ? instance.vnode : null;
  1795. if (instance) {
  1796. let cur = instance.parent;
  1797. const exposedInstance = instance.proxy;
  1798. const errorInfo = ErrorTypeStrings$1[type] ;
  1799. while (cur) {
  1800. const errorCapturedHooks = cur.ec;
  1801. if (errorCapturedHooks) {
  1802. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1803. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1804. return;
  1805. }
  1806. }
  1807. }
  1808. cur = cur.parent;
  1809. }
  1810. const appErrorHandler = instance.appContext.config.errorHandler;
  1811. if (appErrorHandler) {
  1812. pauseTracking();
  1813. callWithErrorHandling(
  1814. appErrorHandler,
  1815. null,
  1816. 10,
  1817. [err, exposedInstance, errorInfo]
  1818. );
  1819. resetTracking();
  1820. return;
  1821. }
  1822. }
  1823. logError(err, type, contextVNode, throwInDev);
  1824. }
  1825. function logError(err, type, contextVNode, throwInDev = true) {
  1826. {
  1827. const info = ErrorTypeStrings$1[type];
  1828. if (contextVNode) {
  1829. pushWarningContext(contextVNode);
  1830. }
  1831. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1832. if (contextVNode) {
  1833. popWarningContext();
  1834. }
  1835. if (throwInDev) {
  1836. throw err;
  1837. } else {
  1838. console.error(err);
  1839. }
  1840. }
  1841. }
  1842. let isFlushing = false;
  1843. let isFlushPending = false;
  1844. const queue = [];
  1845. let flushIndex = 0;
  1846. const pendingPostFlushCbs = [];
  1847. let activePostFlushCbs = null;
  1848. let postFlushIndex = 0;
  1849. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1850. let currentFlushPromise = null;
  1851. const RECURSION_LIMIT = 100;
  1852. function nextTick(fn) {
  1853. const p = currentFlushPromise || resolvedPromise;
  1854. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  1855. }
  1856. function findInsertionIndex(id) {
  1857. let start = flushIndex + 1;
  1858. let end = queue.length;
  1859. while (start < end) {
  1860. const middle = start + end >>> 1;
  1861. const middleJob = queue[middle];
  1862. const middleJobId = getId(middleJob);
  1863. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  1864. start = middle + 1;
  1865. } else {
  1866. end = middle;
  1867. }
  1868. }
  1869. return start;
  1870. }
  1871. function queueJob(job) {
  1872. if (!queue.length || !queue.includes(
  1873. job,
  1874. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1875. )) {
  1876. if (job.id == null) {
  1877. queue.push(job);
  1878. } else {
  1879. queue.splice(findInsertionIndex(job.id), 0, job);
  1880. }
  1881. queueFlush();
  1882. }
  1883. }
  1884. function queueFlush() {
  1885. if (!isFlushing && !isFlushPending) {
  1886. isFlushPending = true;
  1887. currentFlushPromise = resolvedPromise.then(flushJobs);
  1888. }
  1889. }
  1890. function invalidateJob(job) {
  1891. const i = queue.indexOf(job);
  1892. if (i > flushIndex) {
  1893. queue.splice(i, 1);
  1894. }
  1895. }
  1896. function queuePostFlushCb(cb) {
  1897. if (!isArray(cb)) {
  1898. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1899. cb,
  1900. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1901. )) {
  1902. pendingPostFlushCbs.push(cb);
  1903. }
  1904. } else {
  1905. pendingPostFlushCbs.push(...cb);
  1906. }
  1907. queueFlush();
  1908. }
  1909. function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
  1910. {
  1911. seen = seen || /* @__PURE__ */ new Map();
  1912. }
  1913. for (; i < queue.length; i++) {
  1914. const cb = queue[i];
  1915. if (cb && cb.pre) {
  1916. if (instance && cb.id !== instance.uid) {
  1917. continue;
  1918. }
  1919. if (checkRecursiveUpdates(seen, cb)) {
  1920. continue;
  1921. }
  1922. queue.splice(i, 1);
  1923. i--;
  1924. cb();
  1925. }
  1926. }
  1927. }
  1928. function flushPostFlushCbs(seen) {
  1929. if (pendingPostFlushCbs.length) {
  1930. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  1931. (a, b) => getId(a) - getId(b)
  1932. );
  1933. pendingPostFlushCbs.length = 0;
  1934. if (activePostFlushCbs) {
  1935. activePostFlushCbs.push(...deduped);
  1936. return;
  1937. }
  1938. activePostFlushCbs = deduped;
  1939. {
  1940. seen = seen || /* @__PURE__ */ new Map();
  1941. }
  1942. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1943. const cb = activePostFlushCbs[postFlushIndex];
  1944. if (checkRecursiveUpdates(seen, cb)) {
  1945. continue;
  1946. }
  1947. if (cb.active !== false) cb();
  1948. }
  1949. activePostFlushCbs = null;
  1950. postFlushIndex = 0;
  1951. }
  1952. }
  1953. const getId = (job) => job.id == null ? Infinity : job.id;
  1954. const comparator = (a, b) => {
  1955. const diff = getId(a) - getId(b);
  1956. if (diff === 0) {
  1957. if (a.pre && !b.pre) return -1;
  1958. if (b.pre && !a.pre) return 1;
  1959. }
  1960. return diff;
  1961. };
  1962. function flushJobs(seen) {
  1963. isFlushPending = false;
  1964. isFlushing = true;
  1965. {
  1966. seen = seen || /* @__PURE__ */ new Map();
  1967. }
  1968. queue.sort(comparator);
  1969. const check = (job) => checkRecursiveUpdates(seen, job) ;
  1970. try {
  1971. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1972. const job = queue[flushIndex];
  1973. if (job && job.active !== false) {
  1974. if (check(job)) {
  1975. continue;
  1976. }
  1977. callWithErrorHandling(
  1978. job,
  1979. job.i,
  1980. job.i ? 15 : 14
  1981. );
  1982. }
  1983. }
  1984. } finally {
  1985. flushIndex = 0;
  1986. queue.length = 0;
  1987. flushPostFlushCbs(seen);
  1988. isFlushing = false;
  1989. currentFlushPromise = null;
  1990. if (queue.length || pendingPostFlushCbs.length) {
  1991. flushJobs(seen);
  1992. }
  1993. }
  1994. }
  1995. function checkRecursiveUpdates(seen, fn) {
  1996. if (!seen.has(fn)) {
  1997. seen.set(fn, 1);
  1998. } else {
  1999. const count = seen.get(fn);
  2000. if (count > RECURSION_LIMIT) {
  2001. const instance = fn.i;
  2002. const componentName = instance && getComponentName(instance.type);
  2003. handleError(
  2004. `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.`,
  2005. null,
  2006. 10
  2007. );
  2008. return true;
  2009. } else {
  2010. seen.set(fn, count + 1);
  2011. }
  2012. }
  2013. }
  2014. let isHmrUpdating = false;
  2015. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2016. {
  2017. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2018. createRecord: tryWrap(createRecord),
  2019. rerender: tryWrap(rerender),
  2020. reload: tryWrap(reload)
  2021. };
  2022. }
  2023. const map = /* @__PURE__ */ new Map();
  2024. function registerHMR(instance) {
  2025. const id = instance.type.__hmrId;
  2026. let record = map.get(id);
  2027. if (!record) {
  2028. createRecord(id, instance.type);
  2029. record = map.get(id);
  2030. }
  2031. record.instances.add(instance);
  2032. }
  2033. function unregisterHMR(instance) {
  2034. map.get(instance.type.__hmrId).instances.delete(instance);
  2035. }
  2036. function createRecord(id, initialDef) {
  2037. if (map.has(id)) {
  2038. return false;
  2039. }
  2040. map.set(id, {
  2041. initialDef: normalizeClassComponent(initialDef),
  2042. instances: /* @__PURE__ */ new Set()
  2043. });
  2044. return true;
  2045. }
  2046. function normalizeClassComponent(component) {
  2047. return isClassComponent(component) ? component.__vccOpts : component;
  2048. }
  2049. function rerender(id, newRender) {
  2050. const record = map.get(id);
  2051. if (!record) {
  2052. return;
  2053. }
  2054. record.initialDef.render = newRender;
  2055. [...record.instances].forEach((instance) => {
  2056. if (newRender) {
  2057. instance.render = newRender;
  2058. normalizeClassComponent(instance.type).render = newRender;
  2059. }
  2060. instance.renderCache = [];
  2061. isHmrUpdating = true;
  2062. instance.effect.dirty = true;
  2063. instance.update();
  2064. isHmrUpdating = false;
  2065. });
  2066. }
  2067. function reload(id, newComp) {
  2068. const record = map.get(id);
  2069. if (!record) return;
  2070. newComp = normalizeClassComponent(newComp);
  2071. updateComponentDef(record.initialDef, newComp);
  2072. const instances = [...record.instances];
  2073. for (let i = 0; i < instances.length; i++) {
  2074. const instance = instances[i];
  2075. const oldComp = normalizeClassComponent(instance.type);
  2076. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2077. if (!dirtyInstances) {
  2078. if (oldComp !== record.initialDef) {
  2079. updateComponentDef(oldComp, newComp);
  2080. }
  2081. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2082. }
  2083. dirtyInstances.add(instance);
  2084. instance.appContext.propsCache.delete(instance.type);
  2085. instance.appContext.emitsCache.delete(instance.type);
  2086. instance.appContext.optionsCache.delete(instance.type);
  2087. if (instance.ceReload) {
  2088. dirtyInstances.add(instance);
  2089. instance.ceReload(newComp.styles);
  2090. dirtyInstances.delete(instance);
  2091. } else if (instance.parent) {
  2092. instance.parent.effect.dirty = true;
  2093. queueJob(() => {
  2094. instance.parent.update();
  2095. dirtyInstances.delete(instance);
  2096. });
  2097. } else if (instance.appContext.reload) {
  2098. instance.appContext.reload();
  2099. } else if (typeof window !== "undefined") {
  2100. window.location.reload();
  2101. } else {
  2102. console.warn(
  2103. "[HMR] Root or manually mounted instance modified. Full reload required."
  2104. );
  2105. }
  2106. }
  2107. queuePostFlushCb(() => {
  2108. hmrDirtyComponents.clear();
  2109. });
  2110. }
  2111. function updateComponentDef(oldComp, newComp) {
  2112. extend(oldComp, newComp);
  2113. for (const key in oldComp) {
  2114. if (key !== "__file" && !(key in newComp)) {
  2115. delete oldComp[key];
  2116. }
  2117. }
  2118. }
  2119. function tryWrap(fn) {
  2120. return (id, arg) => {
  2121. try {
  2122. return fn(id, arg);
  2123. } catch (e) {
  2124. console.error(e);
  2125. console.warn(
  2126. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2127. );
  2128. }
  2129. };
  2130. }
  2131. let devtools$1;
  2132. let buffer = [];
  2133. let devtoolsNotInstalled = false;
  2134. function emit$1(event, ...args) {
  2135. if (devtools$1) {
  2136. devtools$1.emit(event, ...args);
  2137. } else if (!devtoolsNotInstalled) {
  2138. buffer.push({ event, args });
  2139. }
  2140. }
  2141. function setDevtoolsHook$1(hook, target) {
  2142. var _a, _b;
  2143. devtools$1 = hook;
  2144. if (devtools$1) {
  2145. devtools$1.enabled = true;
  2146. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2147. buffer = [];
  2148. } else if (
  2149. // handle late devtools injection - only do this if we are in an actual
  2150. // browser environment to avoid the timer handle stalling test runner exit
  2151. // (#4815)
  2152. typeof window !== "undefined" && // some envs mock window but not fully
  2153. window.HTMLElement && // also exclude jsdom
  2154. // eslint-disable-next-line no-restricted-syntax
  2155. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2156. ) {
  2157. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2158. replay.push((newHook) => {
  2159. setDevtoolsHook$1(newHook, target);
  2160. });
  2161. setTimeout(() => {
  2162. if (!devtools$1) {
  2163. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2164. devtoolsNotInstalled = true;
  2165. buffer = [];
  2166. }
  2167. }, 3e3);
  2168. } else {
  2169. devtoolsNotInstalled = true;
  2170. buffer = [];
  2171. }
  2172. }
  2173. function devtoolsInitApp(app, version) {
  2174. emit$1("app:init" /* APP_INIT */, app, version, {
  2175. Fragment,
  2176. Text,
  2177. Comment,
  2178. Static
  2179. });
  2180. }
  2181. function devtoolsUnmountApp(app) {
  2182. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2183. }
  2184. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  2185. "component:added" /* COMPONENT_ADDED */
  2186. );
  2187. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2188. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2189. "component:removed" /* COMPONENT_REMOVED */
  2190. );
  2191. const devtoolsComponentRemoved = (component) => {
  2192. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2193. !devtools$1.cleanupBuffer(component)) {
  2194. _devtoolsComponentRemoved(component);
  2195. }
  2196. };
  2197. /*! #__NO_SIDE_EFFECTS__ */
  2198. // @__NO_SIDE_EFFECTS__
  2199. function createDevtoolsComponentHook(hook) {
  2200. return (component) => {
  2201. emit$1(
  2202. hook,
  2203. component.appContext.app,
  2204. component.uid,
  2205. component.parent ? component.parent.uid : void 0,
  2206. component
  2207. );
  2208. };
  2209. }
  2210. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2211. "perf:start" /* PERFORMANCE_START */
  2212. );
  2213. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2214. "perf:end" /* PERFORMANCE_END */
  2215. );
  2216. function createDevtoolsPerformanceHook(hook) {
  2217. return (component, type, time) => {
  2218. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2219. };
  2220. }
  2221. function devtoolsComponentEmit(component, event, params) {
  2222. emit$1(
  2223. "component:emit" /* COMPONENT_EMIT */,
  2224. component.appContext.app,
  2225. component,
  2226. event,
  2227. params
  2228. );
  2229. }
  2230. let currentRenderingInstance = null;
  2231. let currentScopeId = null;
  2232. function setCurrentRenderingInstance(instance) {
  2233. const prev = currentRenderingInstance;
  2234. currentRenderingInstance = instance;
  2235. currentScopeId = instance && instance.type.__scopeId || null;
  2236. return prev;
  2237. }
  2238. function pushScopeId(id) {
  2239. currentScopeId = id;
  2240. }
  2241. function popScopeId() {
  2242. currentScopeId = null;
  2243. }
  2244. const withScopeId = (_id) => withCtx;
  2245. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2246. if (!ctx) return fn;
  2247. if (fn._n) {
  2248. return fn;
  2249. }
  2250. const renderFnWithContext = (...args) => {
  2251. if (renderFnWithContext._d) {
  2252. setBlockTracking(-1);
  2253. }
  2254. const prevInstance = setCurrentRenderingInstance(ctx);
  2255. let res;
  2256. try {
  2257. res = fn(...args);
  2258. } finally {
  2259. setCurrentRenderingInstance(prevInstance);
  2260. if (renderFnWithContext._d) {
  2261. setBlockTracking(1);
  2262. }
  2263. }
  2264. {
  2265. devtoolsComponentUpdated(ctx);
  2266. }
  2267. return res;
  2268. };
  2269. renderFnWithContext._n = true;
  2270. renderFnWithContext._c = true;
  2271. renderFnWithContext._d = true;
  2272. return renderFnWithContext;
  2273. }
  2274. function validateDirectiveName(name) {
  2275. if (isBuiltInDirective(name)) {
  2276. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2277. }
  2278. }
  2279. function withDirectives(vnode, directives) {
  2280. if (currentRenderingInstance === null) {
  2281. warn$1(`withDirectives can only be used inside render functions.`);
  2282. return vnode;
  2283. }
  2284. const instance = getComponentPublicInstance(currentRenderingInstance);
  2285. const bindings = vnode.dirs || (vnode.dirs = []);
  2286. for (let i = 0; i < directives.length; i++) {
  2287. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  2288. if (dir) {
  2289. if (isFunction(dir)) {
  2290. dir = {
  2291. mounted: dir,
  2292. updated: dir
  2293. };
  2294. }
  2295. if (dir.deep) {
  2296. traverse(value);
  2297. }
  2298. bindings.push({
  2299. dir,
  2300. instance,
  2301. value,
  2302. oldValue: void 0,
  2303. arg,
  2304. modifiers
  2305. });
  2306. }
  2307. }
  2308. return vnode;
  2309. }
  2310. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  2311. const bindings = vnode.dirs;
  2312. const oldBindings = prevVNode && prevVNode.dirs;
  2313. for (let i = 0; i < bindings.length; i++) {
  2314. const binding = bindings[i];
  2315. if (oldBindings) {
  2316. binding.oldValue = oldBindings[i].value;
  2317. }
  2318. let hook = binding.dir[name];
  2319. if (hook) {
  2320. pauseTracking();
  2321. callWithAsyncErrorHandling(hook, instance, 8, [
  2322. vnode.el,
  2323. binding,
  2324. vnode,
  2325. prevVNode
  2326. ]);
  2327. resetTracking();
  2328. }
  2329. }
  2330. }
  2331. const leaveCbKey = Symbol("_leaveCb");
  2332. const enterCbKey$1 = Symbol("_enterCb");
  2333. function useTransitionState() {
  2334. const state = {
  2335. isMounted: false,
  2336. isLeaving: false,
  2337. isUnmounting: false,
  2338. leavingVNodes: /* @__PURE__ */ new Map()
  2339. };
  2340. onMounted(() => {
  2341. state.isMounted = true;
  2342. });
  2343. onBeforeUnmount(() => {
  2344. state.isUnmounting = true;
  2345. });
  2346. return state;
  2347. }
  2348. const TransitionHookValidator = [Function, Array];
  2349. const BaseTransitionPropsValidators = {
  2350. mode: String,
  2351. appear: Boolean,
  2352. persisted: Boolean,
  2353. // enter
  2354. onBeforeEnter: TransitionHookValidator,
  2355. onEnter: TransitionHookValidator,
  2356. onAfterEnter: TransitionHookValidator,
  2357. onEnterCancelled: TransitionHookValidator,
  2358. // leave
  2359. onBeforeLeave: TransitionHookValidator,
  2360. onLeave: TransitionHookValidator,
  2361. onAfterLeave: TransitionHookValidator,
  2362. onLeaveCancelled: TransitionHookValidator,
  2363. // appear
  2364. onBeforeAppear: TransitionHookValidator,
  2365. onAppear: TransitionHookValidator,
  2366. onAfterAppear: TransitionHookValidator,
  2367. onAppearCancelled: TransitionHookValidator
  2368. };
  2369. const recursiveGetSubtree = (instance) => {
  2370. const subTree = instance.subTree;
  2371. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  2372. };
  2373. const BaseTransitionImpl = {
  2374. name: `BaseTransition`,
  2375. props: BaseTransitionPropsValidators,
  2376. setup(props, { slots }) {
  2377. const instance = getCurrentInstance();
  2378. const state = useTransitionState();
  2379. return () => {
  2380. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  2381. if (!children || !children.length) {
  2382. return;
  2383. }
  2384. let child = children[0];
  2385. if (children.length > 1) {
  2386. let hasFound = false;
  2387. for (const c of children) {
  2388. if (c.type !== Comment) {
  2389. if (hasFound) {
  2390. warn$1(
  2391. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  2392. );
  2393. break;
  2394. }
  2395. child = c;
  2396. hasFound = true;
  2397. }
  2398. }
  2399. }
  2400. const rawProps = toRaw(props);
  2401. const { mode } = rawProps;
  2402. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  2403. warn$1(`invalid <transition> mode: ${mode}`);
  2404. }
  2405. if (state.isLeaving) {
  2406. return emptyPlaceholder(child);
  2407. }
  2408. const innerChild = getKeepAliveChild(child);
  2409. if (!innerChild) {
  2410. return emptyPlaceholder(child);
  2411. }
  2412. let enterHooks = resolveTransitionHooks(
  2413. innerChild,
  2414. rawProps,
  2415. state,
  2416. instance,
  2417. // #11061, ensure enterHooks is fresh after clone
  2418. (hooks) => enterHooks = hooks
  2419. );
  2420. setTransitionHooks(innerChild, enterHooks);
  2421. const oldChild = instance.subTree;
  2422. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  2423. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
  2424. const leavingHooks = resolveTransitionHooks(
  2425. oldInnerChild,
  2426. rawProps,
  2427. state,
  2428. instance
  2429. );
  2430. setTransitionHooks(oldInnerChild, leavingHooks);
  2431. if (mode === "out-in" && innerChild.type !== Comment) {
  2432. state.isLeaving = true;
  2433. leavingHooks.afterLeave = () => {
  2434. state.isLeaving = false;
  2435. if (instance.update.active !== false) {
  2436. instance.effect.dirty = true;
  2437. instance.update();
  2438. }
  2439. };
  2440. return emptyPlaceholder(child);
  2441. } else if (mode === "in-out" && innerChild.type !== Comment) {
  2442. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  2443. const leavingVNodesCache = getLeavingNodesForType(
  2444. state,
  2445. oldInnerChild
  2446. );
  2447. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  2448. el[leaveCbKey] = () => {
  2449. earlyRemove();
  2450. el[leaveCbKey] = void 0;
  2451. delete enterHooks.delayedLeave;
  2452. };
  2453. enterHooks.delayedLeave = delayedLeave;
  2454. };
  2455. }
  2456. }
  2457. return child;
  2458. };
  2459. }
  2460. };
  2461. const BaseTransition = BaseTransitionImpl;
  2462. function getLeavingNodesForType(state, vnode) {
  2463. const { leavingVNodes } = state;
  2464. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  2465. if (!leavingVNodesCache) {
  2466. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  2467. leavingVNodes.set(vnode.type, leavingVNodesCache);
  2468. }
  2469. return leavingVNodesCache;
  2470. }
  2471. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  2472. const {
  2473. appear,
  2474. mode,
  2475. persisted = false,
  2476. onBeforeEnter,
  2477. onEnter,
  2478. onAfterEnter,
  2479. onEnterCancelled,
  2480. onBeforeLeave,
  2481. onLeave,
  2482. onAfterLeave,
  2483. onLeaveCancelled,
  2484. onBeforeAppear,
  2485. onAppear,
  2486. onAfterAppear,
  2487. onAppearCancelled
  2488. } = props;
  2489. const key = String(vnode.key);
  2490. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  2491. const callHook = (hook, args) => {
  2492. hook && callWithAsyncErrorHandling(
  2493. hook,
  2494. instance,
  2495. 9,
  2496. args
  2497. );
  2498. };
  2499. const callAsyncHook = (hook, args) => {
  2500. const done = args[1];
  2501. callHook(hook, args);
  2502. if (isArray(hook)) {
  2503. if (hook.every((hook2) => hook2.length <= 1)) done();
  2504. } else if (hook.length <= 1) {
  2505. done();
  2506. }
  2507. };
  2508. const hooks = {
  2509. mode,
  2510. persisted,
  2511. beforeEnter(el) {
  2512. let hook = onBeforeEnter;
  2513. if (!state.isMounted) {
  2514. if (appear) {
  2515. hook = onBeforeAppear || onBeforeEnter;
  2516. } else {
  2517. return;
  2518. }
  2519. }
  2520. if (el[leaveCbKey]) {
  2521. el[leaveCbKey](
  2522. true
  2523. /* cancelled */
  2524. );
  2525. }
  2526. const leavingVNode = leavingVNodesCache[key];
  2527. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  2528. leavingVNode.el[leaveCbKey]();
  2529. }
  2530. callHook(hook, [el]);
  2531. },
  2532. enter(el) {
  2533. let hook = onEnter;
  2534. let afterHook = onAfterEnter;
  2535. let cancelHook = onEnterCancelled;
  2536. if (!state.isMounted) {
  2537. if (appear) {
  2538. hook = onAppear || onEnter;
  2539. afterHook = onAfterAppear || onAfterEnter;
  2540. cancelHook = onAppearCancelled || onEnterCancelled;
  2541. } else {
  2542. return;
  2543. }
  2544. }
  2545. let called = false;
  2546. const done = el[enterCbKey$1] = (cancelled) => {
  2547. if (called) return;
  2548. called = true;
  2549. if (cancelled) {
  2550. callHook(cancelHook, [el]);
  2551. } else {
  2552. callHook(afterHook, [el]);
  2553. }
  2554. if (hooks.delayedLeave) {
  2555. hooks.delayedLeave();
  2556. }
  2557. el[enterCbKey$1] = void 0;
  2558. };
  2559. if (hook) {
  2560. callAsyncHook(hook, [el, done]);
  2561. } else {
  2562. done();
  2563. }
  2564. },
  2565. leave(el, remove) {
  2566. const key2 = String(vnode.key);
  2567. if (el[enterCbKey$1]) {
  2568. el[enterCbKey$1](
  2569. true
  2570. /* cancelled */
  2571. );
  2572. }
  2573. if (state.isUnmounting) {
  2574. return remove();
  2575. }
  2576. callHook(onBeforeLeave, [el]);
  2577. let called = false;
  2578. const done = el[leaveCbKey] = (cancelled) => {
  2579. if (called) return;
  2580. called = true;
  2581. remove();
  2582. if (cancelled) {
  2583. callHook(onLeaveCancelled, [el]);
  2584. } else {
  2585. callHook(onAfterLeave, [el]);
  2586. }
  2587. el[leaveCbKey] = void 0;
  2588. if (leavingVNodesCache[key2] === vnode) {
  2589. delete leavingVNodesCache[key2];
  2590. }
  2591. };
  2592. leavingVNodesCache[key2] = vnode;
  2593. if (onLeave) {
  2594. callAsyncHook(onLeave, [el, done]);
  2595. } else {
  2596. done();
  2597. }
  2598. },
  2599. clone(vnode2) {
  2600. const hooks2 = resolveTransitionHooks(
  2601. vnode2,
  2602. props,
  2603. state,
  2604. instance,
  2605. postClone
  2606. );
  2607. if (postClone) postClone(hooks2);
  2608. return hooks2;
  2609. }
  2610. };
  2611. return hooks;
  2612. }
  2613. function emptyPlaceholder(vnode) {
  2614. if (isKeepAlive(vnode)) {
  2615. vnode = cloneVNode(vnode);
  2616. vnode.children = null;
  2617. return vnode;
  2618. }
  2619. }
  2620. function getKeepAliveChild(vnode) {
  2621. if (!isKeepAlive(vnode)) {
  2622. return vnode;
  2623. }
  2624. if (vnode.component) {
  2625. return vnode.component.subTree;
  2626. }
  2627. const { shapeFlag, children } = vnode;
  2628. if (children) {
  2629. if (shapeFlag & 16) {
  2630. return children[0];
  2631. }
  2632. if (shapeFlag & 32 && isFunction(children.default)) {
  2633. return children.default();
  2634. }
  2635. }
  2636. }
  2637. function setTransitionHooks(vnode, hooks) {
  2638. if (vnode.shapeFlag & 6 && vnode.component) {
  2639. setTransitionHooks(vnode.component.subTree, hooks);
  2640. } else if (vnode.shapeFlag & 128) {
  2641. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  2642. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  2643. } else {
  2644. vnode.transition = hooks;
  2645. }
  2646. }
  2647. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  2648. let ret = [];
  2649. let keyedFragmentCount = 0;
  2650. for (let i = 0; i < children.length; i++) {
  2651. let child = children[i];
  2652. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  2653. if (child.type === Fragment) {
  2654. if (child.patchFlag & 128) keyedFragmentCount++;
  2655. ret = ret.concat(
  2656. getTransitionRawChildren(child.children, keepComment, key)
  2657. );
  2658. } else if (keepComment || child.type !== Comment) {
  2659. ret.push(key != null ? cloneVNode(child, { key }) : child);
  2660. }
  2661. }
  2662. if (keyedFragmentCount > 1) {
  2663. for (let i = 0; i < ret.length; i++) {
  2664. ret[i].patchFlag = -2;
  2665. }
  2666. }
  2667. return ret;
  2668. }
  2669. /*! #__NO_SIDE_EFFECTS__ */
  2670. // @__NO_SIDE_EFFECTS__
  2671. function defineComponent(options, extraOptions) {
  2672. return isFunction(options) ? (
  2673. // #8326: extend call and options.name access are considered side-effects
  2674. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  2675. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  2676. ) : options;
  2677. }
  2678. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  2679. /*! #__NO_SIDE_EFFECTS__ */
  2680. // @__NO_SIDE_EFFECTS__
  2681. function defineAsyncComponent(source) {
  2682. if (isFunction(source)) {
  2683. source = { loader: source };
  2684. }
  2685. const {
  2686. loader,
  2687. loadingComponent,
  2688. errorComponent,
  2689. delay = 200,
  2690. timeout,
  2691. // undefined = never times out
  2692. suspensible = true,
  2693. onError: userOnError
  2694. } = source;
  2695. let pendingRequest = null;
  2696. let resolvedComp;
  2697. let retries = 0;
  2698. const retry = () => {
  2699. retries++;
  2700. pendingRequest = null;
  2701. return load();
  2702. };
  2703. const load = () => {
  2704. let thisRequest;
  2705. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  2706. err = err instanceof Error ? err : new Error(String(err));
  2707. if (userOnError) {
  2708. return new Promise((resolve, reject) => {
  2709. const userRetry = () => resolve(retry());
  2710. const userFail = () => reject(err);
  2711. userOnError(err, userRetry, userFail, retries + 1);
  2712. });
  2713. } else {
  2714. throw err;
  2715. }
  2716. }).then((comp) => {
  2717. if (thisRequest !== pendingRequest && pendingRequest) {
  2718. return pendingRequest;
  2719. }
  2720. if (!comp) {
  2721. warn$1(
  2722. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  2723. );
  2724. }
  2725. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  2726. comp = comp.default;
  2727. }
  2728. if (comp && !isObject(comp) && !isFunction(comp)) {
  2729. throw new Error(`Invalid async component load result: ${comp}`);
  2730. }
  2731. resolvedComp = comp;
  2732. return comp;
  2733. }));
  2734. };
  2735. return defineComponent({
  2736. name: "AsyncComponentWrapper",
  2737. __asyncLoader: load,
  2738. get __asyncResolved() {
  2739. return resolvedComp;
  2740. },
  2741. setup() {
  2742. const instance = currentInstance;
  2743. if (resolvedComp) {
  2744. return () => createInnerComp(resolvedComp, instance);
  2745. }
  2746. const onError = (err) => {
  2747. pendingRequest = null;
  2748. handleError(
  2749. err,
  2750. instance,
  2751. 13,
  2752. !errorComponent
  2753. );
  2754. };
  2755. if (suspensible && instance.suspense || false) {
  2756. return load().then((comp) => {
  2757. return () => createInnerComp(comp, instance);
  2758. }).catch((err) => {
  2759. onError(err);
  2760. return () => errorComponent ? createVNode(errorComponent, {
  2761. error: err
  2762. }) : null;
  2763. });
  2764. }
  2765. const loaded = ref(false);
  2766. const error = ref();
  2767. const delayed = ref(!!delay);
  2768. if (delay) {
  2769. setTimeout(() => {
  2770. delayed.value = false;
  2771. }, delay);
  2772. }
  2773. if (timeout != null) {
  2774. setTimeout(() => {
  2775. if (!loaded.value && !error.value) {
  2776. const err = new Error(
  2777. `Async component timed out after ${timeout}ms.`
  2778. );
  2779. onError(err);
  2780. error.value = err;
  2781. }
  2782. }, timeout);
  2783. }
  2784. load().then(() => {
  2785. loaded.value = true;
  2786. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  2787. instance.parent.effect.dirty = true;
  2788. queueJob(instance.parent.update);
  2789. }
  2790. }).catch((err) => {
  2791. onError(err);
  2792. error.value = err;
  2793. });
  2794. return () => {
  2795. if (loaded.value && resolvedComp) {
  2796. return createInnerComp(resolvedComp, instance);
  2797. } else if (error.value && errorComponent) {
  2798. return createVNode(errorComponent, {
  2799. error: error.value
  2800. });
  2801. } else if (loadingComponent && !delayed.value) {
  2802. return createVNode(loadingComponent);
  2803. }
  2804. };
  2805. }
  2806. });
  2807. }
  2808. function createInnerComp(comp, parent) {
  2809. const { ref: ref2, props, children, ce } = parent.vnode;
  2810. const vnode = createVNode(comp, props, children);
  2811. vnode.ref = ref2;
  2812. vnode.ce = ce;
  2813. delete parent.vnode.ce;
  2814. return vnode;
  2815. }
  2816. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  2817. const KeepAliveImpl = {
  2818. name: `KeepAlive`,
  2819. // Marker for special handling inside the renderer. We are not using a ===
  2820. // check directly on KeepAlive in the renderer, because importing it directly
  2821. // would prevent it from being tree-shaken.
  2822. __isKeepAlive: true,
  2823. props: {
  2824. include: [String, RegExp, Array],
  2825. exclude: [String, RegExp, Array],
  2826. max: [String, Number]
  2827. },
  2828. setup(props, { slots }) {
  2829. const instance = getCurrentInstance();
  2830. const sharedContext = instance.ctx;
  2831. const cache = /* @__PURE__ */ new Map();
  2832. const keys = /* @__PURE__ */ new Set();
  2833. let current = null;
  2834. {
  2835. instance.__v_cache = cache;
  2836. }
  2837. const parentSuspense = instance.suspense;
  2838. const {
  2839. renderer: {
  2840. p: patch,
  2841. m: move,
  2842. um: _unmount,
  2843. o: { createElement }
  2844. }
  2845. } = sharedContext;
  2846. const storageContainer = createElement("div");
  2847. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  2848. const instance2 = vnode.component;
  2849. move(vnode, container, anchor, 0, parentSuspense);
  2850. patch(
  2851. instance2.vnode,
  2852. vnode,
  2853. container,
  2854. anchor,
  2855. instance2,
  2856. parentSuspense,
  2857. namespace,
  2858. vnode.slotScopeIds,
  2859. optimized
  2860. );
  2861. queuePostRenderEffect(() => {
  2862. instance2.isDeactivated = false;
  2863. if (instance2.a) {
  2864. invokeArrayFns(instance2.a);
  2865. }
  2866. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  2867. if (vnodeHook) {
  2868. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  2869. }
  2870. }, parentSuspense);
  2871. {
  2872. devtoolsComponentAdded(instance2);
  2873. }
  2874. };
  2875. sharedContext.deactivate = (vnode) => {
  2876. const instance2 = vnode.component;
  2877. invalidateMount(instance2.m);
  2878. invalidateMount(instance2.a);
  2879. move(vnode, storageContainer, null, 1, parentSuspense);
  2880. queuePostRenderEffect(() => {
  2881. if (instance2.da) {
  2882. invokeArrayFns(instance2.da);
  2883. }
  2884. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  2885. if (vnodeHook) {
  2886. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  2887. }
  2888. instance2.isDeactivated = true;
  2889. }, parentSuspense);
  2890. {
  2891. devtoolsComponentAdded(instance2);
  2892. }
  2893. };
  2894. function unmount(vnode) {
  2895. resetShapeFlag(vnode);
  2896. _unmount(vnode, instance, parentSuspense, true);
  2897. }
  2898. function pruneCache(filter) {
  2899. cache.forEach((vnode, key) => {
  2900. const name = getComponentName(vnode.type);
  2901. if (name && (!filter || !filter(name))) {
  2902. pruneCacheEntry(key);
  2903. }
  2904. });
  2905. }
  2906. function pruneCacheEntry(key) {
  2907. const cached = cache.get(key);
  2908. if (cached && (!current || !isSameVNodeType(cached, current))) {
  2909. unmount(cached);
  2910. } else if (current) {
  2911. resetShapeFlag(current);
  2912. }
  2913. cache.delete(key);
  2914. keys.delete(key);
  2915. }
  2916. watch(
  2917. () => [props.include, props.exclude],
  2918. ([include, exclude]) => {
  2919. include && pruneCache((name) => matches(include, name));
  2920. exclude && pruneCache((name) => !matches(exclude, name));
  2921. },
  2922. // prune post-render after `current` has been updated
  2923. { flush: "post", deep: true }
  2924. );
  2925. let pendingCacheKey = null;
  2926. const cacheSubtree = () => {
  2927. if (pendingCacheKey != null) {
  2928. if (isSuspense(instance.subTree.type)) {
  2929. queuePostRenderEffect(() => {
  2930. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  2931. }, instance.subTree.suspense);
  2932. } else {
  2933. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  2934. }
  2935. }
  2936. };
  2937. onMounted(cacheSubtree);
  2938. onUpdated(cacheSubtree);
  2939. onBeforeUnmount(() => {
  2940. cache.forEach((cached) => {
  2941. const { subTree, suspense } = instance;
  2942. const vnode = getInnerChild(subTree);
  2943. if (cached.type === vnode.type && cached.key === vnode.key) {
  2944. resetShapeFlag(vnode);
  2945. const da = vnode.component.da;
  2946. da && queuePostRenderEffect(da, suspense);
  2947. return;
  2948. }
  2949. unmount(cached);
  2950. });
  2951. });
  2952. return () => {
  2953. pendingCacheKey = null;
  2954. if (!slots.default) {
  2955. return null;
  2956. }
  2957. const children = slots.default();
  2958. const rawVNode = children[0];
  2959. if (children.length > 1) {
  2960. {
  2961. warn$1(`KeepAlive should contain exactly one component child.`);
  2962. }
  2963. current = null;
  2964. return children;
  2965. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  2966. current = null;
  2967. return rawVNode;
  2968. }
  2969. let vnode = getInnerChild(rawVNode);
  2970. if (vnode.type === Comment) {
  2971. current = null;
  2972. return vnode;
  2973. }
  2974. const comp = vnode.type;
  2975. const name = getComponentName(
  2976. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  2977. );
  2978. const { include, exclude, max } = props;
  2979. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  2980. current = vnode;
  2981. return rawVNode;
  2982. }
  2983. const key = vnode.key == null ? comp : vnode.key;
  2984. const cachedVNode = cache.get(key);
  2985. if (vnode.el) {
  2986. vnode = cloneVNode(vnode);
  2987. if (rawVNode.shapeFlag & 128) {
  2988. rawVNode.ssContent = vnode;
  2989. }
  2990. }
  2991. pendingCacheKey = key;
  2992. if (cachedVNode) {
  2993. vnode.el = cachedVNode.el;
  2994. vnode.component = cachedVNode.component;
  2995. if (vnode.transition) {
  2996. setTransitionHooks(vnode, vnode.transition);
  2997. }
  2998. vnode.shapeFlag |= 512;
  2999. keys.delete(key);
  3000. keys.add(key);
  3001. } else {
  3002. keys.add(key);
  3003. if (max && keys.size > parseInt(max, 10)) {
  3004. pruneCacheEntry(keys.values().next().value);
  3005. }
  3006. }
  3007. vnode.shapeFlag |= 256;
  3008. current = vnode;
  3009. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  3010. };
  3011. }
  3012. };
  3013. const KeepAlive = KeepAliveImpl;
  3014. function matches(pattern, name) {
  3015. if (isArray(pattern)) {
  3016. return pattern.some((p) => matches(p, name));
  3017. } else if (isString(pattern)) {
  3018. return pattern.split(",").includes(name);
  3019. } else if (isRegExp(pattern)) {
  3020. return pattern.test(name);
  3021. }
  3022. return false;
  3023. }
  3024. function onActivated(hook, target) {
  3025. registerKeepAliveHook(hook, "a", target);
  3026. }
  3027. function onDeactivated(hook, target) {
  3028. registerKeepAliveHook(hook, "da", target);
  3029. }
  3030. function registerKeepAliveHook(hook, type, target = currentInstance) {
  3031. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  3032. let current = target;
  3033. while (current) {
  3034. if (current.isDeactivated) {
  3035. return;
  3036. }
  3037. current = current.parent;
  3038. }
  3039. return hook();
  3040. });
  3041. injectHook(type, wrappedHook, target);
  3042. if (target) {
  3043. let current = target.parent;
  3044. while (current && current.parent) {
  3045. if (isKeepAlive(current.parent.vnode)) {
  3046. injectToKeepAliveRoot(wrappedHook, type, target, current);
  3047. }
  3048. current = current.parent;
  3049. }
  3050. }
  3051. }
  3052. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  3053. const injected = injectHook(
  3054. type,
  3055. hook,
  3056. keepAliveRoot,
  3057. true
  3058. /* prepend */
  3059. );
  3060. onUnmounted(() => {
  3061. remove(keepAliveRoot[type], injected);
  3062. }, target);
  3063. }
  3064. function resetShapeFlag(vnode) {
  3065. vnode.shapeFlag &= ~256;
  3066. vnode.shapeFlag &= ~512;
  3067. }
  3068. function getInnerChild(vnode) {
  3069. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  3070. }
  3071. function injectHook(type, hook, target = currentInstance, prepend = false) {
  3072. if (target) {
  3073. const hooks = target[type] || (target[type] = []);
  3074. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  3075. pauseTracking();
  3076. const reset = setCurrentInstance(target);
  3077. const res = callWithAsyncErrorHandling(hook, target, type, args);
  3078. reset();
  3079. resetTracking();
  3080. return res;
  3081. });
  3082. if (prepend) {
  3083. hooks.unshift(wrappedHook);
  3084. } else {
  3085. hooks.push(wrappedHook);
  3086. }
  3087. return wrappedHook;
  3088. } else {
  3089. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  3090. warn$1(
  3091. `${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.` )
  3092. );
  3093. }
  3094. }
  3095. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  3096. if (!isInSSRComponentSetup || lifecycle === "sp") {
  3097. injectHook(lifecycle, (...args) => hook(...args), target);
  3098. }
  3099. };
  3100. const onBeforeMount = createHook("bm");
  3101. const onMounted = createHook("m");
  3102. const onBeforeUpdate = createHook("bu");
  3103. const onUpdated = createHook("u");
  3104. const onBeforeUnmount = createHook("bum");
  3105. const onUnmounted = createHook("um");
  3106. const onServerPrefetch = createHook("sp");
  3107. const onRenderTriggered = createHook(
  3108. "rtg"
  3109. );
  3110. const onRenderTracked = createHook(
  3111. "rtc"
  3112. );
  3113. function onErrorCaptured(hook, target = currentInstance) {
  3114. injectHook("ec", hook, target);
  3115. }
  3116. const COMPONENTS = "components";
  3117. const DIRECTIVES = "directives";
  3118. function resolveComponent(name, maybeSelfReference) {
  3119. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  3120. }
  3121. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  3122. function resolveDynamicComponent(component) {
  3123. if (isString(component)) {
  3124. return resolveAsset(COMPONENTS, component, false) || component;
  3125. } else {
  3126. return component || NULL_DYNAMIC_COMPONENT;
  3127. }
  3128. }
  3129. function resolveDirective(name) {
  3130. return resolveAsset(DIRECTIVES, name);
  3131. }
  3132. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  3133. const instance = currentRenderingInstance || currentInstance;
  3134. if (instance) {
  3135. const Component = instance.type;
  3136. if (type === COMPONENTS) {
  3137. const selfName = getComponentName(
  3138. Component,
  3139. false
  3140. );
  3141. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  3142. return Component;
  3143. }
  3144. }
  3145. const res = (
  3146. // local registration
  3147. // check instance[type] first which is resolved for options API
  3148. resolve(instance[type] || Component[type], name) || // global registration
  3149. resolve(instance.appContext[type], name)
  3150. );
  3151. if (!res && maybeSelfReference) {
  3152. return Component;
  3153. }
  3154. if (warnMissing && !res) {
  3155. const extra = type === COMPONENTS ? `
  3156. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  3157. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  3158. }
  3159. return res;
  3160. } else {
  3161. warn$1(
  3162. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  3163. );
  3164. }
  3165. }
  3166. function resolve(registry, name) {
  3167. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  3168. }
  3169. function renderList(source, renderItem, cache, index) {
  3170. let ret;
  3171. const cached = cache && cache[index];
  3172. if (isArray(source) || isString(source)) {
  3173. ret = new Array(source.length);
  3174. for (let i = 0, l = source.length; i < l; i++) {
  3175. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  3176. }
  3177. } else if (typeof source === "number") {
  3178. if (!Number.isInteger(source)) {
  3179. warn$1(`The v-for range expect an integer value but got ${source}.`);
  3180. }
  3181. ret = new Array(source);
  3182. for (let i = 0; i < source; i++) {
  3183. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  3184. }
  3185. } else if (isObject(source)) {
  3186. if (source[Symbol.iterator]) {
  3187. ret = Array.from(
  3188. source,
  3189. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  3190. );
  3191. } else {
  3192. const keys = Object.keys(source);
  3193. ret = new Array(keys.length);
  3194. for (let i = 0, l = keys.length; i < l; i++) {
  3195. const key = keys[i];
  3196. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  3197. }
  3198. }
  3199. } else {
  3200. ret = [];
  3201. }
  3202. if (cache) {
  3203. cache[index] = ret;
  3204. }
  3205. return ret;
  3206. }
  3207. function createSlots(slots, dynamicSlots) {
  3208. for (let i = 0; i < dynamicSlots.length; i++) {
  3209. const slot = dynamicSlots[i];
  3210. if (isArray(slot)) {
  3211. for (let j = 0; j < slot.length; j++) {
  3212. slots[slot[j].name] = slot[j].fn;
  3213. }
  3214. } else if (slot) {
  3215. slots[slot.name] = slot.key ? (...args) => {
  3216. const res = slot.fn(...args);
  3217. if (res) res.key = slot.key;
  3218. return res;
  3219. } : slot.fn;
  3220. }
  3221. }
  3222. return slots;
  3223. }
  3224. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  3225. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  3226. if (name !== "default") props.name = name;
  3227. return createVNode("slot", props, fallback && fallback());
  3228. }
  3229. let slot = slots[name];
  3230. if (slot && slot.length > 1) {
  3231. warn$1(
  3232. `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.`
  3233. );
  3234. slot = () => [];
  3235. }
  3236. if (slot && slot._c) {
  3237. slot._d = false;
  3238. }
  3239. openBlock();
  3240. const validSlotContent = slot && ensureValidVNode(slot(props));
  3241. const rendered = createBlock(
  3242. Fragment,
  3243. {
  3244. key: (props.key || // slot content array of a dynamic conditional slot may have a branch
  3245. // key attached in the `createSlots` helper, respect that
  3246. validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
  3247. (!validSlotContent && fallback ? "_fb" : "")
  3248. },
  3249. validSlotContent || (fallback ? fallback() : []),
  3250. validSlotContent && slots._ === 1 ? 64 : -2
  3251. );
  3252. if (!noSlotted && rendered.scopeId) {
  3253. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  3254. }
  3255. if (slot && slot._c) {
  3256. slot._d = true;
  3257. }
  3258. return rendered;
  3259. }
  3260. function ensureValidVNode(vnodes) {
  3261. return vnodes.some((child) => {
  3262. if (!isVNode(child)) return true;
  3263. if (child.type === Comment) return false;
  3264. if (child.type === Fragment && !ensureValidVNode(child.children))
  3265. return false;
  3266. return true;
  3267. }) ? vnodes : null;
  3268. }
  3269. function toHandlers(obj, preserveCaseIfNecessary) {
  3270. const ret = {};
  3271. if (!isObject(obj)) {
  3272. warn$1(`v-on with no argument expects an object value.`);
  3273. return ret;
  3274. }
  3275. for (const key in obj) {
  3276. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  3277. }
  3278. return ret;
  3279. }
  3280. const getPublicInstance = (i) => {
  3281. if (!i) return null;
  3282. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  3283. return getPublicInstance(i.parent);
  3284. };
  3285. const publicPropertiesMap = (
  3286. // Move PURE marker to new line to workaround compiler discarding it
  3287. // due to type annotation
  3288. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  3289. $: (i) => i,
  3290. $el: (i) => i.vnode.el,
  3291. $data: (i) => i.data,
  3292. $props: (i) => shallowReadonly(i.props) ,
  3293. $attrs: (i) => shallowReadonly(i.attrs) ,
  3294. $slots: (i) => shallowReadonly(i.slots) ,
  3295. $refs: (i) => shallowReadonly(i.refs) ,
  3296. $parent: (i) => getPublicInstance(i.parent),
  3297. $root: (i) => getPublicInstance(i.root),
  3298. $emit: (i) => i.emit,
  3299. $options: (i) => resolveMergedOptions(i) ,
  3300. $forceUpdate: (i) => i.f || (i.f = () => {
  3301. i.effect.dirty = true;
  3302. queueJob(i.update);
  3303. }),
  3304. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  3305. $watch: (i) => instanceWatch.bind(i)
  3306. })
  3307. );
  3308. const isReservedPrefix = (key) => key === "_" || key === "$";
  3309. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  3310. const PublicInstanceProxyHandlers = {
  3311. get({ _: instance }, key) {
  3312. if (key === "__v_skip") {
  3313. return true;
  3314. }
  3315. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  3316. if (key === "__isVue") {
  3317. return true;
  3318. }
  3319. let normalizedProps;
  3320. if (key[0] !== "$") {
  3321. const n = accessCache[key];
  3322. if (n !== void 0) {
  3323. switch (n) {
  3324. case 1 /* SETUP */:
  3325. return setupState[key];
  3326. case 2 /* DATA */:
  3327. return data[key];
  3328. case 4 /* CONTEXT */:
  3329. return ctx[key];
  3330. case 3 /* PROPS */:
  3331. return props[key];
  3332. }
  3333. } else if (hasSetupBinding(setupState, key)) {
  3334. accessCache[key] = 1 /* SETUP */;
  3335. return setupState[key];
  3336. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  3337. accessCache[key] = 2 /* DATA */;
  3338. return data[key];
  3339. } else if (
  3340. // only cache other properties when instance has declared (thus stable)
  3341. // props
  3342. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  3343. ) {
  3344. accessCache[key] = 3 /* PROPS */;
  3345. return props[key];
  3346. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  3347. accessCache[key] = 4 /* CONTEXT */;
  3348. return ctx[key];
  3349. } else if (shouldCacheAccess) {
  3350. accessCache[key] = 0 /* OTHER */;
  3351. }
  3352. }
  3353. const publicGetter = publicPropertiesMap[key];
  3354. let cssModule, globalProperties;
  3355. if (publicGetter) {
  3356. if (key === "$attrs") {
  3357. track(instance.attrs, "get", "");
  3358. markAttrsAccessed();
  3359. } else if (key === "$slots") {
  3360. track(instance, "get", key);
  3361. }
  3362. return publicGetter(instance);
  3363. } else if (
  3364. // css module (injected by vue-loader)
  3365. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  3366. ) {
  3367. return cssModule;
  3368. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  3369. accessCache[key] = 4 /* CONTEXT */;
  3370. return ctx[key];
  3371. } else if (
  3372. // global properties
  3373. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  3374. ) {
  3375. {
  3376. return globalProperties[key];
  3377. }
  3378. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  3379. // to infinite warning loop
  3380. key.indexOf("__v") !== 0)) {
  3381. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  3382. warn$1(
  3383. `Property ${JSON.stringify(
  3384. key
  3385. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  3386. );
  3387. } else if (instance === currentRenderingInstance) {
  3388. warn$1(
  3389. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  3390. );
  3391. }
  3392. }
  3393. },
  3394. set({ _: instance }, key, value) {
  3395. const { data, setupState, ctx } = instance;
  3396. if (hasSetupBinding(setupState, key)) {
  3397. setupState[key] = value;
  3398. return true;
  3399. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  3400. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  3401. return false;
  3402. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  3403. data[key] = value;
  3404. return true;
  3405. } else if (hasOwn(instance.props, key)) {
  3406. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  3407. return false;
  3408. }
  3409. if (key[0] === "$" && key.slice(1) in instance) {
  3410. warn$1(
  3411. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  3412. );
  3413. return false;
  3414. } else {
  3415. if (key in instance.appContext.config.globalProperties) {
  3416. Object.defineProperty(ctx, key, {
  3417. enumerable: true,
  3418. configurable: true,
  3419. value
  3420. });
  3421. } else {
  3422. ctx[key] = value;
  3423. }
  3424. }
  3425. return true;
  3426. },
  3427. has({
  3428. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  3429. }, key) {
  3430. let normalizedProps;
  3431. 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);
  3432. },
  3433. defineProperty(target, key, descriptor) {
  3434. if (descriptor.get != null) {
  3435. target._.accessCache[key] = 0;
  3436. } else if (hasOwn(descriptor, "value")) {
  3437. this.set(target, key, descriptor.value, null);
  3438. }
  3439. return Reflect.defineProperty(target, key, descriptor);
  3440. }
  3441. };
  3442. {
  3443. PublicInstanceProxyHandlers.ownKeys = (target) => {
  3444. warn$1(
  3445. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  3446. );
  3447. return Reflect.ownKeys(target);
  3448. };
  3449. }
  3450. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
  3451. {},
  3452. PublicInstanceProxyHandlers,
  3453. {
  3454. get(target, key) {
  3455. if (key === Symbol.unscopables) {
  3456. return;
  3457. }
  3458. return PublicInstanceProxyHandlers.get(target, key, target);
  3459. },
  3460. has(_, key) {
  3461. const has = key[0] !== "_" && !isGloballyAllowed(key);
  3462. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  3463. warn$1(
  3464. `Property ${JSON.stringify(
  3465. key
  3466. )} should not start with _ which is a reserved prefix for Vue internals.`
  3467. );
  3468. }
  3469. return has;
  3470. }
  3471. }
  3472. );
  3473. function createDevRenderContext(instance) {
  3474. const target = {};
  3475. Object.defineProperty(target, `_`, {
  3476. configurable: true,
  3477. enumerable: false,
  3478. get: () => instance
  3479. });
  3480. Object.keys(publicPropertiesMap).forEach((key) => {
  3481. Object.defineProperty(target, key, {
  3482. configurable: true,
  3483. enumerable: false,
  3484. get: () => publicPropertiesMap[key](instance),
  3485. // intercepted by the proxy so no need for implementation,
  3486. // but needed to prevent set errors
  3487. set: NOOP
  3488. });
  3489. });
  3490. return target;
  3491. }
  3492. function exposePropsOnRenderContext(instance) {
  3493. const {
  3494. ctx,
  3495. propsOptions: [propsOptions]
  3496. } = instance;
  3497. if (propsOptions) {
  3498. Object.keys(propsOptions).forEach((key) => {
  3499. Object.defineProperty(ctx, key, {
  3500. enumerable: true,
  3501. configurable: true,
  3502. get: () => instance.props[key],
  3503. set: NOOP
  3504. });
  3505. });
  3506. }
  3507. }
  3508. function exposeSetupStateOnRenderContext(instance) {
  3509. const { ctx, setupState } = instance;
  3510. Object.keys(toRaw(setupState)).forEach((key) => {
  3511. if (!setupState.__isScriptSetup) {
  3512. if (isReservedPrefix(key[0])) {
  3513. warn$1(
  3514. `setup() return property ${JSON.stringify(
  3515. key
  3516. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  3517. );
  3518. return;
  3519. }
  3520. Object.defineProperty(ctx, key, {
  3521. enumerable: true,
  3522. configurable: true,
  3523. get: () => setupState[key],
  3524. set: NOOP
  3525. });
  3526. }
  3527. });
  3528. }
  3529. const warnRuntimeUsage = (method) => warn$1(
  3530. `${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.`
  3531. );
  3532. function defineProps() {
  3533. {
  3534. warnRuntimeUsage(`defineProps`);
  3535. }
  3536. return null;
  3537. }
  3538. function defineEmits() {
  3539. {
  3540. warnRuntimeUsage(`defineEmits`);
  3541. }
  3542. return null;
  3543. }
  3544. function defineExpose(exposed) {
  3545. {
  3546. warnRuntimeUsage(`defineExpose`);
  3547. }
  3548. }
  3549. function defineOptions(options) {
  3550. {
  3551. warnRuntimeUsage(`defineOptions`);
  3552. }
  3553. }
  3554. function defineSlots() {
  3555. {
  3556. warnRuntimeUsage(`defineSlots`);
  3557. }
  3558. return null;
  3559. }
  3560. function defineModel() {
  3561. {
  3562. warnRuntimeUsage("defineModel");
  3563. }
  3564. }
  3565. function withDefaults(props, defaults) {
  3566. {
  3567. warnRuntimeUsage(`withDefaults`);
  3568. }
  3569. return null;
  3570. }
  3571. function useSlots() {
  3572. return getContext().slots;
  3573. }
  3574. function useAttrs() {
  3575. return getContext().attrs;
  3576. }
  3577. function getContext() {
  3578. const i = getCurrentInstance();
  3579. if (!i) {
  3580. warn$1(`useContext() called without active instance.`);
  3581. }
  3582. return i.setupContext || (i.setupContext = createSetupContext(i));
  3583. }
  3584. function normalizePropsOrEmits(props) {
  3585. return isArray(props) ? props.reduce(
  3586. (normalized, p) => (normalized[p] = null, normalized),
  3587. {}
  3588. ) : props;
  3589. }
  3590. function mergeDefaults(raw, defaults) {
  3591. const props = normalizePropsOrEmits(raw);
  3592. for (const key in defaults) {
  3593. if (key.startsWith("__skip")) continue;
  3594. let opt = props[key];
  3595. if (opt) {
  3596. if (isArray(opt) || isFunction(opt)) {
  3597. opt = props[key] = { type: opt, default: defaults[key] };
  3598. } else {
  3599. opt.default = defaults[key];
  3600. }
  3601. } else if (opt === null) {
  3602. opt = props[key] = { default: defaults[key] };
  3603. } else {
  3604. warn$1(`props default key "${key}" has no corresponding declaration.`);
  3605. }
  3606. if (opt && defaults[`__skip_${key}`]) {
  3607. opt.skipFactory = true;
  3608. }
  3609. }
  3610. return props;
  3611. }
  3612. function mergeModels(a, b) {
  3613. if (!a || !b) return a || b;
  3614. if (isArray(a) && isArray(b)) return a.concat(b);
  3615. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  3616. }
  3617. function createPropsRestProxy(props, excludedKeys) {
  3618. const ret = {};
  3619. for (const key in props) {
  3620. if (!excludedKeys.includes(key)) {
  3621. Object.defineProperty(ret, key, {
  3622. enumerable: true,
  3623. get: () => props[key]
  3624. });
  3625. }
  3626. }
  3627. return ret;
  3628. }
  3629. function withAsyncContext(getAwaitable) {
  3630. const ctx = getCurrentInstance();
  3631. if (!ctx) {
  3632. warn$1(
  3633. `withAsyncContext called without active current instance. This is likely a bug.`
  3634. );
  3635. }
  3636. let awaitable = getAwaitable();
  3637. unsetCurrentInstance();
  3638. if (isPromise(awaitable)) {
  3639. awaitable = awaitable.catch((e) => {
  3640. setCurrentInstance(ctx);
  3641. throw e;
  3642. });
  3643. }
  3644. return [awaitable, () => setCurrentInstance(ctx)];
  3645. }
  3646. function createDuplicateChecker() {
  3647. const cache = /* @__PURE__ */ Object.create(null);
  3648. return (type, key) => {
  3649. if (cache[key]) {
  3650. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  3651. } else {
  3652. cache[key] = type;
  3653. }
  3654. };
  3655. }
  3656. let shouldCacheAccess = true;
  3657. function applyOptions(instance) {
  3658. const options = resolveMergedOptions(instance);
  3659. const publicThis = instance.proxy;
  3660. const ctx = instance.ctx;
  3661. shouldCacheAccess = false;
  3662. if (options.beforeCreate) {
  3663. callHook$1(options.beforeCreate, instance, "bc");
  3664. }
  3665. const {
  3666. // state
  3667. data: dataOptions,
  3668. computed: computedOptions,
  3669. methods,
  3670. watch: watchOptions,
  3671. provide: provideOptions,
  3672. inject: injectOptions,
  3673. // lifecycle
  3674. created,
  3675. beforeMount,
  3676. mounted,
  3677. beforeUpdate,
  3678. updated,
  3679. activated,
  3680. deactivated,
  3681. beforeDestroy,
  3682. beforeUnmount,
  3683. destroyed,
  3684. unmounted,
  3685. render,
  3686. renderTracked,
  3687. renderTriggered,
  3688. errorCaptured,
  3689. serverPrefetch,
  3690. // public API
  3691. expose,
  3692. inheritAttrs,
  3693. // assets
  3694. components,
  3695. directives,
  3696. filters
  3697. } = options;
  3698. const checkDuplicateProperties = createDuplicateChecker() ;
  3699. {
  3700. const [propsOptions] = instance.propsOptions;
  3701. if (propsOptions) {
  3702. for (const key in propsOptions) {
  3703. checkDuplicateProperties("Props" /* PROPS */, key);
  3704. }
  3705. }
  3706. }
  3707. if (injectOptions) {
  3708. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  3709. }
  3710. if (methods) {
  3711. for (const key in methods) {
  3712. const methodHandler = methods[key];
  3713. if (isFunction(methodHandler)) {
  3714. {
  3715. Object.defineProperty(ctx, key, {
  3716. value: methodHandler.bind(publicThis),
  3717. configurable: true,
  3718. enumerable: true,
  3719. writable: true
  3720. });
  3721. }
  3722. {
  3723. checkDuplicateProperties("Methods" /* METHODS */, key);
  3724. }
  3725. } else {
  3726. warn$1(
  3727. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  3728. );
  3729. }
  3730. }
  3731. }
  3732. if (dataOptions) {
  3733. if (!isFunction(dataOptions)) {
  3734. warn$1(
  3735. `The data option must be a function. Plain object usage is no longer supported.`
  3736. );
  3737. }
  3738. const data = dataOptions.call(publicThis, publicThis);
  3739. if (isPromise(data)) {
  3740. warn$1(
  3741. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  3742. );
  3743. }
  3744. if (!isObject(data)) {
  3745. warn$1(`data() should return an object.`);
  3746. } else {
  3747. instance.data = reactive(data);
  3748. {
  3749. for (const key in data) {
  3750. checkDuplicateProperties("Data" /* DATA */, key);
  3751. if (!isReservedPrefix(key[0])) {
  3752. Object.defineProperty(ctx, key, {
  3753. configurable: true,
  3754. enumerable: true,
  3755. get: () => data[key],
  3756. set: NOOP
  3757. });
  3758. }
  3759. }
  3760. }
  3761. }
  3762. }
  3763. shouldCacheAccess = true;
  3764. if (computedOptions) {
  3765. for (const key in computedOptions) {
  3766. const opt = computedOptions[key];
  3767. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  3768. if (get === NOOP) {
  3769. warn$1(`Computed property "${key}" has no getter.`);
  3770. }
  3771. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  3772. warn$1(
  3773. `Write operation failed: computed property "${key}" is readonly.`
  3774. );
  3775. } ;
  3776. const c = computed({
  3777. get,
  3778. set
  3779. });
  3780. Object.defineProperty(ctx, key, {
  3781. enumerable: true,
  3782. configurable: true,
  3783. get: () => c.value,
  3784. set: (v) => c.value = v
  3785. });
  3786. {
  3787. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  3788. }
  3789. }
  3790. }
  3791. if (watchOptions) {
  3792. for (const key in watchOptions) {
  3793. createWatcher(watchOptions[key], ctx, publicThis, key);
  3794. }
  3795. }
  3796. if (provideOptions) {
  3797. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  3798. Reflect.ownKeys(provides).forEach((key) => {
  3799. provide(key, provides[key]);
  3800. });
  3801. }
  3802. if (created) {
  3803. callHook$1(created, instance, "c");
  3804. }
  3805. function registerLifecycleHook(register, hook) {
  3806. if (isArray(hook)) {
  3807. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  3808. } else if (hook) {
  3809. register(hook.bind(publicThis));
  3810. }
  3811. }
  3812. registerLifecycleHook(onBeforeMount, beforeMount);
  3813. registerLifecycleHook(onMounted, mounted);
  3814. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  3815. registerLifecycleHook(onUpdated, updated);
  3816. registerLifecycleHook(onActivated, activated);
  3817. registerLifecycleHook(onDeactivated, deactivated);
  3818. registerLifecycleHook(onErrorCaptured, errorCaptured);
  3819. registerLifecycleHook(onRenderTracked, renderTracked);
  3820. registerLifecycleHook(onRenderTriggered, renderTriggered);
  3821. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  3822. registerLifecycleHook(onUnmounted, unmounted);
  3823. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  3824. if (isArray(expose)) {
  3825. if (expose.length) {
  3826. const exposed = instance.exposed || (instance.exposed = {});
  3827. expose.forEach((key) => {
  3828. Object.defineProperty(exposed, key, {
  3829. get: () => publicThis[key],
  3830. set: (val) => publicThis[key] = val
  3831. });
  3832. });
  3833. } else if (!instance.exposed) {
  3834. instance.exposed = {};
  3835. }
  3836. }
  3837. if (render && instance.render === NOOP) {
  3838. instance.render = render;
  3839. }
  3840. if (inheritAttrs != null) {
  3841. instance.inheritAttrs = inheritAttrs;
  3842. }
  3843. if (components) instance.components = components;
  3844. if (directives) instance.directives = directives;
  3845. }
  3846. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  3847. if (isArray(injectOptions)) {
  3848. injectOptions = normalizeInject(injectOptions);
  3849. }
  3850. for (const key in injectOptions) {
  3851. const opt = injectOptions[key];
  3852. let injected;
  3853. if (isObject(opt)) {
  3854. if ("default" in opt) {
  3855. injected = inject(
  3856. opt.from || key,
  3857. opt.default,
  3858. true
  3859. );
  3860. } else {
  3861. injected = inject(opt.from || key);
  3862. }
  3863. } else {
  3864. injected = inject(opt);
  3865. }
  3866. if (isRef(injected)) {
  3867. Object.defineProperty(ctx, key, {
  3868. enumerable: true,
  3869. configurable: true,
  3870. get: () => injected.value,
  3871. set: (v) => injected.value = v
  3872. });
  3873. } else {
  3874. ctx[key] = injected;
  3875. }
  3876. {
  3877. checkDuplicateProperties("Inject" /* INJECT */, key);
  3878. }
  3879. }
  3880. }
  3881. function callHook$1(hook, instance, type) {
  3882. callWithAsyncErrorHandling(
  3883. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  3884. instance,
  3885. type
  3886. );
  3887. }
  3888. function createWatcher(raw, ctx, publicThis, key) {
  3889. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  3890. if (isString(raw)) {
  3891. const handler = ctx[raw];
  3892. if (isFunction(handler)) {
  3893. watch(getter, handler);
  3894. } else {
  3895. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  3896. }
  3897. } else if (isFunction(raw)) {
  3898. watch(getter, raw.bind(publicThis));
  3899. } else if (isObject(raw)) {
  3900. if (isArray(raw)) {
  3901. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  3902. } else {
  3903. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  3904. if (isFunction(handler)) {
  3905. watch(getter, handler, raw);
  3906. } else {
  3907. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  3908. }
  3909. }
  3910. } else {
  3911. warn$1(`Invalid watch option: "${key}"`, raw);
  3912. }
  3913. }
  3914. function resolveMergedOptions(instance) {
  3915. const base = instance.type;
  3916. const { mixins, extends: extendsOptions } = base;
  3917. const {
  3918. mixins: globalMixins,
  3919. optionsCache: cache,
  3920. config: { optionMergeStrategies }
  3921. } = instance.appContext;
  3922. const cached = cache.get(base);
  3923. let resolved;
  3924. if (cached) {
  3925. resolved = cached;
  3926. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  3927. {
  3928. resolved = base;
  3929. }
  3930. } else {
  3931. resolved = {};
  3932. if (globalMixins.length) {
  3933. globalMixins.forEach(
  3934. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  3935. );
  3936. }
  3937. mergeOptions(resolved, base, optionMergeStrategies);
  3938. }
  3939. if (isObject(base)) {
  3940. cache.set(base, resolved);
  3941. }
  3942. return resolved;
  3943. }
  3944. function mergeOptions(to, from, strats, asMixin = false) {
  3945. const { mixins, extends: extendsOptions } = from;
  3946. if (extendsOptions) {
  3947. mergeOptions(to, extendsOptions, strats, true);
  3948. }
  3949. if (mixins) {
  3950. mixins.forEach(
  3951. (m) => mergeOptions(to, m, strats, true)
  3952. );
  3953. }
  3954. for (const key in from) {
  3955. if (asMixin && key === "expose") {
  3956. warn$1(
  3957. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  3958. );
  3959. } else {
  3960. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  3961. to[key] = strat ? strat(to[key], from[key]) : from[key];
  3962. }
  3963. }
  3964. return to;
  3965. }
  3966. const internalOptionMergeStrats = {
  3967. data: mergeDataFn,
  3968. props: mergeEmitsOrPropsOptions,
  3969. emits: mergeEmitsOrPropsOptions,
  3970. // objects
  3971. methods: mergeObjectOptions,
  3972. computed: mergeObjectOptions,
  3973. // lifecycle
  3974. beforeCreate: mergeAsArray$1,
  3975. created: mergeAsArray$1,
  3976. beforeMount: mergeAsArray$1,
  3977. mounted: mergeAsArray$1,
  3978. beforeUpdate: mergeAsArray$1,
  3979. updated: mergeAsArray$1,
  3980. beforeDestroy: mergeAsArray$1,
  3981. beforeUnmount: mergeAsArray$1,
  3982. destroyed: mergeAsArray$1,
  3983. unmounted: mergeAsArray$1,
  3984. activated: mergeAsArray$1,
  3985. deactivated: mergeAsArray$1,
  3986. errorCaptured: mergeAsArray$1,
  3987. serverPrefetch: mergeAsArray$1,
  3988. // assets
  3989. components: mergeObjectOptions,
  3990. directives: mergeObjectOptions,
  3991. // watch
  3992. watch: mergeWatchOptions,
  3993. // provide / inject
  3994. provide: mergeDataFn,
  3995. inject: mergeInject
  3996. };
  3997. function mergeDataFn(to, from) {
  3998. if (!from) {
  3999. return to;
  4000. }
  4001. if (!to) {
  4002. return from;
  4003. }
  4004. return function mergedDataFn() {
  4005. return (extend)(
  4006. isFunction(to) ? to.call(this, this) : to,
  4007. isFunction(from) ? from.call(this, this) : from
  4008. );
  4009. };
  4010. }
  4011. function mergeInject(to, from) {
  4012. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  4013. }
  4014. function normalizeInject(raw) {
  4015. if (isArray(raw)) {
  4016. const res = {};
  4017. for (let i = 0; i < raw.length; i++) {
  4018. res[raw[i]] = raw[i];
  4019. }
  4020. return res;
  4021. }
  4022. return raw;
  4023. }
  4024. function mergeAsArray$1(to, from) {
  4025. return to ? [...new Set([].concat(to, from))] : from;
  4026. }
  4027. function mergeObjectOptions(to, from) {
  4028. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  4029. }
  4030. function mergeEmitsOrPropsOptions(to, from) {
  4031. if (to) {
  4032. if (isArray(to) && isArray(from)) {
  4033. return [.../* @__PURE__ */ new Set([...to, ...from])];
  4034. }
  4035. return extend(
  4036. /* @__PURE__ */ Object.create(null),
  4037. normalizePropsOrEmits(to),
  4038. normalizePropsOrEmits(from != null ? from : {})
  4039. );
  4040. } else {
  4041. return from;
  4042. }
  4043. }
  4044. function mergeWatchOptions(to, from) {
  4045. if (!to) return from;
  4046. if (!from) return to;
  4047. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  4048. for (const key in from) {
  4049. merged[key] = mergeAsArray$1(to[key], from[key]);
  4050. }
  4051. return merged;
  4052. }
  4053. function createAppContext() {
  4054. return {
  4055. app: null,
  4056. config: {
  4057. isNativeTag: NO,
  4058. performance: false,
  4059. globalProperties: {},
  4060. optionMergeStrategies: {},
  4061. errorHandler: void 0,
  4062. warnHandler: void 0,
  4063. compilerOptions: {}
  4064. },
  4065. mixins: [],
  4066. components: {},
  4067. directives: {},
  4068. provides: /* @__PURE__ */ Object.create(null),
  4069. optionsCache: /* @__PURE__ */ new WeakMap(),
  4070. propsCache: /* @__PURE__ */ new WeakMap(),
  4071. emitsCache: /* @__PURE__ */ new WeakMap()
  4072. };
  4073. }
  4074. let uid$1 = 0;
  4075. function createAppAPI(render, hydrate) {
  4076. return function createApp(rootComponent, rootProps = null) {
  4077. if (!isFunction(rootComponent)) {
  4078. rootComponent = extend({}, rootComponent);
  4079. }
  4080. if (rootProps != null && !isObject(rootProps)) {
  4081. warn$1(`root props passed to app.mount() must be an object.`);
  4082. rootProps = null;
  4083. }
  4084. const context = createAppContext();
  4085. const installedPlugins = /* @__PURE__ */ new WeakSet();
  4086. let isMounted = false;
  4087. const app = context.app = {
  4088. _uid: uid$1++,
  4089. _component: rootComponent,
  4090. _props: rootProps,
  4091. _container: null,
  4092. _context: context,
  4093. _instance: null,
  4094. version,
  4095. get config() {
  4096. return context.config;
  4097. },
  4098. set config(v) {
  4099. {
  4100. warn$1(
  4101. `app.config cannot be replaced. Modify individual options instead.`
  4102. );
  4103. }
  4104. },
  4105. use(plugin, ...options) {
  4106. if (installedPlugins.has(plugin)) {
  4107. warn$1(`Plugin has already been applied to target app.`);
  4108. } else if (plugin && isFunction(plugin.install)) {
  4109. installedPlugins.add(plugin);
  4110. plugin.install(app, ...options);
  4111. } else if (isFunction(plugin)) {
  4112. installedPlugins.add(plugin);
  4113. plugin(app, ...options);
  4114. } else {
  4115. warn$1(
  4116. `A plugin must either be a function or an object with an "install" function.`
  4117. );
  4118. }
  4119. return app;
  4120. },
  4121. mixin(mixin) {
  4122. {
  4123. if (!context.mixins.includes(mixin)) {
  4124. context.mixins.push(mixin);
  4125. } else {
  4126. warn$1(
  4127. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  4128. );
  4129. }
  4130. }
  4131. return app;
  4132. },
  4133. component(name, component) {
  4134. {
  4135. validateComponentName(name, context.config);
  4136. }
  4137. if (!component) {
  4138. return context.components[name];
  4139. }
  4140. if (context.components[name]) {
  4141. warn$1(`Component "${name}" has already been registered in target app.`);
  4142. }
  4143. context.components[name] = component;
  4144. return app;
  4145. },
  4146. directive(name, directive) {
  4147. {
  4148. validateDirectiveName(name);
  4149. }
  4150. if (!directive) {
  4151. return context.directives[name];
  4152. }
  4153. if (context.directives[name]) {
  4154. warn$1(`Directive "${name}" has already been registered in target app.`);
  4155. }
  4156. context.directives[name] = directive;
  4157. return app;
  4158. },
  4159. mount(rootContainer, isHydrate, namespace) {
  4160. if (!isMounted) {
  4161. if (rootContainer.__vue_app__) {
  4162. warn$1(
  4163. `There is already an app instance mounted on the host container.
  4164. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  4165. );
  4166. }
  4167. const vnode = createVNode(rootComponent, rootProps);
  4168. vnode.appContext = context;
  4169. if (namespace === true) {
  4170. namespace = "svg";
  4171. } else if (namespace === false) {
  4172. namespace = void 0;
  4173. }
  4174. {
  4175. context.reload = () => {
  4176. render(
  4177. cloneVNode(vnode),
  4178. rootContainer,
  4179. namespace
  4180. );
  4181. };
  4182. }
  4183. if (isHydrate && hydrate) {
  4184. hydrate(vnode, rootContainer);
  4185. } else {
  4186. render(vnode, rootContainer, namespace);
  4187. }
  4188. isMounted = true;
  4189. app._container = rootContainer;
  4190. rootContainer.__vue_app__ = app;
  4191. {
  4192. app._instance = vnode.component;
  4193. devtoolsInitApp(app, version);
  4194. }
  4195. return getComponentPublicInstance(vnode.component);
  4196. } else {
  4197. warn$1(
  4198. `App has already been mounted.
  4199. 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)\``
  4200. );
  4201. }
  4202. },
  4203. unmount() {
  4204. if (isMounted) {
  4205. render(null, app._container);
  4206. {
  4207. app._instance = null;
  4208. devtoolsUnmountApp(app);
  4209. }
  4210. delete app._container.__vue_app__;
  4211. } else {
  4212. warn$1(`Cannot unmount an app that is not mounted.`);
  4213. }
  4214. },
  4215. provide(key, value) {
  4216. if (key in context.provides) {
  4217. warn$1(
  4218. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  4219. );
  4220. }
  4221. context.provides[key] = value;
  4222. return app;
  4223. },
  4224. runWithContext(fn) {
  4225. const lastApp = currentApp;
  4226. currentApp = app;
  4227. try {
  4228. return fn();
  4229. } finally {
  4230. currentApp = lastApp;
  4231. }
  4232. }
  4233. };
  4234. return app;
  4235. };
  4236. }
  4237. let currentApp = null;
  4238. function provide(key, value) {
  4239. if (!currentInstance) {
  4240. {
  4241. warn$1(`provide() can only be used inside setup().`);
  4242. }
  4243. } else {
  4244. let provides = currentInstance.provides;
  4245. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  4246. if (parentProvides === provides) {
  4247. provides = currentInstance.provides = Object.create(parentProvides);
  4248. }
  4249. provides[key] = value;
  4250. }
  4251. }
  4252. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  4253. const instance = currentInstance || currentRenderingInstance;
  4254. if (instance || currentApp) {
  4255. const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  4256. if (provides && key in provides) {
  4257. return provides[key];
  4258. } else if (arguments.length > 1) {
  4259. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  4260. } else {
  4261. warn$1(`injection "${String(key)}" not found.`);
  4262. }
  4263. } else {
  4264. warn$1(`inject() can only be used inside setup() or functional components.`);
  4265. }
  4266. }
  4267. function hasInjectionContext() {
  4268. return !!(currentInstance || currentRenderingInstance || currentApp);
  4269. }
  4270. const internalObjectProto = {};
  4271. const createInternalObject = () => Object.create(internalObjectProto);
  4272. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  4273. function initProps(instance, rawProps, isStateful, isSSR = false) {
  4274. const props = {};
  4275. const attrs = createInternalObject();
  4276. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  4277. setFullProps(instance, rawProps, props, attrs);
  4278. for (const key in instance.propsOptions[0]) {
  4279. if (!(key in props)) {
  4280. props[key] = void 0;
  4281. }
  4282. }
  4283. {
  4284. validateProps(rawProps || {}, props, instance);
  4285. }
  4286. if (isStateful) {
  4287. instance.props = isSSR ? props : shallowReactive(props);
  4288. } else {
  4289. if (!instance.type.props) {
  4290. instance.props = attrs;
  4291. } else {
  4292. instance.props = props;
  4293. }
  4294. }
  4295. instance.attrs = attrs;
  4296. }
  4297. function isInHmrContext(instance) {
  4298. while (instance) {
  4299. if (instance.type.__hmrId) return true;
  4300. instance = instance.parent;
  4301. }
  4302. }
  4303. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  4304. const {
  4305. props,
  4306. attrs,
  4307. vnode: { patchFlag }
  4308. } = instance;
  4309. const rawCurrentProps = toRaw(props);
  4310. const [options] = instance.propsOptions;
  4311. let hasAttrsChanged = false;
  4312. if (
  4313. // always force full diff in dev
  4314. // - #1942 if hmr is enabled with sfc component
  4315. // - vite#872 non-sfc component used by sfc component
  4316. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  4317. ) {
  4318. if (patchFlag & 8) {
  4319. const propsToUpdate = instance.vnode.dynamicProps;
  4320. for (let i = 0; i < propsToUpdate.length; i++) {
  4321. let key = propsToUpdate[i];
  4322. if (isEmitListener(instance.emitsOptions, key)) {
  4323. continue;
  4324. }
  4325. const value = rawProps[key];
  4326. if (options) {
  4327. if (hasOwn(attrs, key)) {
  4328. if (value !== attrs[key]) {
  4329. attrs[key] = value;
  4330. hasAttrsChanged = true;
  4331. }
  4332. } else {
  4333. const camelizedKey = camelize(key);
  4334. props[camelizedKey] = resolvePropValue(
  4335. options,
  4336. rawCurrentProps,
  4337. camelizedKey,
  4338. value,
  4339. instance,
  4340. false
  4341. );
  4342. }
  4343. } else {
  4344. if (value !== attrs[key]) {
  4345. attrs[key] = value;
  4346. hasAttrsChanged = true;
  4347. }
  4348. }
  4349. }
  4350. }
  4351. } else {
  4352. if (setFullProps(instance, rawProps, props, attrs)) {
  4353. hasAttrsChanged = true;
  4354. }
  4355. let kebabKey;
  4356. for (const key in rawCurrentProps) {
  4357. if (!rawProps || // for camelCase
  4358. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  4359. // and converted to camelCase (#955)
  4360. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  4361. if (options) {
  4362. if (rawPrevProps && // for camelCase
  4363. (rawPrevProps[key] !== void 0 || // for kebab-case
  4364. rawPrevProps[kebabKey] !== void 0)) {
  4365. props[key] = resolvePropValue(
  4366. options,
  4367. rawCurrentProps,
  4368. key,
  4369. void 0,
  4370. instance,
  4371. true
  4372. );
  4373. }
  4374. } else {
  4375. delete props[key];
  4376. }
  4377. }
  4378. }
  4379. if (attrs !== rawCurrentProps) {
  4380. for (const key in attrs) {
  4381. if (!rawProps || !hasOwn(rawProps, key) && true) {
  4382. delete attrs[key];
  4383. hasAttrsChanged = true;
  4384. }
  4385. }
  4386. }
  4387. }
  4388. if (hasAttrsChanged) {
  4389. trigger(instance.attrs, "set", "");
  4390. }
  4391. {
  4392. validateProps(rawProps || {}, props, instance);
  4393. }
  4394. }
  4395. function setFullProps(instance, rawProps, props, attrs) {
  4396. const [options, needCastKeys] = instance.propsOptions;
  4397. let hasAttrsChanged = false;
  4398. let rawCastValues;
  4399. if (rawProps) {
  4400. for (let key in rawProps) {
  4401. if (isReservedProp(key)) {
  4402. continue;
  4403. }
  4404. const value = rawProps[key];
  4405. let camelKey;
  4406. if (options && hasOwn(options, camelKey = camelize(key))) {
  4407. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  4408. props[camelKey] = value;
  4409. } else {
  4410. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  4411. }
  4412. } else if (!isEmitListener(instance.emitsOptions, key)) {
  4413. if (!(key in attrs) || value !== attrs[key]) {
  4414. attrs[key] = value;
  4415. hasAttrsChanged = true;
  4416. }
  4417. }
  4418. }
  4419. }
  4420. if (needCastKeys) {
  4421. const rawCurrentProps = toRaw(props);
  4422. const castValues = rawCastValues || EMPTY_OBJ;
  4423. for (let i = 0; i < needCastKeys.length; i++) {
  4424. const key = needCastKeys[i];
  4425. props[key] = resolvePropValue(
  4426. options,
  4427. rawCurrentProps,
  4428. key,
  4429. castValues[key],
  4430. instance,
  4431. !hasOwn(castValues, key)
  4432. );
  4433. }
  4434. }
  4435. return hasAttrsChanged;
  4436. }
  4437. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  4438. const opt = options[key];
  4439. if (opt != null) {
  4440. const hasDefault = hasOwn(opt, "default");
  4441. if (hasDefault && value === void 0) {
  4442. const defaultValue = opt.default;
  4443. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  4444. const { propsDefaults } = instance;
  4445. if (key in propsDefaults) {
  4446. value = propsDefaults[key];
  4447. } else {
  4448. const reset = setCurrentInstance(instance);
  4449. value = propsDefaults[key] = defaultValue.call(
  4450. null,
  4451. props
  4452. );
  4453. reset();
  4454. }
  4455. } else {
  4456. value = defaultValue;
  4457. }
  4458. }
  4459. if (opt[0 /* shouldCast */]) {
  4460. if (isAbsent && !hasDefault) {
  4461. value = false;
  4462. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  4463. value = true;
  4464. }
  4465. }
  4466. }
  4467. return value;
  4468. }
  4469. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  4470. function normalizePropsOptions(comp, appContext, asMixin = false) {
  4471. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  4472. const cached = cache.get(comp);
  4473. if (cached) {
  4474. return cached;
  4475. }
  4476. const raw = comp.props;
  4477. const normalized = {};
  4478. const needCastKeys = [];
  4479. let hasExtends = false;
  4480. if (!isFunction(comp)) {
  4481. const extendProps = (raw2) => {
  4482. hasExtends = true;
  4483. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  4484. extend(normalized, props);
  4485. if (keys) needCastKeys.push(...keys);
  4486. };
  4487. if (!asMixin && appContext.mixins.length) {
  4488. appContext.mixins.forEach(extendProps);
  4489. }
  4490. if (comp.extends) {
  4491. extendProps(comp.extends);
  4492. }
  4493. if (comp.mixins) {
  4494. comp.mixins.forEach(extendProps);
  4495. }
  4496. }
  4497. if (!raw && !hasExtends) {
  4498. if (isObject(comp)) {
  4499. cache.set(comp, EMPTY_ARR);
  4500. }
  4501. return EMPTY_ARR;
  4502. }
  4503. if (isArray(raw)) {
  4504. for (let i = 0; i < raw.length; i++) {
  4505. if (!isString(raw[i])) {
  4506. warn$1(`props must be strings when using array syntax.`, raw[i]);
  4507. }
  4508. const normalizedKey = camelize(raw[i]);
  4509. if (validatePropName(normalizedKey)) {
  4510. normalized[normalizedKey] = EMPTY_OBJ;
  4511. }
  4512. }
  4513. } else if (raw) {
  4514. if (!isObject(raw)) {
  4515. warn$1(`invalid props options`, raw);
  4516. }
  4517. for (const key in raw) {
  4518. const normalizedKey = camelize(key);
  4519. if (validatePropName(normalizedKey)) {
  4520. const opt = raw[key];
  4521. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  4522. const propType = prop.type;
  4523. let shouldCast = false;
  4524. let shouldCastTrue = true;
  4525. if (isArray(propType)) {
  4526. for (let index = 0; index < propType.length; ++index) {
  4527. const type = propType[index];
  4528. const typeName = isFunction(type) && type.name;
  4529. if (typeName === "Boolean") {
  4530. shouldCast = true;
  4531. break;
  4532. } else if (typeName === "String") {
  4533. shouldCastTrue = false;
  4534. }
  4535. }
  4536. } else {
  4537. shouldCast = isFunction(propType) && propType.name === "Boolean";
  4538. }
  4539. prop[0 /* shouldCast */] = shouldCast;
  4540. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  4541. if (shouldCast || hasOwn(prop, "default")) {
  4542. needCastKeys.push(normalizedKey);
  4543. }
  4544. }
  4545. }
  4546. }
  4547. const res = [normalized, needCastKeys];
  4548. if (isObject(comp)) {
  4549. cache.set(comp, res);
  4550. }
  4551. return res;
  4552. }
  4553. function validatePropName(key) {
  4554. if (key[0] !== "$" && !isReservedProp(key)) {
  4555. return true;
  4556. } else {
  4557. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  4558. }
  4559. return false;
  4560. }
  4561. function getType(ctor) {
  4562. if (ctor === null) {
  4563. return "null";
  4564. }
  4565. if (typeof ctor === "function") {
  4566. return ctor.name || "";
  4567. } else if (typeof ctor === "object") {
  4568. const name = ctor.constructor && ctor.constructor.name;
  4569. return name || "";
  4570. }
  4571. return "";
  4572. }
  4573. function validateProps(rawProps, props, instance) {
  4574. const resolvedValues = toRaw(props);
  4575. const options = instance.propsOptions[0];
  4576. for (const key in options) {
  4577. let opt = options[key];
  4578. if (opt == null) continue;
  4579. validateProp(
  4580. key,
  4581. resolvedValues[key],
  4582. opt,
  4583. shallowReadonly(resolvedValues) ,
  4584. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  4585. );
  4586. }
  4587. }
  4588. function validateProp(name, value, prop, props, isAbsent) {
  4589. const { type, required, validator, skipCheck } = prop;
  4590. if (required && isAbsent) {
  4591. warn$1('Missing required prop: "' + name + '"');
  4592. return;
  4593. }
  4594. if (value == null && !required) {
  4595. return;
  4596. }
  4597. if (type != null && type !== true && !skipCheck) {
  4598. let isValid = false;
  4599. const types = isArray(type) ? type : [type];
  4600. const expectedTypes = [];
  4601. for (let i = 0; i < types.length && !isValid; i++) {
  4602. const { valid, expectedType } = assertType(value, types[i]);
  4603. expectedTypes.push(expectedType || "");
  4604. isValid = valid;
  4605. }
  4606. if (!isValid) {
  4607. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  4608. return;
  4609. }
  4610. }
  4611. if (validator && !validator(value, props)) {
  4612. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  4613. }
  4614. }
  4615. const isSimpleType = /* @__PURE__ */ makeMap(
  4616. "String,Number,Boolean,Function,Symbol,BigInt"
  4617. );
  4618. function assertType(value, type) {
  4619. let valid;
  4620. const expectedType = getType(type);
  4621. if (isSimpleType(expectedType)) {
  4622. const t = typeof value;
  4623. valid = t === expectedType.toLowerCase();
  4624. if (!valid && t === "object") {
  4625. valid = value instanceof type;
  4626. }
  4627. } else if (expectedType === "Object") {
  4628. valid = isObject(value);
  4629. } else if (expectedType === "Array") {
  4630. valid = isArray(value);
  4631. } else if (expectedType === "null") {
  4632. valid = value === null;
  4633. } else {
  4634. valid = value instanceof type;
  4635. }
  4636. return {
  4637. valid,
  4638. expectedType
  4639. };
  4640. }
  4641. function getInvalidTypeMessage(name, value, expectedTypes) {
  4642. if (expectedTypes.length === 0) {
  4643. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  4644. }
  4645. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  4646. const expectedType = expectedTypes[0];
  4647. const receivedType = toRawType(value);
  4648. const expectedValue = styleValue(value, expectedType);
  4649. const receivedValue = styleValue(value, receivedType);
  4650. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  4651. message += ` with value ${expectedValue}`;
  4652. }
  4653. message += `, got ${receivedType} `;
  4654. if (isExplicable(receivedType)) {
  4655. message += `with value ${receivedValue}.`;
  4656. }
  4657. return message;
  4658. }
  4659. function styleValue(value, type) {
  4660. if (type === "String") {
  4661. return `"${value}"`;
  4662. } else if (type === "Number") {
  4663. return `${Number(value)}`;
  4664. } else {
  4665. return `${value}`;
  4666. }
  4667. }
  4668. function isExplicable(type) {
  4669. const explicitTypes = ["string", "number", "boolean"];
  4670. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  4671. }
  4672. function isBoolean(...args) {
  4673. return args.some((elem) => elem.toLowerCase() === "boolean");
  4674. }
  4675. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  4676. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  4677. const normalizeSlot = (key, rawSlot, ctx) => {
  4678. if (rawSlot._n) {
  4679. return rawSlot;
  4680. }
  4681. const normalized = withCtx((...args) => {
  4682. if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
  4683. warn$1(
  4684. `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.`
  4685. );
  4686. }
  4687. return normalizeSlotValue(rawSlot(...args));
  4688. }, ctx);
  4689. normalized._c = false;
  4690. return normalized;
  4691. };
  4692. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  4693. const ctx = rawSlots._ctx;
  4694. for (const key in rawSlots) {
  4695. if (isInternalKey(key)) continue;
  4696. const value = rawSlots[key];
  4697. if (isFunction(value)) {
  4698. slots[key] = normalizeSlot(key, value, ctx);
  4699. } else if (value != null) {
  4700. {
  4701. warn$1(
  4702. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  4703. );
  4704. }
  4705. const normalized = normalizeSlotValue(value);
  4706. slots[key] = () => normalized;
  4707. }
  4708. }
  4709. };
  4710. const normalizeVNodeSlots = (instance, children) => {
  4711. if (!isKeepAlive(instance.vnode) && true) {
  4712. warn$1(
  4713. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  4714. );
  4715. }
  4716. const normalized = normalizeSlotValue(children);
  4717. instance.slots.default = () => normalized;
  4718. };
  4719. const assignSlots = (slots, children, optimized) => {
  4720. for (const key in children) {
  4721. if (optimized || key !== "_") {
  4722. slots[key] = children[key];
  4723. }
  4724. }
  4725. };
  4726. const initSlots = (instance, children, optimized) => {
  4727. const slots = instance.slots = createInternalObject();
  4728. if (instance.vnode.shapeFlag & 32) {
  4729. const type = children._;
  4730. if (type) {
  4731. assignSlots(slots, children, optimized);
  4732. if (optimized) {
  4733. def(slots, "_", type, true);
  4734. }
  4735. } else {
  4736. normalizeObjectSlots(children, slots);
  4737. }
  4738. } else if (children) {
  4739. normalizeVNodeSlots(instance, children);
  4740. }
  4741. };
  4742. const updateSlots = (instance, children, optimized) => {
  4743. const { vnode, slots } = instance;
  4744. let needDeletionCheck = true;
  4745. let deletionComparisonTarget = EMPTY_OBJ;
  4746. if (vnode.shapeFlag & 32) {
  4747. const type = children._;
  4748. if (type) {
  4749. if (isHmrUpdating) {
  4750. assignSlots(slots, children, optimized);
  4751. trigger(instance, "set", "$slots");
  4752. } else if (optimized && type === 1) {
  4753. needDeletionCheck = false;
  4754. } else {
  4755. assignSlots(slots, children, optimized);
  4756. }
  4757. } else {
  4758. needDeletionCheck = !children.$stable;
  4759. normalizeObjectSlots(children, slots);
  4760. }
  4761. deletionComparisonTarget = children;
  4762. } else if (children) {
  4763. normalizeVNodeSlots(instance, children);
  4764. deletionComparisonTarget = { default: 1 };
  4765. }
  4766. if (needDeletionCheck) {
  4767. for (const key in slots) {
  4768. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  4769. delete slots[key];
  4770. }
  4771. }
  4772. }
  4773. };
  4774. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  4775. if (isArray(rawRef)) {
  4776. rawRef.forEach(
  4777. (r, i) => setRef(
  4778. r,
  4779. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  4780. parentSuspense,
  4781. vnode,
  4782. isUnmount
  4783. )
  4784. );
  4785. return;
  4786. }
  4787. if (isAsyncWrapper(vnode) && !isUnmount) {
  4788. return;
  4789. }
  4790. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  4791. const value = isUnmount ? null : refValue;
  4792. const { i: owner, r: ref } = rawRef;
  4793. if (!owner) {
  4794. warn$1(
  4795. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  4796. );
  4797. return;
  4798. }
  4799. const oldRef = oldRawRef && oldRawRef.r;
  4800. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  4801. const setupState = owner.setupState;
  4802. if (oldRef != null && oldRef !== ref) {
  4803. if (isString(oldRef)) {
  4804. refs[oldRef] = null;
  4805. if (hasOwn(setupState, oldRef)) {
  4806. setupState[oldRef] = null;
  4807. }
  4808. } else if (isRef(oldRef)) {
  4809. oldRef.value = null;
  4810. }
  4811. }
  4812. if (isFunction(ref)) {
  4813. callWithErrorHandling(ref, owner, 12, [value, refs]);
  4814. } else {
  4815. const _isString = isString(ref);
  4816. const _isRef = isRef(ref);
  4817. if (_isString || _isRef) {
  4818. const doSet = () => {
  4819. if (rawRef.f) {
  4820. const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  4821. if (isUnmount) {
  4822. isArray(existing) && remove(existing, refValue);
  4823. } else {
  4824. if (!isArray(existing)) {
  4825. if (_isString) {
  4826. refs[ref] = [refValue];
  4827. if (hasOwn(setupState, ref)) {
  4828. setupState[ref] = refs[ref];
  4829. }
  4830. } else {
  4831. ref.value = [refValue];
  4832. if (rawRef.k) refs[rawRef.k] = ref.value;
  4833. }
  4834. } else if (!existing.includes(refValue)) {
  4835. existing.push(refValue);
  4836. }
  4837. }
  4838. } else if (_isString) {
  4839. refs[ref] = value;
  4840. if (hasOwn(setupState, ref)) {
  4841. setupState[ref] = value;
  4842. }
  4843. } else if (_isRef) {
  4844. ref.value = value;
  4845. if (rawRef.k) refs[rawRef.k] = value;
  4846. } else {
  4847. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4848. }
  4849. };
  4850. if (value) {
  4851. doSet.id = -1;
  4852. queuePostRenderEffect(doSet, parentSuspense);
  4853. } else {
  4854. doSet();
  4855. }
  4856. } else {
  4857. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4858. }
  4859. }
  4860. }
  4861. const TeleportEndKey = Symbol("_vte");
  4862. const isTeleport = (type) => type.__isTeleport;
  4863. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  4864. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  4865. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  4866. const resolveTarget = (props, select) => {
  4867. const targetSelector = props && props.to;
  4868. if (isString(targetSelector)) {
  4869. if (!select) {
  4870. warn$1(
  4871. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  4872. );
  4873. return null;
  4874. } else {
  4875. const target = select(targetSelector);
  4876. if (!target && !isTeleportDisabled(props)) {
  4877. warn$1(
  4878. `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.`
  4879. );
  4880. }
  4881. return target;
  4882. }
  4883. } else {
  4884. if (!targetSelector && !isTeleportDisabled(props)) {
  4885. warn$1(`Invalid Teleport target: ${targetSelector}`);
  4886. }
  4887. return targetSelector;
  4888. }
  4889. };
  4890. const TeleportImpl = {
  4891. name: "Teleport",
  4892. __isTeleport: true,
  4893. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  4894. const {
  4895. mc: mountChildren,
  4896. pc: patchChildren,
  4897. pbc: patchBlockChildren,
  4898. o: { insert, querySelector, createText, createComment }
  4899. } = internals;
  4900. const disabled = isTeleportDisabled(n2.props);
  4901. let { shapeFlag, children, dynamicChildren } = n2;
  4902. if (isHmrUpdating) {
  4903. optimized = false;
  4904. dynamicChildren = null;
  4905. }
  4906. if (n1 == null) {
  4907. const placeholder = n2.el = createComment("teleport start") ;
  4908. const mainAnchor = n2.anchor = createComment("teleport end") ;
  4909. insert(placeholder, container, anchor);
  4910. insert(mainAnchor, container, anchor);
  4911. const target = n2.target = resolveTarget(n2.props, querySelector);
  4912. const targetAnchor = prepareAnchor(target, n2, createText, insert);
  4913. if (target) {
  4914. if (namespace === "svg" || isTargetSVG(target)) {
  4915. namespace = "svg";
  4916. } else if (namespace === "mathml" || isTargetMathML(target)) {
  4917. namespace = "mathml";
  4918. }
  4919. } else if (!disabled) {
  4920. warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
  4921. }
  4922. const mount = (container2, anchor2) => {
  4923. if (shapeFlag & 16) {
  4924. mountChildren(
  4925. children,
  4926. container2,
  4927. anchor2,
  4928. parentComponent,
  4929. parentSuspense,
  4930. namespace,
  4931. slotScopeIds,
  4932. optimized
  4933. );
  4934. }
  4935. };
  4936. if (disabled) {
  4937. mount(container, mainAnchor);
  4938. } else if (target) {
  4939. mount(target, targetAnchor);
  4940. }
  4941. } else {
  4942. n2.el = n1.el;
  4943. n2.targetStart = n1.targetStart;
  4944. const mainAnchor = n2.anchor = n1.anchor;
  4945. const target = n2.target = n1.target;
  4946. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  4947. const wasDisabled = isTeleportDisabled(n1.props);
  4948. const currentContainer = wasDisabled ? container : target;
  4949. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  4950. if (namespace === "svg" || isTargetSVG(target)) {
  4951. namespace = "svg";
  4952. } else if (namespace === "mathml" || isTargetMathML(target)) {
  4953. namespace = "mathml";
  4954. }
  4955. if (dynamicChildren) {
  4956. patchBlockChildren(
  4957. n1.dynamicChildren,
  4958. dynamicChildren,
  4959. currentContainer,
  4960. parentComponent,
  4961. parentSuspense,
  4962. namespace,
  4963. slotScopeIds
  4964. );
  4965. traverseStaticChildren(n1, n2, true);
  4966. } else if (!optimized) {
  4967. patchChildren(
  4968. n1,
  4969. n2,
  4970. currentContainer,
  4971. currentAnchor,
  4972. parentComponent,
  4973. parentSuspense,
  4974. namespace,
  4975. slotScopeIds,
  4976. false
  4977. );
  4978. }
  4979. if (disabled) {
  4980. if (!wasDisabled) {
  4981. moveTeleport(
  4982. n2,
  4983. container,
  4984. mainAnchor,
  4985. internals,
  4986. 1
  4987. );
  4988. } else {
  4989. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  4990. n2.props.to = n1.props.to;
  4991. }
  4992. }
  4993. } else {
  4994. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  4995. const nextTarget = n2.target = resolveTarget(
  4996. n2.props,
  4997. querySelector
  4998. );
  4999. if (nextTarget) {
  5000. moveTeleport(
  5001. n2,
  5002. nextTarget,
  5003. null,
  5004. internals,
  5005. 0
  5006. );
  5007. } else {
  5008. warn$1(
  5009. "Invalid Teleport target on update:",
  5010. target,
  5011. `(${typeof target})`
  5012. );
  5013. }
  5014. } else if (wasDisabled) {
  5015. moveTeleport(
  5016. n2,
  5017. target,
  5018. targetAnchor,
  5019. internals,
  5020. 1
  5021. );
  5022. }
  5023. }
  5024. }
  5025. updateCssVars(n2);
  5026. },
  5027. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  5028. const {
  5029. shapeFlag,
  5030. children,
  5031. anchor,
  5032. targetStart,
  5033. targetAnchor,
  5034. target,
  5035. props
  5036. } = vnode;
  5037. if (target) {
  5038. hostRemove(targetStart);
  5039. hostRemove(targetAnchor);
  5040. }
  5041. doRemove && hostRemove(anchor);
  5042. if (shapeFlag & 16) {
  5043. const shouldRemove = doRemove || !isTeleportDisabled(props);
  5044. for (let i = 0; i < children.length; i++) {
  5045. const child = children[i];
  5046. unmount(
  5047. child,
  5048. parentComponent,
  5049. parentSuspense,
  5050. shouldRemove,
  5051. !!child.dynamicChildren
  5052. );
  5053. }
  5054. }
  5055. },
  5056. move: moveTeleport,
  5057. hydrate: hydrateTeleport
  5058. };
  5059. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  5060. if (moveType === 0) {
  5061. insert(vnode.targetAnchor, container, parentAnchor);
  5062. }
  5063. const { el, anchor, shapeFlag, children, props } = vnode;
  5064. const isReorder = moveType === 2;
  5065. if (isReorder) {
  5066. insert(el, container, parentAnchor);
  5067. }
  5068. if (!isReorder || isTeleportDisabled(props)) {
  5069. if (shapeFlag & 16) {
  5070. for (let i = 0; i < children.length; i++) {
  5071. move(
  5072. children[i],
  5073. container,
  5074. parentAnchor,
  5075. 2
  5076. );
  5077. }
  5078. }
  5079. }
  5080. if (isReorder) {
  5081. insert(anchor, container, parentAnchor);
  5082. }
  5083. }
  5084. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  5085. o: { nextSibling, parentNode, querySelector, insert, createText }
  5086. }, hydrateChildren) {
  5087. const target = vnode.target = resolveTarget(
  5088. vnode.props,
  5089. querySelector
  5090. );
  5091. if (target) {
  5092. const targetNode = target._lpa || target.firstChild;
  5093. if (vnode.shapeFlag & 16) {
  5094. if (isTeleportDisabled(vnode.props)) {
  5095. vnode.anchor = hydrateChildren(
  5096. nextSibling(node),
  5097. vnode,
  5098. parentNode(node),
  5099. parentComponent,
  5100. parentSuspense,
  5101. slotScopeIds,
  5102. optimized
  5103. );
  5104. vnode.targetStart = targetNode;
  5105. vnode.targetAnchor = targetNode && nextSibling(targetNode);
  5106. } else {
  5107. vnode.anchor = nextSibling(node);
  5108. let targetAnchor = targetNode;
  5109. while (targetAnchor) {
  5110. if (targetAnchor && targetAnchor.nodeType === 8) {
  5111. if (targetAnchor.data === "teleport start anchor") {
  5112. vnode.targetStart = targetAnchor;
  5113. } else if (targetAnchor.data === "teleport anchor") {
  5114. vnode.targetAnchor = targetAnchor;
  5115. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  5116. break;
  5117. }
  5118. }
  5119. targetAnchor = nextSibling(targetAnchor);
  5120. }
  5121. if (!vnode.targetAnchor) {
  5122. prepareAnchor(target, vnode, createText, insert);
  5123. }
  5124. hydrateChildren(
  5125. targetNode && nextSibling(targetNode),
  5126. vnode,
  5127. target,
  5128. parentComponent,
  5129. parentSuspense,
  5130. slotScopeIds,
  5131. optimized
  5132. );
  5133. }
  5134. }
  5135. updateCssVars(vnode);
  5136. }
  5137. return vnode.anchor && nextSibling(vnode.anchor);
  5138. }
  5139. const Teleport = TeleportImpl;
  5140. function updateCssVars(vnode) {
  5141. const ctx = vnode.ctx;
  5142. if (ctx && ctx.ut) {
  5143. let node = vnode.children[0].el;
  5144. while (node && node !== vnode.targetAnchor) {
  5145. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  5146. node = node.nextSibling;
  5147. }
  5148. ctx.ut();
  5149. }
  5150. }
  5151. function prepareAnchor(target, vnode, createText, insert) {
  5152. const targetStart = vnode.targetStart = createText("");
  5153. const targetAnchor = vnode.targetAnchor = createText("");
  5154. targetStart[TeleportEndKey] = targetAnchor;
  5155. if (target) {
  5156. insert(targetStart, target);
  5157. insert(targetAnchor, target);
  5158. }
  5159. return targetAnchor;
  5160. }
  5161. let hasLoggedMismatchError = false;
  5162. const logMismatchError = () => {
  5163. if (hasLoggedMismatchError) {
  5164. return;
  5165. }
  5166. console.error("Hydration completed but contains mismatches.");
  5167. hasLoggedMismatchError = true;
  5168. };
  5169. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  5170. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  5171. const getContainerType = (container) => {
  5172. if (isSVGContainer(container)) return "svg";
  5173. if (isMathMLContainer(container)) return "mathml";
  5174. return void 0;
  5175. };
  5176. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  5177. function createHydrationFunctions(rendererInternals) {
  5178. const {
  5179. mt: mountComponent,
  5180. p: patch,
  5181. o: {
  5182. patchProp,
  5183. createText,
  5184. nextSibling,
  5185. parentNode,
  5186. remove,
  5187. insert,
  5188. createComment
  5189. }
  5190. } = rendererInternals;
  5191. const hydrate = (vnode, container) => {
  5192. if (!container.hasChildNodes()) {
  5193. warn$1(
  5194. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  5195. );
  5196. patch(null, vnode, container);
  5197. flushPostFlushCbs();
  5198. container._vnode = vnode;
  5199. return;
  5200. }
  5201. hydrateNode(container.firstChild, vnode, null, null, null);
  5202. flushPostFlushCbs();
  5203. container._vnode = vnode;
  5204. };
  5205. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  5206. optimized = optimized || !!vnode.dynamicChildren;
  5207. const isFragmentStart = isComment(node) && node.data === "[";
  5208. const onMismatch = () => handleMismatch(
  5209. node,
  5210. vnode,
  5211. parentComponent,
  5212. parentSuspense,
  5213. slotScopeIds,
  5214. isFragmentStart
  5215. );
  5216. const { type, ref, shapeFlag, patchFlag } = vnode;
  5217. let domType = node.nodeType;
  5218. vnode.el = node;
  5219. {
  5220. def(node, "__vnode", vnode, true);
  5221. def(node, "__vueParentComponent", parentComponent, true);
  5222. }
  5223. if (patchFlag === -2) {
  5224. optimized = false;
  5225. vnode.dynamicChildren = null;
  5226. }
  5227. let nextNode = null;
  5228. switch (type) {
  5229. case Text:
  5230. if (domType !== 3 /* TEXT */) {
  5231. if (vnode.children === "") {
  5232. insert(vnode.el = createText(""), parentNode(node), node);
  5233. nextNode = node;
  5234. } else {
  5235. nextNode = onMismatch();
  5236. }
  5237. } else {
  5238. if (node.data !== vnode.children) {
  5239. warn$1(
  5240. `Hydration text mismatch in`,
  5241. node.parentNode,
  5242. `
  5243. - rendered on server: ${JSON.stringify(
  5244. node.data
  5245. )}
  5246. - expected on client: ${JSON.stringify(vnode.children)}`
  5247. );
  5248. logMismatchError();
  5249. node.data = vnode.children;
  5250. }
  5251. nextNode = nextSibling(node);
  5252. }
  5253. break;
  5254. case Comment:
  5255. if (isTemplateNode(node)) {
  5256. nextNode = nextSibling(node);
  5257. replaceNode(
  5258. vnode.el = node.content.firstChild,
  5259. node,
  5260. parentComponent
  5261. );
  5262. } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  5263. nextNode = onMismatch();
  5264. } else {
  5265. nextNode = nextSibling(node);
  5266. }
  5267. break;
  5268. case Static:
  5269. if (isFragmentStart) {
  5270. node = nextSibling(node);
  5271. domType = node.nodeType;
  5272. }
  5273. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  5274. nextNode = node;
  5275. const needToAdoptContent = !vnode.children.length;
  5276. for (let i = 0; i < vnode.staticCount; i++) {
  5277. if (needToAdoptContent)
  5278. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  5279. if (i === vnode.staticCount - 1) {
  5280. vnode.anchor = nextNode;
  5281. }
  5282. nextNode = nextSibling(nextNode);
  5283. }
  5284. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  5285. } else {
  5286. onMismatch();
  5287. }
  5288. break;
  5289. case Fragment:
  5290. if (!isFragmentStart) {
  5291. nextNode = onMismatch();
  5292. } else {
  5293. nextNode = hydrateFragment(
  5294. node,
  5295. vnode,
  5296. parentComponent,
  5297. parentSuspense,
  5298. slotScopeIds,
  5299. optimized
  5300. );
  5301. }
  5302. break;
  5303. default:
  5304. if (shapeFlag & 1) {
  5305. if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  5306. nextNode = onMismatch();
  5307. } else {
  5308. nextNode = hydrateElement(
  5309. node,
  5310. vnode,
  5311. parentComponent,
  5312. parentSuspense,
  5313. slotScopeIds,
  5314. optimized
  5315. );
  5316. }
  5317. } else if (shapeFlag & 6) {
  5318. vnode.slotScopeIds = slotScopeIds;
  5319. const container = parentNode(node);
  5320. if (isFragmentStart) {
  5321. nextNode = locateClosingAnchor(node);
  5322. } else if (isComment(node) && node.data === "teleport start") {
  5323. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  5324. } else {
  5325. nextNode = nextSibling(node);
  5326. }
  5327. mountComponent(
  5328. vnode,
  5329. container,
  5330. null,
  5331. parentComponent,
  5332. parentSuspense,
  5333. getContainerType(container),
  5334. optimized
  5335. );
  5336. if (isAsyncWrapper(vnode)) {
  5337. let subTree;
  5338. if (isFragmentStart) {
  5339. subTree = createVNode(Fragment);
  5340. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  5341. } else {
  5342. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  5343. }
  5344. subTree.el = node;
  5345. vnode.component.subTree = subTree;
  5346. }
  5347. } else if (shapeFlag & 64) {
  5348. if (domType !== 8 /* COMMENT */) {
  5349. nextNode = onMismatch();
  5350. } else {
  5351. nextNode = vnode.type.hydrate(
  5352. node,
  5353. vnode,
  5354. parentComponent,
  5355. parentSuspense,
  5356. slotScopeIds,
  5357. optimized,
  5358. rendererInternals,
  5359. hydrateChildren
  5360. );
  5361. }
  5362. } else if (shapeFlag & 128) {
  5363. nextNode = vnode.type.hydrate(
  5364. node,
  5365. vnode,
  5366. parentComponent,
  5367. parentSuspense,
  5368. getContainerType(parentNode(node)),
  5369. slotScopeIds,
  5370. optimized,
  5371. rendererInternals,
  5372. hydrateNode
  5373. );
  5374. } else {
  5375. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  5376. }
  5377. }
  5378. if (ref != null) {
  5379. setRef(ref, null, parentSuspense, vnode);
  5380. }
  5381. return nextNode;
  5382. };
  5383. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  5384. optimized = optimized || !!vnode.dynamicChildren;
  5385. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  5386. const forcePatch = type === "input" || type === "option";
  5387. {
  5388. if (dirs) {
  5389. invokeDirectiveHook(vnode, null, parentComponent, "created");
  5390. }
  5391. let needCallTransitionHooks = false;
  5392. if (isTemplateNode(el)) {
  5393. needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  5394. const content = el.content.firstChild;
  5395. if (needCallTransitionHooks) {
  5396. transition.beforeEnter(content);
  5397. }
  5398. replaceNode(content, el, parentComponent);
  5399. vnode.el = el = content;
  5400. }
  5401. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  5402. !(props && (props.innerHTML || props.textContent))) {
  5403. let next = hydrateChildren(
  5404. el.firstChild,
  5405. vnode,
  5406. el,
  5407. parentComponent,
  5408. parentSuspense,
  5409. slotScopeIds,
  5410. optimized
  5411. );
  5412. let hasWarned = false;
  5413. while (next) {
  5414. if (!hasWarned) {
  5415. warn$1(
  5416. `Hydration children mismatch on`,
  5417. el,
  5418. `
  5419. Server rendered element contains more child nodes than client vdom.`
  5420. );
  5421. hasWarned = true;
  5422. }
  5423. logMismatchError();
  5424. const cur = next;
  5425. next = next.nextSibling;
  5426. remove(cur);
  5427. }
  5428. } else if (shapeFlag & 8) {
  5429. if (el.textContent !== vnode.children) {
  5430. warn$1(
  5431. `Hydration text content mismatch on`,
  5432. el,
  5433. `
  5434. - rendered on server: ${el.textContent}
  5435. - expected on client: ${vnode.children}`
  5436. );
  5437. logMismatchError();
  5438. el.textContent = vnode.children;
  5439. }
  5440. }
  5441. if (props) {
  5442. {
  5443. const isCustomElement = el.tagName.includes("-");
  5444. for (const key in props) {
  5445. if (// #11189 skip if this node has directives that have created hooks
  5446. // as it could have mutated the DOM in any possible way
  5447. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  5448. logMismatchError();
  5449. }
  5450. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  5451. key[0] === "." || isCustomElement) {
  5452. patchProp(el, key, null, props[key], void 0, parentComponent);
  5453. }
  5454. }
  5455. }
  5456. }
  5457. let vnodeHooks;
  5458. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  5459. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  5460. }
  5461. if (dirs) {
  5462. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  5463. }
  5464. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  5465. queueEffectWithSuspense(() => {
  5466. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  5467. needCallTransitionHooks && transition.enter(el);
  5468. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  5469. }, parentSuspense);
  5470. }
  5471. }
  5472. return el.nextSibling;
  5473. };
  5474. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  5475. optimized = optimized || !!parentVNode.dynamicChildren;
  5476. const children = parentVNode.children;
  5477. const l = children.length;
  5478. let hasWarned = false;
  5479. for (let i = 0; i < l; i++) {
  5480. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  5481. const isText = vnode.type === Text;
  5482. if (node) {
  5483. if (isText && !optimized) {
  5484. let next = children[i + 1];
  5485. if (next && (next = normalizeVNode(next)).type === Text) {
  5486. insert(
  5487. createText(
  5488. node.data.slice(vnode.children.length)
  5489. ),
  5490. container,
  5491. nextSibling(node)
  5492. );
  5493. node.data = vnode.children;
  5494. }
  5495. }
  5496. node = hydrateNode(
  5497. node,
  5498. vnode,
  5499. parentComponent,
  5500. parentSuspense,
  5501. slotScopeIds,
  5502. optimized
  5503. );
  5504. } else if (isText && !vnode.children) {
  5505. insert(vnode.el = createText(""), container);
  5506. } else {
  5507. if (!hasWarned) {
  5508. warn$1(
  5509. `Hydration children mismatch on`,
  5510. container,
  5511. `
  5512. Server rendered element contains fewer child nodes than client vdom.`
  5513. );
  5514. hasWarned = true;
  5515. }
  5516. logMismatchError();
  5517. patch(
  5518. null,
  5519. vnode,
  5520. container,
  5521. null,
  5522. parentComponent,
  5523. parentSuspense,
  5524. getContainerType(container),
  5525. slotScopeIds
  5526. );
  5527. }
  5528. }
  5529. return node;
  5530. };
  5531. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  5532. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  5533. if (fragmentSlotScopeIds) {
  5534. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  5535. }
  5536. const container = parentNode(node);
  5537. const next = hydrateChildren(
  5538. nextSibling(node),
  5539. vnode,
  5540. container,
  5541. parentComponent,
  5542. parentSuspense,
  5543. slotScopeIds,
  5544. optimized
  5545. );
  5546. if (next && isComment(next) && next.data === "]") {
  5547. return nextSibling(vnode.anchor = next);
  5548. } else {
  5549. logMismatchError();
  5550. insert(vnode.anchor = createComment(`]`), container, next);
  5551. return next;
  5552. }
  5553. };
  5554. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  5555. warn$1(
  5556. `Hydration node mismatch:
  5557. - rendered on server:`,
  5558. node,
  5559. node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  5560. `
  5561. - expected on client:`,
  5562. vnode.type
  5563. );
  5564. logMismatchError();
  5565. vnode.el = null;
  5566. if (isFragment) {
  5567. const end = locateClosingAnchor(node);
  5568. while (true) {
  5569. const next2 = nextSibling(node);
  5570. if (next2 && next2 !== end) {
  5571. remove(next2);
  5572. } else {
  5573. break;
  5574. }
  5575. }
  5576. }
  5577. const next = nextSibling(node);
  5578. const container = parentNode(node);
  5579. remove(node);
  5580. patch(
  5581. null,
  5582. vnode,
  5583. container,
  5584. next,
  5585. parentComponent,
  5586. parentSuspense,
  5587. getContainerType(container),
  5588. slotScopeIds
  5589. );
  5590. return next;
  5591. };
  5592. const locateClosingAnchor = (node, open = "[", close = "]") => {
  5593. let match = 0;
  5594. while (node) {
  5595. node = nextSibling(node);
  5596. if (node && isComment(node)) {
  5597. if (node.data === open) match++;
  5598. if (node.data === close) {
  5599. if (match === 0) {
  5600. return nextSibling(node);
  5601. } else {
  5602. match--;
  5603. }
  5604. }
  5605. }
  5606. }
  5607. return node;
  5608. };
  5609. const replaceNode = (newNode, oldNode, parentComponent) => {
  5610. const parentNode2 = oldNode.parentNode;
  5611. if (parentNode2) {
  5612. parentNode2.replaceChild(newNode, oldNode);
  5613. }
  5614. let parent = parentComponent;
  5615. while (parent) {
  5616. if (parent.vnode.el === oldNode) {
  5617. parent.vnode.el = parent.subTree.el = newNode;
  5618. }
  5619. parent = parent.parent;
  5620. }
  5621. };
  5622. const isTemplateNode = (node) => {
  5623. return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
  5624. };
  5625. return [hydrate, hydrateNode];
  5626. }
  5627. function propHasMismatch(el, key, clientValue, vnode, instance) {
  5628. let mismatchType;
  5629. let mismatchKey;
  5630. let actual;
  5631. let expected;
  5632. if (key === "class") {
  5633. actual = el.getAttribute("class");
  5634. expected = normalizeClass(clientValue);
  5635. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  5636. mismatchType = mismatchKey = `class`;
  5637. }
  5638. } else if (key === "style") {
  5639. actual = el.getAttribute("style") || "";
  5640. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  5641. const actualMap = toStyleMap(actual);
  5642. const expectedMap = toStyleMap(expected);
  5643. if (vnode.dirs) {
  5644. for (const { dir, value } of vnode.dirs) {
  5645. if (dir.name === "show" && !value) {
  5646. expectedMap.set("display", "none");
  5647. }
  5648. }
  5649. }
  5650. if (instance) {
  5651. resolveCssVars(instance, vnode, expectedMap);
  5652. }
  5653. if (!isMapEqual(actualMap, expectedMap)) {
  5654. mismatchType = mismatchKey = "style";
  5655. }
  5656. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  5657. if (isBooleanAttr(key)) {
  5658. actual = el.hasAttribute(key);
  5659. expected = includeBooleanAttr(clientValue);
  5660. } else if (clientValue == null) {
  5661. actual = el.hasAttribute(key);
  5662. expected = false;
  5663. } else {
  5664. if (el.hasAttribute(key)) {
  5665. actual = el.getAttribute(key);
  5666. } else if (key === "value" && el.tagName === "TEXTAREA") {
  5667. actual = el.value;
  5668. } else {
  5669. actual = false;
  5670. }
  5671. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  5672. }
  5673. if (actual !== expected) {
  5674. mismatchType = `attribute`;
  5675. mismatchKey = key;
  5676. }
  5677. }
  5678. if (mismatchType) {
  5679. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  5680. const preSegment = `Hydration ${mismatchType} mismatch on`;
  5681. const postSegment = `
  5682. - rendered on server: ${format(actual)}
  5683. - expected on client: ${format(expected)}
  5684. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  5685. You should fix the source of the mismatch.`;
  5686. {
  5687. warn$1(preSegment, el, postSegment);
  5688. }
  5689. return true;
  5690. }
  5691. return false;
  5692. }
  5693. function toClassSet(str) {
  5694. return new Set(str.trim().split(/\s+/));
  5695. }
  5696. function isSetEqual(a, b) {
  5697. if (a.size !== b.size) {
  5698. return false;
  5699. }
  5700. for (const s of a) {
  5701. if (!b.has(s)) {
  5702. return false;
  5703. }
  5704. }
  5705. return true;
  5706. }
  5707. function toStyleMap(str) {
  5708. const styleMap = /* @__PURE__ */ new Map();
  5709. for (const item of str.split(";")) {
  5710. let [key, value] = item.split(":");
  5711. key = key.trim();
  5712. value = value && value.trim();
  5713. if (key && value) {
  5714. styleMap.set(key, value);
  5715. }
  5716. }
  5717. return styleMap;
  5718. }
  5719. function isMapEqual(a, b) {
  5720. if (a.size !== b.size) {
  5721. return false;
  5722. }
  5723. for (const [key, value] of a) {
  5724. if (value !== b.get(key)) {
  5725. return false;
  5726. }
  5727. }
  5728. return true;
  5729. }
  5730. function resolveCssVars(instance, vnode, expectedMap) {
  5731. const root = instance.subTree;
  5732. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  5733. const cssVars = instance.getCssVars();
  5734. for (const key in cssVars) {
  5735. expectedMap.set(`--${key}`, String(cssVars[key]));
  5736. }
  5737. }
  5738. if (vnode === root && instance.parent) {
  5739. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  5740. }
  5741. }
  5742. let supported;
  5743. let perf;
  5744. function startMeasure(instance, type) {
  5745. if (instance.appContext.config.performance && isSupported()) {
  5746. perf.mark(`vue-${type}-${instance.uid}`);
  5747. }
  5748. {
  5749. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  5750. }
  5751. }
  5752. function endMeasure(instance, type) {
  5753. if (instance.appContext.config.performance && isSupported()) {
  5754. const startTag = `vue-${type}-${instance.uid}`;
  5755. const endTag = startTag + `:end`;
  5756. perf.mark(endTag);
  5757. perf.measure(
  5758. `<${formatComponentName(instance, instance.type)}> ${type}`,
  5759. startTag,
  5760. endTag
  5761. );
  5762. perf.clearMarks(startTag);
  5763. perf.clearMarks(endTag);
  5764. }
  5765. {
  5766. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  5767. }
  5768. }
  5769. function isSupported() {
  5770. if (supported !== void 0) {
  5771. return supported;
  5772. }
  5773. if (typeof window !== "undefined" && window.performance) {
  5774. supported = true;
  5775. perf = window.performance;
  5776. } else {
  5777. supported = false;
  5778. }
  5779. return supported;
  5780. }
  5781. const queuePostRenderEffect = queueEffectWithSuspense ;
  5782. function createRenderer(options) {
  5783. return baseCreateRenderer(options);
  5784. }
  5785. function createHydrationRenderer(options) {
  5786. return baseCreateRenderer(options, createHydrationFunctions);
  5787. }
  5788. function baseCreateRenderer(options, createHydrationFns) {
  5789. const target = getGlobalThis();
  5790. target.__VUE__ = true;
  5791. {
  5792. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  5793. }
  5794. const {
  5795. insert: hostInsert,
  5796. remove: hostRemove,
  5797. patchProp: hostPatchProp,
  5798. createElement: hostCreateElement,
  5799. createText: hostCreateText,
  5800. createComment: hostCreateComment,
  5801. setText: hostSetText,
  5802. setElementText: hostSetElementText,
  5803. parentNode: hostParentNode,
  5804. nextSibling: hostNextSibling,
  5805. setScopeId: hostSetScopeId = NOOP,
  5806. insertStaticContent: hostInsertStaticContent
  5807. } = options;
  5808. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  5809. if (n1 === n2) {
  5810. return;
  5811. }
  5812. if (n1 && !isSameVNodeType(n1, n2)) {
  5813. anchor = getNextHostNode(n1);
  5814. unmount(n1, parentComponent, parentSuspense, true);
  5815. n1 = null;
  5816. }
  5817. if (n2.patchFlag === -2) {
  5818. optimized = false;
  5819. n2.dynamicChildren = null;
  5820. }
  5821. const { type, ref, shapeFlag } = n2;
  5822. switch (type) {
  5823. case Text:
  5824. processText(n1, n2, container, anchor);
  5825. break;
  5826. case Comment:
  5827. processCommentNode(n1, n2, container, anchor);
  5828. break;
  5829. case Static:
  5830. if (n1 == null) {
  5831. mountStaticNode(n2, container, anchor, namespace);
  5832. } else {
  5833. patchStaticNode(n1, n2, container, namespace);
  5834. }
  5835. break;
  5836. case Fragment:
  5837. processFragment(
  5838. n1,
  5839. n2,
  5840. container,
  5841. anchor,
  5842. parentComponent,
  5843. parentSuspense,
  5844. namespace,
  5845. slotScopeIds,
  5846. optimized
  5847. );
  5848. break;
  5849. default:
  5850. if (shapeFlag & 1) {
  5851. processElement(
  5852. n1,
  5853. n2,
  5854. container,
  5855. anchor,
  5856. parentComponent,
  5857. parentSuspense,
  5858. namespace,
  5859. slotScopeIds,
  5860. optimized
  5861. );
  5862. } else if (shapeFlag & 6) {
  5863. processComponent(
  5864. n1,
  5865. n2,
  5866. container,
  5867. anchor,
  5868. parentComponent,
  5869. parentSuspense,
  5870. namespace,
  5871. slotScopeIds,
  5872. optimized
  5873. );
  5874. } else if (shapeFlag & 64) {
  5875. type.process(
  5876. n1,
  5877. n2,
  5878. container,
  5879. anchor,
  5880. parentComponent,
  5881. parentSuspense,
  5882. namespace,
  5883. slotScopeIds,
  5884. optimized,
  5885. internals
  5886. );
  5887. } else if (shapeFlag & 128) {
  5888. type.process(
  5889. n1,
  5890. n2,
  5891. container,
  5892. anchor,
  5893. parentComponent,
  5894. parentSuspense,
  5895. namespace,
  5896. slotScopeIds,
  5897. optimized,
  5898. internals
  5899. );
  5900. } else {
  5901. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  5902. }
  5903. }
  5904. if (ref != null && parentComponent) {
  5905. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  5906. }
  5907. };
  5908. const processText = (n1, n2, container, anchor) => {
  5909. if (n1 == null) {
  5910. hostInsert(
  5911. n2.el = hostCreateText(n2.children),
  5912. container,
  5913. anchor
  5914. );
  5915. } else {
  5916. const el = n2.el = n1.el;
  5917. if (n2.children !== n1.children) {
  5918. hostSetText(el, n2.children);
  5919. }
  5920. }
  5921. };
  5922. const processCommentNode = (n1, n2, container, anchor) => {
  5923. if (n1 == null) {
  5924. hostInsert(
  5925. n2.el = hostCreateComment(n2.children || ""),
  5926. container,
  5927. anchor
  5928. );
  5929. } else {
  5930. n2.el = n1.el;
  5931. }
  5932. };
  5933. const mountStaticNode = (n2, container, anchor, namespace) => {
  5934. [n2.el, n2.anchor] = hostInsertStaticContent(
  5935. n2.children,
  5936. container,
  5937. anchor,
  5938. namespace,
  5939. n2.el,
  5940. n2.anchor
  5941. );
  5942. };
  5943. const patchStaticNode = (n1, n2, container, namespace) => {
  5944. if (n2.children !== n1.children) {
  5945. const anchor = hostNextSibling(n1.anchor);
  5946. removeStaticNode(n1);
  5947. [n2.el, n2.anchor] = hostInsertStaticContent(
  5948. n2.children,
  5949. container,
  5950. anchor,
  5951. namespace
  5952. );
  5953. } else {
  5954. n2.el = n1.el;
  5955. n2.anchor = n1.anchor;
  5956. }
  5957. };
  5958. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  5959. let next;
  5960. while (el && el !== anchor) {
  5961. next = hostNextSibling(el);
  5962. hostInsert(el, container, nextSibling);
  5963. el = next;
  5964. }
  5965. hostInsert(anchor, container, nextSibling);
  5966. };
  5967. const removeStaticNode = ({ el, anchor }) => {
  5968. let next;
  5969. while (el && el !== anchor) {
  5970. next = hostNextSibling(el);
  5971. hostRemove(el);
  5972. el = next;
  5973. }
  5974. hostRemove(anchor);
  5975. };
  5976. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  5977. if (n2.type === "svg") {
  5978. namespace = "svg";
  5979. } else if (n2.type === "math") {
  5980. namespace = "mathml";
  5981. }
  5982. if (n1 == null) {
  5983. mountElement(
  5984. n2,
  5985. container,
  5986. anchor,
  5987. parentComponent,
  5988. parentSuspense,
  5989. namespace,
  5990. slotScopeIds,
  5991. optimized
  5992. );
  5993. } else {
  5994. patchElement(
  5995. n1,
  5996. n2,
  5997. parentComponent,
  5998. parentSuspense,
  5999. namespace,
  6000. slotScopeIds,
  6001. optimized
  6002. );
  6003. }
  6004. };
  6005. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6006. let el;
  6007. let vnodeHook;
  6008. const { props, shapeFlag, transition, dirs } = vnode;
  6009. el = vnode.el = hostCreateElement(
  6010. vnode.type,
  6011. namespace,
  6012. props && props.is,
  6013. props
  6014. );
  6015. if (shapeFlag & 8) {
  6016. hostSetElementText(el, vnode.children);
  6017. } else if (shapeFlag & 16) {
  6018. mountChildren(
  6019. vnode.children,
  6020. el,
  6021. null,
  6022. parentComponent,
  6023. parentSuspense,
  6024. resolveChildrenNamespace(vnode, namespace),
  6025. slotScopeIds,
  6026. optimized
  6027. );
  6028. }
  6029. if (dirs) {
  6030. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6031. }
  6032. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6033. if (props) {
  6034. for (const key in props) {
  6035. if (key !== "value" && !isReservedProp(key)) {
  6036. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  6037. }
  6038. }
  6039. if ("value" in props) {
  6040. hostPatchProp(el, "value", null, props.value, namespace);
  6041. }
  6042. if (vnodeHook = props.onVnodeBeforeMount) {
  6043. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6044. }
  6045. }
  6046. {
  6047. def(el, "__vnode", vnode, true);
  6048. def(el, "__vueParentComponent", parentComponent, true);
  6049. }
  6050. if (dirs) {
  6051. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6052. }
  6053. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  6054. if (needCallTransitionHooks) {
  6055. transition.beforeEnter(el);
  6056. }
  6057. hostInsert(el, container, anchor);
  6058. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6059. queuePostRenderEffect(() => {
  6060. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6061. needCallTransitionHooks && transition.enter(el);
  6062. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6063. }, parentSuspense);
  6064. }
  6065. };
  6066. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6067. if (scopeId) {
  6068. hostSetScopeId(el, scopeId);
  6069. }
  6070. if (slotScopeIds) {
  6071. for (let i = 0; i < slotScopeIds.length; i++) {
  6072. hostSetScopeId(el, slotScopeIds[i]);
  6073. }
  6074. }
  6075. if (parentComponent) {
  6076. let subTree = parentComponent.subTree;
  6077. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  6078. subTree = filterSingleRoot(subTree.children) || subTree;
  6079. }
  6080. if (vnode === subTree) {
  6081. const parentVNode = parentComponent.vnode;
  6082. setScopeId(
  6083. el,
  6084. parentVNode,
  6085. parentVNode.scopeId,
  6086. parentVNode.slotScopeIds,
  6087. parentComponent.parent
  6088. );
  6089. }
  6090. }
  6091. };
  6092. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  6093. for (let i = start; i < children.length; i++) {
  6094. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  6095. patch(
  6096. null,
  6097. child,
  6098. container,
  6099. anchor,
  6100. parentComponent,
  6101. parentSuspense,
  6102. namespace,
  6103. slotScopeIds,
  6104. optimized
  6105. );
  6106. }
  6107. };
  6108. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6109. const el = n2.el = n1.el;
  6110. {
  6111. el.__vnode = n2;
  6112. }
  6113. let { patchFlag, dynamicChildren, dirs } = n2;
  6114. patchFlag |= n1.patchFlag & 16;
  6115. const oldProps = n1.props || EMPTY_OBJ;
  6116. const newProps = n2.props || EMPTY_OBJ;
  6117. let vnodeHook;
  6118. parentComponent && toggleRecurse(parentComponent, false);
  6119. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  6120. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6121. }
  6122. if (dirs) {
  6123. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  6124. }
  6125. parentComponent && toggleRecurse(parentComponent, true);
  6126. if (isHmrUpdating) {
  6127. patchFlag = 0;
  6128. optimized = false;
  6129. dynamicChildren = null;
  6130. }
  6131. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  6132. hostSetElementText(el, "");
  6133. }
  6134. if (dynamicChildren) {
  6135. patchBlockChildren(
  6136. n1.dynamicChildren,
  6137. dynamicChildren,
  6138. el,
  6139. parentComponent,
  6140. parentSuspense,
  6141. resolveChildrenNamespace(n2, namespace),
  6142. slotScopeIds
  6143. );
  6144. {
  6145. traverseStaticChildren(n1, n2);
  6146. }
  6147. } else if (!optimized) {
  6148. patchChildren(
  6149. n1,
  6150. n2,
  6151. el,
  6152. null,
  6153. parentComponent,
  6154. parentSuspense,
  6155. resolveChildrenNamespace(n2, namespace),
  6156. slotScopeIds,
  6157. false
  6158. );
  6159. }
  6160. if (patchFlag > 0) {
  6161. if (patchFlag & 16) {
  6162. patchProps(el, oldProps, newProps, parentComponent, namespace);
  6163. } else {
  6164. if (patchFlag & 2) {
  6165. if (oldProps.class !== newProps.class) {
  6166. hostPatchProp(el, "class", null, newProps.class, namespace);
  6167. }
  6168. }
  6169. if (patchFlag & 4) {
  6170. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  6171. }
  6172. if (patchFlag & 8) {
  6173. const propsToUpdate = n2.dynamicProps;
  6174. for (let i = 0; i < propsToUpdate.length; i++) {
  6175. const key = propsToUpdate[i];
  6176. const prev = oldProps[key];
  6177. const next = newProps[key];
  6178. if (next !== prev || key === "value") {
  6179. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  6180. }
  6181. }
  6182. }
  6183. }
  6184. if (patchFlag & 1) {
  6185. if (n1.children !== n2.children) {
  6186. hostSetElementText(el, n2.children);
  6187. }
  6188. }
  6189. } else if (!optimized && dynamicChildren == null) {
  6190. patchProps(el, oldProps, newProps, parentComponent, namespace);
  6191. }
  6192. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  6193. queuePostRenderEffect(() => {
  6194. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6195. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  6196. }, parentSuspense);
  6197. }
  6198. };
  6199. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  6200. for (let i = 0; i < newChildren.length; i++) {
  6201. const oldVNode = oldChildren[i];
  6202. const newVNode = newChildren[i];
  6203. const container = (
  6204. // oldVNode may be an errored async setup() component inside Suspense
  6205. // which will not have a mounted element
  6206. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  6207. // of the Fragment itself so it can move its children.
  6208. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  6209. // which also requires the correct parent container
  6210. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  6211. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  6212. // In other cases, the parent container is not actually used so we
  6213. // just pass the block element here to avoid a DOM parentNode call.
  6214. fallbackContainer
  6215. )
  6216. );
  6217. patch(
  6218. oldVNode,
  6219. newVNode,
  6220. container,
  6221. null,
  6222. parentComponent,
  6223. parentSuspense,
  6224. namespace,
  6225. slotScopeIds,
  6226. true
  6227. );
  6228. }
  6229. };
  6230. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  6231. if (oldProps !== newProps) {
  6232. if (oldProps !== EMPTY_OBJ) {
  6233. for (const key in oldProps) {
  6234. if (!isReservedProp(key) && !(key in newProps)) {
  6235. hostPatchProp(
  6236. el,
  6237. key,
  6238. oldProps[key],
  6239. null,
  6240. namespace,
  6241. parentComponent
  6242. );
  6243. }
  6244. }
  6245. }
  6246. for (const key in newProps) {
  6247. if (isReservedProp(key)) continue;
  6248. const next = newProps[key];
  6249. const prev = oldProps[key];
  6250. if (next !== prev && key !== "value") {
  6251. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  6252. }
  6253. }
  6254. if ("value" in newProps) {
  6255. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  6256. }
  6257. }
  6258. };
  6259. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6260. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  6261. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  6262. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  6263. if (
  6264. // #5523 dev root fragment may inherit directives
  6265. isHmrUpdating || patchFlag & 2048
  6266. ) {
  6267. patchFlag = 0;
  6268. optimized = false;
  6269. dynamicChildren = null;
  6270. }
  6271. if (fragmentSlotScopeIds) {
  6272. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6273. }
  6274. if (n1 == null) {
  6275. hostInsert(fragmentStartAnchor, container, anchor);
  6276. hostInsert(fragmentEndAnchor, container, anchor);
  6277. mountChildren(
  6278. // #10007
  6279. // such fragment like `<></>` will be compiled into
  6280. // a fragment which doesn't have a children.
  6281. // In this case fallback to an empty array
  6282. n2.children || [],
  6283. container,
  6284. fragmentEndAnchor,
  6285. parentComponent,
  6286. parentSuspense,
  6287. namespace,
  6288. slotScopeIds,
  6289. optimized
  6290. );
  6291. } else {
  6292. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  6293. // of renderSlot() with no valid children
  6294. n1.dynamicChildren) {
  6295. patchBlockChildren(
  6296. n1.dynamicChildren,
  6297. dynamicChildren,
  6298. container,
  6299. parentComponent,
  6300. parentSuspense,
  6301. namespace,
  6302. slotScopeIds
  6303. );
  6304. {
  6305. traverseStaticChildren(n1, n2);
  6306. }
  6307. } else {
  6308. patchChildren(
  6309. n1,
  6310. n2,
  6311. container,
  6312. fragmentEndAnchor,
  6313. parentComponent,
  6314. parentSuspense,
  6315. namespace,
  6316. slotScopeIds,
  6317. optimized
  6318. );
  6319. }
  6320. }
  6321. };
  6322. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6323. n2.slotScopeIds = slotScopeIds;
  6324. if (n1 == null) {
  6325. if (n2.shapeFlag & 512) {
  6326. parentComponent.ctx.activate(
  6327. n2,
  6328. container,
  6329. anchor,
  6330. namespace,
  6331. optimized
  6332. );
  6333. } else {
  6334. mountComponent(
  6335. n2,
  6336. container,
  6337. anchor,
  6338. parentComponent,
  6339. parentSuspense,
  6340. namespace,
  6341. optimized
  6342. );
  6343. }
  6344. } else {
  6345. updateComponent(n1, n2, optimized);
  6346. }
  6347. };
  6348. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  6349. const instance = (initialVNode.component = createComponentInstance(
  6350. initialVNode,
  6351. parentComponent,
  6352. parentSuspense
  6353. ));
  6354. if (instance.type.__hmrId) {
  6355. registerHMR(instance);
  6356. }
  6357. {
  6358. pushWarningContext(initialVNode);
  6359. startMeasure(instance, `mount`);
  6360. }
  6361. if (isKeepAlive(initialVNode)) {
  6362. instance.ctx.renderer = internals;
  6363. }
  6364. {
  6365. {
  6366. startMeasure(instance, `init`);
  6367. }
  6368. setupComponent(instance, false, optimized);
  6369. {
  6370. endMeasure(instance, `init`);
  6371. }
  6372. }
  6373. if (instance.asyncDep) {
  6374. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  6375. if (!initialVNode.el) {
  6376. const placeholder = instance.subTree = createVNode(Comment);
  6377. processCommentNode(null, placeholder, container, anchor);
  6378. }
  6379. } else {
  6380. setupRenderEffect(
  6381. instance,
  6382. initialVNode,
  6383. container,
  6384. anchor,
  6385. parentSuspense,
  6386. namespace,
  6387. optimized
  6388. );
  6389. }
  6390. {
  6391. popWarningContext();
  6392. endMeasure(instance, `mount`);
  6393. }
  6394. };
  6395. const updateComponent = (n1, n2, optimized) => {
  6396. const instance = n2.component = n1.component;
  6397. if (shouldUpdateComponent(n1, n2, optimized)) {
  6398. if (instance.asyncDep && !instance.asyncResolved) {
  6399. {
  6400. pushWarningContext(n2);
  6401. }
  6402. updateComponentPreRender(instance, n2, optimized);
  6403. {
  6404. popWarningContext();
  6405. }
  6406. return;
  6407. } else {
  6408. instance.next = n2;
  6409. invalidateJob(instance.update);
  6410. instance.effect.dirty = true;
  6411. instance.update();
  6412. }
  6413. } else {
  6414. n2.el = n1.el;
  6415. instance.vnode = n2;
  6416. }
  6417. };
  6418. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  6419. const componentUpdateFn = () => {
  6420. if (!instance.isMounted) {
  6421. let vnodeHook;
  6422. const { el, props } = initialVNode;
  6423. const { bm, m, parent } = instance;
  6424. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  6425. toggleRecurse(instance, false);
  6426. if (bm) {
  6427. invokeArrayFns(bm);
  6428. }
  6429. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  6430. invokeVNodeHook(vnodeHook, parent, initialVNode);
  6431. }
  6432. toggleRecurse(instance, true);
  6433. if (el && hydrateNode) {
  6434. const hydrateSubTree = () => {
  6435. {
  6436. startMeasure(instance, `render`);
  6437. }
  6438. instance.subTree = renderComponentRoot(instance);
  6439. {
  6440. endMeasure(instance, `render`);
  6441. }
  6442. {
  6443. startMeasure(instance, `hydrate`);
  6444. }
  6445. hydrateNode(
  6446. el,
  6447. instance.subTree,
  6448. instance,
  6449. parentSuspense,
  6450. null
  6451. );
  6452. {
  6453. endMeasure(instance, `hydrate`);
  6454. }
  6455. };
  6456. if (isAsyncWrapperVNode) {
  6457. initialVNode.type.__asyncLoader().then(
  6458. // note: we are moving the render call into an async callback,
  6459. // which means it won't track dependencies - but it's ok because
  6460. // a server-rendered async wrapper is already in resolved state
  6461. // and it will never need to change.
  6462. () => !instance.isUnmounted && hydrateSubTree()
  6463. );
  6464. } else {
  6465. hydrateSubTree();
  6466. }
  6467. } else {
  6468. {
  6469. startMeasure(instance, `render`);
  6470. }
  6471. const subTree = instance.subTree = renderComponentRoot(instance);
  6472. {
  6473. endMeasure(instance, `render`);
  6474. }
  6475. {
  6476. startMeasure(instance, `patch`);
  6477. }
  6478. patch(
  6479. null,
  6480. subTree,
  6481. container,
  6482. anchor,
  6483. instance,
  6484. parentSuspense,
  6485. namespace
  6486. );
  6487. {
  6488. endMeasure(instance, `patch`);
  6489. }
  6490. initialVNode.el = subTree.el;
  6491. }
  6492. if (m) {
  6493. queuePostRenderEffect(m, parentSuspense);
  6494. }
  6495. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  6496. const scopedInitialVNode = initialVNode;
  6497. queuePostRenderEffect(
  6498. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  6499. parentSuspense
  6500. );
  6501. }
  6502. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  6503. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  6504. }
  6505. instance.isMounted = true;
  6506. {
  6507. devtoolsComponentAdded(instance);
  6508. }
  6509. initialVNode = container = anchor = null;
  6510. } else {
  6511. let { next, bu, u, parent, vnode } = instance;
  6512. {
  6513. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  6514. if (nonHydratedAsyncRoot) {
  6515. if (next) {
  6516. next.el = vnode.el;
  6517. updateComponentPreRender(instance, next, optimized);
  6518. }
  6519. nonHydratedAsyncRoot.asyncDep.then(() => {
  6520. if (!instance.isUnmounted) {
  6521. componentUpdateFn();
  6522. }
  6523. });
  6524. return;
  6525. }
  6526. }
  6527. let originNext = next;
  6528. let vnodeHook;
  6529. {
  6530. pushWarningContext(next || instance.vnode);
  6531. }
  6532. toggleRecurse(instance, false);
  6533. if (next) {
  6534. next.el = vnode.el;
  6535. updateComponentPreRender(instance, next, optimized);
  6536. } else {
  6537. next = vnode;
  6538. }
  6539. if (bu) {
  6540. invokeArrayFns(bu);
  6541. }
  6542. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  6543. invokeVNodeHook(vnodeHook, parent, next, vnode);
  6544. }
  6545. toggleRecurse(instance, true);
  6546. {
  6547. startMeasure(instance, `render`);
  6548. }
  6549. const nextTree = renderComponentRoot(instance);
  6550. {
  6551. endMeasure(instance, `render`);
  6552. }
  6553. const prevTree = instance.subTree;
  6554. instance.subTree = nextTree;
  6555. {
  6556. startMeasure(instance, `patch`);
  6557. }
  6558. patch(
  6559. prevTree,
  6560. nextTree,
  6561. // parent may have changed if it's in a teleport
  6562. hostParentNode(prevTree.el),
  6563. // anchor may have changed if it's in a fragment
  6564. getNextHostNode(prevTree),
  6565. instance,
  6566. parentSuspense,
  6567. namespace
  6568. );
  6569. {
  6570. endMeasure(instance, `patch`);
  6571. }
  6572. next.el = nextTree.el;
  6573. if (originNext === null) {
  6574. updateHOCHostEl(instance, nextTree.el);
  6575. }
  6576. if (u) {
  6577. queuePostRenderEffect(u, parentSuspense);
  6578. }
  6579. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  6580. queuePostRenderEffect(
  6581. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  6582. parentSuspense
  6583. );
  6584. }
  6585. {
  6586. devtoolsComponentUpdated(instance);
  6587. }
  6588. {
  6589. popWarningContext();
  6590. }
  6591. }
  6592. };
  6593. const effect = instance.effect = new ReactiveEffect(
  6594. componentUpdateFn,
  6595. NOOP,
  6596. () => queueJob(update),
  6597. instance.scope
  6598. // track it in component's effect scope
  6599. );
  6600. const update = instance.update = () => {
  6601. if (effect.dirty) {
  6602. effect.run();
  6603. }
  6604. };
  6605. update.i = instance;
  6606. update.id = instance.uid;
  6607. toggleRecurse(instance, true);
  6608. {
  6609. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  6610. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  6611. }
  6612. update();
  6613. };
  6614. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  6615. nextVNode.component = instance;
  6616. const prevProps = instance.vnode.props;
  6617. instance.vnode = nextVNode;
  6618. instance.next = null;
  6619. updateProps(instance, nextVNode.props, prevProps, optimized);
  6620. updateSlots(instance, nextVNode.children, optimized);
  6621. pauseTracking();
  6622. flushPreFlushCbs(instance);
  6623. resetTracking();
  6624. };
  6625. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  6626. const c1 = n1 && n1.children;
  6627. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  6628. const c2 = n2.children;
  6629. const { patchFlag, shapeFlag } = n2;
  6630. if (patchFlag > 0) {
  6631. if (patchFlag & 128) {
  6632. patchKeyedChildren(
  6633. c1,
  6634. c2,
  6635. container,
  6636. anchor,
  6637. parentComponent,
  6638. parentSuspense,
  6639. namespace,
  6640. slotScopeIds,
  6641. optimized
  6642. );
  6643. return;
  6644. } else if (patchFlag & 256) {
  6645. patchUnkeyedChildren(
  6646. c1,
  6647. c2,
  6648. container,
  6649. anchor,
  6650. parentComponent,
  6651. parentSuspense,
  6652. namespace,
  6653. slotScopeIds,
  6654. optimized
  6655. );
  6656. return;
  6657. }
  6658. }
  6659. if (shapeFlag & 8) {
  6660. if (prevShapeFlag & 16) {
  6661. unmountChildren(c1, parentComponent, parentSuspense);
  6662. }
  6663. if (c2 !== c1) {
  6664. hostSetElementText(container, c2);
  6665. }
  6666. } else {
  6667. if (prevShapeFlag & 16) {
  6668. if (shapeFlag & 16) {
  6669. patchKeyedChildren(
  6670. c1,
  6671. c2,
  6672. container,
  6673. anchor,
  6674. parentComponent,
  6675. parentSuspense,
  6676. namespace,
  6677. slotScopeIds,
  6678. optimized
  6679. );
  6680. } else {
  6681. unmountChildren(c1, parentComponent, parentSuspense, true);
  6682. }
  6683. } else {
  6684. if (prevShapeFlag & 8) {
  6685. hostSetElementText(container, "");
  6686. }
  6687. if (shapeFlag & 16) {
  6688. mountChildren(
  6689. c2,
  6690. container,
  6691. anchor,
  6692. parentComponent,
  6693. parentSuspense,
  6694. namespace,
  6695. slotScopeIds,
  6696. optimized
  6697. );
  6698. }
  6699. }
  6700. }
  6701. };
  6702. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6703. c1 = c1 || EMPTY_ARR;
  6704. c2 = c2 || EMPTY_ARR;
  6705. const oldLength = c1.length;
  6706. const newLength = c2.length;
  6707. const commonLength = Math.min(oldLength, newLength);
  6708. let i;
  6709. for (i = 0; i < commonLength; i++) {
  6710. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  6711. patch(
  6712. c1[i],
  6713. nextChild,
  6714. container,
  6715. null,
  6716. parentComponent,
  6717. parentSuspense,
  6718. namespace,
  6719. slotScopeIds,
  6720. optimized
  6721. );
  6722. }
  6723. if (oldLength > newLength) {
  6724. unmountChildren(
  6725. c1,
  6726. parentComponent,
  6727. parentSuspense,
  6728. true,
  6729. false,
  6730. commonLength
  6731. );
  6732. } else {
  6733. mountChildren(
  6734. c2,
  6735. container,
  6736. anchor,
  6737. parentComponent,
  6738. parentSuspense,
  6739. namespace,
  6740. slotScopeIds,
  6741. optimized,
  6742. commonLength
  6743. );
  6744. }
  6745. };
  6746. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6747. let i = 0;
  6748. const l2 = c2.length;
  6749. let e1 = c1.length - 1;
  6750. let e2 = l2 - 1;
  6751. while (i <= e1 && i <= e2) {
  6752. const n1 = c1[i];
  6753. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  6754. if (isSameVNodeType(n1, n2)) {
  6755. patch(
  6756. n1,
  6757. n2,
  6758. container,
  6759. null,
  6760. parentComponent,
  6761. parentSuspense,
  6762. namespace,
  6763. slotScopeIds,
  6764. optimized
  6765. );
  6766. } else {
  6767. break;
  6768. }
  6769. i++;
  6770. }
  6771. while (i <= e1 && i <= e2) {
  6772. const n1 = c1[e1];
  6773. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  6774. if (isSameVNodeType(n1, n2)) {
  6775. patch(
  6776. n1,
  6777. n2,
  6778. container,
  6779. null,
  6780. parentComponent,
  6781. parentSuspense,
  6782. namespace,
  6783. slotScopeIds,
  6784. optimized
  6785. );
  6786. } else {
  6787. break;
  6788. }
  6789. e1--;
  6790. e2--;
  6791. }
  6792. if (i > e1) {
  6793. if (i <= e2) {
  6794. const nextPos = e2 + 1;
  6795. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  6796. while (i <= e2) {
  6797. patch(
  6798. null,
  6799. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  6800. container,
  6801. anchor,
  6802. parentComponent,
  6803. parentSuspense,
  6804. namespace,
  6805. slotScopeIds,
  6806. optimized
  6807. );
  6808. i++;
  6809. }
  6810. }
  6811. } else if (i > e2) {
  6812. while (i <= e1) {
  6813. unmount(c1[i], parentComponent, parentSuspense, true);
  6814. i++;
  6815. }
  6816. } else {
  6817. const s1 = i;
  6818. const s2 = i;
  6819. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  6820. for (i = s2; i <= e2; i++) {
  6821. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  6822. if (nextChild.key != null) {
  6823. if (keyToNewIndexMap.has(nextChild.key)) {
  6824. warn$1(
  6825. `Duplicate keys found during update:`,
  6826. JSON.stringify(nextChild.key),
  6827. `Make sure keys are unique.`
  6828. );
  6829. }
  6830. keyToNewIndexMap.set(nextChild.key, i);
  6831. }
  6832. }
  6833. let j;
  6834. let patched = 0;
  6835. const toBePatched = e2 - s2 + 1;
  6836. let moved = false;
  6837. let maxNewIndexSoFar = 0;
  6838. const newIndexToOldIndexMap = new Array(toBePatched);
  6839. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  6840. for (i = s1; i <= e1; i++) {
  6841. const prevChild = c1[i];
  6842. if (patched >= toBePatched) {
  6843. unmount(prevChild, parentComponent, parentSuspense, true);
  6844. continue;
  6845. }
  6846. let newIndex;
  6847. if (prevChild.key != null) {
  6848. newIndex = keyToNewIndexMap.get(prevChild.key);
  6849. } else {
  6850. for (j = s2; j <= e2; j++) {
  6851. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  6852. newIndex = j;
  6853. break;
  6854. }
  6855. }
  6856. }
  6857. if (newIndex === void 0) {
  6858. unmount(prevChild, parentComponent, parentSuspense, true);
  6859. } else {
  6860. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  6861. if (newIndex >= maxNewIndexSoFar) {
  6862. maxNewIndexSoFar = newIndex;
  6863. } else {
  6864. moved = true;
  6865. }
  6866. patch(
  6867. prevChild,
  6868. c2[newIndex],
  6869. container,
  6870. null,
  6871. parentComponent,
  6872. parentSuspense,
  6873. namespace,
  6874. slotScopeIds,
  6875. optimized
  6876. );
  6877. patched++;
  6878. }
  6879. }
  6880. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  6881. j = increasingNewIndexSequence.length - 1;
  6882. for (i = toBePatched - 1; i >= 0; i--) {
  6883. const nextIndex = s2 + i;
  6884. const nextChild = c2[nextIndex];
  6885. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  6886. if (newIndexToOldIndexMap[i] === 0) {
  6887. patch(
  6888. null,
  6889. nextChild,
  6890. container,
  6891. anchor,
  6892. parentComponent,
  6893. parentSuspense,
  6894. namespace,
  6895. slotScopeIds,
  6896. optimized
  6897. );
  6898. } else if (moved) {
  6899. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  6900. move(nextChild, container, anchor, 2);
  6901. } else {
  6902. j--;
  6903. }
  6904. }
  6905. }
  6906. }
  6907. };
  6908. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  6909. const { el, type, transition, children, shapeFlag } = vnode;
  6910. if (shapeFlag & 6) {
  6911. move(vnode.component.subTree, container, anchor, moveType);
  6912. return;
  6913. }
  6914. if (shapeFlag & 128) {
  6915. vnode.suspense.move(container, anchor, moveType);
  6916. return;
  6917. }
  6918. if (shapeFlag & 64) {
  6919. type.move(vnode, container, anchor, internals);
  6920. return;
  6921. }
  6922. if (type === Fragment) {
  6923. hostInsert(el, container, anchor);
  6924. for (let i = 0; i < children.length; i++) {
  6925. move(children[i], container, anchor, moveType);
  6926. }
  6927. hostInsert(vnode.anchor, container, anchor);
  6928. return;
  6929. }
  6930. if (type === Static) {
  6931. moveStaticNode(vnode, container, anchor);
  6932. return;
  6933. }
  6934. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  6935. if (needTransition2) {
  6936. if (moveType === 0) {
  6937. transition.beforeEnter(el);
  6938. hostInsert(el, container, anchor);
  6939. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  6940. } else {
  6941. const { leave, delayLeave, afterLeave } = transition;
  6942. const remove2 = () => hostInsert(el, container, anchor);
  6943. const performLeave = () => {
  6944. leave(el, () => {
  6945. remove2();
  6946. afterLeave && afterLeave();
  6947. });
  6948. };
  6949. if (delayLeave) {
  6950. delayLeave(el, remove2, performLeave);
  6951. } else {
  6952. performLeave();
  6953. }
  6954. }
  6955. } else {
  6956. hostInsert(el, container, anchor);
  6957. }
  6958. };
  6959. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  6960. const {
  6961. type,
  6962. props,
  6963. ref,
  6964. children,
  6965. dynamicChildren,
  6966. shapeFlag,
  6967. patchFlag,
  6968. dirs,
  6969. cacheIndex
  6970. } = vnode;
  6971. if (patchFlag === -2) {
  6972. optimized = false;
  6973. }
  6974. if (ref != null) {
  6975. setRef(ref, null, parentSuspense, vnode, true);
  6976. }
  6977. if (cacheIndex != null) {
  6978. parentComponent.renderCache[cacheIndex] = void 0;
  6979. }
  6980. if (shapeFlag & 256) {
  6981. parentComponent.ctx.deactivate(vnode);
  6982. return;
  6983. }
  6984. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  6985. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  6986. let vnodeHook;
  6987. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  6988. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6989. }
  6990. if (shapeFlag & 6) {
  6991. unmountComponent(vnode.component, parentSuspense, doRemove);
  6992. } else {
  6993. if (shapeFlag & 128) {
  6994. vnode.suspense.unmount(parentSuspense, doRemove);
  6995. return;
  6996. }
  6997. if (shouldInvokeDirs) {
  6998. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  6999. }
  7000. if (shapeFlag & 64) {
  7001. vnode.type.remove(
  7002. vnode,
  7003. parentComponent,
  7004. parentSuspense,
  7005. internals,
  7006. doRemove
  7007. );
  7008. } else if (dynamicChildren && // #5154
  7009. // when v-once is used inside a block, setBlockTracking(-1) marks the
  7010. // parent block with hasOnce: true
  7011. // so that it doesn't take the fast path during unmount - otherwise
  7012. // components nested in v-once are never unmounted.
  7013. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7014. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7015. unmountChildren(
  7016. dynamicChildren,
  7017. parentComponent,
  7018. parentSuspense,
  7019. false,
  7020. true
  7021. );
  7022. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7023. unmountChildren(children, parentComponent, parentSuspense);
  7024. }
  7025. if (doRemove) {
  7026. remove(vnode);
  7027. }
  7028. }
  7029. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7030. queuePostRenderEffect(() => {
  7031. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7032. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  7033. }, parentSuspense);
  7034. }
  7035. };
  7036. const remove = (vnode) => {
  7037. const { type, el, anchor, transition } = vnode;
  7038. if (type === Fragment) {
  7039. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  7040. vnode.children.forEach((child) => {
  7041. if (child.type === Comment) {
  7042. hostRemove(child.el);
  7043. } else {
  7044. remove(child);
  7045. }
  7046. });
  7047. } else {
  7048. removeFragment(el, anchor);
  7049. }
  7050. return;
  7051. }
  7052. if (type === Static) {
  7053. removeStaticNode(vnode);
  7054. return;
  7055. }
  7056. const performRemove = () => {
  7057. hostRemove(el);
  7058. if (transition && !transition.persisted && transition.afterLeave) {
  7059. transition.afterLeave();
  7060. }
  7061. };
  7062. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  7063. const { leave, delayLeave } = transition;
  7064. const performLeave = () => leave(el, performRemove);
  7065. if (delayLeave) {
  7066. delayLeave(vnode.el, performRemove, performLeave);
  7067. } else {
  7068. performLeave();
  7069. }
  7070. } else {
  7071. performRemove();
  7072. }
  7073. };
  7074. const removeFragment = (cur, end) => {
  7075. let next;
  7076. while (cur !== end) {
  7077. next = hostNextSibling(cur);
  7078. hostRemove(cur);
  7079. cur = next;
  7080. }
  7081. hostRemove(end);
  7082. };
  7083. const unmountComponent = (instance, parentSuspense, doRemove) => {
  7084. if (instance.type.__hmrId) {
  7085. unregisterHMR(instance);
  7086. }
  7087. const { bum, scope, update, subTree, um, m, a } = instance;
  7088. invalidateMount(m);
  7089. invalidateMount(a);
  7090. if (bum) {
  7091. invokeArrayFns(bum);
  7092. }
  7093. scope.stop();
  7094. if (update) {
  7095. update.active = false;
  7096. unmount(subTree, instance, parentSuspense, doRemove);
  7097. }
  7098. if (um) {
  7099. queuePostRenderEffect(um, parentSuspense);
  7100. }
  7101. queuePostRenderEffect(() => {
  7102. instance.isUnmounted = true;
  7103. }, parentSuspense);
  7104. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  7105. parentSuspense.deps--;
  7106. if (parentSuspense.deps === 0) {
  7107. parentSuspense.resolve();
  7108. }
  7109. }
  7110. {
  7111. devtoolsComponentRemoved(instance);
  7112. }
  7113. };
  7114. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  7115. for (let i = start; i < children.length; i++) {
  7116. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  7117. }
  7118. };
  7119. const getNextHostNode = (vnode) => {
  7120. if (vnode.shapeFlag & 6) {
  7121. return getNextHostNode(vnode.component.subTree);
  7122. }
  7123. if (vnode.shapeFlag & 128) {
  7124. return vnode.suspense.next();
  7125. }
  7126. const el = hostNextSibling(vnode.anchor || vnode.el);
  7127. const teleportEnd = el && el[TeleportEndKey];
  7128. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  7129. };
  7130. let isFlushing = false;
  7131. const render = (vnode, container, namespace) => {
  7132. if (vnode == null) {
  7133. if (container._vnode) {
  7134. unmount(container._vnode, null, null, true);
  7135. }
  7136. } else {
  7137. patch(
  7138. container._vnode || null,
  7139. vnode,
  7140. container,
  7141. null,
  7142. null,
  7143. null,
  7144. namespace
  7145. );
  7146. }
  7147. container._vnode = vnode;
  7148. if (!isFlushing) {
  7149. isFlushing = true;
  7150. flushPreFlushCbs();
  7151. flushPostFlushCbs();
  7152. isFlushing = false;
  7153. }
  7154. };
  7155. const internals = {
  7156. p: patch,
  7157. um: unmount,
  7158. m: move,
  7159. r: remove,
  7160. mt: mountComponent,
  7161. mc: mountChildren,
  7162. pc: patchChildren,
  7163. pbc: patchBlockChildren,
  7164. n: getNextHostNode,
  7165. o: options
  7166. };
  7167. let hydrate;
  7168. let hydrateNode;
  7169. if (createHydrationFns) {
  7170. [hydrate, hydrateNode] = createHydrationFns(
  7171. internals
  7172. );
  7173. }
  7174. return {
  7175. render,
  7176. hydrate,
  7177. createApp: createAppAPI(render, hydrate)
  7178. };
  7179. }
  7180. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  7181. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  7182. }
  7183. function toggleRecurse({ effect, update }, allowed) {
  7184. effect.allowRecurse = update.allowRecurse = allowed;
  7185. }
  7186. function needTransition(parentSuspense, transition) {
  7187. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  7188. }
  7189. function traverseStaticChildren(n1, n2, shallow = false) {
  7190. const ch1 = n1.children;
  7191. const ch2 = n2.children;
  7192. if (isArray(ch1) && isArray(ch2)) {
  7193. for (let i = 0; i < ch1.length; i++) {
  7194. const c1 = ch1[i];
  7195. let c2 = ch2[i];
  7196. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  7197. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  7198. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  7199. c2.el = c1.el;
  7200. }
  7201. if (!shallow && c2.patchFlag !== -2)
  7202. traverseStaticChildren(c1, c2);
  7203. }
  7204. if (c2.type === Text) {
  7205. c2.el = c1.el;
  7206. }
  7207. if (c2.type === Comment && !c2.el) {
  7208. c2.el = c1.el;
  7209. }
  7210. }
  7211. }
  7212. }
  7213. function getSequence(arr) {
  7214. const p = arr.slice();
  7215. const result = [0];
  7216. let i, j, u, v, c;
  7217. const len = arr.length;
  7218. for (i = 0; i < len; i++) {
  7219. const arrI = arr[i];
  7220. if (arrI !== 0) {
  7221. j = result[result.length - 1];
  7222. if (arr[j] < arrI) {
  7223. p[i] = j;
  7224. result.push(i);
  7225. continue;
  7226. }
  7227. u = 0;
  7228. v = result.length - 1;
  7229. while (u < v) {
  7230. c = u + v >> 1;
  7231. if (arr[result[c]] < arrI) {
  7232. u = c + 1;
  7233. } else {
  7234. v = c;
  7235. }
  7236. }
  7237. if (arrI < arr[result[u]]) {
  7238. if (u > 0) {
  7239. p[i] = result[u - 1];
  7240. }
  7241. result[u] = i;
  7242. }
  7243. }
  7244. }
  7245. u = result.length;
  7246. v = result[u - 1];
  7247. while (u-- > 0) {
  7248. result[u] = v;
  7249. v = p[v];
  7250. }
  7251. return result;
  7252. }
  7253. function locateNonHydratedAsyncRoot(instance) {
  7254. const subComponent = instance.subTree.component;
  7255. if (subComponent) {
  7256. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  7257. return subComponent;
  7258. } else {
  7259. return locateNonHydratedAsyncRoot(subComponent);
  7260. }
  7261. }
  7262. }
  7263. function invalidateMount(hooks) {
  7264. if (hooks) {
  7265. for (let i = 0; i < hooks.length; i++) hooks[i].active = false;
  7266. }
  7267. }
  7268. const ssrContextKey = Symbol.for("v-scx");
  7269. const useSSRContext = () => {
  7270. {
  7271. warn$1(`useSSRContext() is not supported in the global build.`);
  7272. }
  7273. };
  7274. function watchEffect(effect, options) {
  7275. return doWatch(effect, null, options);
  7276. }
  7277. function watchPostEffect(effect, options) {
  7278. return doWatch(
  7279. effect,
  7280. null,
  7281. extend({}, options, { flush: "post" })
  7282. );
  7283. }
  7284. function watchSyncEffect(effect, options) {
  7285. return doWatch(
  7286. effect,
  7287. null,
  7288. extend({}, options, { flush: "sync" })
  7289. );
  7290. }
  7291. const INITIAL_WATCHER_VALUE = {};
  7292. function watch(source, cb, options) {
  7293. if (!isFunction(cb)) {
  7294. warn$1(
  7295. `\`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.`
  7296. );
  7297. }
  7298. return doWatch(source, cb, options);
  7299. }
  7300. function doWatch(source, cb, {
  7301. immediate,
  7302. deep,
  7303. flush,
  7304. once,
  7305. onTrack,
  7306. onTrigger
  7307. } = EMPTY_OBJ) {
  7308. if (cb && once) {
  7309. const _cb = cb;
  7310. cb = (...args) => {
  7311. _cb(...args);
  7312. unwatch();
  7313. };
  7314. }
  7315. if (deep !== void 0 && typeof deep === "number") {
  7316. warn$1(
  7317. `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
  7318. );
  7319. }
  7320. if (!cb) {
  7321. if (immediate !== void 0) {
  7322. warn$1(
  7323. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  7324. );
  7325. }
  7326. if (deep !== void 0) {
  7327. warn$1(
  7328. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  7329. );
  7330. }
  7331. if (once !== void 0) {
  7332. warn$1(
  7333. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  7334. );
  7335. }
  7336. }
  7337. const warnInvalidSource = (s) => {
  7338. warn$1(
  7339. `Invalid watch source: `,
  7340. s,
  7341. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  7342. );
  7343. };
  7344. const instance = currentInstance;
  7345. const reactiveGetter = (source2) => deep === true ? source2 : (
  7346. // for deep: false, only traverse root-level properties
  7347. traverse(source2, deep === false ? 1 : void 0)
  7348. );
  7349. let getter;
  7350. let forceTrigger = false;
  7351. let isMultiSource = false;
  7352. if (isRef(source)) {
  7353. getter = () => source.value;
  7354. forceTrigger = isShallow(source);
  7355. } else if (isReactive(source)) {
  7356. getter = () => reactiveGetter(source);
  7357. forceTrigger = true;
  7358. } else if (isArray(source)) {
  7359. isMultiSource = true;
  7360. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  7361. getter = () => source.map((s) => {
  7362. if (isRef(s)) {
  7363. return s.value;
  7364. } else if (isReactive(s)) {
  7365. return reactiveGetter(s);
  7366. } else if (isFunction(s)) {
  7367. return callWithErrorHandling(s, instance, 2);
  7368. } else {
  7369. warnInvalidSource(s);
  7370. }
  7371. });
  7372. } else if (isFunction(source)) {
  7373. if (cb) {
  7374. getter = () => callWithErrorHandling(source, instance, 2);
  7375. } else {
  7376. getter = () => {
  7377. if (cleanup) {
  7378. cleanup();
  7379. }
  7380. return callWithAsyncErrorHandling(
  7381. source,
  7382. instance,
  7383. 3,
  7384. [onCleanup]
  7385. );
  7386. };
  7387. }
  7388. } else {
  7389. getter = NOOP;
  7390. warnInvalidSource(source);
  7391. }
  7392. if (cb && deep) {
  7393. const baseGetter = getter;
  7394. getter = () => traverse(baseGetter());
  7395. }
  7396. let cleanup;
  7397. let onCleanup = (fn) => {
  7398. cleanup = effect.onStop = () => {
  7399. callWithErrorHandling(fn, instance, 4);
  7400. cleanup = effect.onStop = void 0;
  7401. };
  7402. };
  7403. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  7404. const job = () => {
  7405. if (!effect.active || !effect.dirty) {
  7406. return;
  7407. }
  7408. if (cb) {
  7409. const newValue = effect.run();
  7410. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  7411. if (cleanup) {
  7412. cleanup();
  7413. }
  7414. callWithAsyncErrorHandling(cb, instance, 3, [
  7415. newValue,
  7416. // pass undefined as the old value when it's changed for the first time
  7417. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  7418. onCleanup
  7419. ]);
  7420. oldValue = newValue;
  7421. }
  7422. } else {
  7423. effect.run();
  7424. }
  7425. };
  7426. job.allowRecurse = !!cb;
  7427. let scheduler;
  7428. if (flush === "sync") {
  7429. scheduler = job;
  7430. } else if (flush === "post") {
  7431. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  7432. } else {
  7433. job.pre = true;
  7434. if (instance) job.id = instance.uid;
  7435. scheduler = () => queueJob(job);
  7436. }
  7437. const effect = new ReactiveEffect(getter, NOOP, scheduler);
  7438. const scope = getCurrentScope();
  7439. const unwatch = () => {
  7440. effect.stop();
  7441. if (scope) {
  7442. remove(scope.effects, effect);
  7443. }
  7444. };
  7445. {
  7446. effect.onTrack = onTrack;
  7447. effect.onTrigger = onTrigger;
  7448. }
  7449. if (cb) {
  7450. if (immediate) {
  7451. job();
  7452. } else {
  7453. oldValue = effect.run();
  7454. }
  7455. } else if (flush === "post") {
  7456. queuePostRenderEffect(
  7457. effect.run.bind(effect),
  7458. instance && instance.suspense
  7459. );
  7460. } else {
  7461. effect.run();
  7462. }
  7463. return unwatch;
  7464. }
  7465. function instanceWatch(source, value, options) {
  7466. const publicThis = this.proxy;
  7467. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  7468. let cb;
  7469. if (isFunction(value)) {
  7470. cb = value;
  7471. } else {
  7472. cb = value.handler;
  7473. options = value;
  7474. }
  7475. const reset = setCurrentInstance(this);
  7476. const res = doWatch(getter, cb.bind(publicThis), options);
  7477. reset();
  7478. return res;
  7479. }
  7480. function createPathGetter(ctx, path) {
  7481. const segments = path.split(".");
  7482. return () => {
  7483. let cur = ctx;
  7484. for (let i = 0; i < segments.length && cur; i++) {
  7485. cur = cur[segments[i]];
  7486. }
  7487. return cur;
  7488. };
  7489. }
  7490. function traverse(value, depth = Infinity, seen) {
  7491. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  7492. return value;
  7493. }
  7494. seen = seen || /* @__PURE__ */ new Set();
  7495. if (seen.has(value)) {
  7496. return value;
  7497. }
  7498. seen.add(value);
  7499. depth--;
  7500. if (isRef(value)) {
  7501. traverse(value.value, depth, seen);
  7502. } else if (isArray(value)) {
  7503. for (let i = 0; i < value.length; i++) {
  7504. traverse(value[i], depth, seen);
  7505. }
  7506. } else if (isSet(value) || isMap(value)) {
  7507. value.forEach((v) => {
  7508. traverse(v, depth, seen);
  7509. });
  7510. } else if (isPlainObject(value)) {
  7511. for (const key in value) {
  7512. traverse(value[key], depth, seen);
  7513. }
  7514. for (const key of Object.getOwnPropertySymbols(value)) {
  7515. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  7516. traverse(value[key], depth, seen);
  7517. }
  7518. }
  7519. }
  7520. return value;
  7521. }
  7522. function useModel(props, name, options = EMPTY_OBJ) {
  7523. const i = getCurrentInstance();
  7524. if (!i) {
  7525. warn$1(`useModel() called without active instance.`);
  7526. return ref();
  7527. }
  7528. if (!i.propsOptions[0][name]) {
  7529. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  7530. return ref();
  7531. }
  7532. const camelizedName = camelize(name);
  7533. const hyphenatedName = hyphenate(name);
  7534. const modifiers = getModelModifiers(props, name);
  7535. const res = customRef((track, trigger) => {
  7536. let localValue;
  7537. let prevSetValue = EMPTY_OBJ;
  7538. let prevEmittedValue;
  7539. watchSyncEffect(() => {
  7540. const propValue = props[name];
  7541. if (hasChanged(localValue, propValue)) {
  7542. localValue = propValue;
  7543. trigger();
  7544. }
  7545. });
  7546. return {
  7547. get() {
  7548. track();
  7549. return options.get ? options.get(localValue) : localValue;
  7550. },
  7551. set(value) {
  7552. const emittedValue = options.set ? options.set(value) : value;
  7553. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  7554. return;
  7555. }
  7556. const rawProps = i.vnode.props;
  7557. if (!(rawProps && // check if parent has passed v-model
  7558. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
  7559. localValue = value;
  7560. trigger();
  7561. }
  7562. i.emit(`update:${name}`, emittedValue);
  7563. if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
  7564. trigger();
  7565. }
  7566. prevSetValue = value;
  7567. prevEmittedValue = emittedValue;
  7568. }
  7569. };
  7570. });
  7571. res[Symbol.iterator] = () => {
  7572. let i2 = 0;
  7573. return {
  7574. next() {
  7575. if (i2 < 2) {
  7576. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  7577. } else {
  7578. return { done: true };
  7579. }
  7580. }
  7581. };
  7582. };
  7583. return res;
  7584. }
  7585. const getModelModifiers = (props, modelName) => {
  7586. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  7587. };
  7588. function emit(instance, event, ...rawArgs) {
  7589. if (instance.isUnmounted) return;
  7590. const props = instance.vnode.props || EMPTY_OBJ;
  7591. {
  7592. const {
  7593. emitsOptions,
  7594. propsOptions: [propsOptions]
  7595. } = instance;
  7596. if (emitsOptions) {
  7597. if (!(event in emitsOptions) && true) {
  7598. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  7599. warn$1(
  7600. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  7601. );
  7602. }
  7603. } else {
  7604. const validator = emitsOptions[event];
  7605. if (isFunction(validator)) {
  7606. const isValid = validator(...rawArgs);
  7607. if (!isValid) {
  7608. warn$1(
  7609. `Invalid event arguments: event validation failed for event "${event}".`
  7610. );
  7611. }
  7612. }
  7613. }
  7614. }
  7615. }
  7616. let args = rawArgs;
  7617. const isModelListener = event.startsWith("update:");
  7618. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  7619. if (modifiers) {
  7620. if (modifiers.trim) {
  7621. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  7622. }
  7623. if (modifiers.number) {
  7624. args = rawArgs.map(looseToNumber);
  7625. }
  7626. }
  7627. {
  7628. devtoolsComponentEmit(instance, event, args);
  7629. }
  7630. {
  7631. const lowerCaseEvent = event.toLowerCase();
  7632. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  7633. warn$1(
  7634. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  7635. instance,
  7636. instance.type
  7637. )} 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(
  7638. event
  7639. )}" instead of "${event}".`
  7640. );
  7641. }
  7642. }
  7643. let handlerName;
  7644. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  7645. props[handlerName = toHandlerKey(camelize(event))];
  7646. if (!handler && isModelListener) {
  7647. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  7648. }
  7649. if (handler) {
  7650. callWithAsyncErrorHandling(
  7651. handler,
  7652. instance,
  7653. 6,
  7654. args
  7655. );
  7656. }
  7657. const onceHandler = props[handlerName + `Once`];
  7658. if (onceHandler) {
  7659. if (!instance.emitted) {
  7660. instance.emitted = {};
  7661. } else if (instance.emitted[handlerName]) {
  7662. return;
  7663. }
  7664. instance.emitted[handlerName] = true;
  7665. callWithAsyncErrorHandling(
  7666. onceHandler,
  7667. instance,
  7668. 6,
  7669. args
  7670. );
  7671. }
  7672. }
  7673. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  7674. const cache = appContext.emitsCache;
  7675. const cached = cache.get(comp);
  7676. if (cached !== void 0) {
  7677. return cached;
  7678. }
  7679. const raw = comp.emits;
  7680. let normalized = {};
  7681. let hasExtends = false;
  7682. if (!isFunction(comp)) {
  7683. const extendEmits = (raw2) => {
  7684. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  7685. if (normalizedFromExtend) {
  7686. hasExtends = true;
  7687. extend(normalized, normalizedFromExtend);
  7688. }
  7689. };
  7690. if (!asMixin && appContext.mixins.length) {
  7691. appContext.mixins.forEach(extendEmits);
  7692. }
  7693. if (comp.extends) {
  7694. extendEmits(comp.extends);
  7695. }
  7696. if (comp.mixins) {
  7697. comp.mixins.forEach(extendEmits);
  7698. }
  7699. }
  7700. if (!raw && !hasExtends) {
  7701. if (isObject(comp)) {
  7702. cache.set(comp, null);
  7703. }
  7704. return null;
  7705. }
  7706. if (isArray(raw)) {
  7707. raw.forEach((key) => normalized[key] = null);
  7708. } else {
  7709. extend(normalized, raw);
  7710. }
  7711. if (isObject(comp)) {
  7712. cache.set(comp, normalized);
  7713. }
  7714. return normalized;
  7715. }
  7716. function isEmitListener(options, key) {
  7717. if (!options || !isOn(key)) {
  7718. return false;
  7719. }
  7720. key = key.slice(2).replace(/Once$/, "");
  7721. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  7722. }
  7723. let accessedAttrs = false;
  7724. function markAttrsAccessed() {
  7725. accessedAttrs = true;
  7726. }
  7727. function renderComponentRoot(instance) {
  7728. const {
  7729. type: Component,
  7730. vnode,
  7731. proxy,
  7732. withProxy,
  7733. propsOptions: [propsOptions],
  7734. slots,
  7735. attrs,
  7736. emit,
  7737. render,
  7738. renderCache,
  7739. props,
  7740. data,
  7741. setupState,
  7742. ctx,
  7743. inheritAttrs
  7744. } = instance;
  7745. const prev = setCurrentRenderingInstance(instance);
  7746. let result;
  7747. let fallthroughAttrs;
  7748. {
  7749. accessedAttrs = false;
  7750. }
  7751. try {
  7752. if (vnode.shapeFlag & 4) {
  7753. const proxyToUse = withProxy || proxy;
  7754. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  7755. get(target, key, receiver) {
  7756. warn$1(
  7757. `Property '${String(
  7758. key
  7759. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  7760. );
  7761. return Reflect.get(target, key, receiver);
  7762. }
  7763. }) : proxyToUse;
  7764. result = normalizeVNode(
  7765. render.call(
  7766. thisProxy,
  7767. proxyToUse,
  7768. renderCache,
  7769. true ? shallowReadonly(props) : props,
  7770. setupState,
  7771. data,
  7772. ctx
  7773. )
  7774. );
  7775. fallthroughAttrs = attrs;
  7776. } else {
  7777. const render2 = Component;
  7778. if (attrs === props) {
  7779. markAttrsAccessed();
  7780. }
  7781. result = normalizeVNode(
  7782. render2.length > 1 ? render2(
  7783. true ? shallowReadonly(props) : props,
  7784. true ? {
  7785. get attrs() {
  7786. markAttrsAccessed();
  7787. return shallowReadonly(attrs);
  7788. },
  7789. slots,
  7790. emit
  7791. } : { attrs, slots, emit }
  7792. ) : render2(
  7793. true ? shallowReadonly(props) : props,
  7794. null
  7795. )
  7796. );
  7797. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  7798. }
  7799. } catch (err) {
  7800. blockStack.length = 0;
  7801. handleError(err, instance, 1);
  7802. result = createVNode(Comment);
  7803. }
  7804. let root = result;
  7805. let setRoot = void 0;
  7806. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  7807. [root, setRoot] = getChildRoot(result);
  7808. }
  7809. if (fallthroughAttrs && inheritAttrs !== false) {
  7810. const keys = Object.keys(fallthroughAttrs);
  7811. const { shapeFlag } = root;
  7812. if (keys.length) {
  7813. if (shapeFlag & (1 | 6)) {
  7814. if (propsOptions && keys.some(isModelListener)) {
  7815. fallthroughAttrs = filterModelListeners(
  7816. fallthroughAttrs,
  7817. propsOptions
  7818. );
  7819. }
  7820. root = cloneVNode(root, fallthroughAttrs, false, true);
  7821. } else if (!accessedAttrs && root.type !== Comment) {
  7822. const allAttrs = Object.keys(attrs);
  7823. const eventAttrs = [];
  7824. const extraAttrs = [];
  7825. for (let i = 0, l = allAttrs.length; i < l; i++) {
  7826. const key = allAttrs[i];
  7827. if (isOn(key)) {
  7828. if (!isModelListener(key)) {
  7829. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  7830. }
  7831. } else {
  7832. extraAttrs.push(key);
  7833. }
  7834. }
  7835. if (extraAttrs.length) {
  7836. warn$1(
  7837. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  7838. );
  7839. }
  7840. if (eventAttrs.length) {
  7841. warn$1(
  7842. `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.`
  7843. );
  7844. }
  7845. }
  7846. }
  7847. }
  7848. if (vnode.dirs) {
  7849. if (!isElementRoot(root)) {
  7850. warn$1(
  7851. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  7852. );
  7853. }
  7854. root = cloneVNode(root, null, false, true);
  7855. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  7856. }
  7857. if (vnode.transition) {
  7858. if (!isElementRoot(root)) {
  7859. warn$1(
  7860. `Component inside <Transition> renders non-element root node that cannot be animated.`
  7861. );
  7862. }
  7863. root.transition = vnode.transition;
  7864. }
  7865. if (setRoot) {
  7866. setRoot(root);
  7867. } else {
  7868. result = root;
  7869. }
  7870. setCurrentRenderingInstance(prev);
  7871. return result;
  7872. }
  7873. const getChildRoot = (vnode) => {
  7874. const rawChildren = vnode.children;
  7875. const dynamicChildren = vnode.dynamicChildren;
  7876. const childRoot = filterSingleRoot(rawChildren, false);
  7877. if (!childRoot) {
  7878. return [vnode, void 0];
  7879. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  7880. return getChildRoot(childRoot);
  7881. }
  7882. const index = rawChildren.indexOf(childRoot);
  7883. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  7884. const setRoot = (updatedRoot) => {
  7885. rawChildren[index] = updatedRoot;
  7886. if (dynamicChildren) {
  7887. if (dynamicIndex > -1) {
  7888. dynamicChildren[dynamicIndex] = updatedRoot;
  7889. } else if (updatedRoot.patchFlag > 0) {
  7890. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  7891. }
  7892. }
  7893. };
  7894. return [normalizeVNode(childRoot), setRoot];
  7895. };
  7896. function filterSingleRoot(children, recurse = true) {
  7897. let singleRoot;
  7898. for (let i = 0; i < children.length; i++) {
  7899. const child = children[i];
  7900. if (isVNode(child)) {
  7901. if (child.type !== Comment || child.children === "v-if") {
  7902. if (singleRoot) {
  7903. return;
  7904. } else {
  7905. singleRoot = child;
  7906. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  7907. return filterSingleRoot(singleRoot.children);
  7908. }
  7909. }
  7910. }
  7911. } else {
  7912. return;
  7913. }
  7914. }
  7915. return singleRoot;
  7916. }
  7917. const getFunctionalFallthrough = (attrs) => {
  7918. let res;
  7919. for (const key in attrs) {
  7920. if (key === "class" || key === "style" || isOn(key)) {
  7921. (res || (res = {}))[key] = attrs[key];
  7922. }
  7923. }
  7924. return res;
  7925. };
  7926. const filterModelListeners = (attrs, props) => {
  7927. const res = {};
  7928. for (const key in attrs) {
  7929. if (!isModelListener(key) || !(key.slice(9) in props)) {
  7930. res[key] = attrs[key];
  7931. }
  7932. }
  7933. return res;
  7934. };
  7935. const isElementRoot = (vnode) => {
  7936. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  7937. };
  7938. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  7939. const { props: prevProps, children: prevChildren, component } = prevVNode;
  7940. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  7941. const emits = component.emitsOptions;
  7942. if ((prevChildren || nextChildren) && isHmrUpdating) {
  7943. return true;
  7944. }
  7945. if (nextVNode.dirs || nextVNode.transition) {
  7946. return true;
  7947. }
  7948. if (optimized && patchFlag >= 0) {
  7949. if (patchFlag & 1024) {
  7950. return true;
  7951. }
  7952. if (patchFlag & 16) {
  7953. if (!prevProps) {
  7954. return !!nextProps;
  7955. }
  7956. return hasPropsChanged(prevProps, nextProps, emits);
  7957. } else if (patchFlag & 8) {
  7958. const dynamicProps = nextVNode.dynamicProps;
  7959. for (let i = 0; i < dynamicProps.length; i++) {
  7960. const key = dynamicProps[i];
  7961. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  7962. return true;
  7963. }
  7964. }
  7965. }
  7966. } else {
  7967. if (prevChildren || nextChildren) {
  7968. if (!nextChildren || !nextChildren.$stable) {
  7969. return true;
  7970. }
  7971. }
  7972. if (prevProps === nextProps) {
  7973. return false;
  7974. }
  7975. if (!prevProps) {
  7976. return !!nextProps;
  7977. }
  7978. if (!nextProps) {
  7979. return true;
  7980. }
  7981. return hasPropsChanged(prevProps, nextProps, emits);
  7982. }
  7983. return false;
  7984. }
  7985. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  7986. const nextKeys = Object.keys(nextProps);
  7987. if (nextKeys.length !== Object.keys(prevProps).length) {
  7988. return true;
  7989. }
  7990. for (let i = 0; i < nextKeys.length; i++) {
  7991. const key = nextKeys[i];
  7992. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  7993. return true;
  7994. }
  7995. }
  7996. return false;
  7997. }
  7998. function updateHOCHostEl({ vnode, parent }, el) {
  7999. while (parent) {
  8000. const root = parent.subTree;
  8001. if (root.suspense && root.suspense.activeBranch === vnode) {
  8002. root.el = vnode.el;
  8003. }
  8004. if (root === vnode) {
  8005. (vnode = parent.vnode).el = el;
  8006. parent = parent.parent;
  8007. } else {
  8008. break;
  8009. }
  8010. }
  8011. }
  8012. const isSuspense = (type) => type.__isSuspense;
  8013. let suspenseId = 0;
  8014. const SuspenseImpl = {
  8015. name: "Suspense",
  8016. // In order to make Suspense tree-shakable, we need to avoid importing it
  8017. // directly in the renderer. The renderer checks for the __isSuspense flag
  8018. // on a vnode's type and calls the `process` method, passing in renderer
  8019. // internals.
  8020. __isSuspense: true,
  8021. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8022. if (n1 == null) {
  8023. mountSuspense(
  8024. n2,
  8025. container,
  8026. anchor,
  8027. parentComponent,
  8028. parentSuspense,
  8029. namespace,
  8030. slotScopeIds,
  8031. optimized,
  8032. rendererInternals
  8033. );
  8034. } else {
  8035. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  8036. n2.suspense = n1.suspense;
  8037. n2.suspense.vnode = n2;
  8038. n2.el = n1.el;
  8039. return;
  8040. }
  8041. patchSuspense(
  8042. n1,
  8043. n2,
  8044. container,
  8045. anchor,
  8046. parentComponent,
  8047. namespace,
  8048. slotScopeIds,
  8049. optimized,
  8050. rendererInternals
  8051. );
  8052. }
  8053. },
  8054. hydrate: hydrateSuspense,
  8055. normalize: normalizeSuspenseChildren
  8056. };
  8057. const Suspense = SuspenseImpl ;
  8058. function triggerEvent(vnode, name) {
  8059. const eventListener = vnode.props && vnode.props[name];
  8060. if (isFunction(eventListener)) {
  8061. eventListener();
  8062. }
  8063. }
  8064. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8065. const {
  8066. p: patch,
  8067. o: { createElement }
  8068. } = rendererInternals;
  8069. const hiddenContainer = createElement("div");
  8070. const suspense = vnode.suspense = createSuspenseBoundary(
  8071. vnode,
  8072. parentSuspense,
  8073. parentComponent,
  8074. container,
  8075. hiddenContainer,
  8076. anchor,
  8077. namespace,
  8078. slotScopeIds,
  8079. optimized,
  8080. rendererInternals
  8081. );
  8082. patch(
  8083. null,
  8084. suspense.pendingBranch = vnode.ssContent,
  8085. hiddenContainer,
  8086. null,
  8087. parentComponent,
  8088. suspense,
  8089. namespace,
  8090. slotScopeIds
  8091. );
  8092. if (suspense.deps > 0) {
  8093. triggerEvent(vnode, "onPending");
  8094. triggerEvent(vnode, "onFallback");
  8095. patch(
  8096. null,
  8097. vnode.ssFallback,
  8098. container,
  8099. anchor,
  8100. parentComponent,
  8101. null,
  8102. // fallback tree will not have suspense context
  8103. namespace,
  8104. slotScopeIds
  8105. );
  8106. setActiveBranch(suspense, vnode.ssFallback);
  8107. } else {
  8108. suspense.resolve(false, true);
  8109. }
  8110. }
  8111. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  8112. const suspense = n2.suspense = n1.suspense;
  8113. suspense.vnode = n2;
  8114. n2.el = n1.el;
  8115. const newBranch = n2.ssContent;
  8116. const newFallback = n2.ssFallback;
  8117. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  8118. if (pendingBranch) {
  8119. suspense.pendingBranch = newBranch;
  8120. if (isSameVNodeType(newBranch, pendingBranch)) {
  8121. patch(
  8122. pendingBranch,
  8123. newBranch,
  8124. suspense.hiddenContainer,
  8125. null,
  8126. parentComponent,
  8127. suspense,
  8128. namespace,
  8129. slotScopeIds,
  8130. optimized
  8131. );
  8132. if (suspense.deps <= 0) {
  8133. suspense.resolve();
  8134. } else if (isInFallback) {
  8135. if (!isHydrating) {
  8136. patch(
  8137. activeBranch,
  8138. newFallback,
  8139. container,
  8140. anchor,
  8141. parentComponent,
  8142. null,
  8143. // fallback tree will not have suspense context
  8144. namespace,
  8145. slotScopeIds,
  8146. optimized
  8147. );
  8148. setActiveBranch(suspense, newFallback);
  8149. }
  8150. }
  8151. } else {
  8152. suspense.pendingId = suspenseId++;
  8153. if (isHydrating) {
  8154. suspense.isHydrating = false;
  8155. suspense.activeBranch = pendingBranch;
  8156. } else {
  8157. unmount(pendingBranch, parentComponent, suspense);
  8158. }
  8159. suspense.deps = 0;
  8160. suspense.effects.length = 0;
  8161. suspense.hiddenContainer = createElement("div");
  8162. if (isInFallback) {
  8163. patch(
  8164. null,
  8165. newBranch,
  8166. suspense.hiddenContainer,
  8167. null,
  8168. parentComponent,
  8169. suspense,
  8170. namespace,
  8171. slotScopeIds,
  8172. optimized
  8173. );
  8174. if (suspense.deps <= 0) {
  8175. suspense.resolve();
  8176. } else {
  8177. patch(
  8178. activeBranch,
  8179. newFallback,
  8180. container,
  8181. anchor,
  8182. parentComponent,
  8183. null,
  8184. // fallback tree will not have suspense context
  8185. namespace,
  8186. slotScopeIds,
  8187. optimized
  8188. );
  8189. setActiveBranch(suspense, newFallback);
  8190. }
  8191. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  8192. patch(
  8193. activeBranch,
  8194. newBranch,
  8195. container,
  8196. anchor,
  8197. parentComponent,
  8198. suspense,
  8199. namespace,
  8200. slotScopeIds,
  8201. optimized
  8202. );
  8203. suspense.resolve(true);
  8204. } else {
  8205. patch(
  8206. null,
  8207. newBranch,
  8208. suspense.hiddenContainer,
  8209. null,
  8210. parentComponent,
  8211. suspense,
  8212. namespace,
  8213. slotScopeIds,
  8214. optimized
  8215. );
  8216. if (suspense.deps <= 0) {
  8217. suspense.resolve();
  8218. }
  8219. }
  8220. }
  8221. } else {
  8222. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  8223. patch(
  8224. activeBranch,
  8225. newBranch,
  8226. container,
  8227. anchor,
  8228. parentComponent,
  8229. suspense,
  8230. namespace,
  8231. slotScopeIds,
  8232. optimized
  8233. );
  8234. setActiveBranch(suspense, newBranch);
  8235. } else {
  8236. triggerEvent(n2, "onPending");
  8237. suspense.pendingBranch = newBranch;
  8238. if (newBranch.shapeFlag & 512) {
  8239. suspense.pendingId = newBranch.component.suspenseId;
  8240. } else {
  8241. suspense.pendingId = suspenseId++;
  8242. }
  8243. patch(
  8244. null,
  8245. newBranch,
  8246. suspense.hiddenContainer,
  8247. null,
  8248. parentComponent,
  8249. suspense,
  8250. namespace,
  8251. slotScopeIds,
  8252. optimized
  8253. );
  8254. if (suspense.deps <= 0) {
  8255. suspense.resolve();
  8256. } else {
  8257. const { timeout, pendingId } = suspense;
  8258. if (timeout > 0) {
  8259. setTimeout(() => {
  8260. if (suspense.pendingId === pendingId) {
  8261. suspense.fallback(newFallback);
  8262. }
  8263. }, timeout);
  8264. } else if (timeout === 0) {
  8265. suspense.fallback(newFallback);
  8266. }
  8267. }
  8268. }
  8269. }
  8270. }
  8271. let hasWarned = false;
  8272. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  8273. if (!hasWarned) {
  8274. hasWarned = true;
  8275. console[console.info ? "info" : "log"](
  8276. `<Suspense> is an experimental feature and its API will likely change.`
  8277. );
  8278. }
  8279. const {
  8280. p: patch,
  8281. m: move,
  8282. um: unmount,
  8283. n: next,
  8284. o: { parentNode, remove }
  8285. } = rendererInternals;
  8286. let parentSuspenseId;
  8287. const isSuspensible = isVNodeSuspensible(vnode);
  8288. if (isSuspensible) {
  8289. if (parentSuspense && parentSuspense.pendingBranch) {
  8290. parentSuspenseId = parentSuspense.pendingId;
  8291. parentSuspense.deps++;
  8292. }
  8293. }
  8294. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  8295. {
  8296. assertNumber(timeout, `Suspense timeout`);
  8297. }
  8298. const initialAnchor = anchor;
  8299. const suspense = {
  8300. vnode,
  8301. parent: parentSuspense,
  8302. parentComponent,
  8303. namespace,
  8304. container,
  8305. hiddenContainer,
  8306. deps: 0,
  8307. pendingId: suspenseId++,
  8308. timeout: typeof timeout === "number" ? timeout : -1,
  8309. activeBranch: null,
  8310. pendingBranch: null,
  8311. isInFallback: !isHydrating,
  8312. isHydrating,
  8313. isUnmounted: false,
  8314. effects: [],
  8315. resolve(resume = false, sync = false) {
  8316. {
  8317. if (!resume && !suspense.pendingBranch) {
  8318. throw new Error(
  8319. `suspense.resolve() is called without a pending branch.`
  8320. );
  8321. }
  8322. if (suspense.isUnmounted) {
  8323. throw new Error(
  8324. `suspense.resolve() is called on an already unmounted suspense boundary.`
  8325. );
  8326. }
  8327. }
  8328. const {
  8329. vnode: vnode2,
  8330. activeBranch,
  8331. pendingBranch,
  8332. pendingId,
  8333. effects,
  8334. parentComponent: parentComponent2,
  8335. container: container2
  8336. } = suspense;
  8337. let delayEnter = false;
  8338. if (suspense.isHydrating) {
  8339. suspense.isHydrating = false;
  8340. } else if (!resume) {
  8341. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  8342. if (delayEnter) {
  8343. activeBranch.transition.afterLeave = () => {
  8344. if (pendingId === suspense.pendingId) {
  8345. move(
  8346. pendingBranch,
  8347. container2,
  8348. anchor === initialAnchor ? next(activeBranch) : anchor,
  8349. 0
  8350. );
  8351. queuePostFlushCb(effects);
  8352. }
  8353. };
  8354. }
  8355. if (activeBranch) {
  8356. if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
  8357. anchor = next(activeBranch);
  8358. }
  8359. unmount(activeBranch, parentComponent2, suspense, true);
  8360. }
  8361. if (!delayEnter) {
  8362. move(pendingBranch, container2, anchor, 0);
  8363. }
  8364. }
  8365. setActiveBranch(suspense, pendingBranch);
  8366. suspense.pendingBranch = null;
  8367. suspense.isInFallback = false;
  8368. let parent = suspense.parent;
  8369. let hasUnresolvedAncestor = false;
  8370. while (parent) {
  8371. if (parent.pendingBranch) {
  8372. parent.effects.push(...effects);
  8373. hasUnresolvedAncestor = true;
  8374. break;
  8375. }
  8376. parent = parent.parent;
  8377. }
  8378. if (!hasUnresolvedAncestor && !delayEnter) {
  8379. queuePostFlushCb(effects);
  8380. }
  8381. suspense.effects = [];
  8382. if (isSuspensible) {
  8383. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  8384. parentSuspense.deps--;
  8385. if (parentSuspense.deps === 0 && !sync) {
  8386. parentSuspense.resolve();
  8387. }
  8388. }
  8389. }
  8390. triggerEvent(vnode2, "onResolve");
  8391. },
  8392. fallback(fallbackVNode) {
  8393. if (!suspense.pendingBranch) {
  8394. return;
  8395. }
  8396. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  8397. triggerEvent(vnode2, "onFallback");
  8398. const anchor2 = next(activeBranch);
  8399. const mountFallback = () => {
  8400. if (!suspense.isInFallback) {
  8401. return;
  8402. }
  8403. patch(
  8404. null,
  8405. fallbackVNode,
  8406. container2,
  8407. anchor2,
  8408. parentComponent2,
  8409. null,
  8410. // fallback tree will not have suspense context
  8411. namespace2,
  8412. slotScopeIds,
  8413. optimized
  8414. );
  8415. setActiveBranch(suspense, fallbackVNode);
  8416. };
  8417. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  8418. if (delayEnter) {
  8419. activeBranch.transition.afterLeave = mountFallback;
  8420. }
  8421. suspense.isInFallback = true;
  8422. unmount(
  8423. activeBranch,
  8424. parentComponent2,
  8425. null,
  8426. // no suspense so unmount hooks fire now
  8427. true
  8428. // shouldRemove
  8429. );
  8430. if (!delayEnter) {
  8431. mountFallback();
  8432. }
  8433. },
  8434. move(container2, anchor2, type) {
  8435. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  8436. suspense.container = container2;
  8437. },
  8438. next() {
  8439. return suspense.activeBranch && next(suspense.activeBranch);
  8440. },
  8441. registerDep(instance, setupRenderEffect, optimized2) {
  8442. const isInPendingSuspense = !!suspense.pendingBranch;
  8443. if (isInPendingSuspense) {
  8444. suspense.deps++;
  8445. }
  8446. const hydratedEl = instance.vnode.el;
  8447. instance.asyncDep.catch((err) => {
  8448. handleError(err, instance, 0);
  8449. }).then((asyncSetupResult) => {
  8450. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  8451. return;
  8452. }
  8453. instance.asyncResolved = true;
  8454. const { vnode: vnode2 } = instance;
  8455. {
  8456. pushWarningContext(vnode2);
  8457. }
  8458. handleSetupResult(instance, asyncSetupResult, false);
  8459. if (hydratedEl) {
  8460. vnode2.el = hydratedEl;
  8461. }
  8462. const placeholder = !hydratedEl && instance.subTree.el;
  8463. setupRenderEffect(
  8464. instance,
  8465. vnode2,
  8466. // component may have been moved before resolve.
  8467. // if this is not a hydration, instance.subTree will be the comment
  8468. // placeholder.
  8469. parentNode(hydratedEl || instance.subTree.el),
  8470. // anchor will not be used if this is hydration, so only need to
  8471. // consider the comment placeholder case.
  8472. hydratedEl ? null : next(instance.subTree),
  8473. suspense,
  8474. namespace,
  8475. optimized2
  8476. );
  8477. if (placeholder) {
  8478. remove(placeholder);
  8479. }
  8480. updateHOCHostEl(instance, vnode2.el);
  8481. {
  8482. popWarningContext();
  8483. }
  8484. if (isInPendingSuspense && --suspense.deps === 0) {
  8485. suspense.resolve();
  8486. }
  8487. });
  8488. },
  8489. unmount(parentSuspense2, doRemove) {
  8490. suspense.isUnmounted = true;
  8491. if (suspense.activeBranch) {
  8492. unmount(
  8493. suspense.activeBranch,
  8494. parentComponent,
  8495. parentSuspense2,
  8496. doRemove
  8497. );
  8498. }
  8499. if (suspense.pendingBranch) {
  8500. unmount(
  8501. suspense.pendingBranch,
  8502. parentComponent,
  8503. parentSuspense2,
  8504. doRemove
  8505. );
  8506. }
  8507. }
  8508. };
  8509. return suspense;
  8510. }
  8511. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  8512. const suspense = vnode.suspense = createSuspenseBoundary(
  8513. vnode,
  8514. parentSuspense,
  8515. parentComponent,
  8516. node.parentNode,
  8517. // eslint-disable-next-line no-restricted-globals
  8518. document.createElement("div"),
  8519. null,
  8520. namespace,
  8521. slotScopeIds,
  8522. optimized,
  8523. rendererInternals,
  8524. true
  8525. );
  8526. const result = hydrateNode(
  8527. node,
  8528. suspense.pendingBranch = vnode.ssContent,
  8529. parentComponent,
  8530. suspense,
  8531. slotScopeIds,
  8532. optimized
  8533. );
  8534. if (suspense.deps === 0) {
  8535. suspense.resolve(false, true);
  8536. }
  8537. return result;
  8538. }
  8539. function normalizeSuspenseChildren(vnode) {
  8540. const { shapeFlag, children } = vnode;
  8541. const isSlotChildren = shapeFlag & 32;
  8542. vnode.ssContent = normalizeSuspenseSlot(
  8543. isSlotChildren ? children.default : children
  8544. );
  8545. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  8546. }
  8547. function normalizeSuspenseSlot(s) {
  8548. let block;
  8549. if (isFunction(s)) {
  8550. const trackBlock = isBlockTreeEnabled && s._c;
  8551. if (trackBlock) {
  8552. s._d = false;
  8553. openBlock();
  8554. }
  8555. s = s();
  8556. if (trackBlock) {
  8557. s._d = true;
  8558. block = currentBlock;
  8559. closeBlock();
  8560. }
  8561. }
  8562. if (isArray(s)) {
  8563. const singleChild = filterSingleRoot(s);
  8564. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  8565. warn$1(`<Suspense> slots expect a single root node.`);
  8566. }
  8567. s = singleChild;
  8568. }
  8569. s = normalizeVNode(s);
  8570. if (block && !s.dynamicChildren) {
  8571. s.dynamicChildren = block.filter((c) => c !== s);
  8572. }
  8573. return s;
  8574. }
  8575. function queueEffectWithSuspense(fn, suspense) {
  8576. if (suspense && suspense.pendingBranch) {
  8577. if (isArray(fn)) {
  8578. suspense.effects.push(...fn);
  8579. } else {
  8580. suspense.effects.push(fn);
  8581. }
  8582. } else {
  8583. queuePostFlushCb(fn);
  8584. }
  8585. }
  8586. function setActiveBranch(suspense, branch) {
  8587. suspense.activeBranch = branch;
  8588. const { vnode, parentComponent } = suspense;
  8589. let el = branch.el;
  8590. while (!el && branch.component) {
  8591. branch = branch.component.subTree;
  8592. el = branch.el;
  8593. }
  8594. vnode.el = el;
  8595. if (parentComponent && parentComponent.subTree === vnode) {
  8596. parentComponent.vnode.el = el;
  8597. updateHOCHostEl(parentComponent, el);
  8598. }
  8599. }
  8600. function isVNodeSuspensible(vnode) {
  8601. const suspensible = vnode.props && vnode.props.suspensible;
  8602. return suspensible != null && suspensible !== false;
  8603. }
  8604. const Fragment = Symbol.for("v-fgt");
  8605. const Text = Symbol.for("v-txt");
  8606. const Comment = Symbol.for("v-cmt");
  8607. const Static = Symbol.for("v-stc");
  8608. const blockStack = [];
  8609. let currentBlock = null;
  8610. function openBlock(disableTracking = false) {
  8611. blockStack.push(currentBlock = disableTracking ? null : []);
  8612. }
  8613. function closeBlock() {
  8614. blockStack.pop();
  8615. currentBlock = blockStack[blockStack.length - 1] || null;
  8616. }
  8617. let isBlockTreeEnabled = 1;
  8618. function setBlockTracking(value) {
  8619. isBlockTreeEnabled += value;
  8620. if (value < 0 && currentBlock) {
  8621. currentBlock.hasOnce = true;
  8622. }
  8623. }
  8624. function setupBlock(vnode) {
  8625. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  8626. closeBlock();
  8627. if (isBlockTreeEnabled > 0 && currentBlock) {
  8628. currentBlock.push(vnode);
  8629. }
  8630. return vnode;
  8631. }
  8632. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  8633. return setupBlock(
  8634. createBaseVNode(
  8635. type,
  8636. props,
  8637. children,
  8638. patchFlag,
  8639. dynamicProps,
  8640. shapeFlag,
  8641. true
  8642. )
  8643. );
  8644. }
  8645. function createBlock(type, props, children, patchFlag, dynamicProps) {
  8646. return setupBlock(
  8647. createVNode(
  8648. type,
  8649. props,
  8650. children,
  8651. patchFlag,
  8652. dynamicProps,
  8653. true
  8654. )
  8655. );
  8656. }
  8657. function isVNode(value) {
  8658. return value ? value.__v_isVNode === true : false;
  8659. }
  8660. function isSameVNodeType(n1, n2) {
  8661. if (n2.shapeFlag & 6 && n1.component) {
  8662. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  8663. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  8664. n1.shapeFlag &= ~256;
  8665. n2.shapeFlag &= ~512;
  8666. return false;
  8667. }
  8668. }
  8669. return n1.type === n2.type && n1.key === n2.key;
  8670. }
  8671. let vnodeArgsTransformer;
  8672. function transformVNodeArgs(transformer) {
  8673. vnodeArgsTransformer = transformer;
  8674. }
  8675. const createVNodeWithArgsTransform = (...args) => {
  8676. return _createVNode(
  8677. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  8678. );
  8679. };
  8680. const normalizeKey = ({ key }) => key != null ? key : null;
  8681. const normalizeRef = ({
  8682. ref,
  8683. ref_key,
  8684. ref_for
  8685. }) => {
  8686. if (typeof ref === "number") {
  8687. ref = "" + ref;
  8688. }
  8689. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  8690. };
  8691. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  8692. const vnode = {
  8693. __v_isVNode: true,
  8694. __v_skip: true,
  8695. type,
  8696. props,
  8697. key: props && normalizeKey(props),
  8698. ref: props && normalizeRef(props),
  8699. scopeId: currentScopeId,
  8700. slotScopeIds: null,
  8701. children,
  8702. component: null,
  8703. suspense: null,
  8704. ssContent: null,
  8705. ssFallback: null,
  8706. dirs: null,
  8707. transition: null,
  8708. el: null,
  8709. anchor: null,
  8710. target: null,
  8711. targetStart: null,
  8712. targetAnchor: null,
  8713. staticCount: 0,
  8714. shapeFlag,
  8715. patchFlag,
  8716. dynamicProps,
  8717. dynamicChildren: null,
  8718. appContext: null,
  8719. ctx: currentRenderingInstance
  8720. };
  8721. if (needFullChildrenNormalization) {
  8722. normalizeChildren(vnode, children);
  8723. if (shapeFlag & 128) {
  8724. type.normalize(vnode);
  8725. }
  8726. } else if (children) {
  8727. vnode.shapeFlag |= isString(children) ? 8 : 16;
  8728. }
  8729. if (vnode.key !== vnode.key) {
  8730. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  8731. }
  8732. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  8733. !isBlockNode && // has current parent block
  8734. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  8735. // component nodes also should always be patched, because even if the
  8736. // component doesn't need to update, it needs to persist the instance on to
  8737. // the next vnode so that it can be properly unmounted later.
  8738. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  8739. // vnode should not be considered dynamic due to handler caching.
  8740. vnode.patchFlag !== 32) {
  8741. currentBlock.push(vnode);
  8742. }
  8743. return vnode;
  8744. }
  8745. const createVNode = createVNodeWithArgsTransform ;
  8746. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  8747. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  8748. if (!type) {
  8749. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  8750. }
  8751. type = Comment;
  8752. }
  8753. if (isVNode(type)) {
  8754. const cloned = cloneVNode(
  8755. type,
  8756. props,
  8757. true
  8758. /* mergeRef: true */
  8759. );
  8760. if (children) {
  8761. normalizeChildren(cloned, children);
  8762. }
  8763. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  8764. if (cloned.shapeFlag & 6) {
  8765. currentBlock[currentBlock.indexOf(type)] = cloned;
  8766. } else {
  8767. currentBlock.push(cloned);
  8768. }
  8769. }
  8770. cloned.patchFlag = -2;
  8771. return cloned;
  8772. }
  8773. if (isClassComponent(type)) {
  8774. type = type.__vccOpts;
  8775. }
  8776. if (props) {
  8777. props = guardReactiveProps(props);
  8778. let { class: klass, style } = props;
  8779. if (klass && !isString(klass)) {
  8780. props.class = normalizeClass(klass);
  8781. }
  8782. if (isObject(style)) {
  8783. if (isProxy(style) && !isArray(style)) {
  8784. style = extend({}, style);
  8785. }
  8786. props.style = normalizeStyle(style);
  8787. }
  8788. }
  8789. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  8790. if (shapeFlag & 4 && isProxy(type)) {
  8791. type = toRaw(type);
  8792. warn$1(
  8793. `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\`.`,
  8794. `
  8795. Component that was made reactive: `,
  8796. type
  8797. );
  8798. }
  8799. return createBaseVNode(
  8800. type,
  8801. props,
  8802. children,
  8803. patchFlag,
  8804. dynamicProps,
  8805. shapeFlag,
  8806. isBlockNode,
  8807. true
  8808. );
  8809. }
  8810. function guardReactiveProps(props) {
  8811. if (!props) return null;
  8812. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  8813. }
  8814. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  8815. const { props, ref, patchFlag, children, transition } = vnode;
  8816. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  8817. const cloned = {
  8818. __v_isVNode: true,
  8819. __v_skip: true,
  8820. type: vnode.type,
  8821. props: mergedProps,
  8822. key: mergedProps && normalizeKey(mergedProps),
  8823. ref: extraProps && extraProps.ref ? (
  8824. // #2078 in the case of <component :is="vnode" ref="extra"/>
  8825. // if the vnode itself already has a ref, cloneVNode will need to merge
  8826. // the refs so the single vnode can be set on multiple refs
  8827. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  8828. ) : ref,
  8829. scopeId: vnode.scopeId,
  8830. slotScopeIds: vnode.slotScopeIds,
  8831. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  8832. target: vnode.target,
  8833. targetStart: vnode.targetStart,
  8834. targetAnchor: vnode.targetAnchor,
  8835. staticCount: vnode.staticCount,
  8836. shapeFlag: vnode.shapeFlag,
  8837. // if the vnode is cloned with extra props, we can no longer assume its
  8838. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  8839. // note: preserve flag for fragments since they use the flag for children
  8840. // fast paths only.
  8841. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  8842. dynamicProps: vnode.dynamicProps,
  8843. dynamicChildren: vnode.dynamicChildren,
  8844. appContext: vnode.appContext,
  8845. dirs: vnode.dirs,
  8846. transition,
  8847. // These should technically only be non-null on mounted VNodes. However,
  8848. // they *should* be copied for kept-alive vnodes. So we just always copy
  8849. // them since them being non-null during a mount doesn't affect the logic as
  8850. // they will simply be overwritten.
  8851. component: vnode.component,
  8852. suspense: vnode.suspense,
  8853. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  8854. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  8855. el: vnode.el,
  8856. anchor: vnode.anchor,
  8857. ctx: vnode.ctx,
  8858. ce: vnode.ce
  8859. };
  8860. if (transition && cloneTransition) {
  8861. setTransitionHooks(
  8862. cloned,
  8863. transition.clone(cloned)
  8864. );
  8865. }
  8866. return cloned;
  8867. }
  8868. function deepCloneVNode(vnode) {
  8869. const cloned = cloneVNode(vnode);
  8870. if (isArray(vnode.children)) {
  8871. cloned.children = vnode.children.map(deepCloneVNode);
  8872. }
  8873. return cloned;
  8874. }
  8875. function createTextVNode(text = " ", flag = 0) {
  8876. return createVNode(Text, null, text, flag);
  8877. }
  8878. function createStaticVNode(content, numberOfNodes) {
  8879. const vnode = createVNode(Static, null, content);
  8880. vnode.staticCount = numberOfNodes;
  8881. return vnode;
  8882. }
  8883. function createCommentVNode(text = "", asBlock = false) {
  8884. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  8885. }
  8886. function normalizeVNode(child) {
  8887. if (child == null || typeof child === "boolean") {
  8888. return createVNode(Comment);
  8889. } else if (isArray(child)) {
  8890. return createVNode(
  8891. Fragment,
  8892. null,
  8893. // #3666, avoid reference pollution when reusing vnode
  8894. child.slice()
  8895. );
  8896. } else if (typeof child === "object") {
  8897. return cloneIfMounted(child);
  8898. } else {
  8899. return createVNode(Text, null, String(child));
  8900. }
  8901. }
  8902. function cloneIfMounted(child) {
  8903. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  8904. }
  8905. function normalizeChildren(vnode, children) {
  8906. let type = 0;
  8907. const { shapeFlag } = vnode;
  8908. if (children == null) {
  8909. children = null;
  8910. } else if (isArray(children)) {
  8911. type = 16;
  8912. } else if (typeof children === "object") {
  8913. if (shapeFlag & (1 | 64)) {
  8914. const slot = children.default;
  8915. if (slot) {
  8916. slot._c && (slot._d = false);
  8917. normalizeChildren(vnode, slot());
  8918. slot._c && (slot._d = true);
  8919. }
  8920. return;
  8921. } else {
  8922. type = 32;
  8923. const slotFlag = children._;
  8924. if (!slotFlag && !isInternalObject(children)) {
  8925. children._ctx = currentRenderingInstance;
  8926. } else if (slotFlag === 3 && currentRenderingInstance) {
  8927. if (currentRenderingInstance.slots._ === 1) {
  8928. children._ = 1;
  8929. } else {
  8930. children._ = 2;
  8931. vnode.patchFlag |= 1024;
  8932. }
  8933. }
  8934. }
  8935. } else if (isFunction(children)) {
  8936. children = { default: children, _ctx: currentRenderingInstance };
  8937. type = 32;
  8938. } else {
  8939. children = String(children);
  8940. if (shapeFlag & 64) {
  8941. type = 16;
  8942. children = [createTextVNode(children)];
  8943. } else {
  8944. type = 8;
  8945. }
  8946. }
  8947. vnode.children = children;
  8948. vnode.shapeFlag |= type;
  8949. }
  8950. function mergeProps(...args) {
  8951. const ret = {};
  8952. for (let i = 0; i < args.length; i++) {
  8953. const toMerge = args[i];
  8954. for (const key in toMerge) {
  8955. if (key === "class") {
  8956. if (ret.class !== toMerge.class) {
  8957. ret.class = normalizeClass([ret.class, toMerge.class]);
  8958. }
  8959. } else if (key === "style") {
  8960. ret.style = normalizeStyle([ret.style, toMerge.style]);
  8961. } else if (isOn(key)) {
  8962. const existing = ret[key];
  8963. const incoming = toMerge[key];
  8964. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  8965. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  8966. }
  8967. } else if (key !== "") {
  8968. ret[key] = toMerge[key];
  8969. }
  8970. }
  8971. }
  8972. return ret;
  8973. }
  8974. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  8975. callWithAsyncErrorHandling(hook, instance, 7, [
  8976. vnode,
  8977. prevVNode
  8978. ]);
  8979. }
  8980. const emptyAppContext = createAppContext();
  8981. let uid = 0;
  8982. function createComponentInstance(vnode, parent, suspense) {
  8983. const type = vnode.type;
  8984. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  8985. const instance = {
  8986. uid: uid++,
  8987. vnode,
  8988. type,
  8989. parent,
  8990. appContext,
  8991. root: null,
  8992. // to be immediately set
  8993. next: null,
  8994. subTree: null,
  8995. // will be set synchronously right after creation
  8996. effect: null,
  8997. update: null,
  8998. // will be set synchronously right after creation
  8999. scope: new EffectScope(
  9000. true
  9001. /* detached */
  9002. ),
  9003. render: null,
  9004. proxy: null,
  9005. exposed: null,
  9006. exposeProxy: null,
  9007. withProxy: null,
  9008. provides: parent ? parent.provides : Object.create(appContext.provides),
  9009. accessCache: null,
  9010. renderCache: [],
  9011. // local resolved assets
  9012. components: null,
  9013. directives: null,
  9014. // resolved props and emits options
  9015. propsOptions: normalizePropsOptions(type, appContext),
  9016. emitsOptions: normalizeEmitsOptions(type, appContext),
  9017. // emit
  9018. emit: null,
  9019. // to be set immediately
  9020. emitted: null,
  9021. // props default value
  9022. propsDefaults: EMPTY_OBJ,
  9023. // inheritAttrs
  9024. inheritAttrs: type.inheritAttrs,
  9025. // state
  9026. ctx: EMPTY_OBJ,
  9027. data: EMPTY_OBJ,
  9028. props: EMPTY_OBJ,
  9029. attrs: EMPTY_OBJ,
  9030. slots: EMPTY_OBJ,
  9031. refs: EMPTY_OBJ,
  9032. setupState: EMPTY_OBJ,
  9033. setupContext: null,
  9034. // suspense related
  9035. suspense,
  9036. suspenseId: suspense ? suspense.pendingId : 0,
  9037. asyncDep: null,
  9038. asyncResolved: false,
  9039. // lifecycle hooks
  9040. // not using enums here because it results in computed properties
  9041. isMounted: false,
  9042. isUnmounted: false,
  9043. isDeactivated: false,
  9044. bc: null,
  9045. c: null,
  9046. bm: null,
  9047. m: null,
  9048. bu: null,
  9049. u: null,
  9050. um: null,
  9051. bum: null,
  9052. da: null,
  9053. a: null,
  9054. rtg: null,
  9055. rtc: null,
  9056. ec: null,
  9057. sp: null
  9058. };
  9059. {
  9060. instance.ctx = createDevRenderContext(instance);
  9061. }
  9062. instance.root = parent ? parent.root : instance;
  9063. instance.emit = emit.bind(null, instance);
  9064. if (vnode.ce) {
  9065. vnode.ce(instance);
  9066. }
  9067. return instance;
  9068. }
  9069. let currentInstance = null;
  9070. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  9071. let internalSetCurrentInstance;
  9072. let setInSSRSetupState;
  9073. {
  9074. internalSetCurrentInstance = (i) => {
  9075. currentInstance = i;
  9076. };
  9077. setInSSRSetupState = (v) => {
  9078. isInSSRComponentSetup = v;
  9079. };
  9080. }
  9081. const setCurrentInstance = (instance) => {
  9082. const prev = currentInstance;
  9083. internalSetCurrentInstance(instance);
  9084. instance.scope.on();
  9085. return () => {
  9086. instance.scope.off();
  9087. internalSetCurrentInstance(prev);
  9088. };
  9089. };
  9090. const unsetCurrentInstance = () => {
  9091. currentInstance && currentInstance.scope.off();
  9092. internalSetCurrentInstance(null);
  9093. };
  9094. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  9095. function validateComponentName(name, { isNativeTag }) {
  9096. if (isBuiltInTag(name) || isNativeTag(name)) {
  9097. warn$1(
  9098. "Do not use built-in or reserved HTML elements as component id: " + name
  9099. );
  9100. }
  9101. }
  9102. function isStatefulComponent(instance) {
  9103. return instance.vnode.shapeFlag & 4;
  9104. }
  9105. let isInSSRComponentSetup = false;
  9106. function setupComponent(instance, isSSR = false, optimized = false) {
  9107. isSSR && setInSSRSetupState(isSSR);
  9108. const { props, children } = instance.vnode;
  9109. const isStateful = isStatefulComponent(instance);
  9110. initProps(instance, props, isStateful, isSSR);
  9111. initSlots(instance, children, optimized);
  9112. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  9113. isSSR && setInSSRSetupState(false);
  9114. return setupResult;
  9115. }
  9116. function setupStatefulComponent(instance, isSSR) {
  9117. var _a;
  9118. const Component = instance.type;
  9119. {
  9120. if (Component.name) {
  9121. validateComponentName(Component.name, instance.appContext.config);
  9122. }
  9123. if (Component.components) {
  9124. const names = Object.keys(Component.components);
  9125. for (let i = 0; i < names.length; i++) {
  9126. validateComponentName(names[i], instance.appContext.config);
  9127. }
  9128. }
  9129. if (Component.directives) {
  9130. const names = Object.keys(Component.directives);
  9131. for (let i = 0; i < names.length; i++) {
  9132. validateDirectiveName(names[i]);
  9133. }
  9134. }
  9135. if (Component.compilerOptions && isRuntimeOnly()) {
  9136. warn$1(
  9137. `"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.`
  9138. );
  9139. }
  9140. }
  9141. instance.accessCache = /* @__PURE__ */ Object.create(null);
  9142. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  9143. {
  9144. exposePropsOnRenderContext(instance);
  9145. }
  9146. const { setup } = Component;
  9147. if (setup) {
  9148. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  9149. const reset = setCurrentInstance(instance);
  9150. pauseTracking();
  9151. const setupResult = callWithErrorHandling(
  9152. setup,
  9153. instance,
  9154. 0,
  9155. [
  9156. shallowReadonly(instance.props) ,
  9157. setupContext
  9158. ]
  9159. );
  9160. resetTracking();
  9161. reset();
  9162. if (isPromise(setupResult)) {
  9163. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  9164. if (isSSR) {
  9165. return setupResult.then((resolvedResult) => {
  9166. handleSetupResult(instance, resolvedResult, isSSR);
  9167. }).catch((e) => {
  9168. handleError(e, instance, 0);
  9169. });
  9170. } else {
  9171. instance.asyncDep = setupResult;
  9172. if (!instance.suspense) {
  9173. const name = (_a = Component.name) != null ? _a : "Anonymous";
  9174. warn$1(
  9175. `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.`
  9176. );
  9177. }
  9178. }
  9179. } else {
  9180. handleSetupResult(instance, setupResult, isSSR);
  9181. }
  9182. } else {
  9183. finishComponentSetup(instance, isSSR);
  9184. }
  9185. }
  9186. function handleSetupResult(instance, setupResult, isSSR) {
  9187. if (isFunction(setupResult)) {
  9188. {
  9189. instance.render = setupResult;
  9190. }
  9191. } else if (isObject(setupResult)) {
  9192. if (isVNode(setupResult)) {
  9193. warn$1(
  9194. `setup() should not return VNodes directly - return a render function instead.`
  9195. );
  9196. }
  9197. {
  9198. instance.devtoolsRawSetupState = setupResult;
  9199. }
  9200. instance.setupState = proxyRefs(setupResult);
  9201. {
  9202. exposeSetupStateOnRenderContext(instance);
  9203. }
  9204. } else if (setupResult !== void 0) {
  9205. warn$1(
  9206. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  9207. );
  9208. }
  9209. finishComponentSetup(instance, isSSR);
  9210. }
  9211. let compile$1;
  9212. let installWithProxy;
  9213. function registerRuntimeCompiler(_compile) {
  9214. compile$1 = _compile;
  9215. installWithProxy = (i) => {
  9216. if (i.render._rc) {
  9217. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  9218. }
  9219. };
  9220. }
  9221. const isRuntimeOnly = () => !compile$1;
  9222. function finishComponentSetup(instance, isSSR, skipOptions) {
  9223. const Component = instance.type;
  9224. if (!instance.render) {
  9225. if (!isSSR && compile$1 && !Component.render) {
  9226. const template = Component.template || resolveMergedOptions(instance).template;
  9227. if (template) {
  9228. {
  9229. startMeasure(instance, `compile`);
  9230. }
  9231. const { isCustomElement, compilerOptions } = instance.appContext.config;
  9232. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  9233. const finalCompilerOptions = extend(
  9234. extend(
  9235. {
  9236. isCustomElement,
  9237. delimiters
  9238. },
  9239. compilerOptions
  9240. ),
  9241. componentCompilerOptions
  9242. );
  9243. Component.render = compile$1(template, finalCompilerOptions);
  9244. {
  9245. endMeasure(instance, `compile`);
  9246. }
  9247. }
  9248. }
  9249. instance.render = Component.render || NOOP;
  9250. if (installWithProxy) {
  9251. installWithProxy(instance);
  9252. }
  9253. }
  9254. {
  9255. const reset = setCurrentInstance(instance);
  9256. pauseTracking();
  9257. try {
  9258. applyOptions(instance);
  9259. } finally {
  9260. resetTracking();
  9261. reset();
  9262. }
  9263. }
  9264. if (!Component.render && instance.render === NOOP && !isSSR) {
  9265. if (!compile$1 && Component.template) {
  9266. warn$1(
  9267. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
  9268. );
  9269. } else {
  9270. warn$1(`Component is missing template or render function: `, Component);
  9271. }
  9272. }
  9273. }
  9274. const attrsProxyHandlers = {
  9275. get(target, key) {
  9276. markAttrsAccessed();
  9277. track(target, "get", "");
  9278. return target[key];
  9279. },
  9280. set() {
  9281. warn$1(`setupContext.attrs is readonly.`);
  9282. return false;
  9283. },
  9284. deleteProperty() {
  9285. warn$1(`setupContext.attrs is readonly.`);
  9286. return false;
  9287. }
  9288. } ;
  9289. function getSlotsProxy(instance) {
  9290. return new Proxy(instance.slots, {
  9291. get(target, key) {
  9292. track(instance, "get", "$slots");
  9293. return target[key];
  9294. }
  9295. });
  9296. }
  9297. function createSetupContext(instance) {
  9298. const expose = (exposed) => {
  9299. {
  9300. if (instance.exposed) {
  9301. warn$1(`expose() should be called only once per setup().`);
  9302. }
  9303. if (exposed != null) {
  9304. let exposedType = typeof exposed;
  9305. if (exposedType === "object") {
  9306. if (isArray(exposed)) {
  9307. exposedType = "array";
  9308. } else if (isRef(exposed)) {
  9309. exposedType = "ref";
  9310. }
  9311. }
  9312. if (exposedType !== "object") {
  9313. warn$1(
  9314. `expose() should be passed a plain object, received ${exposedType}.`
  9315. );
  9316. }
  9317. }
  9318. }
  9319. instance.exposed = exposed || {};
  9320. };
  9321. {
  9322. let attrsProxy;
  9323. let slotsProxy;
  9324. return Object.freeze({
  9325. get attrs() {
  9326. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  9327. },
  9328. get slots() {
  9329. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  9330. },
  9331. get emit() {
  9332. return (event, ...args) => instance.emit(event, ...args);
  9333. },
  9334. expose
  9335. });
  9336. }
  9337. }
  9338. function getComponentPublicInstance(instance) {
  9339. if (instance.exposed) {
  9340. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  9341. get(target, key) {
  9342. if (key in target) {
  9343. return target[key];
  9344. } else if (key in publicPropertiesMap) {
  9345. return publicPropertiesMap[key](instance);
  9346. }
  9347. },
  9348. has(target, key) {
  9349. return key in target || key in publicPropertiesMap;
  9350. }
  9351. }));
  9352. } else {
  9353. return instance.proxy;
  9354. }
  9355. }
  9356. const classifyRE = /(?:^|[-_])(\w)/g;
  9357. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  9358. function getComponentName(Component, includeInferred = true) {
  9359. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  9360. }
  9361. function formatComponentName(instance, Component, isRoot = false) {
  9362. let name = getComponentName(Component);
  9363. if (!name && Component.__file) {
  9364. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  9365. if (match) {
  9366. name = match[1];
  9367. }
  9368. }
  9369. if (!name && instance && instance.parent) {
  9370. const inferFromRegistry = (registry) => {
  9371. for (const key in registry) {
  9372. if (registry[key] === Component) {
  9373. return key;
  9374. }
  9375. }
  9376. };
  9377. name = inferFromRegistry(
  9378. instance.components || instance.parent.type.components
  9379. ) || inferFromRegistry(instance.appContext.components);
  9380. }
  9381. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  9382. }
  9383. function isClassComponent(value) {
  9384. return isFunction(value) && "__vccOpts" in value;
  9385. }
  9386. const computed = (getterOrOptions, debugOptions) => {
  9387. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  9388. {
  9389. const i = getCurrentInstance();
  9390. if (i && i.appContext.config.warnRecursiveComputed) {
  9391. c._warnRecursive = true;
  9392. }
  9393. }
  9394. return c;
  9395. };
  9396. function h(type, propsOrChildren, children) {
  9397. const l = arguments.length;
  9398. if (l === 2) {
  9399. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  9400. if (isVNode(propsOrChildren)) {
  9401. return createVNode(type, null, [propsOrChildren]);
  9402. }
  9403. return createVNode(type, propsOrChildren);
  9404. } else {
  9405. return createVNode(type, null, propsOrChildren);
  9406. }
  9407. } else {
  9408. if (l > 3) {
  9409. children = Array.prototype.slice.call(arguments, 2);
  9410. } else if (l === 3 && isVNode(children)) {
  9411. children = [children];
  9412. }
  9413. return createVNode(type, propsOrChildren, children);
  9414. }
  9415. }
  9416. function initCustomFormatter() {
  9417. if (typeof window === "undefined") {
  9418. return;
  9419. }
  9420. const vueStyle = { style: "color:#3ba776" };
  9421. const numberStyle = { style: "color:#1677ff" };
  9422. const stringStyle = { style: "color:#f5222d" };
  9423. const keywordStyle = { style: "color:#eb2f96" };
  9424. const formatter = {
  9425. __vue_custom_formatter: true,
  9426. header(obj) {
  9427. if (!isObject(obj)) {
  9428. return null;
  9429. }
  9430. if (obj.__isVue) {
  9431. return ["div", vueStyle, `VueInstance`];
  9432. } else if (isRef(obj)) {
  9433. return [
  9434. "div",
  9435. {},
  9436. ["span", vueStyle, genRefFlag(obj)],
  9437. "<",
  9438. formatValue(obj.value),
  9439. `>`
  9440. ];
  9441. } else if (isReactive(obj)) {
  9442. return [
  9443. "div",
  9444. {},
  9445. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  9446. "<",
  9447. formatValue(obj),
  9448. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  9449. ];
  9450. } else if (isReadonly(obj)) {
  9451. return [
  9452. "div",
  9453. {},
  9454. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  9455. "<",
  9456. formatValue(obj),
  9457. ">"
  9458. ];
  9459. }
  9460. return null;
  9461. },
  9462. hasBody(obj) {
  9463. return obj && obj.__isVue;
  9464. },
  9465. body(obj) {
  9466. if (obj && obj.__isVue) {
  9467. return [
  9468. "div",
  9469. {},
  9470. ...formatInstance(obj.$)
  9471. ];
  9472. }
  9473. }
  9474. };
  9475. function formatInstance(instance) {
  9476. const blocks = [];
  9477. if (instance.type.props && instance.props) {
  9478. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  9479. }
  9480. if (instance.setupState !== EMPTY_OBJ) {
  9481. blocks.push(createInstanceBlock("setup", instance.setupState));
  9482. }
  9483. if (instance.data !== EMPTY_OBJ) {
  9484. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  9485. }
  9486. const computed = extractKeys(instance, "computed");
  9487. if (computed) {
  9488. blocks.push(createInstanceBlock("computed", computed));
  9489. }
  9490. const injected = extractKeys(instance, "inject");
  9491. if (injected) {
  9492. blocks.push(createInstanceBlock("injected", injected));
  9493. }
  9494. blocks.push([
  9495. "div",
  9496. {},
  9497. [
  9498. "span",
  9499. {
  9500. style: keywordStyle.style + ";opacity:0.66"
  9501. },
  9502. "$ (internal): "
  9503. ],
  9504. ["object", { object: instance }]
  9505. ]);
  9506. return blocks;
  9507. }
  9508. function createInstanceBlock(type, target) {
  9509. target = extend({}, target);
  9510. if (!Object.keys(target).length) {
  9511. return ["span", {}];
  9512. }
  9513. return [
  9514. "div",
  9515. { style: "line-height:1.25em;margin-bottom:0.6em" },
  9516. [
  9517. "div",
  9518. {
  9519. style: "color:#476582"
  9520. },
  9521. type
  9522. ],
  9523. [
  9524. "div",
  9525. {
  9526. style: "padding-left:1.25em"
  9527. },
  9528. ...Object.keys(target).map((key) => {
  9529. return [
  9530. "div",
  9531. {},
  9532. ["span", keywordStyle, key + ": "],
  9533. formatValue(target[key], false)
  9534. ];
  9535. })
  9536. ]
  9537. ];
  9538. }
  9539. function formatValue(v, asRaw = true) {
  9540. if (typeof v === "number") {
  9541. return ["span", numberStyle, v];
  9542. } else if (typeof v === "string") {
  9543. return ["span", stringStyle, JSON.stringify(v)];
  9544. } else if (typeof v === "boolean") {
  9545. return ["span", keywordStyle, v];
  9546. } else if (isObject(v)) {
  9547. return ["object", { object: asRaw ? toRaw(v) : v }];
  9548. } else {
  9549. return ["span", stringStyle, String(v)];
  9550. }
  9551. }
  9552. function extractKeys(instance, type) {
  9553. const Comp = instance.type;
  9554. if (isFunction(Comp)) {
  9555. return;
  9556. }
  9557. const extracted = {};
  9558. for (const key in instance.ctx) {
  9559. if (isKeyOfType(Comp, key, type)) {
  9560. extracted[key] = instance.ctx[key];
  9561. }
  9562. }
  9563. return extracted;
  9564. }
  9565. function isKeyOfType(Comp, key, type) {
  9566. const opts = Comp[type];
  9567. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  9568. return true;
  9569. }
  9570. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  9571. return true;
  9572. }
  9573. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  9574. return true;
  9575. }
  9576. }
  9577. function genRefFlag(v) {
  9578. if (isShallow(v)) {
  9579. return `ShallowRef`;
  9580. }
  9581. if (v.effect) {
  9582. return `ComputedRef`;
  9583. }
  9584. return `Ref`;
  9585. }
  9586. if (window.devtoolsFormatters) {
  9587. window.devtoolsFormatters.push(formatter);
  9588. } else {
  9589. window.devtoolsFormatters = [formatter];
  9590. }
  9591. }
  9592. function withMemo(memo, render, cache, index) {
  9593. const cached = cache[index];
  9594. if (cached && isMemoSame(cached, memo)) {
  9595. return cached;
  9596. }
  9597. const ret = render();
  9598. ret.memo = memo.slice();
  9599. ret.cacheIndex = index;
  9600. return cache[index] = ret;
  9601. }
  9602. function isMemoSame(cached, memo) {
  9603. const prev = cached.memo;
  9604. if (prev.length != memo.length) {
  9605. return false;
  9606. }
  9607. for (let i = 0; i < prev.length; i++) {
  9608. if (hasChanged(prev[i], memo[i])) {
  9609. return false;
  9610. }
  9611. }
  9612. if (isBlockTreeEnabled > 0 && currentBlock) {
  9613. currentBlock.push(cached);
  9614. }
  9615. return true;
  9616. }
  9617. const version = "3.4.38";
  9618. const warn = warn$1 ;
  9619. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  9620. const devtools = devtools$1 ;
  9621. const setDevtoolsHook = setDevtoolsHook$1 ;
  9622. const ssrUtils = null;
  9623. const resolveFilter = null;
  9624. const compatUtils = null;
  9625. const DeprecationTypes = null;
  9626. const svgNS = "http://www.w3.org/2000/svg";
  9627. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  9628. const doc = typeof document !== "undefined" ? document : null;
  9629. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  9630. const nodeOps = {
  9631. insert: (child, parent, anchor) => {
  9632. parent.insertBefore(child, anchor || null);
  9633. },
  9634. remove: (child) => {
  9635. const parent = child.parentNode;
  9636. if (parent) {
  9637. parent.removeChild(child);
  9638. }
  9639. },
  9640. createElement: (tag, namespace, is, props) => {
  9641. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  9642. if (tag === "select" && props && props.multiple != null) {
  9643. el.setAttribute("multiple", props.multiple);
  9644. }
  9645. return el;
  9646. },
  9647. createText: (text) => doc.createTextNode(text),
  9648. createComment: (text) => doc.createComment(text),
  9649. setText: (node, text) => {
  9650. node.nodeValue = text;
  9651. },
  9652. setElementText: (el, text) => {
  9653. el.textContent = text;
  9654. },
  9655. parentNode: (node) => node.parentNode,
  9656. nextSibling: (node) => node.nextSibling,
  9657. querySelector: (selector) => doc.querySelector(selector),
  9658. setScopeId(el, id) {
  9659. el.setAttribute(id, "");
  9660. },
  9661. // __UNSAFE__
  9662. // Reason: innerHTML.
  9663. // Static content here can only come from compiled templates.
  9664. // As long as the user only uses trusted templates, this is safe.
  9665. insertStaticContent(content, parent, anchor, namespace, start, end) {
  9666. const before = anchor ? anchor.previousSibling : parent.lastChild;
  9667. if (start && (start === end || start.nextSibling)) {
  9668. while (true) {
  9669. parent.insertBefore(start.cloneNode(true), anchor);
  9670. if (start === end || !(start = start.nextSibling)) break;
  9671. }
  9672. } else {
  9673. templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
  9674. const template = templateContainer.content;
  9675. if (namespace === "svg" || namespace === "mathml") {
  9676. const wrapper = template.firstChild;
  9677. while (wrapper.firstChild) {
  9678. template.appendChild(wrapper.firstChild);
  9679. }
  9680. template.removeChild(wrapper);
  9681. }
  9682. parent.insertBefore(template, anchor);
  9683. }
  9684. return [
  9685. // first
  9686. before ? before.nextSibling : parent.firstChild,
  9687. // last
  9688. anchor ? anchor.previousSibling : parent.lastChild
  9689. ];
  9690. }
  9691. };
  9692. const TRANSITION$1 = "transition";
  9693. const ANIMATION = "animation";
  9694. const vtcKey = Symbol("_vtc");
  9695. const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
  9696. Transition.displayName = "Transition";
  9697. const DOMTransitionPropsValidators = {
  9698. name: String,
  9699. type: String,
  9700. css: {
  9701. type: Boolean,
  9702. default: true
  9703. },
  9704. duration: [String, Number, Object],
  9705. enterFromClass: String,
  9706. enterActiveClass: String,
  9707. enterToClass: String,
  9708. appearFromClass: String,
  9709. appearActiveClass: String,
  9710. appearToClass: String,
  9711. leaveFromClass: String,
  9712. leaveActiveClass: String,
  9713. leaveToClass: String
  9714. };
  9715. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
  9716. {},
  9717. BaseTransitionPropsValidators,
  9718. DOMTransitionPropsValidators
  9719. );
  9720. const callHook = (hook, args = []) => {
  9721. if (isArray(hook)) {
  9722. hook.forEach((h2) => h2(...args));
  9723. } else if (hook) {
  9724. hook(...args);
  9725. }
  9726. };
  9727. const hasExplicitCallback = (hook) => {
  9728. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  9729. };
  9730. function resolveTransitionProps(rawProps) {
  9731. const baseProps = {};
  9732. for (const key in rawProps) {
  9733. if (!(key in DOMTransitionPropsValidators)) {
  9734. baseProps[key] = rawProps[key];
  9735. }
  9736. }
  9737. if (rawProps.css === false) {
  9738. return baseProps;
  9739. }
  9740. const {
  9741. name = "v",
  9742. type,
  9743. duration,
  9744. enterFromClass = `${name}-enter-from`,
  9745. enterActiveClass = `${name}-enter-active`,
  9746. enterToClass = `${name}-enter-to`,
  9747. appearFromClass = enterFromClass,
  9748. appearActiveClass = enterActiveClass,
  9749. appearToClass = enterToClass,
  9750. leaveFromClass = `${name}-leave-from`,
  9751. leaveActiveClass = `${name}-leave-active`,
  9752. leaveToClass = `${name}-leave-to`
  9753. } = rawProps;
  9754. const durations = normalizeDuration(duration);
  9755. const enterDuration = durations && durations[0];
  9756. const leaveDuration = durations && durations[1];
  9757. const {
  9758. onBeforeEnter,
  9759. onEnter,
  9760. onEnterCancelled,
  9761. onLeave,
  9762. onLeaveCancelled,
  9763. onBeforeAppear = onBeforeEnter,
  9764. onAppear = onEnter,
  9765. onAppearCancelled = onEnterCancelled
  9766. } = baseProps;
  9767. const finishEnter = (el, isAppear, done) => {
  9768. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9769. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  9770. done && done();
  9771. };
  9772. const finishLeave = (el, done) => {
  9773. el._isLeaving = false;
  9774. removeTransitionClass(el, leaveFromClass);
  9775. removeTransitionClass(el, leaveToClass);
  9776. removeTransitionClass(el, leaveActiveClass);
  9777. done && done();
  9778. };
  9779. const makeEnterHook = (isAppear) => {
  9780. return (el, done) => {
  9781. const hook = isAppear ? onAppear : onEnter;
  9782. const resolve = () => finishEnter(el, isAppear, done);
  9783. callHook(hook, [el, resolve]);
  9784. nextFrame(() => {
  9785. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  9786. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9787. if (!hasExplicitCallback(hook)) {
  9788. whenTransitionEnds(el, type, enterDuration, resolve);
  9789. }
  9790. });
  9791. };
  9792. };
  9793. return extend(baseProps, {
  9794. onBeforeEnter(el) {
  9795. callHook(onBeforeEnter, [el]);
  9796. addTransitionClass(el, enterFromClass);
  9797. addTransitionClass(el, enterActiveClass);
  9798. },
  9799. onBeforeAppear(el) {
  9800. callHook(onBeforeAppear, [el]);
  9801. addTransitionClass(el, appearFromClass);
  9802. addTransitionClass(el, appearActiveClass);
  9803. },
  9804. onEnter: makeEnterHook(false),
  9805. onAppear: makeEnterHook(true),
  9806. onLeave(el, done) {
  9807. el._isLeaving = true;
  9808. const resolve = () => finishLeave(el, done);
  9809. addTransitionClass(el, leaveFromClass);
  9810. addTransitionClass(el, leaveActiveClass);
  9811. forceReflow();
  9812. nextFrame(() => {
  9813. if (!el._isLeaving) {
  9814. return;
  9815. }
  9816. removeTransitionClass(el, leaveFromClass);
  9817. addTransitionClass(el, leaveToClass);
  9818. if (!hasExplicitCallback(onLeave)) {
  9819. whenTransitionEnds(el, type, leaveDuration, resolve);
  9820. }
  9821. });
  9822. callHook(onLeave, [el, resolve]);
  9823. },
  9824. onEnterCancelled(el) {
  9825. finishEnter(el, false);
  9826. callHook(onEnterCancelled, [el]);
  9827. },
  9828. onAppearCancelled(el) {
  9829. finishEnter(el, true);
  9830. callHook(onAppearCancelled, [el]);
  9831. },
  9832. onLeaveCancelled(el) {
  9833. finishLeave(el);
  9834. callHook(onLeaveCancelled, [el]);
  9835. }
  9836. });
  9837. }
  9838. function normalizeDuration(duration) {
  9839. if (duration == null) {
  9840. return null;
  9841. } else if (isObject(duration)) {
  9842. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  9843. } else {
  9844. const n = NumberOf(duration);
  9845. return [n, n];
  9846. }
  9847. }
  9848. function NumberOf(val) {
  9849. const res = toNumber(val);
  9850. {
  9851. assertNumber(res, "<transition> explicit duration");
  9852. }
  9853. return res;
  9854. }
  9855. function addTransitionClass(el, cls) {
  9856. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  9857. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  9858. }
  9859. function removeTransitionClass(el, cls) {
  9860. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  9861. const _vtc = el[vtcKey];
  9862. if (_vtc) {
  9863. _vtc.delete(cls);
  9864. if (!_vtc.size) {
  9865. el[vtcKey] = void 0;
  9866. }
  9867. }
  9868. }
  9869. function nextFrame(cb) {
  9870. requestAnimationFrame(() => {
  9871. requestAnimationFrame(cb);
  9872. });
  9873. }
  9874. let endId = 0;
  9875. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  9876. const id = el._endId = ++endId;
  9877. const resolveIfNotStale = () => {
  9878. if (id === el._endId) {
  9879. resolve();
  9880. }
  9881. };
  9882. if (explicitTimeout) {
  9883. return setTimeout(resolveIfNotStale, explicitTimeout);
  9884. }
  9885. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  9886. if (!type) {
  9887. return resolve();
  9888. }
  9889. const endEvent = type + "end";
  9890. let ended = 0;
  9891. const end = () => {
  9892. el.removeEventListener(endEvent, onEnd);
  9893. resolveIfNotStale();
  9894. };
  9895. const onEnd = (e) => {
  9896. if (e.target === el && ++ended >= propCount) {
  9897. end();
  9898. }
  9899. };
  9900. setTimeout(() => {
  9901. if (ended < propCount) {
  9902. end();
  9903. }
  9904. }, timeout + 1);
  9905. el.addEventListener(endEvent, onEnd);
  9906. }
  9907. function getTransitionInfo(el, expectedType) {
  9908. const styles = window.getComputedStyle(el);
  9909. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  9910. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  9911. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  9912. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  9913. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  9914. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  9915. const animationTimeout = getTimeout(animationDelays, animationDurations);
  9916. let type = null;
  9917. let timeout = 0;
  9918. let propCount = 0;
  9919. if (expectedType === TRANSITION$1) {
  9920. if (transitionTimeout > 0) {
  9921. type = TRANSITION$1;
  9922. timeout = transitionTimeout;
  9923. propCount = transitionDurations.length;
  9924. }
  9925. } else if (expectedType === ANIMATION) {
  9926. if (animationTimeout > 0) {
  9927. type = ANIMATION;
  9928. timeout = animationTimeout;
  9929. propCount = animationDurations.length;
  9930. }
  9931. } else {
  9932. timeout = Math.max(transitionTimeout, animationTimeout);
  9933. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  9934. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  9935. }
  9936. const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
  9937. getStyleProperties(`${TRANSITION$1}Property`).toString()
  9938. );
  9939. return {
  9940. type,
  9941. timeout,
  9942. propCount,
  9943. hasTransform
  9944. };
  9945. }
  9946. function getTimeout(delays, durations) {
  9947. while (delays.length < durations.length) {
  9948. delays = delays.concat(delays);
  9949. }
  9950. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  9951. }
  9952. function toMs(s) {
  9953. if (s === "auto") return 0;
  9954. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  9955. }
  9956. function forceReflow() {
  9957. return document.body.offsetHeight;
  9958. }
  9959. function patchClass(el, value, isSVG) {
  9960. const transitionClasses = el[vtcKey];
  9961. if (transitionClasses) {
  9962. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  9963. }
  9964. if (value == null) {
  9965. el.removeAttribute("class");
  9966. } else if (isSVG) {
  9967. el.setAttribute("class", value);
  9968. } else {
  9969. el.className = value;
  9970. }
  9971. }
  9972. const vShowOriginalDisplay = Symbol("_vod");
  9973. const vShowHidden = Symbol("_vsh");
  9974. const vShow = {
  9975. beforeMount(el, { value }, { transition }) {
  9976. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  9977. if (transition && value) {
  9978. transition.beforeEnter(el);
  9979. } else {
  9980. setDisplay(el, value);
  9981. }
  9982. },
  9983. mounted(el, { value }, { transition }) {
  9984. if (transition && value) {
  9985. transition.enter(el);
  9986. }
  9987. },
  9988. updated(el, { value, oldValue }, { transition }) {
  9989. if (!value === !oldValue) return;
  9990. if (transition) {
  9991. if (value) {
  9992. transition.beforeEnter(el);
  9993. setDisplay(el, true);
  9994. transition.enter(el);
  9995. } else {
  9996. transition.leave(el, () => {
  9997. setDisplay(el, false);
  9998. });
  9999. }
  10000. } else {
  10001. setDisplay(el, value);
  10002. }
  10003. },
  10004. beforeUnmount(el, { value }) {
  10005. setDisplay(el, value);
  10006. }
  10007. };
  10008. {
  10009. vShow.name = "show";
  10010. }
  10011. function setDisplay(el, value) {
  10012. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  10013. el[vShowHidden] = !value;
  10014. }
  10015. const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
  10016. function useCssVars(getter) {
  10017. const instance = getCurrentInstance();
  10018. if (!instance) {
  10019. warn(`useCssVars is called without current active component instance.`);
  10020. return;
  10021. }
  10022. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  10023. Array.from(
  10024. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  10025. ).forEach((node) => setVarsOnNode(node, vars));
  10026. };
  10027. {
  10028. instance.getCssVars = () => getter(instance.proxy);
  10029. }
  10030. const setVars = () => {
  10031. const vars = getter(instance.proxy);
  10032. setVarsOnVNode(instance.subTree, vars);
  10033. updateTeleports(vars);
  10034. };
  10035. onBeforeMount(() => {
  10036. watchPostEffect(setVars);
  10037. });
  10038. onMounted(() => {
  10039. const ob = new MutationObserver(setVars);
  10040. ob.observe(instance.subTree.el.parentNode, { childList: true });
  10041. onUnmounted(() => ob.disconnect());
  10042. });
  10043. }
  10044. function setVarsOnVNode(vnode, vars) {
  10045. if (vnode.shapeFlag & 128) {
  10046. const suspense = vnode.suspense;
  10047. vnode = suspense.activeBranch;
  10048. if (suspense.pendingBranch && !suspense.isHydrating) {
  10049. suspense.effects.push(() => {
  10050. setVarsOnVNode(suspense.activeBranch, vars);
  10051. });
  10052. }
  10053. }
  10054. while (vnode.component) {
  10055. vnode = vnode.component.subTree;
  10056. }
  10057. if (vnode.shapeFlag & 1 && vnode.el) {
  10058. setVarsOnNode(vnode.el, vars);
  10059. } else if (vnode.type === Fragment) {
  10060. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  10061. } else if (vnode.type === Static) {
  10062. let { el, anchor } = vnode;
  10063. while (el) {
  10064. setVarsOnNode(el, vars);
  10065. if (el === anchor) break;
  10066. el = el.nextSibling;
  10067. }
  10068. }
  10069. }
  10070. function setVarsOnNode(el, vars) {
  10071. if (el.nodeType === 1) {
  10072. const style = el.style;
  10073. let cssText = "";
  10074. for (const key in vars) {
  10075. style.setProperty(`--${key}`, vars[key]);
  10076. cssText += `--${key}: ${vars[key]};`;
  10077. }
  10078. style[CSS_VAR_TEXT] = cssText;
  10079. }
  10080. }
  10081. const displayRE = /(^|;)\s*display\s*:/;
  10082. function patchStyle(el, prev, next) {
  10083. const style = el.style;
  10084. const isCssString = isString(next);
  10085. let hasControlledDisplay = false;
  10086. if (next && !isCssString) {
  10087. if (prev) {
  10088. if (!isString(prev)) {
  10089. for (const key in prev) {
  10090. if (next[key] == null) {
  10091. setStyle(style, key, "");
  10092. }
  10093. }
  10094. } else {
  10095. for (const prevStyle of prev.split(";")) {
  10096. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  10097. if (next[key] == null) {
  10098. setStyle(style, key, "");
  10099. }
  10100. }
  10101. }
  10102. }
  10103. for (const key in next) {
  10104. if (key === "display") {
  10105. hasControlledDisplay = true;
  10106. }
  10107. setStyle(style, key, next[key]);
  10108. }
  10109. } else {
  10110. if (isCssString) {
  10111. if (prev !== next) {
  10112. const cssVarText = style[CSS_VAR_TEXT];
  10113. if (cssVarText) {
  10114. next += ";" + cssVarText;
  10115. }
  10116. style.cssText = next;
  10117. hasControlledDisplay = displayRE.test(next);
  10118. }
  10119. } else if (prev) {
  10120. el.removeAttribute("style");
  10121. }
  10122. }
  10123. if (vShowOriginalDisplay in el) {
  10124. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  10125. if (el[vShowHidden]) {
  10126. style.display = "none";
  10127. }
  10128. }
  10129. }
  10130. const semicolonRE = /[^\\];\s*$/;
  10131. const importantRE = /\s*!important$/;
  10132. function setStyle(style, name, val) {
  10133. if (isArray(val)) {
  10134. val.forEach((v) => setStyle(style, name, v));
  10135. } else {
  10136. if (val == null) val = "";
  10137. {
  10138. if (semicolonRE.test(val)) {
  10139. warn(
  10140. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  10141. );
  10142. }
  10143. }
  10144. if (name.startsWith("--")) {
  10145. style.setProperty(name, val);
  10146. } else {
  10147. const prefixed = autoPrefix(style, name);
  10148. if (importantRE.test(val)) {
  10149. style.setProperty(
  10150. hyphenate(prefixed),
  10151. val.replace(importantRE, ""),
  10152. "important"
  10153. );
  10154. } else {
  10155. style[prefixed] = val;
  10156. }
  10157. }
  10158. }
  10159. }
  10160. const prefixes = ["Webkit", "Moz", "ms"];
  10161. const prefixCache = {};
  10162. function autoPrefix(style, rawName) {
  10163. const cached = prefixCache[rawName];
  10164. if (cached) {
  10165. return cached;
  10166. }
  10167. let name = camelize(rawName);
  10168. if (name !== "filter" && name in style) {
  10169. return prefixCache[rawName] = name;
  10170. }
  10171. name = capitalize(name);
  10172. for (let i = 0; i < prefixes.length; i++) {
  10173. const prefixed = prefixes[i] + name;
  10174. if (prefixed in style) {
  10175. return prefixCache[rawName] = prefixed;
  10176. }
  10177. }
  10178. return rawName;
  10179. }
  10180. const xlinkNS = "http://www.w3.org/1999/xlink";
  10181. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  10182. if (isSVG && key.startsWith("xlink:")) {
  10183. if (value == null) {
  10184. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  10185. } else {
  10186. el.setAttributeNS(xlinkNS, key, value);
  10187. }
  10188. } else {
  10189. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  10190. el.removeAttribute(key);
  10191. } else {
  10192. el.setAttribute(
  10193. key,
  10194. isBoolean ? "" : isSymbol(value) ? String(value) : value
  10195. );
  10196. }
  10197. }
  10198. }
  10199. function patchDOMProp(el, key, value, parentComponent) {
  10200. if (key === "innerHTML" || key === "textContent") {
  10201. if (value == null) return;
  10202. el[key] = value;
  10203. return;
  10204. }
  10205. const tag = el.tagName;
  10206. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  10207. !tag.includes("-")) {
  10208. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  10209. const newValue = value == null ? "" : String(value);
  10210. if (oldValue !== newValue || !("_value" in el)) {
  10211. el.value = newValue;
  10212. }
  10213. if (value == null) {
  10214. el.removeAttribute(key);
  10215. }
  10216. el._value = value;
  10217. return;
  10218. }
  10219. let needRemove = false;
  10220. if (value === "" || value == null) {
  10221. const type = typeof el[key];
  10222. if (type === "boolean") {
  10223. value = includeBooleanAttr(value);
  10224. } else if (value == null && type === "string") {
  10225. value = "";
  10226. needRemove = true;
  10227. } else if (type === "number") {
  10228. value = 0;
  10229. needRemove = true;
  10230. }
  10231. }
  10232. try {
  10233. el[key] = value;
  10234. } catch (e) {
  10235. if (!needRemove) {
  10236. warn(
  10237. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  10238. e
  10239. );
  10240. }
  10241. }
  10242. needRemove && el.removeAttribute(key);
  10243. }
  10244. function addEventListener(el, event, handler, options) {
  10245. el.addEventListener(event, handler, options);
  10246. }
  10247. function removeEventListener(el, event, handler, options) {
  10248. el.removeEventListener(event, handler, options);
  10249. }
  10250. const veiKey = Symbol("_vei");
  10251. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  10252. const invokers = el[veiKey] || (el[veiKey] = {});
  10253. const existingInvoker = invokers[rawName];
  10254. if (nextValue && existingInvoker) {
  10255. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  10256. } else {
  10257. const [name, options] = parseName(rawName);
  10258. if (nextValue) {
  10259. const invoker = invokers[rawName] = createInvoker(
  10260. sanitizeEventValue(nextValue, rawName) ,
  10261. instance
  10262. );
  10263. addEventListener(el, name, invoker, options);
  10264. } else if (existingInvoker) {
  10265. removeEventListener(el, name, existingInvoker, options);
  10266. invokers[rawName] = void 0;
  10267. }
  10268. }
  10269. }
  10270. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  10271. function parseName(name) {
  10272. let options;
  10273. if (optionsModifierRE.test(name)) {
  10274. options = {};
  10275. let m;
  10276. while (m = name.match(optionsModifierRE)) {
  10277. name = name.slice(0, name.length - m[0].length);
  10278. options[m[0].toLowerCase()] = true;
  10279. }
  10280. }
  10281. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  10282. return [event, options];
  10283. }
  10284. let cachedNow = 0;
  10285. const p = /* @__PURE__ */ Promise.resolve();
  10286. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  10287. function createInvoker(initialValue, instance) {
  10288. const invoker = (e) => {
  10289. if (!e._vts) {
  10290. e._vts = Date.now();
  10291. } else if (e._vts <= invoker.attached) {
  10292. return;
  10293. }
  10294. callWithAsyncErrorHandling(
  10295. patchStopImmediatePropagation(e, invoker.value),
  10296. instance,
  10297. 5,
  10298. [e]
  10299. );
  10300. };
  10301. invoker.value = initialValue;
  10302. invoker.attached = getNow();
  10303. return invoker;
  10304. }
  10305. function sanitizeEventValue(value, propName) {
  10306. if (isFunction(value) || isArray(value)) {
  10307. return value;
  10308. }
  10309. warn(
  10310. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  10311. Expected function or array of functions, received type ${typeof value}.`
  10312. );
  10313. return NOOP;
  10314. }
  10315. function patchStopImmediatePropagation(e, value) {
  10316. if (isArray(value)) {
  10317. const originalStop = e.stopImmediatePropagation;
  10318. e.stopImmediatePropagation = () => {
  10319. originalStop.call(e);
  10320. e._stopped = true;
  10321. };
  10322. return value.map(
  10323. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  10324. );
  10325. } else {
  10326. return value;
  10327. }
  10328. }
  10329. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  10330. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  10331. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  10332. const isSVG = namespace === "svg";
  10333. if (key === "class") {
  10334. patchClass(el, nextValue, isSVG);
  10335. } else if (key === "style") {
  10336. patchStyle(el, prevValue, nextValue);
  10337. } else if (isOn(key)) {
  10338. if (!isModelListener(key)) {
  10339. patchEvent(el, key, prevValue, nextValue, parentComponent);
  10340. }
  10341. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  10342. patchDOMProp(el, key, nextValue);
  10343. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  10344. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  10345. }
  10346. } else {
  10347. if (key === "true-value") {
  10348. el._trueValue = nextValue;
  10349. } else if (key === "false-value") {
  10350. el._falseValue = nextValue;
  10351. }
  10352. patchAttr(el, key, nextValue, isSVG);
  10353. }
  10354. };
  10355. function shouldSetAsProp(el, key, value, isSVG) {
  10356. if (isSVG) {
  10357. if (key === "innerHTML" || key === "textContent") {
  10358. return true;
  10359. }
  10360. if (key in el && isNativeOn(key) && isFunction(value)) {
  10361. return true;
  10362. }
  10363. return false;
  10364. }
  10365. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  10366. return false;
  10367. }
  10368. if (key === "form") {
  10369. return false;
  10370. }
  10371. if (key === "list" && el.tagName === "INPUT") {
  10372. return false;
  10373. }
  10374. if (key === "type" && el.tagName === "TEXTAREA") {
  10375. return false;
  10376. }
  10377. if (key === "width" || key === "height") {
  10378. const tag = el.tagName;
  10379. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  10380. return false;
  10381. }
  10382. }
  10383. if (isNativeOn(key) && isString(value)) {
  10384. return false;
  10385. }
  10386. return key in el;
  10387. }
  10388. /*! #__NO_SIDE_EFFECTS__ */
  10389. // @__NO_SIDE_EFFECTS__
  10390. function defineCustomElement(options, extraOptions, hydrate2) {
  10391. const Comp = defineComponent(options, extraOptions);
  10392. class VueCustomElement extends VueElement {
  10393. constructor(initialProps) {
  10394. super(Comp, initialProps, hydrate2);
  10395. }
  10396. }
  10397. VueCustomElement.def = Comp;
  10398. return VueCustomElement;
  10399. }
  10400. /*! #__NO_SIDE_EFFECTS__ */
  10401. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  10402. return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
  10403. };
  10404. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  10405. };
  10406. class VueElement extends BaseClass {
  10407. constructor(_def, _props = {}, hydrate2) {
  10408. super();
  10409. this._def = _def;
  10410. this._props = _props;
  10411. /**
  10412. * @internal
  10413. */
  10414. this._instance = null;
  10415. this._connected = false;
  10416. this._resolved = false;
  10417. this._numberProps = null;
  10418. this._ob = null;
  10419. if (this.shadowRoot && hydrate2) {
  10420. hydrate2(this._createVNode(), this.shadowRoot);
  10421. } else {
  10422. if (this.shadowRoot) {
  10423. warn(
  10424. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  10425. );
  10426. }
  10427. this.attachShadow({ mode: "open" });
  10428. if (!this._def.__asyncLoader) {
  10429. this._resolveProps(this._def);
  10430. }
  10431. }
  10432. }
  10433. connectedCallback() {
  10434. this._connected = true;
  10435. if (!this._instance) {
  10436. if (this._resolved) {
  10437. this._update();
  10438. } else {
  10439. this._resolveDef();
  10440. }
  10441. }
  10442. }
  10443. disconnectedCallback() {
  10444. this._connected = false;
  10445. nextTick(() => {
  10446. if (!this._connected) {
  10447. if (this._ob) {
  10448. this._ob.disconnect();
  10449. this._ob = null;
  10450. }
  10451. render(null, this.shadowRoot);
  10452. this._instance = null;
  10453. }
  10454. });
  10455. }
  10456. /**
  10457. * resolve inner component definition (handle possible async component)
  10458. */
  10459. _resolveDef() {
  10460. this._resolved = true;
  10461. for (let i = 0; i < this.attributes.length; i++) {
  10462. this._setAttr(this.attributes[i].name);
  10463. }
  10464. this._ob = new MutationObserver((mutations) => {
  10465. for (const m of mutations) {
  10466. this._setAttr(m.attributeName);
  10467. }
  10468. });
  10469. this._ob.observe(this, { attributes: true });
  10470. const resolve = (def, isAsync = false) => {
  10471. const { props, styles } = def;
  10472. let numberProps;
  10473. if (props && !isArray(props)) {
  10474. for (const key in props) {
  10475. const opt = props[key];
  10476. if (opt === Number || opt && opt.type === Number) {
  10477. if (key in this._props) {
  10478. this._props[key] = toNumber(this._props[key]);
  10479. }
  10480. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  10481. }
  10482. }
  10483. }
  10484. this._numberProps = numberProps;
  10485. if (isAsync) {
  10486. this._resolveProps(def);
  10487. }
  10488. this._applyStyles(styles);
  10489. this._update();
  10490. };
  10491. const asyncDef = this._def.__asyncLoader;
  10492. if (asyncDef) {
  10493. asyncDef().then((def) => resolve(def, true));
  10494. } else {
  10495. resolve(this._def);
  10496. }
  10497. }
  10498. _resolveProps(def) {
  10499. const { props } = def;
  10500. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  10501. for (const key of Object.keys(this)) {
  10502. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  10503. this._setProp(key, this[key], true, false);
  10504. }
  10505. }
  10506. for (const key of declaredPropKeys.map(camelize)) {
  10507. Object.defineProperty(this, key, {
  10508. get() {
  10509. return this._getProp(key);
  10510. },
  10511. set(val) {
  10512. this._setProp(key, val);
  10513. }
  10514. });
  10515. }
  10516. }
  10517. _setAttr(key) {
  10518. let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
  10519. const camelKey = camelize(key);
  10520. if (this._numberProps && this._numberProps[camelKey]) {
  10521. value = toNumber(value);
  10522. }
  10523. this._setProp(camelKey, value, false);
  10524. }
  10525. /**
  10526. * @internal
  10527. */
  10528. _getProp(key) {
  10529. return this._props[key];
  10530. }
  10531. /**
  10532. * @internal
  10533. */
  10534. _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
  10535. if (val !== this._props[key]) {
  10536. this._props[key] = val;
  10537. if (shouldUpdate && this._instance) {
  10538. this._update();
  10539. }
  10540. if (shouldReflect) {
  10541. if (val === true) {
  10542. this.setAttribute(hyphenate(key), "");
  10543. } else if (typeof val === "string" || typeof val === "number") {
  10544. this.setAttribute(hyphenate(key), val + "");
  10545. } else if (!val) {
  10546. this.removeAttribute(hyphenate(key));
  10547. }
  10548. }
  10549. }
  10550. }
  10551. _update() {
  10552. render(this._createVNode(), this.shadowRoot);
  10553. }
  10554. _createVNode() {
  10555. const vnode = createVNode(this._def, extend({}, this._props));
  10556. if (!this._instance) {
  10557. vnode.ce = (instance) => {
  10558. this._instance = instance;
  10559. instance.isCE = true;
  10560. {
  10561. instance.ceReload = (newStyles) => {
  10562. if (this._styles) {
  10563. this._styles.forEach((s) => this.shadowRoot.removeChild(s));
  10564. this._styles.length = 0;
  10565. }
  10566. this._applyStyles(newStyles);
  10567. this._instance = null;
  10568. this._update();
  10569. };
  10570. }
  10571. const dispatch = (event, args) => {
  10572. this.dispatchEvent(
  10573. new CustomEvent(event, {
  10574. detail: args
  10575. })
  10576. );
  10577. };
  10578. instance.emit = (event, ...args) => {
  10579. dispatch(event, args);
  10580. if (hyphenate(event) !== event) {
  10581. dispatch(hyphenate(event), args);
  10582. }
  10583. };
  10584. let parent = this;
  10585. while (parent = parent && (parent.parentNode || parent.host)) {
  10586. if (parent instanceof VueElement) {
  10587. instance.parent = parent._instance;
  10588. instance.provides = parent._instance.provides;
  10589. break;
  10590. }
  10591. }
  10592. };
  10593. }
  10594. return vnode;
  10595. }
  10596. _applyStyles(styles) {
  10597. if (styles) {
  10598. styles.forEach((css) => {
  10599. const s = document.createElement("style");
  10600. s.textContent = css;
  10601. this.shadowRoot.appendChild(s);
  10602. {
  10603. (this._styles || (this._styles = [])).push(s);
  10604. }
  10605. });
  10606. }
  10607. }
  10608. }
  10609. function useCssModule(name = "$style") {
  10610. {
  10611. {
  10612. warn(`useCssModule() is not supported in the global build.`);
  10613. }
  10614. return EMPTY_OBJ;
  10615. }
  10616. }
  10617. const positionMap = /* @__PURE__ */ new WeakMap();
  10618. const newPositionMap = /* @__PURE__ */ new WeakMap();
  10619. const moveCbKey = Symbol("_moveCb");
  10620. const enterCbKey = Symbol("_enterCb");
  10621. const TransitionGroupImpl = {
  10622. name: "TransitionGroup",
  10623. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  10624. tag: String,
  10625. moveClass: String
  10626. }),
  10627. setup(props, { slots }) {
  10628. const instance = getCurrentInstance();
  10629. const state = useTransitionState();
  10630. let prevChildren;
  10631. let children;
  10632. onUpdated(() => {
  10633. if (!prevChildren.length) {
  10634. return;
  10635. }
  10636. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  10637. if (!hasCSSTransform(
  10638. prevChildren[0].el,
  10639. instance.vnode.el,
  10640. moveClass
  10641. )) {
  10642. return;
  10643. }
  10644. prevChildren.forEach(callPendingCbs);
  10645. prevChildren.forEach(recordPosition);
  10646. const movedChildren = prevChildren.filter(applyTranslation);
  10647. forceReflow();
  10648. movedChildren.forEach((c) => {
  10649. const el = c.el;
  10650. const style = el.style;
  10651. addTransitionClass(el, moveClass);
  10652. style.transform = style.webkitTransform = style.transitionDuration = "";
  10653. const cb = el[moveCbKey] = (e) => {
  10654. if (e && e.target !== el) {
  10655. return;
  10656. }
  10657. if (!e || /transform$/.test(e.propertyName)) {
  10658. el.removeEventListener("transitionend", cb);
  10659. el[moveCbKey] = null;
  10660. removeTransitionClass(el, moveClass);
  10661. }
  10662. };
  10663. el.addEventListener("transitionend", cb);
  10664. });
  10665. });
  10666. return () => {
  10667. const rawProps = toRaw(props);
  10668. const cssTransitionProps = resolveTransitionProps(rawProps);
  10669. let tag = rawProps.tag || Fragment;
  10670. prevChildren = [];
  10671. if (children) {
  10672. for (let i = 0; i < children.length; i++) {
  10673. const child = children[i];
  10674. if (child.el && child.el instanceof Element) {
  10675. prevChildren.push(child);
  10676. setTransitionHooks(
  10677. child,
  10678. resolveTransitionHooks(
  10679. child,
  10680. cssTransitionProps,
  10681. state,
  10682. instance
  10683. )
  10684. );
  10685. positionMap.set(
  10686. child,
  10687. child.el.getBoundingClientRect()
  10688. );
  10689. }
  10690. }
  10691. }
  10692. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  10693. for (let i = 0; i < children.length; i++) {
  10694. const child = children[i];
  10695. if (child.key != null) {
  10696. setTransitionHooks(
  10697. child,
  10698. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  10699. );
  10700. } else {
  10701. warn(`<TransitionGroup> children must be keyed.`);
  10702. }
  10703. }
  10704. return createVNode(tag, null, children);
  10705. };
  10706. }
  10707. };
  10708. const removeMode = (props) => delete props.mode;
  10709. /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
  10710. const TransitionGroup = TransitionGroupImpl;
  10711. function callPendingCbs(c) {
  10712. const el = c.el;
  10713. if (el[moveCbKey]) {
  10714. el[moveCbKey]();
  10715. }
  10716. if (el[enterCbKey]) {
  10717. el[enterCbKey]();
  10718. }
  10719. }
  10720. function recordPosition(c) {
  10721. newPositionMap.set(c, c.el.getBoundingClientRect());
  10722. }
  10723. function applyTranslation(c) {
  10724. const oldPos = positionMap.get(c);
  10725. const newPos = newPositionMap.get(c);
  10726. const dx = oldPos.left - newPos.left;
  10727. const dy = oldPos.top - newPos.top;
  10728. if (dx || dy) {
  10729. const s = c.el.style;
  10730. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  10731. s.transitionDuration = "0s";
  10732. return c;
  10733. }
  10734. }
  10735. function hasCSSTransform(el, root, moveClass) {
  10736. const clone = el.cloneNode();
  10737. const _vtc = el[vtcKey];
  10738. if (_vtc) {
  10739. _vtc.forEach((cls) => {
  10740. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  10741. });
  10742. }
  10743. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  10744. clone.style.display = "none";
  10745. const container = root.nodeType === 1 ? root : root.parentNode;
  10746. container.appendChild(clone);
  10747. const { hasTransform } = getTransitionInfo(clone);
  10748. container.removeChild(clone);
  10749. return hasTransform;
  10750. }
  10751. const getModelAssigner = (vnode) => {
  10752. const fn = vnode.props["onUpdate:modelValue"] || false;
  10753. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  10754. };
  10755. function onCompositionStart(e) {
  10756. e.target.composing = true;
  10757. }
  10758. function onCompositionEnd(e) {
  10759. const target = e.target;
  10760. if (target.composing) {
  10761. target.composing = false;
  10762. target.dispatchEvent(new Event("input"));
  10763. }
  10764. }
  10765. const assignKey = Symbol("_assign");
  10766. const vModelText = {
  10767. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  10768. el[assignKey] = getModelAssigner(vnode);
  10769. const castToNumber = number || vnode.props && vnode.props.type === "number";
  10770. addEventListener(el, lazy ? "change" : "input", (e) => {
  10771. if (e.target.composing) return;
  10772. let domValue = el.value;
  10773. if (trim) {
  10774. domValue = domValue.trim();
  10775. }
  10776. if (castToNumber) {
  10777. domValue = looseToNumber(domValue);
  10778. }
  10779. el[assignKey](domValue);
  10780. });
  10781. if (trim) {
  10782. addEventListener(el, "change", () => {
  10783. el.value = el.value.trim();
  10784. });
  10785. }
  10786. if (!lazy) {
  10787. addEventListener(el, "compositionstart", onCompositionStart);
  10788. addEventListener(el, "compositionend", onCompositionEnd);
  10789. addEventListener(el, "change", onCompositionEnd);
  10790. }
  10791. },
  10792. // set value on mounted so it's after min/max for type="range"
  10793. mounted(el, { value }) {
  10794. el.value = value == null ? "" : value;
  10795. },
  10796. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  10797. el[assignKey] = getModelAssigner(vnode);
  10798. if (el.composing) return;
  10799. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  10800. const newValue = value == null ? "" : value;
  10801. if (elValue === newValue) {
  10802. return;
  10803. }
  10804. if (document.activeElement === el && el.type !== "range") {
  10805. if (lazy && value === oldValue) {
  10806. return;
  10807. }
  10808. if (trim && el.value.trim() === newValue) {
  10809. return;
  10810. }
  10811. }
  10812. el.value = newValue;
  10813. }
  10814. };
  10815. const vModelCheckbox = {
  10816. // #4096 array checkboxes need to be deep traversed
  10817. deep: true,
  10818. created(el, _, vnode) {
  10819. el[assignKey] = getModelAssigner(vnode);
  10820. addEventListener(el, "change", () => {
  10821. const modelValue = el._modelValue;
  10822. const elementValue = getValue(el);
  10823. const checked = el.checked;
  10824. const assign = el[assignKey];
  10825. if (isArray(modelValue)) {
  10826. const index = looseIndexOf(modelValue, elementValue);
  10827. const found = index !== -1;
  10828. if (checked && !found) {
  10829. assign(modelValue.concat(elementValue));
  10830. } else if (!checked && found) {
  10831. const filtered = [...modelValue];
  10832. filtered.splice(index, 1);
  10833. assign(filtered);
  10834. }
  10835. } else if (isSet(modelValue)) {
  10836. const cloned = new Set(modelValue);
  10837. if (checked) {
  10838. cloned.add(elementValue);
  10839. } else {
  10840. cloned.delete(elementValue);
  10841. }
  10842. assign(cloned);
  10843. } else {
  10844. assign(getCheckboxValue(el, checked));
  10845. }
  10846. });
  10847. },
  10848. // set initial checked on mount to wait for true-value/false-value
  10849. mounted: setChecked,
  10850. beforeUpdate(el, binding, vnode) {
  10851. el[assignKey] = getModelAssigner(vnode);
  10852. setChecked(el, binding, vnode);
  10853. }
  10854. };
  10855. function setChecked(el, { value, oldValue }, vnode) {
  10856. el._modelValue = value;
  10857. if (isArray(value)) {
  10858. el.checked = looseIndexOf(value, vnode.props.value) > -1;
  10859. } else if (isSet(value)) {
  10860. el.checked = value.has(vnode.props.value);
  10861. } else if (value !== oldValue) {
  10862. el.checked = looseEqual(value, getCheckboxValue(el, true));
  10863. }
  10864. }
  10865. const vModelRadio = {
  10866. created(el, { value }, vnode) {
  10867. el.checked = looseEqual(value, vnode.props.value);
  10868. el[assignKey] = getModelAssigner(vnode);
  10869. addEventListener(el, "change", () => {
  10870. el[assignKey](getValue(el));
  10871. });
  10872. },
  10873. beforeUpdate(el, { value, oldValue }, vnode) {
  10874. el[assignKey] = getModelAssigner(vnode);
  10875. if (value !== oldValue) {
  10876. el.checked = looseEqual(value, vnode.props.value);
  10877. }
  10878. }
  10879. };
  10880. const vModelSelect = {
  10881. // <select multiple> value need to be deep traversed
  10882. deep: true,
  10883. created(el, { value, modifiers: { number } }, vnode) {
  10884. const isSetModel = isSet(value);
  10885. addEventListener(el, "change", () => {
  10886. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  10887. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  10888. );
  10889. el[assignKey](
  10890. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  10891. );
  10892. el._assigning = true;
  10893. nextTick(() => {
  10894. el._assigning = false;
  10895. });
  10896. });
  10897. el[assignKey] = getModelAssigner(vnode);
  10898. },
  10899. // set value in mounted & updated because <select> relies on its children
  10900. // <option>s.
  10901. mounted(el, { value, modifiers: { number } }) {
  10902. setSelected(el, value);
  10903. },
  10904. beforeUpdate(el, _binding, vnode) {
  10905. el[assignKey] = getModelAssigner(vnode);
  10906. },
  10907. updated(el, { value, modifiers: { number } }) {
  10908. if (!el._assigning) {
  10909. setSelected(el, value);
  10910. }
  10911. }
  10912. };
  10913. function setSelected(el, value, number) {
  10914. const isMultiple = el.multiple;
  10915. const isArrayValue = isArray(value);
  10916. if (isMultiple && !isArrayValue && !isSet(value)) {
  10917. warn(
  10918. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  10919. );
  10920. return;
  10921. }
  10922. for (let i = 0, l = el.options.length; i < l; i++) {
  10923. const option = el.options[i];
  10924. const optionValue = getValue(option);
  10925. if (isMultiple) {
  10926. if (isArrayValue) {
  10927. const optionType = typeof optionValue;
  10928. if (optionType === "string" || optionType === "number") {
  10929. option.selected = value.some((v) => String(v) === String(optionValue));
  10930. } else {
  10931. option.selected = looseIndexOf(value, optionValue) > -1;
  10932. }
  10933. } else {
  10934. option.selected = value.has(optionValue);
  10935. }
  10936. } else if (looseEqual(getValue(option), value)) {
  10937. if (el.selectedIndex !== i) el.selectedIndex = i;
  10938. return;
  10939. }
  10940. }
  10941. if (!isMultiple && el.selectedIndex !== -1) {
  10942. el.selectedIndex = -1;
  10943. }
  10944. }
  10945. function getValue(el) {
  10946. return "_value" in el ? el._value : el.value;
  10947. }
  10948. function getCheckboxValue(el, checked) {
  10949. const key = checked ? "_trueValue" : "_falseValue";
  10950. return key in el ? el[key] : checked;
  10951. }
  10952. const vModelDynamic = {
  10953. created(el, binding, vnode) {
  10954. callModelHook(el, binding, vnode, null, "created");
  10955. },
  10956. mounted(el, binding, vnode) {
  10957. callModelHook(el, binding, vnode, null, "mounted");
  10958. },
  10959. beforeUpdate(el, binding, vnode, prevVNode) {
  10960. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  10961. },
  10962. updated(el, binding, vnode, prevVNode) {
  10963. callModelHook(el, binding, vnode, prevVNode, "updated");
  10964. }
  10965. };
  10966. function resolveDynamicModel(tagName, type) {
  10967. switch (tagName) {
  10968. case "SELECT":
  10969. return vModelSelect;
  10970. case "TEXTAREA":
  10971. return vModelText;
  10972. default:
  10973. switch (type) {
  10974. case "checkbox":
  10975. return vModelCheckbox;
  10976. case "radio":
  10977. return vModelRadio;
  10978. default:
  10979. return vModelText;
  10980. }
  10981. }
  10982. }
  10983. function callModelHook(el, binding, vnode, prevVNode, hook) {
  10984. const modelToUse = resolveDynamicModel(
  10985. el.tagName,
  10986. vnode.props && vnode.props.type
  10987. );
  10988. const fn = modelToUse[hook];
  10989. fn && fn(el, binding, vnode, prevVNode);
  10990. }
  10991. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  10992. const modifierGuards = {
  10993. stop: (e) => e.stopPropagation(),
  10994. prevent: (e) => e.preventDefault(),
  10995. self: (e) => e.target !== e.currentTarget,
  10996. ctrl: (e) => !e.ctrlKey,
  10997. shift: (e) => !e.shiftKey,
  10998. alt: (e) => !e.altKey,
  10999. meta: (e) => !e.metaKey,
  11000. left: (e) => "button" in e && e.button !== 0,
  11001. middle: (e) => "button" in e && e.button !== 1,
  11002. right: (e) => "button" in e && e.button !== 2,
  11003. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  11004. };
  11005. const withModifiers = (fn, modifiers) => {
  11006. const cache = fn._withMods || (fn._withMods = {});
  11007. const cacheKey = modifiers.join(".");
  11008. return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
  11009. for (let i = 0; i < modifiers.length; i++) {
  11010. const guard = modifierGuards[modifiers[i]];
  11011. if (guard && guard(event, modifiers)) return;
  11012. }
  11013. return fn(event, ...args);
  11014. });
  11015. };
  11016. const keyNames = {
  11017. esc: "escape",
  11018. space: " ",
  11019. up: "arrow-up",
  11020. left: "arrow-left",
  11021. right: "arrow-right",
  11022. down: "arrow-down",
  11023. delete: "backspace"
  11024. };
  11025. const withKeys = (fn, modifiers) => {
  11026. const cache = fn._withKeys || (fn._withKeys = {});
  11027. const cacheKey = modifiers.join(".");
  11028. return cache[cacheKey] || (cache[cacheKey] = (event) => {
  11029. if (!("key" in event)) {
  11030. return;
  11031. }
  11032. const eventKey = hyphenate(event.key);
  11033. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  11034. return fn(event);
  11035. }
  11036. });
  11037. };
  11038. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  11039. let renderer;
  11040. let enabledHydration = false;
  11041. function ensureRenderer() {
  11042. return renderer || (renderer = createRenderer(rendererOptions));
  11043. }
  11044. function ensureHydrationRenderer() {
  11045. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  11046. enabledHydration = true;
  11047. return renderer;
  11048. }
  11049. const render = (...args) => {
  11050. ensureRenderer().render(...args);
  11051. };
  11052. const hydrate = (...args) => {
  11053. ensureHydrationRenderer().hydrate(...args);
  11054. };
  11055. const createApp = (...args) => {
  11056. const app = ensureRenderer().createApp(...args);
  11057. {
  11058. injectNativeTagCheck(app);
  11059. injectCompilerOptionsCheck(app);
  11060. }
  11061. const { mount } = app;
  11062. app.mount = (containerOrSelector) => {
  11063. const container = normalizeContainer(containerOrSelector);
  11064. if (!container) return;
  11065. const component = app._component;
  11066. if (!isFunction(component) && !component.render && !component.template) {
  11067. component.template = container.innerHTML;
  11068. }
  11069. container.innerHTML = "";
  11070. const proxy = mount(container, false, resolveRootNamespace(container));
  11071. if (container instanceof Element) {
  11072. container.removeAttribute("v-cloak");
  11073. container.setAttribute("data-v-app", "");
  11074. }
  11075. return proxy;
  11076. };
  11077. return app;
  11078. };
  11079. const createSSRApp = (...args) => {
  11080. const app = ensureHydrationRenderer().createApp(...args);
  11081. {
  11082. injectNativeTagCheck(app);
  11083. injectCompilerOptionsCheck(app);
  11084. }
  11085. const { mount } = app;
  11086. app.mount = (containerOrSelector) => {
  11087. const container = normalizeContainer(containerOrSelector);
  11088. if (container) {
  11089. return mount(container, true, resolveRootNamespace(container));
  11090. }
  11091. };
  11092. return app;
  11093. };
  11094. function resolveRootNamespace(container) {
  11095. if (container instanceof SVGElement) {
  11096. return "svg";
  11097. }
  11098. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  11099. return "mathml";
  11100. }
  11101. }
  11102. function injectNativeTagCheck(app) {
  11103. Object.defineProperty(app.config, "isNativeTag", {
  11104. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  11105. writable: false
  11106. });
  11107. }
  11108. function injectCompilerOptionsCheck(app) {
  11109. if (isRuntimeOnly()) {
  11110. const isCustomElement = app.config.isCustomElement;
  11111. Object.defineProperty(app.config, "isCustomElement", {
  11112. get() {
  11113. return isCustomElement;
  11114. },
  11115. set() {
  11116. warn(
  11117. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  11118. );
  11119. }
  11120. });
  11121. const compilerOptions = app.config.compilerOptions;
  11122. 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.
  11123. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  11124. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  11125. - 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`;
  11126. Object.defineProperty(app.config, "compilerOptions", {
  11127. get() {
  11128. warn(msg);
  11129. return compilerOptions;
  11130. },
  11131. set() {
  11132. warn(msg);
  11133. }
  11134. });
  11135. }
  11136. }
  11137. function normalizeContainer(container) {
  11138. if (isString(container)) {
  11139. const res = document.querySelector(container);
  11140. if (!res) {
  11141. warn(
  11142. `Failed to mount app: mount target selector "${container}" returned null.`
  11143. );
  11144. }
  11145. return res;
  11146. }
  11147. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  11148. warn(
  11149. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  11150. );
  11151. }
  11152. return container;
  11153. }
  11154. const initDirectivesForSSR = NOOP;
  11155. function initDev() {
  11156. {
  11157. {
  11158. console.info(
  11159. `You are running a development build of Vue.
  11160. Make sure to use the production build (*.prod.js) when deploying for production.`
  11161. );
  11162. }
  11163. initCustomFormatter();
  11164. }
  11165. }
  11166. const FRAGMENT = Symbol(`Fragment` );
  11167. const TELEPORT = Symbol(`Teleport` );
  11168. const SUSPENSE = Symbol(`Suspense` );
  11169. const KEEP_ALIVE = Symbol(`KeepAlive` );
  11170. const BASE_TRANSITION = Symbol(`BaseTransition` );
  11171. const OPEN_BLOCK = Symbol(`openBlock` );
  11172. const CREATE_BLOCK = Symbol(`createBlock` );
  11173. const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
  11174. const CREATE_VNODE = Symbol(`createVNode` );
  11175. const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
  11176. const CREATE_COMMENT = Symbol(`createCommentVNode` );
  11177. const CREATE_TEXT = Symbol(`createTextVNode` );
  11178. const CREATE_STATIC = Symbol(`createStaticVNode` );
  11179. const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
  11180. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  11181. `resolveDynamicComponent`
  11182. );
  11183. const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
  11184. const RESOLVE_FILTER = Symbol(`resolveFilter` );
  11185. const WITH_DIRECTIVES = Symbol(`withDirectives` );
  11186. const RENDER_LIST = Symbol(`renderList` );
  11187. const RENDER_SLOT = Symbol(`renderSlot` );
  11188. const CREATE_SLOTS = Symbol(`createSlots` );
  11189. const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
  11190. const MERGE_PROPS = Symbol(`mergeProps` );
  11191. const NORMALIZE_CLASS = Symbol(`normalizeClass` );
  11192. const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
  11193. const NORMALIZE_PROPS = Symbol(`normalizeProps` );
  11194. const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
  11195. const TO_HANDLERS = Symbol(`toHandlers` );
  11196. const CAMELIZE = Symbol(`camelize` );
  11197. const CAPITALIZE = Symbol(`capitalize` );
  11198. const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
  11199. const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
  11200. const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
  11201. const POP_SCOPE_ID = Symbol(`popScopeId` );
  11202. const WITH_CTX = Symbol(`withCtx` );
  11203. const UNREF = Symbol(`unref` );
  11204. const IS_REF = Symbol(`isRef` );
  11205. const WITH_MEMO = Symbol(`withMemo` );
  11206. const IS_MEMO_SAME = Symbol(`isMemoSame` );
  11207. const helperNameMap = {
  11208. [FRAGMENT]: `Fragment`,
  11209. [TELEPORT]: `Teleport`,
  11210. [SUSPENSE]: `Suspense`,
  11211. [KEEP_ALIVE]: `KeepAlive`,
  11212. [BASE_TRANSITION]: `BaseTransition`,
  11213. [OPEN_BLOCK]: `openBlock`,
  11214. [CREATE_BLOCK]: `createBlock`,
  11215. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  11216. [CREATE_VNODE]: `createVNode`,
  11217. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  11218. [CREATE_COMMENT]: `createCommentVNode`,
  11219. [CREATE_TEXT]: `createTextVNode`,
  11220. [CREATE_STATIC]: `createStaticVNode`,
  11221. [RESOLVE_COMPONENT]: `resolveComponent`,
  11222. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  11223. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  11224. [RESOLVE_FILTER]: `resolveFilter`,
  11225. [WITH_DIRECTIVES]: `withDirectives`,
  11226. [RENDER_LIST]: `renderList`,
  11227. [RENDER_SLOT]: `renderSlot`,
  11228. [CREATE_SLOTS]: `createSlots`,
  11229. [TO_DISPLAY_STRING]: `toDisplayString`,
  11230. [MERGE_PROPS]: `mergeProps`,
  11231. [NORMALIZE_CLASS]: `normalizeClass`,
  11232. [NORMALIZE_STYLE]: `normalizeStyle`,
  11233. [NORMALIZE_PROPS]: `normalizeProps`,
  11234. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  11235. [TO_HANDLERS]: `toHandlers`,
  11236. [CAMELIZE]: `camelize`,
  11237. [CAPITALIZE]: `capitalize`,
  11238. [TO_HANDLER_KEY]: `toHandlerKey`,
  11239. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  11240. [PUSH_SCOPE_ID]: `pushScopeId`,
  11241. [POP_SCOPE_ID]: `popScopeId`,
  11242. [WITH_CTX]: `withCtx`,
  11243. [UNREF]: `unref`,
  11244. [IS_REF]: `isRef`,
  11245. [WITH_MEMO]: `withMemo`,
  11246. [IS_MEMO_SAME]: `isMemoSame`
  11247. };
  11248. function registerRuntimeHelpers(helpers) {
  11249. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  11250. helperNameMap[s] = helpers[s];
  11251. });
  11252. }
  11253. const locStub = {
  11254. start: { line: 1, column: 1, offset: 0 },
  11255. end: { line: 1, column: 1, offset: 0 },
  11256. source: ""
  11257. };
  11258. function createRoot(children, source = "") {
  11259. return {
  11260. type: 0,
  11261. source,
  11262. children,
  11263. helpers: /* @__PURE__ */ new Set(),
  11264. components: [],
  11265. directives: [],
  11266. hoists: [],
  11267. imports: [],
  11268. cached: 0,
  11269. temps: 0,
  11270. codegenNode: void 0,
  11271. loc: locStub
  11272. };
  11273. }
  11274. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  11275. if (context) {
  11276. if (isBlock) {
  11277. context.helper(OPEN_BLOCK);
  11278. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  11279. } else {
  11280. context.helper(getVNodeHelper(context.inSSR, isComponent));
  11281. }
  11282. if (directives) {
  11283. context.helper(WITH_DIRECTIVES);
  11284. }
  11285. }
  11286. return {
  11287. type: 13,
  11288. tag,
  11289. props,
  11290. children,
  11291. patchFlag,
  11292. dynamicProps,
  11293. directives,
  11294. isBlock,
  11295. disableTracking,
  11296. isComponent,
  11297. loc
  11298. };
  11299. }
  11300. function createArrayExpression(elements, loc = locStub) {
  11301. return {
  11302. type: 17,
  11303. loc,
  11304. elements
  11305. };
  11306. }
  11307. function createObjectExpression(properties, loc = locStub) {
  11308. return {
  11309. type: 15,
  11310. loc,
  11311. properties
  11312. };
  11313. }
  11314. function createObjectProperty(key, value) {
  11315. return {
  11316. type: 16,
  11317. loc: locStub,
  11318. key: isString(key) ? createSimpleExpression(key, true) : key,
  11319. value
  11320. };
  11321. }
  11322. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  11323. return {
  11324. type: 4,
  11325. loc,
  11326. content,
  11327. isStatic,
  11328. constType: isStatic ? 3 : constType
  11329. };
  11330. }
  11331. function createCompoundExpression(children, loc = locStub) {
  11332. return {
  11333. type: 8,
  11334. loc,
  11335. children
  11336. };
  11337. }
  11338. function createCallExpression(callee, args = [], loc = locStub) {
  11339. return {
  11340. type: 14,
  11341. loc,
  11342. callee,
  11343. arguments: args
  11344. };
  11345. }
  11346. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  11347. return {
  11348. type: 18,
  11349. params,
  11350. returns,
  11351. newline,
  11352. isSlot,
  11353. loc
  11354. };
  11355. }
  11356. function createConditionalExpression(test, consequent, alternate, newline = true) {
  11357. return {
  11358. type: 19,
  11359. test,
  11360. consequent,
  11361. alternate,
  11362. newline,
  11363. loc: locStub
  11364. };
  11365. }
  11366. function createCacheExpression(index, value, isVOnce = false) {
  11367. return {
  11368. type: 20,
  11369. index,
  11370. value,
  11371. isVOnce,
  11372. loc: locStub
  11373. };
  11374. }
  11375. function createBlockStatement(body) {
  11376. return {
  11377. type: 21,
  11378. body,
  11379. loc: locStub
  11380. };
  11381. }
  11382. function getVNodeHelper(ssr, isComponent) {
  11383. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  11384. }
  11385. function getVNodeBlockHelper(ssr, isComponent) {
  11386. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  11387. }
  11388. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  11389. if (!node.isBlock) {
  11390. node.isBlock = true;
  11391. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  11392. helper(OPEN_BLOCK);
  11393. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  11394. }
  11395. }
  11396. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  11397. const defaultDelimitersClose = new Uint8Array([125, 125]);
  11398. function isTagStartChar(c) {
  11399. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  11400. }
  11401. function isWhitespace(c) {
  11402. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  11403. }
  11404. function isEndOfTagSection(c) {
  11405. return c === 47 || c === 62 || isWhitespace(c);
  11406. }
  11407. function toCharCodes(str) {
  11408. const ret = new Uint8Array(str.length);
  11409. for (let i = 0; i < str.length; i++) {
  11410. ret[i] = str.charCodeAt(i);
  11411. }
  11412. return ret;
  11413. }
  11414. const Sequences = {
  11415. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  11416. // CDATA[
  11417. CdataEnd: new Uint8Array([93, 93, 62]),
  11418. // ]]>
  11419. CommentEnd: new Uint8Array([45, 45, 62]),
  11420. // `-->`
  11421. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  11422. // `<\/script`
  11423. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  11424. // `</style`
  11425. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  11426. // `</title`
  11427. TextareaEnd: new Uint8Array([
  11428. 60,
  11429. 47,
  11430. 116,
  11431. 101,
  11432. 120,
  11433. 116,
  11434. 97,
  11435. 114,
  11436. 101,
  11437. 97
  11438. ])
  11439. // `</textarea
  11440. };
  11441. class Tokenizer {
  11442. constructor(stack, cbs) {
  11443. this.stack = stack;
  11444. this.cbs = cbs;
  11445. /** The current state the tokenizer is in. */
  11446. this.state = 1;
  11447. /** The read buffer. */
  11448. this.buffer = "";
  11449. /** The beginning of the section that is currently being read. */
  11450. this.sectionStart = 0;
  11451. /** The index within the buffer that we are currently looking at. */
  11452. this.index = 0;
  11453. /** The start of the last entity. */
  11454. this.entityStart = 0;
  11455. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  11456. this.baseState = 1;
  11457. /** For special parsing behavior inside of script and style tags. */
  11458. this.inRCDATA = false;
  11459. /** For disabling RCDATA tags handling */
  11460. this.inXML = false;
  11461. /** For disabling interpolation parsing in v-pre */
  11462. this.inVPre = false;
  11463. /** Record newline positions for fast line / column calculation */
  11464. this.newlines = [];
  11465. this.mode = 0;
  11466. this.delimiterOpen = defaultDelimitersOpen;
  11467. this.delimiterClose = defaultDelimitersClose;
  11468. this.delimiterIndex = -1;
  11469. this.currentSequence = void 0;
  11470. this.sequenceIndex = 0;
  11471. }
  11472. get inSFCRoot() {
  11473. return this.mode === 2 && this.stack.length === 0;
  11474. }
  11475. reset() {
  11476. this.state = 1;
  11477. this.mode = 0;
  11478. this.buffer = "";
  11479. this.sectionStart = 0;
  11480. this.index = 0;
  11481. this.baseState = 1;
  11482. this.inRCDATA = false;
  11483. this.currentSequence = void 0;
  11484. this.newlines.length = 0;
  11485. this.delimiterOpen = defaultDelimitersOpen;
  11486. this.delimiterClose = defaultDelimitersClose;
  11487. }
  11488. /**
  11489. * Generate Position object with line / column information using recorded
  11490. * newline positions. We know the index is always going to be an already
  11491. * processed index, so all the newlines up to this index should have been
  11492. * recorded.
  11493. */
  11494. getPos(index) {
  11495. let line = 1;
  11496. let column = index + 1;
  11497. for (let i = this.newlines.length - 1; i >= 0; i--) {
  11498. const newlineIndex = this.newlines[i];
  11499. if (index > newlineIndex) {
  11500. line = i + 2;
  11501. column = index - newlineIndex;
  11502. break;
  11503. }
  11504. }
  11505. return {
  11506. column,
  11507. line,
  11508. offset: index
  11509. };
  11510. }
  11511. peek() {
  11512. return this.buffer.charCodeAt(this.index + 1);
  11513. }
  11514. stateText(c) {
  11515. if (c === 60) {
  11516. if (this.index > this.sectionStart) {
  11517. this.cbs.ontext(this.sectionStart, this.index);
  11518. }
  11519. this.state = 5;
  11520. this.sectionStart = this.index;
  11521. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  11522. this.state = 2;
  11523. this.delimiterIndex = 0;
  11524. this.stateInterpolationOpen(c);
  11525. }
  11526. }
  11527. stateInterpolationOpen(c) {
  11528. if (c === this.delimiterOpen[this.delimiterIndex]) {
  11529. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  11530. const start = this.index + 1 - this.delimiterOpen.length;
  11531. if (start > this.sectionStart) {
  11532. this.cbs.ontext(this.sectionStart, start);
  11533. }
  11534. this.state = 3;
  11535. this.sectionStart = start;
  11536. } else {
  11537. this.delimiterIndex++;
  11538. }
  11539. } else if (this.inRCDATA) {
  11540. this.state = 32;
  11541. this.stateInRCDATA(c);
  11542. } else {
  11543. this.state = 1;
  11544. this.stateText(c);
  11545. }
  11546. }
  11547. stateInterpolation(c) {
  11548. if (c === this.delimiterClose[0]) {
  11549. this.state = 4;
  11550. this.delimiterIndex = 0;
  11551. this.stateInterpolationClose(c);
  11552. }
  11553. }
  11554. stateInterpolationClose(c) {
  11555. if (c === this.delimiterClose[this.delimiterIndex]) {
  11556. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  11557. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  11558. if (this.inRCDATA) {
  11559. this.state = 32;
  11560. } else {
  11561. this.state = 1;
  11562. }
  11563. this.sectionStart = this.index + 1;
  11564. } else {
  11565. this.delimiterIndex++;
  11566. }
  11567. } else {
  11568. this.state = 3;
  11569. this.stateInterpolation(c);
  11570. }
  11571. }
  11572. stateSpecialStartSequence(c) {
  11573. const isEnd = this.sequenceIndex === this.currentSequence.length;
  11574. const isMatch = isEnd ? (
  11575. // If we are at the end of the sequence, make sure the tag name has ended
  11576. isEndOfTagSection(c)
  11577. ) : (
  11578. // Otherwise, do a case-insensitive comparison
  11579. (c | 32) === this.currentSequence[this.sequenceIndex]
  11580. );
  11581. if (!isMatch) {
  11582. this.inRCDATA = false;
  11583. } else if (!isEnd) {
  11584. this.sequenceIndex++;
  11585. return;
  11586. }
  11587. this.sequenceIndex = 0;
  11588. this.state = 6;
  11589. this.stateInTagName(c);
  11590. }
  11591. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  11592. stateInRCDATA(c) {
  11593. if (this.sequenceIndex === this.currentSequence.length) {
  11594. if (c === 62 || isWhitespace(c)) {
  11595. const endOfText = this.index - this.currentSequence.length;
  11596. if (this.sectionStart < endOfText) {
  11597. const actualIndex = this.index;
  11598. this.index = endOfText;
  11599. this.cbs.ontext(this.sectionStart, endOfText);
  11600. this.index = actualIndex;
  11601. }
  11602. this.sectionStart = endOfText + 2;
  11603. this.stateInClosingTagName(c);
  11604. this.inRCDATA = false;
  11605. return;
  11606. }
  11607. this.sequenceIndex = 0;
  11608. }
  11609. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  11610. this.sequenceIndex += 1;
  11611. } else if (this.sequenceIndex === 0) {
  11612. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  11613. if (c === this.delimiterOpen[0]) {
  11614. this.state = 2;
  11615. this.delimiterIndex = 0;
  11616. this.stateInterpolationOpen(c);
  11617. }
  11618. } else if (this.fastForwardTo(60)) {
  11619. this.sequenceIndex = 1;
  11620. }
  11621. } else {
  11622. this.sequenceIndex = Number(c === 60);
  11623. }
  11624. }
  11625. stateCDATASequence(c) {
  11626. if (c === Sequences.Cdata[this.sequenceIndex]) {
  11627. if (++this.sequenceIndex === Sequences.Cdata.length) {
  11628. this.state = 28;
  11629. this.currentSequence = Sequences.CdataEnd;
  11630. this.sequenceIndex = 0;
  11631. this.sectionStart = this.index + 1;
  11632. }
  11633. } else {
  11634. this.sequenceIndex = 0;
  11635. this.state = 23;
  11636. this.stateInDeclaration(c);
  11637. }
  11638. }
  11639. /**
  11640. * When we wait for one specific character, we can speed things up
  11641. * by skipping through the buffer until we find it.
  11642. *
  11643. * @returns Whether the character was found.
  11644. */
  11645. fastForwardTo(c) {
  11646. while (++this.index < this.buffer.length) {
  11647. const cc = this.buffer.charCodeAt(this.index);
  11648. if (cc === 10) {
  11649. this.newlines.push(this.index);
  11650. }
  11651. if (cc === c) {
  11652. return true;
  11653. }
  11654. }
  11655. this.index = this.buffer.length - 1;
  11656. return false;
  11657. }
  11658. /**
  11659. * Comments and CDATA end with `-->` and `]]>`.
  11660. *
  11661. * Their common qualities are:
  11662. * - Their end sequences have a distinct character they start with.
  11663. * - That character is then repeated, so we have to check multiple repeats.
  11664. * - All characters but the start character of the sequence can be skipped.
  11665. */
  11666. stateInCommentLike(c) {
  11667. if (c === this.currentSequence[this.sequenceIndex]) {
  11668. if (++this.sequenceIndex === this.currentSequence.length) {
  11669. if (this.currentSequence === Sequences.CdataEnd) {
  11670. this.cbs.oncdata(this.sectionStart, this.index - 2);
  11671. } else {
  11672. this.cbs.oncomment(this.sectionStart, this.index - 2);
  11673. }
  11674. this.sequenceIndex = 0;
  11675. this.sectionStart = this.index + 1;
  11676. this.state = 1;
  11677. }
  11678. } else if (this.sequenceIndex === 0) {
  11679. if (this.fastForwardTo(this.currentSequence[0])) {
  11680. this.sequenceIndex = 1;
  11681. }
  11682. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  11683. this.sequenceIndex = 0;
  11684. }
  11685. }
  11686. startSpecial(sequence, offset) {
  11687. this.enterRCDATA(sequence, offset);
  11688. this.state = 31;
  11689. }
  11690. enterRCDATA(sequence, offset) {
  11691. this.inRCDATA = true;
  11692. this.currentSequence = sequence;
  11693. this.sequenceIndex = offset;
  11694. }
  11695. stateBeforeTagName(c) {
  11696. if (c === 33) {
  11697. this.state = 22;
  11698. this.sectionStart = this.index + 1;
  11699. } else if (c === 63) {
  11700. this.state = 24;
  11701. this.sectionStart = this.index + 1;
  11702. } else if (isTagStartChar(c)) {
  11703. this.sectionStart = this.index;
  11704. if (this.mode === 0) {
  11705. this.state = 6;
  11706. } else if (this.inSFCRoot) {
  11707. this.state = 34;
  11708. } else if (!this.inXML) {
  11709. if (c === 116) {
  11710. this.state = 30;
  11711. } else {
  11712. this.state = c === 115 ? 29 : 6;
  11713. }
  11714. } else {
  11715. this.state = 6;
  11716. }
  11717. } else if (c === 47) {
  11718. this.state = 8;
  11719. } else {
  11720. this.state = 1;
  11721. this.stateText(c);
  11722. }
  11723. }
  11724. stateInTagName(c) {
  11725. if (isEndOfTagSection(c)) {
  11726. this.handleTagName(c);
  11727. }
  11728. }
  11729. stateInSFCRootTagName(c) {
  11730. if (isEndOfTagSection(c)) {
  11731. const tag = this.buffer.slice(this.sectionStart, this.index);
  11732. if (tag !== "template") {
  11733. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  11734. }
  11735. this.handleTagName(c);
  11736. }
  11737. }
  11738. handleTagName(c) {
  11739. this.cbs.onopentagname(this.sectionStart, this.index);
  11740. this.sectionStart = -1;
  11741. this.state = 11;
  11742. this.stateBeforeAttrName(c);
  11743. }
  11744. stateBeforeClosingTagName(c) {
  11745. if (isWhitespace(c)) ; else if (c === 62) {
  11746. {
  11747. this.cbs.onerr(14, this.index);
  11748. }
  11749. this.state = 1;
  11750. this.sectionStart = this.index + 1;
  11751. } else {
  11752. this.state = isTagStartChar(c) ? 9 : 27;
  11753. this.sectionStart = this.index;
  11754. }
  11755. }
  11756. stateInClosingTagName(c) {
  11757. if (c === 62 || isWhitespace(c)) {
  11758. this.cbs.onclosetag(this.sectionStart, this.index);
  11759. this.sectionStart = -1;
  11760. this.state = 10;
  11761. this.stateAfterClosingTagName(c);
  11762. }
  11763. }
  11764. stateAfterClosingTagName(c) {
  11765. if (c === 62) {
  11766. this.state = 1;
  11767. this.sectionStart = this.index + 1;
  11768. }
  11769. }
  11770. stateBeforeAttrName(c) {
  11771. if (c === 62) {
  11772. this.cbs.onopentagend(this.index);
  11773. if (this.inRCDATA) {
  11774. this.state = 32;
  11775. } else {
  11776. this.state = 1;
  11777. }
  11778. this.sectionStart = this.index + 1;
  11779. } else if (c === 47) {
  11780. this.state = 7;
  11781. if (this.peek() !== 62) {
  11782. this.cbs.onerr(22, this.index);
  11783. }
  11784. } else if (c === 60 && this.peek() === 47) {
  11785. this.cbs.onopentagend(this.index);
  11786. this.state = 5;
  11787. this.sectionStart = this.index;
  11788. } else if (!isWhitespace(c)) {
  11789. if (c === 61) {
  11790. this.cbs.onerr(
  11791. 19,
  11792. this.index
  11793. );
  11794. }
  11795. this.handleAttrStart(c);
  11796. }
  11797. }
  11798. handleAttrStart(c) {
  11799. if (c === 118 && this.peek() === 45) {
  11800. this.state = 13;
  11801. this.sectionStart = this.index;
  11802. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  11803. this.cbs.ondirname(this.index, this.index + 1);
  11804. this.state = 14;
  11805. this.sectionStart = this.index + 1;
  11806. } else {
  11807. this.state = 12;
  11808. this.sectionStart = this.index;
  11809. }
  11810. }
  11811. stateInSelfClosingTag(c) {
  11812. if (c === 62) {
  11813. this.cbs.onselfclosingtag(this.index);
  11814. this.state = 1;
  11815. this.sectionStart = this.index + 1;
  11816. this.inRCDATA = false;
  11817. } else if (!isWhitespace(c)) {
  11818. this.state = 11;
  11819. this.stateBeforeAttrName(c);
  11820. }
  11821. }
  11822. stateInAttrName(c) {
  11823. if (c === 61 || isEndOfTagSection(c)) {
  11824. this.cbs.onattribname(this.sectionStart, this.index);
  11825. this.handleAttrNameEnd(c);
  11826. } else if (c === 34 || c === 39 || c === 60) {
  11827. this.cbs.onerr(
  11828. 17,
  11829. this.index
  11830. );
  11831. }
  11832. }
  11833. stateInDirName(c) {
  11834. if (c === 61 || isEndOfTagSection(c)) {
  11835. this.cbs.ondirname(this.sectionStart, this.index);
  11836. this.handleAttrNameEnd(c);
  11837. } else if (c === 58) {
  11838. this.cbs.ondirname(this.sectionStart, this.index);
  11839. this.state = 14;
  11840. this.sectionStart = this.index + 1;
  11841. } else if (c === 46) {
  11842. this.cbs.ondirname(this.sectionStart, this.index);
  11843. this.state = 16;
  11844. this.sectionStart = this.index + 1;
  11845. }
  11846. }
  11847. stateInDirArg(c) {
  11848. if (c === 61 || isEndOfTagSection(c)) {
  11849. this.cbs.ondirarg(this.sectionStart, this.index);
  11850. this.handleAttrNameEnd(c);
  11851. } else if (c === 91) {
  11852. this.state = 15;
  11853. } else if (c === 46) {
  11854. this.cbs.ondirarg(this.sectionStart, this.index);
  11855. this.state = 16;
  11856. this.sectionStart = this.index + 1;
  11857. }
  11858. }
  11859. stateInDynamicDirArg(c) {
  11860. if (c === 93) {
  11861. this.state = 14;
  11862. } else if (c === 61 || isEndOfTagSection(c)) {
  11863. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  11864. this.handleAttrNameEnd(c);
  11865. {
  11866. this.cbs.onerr(
  11867. 27,
  11868. this.index
  11869. );
  11870. }
  11871. }
  11872. }
  11873. stateInDirModifier(c) {
  11874. if (c === 61 || isEndOfTagSection(c)) {
  11875. this.cbs.ondirmodifier(this.sectionStart, this.index);
  11876. this.handleAttrNameEnd(c);
  11877. } else if (c === 46) {
  11878. this.cbs.ondirmodifier(this.sectionStart, this.index);
  11879. this.sectionStart = this.index + 1;
  11880. }
  11881. }
  11882. handleAttrNameEnd(c) {
  11883. this.sectionStart = this.index;
  11884. this.state = 17;
  11885. this.cbs.onattribnameend(this.index);
  11886. this.stateAfterAttrName(c);
  11887. }
  11888. stateAfterAttrName(c) {
  11889. if (c === 61) {
  11890. this.state = 18;
  11891. } else if (c === 47 || c === 62) {
  11892. this.cbs.onattribend(0, this.sectionStart);
  11893. this.sectionStart = -1;
  11894. this.state = 11;
  11895. this.stateBeforeAttrName(c);
  11896. } else if (!isWhitespace(c)) {
  11897. this.cbs.onattribend(0, this.sectionStart);
  11898. this.handleAttrStart(c);
  11899. }
  11900. }
  11901. stateBeforeAttrValue(c) {
  11902. if (c === 34) {
  11903. this.state = 19;
  11904. this.sectionStart = this.index + 1;
  11905. } else if (c === 39) {
  11906. this.state = 20;
  11907. this.sectionStart = this.index + 1;
  11908. } else if (!isWhitespace(c)) {
  11909. this.sectionStart = this.index;
  11910. this.state = 21;
  11911. this.stateInAttrValueNoQuotes(c);
  11912. }
  11913. }
  11914. handleInAttrValue(c, quote) {
  11915. if (c === quote || this.fastForwardTo(quote)) {
  11916. this.cbs.onattribdata(this.sectionStart, this.index);
  11917. this.sectionStart = -1;
  11918. this.cbs.onattribend(
  11919. quote === 34 ? 3 : 2,
  11920. this.index + 1
  11921. );
  11922. this.state = 11;
  11923. }
  11924. }
  11925. stateInAttrValueDoubleQuotes(c) {
  11926. this.handleInAttrValue(c, 34);
  11927. }
  11928. stateInAttrValueSingleQuotes(c) {
  11929. this.handleInAttrValue(c, 39);
  11930. }
  11931. stateInAttrValueNoQuotes(c) {
  11932. if (isWhitespace(c) || c === 62) {
  11933. this.cbs.onattribdata(this.sectionStart, this.index);
  11934. this.sectionStart = -1;
  11935. this.cbs.onattribend(1, this.index);
  11936. this.state = 11;
  11937. this.stateBeforeAttrName(c);
  11938. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  11939. this.cbs.onerr(
  11940. 18,
  11941. this.index
  11942. );
  11943. } else ;
  11944. }
  11945. stateBeforeDeclaration(c) {
  11946. if (c === 91) {
  11947. this.state = 26;
  11948. this.sequenceIndex = 0;
  11949. } else {
  11950. this.state = c === 45 ? 25 : 23;
  11951. }
  11952. }
  11953. stateInDeclaration(c) {
  11954. if (c === 62 || this.fastForwardTo(62)) {
  11955. this.state = 1;
  11956. this.sectionStart = this.index + 1;
  11957. }
  11958. }
  11959. stateInProcessingInstruction(c) {
  11960. if (c === 62 || this.fastForwardTo(62)) {
  11961. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  11962. this.state = 1;
  11963. this.sectionStart = this.index + 1;
  11964. }
  11965. }
  11966. stateBeforeComment(c) {
  11967. if (c === 45) {
  11968. this.state = 28;
  11969. this.currentSequence = Sequences.CommentEnd;
  11970. this.sequenceIndex = 2;
  11971. this.sectionStart = this.index + 1;
  11972. } else {
  11973. this.state = 23;
  11974. }
  11975. }
  11976. stateInSpecialComment(c) {
  11977. if (c === 62 || this.fastForwardTo(62)) {
  11978. this.cbs.oncomment(this.sectionStart, this.index);
  11979. this.state = 1;
  11980. this.sectionStart = this.index + 1;
  11981. }
  11982. }
  11983. stateBeforeSpecialS(c) {
  11984. if (c === Sequences.ScriptEnd[3]) {
  11985. this.startSpecial(Sequences.ScriptEnd, 4);
  11986. } else if (c === Sequences.StyleEnd[3]) {
  11987. this.startSpecial(Sequences.StyleEnd, 4);
  11988. } else {
  11989. this.state = 6;
  11990. this.stateInTagName(c);
  11991. }
  11992. }
  11993. stateBeforeSpecialT(c) {
  11994. if (c === Sequences.TitleEnd[3]) {
  11995. this.startSpecial(Sequences.TitleEnd, 4);
  11996. } else if (c === Sequences.TextareaEnd[3]) {
  11997. this.startSpecial(Sequences.TextareaEnd, 4);
  11998. } else {
  11999. this.state = 6;
  12000. this.stateInTagName(c);
  12001. }
  12002. }
  12003. startEntity() {
  12004. }
  12005. stateInEntity() {
  12006. }
  12007. /**
  12008. * Iterates through the buffer, calling the function corresponding to the current state.
  12009. *
  12010. * States that are more likely to be hit are higher up, as a performance improvement.
  12011. */
  12012. parse(input) {
  12013. this.buffer = input;
  12014. while (this.index < this.buffer.length) {
  12015. const c = this.buffer.charCodeAt(this.index);
  12016. if (c === 10) {
  12017. this.newlines.push(this.index);
  12018. }
  12019. switch (this.state) {
  12020. case 1: {
  12021. this.stateText(c);
  12022. break;
  12023. }
  12024. case 2: {
  12025. this.stateInterpolationOpen(c);
  12026. break;
  12027. }
  12028. case 3: {
  12029. this.stateInterpolation(c);
  12030. break;
  12031. }
  12032. case 4: {
  12033. this.stateInterpolationClose(c);
  12034. break;
  12035. }
  12036. case 31: {
  12037. this.stateSpecialStartSequence(c);
  12038. break;
  12039. }
  12040. case 32: {
  12041. this.stateInRCDATA(c);
  12042. break;
  12043. }
  12044. case 26: {
  12045. this.stateCDATASequence(c);
  12046. break;
  12047. }
  12048. case 19: {
  12049. this.stateInAttrValueDoubleQuotes(c);
  12050. break;
  12051. }
  12052. case 12: {
  12053. this.stateInAttrName(c);
  12054. break;
  12055. }
  12056. case 13: {
  12057. this.stateInDirName(c);
  12058. break;
  12059. }
  12060. case 14: {
  12061. this.stateInDirArg(c);
  12062. break;
  12063. }
  12064. case 15: {
  12065. this.stateInDynamicDirArg(c);
  12066. break;
  12067. }
  12068. case 16: {
  12069. this.stateInDirModifier(c);
  12070. break;
  12071. }
  12072. case 28: {
  12073. this.stateInCommentLike(c);
  12074. break;
  12075. }
  12076. case 27: {
  12077. this.stateInSpecialComment(c);
  12078. break;
  12079. }
  12080. case 11: {
  12081. this.stateBeforeAttrName(c);
  12082. break;
  12083. }
  12084. case 6: {
  12085. this.stateInTagName(c);
  12086. break;
  12087. }
  12088. case 34: {
  12089. this.stateInSFCRootTagName(c);
  12090. break;
  12091. }
  12092. case 9: {
  12093. this.stateInClosingTagName(c);
  12094. break;
  12095. }
  12096. case 5: {
  12097. this.stateBeforeTagName(c);
  12098. break;
  12099. }
  12100. case 17: {
  12101. this.stateAfterAttrName(c);
  12102. break;
  12103. }
  12104. case 20: {
  12105. this.stateInAttrValueSingleQuotes(c);
  12106. break;
  12107. }
  12108. case 18: {
  12109. this.stateBeforeAttrValue(c);
  12110. break;
  12111. }
  12112. case 8: {
  12113. this.stateBeforeClosingTagName(c);
  12114. break;
  12115. }
  12116. case 10: {
  12117. this.stateAfterClosingTagName(c);
  12118. break;
  12119. }
  12120. case 29: {
  12121. this.stateBeforeSpecialS(c);
  12122. break;
  12123. }
  12124. case 30: {
  12125. this.stateBeforeSpecialT(c);
  12126. break;
  12127. }
  12128. case 21: {
  12129. this.stateInAttrValueNoQuotes(c);
  12130. break;
  12131. }
  12132. case 7: {
  12133. this.stateInSelfClosingTag(c);
  12134. break;
  12135. }
  12136. case 23: {
  12137. this.stateInDeclaration(c);
  12138. break;
  12139. }
  12140. case 22: {
  12141. this.stateBeforeDeclaration(c);
  12142. break;
  12143. }
  12144. case 25: {
  12145. this.stateBeforeComment(c);
  12146. break;
  12147. }
  12148. case 24: {
  12149. this.stateInProcessingInstruction(c);
  12150. break;
  12151. }
  12152. case 33: {
  12153. this.stateInEntity();
  12154. break;
  12155. }
  12156. }
  12157. this.index++;
  12158. }
  12159. this.cleanup();
  12160. this.finish();
  12161. }
  12162. /**
  12163. * Remove data that has already been consumed from the buffer.
  12164. */
  12165. cleanup() {
  12166. if (this.sectionStart !== this.index) {
  12167. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  12168. this.cbs.ontext(this.sectionStart, this.index);
  12169. this.sectionStart = this.index;
  12170. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  12171. this.cbs.onattribdata(this.sectionStart, this.index);
  12172. this.sectionStart = this.index;
  12173. }
  12174. }
  12175. }
  12176. finish() {
  12177. this.handleTrailingData();
  12178. this.cbs.onend();
  12179. }
  12180. /** Handle any trailing data. */
  12181. handleTrailingData() {
  12182. const endIndex = this.buffer.length;
  12183. if (this.sectionStart >= endIndex) {
  12184. return;
  12185. }
  12186. if (this.state === 28) {
  12187. if (this.currentSequence === Sequences.CdataEnd) {
  12188. this.cbs.oncdata(this.sectionStart, endIndex);
  12189. } else {
  12190. this.cbs.oncomment(this.sectionStart, endIndex);
  12191. }
  12192. } 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 {
  12193. this.cbs.ontext(this.sectionStart, endIndex);
  12194. }
  12195. }
  12196. emitCodePoint(cp, consumed) {
  12197. }
  12198. }
  12199. function defaultOnError(error) {
  12200. throw error;
  12201. }
  12202. function defaultOnWarn(msg) {
  12203. console.warn(`[Vue warn] ${msg.message}`);
  12204. }
  12205. function createCompilerError(code, loc, messages, additionalMessage) {
  12206. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  12207. const error = new SyntaxError(String(msg));
  12208. error.code = code;
  12209. error.loc = loc;
  12210. return error;
  12211. }
  12212. const errorMessages = {
  12213. // parse errors
  12214. [0]: "Illegal comment.",
  12215. [1]: "CDATA section is allowed only in XML context.",
  12216. [2]: "Duplicate attribute.",
  12217. [3]: "End tag cannot have attributes.",
  12218. [4]: "Illegal '/' in tags.",
  12219. [5]: "Unexpected EOF in tag.",
  12220. [6]: "Unexpected EOF in CDATA section.",
  12221. [7]: "Unexpected EOF in comment.",
  12222. [8]: "Unexpected EOF in script.",
  12223. [9]: "Unexpected EOF in tag.",
  12224. [10]: "Incorrectly closed comment.",
  12225. [11]: "Incorrectly opened comment.",
  12226. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  12227. [13]: "Attribute value was expected.",
  12228. [14]: "End tag name was expected.",
  12229. [15]: "Whitespace was expected.",
  12230. [16]: "Unexpected '<!--' in comment.",
  12231. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  12232. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  12233. [19]: "Attribute name cannot start with '='.",
  12234. [21]: "'<?' is allowed only in XML context.",
  12235. [20]: `Unexpected null character.`,
  12236. [22]: "Illegal '/' in tags.",
  12237. // Vue-specific parse errors
  12238. [23]: "Invalid end tag.",
  12239. [24]: "Element is missing end tag.",
  12240. [25]: "Interpolation end sign was not found.",
  12241. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  12242. [26]: "Legal directive name was expected.",
  12243. // transform errors
  12244. [28]: `v-if/v-else-if is missing expression.`,
  12245. [29]: `v-if/else branches must use unique keys.`,
  12246. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  12247. [31]: `v-for is missing expression.`,
  12248. [32]: `v-for has invalid expression.`,
  12249. [33]: `<template v-for> key should be placed on the <template> tag.`,
  12250. [34]: `v-bind is missing expression.`,
  12251. [52]: `v-bind with same-name shorthand only allows static argument.`,
  12252. [35]: `v-on is missing expression.`,
  12253. [36]: `Unexpected custom directive on <slot> outlet.`,
  12254. [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.`,
  12255. [38]: `Duplicate slot names found. `,
  12256. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  12257. [40]: `v-slot can only be used on components or <template> tags.`,
  12258. [41]: `v-model is missing expression.`,
  12259. [42]: `v-model value must be a valid JavaScript member expression.`,
  12260. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  12261. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  12262. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  12263. [45]: `Error parsing JavaScript expression: `,
  12264. [46]: `<KeepAlive> expects exactly one child component.`,
  12265. [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.`,
  12266. // generic errors
  12267. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  12268. [48]: `ES module mode is not supported in this build of compiler.`,
  12269. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  12270. [50]: `"scopeId" option is only supported in module mode.`,
  12271. // just to fulfill types
  12272. [53]: ``
  12273. };
  12274. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  12275. function isCoreComponent(tag) {
  12276. switch (tag) {
  12277. case "Teleport":
  12278. case "teleport":
  12279. return TELEPORT;
  12280. case "Suspense":
  12281. case "suspense":
  12282. return SUSPENSE;
  12283. case "KeepAlive":
  12284. case "keep-alive":
  12285. return KEEP_ALIVE;
  12286. case "BaseTransition":
  12287. case "base-transition":
  12288. return BASE_TRANSITION;
  12289. }
  12290. }
  12291. const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
  12292. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  12293. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  12294. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  12295. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  12296. const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
  12297. const isMemberExpressionBrowser = (exp) => {
  12298. const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
  12299. let state = 0 /* inMemberExp */;
  12300. let stateStack = [];
  12301. let currentOpenBracketCount = 0;
  12302. let currentOpenParensCount = 0;
  12303. let currentStringType = null;
  12304. for (let i = 0; i < path.length; i++) {
  12305. const char = path.charAt(i);
  12306. switch (state) {
  12307. case 0 /* inMemberExp */:
  12308. if (char === "[") {
  12309. stateStack.push(state);
  12310. state = 1 /* inBrackets */;
  12311. currentOpenBracketCount++;
  12312. } else if (char === "(") {
  12313. stateStack.push(state);
  12314. state = 2 /* inParens */;
  12315. currentOpenParensCount++;
  12316. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  12317. return false;
  12318. }
  12319. break;
  12320. case 1 /* inBrackets */:
  12321. if (char === `'` || char === `"` || char === "`") {
  12322. stateStack.push(state);
  12323. state = 3 /* inString */;
  12324. currentStringType = char;
  12325. } else if (char === `[`) {
  12326. currentOpenBracketCount++;
  12327. } else if (char === `]`) {
  12328. if (!--currentOpenBracketCount) {
  12329. state = stateStack.pop();
  12330. }
  12331. }
  12332. break;
  12333. case 2 /* inParens */:
  12334. if (char === `'` || char === `"` || char === "`") {
  12335. stateStack.push(state);
  12336. state = 3 /* inString */;
  12337. currentStringType = char;
  12338. } else if (char === `(`) {
  12339. currentOpenParensCount++;
  12340. } else if (char === `)`) {
  12341. if (i === path.length - 1) {
  12342. return false;
  12343. }
  12344. if (!--currentOpenParensCount) {
  12345. state = stateStack.pop();
  12346. }
  12347. }
  12348. break;
  12349. case 3 /* inString */:
  12350. if (char === currentStringType) {
  12351. state = stateStack.pop();
  12352. currentStringType = null;
  12353. }
  12354. break;
  12355. }
  12356. }
  12357. return !currentOpenBracketCount && !currentOpenParensCount;
  12358. };
  12359. const isMemberExpression = isMemberExpressionBrowser ;
  12360. const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  12361. const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
  12362. const isFnExpression = isFnExpressionBrowser ;
  12363. function assert(condition, msg) {
  12364. if (!condition) {
  12365. throw new Error(msg || `unexpected compiler condition`);
  12366. }
  12367. }
  12368. function findDir(node, name, allowEmpty = false) {
  12369. for (let i = 0; i < node.props.length; i++) {
  12370. const p = node.props[i];
  12371. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  12372. return p;
  12373. }
  12374. }
  12375. }
  12376. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  12377. for (let i = 0; i < node.props.length; i++) {
  12378. const p = node.props[i];
  12379. if (p.type === 6) {
  12380. if (dynamicOnly) continue;
  12381. if (p.name === name && (p.value || allowEmpty)) {
  12382. return p;
  12383. }
  12384. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  12385. return p;
  12386. }
  12387. }
  12388. }
  12389. function isStaticArgOf(arg, name) {
  12390. return !!(arg && isStaticExp(arg) && arg.content === name);
  12391. }
  12392. function hasDynamicKeyVBind(node) {
  12393. return node.props.some(
  12394. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  12395. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  12396. !p.arg.isStatic)
  12397. // v-bind:[foo]
  12398. );
  12399. }
  12400. function isText$1(node) {
  12401. return node.type === 5 || node.type === 2;
  12402. }
  12403. function isVSlot(p) {
  12404. return p.type === 7 && p.name === "slot";
  12405. }
  12406. function isTemplateNode(node) {
  12407. return node.type === 1 && node.tagType === 3;
  12408. }
  12409. function isSlotOutlet(node) {
  12410. return node.type === 1 && node.tagType === 2;
  12411. }
  12412. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  12413. function getUnnormalizedProps(props, callPath = []) {
  12414. if (props && !isString(props) && props.type === 14) {
  12415. const callee = props.callee;
  12416. if (!isString(callee) && propsHelperSet.has(callee)) {
  12417. return getUnnormalizedProps(
  12418. props.arguments[0],
  12419. callPath.concat(props)
  12420. );
  12421. }
  12422. }
  12423. return [props, callPath];
  12424. }
  12425. function injectProp(node, prop, context) {
  12426. let propsWithInjection;
  12427. let props = node.type === 13 ? node.props : node.arguments[2];
  12428. let callPath = [];
  12429. let parentCall;
  12430. if (props && !isString(props) && props.type === 14) {
  12431. const ret = getUnnormalizedProps(props);
  12432. props = ret[0];
  12433. callPath = ret[1];
  12434. parentCall = callPath[callPath.length - 1];
  12435. }
  12436. if (props == null || isString(props)) {
  12437. propsWithInjection = createObjectExpression([prop]);
  12438. } else if (props.type === 14) {
  12439. const first = props.arguments[0];
  12440. if (!isString(first) && first.type === 15) {
  12441. if (!hasProp(prop, first)) {
  12442. first.properties.unshift(prop);
  12443. }
  12444. } else {
  12445. if (props.callee === TO_HANDLERS) {
  12446. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  12447. createObjectExpression([prop]),
  12448. props
  12449. ]);
  12450. } else {
  12451. props.arguments.unshift(createObjectExpression([prop]));
  12452. }
  12453. }
  12454. !propsWithInjection && (propsWithInjection = props);
  12455. } else if (props.type === 15) {
  12456. if (!hasProp(prop, props)) {
  12457. props.properties.unshift(prop);
  12458. }
  12459. propsWithInjection = props;
  12460. } else {
  12461. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  12462. createObjectExpression([prop]),
  12463. props
  12464. ]);
  12465. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  12466. parentCall = callPath[callPath.length - 2];
  12467. }
  12468. }
  12469. if (node.type === 13) {
  12470. if (parentCall) {
  12471. parentCall.arguments[0] = propsWithInjection;
  12472. } else {
  12473. node.props = propsWithInjection;
  12474. }
  12475. } else {
  12476. if (parentCall) {
  12477. parentCall.arguments[0] = propsWithInjection;
  12478. } else {
  12479. node.arguments[2] = propsWithInjection;
  12480. }
  12481. }
  12482. }
  12483. function hasProp(prop, props) {
  12484. let result = false;
  12485. if (prop.key.type === 4) {
  12486. const propKeyName = prop.key.content;
  12487. result = props.properties.some(
  12488. (p) => p.key.type === 4 && p.key.content === propKeyName
  12489. );
  12490. }
  12491. return result;
  12492. }
  12493. function toValidAssetId(name, type) {
  12494. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  12495. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  12496. })}`;
  12497. }
  12498. function getMemoedVNodeCall(node) {
  12499. if (node.type === 14 && node.callee === WITH_MEMO) {
  12500. return node.arguments[1].returns;
  12501. } else {
  12502. return node;
  12503. }
  12504. }
  12505. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
  12506. const defaultParserOptions = {
  12507. parseMode: "base",
  12508. ns: 0,
  12509. delimiters: [`{{`, `}}`],
  12510. getNamespace: () => 0,
  12511. isVoidTag: NO,
  12512. isPreTag: NO,
  12513. isCustomElement: NO,
  12514. onError: defaultOnError,
  12515. onWarn: defaultOnWarn,
  12516. comments: true,
  12517. prefixIdentifiers: false
  12518. };
  12519. let currentOptions = defaultParserOptions;
  12520. let currentRoot = null;
  12521. let currentInput = "";
  12522. let currentOpenTag = null;
  12523. let currentProp = null;
  12524. let currentAttrValue = "";
  12525. let currentAttrStartIndex = -1;
  12526. let currentAttrEndIndex = -1;
  12527. let inPre = 0;
  12528. let inVPre = false;
  12529. let currentVPreBoundary = null;
  12530. const stack = [];
  12531. const tokenizer = new Tokenizer(stack, {
  12532. onerr: emitError,
  12533. ontext(start, end) {
  12534. onText(getSlice(start, end), start, end);
  12535. },
  12536. ontextentity(char, start, end) {
  12537. onText(char, start, end);
  12538. },
  12539. oninterpolation(start, end) {
  12540. if (inVPre) {
  12541. return onText(getSlice(start, end), start, end);
  12542. }
  12543. let innerStart = start + tokenizer.delimiterOpen.length;
  12544. let innerEnd = end - tokenizer.delimiterClose.length;
  12545. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  12546. innerStart++;
  12547. }
  12548. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  12549. innerEnd--;
  12550. }
  12551. let exp = getSlice(innerStart, innerEnd);
  12552. if (exp.includes("&")) {
  12553. {
  12554. exp = currentOptions.decodeEntities(exp, false);
  12555. }
  12556. }
  12557. addNode({
  12558. type: 5,
  12559. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  12560. loc: getLoc(start, end)
  12561. });
  12562. },
  12563. onopentagname(start, end) {
  12564. const name = getSlice(start, end);
  12565. currentOpenTag = {
  12566. type: 1,
  12567. tag: name,
  12568. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  12569. tagType: 0,
  12570. // will be refined on tag close
  12571. props: [],
  12572. children: [],
  12573. loc: getLoc(start - 1, end),
  12574. codegenNode: void 0
  12575. };
  12576. },
  12577. onopentagend(end) {
  12578. endOpenTag(end);
  12579. },
  12580. onclosetag(start, end) {
  12581. const name = getSlice(start, end);
  12582. if (!currentOptions.isVoidTag(name)) {
  12583. let found = false;
  12584. for (let i = 0; i < stack.length; i++) {
  12585. const e = stack[i];
  12586. if (e.tag.toLowerCase() === name.toLowerCase()) {
  12587. found = true;
  12588. if (i > 0) {
  12589. emitError(24, stack[0].loc.start.offset);
  12590. }
  12591. for (let j = 0; j <= i; j++) {
  12592. const el = stack.shift();
  12593. onCloseTag(el, end, j < i);
  12594. }
  12595. break;
  12596. }
  12597. }
  12598. if (!found) {
  12599. emitError(23, backTrack(start, 60));
  12600. }
  12601. }
  12602. },
  12603. onselfclosingtag(end) {
  12604. const name = currentOpenTag.tag;
  12605. currentOpenTag.isSelfClosing = true;
  12606. endOpenTag(end);
  12607. if (stack[0] && stack[0].tag === name) {
  12608. onCloseTag(stack.shift(), end);
  12609. }
  12610. },
  12611. onattribname(start, end) {
  12612. currentProp = {
  12613. type: 6,
  12614. name: getSlice(start, end),
  12615. nameLoc: getLoc(start, end),
  12616. value: void 0,
  12617. loc: getLoc(start)
  12618. };
  12619. },
  12620. ondirname(start, end) {
  12621. const raw = getSlice(start, end);
  12622. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  12623. if (!inVPre && name === "") {
  12624. emitError(26, start);
  12625. }
  12626. if (inVPre || name === "") {
  12627. currentProp = {
  12628. type: 6,
  12629. name: raw,
  12630. nameLoc: getLoc(start, end),
  12631. value: void 0,
  12632. loc: getLoc(start)
  12633. };
  12634. } else {
  12635. currentProp = {
  12636. type: 7,
  12637. name,
  12638. rawName: raw,
  12639. exp: void 0,
  12640. arg: void 0,
  12641. modifiers: raw === "." ? ["prop"] : [],
  12642. loc: getLoc(start)
  12643. };
  12644. if (name === "pre") {
  12645. inVPre = tokenizer.inVPre = true;
  12646. currentVPreBoundary = currentOpenTag;
  12647. const props = currentOpenTag.props;
  12648. for (let i = 0; i < props.length; i++) {
  12649. if (props[i].type === 7) {
  12650. props[i] = dirToAttr(props[i]);
  12651. }
  12652. }
  12653. }
  12654. }
  12655. },
  12656. ondirarg(start, end) {
  12657. if (start === end) return;
  12658. const arg = getSlice(start, end);
  12659. if (inVPre) {
  12660. currentProp.name += arg;
  12661. setLocEnd(currentProp.nameLoc, end);
  12662. } else {
  12663. const isStatic = arg[0] !== `[`;
  12664. currentProp.arg = createExp(
  12665. isStatic ? arg : arg.slice(1, -1),
  12666. isStatic,
  12667. getLoc(start, end),
  12668. isStatic ? 3 : 0
  12669. );
  12670. }
  12671. },
  12672. ondirmodifier(start, end) {
  12673. const mod = getSlice(start, end);
  12674. if (inVPre) {
  12675. currentProp.name += "." + mod;
  12676. setLocEnd(currentProp.nameLoc, end);
  12677. } else if (currentProp.name === "slot") {
  12678. const arg = currentProp.arg;
  12679. if (arg) {
  12680. arg.content += "." + mod;
  12681. setLocEnd(arg.loc, end);
  12682. }
  12683. } else {
  12684. currentProp.modifiers.push(mod);
  12685. }
  12686. },
  12687. onattribdata(start, end) {
  12688. currentAttrValue += getSlice(start, end);
  12689. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  12690. currentAttrEndIndex = end;
  12691. },
  12692. onattribentity(char, start, end) {
  12693. currentAttrValue += char;
  12694. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  12695. currentAttrEndIndex = end;
  12696. },
  12697. onattribnameend(end) {
  12698. const start = currentProp.loc.start.offset;
  12699. const name = getSlice(start, end);
  12700. if (currentProp.type === 7) {
  12701. currentProp.rawName = name;
  12702. }
  12703. if (currentOpenTag.props.some(
  12704. (p) => (p.type === 7 ? p.rawName : p.name) === name
  12705. )) {
  12706. emitError(2, start);
  12707. }
  12708. },
  12709. onattribend(quote, end) {
  12710. if (currentOpenTag && currentProp) {
  12711. setLocEnd(currentProp.loc, end);
  12712. if (quote !== 0) {
  12713. if (currentAttrValue.includes("&")) {
  12714. currentAttrValue = currentOptions.decodeEntities(
  12715. currentAttrValue,
  12716. true
  12717. );
  12718. }
  12719. if (currentProp.type === 6) {
  12720. if (currentProp.name === "class") {
  12721. currentAttrValue = condense(currentAttrValue).trim();
  12722. }
  12723. if (quote === 1 && !currentAttrValue) {
  12724. emitError(13, end);
  12725. }
  12726. currentProp.value = {
  12727. type: 2,
  12728. content: currentAttrValue,
  12729. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  12730. };
  12731. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  12732. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  12733. }
  12734. } else {
  12735. let expParseMode = 0 /* Normal */;
  12736. currentProp.exp = createExp(
  12737. currentAttrValue,
  12738. false,
  12739. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  12740. 0,
  12741. expParseMode
  12742. );
  12743. if (currentProp.name === "for") {
  12744. currentProp.forParseResult = parseForExpression(currentProp.exp);
  12745. }
  12746. }
  12747. }
  12748. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  12749. currentOpenTag.props.push(currentProp);
  12750. }
  12751. }
  12752. currentAttrValue = "";
  12753. currentAttrStartIndex = currentAttrEndIndex = -1;
  12754. },
  12755. oncomment(start, end) {
  12756. if (currentOptions.comments) {
  12757. addNode({
  12758. type: 3,
  12759. content: getSlice(start, end),
  12760. loc: getLoc(start - 4, end + 3)
  12761. });
  12762. }
  12763. },
  12764. onend() {
  12765. const end = currentInput.length;
  12766. if (tokenizer.state !== 1) {
  12767. switch (tokenizer.state) {
  12768. case 5:
  12769. case 8:
  12770. emitError(5, end);
  12771. break;
  12772. case 3:
  12773. case 4:
  12774. emitError(
  12775. 25,
  12776. tokenizer.sectionStart
  12777. );
  12778. break;
  12779. case 28:
  12780. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  12781. emitError(6, end);
  12782. } else {
  12783. emitError(7, end);
  12784. }
  12785. break;
  12786. case 6:
  12787. case 7:
  12788. case 9:
  12789. case 11:
  12790. case 12:
  12791. case 13:
  12792. case 14:
  12793. case 15:
  12794. case 16:
  12795. case 17:
  12796. case 18:
  12797. case 19:
  12798. case 20:
  12799. case 21:
  12800. emitError(9, end);
  12801. break;
  12802. }
  12803. }
  12804. for (let index = 0; index < stack.length; index++) {
  12805. onCloseTag(stack[index], end - 1);
  12806. emitError(24, stack[index].loc.start.offset);
  12807. }
  12808. },
  12809. oncdata(start, end) {
  12810. if (stack[0].ns !== 0) {
  12811. onText(getSlice(start, end), start, end);
  12812. } else {
  12813. emitError(1, start - 9);
  12814. }
  12815. },
  12816. onprocessinginstruction(start) {
  12817. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  12818. emitError(
  12819. 21,
  12820. start - 1
  12821. );
  12822. }
  12823. }
  12824. });
  12825. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  12826. const stripParensRE = /^\(|\)$/g;
  12827. function parseForExpression(input) {
  12828. const loc = input.loc;
  12829. const exp = input.content;
  12830. const inMatch = exp.match(forAliasRE);
  12831. if (!inMatch) return;
  12832. const [, LHS, RHS] = inMatch;
  12833. const createAliasExpression = (content, offset, asParam = false) => {
  12834. const start = loc.start.offset + offset;
  12835. const end = start + content.length;
  12836. return createExp(
  12837. content,
  12838. false,
  12839. getLoc(start, end),
  12840. 0,
  12841. asParam ? 1 /* Params */ : 0 /* Normal */
  12842. );
  12843. };
  12844. const result = {
  12845. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  12846. value: void 0,
  12847. key: void 0,
  12848. index: void 0,
  12849. finalized: false
  12850. };
  12851. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  12852. const trimmedOffset = LHS.indexOf(valueContent);
  12853. const iteratorMatch = valueContent.match(forIteratorRE);
  12854. if (iteratorMatch) {
  12855. valueContent = valueContent.replace(forIteratorRE, "").trim();
  12856. const keyContent = iteratorMatch[1].trim();
  12857. let keyOffset;
  12858. if (keyContent) {
  12859. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  12860. result.key = createAliasExpression(keyContent, keyOffset, true);
  12861. }
  12862. if (iteratorMatch[2]) {
  12863. const indexContent = iteratorMatch[2].trim();
  12864. if (indexContent) {
  12865. result.index = createAliasExpression(
  12866. indexContent,
  12867. exp.indexOf(
  12868. indexContent,
  12869. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  12870. ),
  12871. true
  12872. );
  12873. }
  12874. }
  12875. }
  12876. if (valueContent) {
  12877. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  12878. }
  12879. return result;
  12880. }
  12881. function getSlice(start, end) {
  12882. return currentInput.slice(start, end);
  12883. }
  12884. function endOpenTag(end) {
  12885. if (tokenizer.inSFCRoot) {
  12886. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  12887. }
  12888. addNode(currentOpenTag);
  12889. const { tag, ns } = currentOpenTag;
  12890. if (ns === 0 && currentOptions.isPreTag(tag)) {
  12891. inPre++;
  12892. }
  12893. if (currentOptions.isVoidTag(tag)) {
  12894. onCloseTag(currentOpenTag, end);
  12895. } else {
  12896. stack.unshift(currentOpenTag);
  12897. if (ns === 1 || ns === 2) {
  12898. tokenizer.inXML = true;
  12899. }
  12900. }
  12901. currentOpenTag = null;
  12902. }
  12903. function onText(content, start, end) {
  12904. {
  12905. const tag = stack[0] && stack[0].tag;
  12906. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  12907. content = currentOptions.decodeEntities(content, false);
  12908. }
  12909. }
  12910. const parent = stack[0] || currentRoot;
  12911. const lastNode = parent.children[parent.children.length - 1];
  12912. if (lastNode && lastNode.type === 2) {
  12913. lastNode.content += content;
  12914. setLocEnd(lastNode.loc, end);
  12915. } else {
  12916. parent.children.push({
  12917. type: 2,
  12918. content,
  12919. loc: getLoc(start, end)
  12920. });
  12921. }
  12922. }
  12923. function onCloseTag(el, end, isImplied = false) {
  12924. if (isImplied) {
  12925. setLocEnd(el.loc, backTrack(end, 60));
  12926. } else {
  12927. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  12928. }
  12929. if (tokenizer.inSFCRoot) {
  12930. if (el.children.length) {
  12931. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  12932. } else {
  12933. el.innerLoc.end = extend({}, el.innerLoc.start);
  12934. }
  12935. el.innerLoc.source = getSlice(
  12936. el.innerLoc.start.offset,
  12937. el.innerLoc.end.offset
  12938. );
  12939. }
  12940. const { tag, ns } = el;
  12941. if (!inVPre) {
  12942. if (tag === "slot") {
  12943. el.tagType = 2;
  12944. } else if (isFragmentTemplate(el)) {
  12945. el.tagType = 3;
  12946. } else if (isComponent(el)) {
  12947. el.tagType = 1;
  12948. }
  12949. }
  12950. if (!tokenizer.inRCDATA) {
  12951. el.children = condenseWhitespace(el.children, el.tag);
  12952. }
  12953. if (ns === 0 && currentOptions.isPreTag(tag)) {
  12954. inPre--;
  12955. }
  12956. if (currentVPreBoundary === el) {
  12957. inVPre = tokenizer.inVPre = false;
  12958. currentVPreBoundary = null;
  12959. }
  12960. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  12961. tokenizer.inXML = false;
  12962. }
  12963. }
  12964. function lookAhead(index, c) {
  12965. let i = index;
  12966. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
  12967. return i;
  12968. }
  12969. function backTrack(index, c) {
  12970. let i = index;
  12971. while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
  12972. return i;
  12973. }
  12974. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  12975. function isFragmentTemplate({ tag, props }) {
  12976. if (tag === "template") {
  12977. for (let i = 0; i < props.length; i++) {
  12978. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  12979. return true;
  12980. }
  12981. }
  12982. }
  12983. return false;
  12984. }
  12985. function isComponent({ tag, props }) {
  12986. if (currentOptions.isCustomElement(tag)) {
  12987. return false;
  12988. }
  12989. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  12990. return true;
  12991. }
  12992. for (let i = 0; i < props.length; i++) {
  12993. const p = props[i];
  12994. if (p.type === 6) {
  12995. if (p.name === "is" && p.value) {
  12996. if (p.value.content.startsWith("vue:")) {
  12997. return true;
  12998. }
  12999. }
  13000. }
  13001. }
  13002. return false;
  13003. }
  13004. function isUpperCase(c) {
  13005. return c > 64 && c < 91;
  13006. }
  13007. const windowsNewlineRE = /\r\n/g;
  13008. function condenseWhitespace(nodes, tag) {
  13009. const shouldCondense = currentOptions.whitespace !== "preserve";
  13010. let removedWhitespace = false;
  13011. for (let i = 0; i < nodes.length; i++) {
  13012. const node = nodes[i];
  13013. if (node.type === 2) {
  13014. if (!inPre) {
  13015. if (isAllWhitespace(node.content)) {
  13016. const prev = nodes[i - 1] && nodes[i - 1].type;
  13017. const next = nodes[i + 1] && nodes[i + 1].type;
  13018. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  13019. removedWhitespace = true;
  13020. nodes[i] = null;
  13021. } else {
  13022. node.content = " ";
  13023. }
  13024. } else if (shouldCondense) {
  13025. node.content = condense(node.content);
  13026. }
  13027. } else {
  13028. node.content = node.content.replace(windowsNewlineRE, "\n");
  13029. }
  13030. }
  13031. }
  13032. if (inPre && tag && currentOptions.isPreTag(tag)) {
  13033. const first = nodes[0];
  13034. if (first && first.type === 2) {
  13035. first.content = first.content.replace(/^\r?\n/, "");
  13036. }
  13037. }
  13038. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  13039. }
  13040. function isAllWhitespace(str) {
  13041. for (let i = 0; i < str.length; i++) {
  13042. if (!isWhitespace(str.charCodeAt(i))) {
  13043. return false;
  13044. }
  13045. }
  13046. return true;
  13047. }
  13048. function hasNewlineChar(str) {
  13049. for (let i = 0; i < str.length; i++) {
  13050. const c = str.charCodeAt(i);
  13051. if (c === 10 || c === 13) {
  13052. return true;
  13053. }
  13054. }
  13055. return false;
  13056. }
  13057. function condense(str) {
  13058. let ret = "";
  13059. let prevCharIsWhitespace = false;
  13060. for (let i = 0; i < str.length; i++) {
  13061. if (isWhitespace(str.charCodeAt(i))) {
  13062. if (!prevCharIsWhitespace) {
  13063. ret += " ";
  13064. prevCharIsWhitespace = true;
  13065. }
  13066. } else {
  13067. ret += str[i];
  13068. prevCharIsWhitespace = false;
  13069. }
  13070. }
  13071. return ret;
  13072. }
  13073. function addNode(node) {
  13074. (stack[0] || currentRoot).children.push(node);
  13075. }
  13076. function getLoc(start, end) {
  13077. return {
  13078. start: tokenizer.getPos(start),
  13079. // @ts-expect-error allow late attachment
  13080. end: end == null ? end : tokenizer.getPos(end),
  13081. // @ts-expect-error allow late attachment
  13082. source: end == null ? end : getSlice(start, end)
  13083. };
  13084. }
  13085. function setLocEnd(loc, end) {
  13086. loc.end = tokenizer.getPos(end);
  13087. loc.source = getSlice(loc.start.offset, end);
  13088. }
  13089. function dirToAttr(dir) {
  13090. const attr = {
  13091. type: 6,
  13092. name: dir.rawName,
  13093. nameLoc: getLoc(
  13094. dir.loc.start.offset,
  13095. dir.loc.start.offset + dir.rawName.length
  13096. ),
  13097. value: void 0,
  13098. loc: dir.loc
  13099. };
  13100. if (dir.exp) {
  13101. const loc = dir.exp.loc;
  13102. if (loc.end.offset < dir.loc.end.offset) {
  13103. loc.start.offset--;
  13104. loc.start.column--;
  13105. loc.end.offset++;
  13106. loc.end.column++;
  13107. }
  13108. attr.value = {
  13109. type: 2,
  13110. content: dir.exp.content,
  13111. loc
  13112. };
  13113. }
  13114. return attr;
  13115. }
  13116. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  13117. const exp = createSimpleExpression(content, isStatic, loc, constType);
  13118. return exp;
  13119. }
  13120. function emitError(code, index, message) {
  13121. currentOptions.onError(
  13122. createCompilerError(code, getLoc(index, index), void 0, message)
  13123. );
  13124. }
  13125. function reset() {
  13126. tokenizer.reset();
  13127. currentOpenTag = null;
  13128. currentProp = null;
  13129. currentAttrValue = "";
  13130. currentAttrStartIndex = -1;
  13131. currentAttrEndIndex = -1;
  13132. stack.length = 0;
  13133. }
  13134. function baseParse(input, options) {
  13135. reset();
  13136. currentInput = input;
  13137. currentOptions = extend({}, defaultParserOptions);
  13138. if (options) {
  13139. let key;
  13140. for (key in options) {
  13141. if (options[key] != null) {
  13142. currentOptions[key] = options[key];
  13143. }
  13144. }
  13145. }
  13146. {
  13147. if (!currentOptions.decodeEntities) {
  13148. throw new Error(
  13149. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  13150. );
  13151. }
  13152. }
  13153. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  13154. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  13155. const delimiters = options && options.delimiters;
  13156. if (delimiters) {
  13157. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  13158. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  13159. }
  13160. const root = currentRoot = createRoot([], input);
  13161. tokenizer.parse(currentInput);
  13162. root.loc = getLoc(0, input.length);
  13163. root.children = condenseWhitespace(root.children);
  13164. currentRoot = null;
  13165. return root;
  13166. }
  13167. function hoistStatic(root, context) {
  13168. walk(
  13169. root,
  13170. context,
  13171. // Root node is unfortunately non-hoistable due to potential parent
  13172. // fallthrough attributes.
  13173. isSingleElementRoot(root, root.children[0])
  13174. );
  13175. }
  13176. function isSingleElementRoot(root, child) {
  13177. const { children } = root;
  13178. return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
  13179. }
  13180. function walk(node, context, doNotHoistNode = false) {
  13181. const { children } = node;
  13182. const originalCount = children.length;
  13183. let hoistedCount = 0;
  13184. for (let i = 0; i < children.length; i++) {
  13185. const child = children[i];
  13186. if (child.type === 1 && child.tagType === 0) {
  13187. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  13188. if (constantType > 0) {
  13189. if (constantType >= 2) {
  13190. child.codegenNode.patchFlag = -1;
  13191. child.codegenNode = context.hoist(child.codegenNode);
  13192. hoistedCount++;
  13193. continue;
  13194. }
  13195. } else {
  13196. const codegenNode = child.codegenNode;
  13197. if (codegenNode.type === 13) {
  13198. const flag = codegenNode.patchFlag;
  13199. if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  13200. const props = getNodeProps(child);
  13201. if (props) {
  13202. codegenNode.props = context.hoist(props);
  13203. }
  13204. }
  13205. if (codegenNode.dynamicProps) {
  13206. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  13207. }
  13208. }
  13209. }
  13210. }
  13211. if (child.type === 1) {
  13212. const isComponent = child.tagType === 1;
  13213. if (isComponent) {
  13214. context.scopes.vSlot++;
  13215. }
  13216. walk(child, context);
  13217. if (isComponent) {
  13218. context.scopes.vSlot--;
  13219. }
  13220. } else if (child.type === 11) {
  13221. walk(child, context, child.children.length === 1);
  13222. } else if (child.type === 9) {
  13223. for (let i2 = 0; i2 < child.branches.length; i2++) {
  13224. walk(
  13225. child.branches[i2],
  13226. context,
  13227. child.branches[i2].children.length === 1
  13228. );
  13229. }
  13230. }
  13231. }
  13232. if (hoistedCount && context.transformHoist) {
  13233. context.transformHoist(children, context, node);
  13234. }
  13235. if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  13236. const hoisted = context.hoist(
  13237. createArrayExpression(node.codegenNode.children)
  13238. );
  13239. if (context.hmr) {
  13240. hoisted.content = `[...${hoisted.content}]`;
  13241. }
  13242. node.codegenNode.children = hoisted;
  13243. }
  13244. }
  13245. function getConstantType(node, context) {
  13246. const { constantCache } = context;
  13247. switch (node.type) {
  13248. case 1:
  13249. if (node.tagType !== 0) {
  13250. return 0;
  13251. }
  13252. const cached = constantCache.get(node);
  13253. if (cached !== void 0) {
  13254. return cached;
  13255. }
  13256. const codegenNode = node.codegenNode;
  13257. if (codegenNode.type !== 13) {
  13258. return 0;
  13259. }
  13260. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
  13261. return 0;
  13262. }
  13263. if (codegenNode.patchFlag === void 0) {
  13264. let returnType2 = 3;
  13265. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  13266. if (generatedPropsType === 0) {
  13267. constantCache.set(node, 0);
  13268. return 0;
  13269. }
  13270. if (generatedPropsType < returnType2) {
  13271. returnType2 = generatedPropsType;
  13272. }
  13273. for (let i = 0; i < node.children.length; i++) {
  13274. const childType = getConstantType(node.children[i], context);
  13275. if (childType === 0) {
  13276. constantCache.set(node, 0);
  13277. return 0;
  13278. }
  13279. if (childType < returnType2) {
  13280. returnType2 = childType;
  13281. }
  13282. }
  13283. if (returnType2 > 1) {
  13284. for (let i = 0; i < node.props.length; i++) {
  13285. const p = node.props[i];
  13286. if (p.type === 7 && p.name === "bind" && p.exp) {
  13287. const expType = getConstantType(p.exp, context);
  13288. if (expType === 0) {
  13289. constantCache.set(node, 0);
  13290. return 0;
  13291. }
  13292. if (expType < returnType2) {
  13293. returnType2 = expType;
  13294. }
  13295. }
  13296. }
  13297. }
  13298. if (codegenNode.isBlock) {
  13299. for (let i = 0; i < node.props.length; i++) {
  13300. const p = node.props[i];
  13301. if (p.type === 7) {
  13302. constantCache.set(node, 0);
  13303. return 0;
  13304. }
  13305. }
  13306. context.removeHelper(OPEN_BLOCK);
  13307. context.removeHelper(
  13308. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  13309. );
  13310. codegenNode.isBlock = false;
  13311. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  13312. }
  13313. constantCache.set(node, returnType2);
  13314. return returnType2;
  13315. } else {
  13316. constantCache.set(node, 0);
  13317. return 0;
  13318. }
  13319. case 2:
  13320. case 3:
  13321. return 3;
  13322. case 9:
  13323. case 11:
  13324. case 10:
  13325. return 0;
  13326. case 5:
  13327. case 12:
  13328. return getConstantType(node.content, context);
  13329. case 4:
  13330. return node.constType;
  13331. case 8:
  13332. let returnType = 3;
  13333. for (let i = 0; i < node.children.length; i++) {
  13334. const child = node.children[i];
  13335. if (isString(child) || isSymbol(child)) {
  13336. continue;
  13337. }
  13338. const childType = getConstantType(child, context);
  13339. if (childType === 0) {
  13340. return 0;
  13341. } else if (childType < returnType) {
  13342. returnType = childType;
  13343. }
  13344. }
  13345. return returnType;
  13346. default:
  13347. return 0;
  13348. }
  13349. }
  13350. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  13351. NORMALIZE_CLASS,
  13352. NORMALIZE_STYLE,
  13353. NORMALIZE_PROPS,
  13354. GUARD_REACTIVE_PROPS
  13355. ]);
  13356. function getConstantTypeOfHelperCall(value, context) {
  13357. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  13358. const arg = value.arguments[0];
  13359. if (arg.type === 4) {
  13360. return getConstantType(arg, context);
  13361. } else if (arg.type === 14) {
  13362. return getConstantTypeOfHelperCall(arg, context);
  13363. }
  13364. }
  13365. return 0;
  13366. }
  13367. function getGeneratedPropsConstantType(node, context) {
  13368. let returnType = 3;
  13369. const props = getNodeProps(node);
  13370. if (props && props.type === 15) {
  13371. const { properties } = props;
  13372. for (let i = 0; i < properties.length; i++) {
  13373. const { key, value } = properties[i];
  13374. const keyType = getConstantType(key, context);
  13375. if (keyType === 0) {
  13376. return keyType;
  13377. }
  13378. if (keyType < returnType) {
  13379. returnType = keyType;
  13380. }
  13381. let valueType;
  13382. if (value.type === 4) {
  13383. valueType = getConstantType(value, context);
  13384. } else if (value.type === 14) {
  13385. valueType = getConstantTypeOfHelperCall(value, context);
  13386. } else {
  13387. valueType = 0;
  13388. }
  13389. if (valueType === 0) {
  13390. return valueType;
  13391. }
  13392. if (valueType < returnType) {
  13393. returnType = valueType;
  13394. }
  13395. }
  13396. }
  13397. return returnType;
  13398. }
  13399. function getNodeProps(node) {
  13400. const codegenNode = node.codegenNode;
  13401. if (codegenNode.type === 13) {
  13402. return codegenNode.props;
  13403. }
  13404. }
  13405. function createTransformContext(root, {
  13406. filename = "",
  13407. prefixIdentifiers = false,
  13408. hoistStatic: hoistStatic2 = false,
  13409. hmr = false,
  13410. cacheHandlers = false,
  13411. nodeTransforms = [],
  13412. directiveTransforms = {},
  13413. transformHoist = null,
  13414. isBuiltInComponent = NOOP,
  13415. isCustomElement = NOOP,
  13416. expressionPlugins = [],
  13417. scopeId = null,
  13418. slotted = true,
  13419. ssr = false,
  13420. inSSR = false,
  13421. ssrCssVars = ``,
  13422. bindingMetadata = EMPTY_OBJ,
  13423. inline = false,
  13424. isTS = false,
  13425. onError = defaultOnError,
  13426. onWarn = defaultOnWarn,
  13427. compatConfig
  13428. }) {
  13429. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  13430. const context = {
  13431. // options
  13432. filename,
  13433. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  13434. prefixIdentifiers,
  13435. hoistStatic: hoistStatic2,
  13436. hmr,
  13437. cacheHandlers,
  13438. nodeTransforms,
  13439. directiveTransforms,
  13440. transformHoist,
  13441. isBuiltInComponent,
  13442. isCustomElement,
  13443. expressionPlugins,
  13444. scopeId,
  13445. slotted,
  13446. ssr,
  13447. inSSR,
  13448. ssrCssVars,
  13449. bindingMetadata,
  13450. inline,
  13451. isTS,
  13452. onError,
  13453. onWarn,
  13454. compatConfig,
  13455. // state
  13456. root,
  13457. helpers: /* @__PURE__ */ new Map(),
  13458. components: /* @__PURE__ */ new Set(),
  13459. directives: /* @__PURE__ */ new Set(),
  13460. hoists: [],
  13461. imports: [],
  13462. constantCache: /* @__PURE__ */ new WeakMap(),
  13463. temps: 0,
  13464. cached: 0,
  13465. identifiers: /* @__PURE__ */ Object.create(null),
  13466. scopes: {
  13467. vFor: 0,
  13468. vSlot: 0,
  13469. vPre: 0,
  13470. vOnce: 0
  13471. },
  13472. parent: null,
  13473. grandParent: null,
  13474. currentNode: root,
  13475. childIndex: 0,
  13476. inVOnce: false,
  13477. // methods
  13478. helper(name) {
  13479. const count = context.helpers.get(name) || 0;
  13480. context.helpers.set(name, count + 1);
  13481. return name;
  13482. },
  13483. removeHelper(name) {
  13484. const count = context.helpers.get(name);
  13485. if (count) {
  13486. const currentCount = count - 1;
  13487. if (!currentCount) {
  13488. context.helpers.delete(name);
  13489. } else {
  13490. context.helpers.set(name, currentCount);
  13491. }
  13492. }
  13493. },
  13494. helperString(name) {
  13495. return `_${helperNameMap[context.helper(name)]}`;
  13496. },
  13497. replaceNode(node) {
  13498. {
  13499. if (!context.currentNode) {
  13500. throw new Error(`Node being replaced is already removed.`);
  13501. }
  13502. if (!context.parent) {
  13503. throw new Error(`Cannot replace root node.`);
  13504. }
  13505. }
  13506. context.parent.children[context.childIndex] = context.currentNode = node;
  13507. },
  13508. removeNode(node) {
  13509. if (!context.parent) {
  13510. throw new Error(`Cannot remove root node.`);
  13511. }
  13512. const list = context.parent.children;
  13513. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  13514. if (removalIndex < 0) {
  13515. throw new Error(`node being removed is not a child of current parent`);
  13516. }
  13517. if (!node || node === context.currentNode) {
  13518. context.currentNode = null;
  13519. context.onNodeRemoved();
  13520. } else {
  13521. if (context.childIndex > removalIndex) {
  13522. context.childIndex--;
  13523. context.onNodeRemoved();
  13524. }
  13525. }
  13526. context.parent.children.splice(removalIndex, 1);
  13527. },
  13528. onNodeRemoved: NOOP,
  13529. addIdentifiers(exp) {
  13530. },
  13531. removeIdentifiers(exp) {
  13532. },
  13533. hoist(exp) {
  13534. if (isString(exp)) exp = createSimpleExpression(exp);
  13535. context.hoists.push(exp);
  13536. const identifier = createSimpleExpression(
  13537. `_hoisted_${context.hoists.length}`,
  13538. false,
  13539. exp.loc,
  13540. 2
  13541. );
  13542. identifier.hoisted = exp;
  13543. return identifier;
  13544. },
  13545. cache(exp, isVNode = false) {
  13546. return createCacheExpression(context.cached++, exp, isVNode);
  13547. }
  13548. };
  13549. return context;
  13550. }
  13551. function transform(root, options) {
  13552. const context = createTransformContext(root, options);
  13553. traverseNode(root, context);
  13554. if (options.hoistStatic) {
  13555. hoistStatic(root, context);
  13556. }
  13557. if (!options.ssr) {
  13558. createRootCodegen(root, context);
  13559. }
  13560. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  13561. root.components = [...context.components];
  13562. root.directives = [...context.directives];
  13563. root.imports = context.imports;
  13564. root.hoists = context.hoists;
  13565. root.temps = context.temps;
  13566. root.cached = context.cached;
  13567. root.transformed = true;
  13568. }
  13569. function createRootCodegen(root, context) {
  13570. const { helper } = context;
  13571. const { children } = root;
  13572. if (children.length === 1) {
  13573. const child = children[0];
  13574. if (isSingleElementRoot(root, child) && child.codegenNode) {
  13575. const codegenNode = child.codegenNode;
  13576. if (codegenNode.type === 13) {
  13577. convertToBlock(codegenNode, context);
  13578. }
  13579. root.codegenNode = codegenNode;
  13580. } else {
  13581. root.codegenNode = child;
  13582. }
  13583. } else if (children.length > 1) {
  13584. let patchFlag = 64;
  13585. let patchFlagText = PatchFlagNames[64];
  13586. if (children.filter((c) => c.type !== 3).length === 1) {
  13587. patchFlag |= 2048;
  13588. patchFlagText += `, ${PatchFlagNames[2048]}`;
  13589. }
  13590. root.codegenNode = createVNodeCall(
  13591. context,
  13592. helper(FRAGMENT),
  13593. void 0,
  13594. root.children,
  13595. patchFlag,
  13596. void 0,
  13597. void 0,
  13598. true,
  13599. void 0,
  13600. false
  13601. );
  13602. } else ;
  13603. }
  13604. function traverseChildren(parent, context) {
  13605. let i = 0;
  13606. const nodeRemoved = () => {
  13607. i--;
  13608. };
  13609. for (; i < parent.children.length; i++) {
  13610. const child = parent.children[i];
  13611. if (isString(child)) continue;
  13612. context.grandParent = context.parent;
  13613. context.parent = parent;
  13614. context.childIndex = i;
  13615. context.onNodeRemoved = nodeRemoved;
  13616. traverseNode(child, context);
  13617. }
  13618. }
  13619. function traverseNode(node, context) {
  13620. context.currentNode = node;
  13621. const { nodeTransforms } = context;
  13622. const exitFns = [];
  13623. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  13624. const onExit = nodeTransforms[i2](node, context);
  13625. if (onExit) {
  13626. if (isArray(onExit)) {
  13627. exitFns.push(...onExit);
  13628. } else {
  13629. exitFns.push(onExit);
  13630. }
  13631. }
  13632. if (!context.currentNode) {
  13633. return;
  13634. } else {
  13635. node = context.currentNode;
  13636. }
  13637. }
  13638. switch (node.type) {
  13639. case 3:
  13640. if (!context.ssr) {
  13641. context.helper(CREATE_COMMENT);
  13642. }
  13643. break;
  13644. case 5:
  13645. if (!context.ssr) {
  13646. context.helper(TO_DISPLAY_STRING);
  13647. }
  13648. break;
  13649. case 9:
  13650. for (let i2 = 0; i2 < node.branches.length; i2++) {
  13651. traverseNode(node.branches[i2], context);
  13652. }
  13653. break;
  13654. case 10:
  13655. case 11:
  13656. case 1:
  13657. case 0:
  13658. traverseChildren(node, context);
  13659. break;
  13660. }
  13661. context.currentNode = node;
  13662. let i = exitFns.length;
  13663. while (i--) {
  13664. exitFns[i]();
  13665. }
  13666. }
  13667. function createStructuralDirectiveTransform(name, fn) {
  13668. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  13669. return (node, context) => {
  13670. if (node.type === 1) {
  13671. const { props } = node;
  13672. if (node.tagType === 3 && props.some(isVSlot)) {
  13673. return;
  13674. }
  13675. const exitFns = [];
  13676. for (let i = 0; i < props.length; i++) {
  13677. const prop = props[i];
  13678. if (prop.type === 7 && matches(prop.name)) {
  13679. props.splice(i, 1);
  13680. i--;
  13681. const onExit = fn(node, prop, context);
  13682. if (onExit) exitFns.push(onExit);
  13683. }
  13684. }
  13685. return exitFns;
  13686. }
  13687. };
  13688. }
  13689. const PURE_ANNOTATION = `/*#__PURE__*/`;
  13690. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  13691. function createCodegenContext(ast, {
  13692. mode = "function",
  13693. prefixIdentifiers = mode === "module",
  13694. sourceMap = false,
  13695. filename = `template.vue.html`,
  13696. scopeId = null,
  13697. optimizeImports = false,
  13698. runtimeGlobalName = `Vue`,
  13699. runtimeModuleName = `vue`,
  13700. ssrRuntimeModuleName = "vue/server-renderer",
  13701. ssr = false,
  13702. isTS = false,
  13703. inSSR = false
  13704. }) {
  13705. const context = {
  13706. mode,
  13707. prefixIdentifiers,
  13708. sourceMap,
  13709. filename,
  13710. scopeId,
  13711. optimizeImports,
  13712. runtimeGlobalName,
  13713. runtimeModuleName,
  13714. ssrRuntimeModuleName,
  13715. ssr,
  13716. isTS,
  13717. inSSR,
  13718. source: ast.source,
  13719. code: ``,
  13720. column: 1,
  13721. line: 1,
  13722. offset: 0,
  13723. indentLevel: 0,
  13724. pure: false,
  13725. map: void 0,
  13726. helper(key) {
  13727. return `_${helperNameMap[key]}`;
  13728. },
  13729. push(code, newlineIndex = -2 /* None */, node) {
  13730. context.code += code;
  13731. },
  13732. indent() {
  13733. newline(++context.indentLevel);
  13734. },
  13735. deindent(withoutNewLine = false) {
  13736. if (withoutNewLine) {
  13737. --context.indentLevel;
  13738. } else {
  13739. newline(--context.indentLevel);
  13740. }
  13741. },
  13742. newline() {
  13743. newline(context.indentLevel);
  13744. }
  13745. };
  13746. function newline(n) {
  13747. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  13748. }
  13749. return context;
  13750. }
  13751. function generate(ast, options = {}) {
  13752. const context = createCodegenContext(ast, options);
  13753. if (options.onContextCreated) options.onContextCreated(context);
  13754. const {
  13755. mode,
  13756. push,
  13757. prefixIdentifiers,
  13758. indent,
  13759. deindent,
  13760. newline,
  13761. scopeId,
  13762. ssr
  13763. } = context;
  13764. const helpers = Array.from(ast.helpers);
  13765. const hasHelpers = helpers.length > 0;
  13766. const useWithBlock = !prefixIdentifiers && mode !== "module";
  13767. const preambleContext = context;
  13768. {
  13769. genFunctionPreamble(ast, preambleContext);
  13770. }
  13771. const functionName = ssr ? `ssrRender` : `render`;
  13772. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  13773. const signature = args.join(", ");
  13774. {
  13775. push(`function ${functionName}(${signature}) {`);
  13776. }
  13777. indent();
  13778. if (useWithBlock) {
  13779. push(`with (_ctx) {`);
  13780. indent();
  13781. if (hasHelpers) {
  13782. push(
  13783. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  13784. `,
  13785. -1 /* End */
  13786. );
  13787. newline();
  13788. }
  13789. }
  13790. if (ast.components.length) {
  13791. genAssets(ast.components, "component", context);
  13792. if (ast.directives.length || ast.temps > 0) {
  13793. newline();
  13794. }
  13795. }
  13796. if (ast.directives.length) {
  13797. genAssets(ast.directives, "directive", context);
  13798. if (ast.temps > 0) {
  13799. newline();
  13800. }
  13801. }
  13802. if (ast.temps > 0) {
  13803. push(`let `);
  13804. for (let i = 0; i < ast.temps; i++) {
  13805. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  13806. }
  13807. }
  13808. if (ast.components.length || ast.directives.length || ast.temps) {
  13809. push(`
  13810. `, 0 /* Start */);
  13811. newline();
  13812. }
  13813. if (!ssr) {
  13814. push(`return `);
  13815. }
  13816. if (ast.codegenNode) {
  13817. genNode(ast.codegenNode, context);
  13818. } else {
  13819. push(`null`);
  13820. }
  13821. if (useWithBlock) {
  13822. deindent();
  13823. push(`}`);
  13824. }
  13825. deindent();
  13826. push(`}`);
  13827. return {
  13828. ast,
  13829. code: context.code,
  13830. preamble: ``,
  13831. map: context.map ? context.map.toJSON() : void 0
  13832. };
  13833. }
  13834. function genFunctionPreamble(ast, context) {
  13835. const {
  13836. ssr,
  13837. prefixIdentifiers,
  13838. push,
  13839. newline,
  13840. runtimeModuleName,
  13841. runtimeGlobalName,
  13842. ssrRuntimeModuleName
  13843. } = context;
  13844. const VueBinding = runtimeGlobalName;
  13845. const helpers = Array.from(ast.helpers);
  13846. if (helpers.length > 0) {
  13847. {
  13848. push(`const _Vue = ${VueBinding}
  13849. `, -1 /* End */);
  13850. if (ast.hoists.length) {
  13851. const staticHelpers = [
  13852. CREATE_VNODE,
  13853. CREATE_ELEMENT_VNODE,
  13854. CREATE_COMMENT,
  13855. CREATE_TEXT,
  13856. CREATE_STATIC
  13857. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  13858. push(`const { ${staticHelpers} } = _Vue
  13859. `, -1 /* End */);
  13860. }
  13861. }
  13862. }
  13863. genHoists(ast.hoists, context);
  13864. newline();
  13865. push(`return `);
  13866. }
  13867. function genAssets(assets, type, { helper, push, newline, isTS }) {
  13868. const resolver = helper(
  13869. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  13870. );
  13871. for (let i = 0; i < assets.length; i++) {
  13872. let id = assets[i];
  13873. const maybeSelfReference = id.endsWith("__self");
  13874. if (maybeSelfReference) {
  13875. id = id.slice(0, -6);
  13876. }
  13877. push(
  13878. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  13879. );
  13880. if (i < assets.length - 1) {
  13881. newline();
  13882. }
  13883. }
  13884. }
  13885. function genHoists(hoists, context) {
  13886. if (!hoists.length) {
  13887. return;
  13888. }
  13889. context.pure = true;
  13890. const { push, newline, helper, scopeId, mode } = context;
  13891. newline();
  13892. for (let i = 0; i < hoists.length; i++) {
  13893. const exp = hoists[i];
  13894. if (exp) {
  13895. push(
  13896. `const _hoisted_${i + 1} = ${``}`
  13897. );
  13898. genNode(exp, context);
  13899. newline();
  13900. }
  13901. }
  13902. context.pure = false;
  13903. }
  13904. function isText(n) {
  13905. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  13906. }
  13907. function genNodeListAsArray(nodes, context) {
  13908. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  13909. context.push(`[`);
  13910. multilines && context.indent();
  13911. genNodeList(nodes, context, multilines);
  13912. multilines && context.deindent();
  13913. context.push(`]`);
  13914. }
  13915. function genNodeList(nodes, context, multilines = false, comma = true) {
  13916. const { push, newline } = context;
  13917. for (let i = 0; i < nodes.length; i++) {
  13918. const node = nodes[i];
  13919. if (isString(node)) {
  13920. push(node, -3 /* Unknown */);
  13921. } else if (isArray(node)) {
  13922. genNodeListAsArray(node, context);
  13923. } else {
  13924. genNode(node, context);
  13925. }
  13926. if (i < nodes.length - 1) {
  13927. if (multilines) {
  13928. comma && push(",");
  13929. newline();
  13930. } else {
  13931. comma && push(", ");
  13932. }
  13933. }
  13934. }
  13935. }
  13936. function genNode(node, context) {
  13937. if (isString(node)) {
  13938. context.push(node, -3 /* Unknown */);
  13939. return;
  13940. }
  13941. if (isSymbol(node)) {
  13942. context.push(context.helper(node));
  13943. return;
  13944. }
  13945. switch (node.type) {
  13946. case 1:
  13947. case 9:
  13948. case 11:
  13949. assert(
  13950. node.codegenNode != null,
  13951. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  13952. );
  13953. genNode(node.codegenNode, context);
  13954. break;
  13955. case 2:
  13956. genText(node, context);
  13957. break;
  13958. case 4:
  13959. genExpression(node, context);
  13960. break;
  13961. case 5:
  13962. genInterpolation(node, context);
  13963. break;
  13964. case 12:
  13965. genNode(node.codegenNode, context);
  13966. break;
  13967. case 8:
  13968. genCompoundExpression(node, context);
  13969. break;
  13970. case 3:
  13971. genComment(node, context);
  13972. break;
  13973. case 13:
  13974. genVNodeCall(node, context);
  13975. break;
  13976. case 14:
  13977. genCallExpression(node, context);
  13978. break;
  13979. case 15:
  13980. genObjectExpression(node, context);
  13981. break;
  13982. case 17:
  13983. genArrayExpression(node, context);
  13984. break;
  13985. case 18:
  13986. genFunctionExpression(node, context);
  13987. break;
  13988. case 19:
  13989. genConditionalExpression(node, context);
  13990. break;
  13991. case 20:
  13992. genCacheExpression(node, context);
  13993. break;
  13994. case 21:
  13995. genNodeList(node.body, context, true, false);
  13996. break;
  13997. case 22:
  13998. break;
  13999. case 23:
  14000. break;
  14001. case 24:
  14002. break;
  14003. case 25:
  14004. break;
  14005. case 26:
  14006. break;
  14007. case 10:
  14008. break;
  14009. default:
  14010. {
  14011. assert(false, `unhandled codegen node type: ${node.type}`);
  14012. const exhaustiveCheck = node;
  14013. return exhaustiveCheck;
  14014. }
  14015. }
  14016. }
  14017. function genText(node, context) {
  14018. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  14019. }
  14020. function genExpression(node, context) {
  14021. const { content, isStatic } = node;
  14022. context.push(
  14023. isStatic ? JSON.stringify(content) : content,
  14024. -3 /* Unknown */,
  14025. node
  14026. );
  14027. }
  14028. function genInterpolation(node, context) {
  14029. const { push, helper, pure } = context;
  14030. if (pure) push(PURE_ANNOTATION);
  14031. push(`${helper(TO_DISPLAY_STRING)}(`);
  14032. genNode(node.content, context);
  14033. push(`)`);
  14034. }
  14035. function genCompoundExpression(node, context) {
  14036. for (let i = 0; i < node.children.length; i++) {
  14037. const child = node.children[i];
  14038. if (isString(child)) {
  14039. context.push(child, -3 /* Unknown */);
  14040. } else {
  14041. genNode(child, context);
  14042. }
  14043. }
  14044. }
  14045. function genExpressionAsPropertyKey(node, context) {
  14046. const { push } = context;
  14047. if (node.type === 8) {
  14048. push(`[`);
  14049. genCompoundExpression(node, context);
  14050. push(`]`);
  14051. } else if (node.isStatic) {
  14052. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  14053. push(text, -2 /* None */, node);
  14054. } else {
  14055. push(`[${node.content}]`, -3 /* Unknown */, node);
  14056. }
  14057. }
  14058. function genComment(node, context) {
  14059. const { push, helper, pure } = context;
  14060. if (pure) {
  14061. push(PURE_ANNOTATION);
  14062. }
  14063. push(
  14064. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  14065. -3 /* Unknown */,
  14066. node
  14067. );
  14068. }
  14069. function genVNodeCall(node, context) {
  14070. const { push, helper, pure } = context;
  14071. const {
  14072. tag,
  14073. props,
  14074. children,
  14075. patchFlag,
  14076. dynamicProps,
  14077. directives,
  14078. isBlock,
  14079. disableTracking,
  14080. isComponent
  14081. } = node;
  14082. let patchFlagString;
  14083. if (patchFlag) {
  14084. {
  14085. if (patchFlag < 0) {
  14086. patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  14087. } else {
  14088. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  14089. patchFlagString = patchFlag + ` /* ${flagNames} */`;
  14090. }
  14091. }
  14092. }
  14093. if (directives) {
  14094. push(helper(WITH_DIRECTIVES) + `(`);
  14095. }
  14096. if (isBlock) {
  14097. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  14098. }
  14099. if (pure) {
  14100. push(PURE_ANNOTATION);
  14101. }
  14102. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  14103. push(helper(callHelper) + `(`, -2 /* None */, node);
  14104. genNodeList(
  14105. genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
  14106. context
  14107. );
  14108. push(`)`);
  14109. if (isBlock) {
  14110. push(`)`);
  14111. }
  14112. if (directives) {
  14113. push(`, `);
  14114. genNode(directives, context);
  14115. push(`)`);
  14116. }
  14117. }
  14118. function genNullableArgs(args) {
  14119. let i = args.length;
  14120. while (i--) {
  14121. if (args[i] != null) break;
  14122. }
  14123. return args.slice(0, i + 1).map((arg) => arg || `null`);
  14124. }
  14125. function genCallExpression(node, context) {
  14126. const { push, helper, pure } = context;
  14127. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  14128. if (pure) {
  14129. push(PURE_ANNOTATION);
  14130. }
  14131. push(callee + `(`, -2 /* None */, node);
  14132. genNodeList(node.arguments, context);
  14133. push(`)`);
  14134. }
  14135. function genObjectExpression(node, context) {
  14136. const { push, indent, deindent, newline } = context;
  14137. const { properties } = node;
  14138. if (!properties.length) {
  14139. push(`{}`, -2 /* None */, node);
  14140. return;
  14141. }
  14142. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  14143. push(multilines ? `{` : `{ `);
  14144. multilines && indent();
  14145. for (let i = 0; i < properties.length; i++) {
  14146. const { key, value } = properties[i];
  14147. genExpressionAsPropertyKey(key, context);
  14148. push(`: `);
  14149. genNode(value, context);
  14150. if (i < properties.length - 1) {
  14151. push(`,`);
  14152. newline();
  14153. }
  14154. }
  14155. multilines && deindent();
  14156. push(multilines ? `}` : ` }`);
  14157. }
  14158. function genArrayExpression(node, context) {
  14159. genNodeListAsArray(node.elements, context);
  14160. }
  14161. function genFunctionExpression(node, context) {
  14162. const { push, indent, deindent } = context;
  14163. const { params, returns, body, newline, isSlot } = node;
  14164. if (isSlot) {
  14165. push(`_${helperNameMap[WITH_CTX]}(`);
  14166. }
  14167. push(`(`, -2 /* None */, node);
  14168. if (isArray(params)) {
  14169. genNodeList(params, context);
  14170. } else if (params) {
  14171. genNode(params, context);
  14172. }
  14173. push(`) => `);
  14174. if (newline || body) {
  14175. push(`{`);
  14176. indent();
  14177. }
  14178. if (returns) {
  14179. if (newline) {
  14180. push(`return `);
  14181. }
  14182. if (isArray(returns)) {
  14183. genNodeListAsArray(returns, context);
  14184. } else {
  14185. genNode(returns, context);
  14186. }
  14187. } else if (body) {
  14188. genNode(body, context);
  14189. }
  14190. if (newline || body) {
  14191. deindent();
  14192. push(`}`);
  14193. }
  14194. if (isSlot) {
  14195. push(`)`);
  14196. }
  14197. }
  14198. function genConditionalExpression(node, context) {
  14199. const { test, consequent, alternate, newline: needNewline } = node;
  14200. const { push, indent, deindent, newline } = context;
  14201. if (test.type === 4) {
  14202. const needsParens = !isSimpleIdentifier(test.content);
  14203. needsParens && push(`(`);
  14204. genExpression(test, context);
  14205. needsParens && push(`)`);
  14206. } else {
  14207. push(`(`);
  14208. genNode(test, context);
  14209. push(`)`);
  14210. }
  14211. needNewline && indent();
  14212. context.indentLevel++;
  14213. needNewline || push(` `);
  14214. push(`? `);
  14215. genNode(consequent, context);
  14216. context.indentLevel--;
  14217. needNewline && newline();
  14218. needNewline || push(` `);
  14219. push(`: `);
  14220. const isNested = alternate.type === 19;
  14221. if (!isNested) {
  14222. context.indentLevel++;
  14223. }
  14224. genNode(alternate, context);
  14225. if (!isNested) {
  14226. context.indentLevel--;
  14227. }
  14228. needNewline && deindent(
  14229. true
  14230. /* without newline */
  14231. );
  14232. }
  14233. function genCacheExpression(node, context) {
  14234. const { push, helper, indent, deindent, newline } = context;
  14235. push(`_cache[${node.index}] || (`);
  14236. if (node.isVOnce) {
  14237. indent();
  14238. push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
  14239. newline();
  14240. push(`(`);
  14241. }
  14242. push(`_cache[${node.index}] = `);
  14243. genNode(node.value, context);
  14244. if (node.isVOnce) {
  14245. push(`).cacheIndex = ${node.index},`);
  14246. newline();
  14247. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  14248. newline();
  14249. push(`_cache[${node.index}]`);
  14250. deindent();
  14251. }
  14252. push(`)`);
  14253. }
  14254. const prohibitedKeywordRE = new RegExp(
  14255. "\\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"
  14256. );
  14257. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  14258. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  14259. const exp = node.content;
  14260. if (!exp.trim()) {
  14261. return;
  14262. }
  14263. try {
  14264. new Function(
  14265. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  14266. );
  14267. } catch (e) {
  14268. let message = e.message;
  14269. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  14270. if (keywordMatch) {
  14271. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  14272. }
  14273. context.onError(
  14274. createCompilerError(
  14275. 45,
  14276. node.loc,
  14277. void 0,
  14278. message
  14279. )
  14280. );
  14281. }
  14282. }
  14283. const transformExpression = (node, context) => {
  14284. if (node.type === 5) {
  14285. node.content = processExpression(
  14286. node.content,
  14287. context
  14288. );
  14289. } else if (node.type === 1) {
  14290. for (let i = 0; i < node.props.length; i++) {
  14291. const dir = node.props[i];
  14292. if (dir.type === 7 && dir.name !== "for") {
  14293. const exp = dir.exp;
  14294. const arg = dir.arg;
  14295. if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
  14296. dir.exp = processExpression(
  14297. exp,
  14298. context,
  14299. // slot args must be processed as function params
  14300. dir.name === "slot"
  14301. );
  14302. }
  14303. if (arg && arg.type === 4 && !arg.isStatic) {
  14304. dir.arg = processExpression(arg, context);
  14305. }
  14306. }
  14307. }
  14308. }
  14309. };
  14310. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  14311. {
  14312. {
  14313. validateBrowserExpression(node, context, asParams, asRawStatements);
  14314. }
  14315. return node;
  14316. }
  14317. }
  14318. const transformIf = createStructuralDirectiveTransform(
  14319. /^(if|else|else-if)$/,
  14320. (node, dir, context) => {
  14321. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  14322. const siblings = context.parent.children;
  14323. let i = siblings.indexOf(ifNode);
  14324. let key = 0;
  14325. while (i-- >= 0) {
  14326. const sibling = siblings[i];
  14327. if (sibling && sibling.type === 9) {
  14328. key += sibling.branches.length;
  14329. }
  14330. }
  14331. return () => {
  14332. if (isRoot) {
  14333. ifNode.codegenNode = createCodegenNodeForBranch(
  14334. branch,
  14335. key,
  14336. context
  14337. );
  14338. } else {
  14339. const parentCondition = getParentCondition(ifNode.codegenNode);
  14340. parentCondition.alternate = createCodegenNodeForBranch(
  14341. branch,
  14342. key + ifNode.branches.length - 1,
  14343. context
  14344. );
  14345. }
  14346. };
  14347. });
  14348. }
  14349. );
  14350. function processIf(node, dir, context, processCodegen) {
  14351. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  14352. const loc = dir.exp ? dir.exp.loc : node.loc;
  14353. context.onError(
  14354. createCompilerError(28, dir.loc)
  14355. );
  14356. dir.exp = createSimpleExpression(`true`, false, loc);
  14357. }
  14358. if (dir.exp) {
  14359. validateBrowserExpression(dir.exp, context);
  14360. }
  14361. if (dir.name === "if") {
  14362. const branch = createIfBranch(node, dir);
  14363. const ifNode = {
  14364. type: 9,
  14365. loc: node.loc,
  14366. branches: [branch]
  14367. };
  14368. context.replaceNode(ifNode);
  14369. if (processCodegen) {
  14370. return processCodegen(ifNode, branch, true);
  14371. }
  14372. } else {
  14373. const siblings = context.parent.children;
  14374. const comments = [];
  14375. let i = siblings.indexOf(node);
  14376. while (i-- >= -1) {
  14377. const sibling = siblings[i];
  14378. if (sibling && sibling.type === 3) {
  14379. context.removeNode(sibling);
  14380. comments.unshift(sibling);
  14381. continue;
  14382. }
  14383. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  14384. context.removeNode(sibling);
  14385. continue;
  14386. }
  14387. if (sibling && sibling.type === 9) {
  14388. if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  14389. context.onError(
  14390. createCompilerError(30, node.loc)
  14391. );
  14392. }
  14393. context.removeNode();
  14394. const branch = createIfBranch(node, dir);
  14395. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  14396. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  14397. branch.children = [...comments, ...branch.children];
  14398. }
  14399. {
  14400. const key = branch.userKey;
  14401. if (key) {
  14402. sibling.branches.forEach(({ userKey }) => {
  14403. if (isSameKey(userKey, key)) {
  14404. context.onError(
  14405. createCompilerError(
  14406. 29,
  14407. branch.userKey.loc
  14408. )
  14409. );
  14410. }
  14411. });
  14412. }
  14413. }
  14414. sibling.branches.push(branch);
  14415. const onExit = processCodegen && processCodegen(sibling, branch, false);
  14416. traverseNode(branch, context);
  14417. if (onExit) onExit();
  14418. context.currentNode = null;
  14419. } else {
  14420. context.onError(
  14421. createCompilerError(30, node.loc)
  14422. );
  14423. }
  14424. break;
  14425. }
  14426. }
  14427. }
  14428. function createIfBranch(node, dir) {
  14429. const isTemplateIf = node.tagType === 3;
  14430. return {
  14431. type: 10,
  14432. loc: node.loc,
  14433. condition: dir.name === "else" ? void 0 : dir.exp,
  14434. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  14435. userKey: findProp(node, `key`),
  14436. isTemplateIf
  14437. };
  14438. }
  14439. function createCodegenNodeForBranch(branch, keyIndex, context) {
  14440. if (branch.condition) {
  14441. return createConditionalExpression(
  14442. branch.condition,
  14443. createChildrenCodegenNode(branch, keyIndex, context),
  14444. // make sure to pass in asBlock: true so that the comment node call
  14445. // closes the current block.
  14446. createCallExpression(context.helper(CREATE_COMMENT), [
  14447. '"v-if"' ,
  14448. "true"
  14449. ])
  14450. );
  14451. } else {
  14452. return createChildrenCodegenNode(branch, keyIndex, context);
  14453. }
  14454. }
  14455. function createChildrenCodegenNode(branch, keyIndex, context) {
  14456. const { helper } = context;
  14457. const keyProperty = createObjectProperty(
  14458. `key`,
  14459. createSimpleExpression(
  14460. `${keyIndex}`,
  14461. false,
  14462. locStub,
  14463. 2
  14464. )
  14465. );
  14466. const { children } = branch;
  14467. const firstChild = children[0];
  14468. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  14469. if (needFragmentWrapper) {
  14470. if (children.length === 1 && firstChild.type === 11) {
  14471. const vnodeCall = firstChild.codegenNode;
  14472. injectProp(vnodeCall, keyProperty, context);
  14473. return vnodeCall;
  14474. } else {
  14475. let patchFlag = 64;
  14476. let patchFlagText = PatchFlagNames[64];
  14477. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  14478. patchFlag |= 2048;
  14479. patchFlagText += `, ${PatchFlagNames[2048]}`;
  14480. }
  14481. return createVNodeCall(
  14482. context,
  14483. helper(FRAGMENT),
  14484. createObjectExpression([keyProperty]),
  14485. children,
  14486. patchFlag,
  14487. void 0,
  14488. void 0,
  14489. true,
  14490. false,
  14491. false,
  14492. branch.loc
  14493. );
  14494. }
  14495. } else {
  14496. const ret = firstChild.codegenNode;
  14497. const vnodeCall = getMemoedVNodeCall(ret);
  14498. if (vnodeCall.type === 13) {
  14499. convertToBlock(vnodeCall, context);
  14500. }
  14501. injectProp(vnodeCall, keyProperty, context);
  14502. return ret;
  14503. }
  14504. }
  14505. function isSameKey(a, b) {
  14506. if (!a || a.type !== b.type) {
  14507. return false;
  14508. }
  14509. if (a.type === 6) {
  14510. if (a.value.content !== b.value.content) {
  14511. return false;
  14512. }
  14513. } else {
  14514. const exp = a.exp;
  14515. const branchExp = b.exp;
  14516. if (exp.type !== branchExp.type) {
  14517. return false;
  14518. }
  14519. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  14520. return false;
  14521. }
  14522. }
  14523. return true;
  14524. }
  14525. function getParentCondition(node) {
  14526. while (true) {
  14527. if (node.type === 19) {
  14528. if (node.alternate.type === 19) {
  14529. node = node.alternate;
  14530. } else {
  14531. return node;
  14532. }
  14533. } else if (node.type === 20) {
  14534. node = node.value;
  14535. }
  14536. }
  14537. }
  14538. const transformBind = (dir, _node, context) => {
  14539. const { modifiers, loc } = dir;
  14540. const arg = dir.arg;
  14541. let { exp } = dir;
  14542. if (exp && exp.type === 4 && !exp.content.trim()) {
  14543. {
  14544. exp = void 0;
  14545. }
  14546. }
  14547. if (!exp) {
  14548. if (arg.type !== 4 || !arg.isStatic) {
  14549. context.onError(
  14550. createCompilerError(
  14551. 52,
  14552. arg.loc
  14553. )
  14554. );
  14555. return {
  14556. props: [
  14557. createObjectProperty(arg, createSimpleExpression("", true, loc))
  14558. ]
  14559. };
  14560. }
  14561. transformBindShorthand(dir);
  14562. exp = dir.exp;
  14563. }
  14564. if (arg.type !== 4) {
  14565. arg.children.unshift(`(`);
  14566. arg.children.push(`) || ""`);
  14567. } else if (!arg.isStatic) {
  14568. arg.content = `${arg.content} || ""`;
  14569. }
  14570. if (modifiers.includes("camel")) {
  14571. if (arg.type === 4) {
  14572. if (arg.isStatic) {
  14573. arg.content = camelize(arg.content);
  14574. } else {
  14575. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  14576. }
  14577. } else {
  14578. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  14579. arg.children.push(`)`);
  14580. }
  14581. }
  14582. if (!context.inSSR) {
  14583. if (modifiers.includes("prop")) {
  14584. injectPrefix(arg, ".");
  14585. }
  14586. if (modifiers.includes("attr")) {
  14587. injectPrefix(arg, "^");
  14588. }
  14589. }
  14590. return {
  14591. props: [createObjectProperty(arg, exp)]
  14592. };
  14593. };
  14594. const transformBindShorthand = (dir, context) => {
  14595. const arg = dir.arg;
  14596. const propName = camelize(arg.content);
  14597. dir.exp = createSimpleExpression(propName, false, arg.loc);
  14598. };
  14599. const injectPrefix = (arg, prefix) => {
  14600. if (arg.type === 4) {
  14601. if (arg.isStatic) {
  14602. arg.content = prefix + arg.content;
  14603. } else {
  14604. arg.content = `\`${prefix}\${${arg.content}}\``;
  14605. }
  14606. } else {
  14607. arg.children.unshift(`'${prefix}' + (`);
  14608. arg.children.push(`)`);
  14609. }
  14610. };
  14611. const transformFor = createStructuralDirectiveTransform(
  14612. "for",
  14613. (node, dir, context) => {
  14614. const { helper, removeHelper } = context;
  14615. return processFor(node, dir, context, (forNode) => {
  14616. const renderExp = createCallExpression(helper(RENDER_LIST), [
  14617. forNode.source
  14618. ]);
  14619. const isTemplate = isTemplateNode(node);
  14620. const memo = findDir(node, "memo");
  14621. const keyProp = findProp(node, `key`, false, true);
  14622. if (keyProp && keyProp.type === 7 && !keyProp.exp) {
  14623. transformBindShorthand(keyProp);
  14624. }
  14625. const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
  14626. const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
  14627. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  14628. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  14629. forNode.codegenNode = createVNodeCall(
  14630. context,
  14631. helper(FRAGMENT),
  14632. void 0,
  14633. renderExp,
  14634. fragmentFlag,
  14635. void 0,
  14636. void 0,
  14637. true,
  14638. !isStableFragment,
  14639. false,
  14640. node.loc
  14641. );
  14642. return () => {
  14643. let childBlock;
  14644. const { children } = forNode;
  14645. if (isTemplate) {
  14646. node.children.some((c) => {
  14647. if (c.type === 1) {
  14648. const key = findProp(c, "key");
  14649. if (key) {
  14650. context.onError(
  14651. createCompilerError(
  14652. 33,
  14653. key.loc
  14654. )
  14655. );
  14656. return true;
  14657. }
  14658. }
  14659. });
  14660. }
  14661. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  14662. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  14663. if (slotOutlet) {
  14664. childBlock = slotOutlet.codegenNode;
  14665. if (isTemplate && keyProperty) {
  14666. injectProp(childBlock, keyProperty, context);
  14667. }
  14668. } else if (needFragmentWrapper) {
  14669. childBlock = createVNodeCall(
  14670. context,
  14671. helper(FRAGMENT),
  14672. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  14673. node.children,
  14674. 64,
  14675. void 0,
  14676. void 0,
  14677. true,
  14678. void 0,
  14679. false
  14680. );
  14681. } else {
  14682. childBlock = children[0].codegenNode;
  14683. if (isTemplate && keyProperty) {
  14684. injectProp(childBlock, keyProperty, context);
  14685. }
  14686. if (childBlock.isBlock !== !isStableFragment) {
  14687. if (childBlock.isBlock) {
  14688. removeHelper(OPEN_BLOCK);
  14689. removeHelper(
  14690. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  14691. );
  14692. } else {
  14693. removeHelper(
  14694. getVNodeHelper(context.inSSR, childBlock.isComponent)
  14695. );
  14696. }
  14697. }
  14698. childBlock.isBlock = !isStableFragment;
  14699. if (childBlock.isBlock) {
  14700. helper(OPEN_BLOCK);
  14701. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  14702. } else {
  14703. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  14704. }
  14705. }
  14706. if (memo) {
  14707. const loop = createFunctionExpression(
  14708. createForLoopParams(forNode.parseResult, [
  14709. createSimpleExpression(`_cached`)
  14710. ])
  14711. );
  14712. loop.body = createBlockStatement([
  14713. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  14714. createCompoundExpression([
  14715. `if (_cached`,
  14716. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  14717. ` && ${context.helperString(
  14718. IS_MEMO_SAME
  14719. )}(_cached, _memo)) return _cached`
  14720. ]),
  14721. createCompoundExpression([`const _item = `, childBlock]),
  14722. createSimpleExpression(`_item.memo = _memo`),
  14723. createSimpleExpression(`return _item`)
  14724. ]);
  14725. renderExp.arguments.push(
  14726. loop,
  14727. createSimpleExpression(`_cache`),
  14728. createSimpleExpression(String(context.cached++))
  14729. );
  14730. } else {
  14731. renderExp.arguments.push(
  14732. createFunctionExpression(
  14733. createForLoopParams(forNode.parseResult),
  14734. childBlock,
  14735. true
  14736. )
  14737. );
  14738. }
  14739. };
  14740. });
  14741. }
  14742. );
  14743. function processFor(node, dir, context, processCodegen) {
  14744. if (!dir.exp) {
  14745. context.onError(
  14746. createCompilerError(31, dir.loc)
  14747. );
  14748. return;
  14749. }
  14750. const parseResult = dir.forParseResult;
  14751. if (!parseResult) {
  14752. context.onError(
  14753. createCompilerError(32, dir.loc)
  14754. );
  14755. return;
  14756. }
  14757. finalizeForParseResult(parseResult, context);
  14758. const { addIdentifiers, removeIdentifiers, scopes } = context;
  14759. const { source, value, key, index } = parseResult;
  14760. const forNode = {
  14761. type: 11,
  14762. loc: dir.loc,
  14763. source,
  14764. valueAlias: value,
  14765. keyAlias: key,
  14766. objectIndexAlias: index,
  14767. parseResult,
  14768. children: isTemplateNode(node) ? node.children : [node]
  14769. };
  14770. context.replaceNode(forNode);
  14771. scopes.vFor++;
  14772. const onExit = processCodegen && processCodegen(forNode);
  14773. return () => {
  14774. scopes.vFor--;
  14775. if (onExit) onExit();
  14776. };
  14777. }
  14778. function finalizeForParseResult(result, context) {
  14779. if (result.finalized) return;
  14780. {
  14781. validateBrowserExpression(result.source, context);
  14782. if (result.key) {
  14783. validateBrowserExpression(
  14784. result.key,
  14785. context,
  14786. true
  14787. );
  14788. }
  14789. if (result.index) {
  14790. validateBrowserExpression(
  14791. result.index,
  14792. context,
  14793. true
  14794. );
  14795. }
  14796. if (result.value) {
  14797. validateBrowserExpression(
  14798. result.value,
  14799. context,
  14800. true
  14801. );
  14802. }
  14803. }
  14804. result.finalized = true;
  14805. }
  14806. function createForLoopParams({ value, key, index }, memoArgs = []) {
  14807. return createParamsList([value, key, index, ...memoArgs]);
  14808. }
  14809. function createParamsList(args) {
  14810. let i = args.length;
  14811. while (i--) {
  14812. if (args[i]) break;
  14813. }
  14814. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  14815. }
  14816. const defaultFallback = createSimpleExpression(`undefined`, false);
  14817. const trackSlotScopes = (node, context) => {
  14818. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  14819. const vSlot = findDir(node, "slot");
  14820. if (vSlot) {
  14821. vSlot.exp;
  14822. context.scopes.vSlot++;
  14823. return () => {
  14824. context.scopes.vSlot--;
  14825. };
  14826. }
  14827. }
  14828. };
  14829. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  14830. props,
  14831. children,
  14832. false,
  14833. true,
  14834. children.length ? children[0].loc : loc
  14835. );
  14836. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  14837. context.helper(WITH_CTX);
  14838. const { children, loc } = node;
  14839. const slotsProperties = [];
  14840. const dynamicSlots = [];
  14841. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  14842. const onComponentSlot = findDir(node, "slot", true);
  14843. if (onComponentSlot) {
  14844. const { arg, exp } = onComponentSlot;
  14845. if (arg && !isStaticExp(arg)) {
  14846. hasDynamicSlots = true;
  14847. }
  14848. slotsProperties.push(
  14849. createObjectProperty(
  14850. arg || createSimpleExpression("default", true),
  14851. buildSlotFn(exp, void 0, children, loc)
  14852. )
  14853. );
  14854. }
  14855. let hasTemplateSlots = false;
  14856. let hasNamedDefaultSlot = false;
  14857. const implicitDefaultChildren = [];
  14858. const seenSlotNames = /* @__PURE__ */ new Set();
  14859. let conditionalBranchIndex = 0;
  14860. for (let i = 0; i < children.length; i++) {
  14861. const slotElement = children[i];
  14862. let slotDir;
  14863. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  14864. if (slotElement.type !== 3) {
  14865. implicitDefaultChildren.push(slotElement);
  14866. }
  14867. continue;
  14868. }
  14869. if (onComponentSlot) {
  14870. context.onError(
  14871. createCompilerError(37, slotDir.loc)
  14872. );
  14873. break;
  14874. }
  14875. hasTemplateSlots = true;
  14876. const { children: slotChildren, loc: slotLoc } = slotElement;
  14877. const {
  14878. arg: slotName = createSimpleExpression(`default`, true),
  14879. exp: slotProps,
  14880. loc: dirLoc
  14881. } = slotDir;
  14882. let staticSlotName;
  14883. if (isStaticExp(slotName)) {
  14884. staticSlotName = slotName ? slotName.content : `default`;
  14885. } else {
  14886. hasDynamicSlots = true;
  14887. }
  14888. const vFor = findDir(slotElement, "for");
  14889. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  14890. let vIf;
  14891. let vElse;
  14892. if (vIf = findDir(slotElement, "if")) {
  14893. hasDynamicSlots = true;
  14894. dynamicSlots.push(
  14895. createConditionalExpression(
  14896. vIf.exp,
  14897. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  14898. defaultFallback
  14899. )
  14900. );
  14901. } else if (vElse = findDir(
  14902. slotElement,
  14903. /^else(-if)?$/,
  14904. true
  14905. /* allowEmpty */
  14906. )) {
  14907. let j = i;
  14908. let prev;
  14909. while (j--) {
  14910. prev = children[j];
  14911. if (prev.type !== 3) {
  14912. break;
  14913. }
  14914. }
  14915. if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
  14916. let conditional = dynamicSlots[dynamicSlots.length - 1];
  14917. while (conditional.alternate.type === 19) {
  14918. conditional = conditional.alternate;
  14919. }
  14920. conditional.alternate = vElse.exp ? createConditionalExpression(
  14921. vElse.exp,
  14922. buildDynamicSlot(
  14923. slotName,
  14924. slotFunction,
  14925. conditionalBranchIndex++
  14926. ),
  14927. defaultFallback
  14928. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  14929. } else {
  14930. context.onError(
  14931. createCompilerError(30, vElse.loc)
  14932. );
  14933. }
  14934. } else if (vFor) {
  14935. hasDynamicSlots = true;
  14936. const parseResult = vFor.forParseResult;
  14937. if (parseResult) {
  14938. finalizeForParseResult(parseResult, context);
  14939. dynamicSlots.push(
  14940. createCallExpression(context.helper(RENDER_LIST), [
  14941. parseResult.source,
  14942. createFunctionExpression(
  14943. createForLoopParams(parseResult),
  14944. buildDynamicSlot(slotName, slotFunction),
  14945. true
  14946. )
  14947. ])
  14948. );
  14949. } else {
  14950. context.onError(
  14951. createCompilerError(
  14952. 32,
  14953. vFor.loc
  14954. )
  14955. );
  14956. }
  14957. } else {
  14958. if (staticSlotName) {
  14959. if (seenSlotNames.has(staticSlotName)) {
  14960. context.onError(
  14961. createCompilerError(
  14962. 38,
  14963. dirLoc
  14964. )
  14965. );
  14966. continue;
  14967. }
  14968. seenSlotNames.add(staticSlotName);
  14969. if (staticSlotName === "default") {
  14970. hasNamedDefaultSlot = true;
  14971. }
  14972. }
  14973. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  14974. }
  14975. }
  14976. if (!onComponentSlot) {
  14977. const buildDefaultSlotProperty = (props, children2) => {
  14978. const fn = buildSlotFn(props, void 0, children2, loc);
  14979. return createObjectProperty(`default`, fn);
  14980. };
  14981. if (!hasTemplateSlots) {
  14982. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  14983. } else if (implicitDefaultChildren.length && // #3766
  14984. // with whitespace: 'preserve', whitespaces between slots will end up in
  14985. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  14986. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  14987. if (hasNamedDefaultSlot) {
  14988. context.onError(
  14989. createCompilerError(
  14990. 39,
  14991. implicitDefaultChildren[0].loc
  14992. )
  14993. );
  14994. } else {
  14995. slotsProperties.push(
  14996. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  14997. );
  14998. }
  14999. }
  15000. }
  15001. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  15002. let slots = createObjectExpression(
  15003. slotsProperties.concat(
  15004. createObjectProperty(
  15005. `_`,
  15006. // 2 = compiled but dynamic = can skip normalization, but must run diff
  15007. // 1 = compiled and static = can skip normalization AND diff as optimized
  15008. createSimpleExpression(
  15009. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  15010. false
  15011. )
  15012. )
  15013. ),
  15014. loc
  15015. );
  15016. if (dynamicSlots.length) {
  15017. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  15018. slots,
  15019. createArrayExpression(dynamicSlots)
  15020. ]);
  15021. }
  15022. return {
  15023. slots,
  15024. hasDynamicSlots
  15025. };
  15026. }
  15027. function buildDynamicSlot(name, fn, index) {
  15028. const props = [
  15029. createObjectProperty(`name`, name),
  15030. createObjectProperty(`fn`, fn)
  15031. ];
  15032. if (index != null) {
  15033. props.push(
  15034. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  15035. );
  15036. }
  15037. return createObjectExpression(props);
  15038. }
  15039. function hasForwardedSlots(children) {
  15040. for (let i = 0; i < children.length; i++) {
  15041. const child = children[i];
  15042. switch (child.type) {
  15043. case 1:
  15044. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  15045. return true;
  15046. }
  15047. break;
  15048. case 9:
  15049. if (hasForwardedSlots(child.branches)) return true;
  15050. break;
  15051. case 10:
  15052. case 11:
  15053. if (hasForwardedSlots(child.children)) return true;
  15054. break;
  15055. }
  15056. }
  15057. return false;
  15058. }
  15059. function isNonWhitespaceContent(node) {
  15060. if (node.type !== 2 && node.type !== 12)
  15061. return true;
  15062. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  15063. }
  15064. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  15065. const transformElement = (node, context) => {
  15066. return function postTransformElement() {
  15067. node = context.currentNode;
  15068. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  15069. return;
  15070. }
  15071. const { tag, props } = node;
  15072. const isComponent = node.tagType === 1;
  15073. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  15074. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  15075. let vnodeProps;
  15076. let vnodeChildren;
  15077. let patchFlag = 0;
  15078. let vnodeDynamicProps;
  15079. let dynamicPropNames;
  15080. let vnodeDirectives;
  15081. let shouldUseBlock = (
  15082. // dynamic component may resolve to plain elements
  15083. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  15084. // updates inside get proper isSVG flag at runtime. (#639, #643)
  15085. // This is technically web-specific, but splitting the logic out of core
  15086. // leads to too much unnecessary complexity.
  15087. (tag === "svg" || tag === "foreignObject" || tag === "math")
  15088. );
  15089. if (props.length > 0) {
  15090. const propsBuildResult = buildProps(
  15091. node,
  15092. context,
  15093. void 0,
  15094. isComponent,
  15095. isDynamicComponent
  15096. );
  15097. vnodeProps = propsBuildResult.props;
  15098. patchFlag = propsBuildResult.patchFlag;
  15099. dynamicPropNames = propsBuildResult.dynamicPropNames;
  15100. const directives = propsBuildResult.directives;
  15101. vnodeDirectives = directives && directives.length ? createArrayExpression(
  15102. directives.map((dir) => buildDirectiveArgs(dir, context))
  15103. ) : void 0;
  15104. if (propsBuildResult.shouldUseBlock) {
  15105. shouldUseBlock = true;
  15106. }
  15107. }
  15108. if (node.children.length > 0) {
  15109. if (vnodeTag === KEEP_ALIVE) {
  15110. shouldUseBlock = true;
  15111. patchFlag |= 1024;
  15112. if (node.children.length > 1) {
  15113. context.onError(
  15114. createCompilerError(46, {
  15115. start: node.children[0].loc.start,
  15116. end: node.children[node.children.length - 1].loc.end,
  15117. source: ""
  15118. })
  15119. );
  15120. }
  15121. }
  15122. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  15123. vnodeTag !== TELEPORT && // explained above.
  15124. vnodeTag !== KEEP_ALIVE;
  15125. if (shouldBuildAsSlots) {
  15126. const { slots, hasDynamicSlots } = buildSlots(node, context);
  15127. vnodeChildren = slots;
  15128. if (hasDynamicSlots) {
  15129. patchFlag |= 1024;
  15130. }
  15131. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  15132. const child = node.children[0];
  15133. const type = child.type;
  15134. const hasDynamicTextChild = type === 5 || type === 8;
  15135. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  15136. patchFlag |= 1;
  15137. }
  15138. if (hasDynamicTextChild || type === 2) {
  15139. vnodeChildren = child;
  15140. } else {
  15141. vnodeChildren = node.children;
  15142. }
  15143. } else {
  15144. vnodeChildren = node.children;
  15145. }
  15146. }
  15147. if (dynamicPropNames && dynamicPropNames.length) {
  15148. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  15149. }
  15150. node.codegenNode = createVNodeCall(
  15151. context,
  15152. vnodeTag,
  15153. vnodeProps,
  15154. vnodeChildren,
  15155. patchFlag === 0 ? void 0 : patchFlag,
  15156. vnodeDynamicProps,
  15157. vnodeDirectives,
  15158. !!shouldUseBlock,
  15159. false,
  15160. isComponent,
  15161. node.loc
  15162. );
  15163. };
  15164. };
  15165. function resolveComponentType(node, context, ssr = false) {
  15166. let { tag } = node;
  15167. const isExplicitDynamic = isComponentTag(tag);
  15168. const isProp = findProp(
  15169. node,
  15170. "is",
  15171. false,
  15172. true
  15173. /* allow empty */
  15174. );
  15175. if (isProp) {
  15176. if (isExplicitDynamic || false) {
  15177. let exp;
  15178. if (isProp.type === 6) {
  15179. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  15180. } else {
  15181. exp = isProp.exp;
  15182. if (!exp) {
  15183. exp = createSimpleExpression(`is`, false, isProp.arg.loc);
  15184. }
  15185. }
  15186. if (exp) {
  15187. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  15188. exp
  15189. ]);
  15190. }
  15191. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  15192. tag = isProp.value.content.slice(4);
  15193. }
  15194. }
  15195. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  15196. if (builtIn) {
  15197. if (!ssr) context.helper(builtIn);
  15198. return builtIn;
  15199. }
  15200. context.helper(RESOLVE_COMPONENT);
  15201. context.components.add(tag);
  15202. return toValidAssetId(tag, `component`);
  15203. }
  15204. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  15205. const { tag, loc: elementLoc, children } = node;
  15206. let properties = [];
  15207. const mergeArgs = [];
  15208. const runtimeDirectives = [];
  15209. const hasChildren = children.length > 0;
  15210. let shouldUseBlock = false;
  15211. let patchFlag = 0;
  15212. let hasRef = false;
  15213. let hasClassBinding = false;
  15214. let hasStyleBinding = false;
  15215. let hasHydrationEventBinding = false;
  15216. let hasDynamicKeys = false;
  15217. let hasVnodeHook = false;
  15218. const dynamicPropNames = [];
  15219. const pushMergeArg = (arg) => {
  15220. if (properties.length) {
  15221. mergeArgs.push(
  15222. createObjectExpression(dedupeProperties(properties), elementLoc)
  15223. );
  15224. properties = [];
  15225. }
  15226. if (arg) mergeArgs.push(arg);
  15227. };
  15228. const pushRefVForMarker = () => {
  15229. if (context.scopes.vFor > 0) {
  15230. properties.push(
  15231. createObjectProperty(
  15232. createSimpleExpression("ref_for", true),
  15233. createSimpleExpression("true")
  15234. )
  15235. );
  15236. }
  15237. };
  15238. const analyzePatchFlag = ({ key, value }) => {
  15239. if (isStaticExp(key)) {
  15240. const name = key.content;
  15241. const isEventHandler = isOn(name);
  15242. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  15243. // dedicated fast path.
  15244. name.toLowerCase() !== "onclick" && // omit v-model handlers
  15245. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  15246. !isReservedProp(name)) {
  15247. hasHydrationEventBinding = true;
  15248. }
  15249. if (isEventHandler && isReservedProp(name)) {
  15250. hasVnodeHook = true;
  15251. }
  15252. if (isEventHandler && value.type === 14) {
  15253. value = value.arguments[0];
  15254. }
  15255. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  15256. return;
  15257. }
  15258. if (name === "ref") {
  15259. hasRef = true;
  15260. } else if (name === "class") {
  15261. hasClassBinding = true;
  15262. } else if (name === "style") {
  15263. hasStyleBinding = true;
  15264. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  15265. dynamicPropNames.push(name);
  15266. }
  15267. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  15268. dynamicPropNames.push(name);
  15269. }
  15270. } else {
  15271. hasDynamicKeys = true;
  15272. }
  15273. };
  15274. for (let i = 0; i < props.length; i++) {
  15275. const prop = props[i];
  15276. if (prop.type === 6) {
  15277. const { loc, name, nameLoc, value } = prop;
  15278. let isStatic = true;
  15279. if (name === "ref") {
  15280. hasRef = true;
  15281. pushRefVForMarker();
  15282. }
  15283. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  15284. continue;
  15285. }
  15286. properties.push(
  15287. createObjectProperty(
  15288. createSimpleExpression(name, true, nameLoc),
  15289. createSimpleExpression(
  15290. value ? value.content : "",
  15291. isStatic,
  15292. value ? value.loc : loc
  15293. )
  15294. )
  15295. );
  15296. } else {
  15297. const { name, arg, exp, loc, modifiers } = prop;
  15298. const isVBind = name === "bind";
  15299. const isVOn = name === "on";
  15300. if (name === "slot") {
  15301. if (!isComponent) {
  15302. context.onError(
  15303. createCompilerError(40, loc)
  15304. );
  15305. }
  15306. continue;
  15307. }
  15308. if (name === "once" || name === "memo") {
  15309. continue;
  15310. }
  15311. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  15312. continue;
  15313. }
  15314. if (isVOn && ssr) {
  15315. continue;
  15316. }
  15317. if (
  15318. // #938: elements with dynamic keys should be forced into blocks
  15319. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  15320. // before children
  15321. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  15322. ) {
  15323. shouldUseBlock = true;
  15324. }
  15325. if (isVBind && isStaticArgOf(arg, "ref")) {
  15326. pushRefVForMarker();
  15327. }
  15328. if (!arg && (isVBind || isVOn)) {
  15329. hasDynamicKeys = true;
  15330. if (exp) {
  15331. if (isVBind) {
  15332. pushRefVForMarker();
  15333. pushMergeArg();
  15334. mergeArgs.push(exp);
  15335. } else {
  15336. pushMergeArg({
  15337. type: 14,
  15338. loc,
  15339. callee: context.helper(TO_HANDLERS),
  15340. arguments: isComponent ? [exp] : [exp, `true`]
  15341. });
  15342. }
  15343. } else {
  15344. context.onError(
  15345. createCompilerError(
  15346. isVBind ? 34 : 35,
  15347. loc
  15348. )
  15349. );
  15350. }
  15351. continue;
  15352. }
  15353. if (isVBind && modifiers.includes("prop")) {
  15354. patchFlag |= 32;
  15355. }
  15356. const directiveTransform = context.directiveTransforms[name];
  15357. if (directiveTransform) {
  15358. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  15359. !ssr && props2.forEach(analyzePatchFlag);
  15360. if (isVOn && arg && !isStaticExp(arg)) {
  15361. pushMergeArg(createObjectExpression(props2, elementLoc));
  15362. } else {
  15363. properties.push(...props2);
  15364. }
  15365. if (needRuntime) {
  15366. runtimeDirectives.push(prop);
  15367. if (isSymbol(needRuntime)) {
  15368. directiveImportMap.set(prop, needRuntime);
  15369. }
  15370. }
  15371. } else if (!isBuiltInDirective(name)) {
  15372. runtimeDirectives.push(prop);
  15373. if (hasChildren) {
  15374. shouldUseBlock = true;
  15375. }
  15376. }
  15377. }
  15378. }
  15379. let propsExpression = void 0;
  15380. if (mergeArgs.length) {
  15381. pushMergeArg();
  15382. if (mergeArgs.length > 1) {
  15383. propsExpression = createCallExpression(
  15384. context.helper(MERGE_PROPS),
  15385. mergeArgs,
  15386. elementLoc
  15387. );
  15388. } else {
  15389. propsExpression = mergeArgs[0];
  15390. }
  15391. } else if (properties.length) {
  15392. propsExpression = createObjectExpression(
  15393. dedupeProperties(properties),
  15394. elementLoc
  15395. );
  15396. }
  15397. if (hasDynamicKeys) {
  15398. patchFlag |= 16;
  15399. } else {
  15400. if (hasClassBinding && !isComponent) {
  15401. patchFlag |= 2;
  15402. }
  15403. if (hasStyleBinding && !isComponent) {
  15404. patchFlag |= 4;
  15405. }
  15406. if (dynamicPropNames.length) {
  15407. patchFlag |= 8;
  15408. }
  15409. if (hasHydrationEventBinding) {
  15410. patchFlag |= 32;
  15411. }
  15412. }
  15413. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  15414. patchFlag |= 512;
  15415. }
  15416. if (!context.inSSR && propsExpression) {
  15417. switch (propsExpression.type) {
  15418. case 15:
  15419. let classKeyIndex = -1;
  15420. let styleKeyIndex = -1;
  15421. let hasDynamicKey = false;
  15422. for (let i = 0; i < propsExpression.properties.length; i++) {
  15423. const key = propsExpression.properties[i].key;
  15424. if (isStaticExp(key)) {
  15425. if (key.content === "class") {
  15426. classKeyIndex = i;
  15427. } else if (key.content === "style") {
  15428. styleKeyIndex = i;
  15429. }
  15430. } else if (!key.isHandlerKey) {
  15431. hasDynamicKey = true;
  15432. }
  15433. }
  15434. const classProp = propsExpression.properties[classKeyIndex];
  15435. const styleProp = propsExpression.properties[styleKeyIndex];
  15436. if (!hasDynamicKey) {
  15437. if (classProp && !isStaticExp(classProp.value)) {
  15438. classProp.value = createCallExpression(
  15439. context.helper(NORMALIZE_CLASS),
  15440. [classProp.value]
  15441. );
  15442. }
  15443. if (styleProp && // the static style is compiled into an object,
  15444. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  15445. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  15446. // v-bind:style with static literal object
  15447. styleProp.value.type === 17)) {
  15448. styleProp.value = createCallExpression(
  15449. context.helper(NORMALIZE_STYLE),
  15450. [styleProp.value]
  15451. );
  15452. }
  15453. } else {
  15454. propsExpression = createCallExpression(
  15455. context.helper(NORMALIZE_PROPS),
  15456. [propsExpression]
  15457. );
  15458. }
  15459. break;
  15460. case 14:
  15461. break;
  15462. default:
  15463. propsExpression = createCallExpression(
  15464. context.helper(NORMALIZE_PROPS),
  15465. [
  15466. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  15467. propsExpression
  15468. ])
  15469. ]
  15470. );
  15471. break;
  15472. }
  15473. }
  15474. return {
  15475. props: propsExpression,
  15476. directives: runtimeDirectives,
  15477. patchFlag,
  15478. dynamicPropNames,
  15479. shouldUseBlock
  15480. };
  15481. }
  15482. function dedupeProperties(properties) {
  15483. const knownProps = /* @__PURE__ */ new Map();
  15484. const deduped = [];
  15485. for (let i = 0; i < properties.length; i++) {
  15486. const prop = properties[i];
  15487. if (prop.key.type === 8 || !prop.key.isStatic) {
  15488. deduped.push(prop);
  15489. continue;
  15490. }
  15491. const name = prop.key.content;
  15492. const existing = knownProps.get(name);
  15493. if (existing) {
  15494. if (name === "style" || name === "class" || isOn(name)) {
  15495. mergeAsArray(existing, prop);
  15496. }
  15497. } else {
  15498. knownProps.set(name, prop);
  15499. deduped.push(prop);
  15500. }
  15501. }
  15502. return deduped;
  15503. }
  15504. function mergeAsArray(existing, incoming) {
  15505. if (existing.value.type === 17) {
  15506. existing.value.elements.push(incoming.value);
  15507. } else {
  15508. existing.value = createArrayExpression(
  15509. [existing.value, incoming.value],
  15510. existing.loc
  15511. );
  15512. }
  15513. }
  15514. function buildDirectiveArgs(dir, context) {
  15515. const dirArgs = [];
  15516. const runtime = directiveImportMap.get(dir);
  15517. if (runtime) {
  15518. dirArgs.push(context.helperString(runtime));
  15519. } else {
  15520. {
  15521. context.helper(RESOLVE_DIRECTIVE);
  15522. context.directives.add(dir.name);
  15523. dirArgs.push(toValidAssetId(dir.name, `directive`));
  15524. }
  15525. }
  15526. const { loc } = dir;
  15527. if (dir.exp) dirArgs.push(dir.exp);
  15528. if (dir.arg) {
  15529. if (!dir.exp) {
  15530. dirArgs.push(`void 0`);
  15531. }
  15532. dirArgs.push(dir.arg);
  15533. }
  15534. if (Object.keys(dir.modifiers).length) {
  15535. if (!dir.arg) {
  15536. if (!dir.exp) {
  15537. dirArgs.push(`void 0`);
  15538. }
  15539. dirArgs.push(`void 0`);
  15540. }
  15541. const trueExpression = createSimpleExpression(`true`, false, loc);
  15542. dirArgs.push(
  15543. createObjectExpression(
  15544. dir.modifiers.map(
  15545. (modifier) => createObjectProperty(modifier, trueExpression)
  15546. ),
  15547. loc
  15548. )
  15549. );
  15550. }
  15551. return createArrayExpression(dirArgs, dir.loc);
  15552. }
  15553. function stringifyDynamicPropNames(props) {
  15554. let propsNamesString = `[`;
  15555. for (let i = 0, l = props.length; i < l; i++) {
  15556. propsNamesString += JSON.stringify(props[i]);
  15557. if (i < l - 1) propsNamesString += ", ";
  15558. }
  15559. return propsNamesString + `]`;
  15560. }
  15561. function isComponentTag(tag) {
  15562. return tag === "component" || tag === "Component";
  15563. }
  15564. const transformSlotOutlet = (node, context) => {
  15565. if (isSlotOutlet(node)) {
  15566. const { children, loc } = node;
  15567. const { slotName, slotProps } = processSlotOutlet(node, context);
  15568. const slotArgs = [
  15569. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  15570. slotName,
  15571. "{}",
  15572. "undefined",
  15573. "true"
  15574. ];
  15575. let expectedLen = 2;
  15576. if (slotProps) {
  15577. slotArgs[2] = slotProps;
  15578. expectedLen = 3;
  15579. }
  15580. if (children.length) {
  15581. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  15582. expectedLen = 4;
  15583. }
  15584. if (context.scopeId && !context.slotted) {
  15585. expectedLen = 5;
  15586. }
  15587. slotArgs.splice(expectedLen);
  15588. node.codegenNode = createCallExpression(
  15589. context.helper(RENDER_SLOT),
  15590. slotArgs,
  15591. loc
  15592. );
  15593. }
  15594. };
  15595. function processSlotOutlet(node, context) {
  15596. let slotName = `"default"`;
  15597. let slotProps = void 0;
  15598. const nonNameProps = [];
  15599. for (let i = 0; i < node.props.length; i++) {
  15600. const p = node.props[i];
  15601. if (p.type === 6) {
  15602. if (p.value) {
  15603. if (p.name === "name") {
  15604. slotName = JSON.stringify(p.value.content);
  15605. } else {
  15606. p.name = camelize(p.name);
  15607. nonNameProps.push(p);
  15608. }
  15609. }
  15610. } else {
  15611. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  15612. if (p.exp) {
  15613. slotName = p.exp;
  15614. } else if (p.arg && p.arg.type === 4) {
  15615. const name = camelize(p.arg.content);
  15616. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  15617. }
  15618. } else {
  15619. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  15620. p.arg.content = camelize(p.arg.content);
  15621. }
  15622. nonNameProps.push(p);
  15623. }
  15624. }
  15625. }
  15626. if (nonNameProps.length > 0) {
  15627. const { props, directives } = buildProps(
  15628. node,
  15629. context,
  15630. nonNameProps,
  15631. false,
  15632. false
  15633. );
  15634. slotProps = props;
  15635. if (directives.length) {
  15636. context.onError(
  15637. createCompilerError(
  15638. 36,
  15639. directives[0].loc
  15640. )
  15641. );
  15642. }
  15643. }
  15644. return {
  15645. slotName,
  15646. slotProps
  15647. };
  15648. }
  15649. const transformOn$1 = (dir, node, context, augmentor) => {
  15650. const { loc, modifiers, arg } = dir;
  15651. if (!dir.exp && !modifiers.length) {
  15652. context.onError(createCompilerError(35, loc));
  15653. }
  15654. let eventName;
  15655. if (arg.type === 4) {
  15656. if (arg.isStatic) {
  15657. let rawName = arg.content;
  15658. if (rawName.startsWith("vnode")) {
  15659. context.onError(createCompilerError(51, arg.loc));
  15660. }
  15661. if (rawName.startsWith("vue:")) {
  15662. rawName = `vnode-${rawName.slice(4)}`;
  15663. }
  15664. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  15665. // for non-element and vnode lifecycle event listeners, auto convert
  15666. // it to camelCase. See issue #2249
  15667. toHandlerKey(camelize(rawName))
  15668. ) : (
  15669. // preserve case for plain element listeners that have uppercase
  15670. // letters, as these may be custom elements' custom events
  15671. `on:${rawName}`
  15672. );
  15673. eventName = createSimpleExpression(eventString, true, arg.loc);
  15674. } else {
  15675. eventName = createCompoundExpression([
  15676. `${context.helperString(TO_HANDLER_KEY)}(`,
  15677. arg,
  15678. `)`
  15679. ]);
  15680. }
  15681. } else {
  15682. eventName = arg;
  15683. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  15684. eventName.children.push(`)`);
  15685. }
  15686. let exp = dir.exp;
  15687. if (exp && !exp.content.trim()) {
  15688. exp = void 0;
  15689. }
  15690. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  15691. if (exp) {
  15692. const isMemberExp = isMemberExpression(exp);
  15693. const isInlineStatement = !(isMemberExp || isFnExpression(exp));
  15694. const hasMultipleStatements = exp.content.includes(`;`);
  15695. {
  15696. validateBrowserExpression(
  15697. exp,
  15698. context,
  15699. false,
  15700. hasMultipleStatements
  15701. );
  15702. }
  15703. if (isInlineStatement || shouldCache && isMemberExp) {
  15704. exp = createCompoundExpression([
  15705. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  15706. exp,
  15707. hasMultipleStatements ? `}` : `)`
  15708. ]);
  15709. }
  15710. }
  15711. let ret = {
  15712. props: [
  15713. createObjectProperty(
  15714. eventName,
  15715. exp || createSimpleExpression(`() => {}`, false, loc)
  15716. )
  15717. ]
  15718. };
  15719. if (augmentor) {
  15720. ret = augmentor(ret);
  15721. }
  15722. if (shouldCache) {
  15723. ret.props[0].value = context.cache(ret.props[0].value);
  15724. }
  15725. ret.props.forEach((p) => p.key.isHandlerKey = true);
  15726. return ret;
  15727. };
  15728. const transformText = (node, context) => {
  15729. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  15730. return () => {
  15731. const children = node.children;
  15732. let currentContainer = void 0;
  15733. let hasText = false;
  15734. for (let i = 0; i < children.length; i++) {
  15735. const child = children[i];
  15736. if (isText$1(child)) {
  15737. hasText = true;
  15738. for (let j = i + 1; j < children.length; j++) {
  15739. const next = children[j];
  15740. if (isText$1(next)) {
  15741. if (!currentContainer) {
  15742. currentContainer = children[i] = createCompoundExpression(
  15743. [child],
  15744. child.loc
  15745. );
  15746. }
  15747. currentContainer.children.push(` + `, next);
  15748. children.splice(j, 1);
  15749. j--;
  15750. } else {
  15751. currentContainer = void 0;
  15752. break;
  15753. }
  15754. }
  15755. }
  15756. }
  15757. if (!hasText || // if this is a plain element with a single text child, leave it
  15758. // as-is since the runtime has dedicated fast path for this by directly
  15759. // setting textContent of the element.
  15760. // for component root it's always normalized anyway.
  15761. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  15762. // custom directives can potentially add DOM elements arbitrarily,
  15763. // we need to avoid setting textContent of the element at runtime
  15764. // to avoid accidentally overwriting the DOM elements added
  15765. // by the user through custom directives.
  15766. !node.props.find(
  15767. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  15768. ) && // in compat mode, <template> tags with no special directives
  15769. // will be rendered as a fragment so its children must be
  15770. // converted into vnodes.
  15771. true)) {
  15772. return;
  15773. }
  15774. for (let i = 0; i < children.length; i++) {
  15775. const child = children[i];
  15776. if (isText$1(child) || child.type === 8) {
  15777. const callArgs = [];
  15778. if (child.type !== 2 || child.content !== " ") {
  15779. callArgs.push(child);
  15780. }
  15781. if (!context.ssr && getConstantType(child, context) === 0) {
  15782. callArgs.push(
  15783. 1 + (` /* ${PatchFlagNames[1]} */` )
  15784. );
  15785. }
  15786. children[i] = {
  15787. type: 12,
  15788. content: child,
  15789. loc: child.loc,
  15790. codegenNode: createCallExpression(
  15791. context.helper(CREATE_TEXT),
  15792. callArgs
  15793. )
  15794. };
  15795. }
  15796. }
  15797. };
  15798. }
  15799. };
  15800. const seen$1 = /* @__PURE__ */ new WeakSet();
  15801. const transformOnce = (node, context) => {
  15802. if (node.type === 1 && findDir(node, "once", true)) {
  15803. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  15804. return;
  15805. }
  15806. seen$1.add(node);
  15807. context.inVOnce = true;
  15808. context.helper(SET_BLOCK_TRACKING);
  15809. return () => {
  15810. context.inVOnce = false;
  15811. const cur = context.currentNode;
  15812. if (cur.codegenNode) {
  15813. cur.codegenNode = context.cache(
  15814. cur.codegenNode,
  15815. true
  15816. /* isVNode */
  15817. );
  15818. }
  15819. };
  15820. }
  15821. };
  15822. const transformModel$1 = (dir, node, context) => {
  15823. const { exp, arg } = dir;
  15824. if (!exp) {
  15825. context.onError(
  15826. createCompilerError(41, dir.loc)
  15827. );
  15828. return createTransformProps();
  15829. }
  15830. const rawExp = exp.loc.source;
  15831. const expString = exp.type === 4 ? exp.content : rawExp;
  15832. const bindingType = context.bindingMetadata[rawExp];
  15833. if (bindingType === "props" || bindingType === "props-aliased") {
  15834. context.onError(createCompilerError(44, exp.loc));
  15835. return createTransformProps();
  15836. }
  15837. const maybeRef = false;
  15838. if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
  15839. context.onError(
  15840. createCompilerError(42, exp.loc)
  15841. );
  15842. return createTransformProps();
  15843. }
  15844. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  15845. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  15846. let assignmentExp;
  15847. const eventArg = context.isTS ? `($event: any)` : `$event`;
  15848. {
  15849. assignmentExp = createCompoundExpression([
  15850. `${eventArg} => ((`,
  15851. exp,
  15852. `) = $event)`
  15853. ]);
  15854. }
  15855. const props = [
  15856. // modelValue: foo
  15857. createObjectProperty(propName, dir.exp),
  15858. // "onUpdate:modelValue": $event => (foo = $event)
  15859. createObjectProperty(eventName, assignmentExp)
  15860. ];
  15861. if (dir.modifiers.length && node.tagType === 1) {
  15862. const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  15863. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  15864. props.push(
  15865. createObjectProperty(
  15866. modifiersKey,
  15867. createSimpleExpression(
  15868. `{ ${modifiers} }`,
  15869. false,
  15870. dir.loc,
  15871. 2
  15872. )
  15873. )
  15874. );
  15875. }
  15876. return createTransformProps(props);
  15877. };
  15878. function createTransformProps(props = []) {
  15879. return { props };
  15880. }
  15881. const seen = /* @__PURE__ */ new WeakSet();
  15882. const transformMemo = (node, context) => {
  15883. if (node.type === 1) {
  15884. const dir = findDir(node, "memo");
  15885. if (!dir || seen.has(node)) {
  15886. return;
  15887. }
  15888. seen.add(node);
  15889. return () => {
  15890. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  15891. if (codegenNode && codegenNode.type === 13) {
  15892. if (node.tagType !== 1) {
  15893. convertToBlock(codegenNode, context);
  15894. }
  15895. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  15896. dir.exp,
  15897. createFunctionExpression(void 0, codegenNode),
  15898. `_cache`,
  15899. String(context.cached++)
  15900. ]);
  15901. }
  15902. };
  15903. }
  15904. };
  15905. function getBaseTransformPreset(prefixIdentifiers) {
  15906. return [
  15907. [
  15908. transformOnce,
  15909. transformIf,
  15910. transformMemo,
  15911. transformFor,
  15912. ...[],
  15913. ...[transformExpression] ,
  15914. transformSlotOutlet,
  15915. transformElement,
  15916. trackSlotScopes,
  15917. transformText
  15918. ],
  15919. {
  15920. on: transformOn$1,
  15921. bind: transformBind,
  15922. model: transformModel$1
  15923. }
  15924. ];
  15925. }
  15926. function baseCompile(source, options = {}) {
  15927. const onError = options.onError || defaultOnError;
  15928. const isModuleMode = options.mode === "module";
  15929. {
  15930. if (options.prefixIdentifiers === true) {
  15931. onError(createCompilerError(47));
  15932. } else if (isModuleMode) {
  15933. onError(createCompilerError(48));
  15934. }
  15935. }
  15936. const prefixIdentifiers = false;
  15937. if (options.cacheHandlers) {
  15938. onError(createCompilerError(49));
  15939. }
  15940. if (options.scopeId && !isModuleMode) {
  15941. onError(createCompilerError(50));
  15942. }
  15943. const resolvedOptions = extend({}, options, {
  15944. prefixIdentifiers
  15945. });
  15946. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  15947. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  15948. transform(
  15949. ast,
  15950. extend({}, resolvedOptions, {
  15951. nodeTransforms: [
  15952. ...nodeTransforms,
  15953. ...options.nodeTransforms || []
  15954. // user transforms
  15955. ],
  15956. directiveTransforms: extend(
  15957. {},
  15958. directiveTransforms,
  15959. options.directiveTransforms || {}
  15960. // user transforms
  15961. )
  15962. })
  15963. );
  15964. return generate(ast, resolvedOptions);
  15965. }
  15966. const noopDirectiveTransform = () => ({ props: [] });
  15967. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  15968. const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
  15969. const V_MODEL_TEXT = Symbol(`vModelText` );
  15970. const V_MODEL_SELECT = Symbol(`vModelSelect` );
  15971. const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
  15972. const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
  15973. const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
  15974. const V_SHOW = Symbol(`vShow` );
  15975. const TRANSITION = Symbol(`Transition` );
  15976. const TRANSITION_GROUP = Symbol(`TransitionGroup` );
  15977. registerRuntimeHelpers({
  15978. [V_MODEL_RADIO]: `vModelRadio`,
  15979. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  15980. [V_MODEL_TEXT]: `vModelText`,
  15981. [V_MODEL_SELECT]: `vModelSelect`,
  15982. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  15983. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  15984. [V_ON_WITH_KEYS]: `withKeys`,
  15985. [V_SHOW]: `vShow`,
  15986. [TRANSITION]: `Transition`,
  15987. [TRANSITION_GROUP]: `TransitionGroup`
  15988. });
  15989. let decoder;
  15990. function decodeHtmlBrowser(raw, asAttr = false) {
  15991. if (!decoder) {
  15992. decoder = document.createElement("div");
  15993. }
  15994. if (asAttr) {
  15995. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  15996. return decoder.children[0].getAttribute("foo");
  15997. } else {
  15998. decoder.innerHTML = raw;
  15999. return decoder.textContent;
  16000. }
  16001. }
  16002. const parserOptions = {
  16003. parseMode: "html",
  16004. isVoidTag,
  16005. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  16006. isPreTag: (tag) => tag === "pre",
  16007. decodeEntities: decodeHtmlBrowser ,
  16008. isBuiltInComponent: (tag) => {
  16009. if (tag === "Transition" || tag === "transition") {
  16010. return TRANSITION;
  16011. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  16012. return TRANSITION_GROUP;
  16013. }
  16014. },
  16015. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  16016. getNamespace(tag, parent, rootNamespace) {
  16017. let ns = parent ? parent.ns : rootNamespace;
  16018. if (parent && ns === 2) {
  16019. if (parent.tag === "annotation-xml") {
  16020. if (tag === "svg") {
  16021. return 1;
  16022. }
  16023. if (parent.props.some(
  16024. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  16025. )) {
  16026. ns = 0;
  16027. }
  16028. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  16029. ns = 0;
  16030. }
  16031. } else if (parent && ns === 1) {
  16032. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  16033. ns = 0;
  16034. }
  16035. }
  16036. if (ns === 0) {
  16037. if (tag === "svg") {
  16038. return 1;
  16039. }
  16040. if (tag === "math") {
  16041. return 2;
  16042. }
  16043. }
  16044. return ns;
  16045. }
  16046. };
  16047. const transformStyle = (node) => {
  16048. if (node.type === 1) {
  16049. node.props.forEach((p, i) => {
  16050. if (p.type === 6 && p.name === "style" && p.value) {
  16051. node.props[i] = {
  16052. type: 7,
  16053. name: `bind`,
  16054. arg: createSimpleExpression(`style`, true, p.loc),
  16055. exp: parseInlineCSS(p.value.content, p.loc),
  16056. modifiers: [],
  16057. loc: p.loc
  16058. };
  16059. }
  16060. });
  16061. }
  16062. };
  16063. const parseInlineCSS = (cssText, loc) => {
  16064. const normalized = parseStringStyle(cssText);
  16065. return createSimpleExpression(
  16066. JSON.stringify(normalized),
  16067. false,
  16068. loc,
  16069. 3
  16070. );
  16071. };
  16072. function createDOMCompilerError(code, loc) {
  16073. return createCompilerError(
  16074. code,
  16075. loc,
  16076. DOMErrorMessages
  16077. );
  16078. }
  16079. const DOMErrorMessages = {
  16080. [53]: `v-html is missing expression.`,
  16081. [54]: `v-html will override element children.`,
  16082. [55]: `v-text is missing expression.`,
  16083. [56]: `v-text will override element children.`,
  16084. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  16085. [58]: `v-model argument is not supported on plain elements.`,
  16086. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  16087. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  16088. [61]: `v-show is missing expression.`,
  16089. [62]: `<Transition> expects exactly one child element or component.`,
  16090. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  16091. };
  16092. const transformVHtml = (dir, node, context) => {
  16093. const { exp, loc } = dir;
  16094. if (!exp) {
  16095. context.onError(
  16096. createDOMCompilerError(53, loc)
  16097. );
  16098. }
  16099. if (node.children.length) {
  16100. context.onError(
  16101. createDOMCompilerError(54, loc)
  16102. );
  16103. node.children.length = 0;
  16104. }
  16105. return {
  16106. props: [
  16107. createObjectProperty(
  16108. createSimpleExpression(`innerHTML`, true, loc),
  16109. exp || createSimpleExpression("", true)
  16110. )
  16111. ]
  16112. };
  16113. };
  16114. const transformVText = (dir, node, context) => {
  16115. const { exp, loc } = dir;
  16116. if (!exp) {
  16117. context.onError(
  16118. createDOMCompilerError(55, loc)
  16119. );
  16120. }
  16121. if (node.children.length) {
  16122. context.onError(
  16123. createDOMCompilerError(56, loc)
  16124. );
  16125. node.children.length = 0;
  16126. }
  16127. return {
  16128. props: [
  16129. createObjectProperty(
  16130. createSimpleExpression(`textContent`, true),
  16131. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  16132. context.helperString(TO_DISPLAY_STRING),
  16133. [exp],
  16134. loc
  16135. ) : createSimpleExpression("", true)
  16136. )
  16137. ]
  16138. };
  16139. };
  16140. const transformModel = (dir, node, context) => {
  16141. const baseResult = transformModel$1(dir, node, context);
  16142. if (!baseResult.props.length || node.tagType === 1) {
  16143. return baseResult;
  16144. }
  16145. if (dir.arg) {
  16146. context.onError(
  16147. createDOMCompilerError(
  16148. 58,
  16149. dir.arg.loc
  16150. )
  16151. );
  16152. }
  16153. function checkDuplicatedValue() {
  16154. const value = findDir(node, "bind");
  16155. if (value && isStaticArgOf(value.arg, "value")) {
  16156. context.onError(
  16157. createDOMCompilerError(
  16158. 60,
  16159. value.loc
  16160. )
  16161. );
  16162. }
  16163. }
  16164. const { tag } = node;
  16165. const isCustomElement = context.isCustomElement(tag);
  16166. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  16167. let directiveToUse = V_MODEL_TEXT;
  16168. let isInvalidType = false;
  16169. if (tag === "input" || isCustomElement) {
  16170. const type = findProp(node, `type`);
  16171. if (type) {
  16172. if (type.type === 7) {
  16173. directiveToUse = V_MODEL_DYNAMIC;
  16174. } else if (type.value) {
  16175. switch (type.value.content) {
  16176. case "radio":
  16177. directiveToUse = V_MODEL_RADIO;
  16178. break;
  16179. case "checkbox":
  16180. directiveToUse = V_MODEL_CHECKBOX;
  16181. break;
  16182. case "file":
  16183. isInvalidType = true;
  16184. context.onError(
  16185. createDOMCompilerError(
  16186. 59,
  16187. dir.loc
  16188. )
  16189. );
  16190. break;
  16191. default:
  16192. checkDuplicatedValue();
  16193. break;
  16194. }
  16195. }
  16196. } else if (hasDynamicKeyVBind(node)) {
  16197. directiveToUse = V_MODEL_DYNAMIC;
  16198. } else {
  16199. checkDuplicatedValue();
  16200. }
  16201. } else if (tag === "select") {
  16202. directiveToUse = V_MODEL_SELECT;
  16203. } else {
  16204. checkDuplicatedValue();
  16205. }
  16206. if (!isInvalidType) {
  16207. baseResult.needRuntime = context.helper(directiveToUse);
  16208. }
  16209. } else {
  16210. context.onError(
  16211. createDOMCompilerError(
  16212. 57,
  16213. dir.loc
  16214. )
  16215. );
  16216. }
  16217. baseResult.props = baseResult.props.filter(
  16218. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  16219. );
  16220. return baseResult;
  16221. };
  16222. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  16223. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  16224. // event propagation management
  16225. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  16226. );
  16227. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  16228. const isKeyboardEvent = /* @__PURE__ */ makeMap(
  16229. `onkeyup,onkeydown,onkeypress`,
  16230. true
  16231. );
  16232. const resolveModifiers = (key, modifiers, context, loc) => {
  16233. const keyModifiers = [];
  16234. const nonKeyModifiers = [];
  16235. const eventOptionModifiers = [];
  16236. for (let i = 0; i < modifiers.length; i++) {
  16237. const modifier = modifiers[i];
  16238. if (isEventOptionModifier(modifier)) {
  16239. eventOptionModifiers.push(modifier);
  16240. } else {
  16241. if (maybeKeyModifier(modifier)) {
  16242. if (isStaticExp(key)) {
  16243. if (isKeyboardEvent(key.content)) {
  16244. keyModifiers.push(modifier);
  16245. } else {
  16246. nonKeyModifiers.push(modifier);
  16247. }
  16248. } else {
  16249. keyModifiers.push(modifier);
  16250. nonKeyModifiers.push(modifier);
  16251. }
  16252. } else {
  16253. if (isNonKeyModifier(modifier)) {
  16254. nonKeyModifiers.push(modifier);
  16255. } else {
  16256. keyModifiers.push(modifier);
  16257. }
  16258. }
  16259. }
  16260. }
  16261. return {
  16262. keyModifiers,
  16263. nonKeyModifiers,
  16264. eventOptionModifiers
  16265. };
  16266. };
  16267. const transformClick = (key, event) => {
  16268. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  16269. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  16270. `(`,
  16271. key,
  16272. `) === "onClick" ? "${event}" : (`,
  16273. key,
  16274. `)`
  16275. ]) : key;
  16276. };
  16277. const transformOn = (dir, node, context) => {
  16278. return transformOn$1(dir, node, context, (baseResult) => {
  16279. const { modifiers } = dir;
  16280. if (!modifiers.length) return baseResult;
  16281. let { key, value: handlerExp } = baseResult.props[0];
  16282. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  16283. if (nonKeyModifiers.includes("right")) {
  16284. key = transformClick(key, `onContextmenu`);
  16285. }
  16286. if (nonKeyModifiers.includes("middle")) {
  16287. key = transformClick(key, `onMouseup`);
  16288. }
  16289. if (nonKeyModifiers.length) {
  16290. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  16291. handlerExp,
  16292. JSON.stringify(nonKeyModifiers)
  16293. ]);
  16294. }
  16295. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  16296. (!isStaticExp(key) || isKeyboardEvent(key.content))) {
  16297. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  16298. handlerExp,
  16299. JSON.stringify(keyModifiers)
  16300. ]);
  16301. }
  16302. if (eventOptionModifiers.length) {
  16303. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  16304. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  16305. }
  16306. return {
  16307. props: [createObjectProperty(key, handlerExp)]
  16308. };
  16309. });
  16310. };
  16311. const transformShow = (dir, node, context) => {
  16312. const { exp, loc } = dir;
  16313. if (!exp) {
  16314. context.onError(
  16315. createDOMCompilerError(61, loc)
  16316. );
  16317. }
  16318. return {
  16319. props: [],
  16320. needRuntime: context.helper(V_SHOW)
  16321. };
  16322. };
  16323. const transformTransition = (node, context) => {
  16324. if (node.type === 1 && node.tagType === 1) {
  16325. const component = context.isBuiltInComponent(node.tag);
  16326. if (component === TRANSITION) {
  16327. return () => {
  16328. if (!node.children.length) {
  16329. return;
  16330. }
  16331. if (hasMultipleChildren(node)) {
  16332. context.onError(
  16333. createDOMCompilerError(
  16334. 62,
  16335. {
  16336. start: node.children[0].loc.start,
  16337. end: node.children[node.children.length - 1].loc.end,
  16338. source: ""
  16339. }
  16340. )
  16341. );
  16342. }
  16343. const child = node.children[0];
  16344. if (child.type === 1) {
  16345. for (const p of child.props) {
  16346. if (p.type === 7 && p.name === "show") {
  16347. node.props.push({
  16348. type: 6,
  16349. name: "persisted",
  16350. nameLoc: node.loc,
  16351. value: void 0,
  16352. loc: node.loc
  16353. });
  16354. }
  16355. }
  16356. }
  16357. };
  16358. }
  16359. }
  16360. };
  16361. function hasMultipleChildren(node) {
  16362. const children = node.children = node.children.filter(
  16363. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  16364. );
  16365. const child = children[0];
  16366. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  16367. }
  16368. const ignoreSideEffectTags = (node, context) => {
  16369. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  16370. context.onError(
  16371. createDOMCompilerError(
  16372. 63,
  16373. node.loc
  16374. )
  16375. );
  16376. context.removeNode();
  16377. }
  16378. };
  16379. const DOMNodeTransforms = [
  16380. transformStyle,
  16381. ...[transformTransition]
  16382. ];
  16383. const DOMDirectiveTransforms = {
  16384. cloak: noopDirectiveTransform,
  16385. html: transformVHtml,
  16386. text: transformVText,
  16387. model: transformModel,
  16388. // override compiler-core
  16389. on: transformOn,
  16390. // override compiler-core
  16391. show: transformShow
  16392. };
  16393. function compile(src, options = {}) {
  16394. return baseCompile(
  16395. src,
  16396. extend({}, parserOptions, options, {
  16397. nodeTransforms: [
  16398. // ignore <script> and <tag>
  16399. // this is not put inside DOMNodeTransforms because that list is used
  16400. // by compiler-ssr to generate vnode fallback branches
  16401. ignoreSideEffectTags,
  16402. ...DOMNodeTransforms,
  16403. ...options.nodeTransforms || []
  16404. ],
  16405. directiveTransforms: extend(
  16406. {},
  16407. DOMDirectiveTransforms,
  16408. options.directiveTransforms || {}
  16409. ),
  16410. transformHoist: null
  16411. })
  16412. );
  16413. }
  16414. {
  16415. initDev();
  16416. }
  16417. const compileCache = /* @__PURE__ */ new WeakMap();
  16418. function getCache(options) {
  16419. let c = compileCache.get(options != null ? options : EMPTY_OBJ);
  16420. if (!c) {
  16421. c = /* @__PURE__ */ Object.create(null);
  16422. compileCache.set(options != null ? options : EMPTY_OBJ, c);
  16423. }
  16424. return c;
  16425. }
  16426. function compileToFunction(template, options) {
  16427. if (!isString(template)) {
  16428. if (template.nodeType) {
  16429. template = template.innerHTML;
  16430. } else {
  16431. warn(`invalid template option: `, template);
  16432. return NOOP;
  16433. }
  16434. }
  16435. const key = template;
  16436. const cache = getCache(options);
  16437. const cached = cache[key];
  16438. if (cached) {
  16439. return cached;
  16440. }
  16441. if (template[0] === "#") {
  16442. const el = document.querySelector(template);
  16443. if (!el) {
  16444. warn(`Template element not found or is empty: ${template}`);
  16445. }
  16446. template = el ? el.innerHTML : ``;
  16447. }
  16448. const opts = extend(
  16449. {
  16450. hoistStatic: true,
  16451. onError: onError ,
  16452. onWarn: (e) => onError(e, true)
  16453. },
  16454. options
  16455. );
  16456. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  16457. opts.isCustomElement = (tag) => !!customElements.get(tag);
  16458. }
  16459. const { code } = compile(template, opts);
  16460. function onError(err, asWarning = false) {
  16461. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  16462. const codeFrame = err.loc && generateCodeFrame(
  16463. template,
  16464. err.loc.start.offset,
  16465. err.loc.end.offset
  16466. );
  16467. warn(codeFrame ? `${message}
  16468. ${codeFrame}` : message);
  16469. }
  16470. const render = new Function(code)() ;
  16471. render._rc = true;
  16472. return cache[key] = render;
  16473. }
  16474. registerRuntimeCompiler(compileToFunction);
  16475. exports.BaseTransition = BaseTransition;
  16476. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  16477. exports.Comment = Comment;
  16478. exports.DeprecationTypes = DeprecationTypes;
  16479. exports.EffectScope = EffectScope;
  16480. exports.ErrorCodes = ErrorCodes;
  16481. exports.ErrorTypeStrings = ErrorTypeStrings;
  16482. exports.Fragment = Fragment;
  16483. exports.KeepAlive = KeepAlive;
  16484. exports.ReactiveEffect = ReactiveEffect;
  16485. exports.Static = Static;
  16486. exports.Suspense = Suspense;
  16487. exports.Teleport = Teleport;
  16488. exports.Text = Text;
  16489. exports.TrackOpTypes = TrackOpTypes;
  16490. exports.Transition = Transition;
  16491. exports.TransitionGroup = TransitionGroup;
  16492. exports.TriggerOpTypes = TriggerOpTypes;
  16493. exports.VueElement = VueElement;
  16494. exports.assertNumber = assertNumber;
  16495. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  16496. exports.callWithErrorHandling = callWithErrorHandling;
  16497. exports.camelize = camelize;
  16498. exports.capitalize = capitalize;
  16499. exports.cloneVNode = cloneVNode;
  16500. exports.compatUtils = compatUtils;
  16501. exports.compile = compileToFunction;
  16502. exports.computed = computed;
  16503. exports.createApp = createApp;
  16504. exports.createBlock = createBlock;
  16505. exports.createCommentVNode = createCommentVNode;
  16506. exports.createElementBlock = createElementBlock;
  16507. exports.createElementVNode = createBaseVNode;
  16508. exports.createHydrationRenderer = createHydrationRenderer;
  16509. exports.createPropsRestProxy = createPropsRestProxy;
  16510. exports.createRenderer = createRenderer;
  16511. exports.createSSRApp = createSSRApp;
  16512. exports.createSlots = createSlots;
  16513. exports.createStaticVNode = createStaticVNode;
  16514. exports.createTextVNode = createTextVNode;
  16515. exports.createVNode = createVNode;
  16516. exports.customRef = customRef;
  16517. exports.defineAsyncComponent = defineAsyncComponent;
  16518. exports.defineComponent = defineComponent;
  16519. exports.defineCustomElement = defineCustomElement;
  16520. exports.defineEmits = defineEmits;
  16521. exports.defineExpose = defineExpose;
  16522. exports.defineModel = defineModel;
  16523. exports.defineOptions = defineOptions;
  16524. exports.defineProps = defineProps;
  16525. exports.defineSSRCustomElement = defineSSRCustomElement;
  16526. exports.defineSlots = defineSlots;
  16527. exports.devtools = devtools;
  16528. exports.effect = effect;
  16529. exports.effectScope = effectScope;
  16530. exports.getCurrentInstance = getCurrentInstance;
  16531. exports.getCurrentScope = getCurrentScope;
  16532. exports.getTransitionRawChildren = getTransitionRawChildren;
  16533. exports.guardReactiveProps = guardReactiveProps;
  16534. exports.h = h;
  16535. exports.handleError = handleError;
  16536. exports.hasInjectionContext = hasInjectionContext;
  16537. exports.hydrate = hydrate;
  16538. exports.initCustomFormatter = initCustomFormatter;
  16539. exports.initDirectivesForSSR = initDirectivesForSSR;
  16540. exports.inject = inject;
  16541. exports.isMemoSame = isMemoSame;
  16542. exports.isProxy = isProxy;
  16543. exports.isReactive = isReactive;
  16544. exports.isReadonly = isReadonly;
  16545. exports.isRef = isRef;
  16546. exports.isRuntimeOnly = isRuntimeOnly;
  16547. exports.isShallow = isShallow;
  16548. exports.isVNode = isVNode;
  16549. exports.markRaw = markRaw;
  16550. exports.mergeDefaults = mergeDefaults;
  16551. exports.mergeModels = mergeModels;
  16552. exports.mergeProps = mergeProps;
  16553. exports.nextTick = nextTick;
  16554. exports.normalizeClass = normalizeClass;
  16555. exports.normalizeProps = normalizeProps;
  16556. exports.normalizeStyle = normalizeStyle;
  16557. exports.onActivated = onActivated;
  16558. exports.onBeforeMount = onBeforeMount;
  16559. exports.onBeforeUnmount = onBeforeUnmount;
  16560. exports.onBeforeUpdate = onBeforeUpdate;
  16561. exports.onDeactivated = onDeactivated;
  16562. exports.onErrorCaptured = onErrorCaptured;
  16563. exports.onMounted = onMounted;
  16564. exports.onRenderTracked = onRenderTracked;
  16565. exports.onRenderTriggered = onRenderTriggered;
  16566. exports.onScopeDispose = onScopeDispose;
  16567. exports.onServerPrefetch = onServerPrefetch;
  16568. exports.onUnmounted = onUnmounted;
  16569. exports.onUpdated = onUpdated;
  16570. exports.openBlock = openBlock;
  16571. exports.popScopeId = popScopeId;
  16572. exports.provide = provide;
  16573. exports.proxyRefs = proxyRefs;
  16574. exports.pushScopeId = pushScopeId;
  16575. exports.queuePostFlushCb = queuePostFlushCb;
  16576. exports.reactive = reactive;
  16577. exports.readonly = readonly;
  16578. exports.ref = ref;
  16579. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  16580. exports.render = render;
  16581. exports.renderList = renderList;
  16582. exports.renderSlot = renderSlot;
  16583. exports.resolveComponent = resolveComponent;
  16584. exports.resolveDirective = resolveDirective;
  16585. exports.resolveDynamicComponent = resolveDynamicComponent;
  16586. exports.resolveFilter = resolveFilter;
  16587. exports.resolveTransitionHooks = resolveTransitionHooks;
  16588. exports.setBlockTracking = setBlockTracking;
  16589. exports.setDevtoolsHook = setDevtoolsHook;
  16590. exports.setTransitionHooks = setTransitionHooks;
  16591. exports.shallowReactive = shallowReactive;
  16592. exports.shallowReadonly = shallowReadonly;
  16593. exports.shallowRef = shallowRef;
  16594. exports.ssrContextKey = ssrContextKey;
  16595. exports.ssrUtils = ssrUtils;
  16596. exports.stop = stop;
  16597. exports.toDisplayString = toDisplayString;
  16598. exports.toHandlerKey = toHandlerKey;
  16599. exports.toHandlers = toHandlers;
  16600. exports.toRaw = toRaw;
  16601. exports.toRef = toRef;
  16602. exports.toRefs = toRefs;
  16603. exports.toValue = toValue;
  16604. exports.transformVNodeArgs = transformVNodeArgs;
  16605. exports.triggerRef = triggerRef;
  16606. exports.unref = unref;
  16607. exports.useAttrs = useAttrs;
  16608. exports.useCssModule = useCssModule;
  16609. exports.useCssVars = useCssVars;
  16610. exports.useModel = useModel;
  16611. exports.useSSRContext = useSSRContext;
  16612. exports.useSlots = useSlots;
  16613. exports.useTransitionState = useTransitionState;
  16614. exports.vModelCheckbox = vModelCheckbox;
  16615. exports.vModelDynamic = vModelDynamic;
  16616. exports.vModelRadio = vModelRadio;
  16617. exports.vModelSelect = vModelSelect;
  16618. exports.vModelText = vModelText;
  16619. exports.vShow = vShow;
  16620. exports.version = version;
  16621. exports.warn = warn;
  16622. exports.watch = watch;
  16623. exports.watchEffect = watchEffect;
  16624. exports.watchPostEffect = watchPostEffect;
  16625. exports.watchSyncEffect = watchSyncEffect;
  16626. exports.withAsyncContext = withAsyncContext;
  16627. exports.withCtx = withCtx;
  16628. exports.withDefaults = withDefaults;
  16629. exports.withDirectives = withDirectives;
  16630. exports.withKeys = withKeys;
  16631. exports.withMemo = withMemo;
  16632. exports.withModifiers = withModifiers;
  16633. exports.withScopeId = withScopeId;
  16634. return exports;
  16635. })({});