Node-Red configuration
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

vue.esm-browser.js 483KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774
  1. /**
  2. * vue v3.4.38
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. /*! #__NO_SIDE_EFFECTS__ */
  7. // @__NO_SIDE_EFFECTS__
  8. function makeMap(str, expectsLowerCase) {
  9. const set = new Set(str.split(","));
  10. return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
  11. }
  12. const EMPTY_OBJ = Object.freeze({}) ;
  13. const EMPTY_ARR = Object.freeze([]) ;
  14. const NOOP = () => {
  15. };
  16. const NO = () => false;
  17. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  18. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  19. const isModelListener = (key) => key.startsWith("onUpdate:");
  20. const extend = Object.assign;
  21. const remove = (arr, el) => {
  22. const i = arr.indexOf(el);
  23. if (i > -1) {
  24. arr.splice(i, 1);
  25. }
  26. };
  27. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  28. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  29. const isArray = Array.isArray;
  30. const isMap = (val) => toTypeString(val) === "[object Map]";
  31. const isSet = (val) => toTypeString(val) === "[object Set]";
  32. const isDate = (val) => toTypeString(val) === "[object Date]";
  33. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  34. const isFunction = (val) => typeof val === "function";
  35. const isString = (val) => typeof val === "string";
  36. const isSymbol = (val) => typeof val === "symbol";
  37. const isObject = (val) => val !== null && typeof val === "object";
  38. const isPromise = (val) => {
  39. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  40. };
  41. const objectToString = Object.prototype.toString;
  42. const toTypeString = (value) => objectToString.call(value);
  43. const toRawType = (value) => {
  44. return toTypeString(value).slice(8, -1);
  45. };
  46. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  47. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  48. const isReservedProp = /* @__PURE__ */ makeMap(
  49. // the leading comma is intentional so empty string "" is also included
  50. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  51. );
  52. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  53. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  54. );
  55. const cacheStringFunction = (fn) => {
  56. const cache = /* @__PURE__ */ Object.create(null);
  57. return (str) => {
  58. const hit = cache[str];
  59. return hit || (cache[str] = fn(str));
  60. };
  61. };
  62. const camelizeRE = /-(\w)/g;
  63. const camelize = cacheStringFunction((str) => {
  64. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  65. });
  66. const hyphenateRE = /\B([A-Z])/g;
  67. const hyphenate = cacheStringFunction(
  68. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  69. );
  70. const capitalize = cacheStringFunction((str) => {
  71. return str.charAt(0).toUpperCase() + str.slice(1);
  72. });
  73. const toHandlerKey = cacheStringFunction((str) => {
  74. const s = str ? `on${capitalize(str)}` : ``;
  75. return s;
  76. });
  77. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  78. const invokeArrayFns = (fns, ...arg) => {
  79. for (let i = 0; i < fns.length; i++) {
  80. fns[i](...arg);
  81. }
  82. };
  83. const def = (obj, key, value, writable = false) => {
  84. Object.defineProperty(obj, key, {
  85. configurable: true,
  86. enumerable: false,
  87. writable,
  88. value
  89. });
  90. };
  91. const looseToNumber = (val) => {
  92. const n = parseFloat(val);
  93. return isNaN(n) ? val : n;
  94. };
  95. const toNumber = (val) => {
  96. const n = isString(val) ? Number(val) : NaN;
  97. return isNaN(n) ? val : n;
  98. };
  99. let _globalThis;
  100. const getGlobalThis = () => {
  101. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  102. };
  103. const PatchFlagNames = {
  104. [1]: `TEXT`,
  105. [2]: `CLASS`,
  106. [4]: `STYLE`,
  107. [8]: `PROPS`,
  108. [16]: `FULL_PROPS`,
  109. [32]: `NEED_HYDRATION`,
  110. [64]: `STABLE_FRAGMENT`,
  111. [128]: `KEYED_FRAGMENT`,
  112. [256]: `UNKEYED_FRAGMENT`,
  113. [512]: `NEED_PATCH`,
  114. [1024]: `DYNAMIC_SLOTS`,
  115. [2048]: `DEV_ROOT_FRAGMENT`,
  116. [-1]: `HOISTED`,
  117. [-2]: `BAIL`
  118. };
  119. const slotFlagsText = {
  120. [1]: "STABLE",
  121. [2]: "DYNAMIC",
  122. [3]: "FORWARDED"
  123. };
  124. 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";
  125. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  126. const range = 2;
  127. function generateCodeFrame(source, start = 0, end = source.length) {
  128. start = Math.max(0, Math.min(start, source.length));
  129. end = Math.max(0, Math.min(end, source.length));
  130. if (start > end) return "";
  131. let lines = source.split(/(\r?\n)/);
  132. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  133. lines = lines.filter((_, idx) => idx % 2 === 0);
  134. let count = 0;
  135. const res = [];
  136. for (let i = 0; i < lines.length; i++) {
  137. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  138. if (count >= start) {
  139. for (let j = i - range; j <= i + range || end > count; j++) {
  140. if (j < 0 || j >= lines.length) continue;
  141. const line = j + 1;
  142. res.push(
  143. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  144. );
  145. const lineLength = lines[j].length;
  146. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  147. if (j === i) {
  148. const pad = start - (count - (lineLength + newLineSeqLength));
  149. const length = Math.max(
  150. 1,
  151. end > count ? lineLength - pad : end - start
  152. );
  153. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  154. } else if (j > i) {
  155. if (end > count) {
  156. const length = Math.max(Math.min(end - count, lineLength), 1);
  157. res.push(` | ` + "^".repeat(length));
  158. }
  159. count += lineLength + newLineSeqLength;
  160. }
  161. }
  162. break;
  163. }
  164. }
  165. return res.join("\n");
  166. }
  167. function normalizeStyle(value) {
  168. if (isArray(value)) {
  169. const res = {};
  170. for (let i = 0; i < value.length; i++) {
  171. const item = value[i];
  172. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  173. if (normalized) {
  174. for (const key in normalized) {
  175. res[key] = normalized[key];
  176. }
  177. }
  178. }
  179. return res;
  180. } else if (isString(value) || isObject(value)) {
  181. return value;
  182. }
  183. }
  184. const listDelimiterRE = /;(?![^(]*\))/g;
  185. const propertyDelimiterRE = /:([^]+)/;
  186. const styleCommentRE = /\/\*[^]*?\*\//g;
  187. function parseStringStyle(cssText) {
  188. const ret = {};
  189. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  190. if (item) {
  191. const tmp = item.split(propertyDelimiterRE);
  192. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  193. }
  194. });
  195. return ret;
  196. }
  197. function stringifyStyle(styles) {
  198. let ret = "";
  199. if (!styles || isString(styles)) {
  200. return ret;
  201. }
  202. for (const key in styles) {
  203. const value = styles[key];
  204. if (isString(value) || typeof value === "number") {
  205. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  206. ret += `${normalizedKey}:${value};`;
  207. }
  208. }
  209. return ret;
  210. }
  211. function normalizeClass(value) {
  212. let res = "";
  213. if (isString(value)) {
  214. res = value;
  215. } else if (isArray(value)) {
  216. for (let i = 0; i < value.length; i++) {
  217. const normalized = normalizeClass(value[i]);
  218. if (normalized) {
  219. res += normalized + " ";
  220. }
  221. }
  222. } else if (isObject(value)) {
  223. for (const name in value) {
  224. if (value[name]) {
  225. res += name + " ";
  226. }
  227. }
  228. }
  229. return res.trim();
  230. }
  231. function normalizeProps(props) {
  232. if (!props) return null;
  233. let { class: klass, style } = props;
  234. if (klass && !isString(klass)) {
  235. props.class = normalizeClass(klass);
  236. }
  237. if (style) {
  238. props.style = normalizeStyle(style);
  239. }
  240. return props;
  241. }
  242. 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";
  243. 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";
  244. 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";
  245. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  246. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  247. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  248. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  249. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  250. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  251. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  252. const isBooleanAttr = /* @__PURE__ */ makeMap(
  253. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  254. );
  255. function includeBooleanAttr(value) {
  256. return !!value || value === "";
  257. }
  258. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  259. `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`
  260. );
  261. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  262. `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`
  263. );
  264. function isRenderableAttrValue(value) {
  265. if (value == null) {
  266. return false;
  267. }
  268. const type = typeof value;
  269. return type === "string" || type === "number" || type === "boolean";
  270. }
  271. function looseCompareArrays(a, b) {
  272. if (a.length !== b.length) return false;
  273. let equal = true;
  274. for (let i = 0; equal && i < a.length; i++) {
  275. equal = looseEqual(a[i], b[i]);
  276. }
  277. return equal;
  278. }
  279. function looseEqual(a, b) {
  280. if (a === b) return true;
  281. let aValidType = isDate(a);
  282. let bValidType = isDate(b);
  283. if (aValidType || bValidType) {
  284. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  285. }
  286. aValidType = isSymbol(a);
  287. bValidType = isSymbol(b);
  288. if (aValidType || bValidType) {
  289. return a === b;
  290. }
  291. aValidType = isArray(a);
  292. bValidType = isArray(b);
  293. if (aValidType || bValidType) {
  294. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  295. }
  296. aValidType = isObject(a);
  297. bValidType = isObject(b);
  298. if (aValidType || bValidType) {
  299. if (!aValidType || !bValidType) {
  300. return false;
  301. }
  302. const aKeysCount = Object.keys(a).length;
  303. const bKeysCount = Object.keys(b).length;
  304. if (aKeysCount !== bKeysCount) {
  305. return false;
  306. }
  307. for (const key in a) {
  308. const aHasKey = a.hasOwnProperty(key);
  309. const bHasKey = b.hasOwnProperty(key);
  310. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  311. return false;
  312. }
  313. }
  314. }
  315. return String(a) === String(b);
  316. }
  317. function looseIndexOf(arr, val) {
  318. return arr.findIndex((item) => looseEqual(item, val));
  319. }
  320. const isRef$1 = (val) => {
  321. return !!(val && val.__v_isRef === true);
  322. };
  323. const toDisplayString = (val) => {
  324. 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);
  325. };
  326. const replacer = (_key, val) => {
  327. if (isRef$1(val)) {
  328. return replacer(_key, val.value);
  329. } else if (isMap(val)) {
  330. return {
  331. [`Map(${val.size})`]: [...val.entries()].reduce(
  332. (entries, [key, val2], i) => {
  333. entries[stringifySymbol(key, i) + " =>"] = val2;
  334. return entries;
  335. },
  336. {}
  337. )
  338. };
  339. } else if (isSet(val)) {
  340. return {
  341. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  342. };
  343. } else if (isSymbol(val)) {
  344. return stringifySymbol(val);
  345. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  346. return String(val);
  347. }
  348. return val;
  349. };
  350. const stringifySymbol = (v, i = "") => {
  351. var _a;
  352. return (
  353. // Symbol.description in es2019+ so we need to cast here to pass
  354. // the lib: es2016 check
  355. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  356. );
  357. };
  358. function warn$2(msg, ...args) {
  359. console.warn(`[Vue warn] ${msg}`, ...args);
  360. }
  361. let activeEffectScope;
  362. class EffectScope {
  363. constructor(detached = false) {
  364. this.detached = detached;
  365. /**
  366. * @internal
  367. */
  368. this._active = true;
  369. /**
  370. * @internal
  371. */
  372. this.effects = [];
  373. /**
  374. * @internal
  375. */
  376. this.cleanups = [];
  377. this.parent = activeEffectScope;
  378. if (!detached && activeEffectScope) {
  379. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  380. this
  381. ) - 1;
  382. }
  383. }
  384. get active() {
  385. return this._active;
  386. }
  387. run(fn) {
  388. if (this._active) {
  389. const currentEffectScope = activeEffectScope;
  390. try {
  391. activeEffectScope = this;
  392. return fn();
  393. } finally {
  394. activeEffectScope = currentEffectScope;
  395. }
  396. } else {
  397. warn$2(`cannot run an inactive effect scope.`);
  398. }
  399. }
  400. /**
  401. * This should only be called on non-detached scopes
  402. * @internal
  403. */
  404. on() {
  405. activeEffectScope = this;
  406. }
  407. /**
  408. * This should only be called on non-detached scopes
  409. * @internal
  410. */
  411. off() {
  412. activeEffectScope = this.parent;
  413. }
  414. stop(fromParent) {
  415. if (this._active) {
  416. let i, l;
  417. for (i = 0, l = this.effects.length; i < l; i++) {
  418. this.effects[i].stop();
  419. }
  420. for (i = 0, l = this.cleanups.length; i < l; i++) {
  421. this.cleanups[i]();
  422. }
  423. if (this.scopes) {
  424. for (i = 0, l = this.scopes.length; i < l; i++) {
  425. this.scopes[i].stop(true);
  426. }
  427. }
  428. if (!this.detached && this.parent && !fromParent) {
  429. const last = this.parent.scopes.pop();
  430. if (last && last !== this) {
  431. this.parent.scopes[this.index] = last;
  432. last.index = this.index;
  433. }
  434. }
  435. this.parent = void 0;
  436. this._active = false;
  437. }
  438. }
  439. }
  440. function effectScope(detached) {
  441. return new EffectScope(detached);
  442. }
  443. function recordEffectScope(effect, scope = activeEffectScope) {
  444. if (scope && scope.active) {
  445. scope.effects.push(effect);
  446. }
  447. }
  448. function getCurrentScope() {
  449. return activeEffectScope;
  450. }
  451. function onScopeDispose(fn) {
  452. if (activeEffectScope) {
  453. activeEffectScope.cleanups.push(fn);
  454. } else {
  455. warn$2(
  456. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  457. );
  458. }
  459. }
  460. let activeEffect;
  461. class ReactiveEffect {
  462. constructor(fn, trigger, scheduler, scope) {
  463. this.fn = fn;
  464. this.trigger = trigger;
  465. this.scheduler = scheduler;
  466. this.active = true;
  467. this.deps = [];
  468. /**
  469. * @internal
  470. */
  471. this._dirtyLevel = 4;
  472. /**
  473. * @internal
  474. */
  475. this._trackId = 0;
  476. /**
  477. * @internal
  478. */
  479. this._runnings = 0;
  480. /**
  481. * @internal
  482. */
  483. this._shouldSchedule = false;
  484. /**
  485. * @internal
  486. */
  487. this._depsLength = 0;
  488. recordEffectScope(this, scope);
  489. }
  490. get dirty() {
  491. if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
  492. this._dirtyLevel = 1;
  493. pauseTracking();
  494. for (let i = 0; i < this._depsLength; i++) {
  495. const dep = this.deps[i];
  496. if (dep.computed) {
  497. triggerComputed(dep.computed);
  498. if (this._dirtyLevel >= 4) {
  499. break;
  500. }
  501. }
  502. }
  503. if (this._dirtyLevel === 1) {
  504. this._dirtyLevel = 0;
  505. }
  506. resetTracking();
  507. }
  508. return this._dirtyLevel >= 4;
  509. }
  510. set dirty(v) {
  511. this._dirtyLevel = v ? 4 : 0;
  512. }
  513. run() {
  514. this._dirtyLevel = 0;
  515. if (!this.active) {
  516. return this.fn();
  517. }
  518. let lastShouldTrack = shouldTrack;
  519. let lastEffect = activeEffect;
  520. try {
  521. shouldTrack = true;
  522. activeEffect = this;
  523. this._runnings++;
  524. preCleanupEffect(this);
  525. return this.fn();
  526. } finally {
  527. postCleanupEffect(this);
  528. this._runnings--;
  529. activeEffect = lastEffect;
  530. shouldTrack = lastShouldTrack;
  531. }
  532. }
  533. stop() {
  534. if (this.active) {
  535. preCleanupEffect(this);
  536. postCleanupEffect(this);
  537. this.onStop && this.onStop();
  538. this.active = false;
  539. }
  540. }
  541. }
  542. function triggerComputed(computed) {
  543. return computed.value;
  544. }
  545. function preCleanupEffect(effect2) {
  546. effect2._trackId++;
  547. effect2._depsLength = 0;
  548. }
  549. function postCleanupEffect(effect2) {
  550. if (effect2.deps.length > effect2._depsLength) {
  551. for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
  552. cleanupDepEffect(effect2.deps[i], effect2);
  553. }
  554. effect2.deps.length = effect2._depsLength;
  555. }
  556. }
  557. function cleanupDepEffect(dep, effect2) {
  558. const trackId = dep.get(effect2);
  559. if (trackId !== void 0 && effect2._trackId !== trackId) {
  560. dep.delete(effect2);
  561. if (dep.size === 0) {
  562. dep.cleanup();
  563. }
  564. }
  565. }
  566. function effect(fn, options) {
  567. if (fn.effect instanceof ReactiveEffect) {
  568. fn = fn.effect.fn;
  569. }
  570. const _effect = new ReactiveEffect(fn, NOOP, () => {
  571. if (_effect.dirty) {
  572. _effect.run();
  573. }
  574. });
  575. if (options) {
  576. extend(_effect, options);
  577. if (options.scope) recordEffectScope(_effect, options.scope);
  578. }
  579. if (!options || !options.lazy) {
  580. _effect.run();
  581. }
  582. const runner = _effect.run.bind(_effect);
  583. runner.effect = _effect;
  584. return runner;
  585. }
  586. function stop(runner) {
  587. runner.effect.stop();
  588. }
  589. let shouldTrack = true;
  590. let pauseScheduleStack = 0;
  591. const trackStack = [];
  592. function pauseTracking() {
  593. trackStack.push(shouldTrack);
  594. shouldTrack = false;
  595. }
  596. function resetTracking() {
  597. const last = trackStack.pop();
  598. shouldTrack = last === void 0 ? true : last;
  599. }
  600. function pauseScheduling() {
  601. pauseScheduleStack++;
  602. }
  603. function resetScheduling() {
  604. pauseScheduleStack--;
  605. while (!pauseScheduleStack && queueEffectSchedulers.length) {
  606. queueEffectSchedulers.shift()();
  607. }
  608. }
  609. function trackEffect(effect2, dep, debuggerEventExtraInfo) {
  610. var _a;
  611. if (dep.get(effect2) !== effect2._trackId) {
  612. dep.set(effect2, effect2._trackId);
  613. const oldDep = effect2.deps[effect2._depsLength];
  614. if (oldDep !== dep) {
  615. if (oldDep) {
  616. cleanupDepEffect(oldDep, effect2);
  617. }
  618. effect2.deps[effect2._depsLength++] = dep;
  619. } else {
  620. effect2._depsLength++;
  621. }
  622. {
  623. (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  624. }
  625. }
  626. }
  627. const queueEffectSchedulers = [];
  628. function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
  629. var _a;
  630. pauseScheduling();
  631. for (const effect2 of dep.keys()) {
  632. let tracking;
  633. if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  634. effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
  635. effect2._dirtyLevel = dirtyLevel;
  636. }
  637. if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  638. {
  639. (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  640. }
  641. effect2.trigger();
  642. if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
  643. effect2._shouldSchedule = false;
  644. if (effect2.scheduler) {
  645. queueEffectSchedulers.push(effect2.scheduler);
  646. }
  647. }
  648. }
  649. }
  650. resetScheduling();
  651. }
  652. const createDep = (cleanup, computed) => {
  653. const dep = /* @__PURE__ */ new Map();
  654. dep.cleanup = cleanup;
  655. dep.computed = computed;
  656. return dep;
  657. };
  658. const targetMap = /* @__PURE__ */ new WeakMap();
  659. const ITERATE_KEY = Symbol("iterate" );
  660. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
  661. function track(target, type, key) {
  662. if (shouldTrack && activeEffect) {
  663. let depsMap = targetMap.get(target);
  664. if (!depsMap) {
  665. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  666. }
  667. let dep = depsMap.get(key);
  668. if (!dep) {
  669. depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
  670. }
  671. trackEffect(
  672. activeEffect,
  673. dep,
  674. {
  675. target,
  676. type,
  677. key
  678. }
  679. );
  680. }
  681. }
  682. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  683. const depsMap = targetMap.get(target);
  684. if (!depsMap) {
  685. return;
  686. }
  687. let deps = [];
  688. if (type === "clear") {
  689. deps = [...depsMap.values()];
  690. } else if (key === "length" && isArray(target)) {
  691. const newLength = Number(newValue);
  692. depsMap.forEach((dep, key2) => {
  693. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  694. deps.push(dep);
  695. }
  696. });
  697. } else {
  698. if (key !== void 0) {
  699. deps.push(depsMap.get(key));
  700. }
  701. switch (type) {
  702. case "add":
  703. if (!isArray(target)) {
  704. deps.push(depsMap.get(ITERATE_KEY));
  705. if (isMap(target)) {
  706. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  707. }
  708. } else if (isIntegerKey(key)) {
  709. deps.push(depsMap.get("length"));
  710. }
  711. break;
  712. case "delete":
  713. if (!isArray(target)) {
  714. deps.push(depsMap.get(ITERATE_KEY));
  715. if (isMap(target)) {
  716. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  717. }
  718. }
  719. break;
  720. case "set":
  721. if (isMap(target)) {
  722. deps.push(depsMap.get(ITERATE_KEY));
  723. }
  724. break;
  725. }
  726. }
  727. pauseScheduling();
  728. for (const dep of deps) {
  729. if (dep) {
  730. triggerEffects(
  731. dep,
  732. 4,
  733. {
  734. target,
  735. type,
  736. key,
  737. newValue,
  738. oldValue,
  739. oldTarget
  740. }
  741. );
  742. }
  743. }
  744. resetScheduling();
  745. }
  746. function getDepFromReactive(object, key) {
  747. const depsMap = targetMap.get(object);
  748. return depsMap && depsMap.get(key);
  749. }
  750. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  751. const builtInSymbols = new Set(
  752. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  753. );
  754. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  755. function createArrayInstrumentations() {
  756. const instrumentations = {};
  757. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  758. instrumentations[key] = function(...args) {
  759. const arr = toRaw(this);
  760. for (let i = 0, l = this.length; i < l; i++) {
  761. track(arr, "get", i + "");
  762. }
  763. const res = arr[key](...args);
  764. if (res === -1 || res === false) {
  765. return arr[key](...args.map(toRaw));
  766. } else {
  767. return res;
  768. }
  769. };
  770. });
  771. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  772. instrumentations[key] = function(...args) {
  773. pauseTracking();
  774. pauseScheduling();
  775. const res = toRaw(this)[key].apply(this, args);
  776. resetScheduling();
  777. resetTracking();
  778. return res;
  779. };
  780. });
  781. return instrumentations;
  782. }
  783. function hasOwnProperty(key) {
  784. if (!isSymbol(key)) key = String(key);
  785. const obj = toRaw(this);
  786. track(obj, "has", key);
  787. return obj.hasOwnProperty(key);
  788. }
  789. class BaseReactiveHandler {
  790. constructor(_isReadonly = false, _isShallow = false) {
  791. this._isReadonly = _isReadonly;
  792. this._isShallow = _isShallow;
  793. }
  794. get(target, key, receiver) {
  795. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  796. if (key === "__v_isReactive") {
  797. return !isReadonly2;
  798. } else if (key === "__v_isReadonly") {
  799. return isReadonly2;
  800. } else if (key === "__v_isShallow") {
  801. return isShallow2;
  802. } else if (key === "__v_raw") {
  803. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  804. // this means the receiver is a user proxy of the reactive proxy
  805. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  806. return target;
  807. }
  808. return;
  809. }
  810. const targetIsArray = isArray(target);
  811. if (!isReadonly2) {
  812. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  813. return Reflect.get(arrayInstrumentations, key, receiver);
  814. }
  815. if (key === "hasOwnProperty") {
  816. return hasOwnProperty;
  817. }
  818. }
  819. const res = Reflect.get(target, key, receiver);
  820. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  821. return res;
  822. }
  823. if (!isReadonly2) {
  824. track(target, "get", key);
  825. }
  826. if (isShallow2) {
  827. return res;
  828. }
  829. if (isRef(res)) {
  830. return targetIsArray && isIntegerKey(key) ? res : res.value;
  831. }
  832. if (isObject(res)) {
  833. return isReadonly2 ? readonly(res) : reactive(res);
  834. }
  835. return res;
  836. }
  837. }
  838. class MutableReactiveHandler extends BaseReactiveHandler {
  839. constructor(isShallow2 = false) {
  840. super(false, isShallow2);
  841. }
  842. set(target, key, value, receiver) {
  843. let oldValue = target[key];
  844. if (!this._isShallow) {
  845. const isOldValueReadonly = isReadonly(oldValue);
  846. if (!isShallow(value) && !isReadonly(value)) {
  847. oldValue = toRaw(oldValue);
  848. value = toRaw(value);
  849. }
  850. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  851. if (isOldValueReadonly) {
  852. return false;
  853. } else {
  854. oldValue.value = value;
  855. return true;
  856. }
  857. }
  858. }
  859. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  860. const result = Reflect.set(target, key, value, receiver);
  861. if (target === toRaw(receiver)) {
  862. if (!hadKey) {
  863. trigger(target, "add", key, value);
  864. } else if (hasChanged(value, oldValue)) {
  865. trigger(target, "set", key, value, oldValue);
  866. }
  867. }
  868. return result;
  869. }
  870. deleteProperty(target, key) {
  871. const hadKey = hasOwn(target, key);
  872. const oldValue = target[key];
  873. const result = Reflect.deleteProperty(target, key);
  874. if (result && hadKey) {
  875. trigger(target, "delete", key, void 0, oldValue);
  876. }
  877. return result;
  878. }
  879. has(target, key) {
  880. const result = Reflect.has(target, key);
  881. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  882. track(target, "has", key);
  883. }
  884. return result;
  885. }
  886. ownKeys(target) {
  887. track(
  888. target,
  889. "iterate",
  890. isArray(target) ? "length" : ITERATE_KEY
  891. );
  892. return Reflect.ownKeys(target);
  893. }
  894. }
  895. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  896. constructor(isShallow2 = false) {
  897. super(true, isShallow2);
  898. }
  899. set(target, key) {
  900. {
  901. warn$2(
  902. `Set operation on key "${String(key)}" failed: target is readonly.`,
  903. target
  904. );
  905. }
  906. return true;
  907. }
  908. deleteProperty(target, key) {
  909. {
  910. warn$2(
  911. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  912. target
  913. );
  914. }
  915. return true;
  916. }
  917. }
  918. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  919. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  920. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
  921. true
  922. );
  923. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  924. const toShallow = (value) => value;
  925. const getProto = (v) => Reflect.getPrototypeOf(v);
  926. function get(target, key, isReadonly2 = false, isShallow2 = false) {
  927. target = target["__v_raw"];
  928. const rawTarget = toRaw(target);
  929. const rawKey = toRaw(key);
  930. if (!isReadonly2) {
  931. if (hasChanged(key, rawKey)) {
  932. track(rawTarget, "get", key);
  933. }
  934. track(rawTarget, "get", rawKey);
  935. }
  936. const { has: has2 } = getProto(rawTarget);
  937. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  938. if (has2.call(rawTarget, key)) {
  939. return wrap(target.get(key));
  940. } else if (has2.call(rawTarget, rawKey)) {
  941. return wrap(target.get(rawKey));
  942. } else if (target !== rawTarget) {
  943. target.get(key);
  944. }
  945. }
  946. function has(key, isReadonly2 = false) {
  947. const target = this["__v_raw"];
  948. const rawTarget = toRaw(target);
  949. const rawKey = toRaw(key);
  950. if (!isReadonly2) {
  951. if (hasChanged(key, rawKey)) {
  952. track(rawTarget, "has", key);
  953. }
  954. track(rawTarget, "has", rawKey);
  955. }
  956. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  957. }
  958. function size(target, isReadonly2 = false) {
  959. target = target["__v_raw"];
  960. !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
  961. return Reflect.get(target, "size", target);
  962. }
  963. function add(value, _isShallow = false) {
  964. if (!_isShallow && !isShallow(value) && !isReadonly(value)) {
  965. value = toRaw(value);
  966. }
  967. const target = toRaw(this);
  968. const proto = getProto(target);
  969. const hadKey = proto.has.call(target, value);
  970. if (!hadKey) {
  971. target.add(value);
  972. trigger(target, "add", value, value);
  973. }
  974. return this;
  975. }
  976. function set(key, value, _isShallow = false) {
  977. if (!_isShallow && !isShallow(value) && !isReadonly(value)) {
  978. value = toRaw(value);
  979. }
  980. const target = toRaw(this);
  981. const { has: has2, get: get2 } = getProto(target);
  982. let hadKey = has2.call(target, key);
  983. if (!hadKey) {
  984. key = toRaw(key);
  985. hadKey = has2.call(target, key);
  986. } else {
  987. checkIdentityKeys(target, has2, key);
  988. }
  989. const oldValue = get2.call(target, key);
  990. target.set(key, value);
  991. if (!hadKey) {
  992. trigger(target, "add", key, value);
  993. } else if (hasChanged(value, oldValue)) {
  994. trigger(target, "set", key, value, oldValue);
  995. }
  996. return this;
  997. }
  998. function deleteEntry(key) {
  999. const target = toRaw(this);
  1000. const { has: has2, get: get2 } = getProto(target);
  1001. let hadKey = has2.call(target, key);
  1002. if (!hadKey) {
  1003. key = toRaw(key);
  1004. hadKey = has2.call(target, key);
  1005. } else {
  1006. checkIdentityKeys(target, has2, key);
  1007. }
  1008. const oldValue = get2 ? get2.call(target, key) : void 0;
  1009. const result = target.delete(key);
  1010. if (hadKey) {
  1011. trigger(target, "delete", key, void 0, oldValue);
  1012. }
  1013. return result;
  1014. }
  1015. function clear() {
  1016. const target = toRaw(this);
  1017. const hadItems = target.size !== 0;
  1018. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1019. const result = target.clear();
  1020. if (hadItems) {
  1021. trigger(target, "clear", void 0, void 0, oldTarget);
  1022. }
  1023. return result;
  1024. }
  1025. function createForEach(isReadonly2, isShallow2) {
  1026. return function forEach(callback, thisArg) {
  1027. const observed = this;
  1028. const target = observed["__v_raw"];
  1029. const rawTarget = toRaw(target);
  1030. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1031. !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
  1032. return target.forEach((value, key) => {
  1033. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1034. });
  1035. };
  1036. }
  1037. function createIterableMethod(method, isReadonly2, isShallow2) {
  1038. return function(...args) {
  1039. const target = this["__v_raw"];
  1040. const rawTarget = toRaw(target);
  1041. const targetIsMap = isMap(rawTarget);
  1042. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1043. const isKeyOnly = method === "keys" && targetIsMap;
  1044. const innerIterator = target[method](...args);
  1045. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1046. !isReadonly2 && track(
  1047. rawTarget,
  1048. "iterate",
  1049. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1050. );
  1051. return {
  1052. // iterator protocol
  1053. next() {
  1054. const { value, done } = innerIterator.next();
  1055. return done ? { value, done } : {
  1056. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1057. done
  1058. };
  1059. },
  1060. // iterable protocol
  1061. [Symbol.iterator]() {
  1062. return this;
  1063. }
  1064. };
  1065. };
  1066. }
  1067. function createReadonlyMethod(type) {
  1068. return function(...args) {
  1069. {
  1070. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1071. warn$2(
  1072. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1073. toRaw(this)
  1074. );
  1075. }
  1076. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1077. };
  1078. }
  1079. function createInstrumentations() {
  1080. const mutableInstrumentations2 = {
  1081. get(key) {
  1082. return get(this, key);
  1083. },
  1084. get size() {
  1085. return size(this);
  1086. },
  1087. has,
  1088. add,
  1089. set,
  1090. delete: deleteEntry,
  1091. clear,
  1092. forEach: createForEach(false, false)
  1093. };
  1094. const shallowInstrumentations2 = {
  1095. get(key) {
  1096. return get(this, key, false, true);
  1097. },
  1098. get size() {
  1099. return size(this);
  1100. },
  1101. has,
  1102. add(value) {
  1103. return add.call(this, value, true);
  1104. },
  1105. set(key, value) {
  1106. return set.call(this, key, value, true);
  1107. },
  1108. delete: deleteEntry,
  1109. clear,
  1110. forEach: createForEach(false, true)
  1111. };
  1112. const readonlyInstrumentations2 = {
  1113. get(key) {
  1114. return get(this, key, true);
  1115. },
  1116. get size() {
  1117. return size(this, true);
  1118. },
  1119. has(key) {
  1120. return has.call(this, key, true);
  1121. },
  1122. add: createReadonlyMethod("add"),
  1123. set: createReadonlyMethod("set"),
  1124. delete: createReadonlyMethod("delete"),
  1125. clear: createReadonlyMethod("clear"),
  1126. forEach: createForEach(true, false)
  1127. };
  1128. const shallowReadonlyInstrumentations2 = {
  1129. get(key) {
  1130. return get(this, key, true, true);
  1131. },
  1132. get size() {
  1133. return size(this, true);
  1134. },
  1135. has(key) {
  1136. return has.call(this, key, true);
  1137. },
  1138. add: createReadonlyMethod("add"),
  1139. set: createReadonlyMethod("set"),
  1140. delete: createReadonlyMethod("delete"),
  1141. clear: createReadonlyMethod("clear"),
  1142. forEach: createForEach(true, true)
  1143. };
  1144. const iteratorMethods = [
  1145. "keys",
  1146. "values",
  1147. "entries",
  1148. Symbol.iterator
  1149. ];
  1150. iteratorMethods.forEach((method) => {
  1151. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  1152. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  1153. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  1154. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1155. method,
  1156. true,
  1157. true
  1158. );
  1159. });
  1160. return [
  1161. mutableInstrumentations2,
  1162. readonlyInstrumentations2,
  1163. shallowInstrumentations2,
  1164. shallowReadonlyInstrumentations2
  1165. ];
  1166. }
  1167. const [
  1168. mutableInstrumentations,
  1169. readonlyInstrumentations,
  1170. shallowInstrumentations,
  1171. shallowReadonlyInstrumentations
  1172. ] = /* @__PURE__ */ createInstrumentations();
  1173. function createInstrumentationGetter(isReadonly2, shallow) {
  1174. const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
  1175. return (target, key, receiver) => {
  1176. if (key === "__v_isReactive") {
  1177. return !isReadonly2;
  1178. } else if (key === "__v_isReadonly") {
  1179. return isReadonly2;
  1180. } else if (key === "__v_raw") {
  1181. return target;
  1182. }
  1183. return Reflect.get(
  1184. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1185. key,
  1186. receiver
  1187. );
  1188. };
  1189. }
  1190. const mutableCollectionHandlers = {
  1191. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1192. };
  1193. const shallowCollectionHandlers = {
  1194. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1195. };
  1196. const readonlyCollectionHandlers = {
  1197. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1198. };
  1199. const shallowReadonlyCollectionHandlers = {
  1200. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1201. };
  1202. function checkIdentityKeys(target, has2, key) {
  1203. const rawKey = toRaw(key);
  1204. if (rawKey !== key && has2.call(target, rawKey)) {
  1205. const type = toRawType(target);
  1206. warn$2(
  1207. `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.`
  1208. );
  1209. }
  1210. }
  1211. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1212. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1213. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1214. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1215. function targetTypeMap(rawType) {
  1216. switch (rawType) {
  1217. case "Object":
  1218. case "Array":
  1219. return 1 /* COMMON */;
  1220. case "Map":
  1221. case "Set":
  1222. case "WeakMap":
  1223. case "WeakSet":
  1224. return 2 /* COLLECTION */;
  1225. default:
  1226. return 0 /* INVALID */;
  1227. }
  1228. }
  1229. function getTargetType(value) {
  1230. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1231. }
  1232. function reactive(target) {
  1233. if (isReadonly(target)) {
  1234. return target;
  1235. }
  1236. return createReactiveObject(
  1237. target,
  1238. false,
  1239. mutableHandlers,
  1240. mutableCollectionHandlers,
  1241. reactiveMap
  1242. );
  1243. }
  1244. function shallowReactive(target) {
  1245. return createReactiveObject(
  1246. target,
  1247. false,
  1248. shallowReactiveHandlers,
  1249. shallowCollectionHandlers,
  1250. shallowReactiveMap
  1251. );
  1252. }
  1253. function readonly(target) {
  1254. return createReactiveObject(
  1255. target,
  1256. true,
  1257. readonlyHandlers,
  1258. readonlyCollectionHandlers,
  1259. readonlyMap
  1260. );
  1261. }
  1262. function shallowReadonly(target) {
  1263. return createReactiveObject(
  1264. target,
  1265. true,
  1266. shallowReadonlyHandlers,
  1267. shallowReadonlyCollectionHandlers,
  1268. shallowReadonlyMap
  1269. );
  1270. }
  1271. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1272. if (!isObject(target)) {
  1273. {
  1274. warn$2(
  1275. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1276. target
  1277. )}`
  1278. );
  1279. }
  1280. return target;
  1281. }
  1282. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1283. return target;
  1284. }
  1285. const existingProxy = proxyMap.get(target);
  1286. if (existingProxy) {
  1287. return existingProxy;
  1288. }
  1289. const targetType = getTargetType(target);
  1290. if (targetType === 0 /* INVALID */) {
  1291. return target;
  1292. }
  1293. const proxy = new Proxy(
  1294. target,
  1295. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1296. );
  1297. proxyMap.set(target, proxy);
  1298. return proxy;
  1299. }
  1300. function isReactive(value) {
  1301. if (isReadonly(value)) {
  1302. return isReactive(value["__v_raw"]);
  1303. }
  1304. return !!(value && value["__v_isReactive"]);
  1305. }
  1306. function isReadonly(value) {
  1307. return !!(value && value["__v_isReadonly"]);
  1308. }
  1309. function isShallow(value) {
  1310. return !!(value && value["__v_isShallow"]);
  1311. }
  1312. function isProxy(value) {
  1313. return value ? !!value["__v_raw"] : false;
  1314. }
  1315. function toRaw(observed) {
  1316. const raw = observed && observed["__v_raw"];
  1317. return raw ? toRaw(raw) : observed;
  1318. }
  1319. function markRaw(value) {
  1320. if (Object.isExtensible(value)) {
  1321. def(value, "__v_skip", true);
  1322. }
  1323. return value;
  1324. }
  1325. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1326. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1327. 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`;
  1328. class ComputedRefImpl {
  1329. constructor(getter, _setter, isReadonly, isSSR) {
  1330. this.getter = getter;
  1331. this._setter = _setter;
  1332. this.dep = void 0;
  1333. this.__v_isRef = true;
  1334. this["__v_isReadonly"] = false;
  1335. this.effect = new ReactiveEffect(
  1336. () => getter(this._value),
  1337. () => triggerRefValue(
  1338. this,
  1339. this.effect._dirtyLevel === 2 ? 2 : 3
  1340. )
  1341. );
  1342. this.effect.computed = this;
  1343. this.effect.active = this._cacheable = !isSSR;
  1344. this["__v_isReadonly"] = isReadonly;
  1345. }
  1346. get value() {
  1347. const self = toRaw(this);
  1348. if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
  1349. triggerRefValue(self, 4);
  1350. }
  1351. trackRefValue(self);
  1352. if (self.effect._dirtyLevel >= 2) {
  1353. if (this._warnRecursive) {
  1354. warn$2(COMPUTED_SIDE_EFFECT_WARN, `
  1355. getter: `, this.getter);
  1356. }
  1357. triggerRefValue(self, 2);
  1358. }
  1359. return self._value;
  1360. }
  1361. set value(newValue) {
  1362. this._setter(newValue);
  1363. }
  1364. // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
  1365. get _dirty() {
  1366. return this.effect.dirty;
  1367. }
  1368. set _dirty(v) {
  1369. this.effect.dirty = v;
  1370. }
  1371. // #endregion
  1372. }
  1373. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1374. let getter;
  1375. let setter;
  1376. const onlyGetter = isFunction(getterOrOptions);
  1377. if (onlyGetter) {
  1378. getter = getterOrOptions;
  1379. setter = () => {
  1380. warn$2("Write operation failed: computed value is readonly");
  1381. } ;
  1382. } else {
  1383. getter = getterOrOptions.get;
  1384. setter = getterOrOptions.set;
  1385. }
  1386. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1387. if (debugOptions && !isSSR) {
  1388. cRef.effect.onTrack = debugOptions.onTrack;
  1389. cRef.effect.onTrigger = debugOptions.onTrigger;
  1390. }
  1391. return cRef;
  1392. }
  1393. function trackRefValue(ref2) {
  1394. var _a;
  1395. if (shouldTrack && activeEffect) {
  1396. ref2 = toRaw(ref2);
  1397. trackEffect(
  1398. activeEffect,
  1399. (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
  1400. () => ref2.dep = void 0,
  1401. ref2 instanceof ComputedRefImpl ? ref2 : void 0
  1402. ),
  1403. {
  1404. target: ref2,
  1405. type: "get",
  1406. key: "value"
  1407. }
  1408. );
  1409. }
  1410. }
  1411. function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
  1412. ref2 = toRaw(ref2);
  1413. const dep = ref2.dep;
  1414. if (dep) {
  1415. triggerEffects(
  1416. dep,
  1417. dirtyLevel,
  1418. {
  1419. target: ref2,
  1420. type: "set",
  1421. key: "value",
  1422. newValue: newVal,
  1423. oldValue: oldVal
  1424. }
  1425. );
  1426. }
  1427. }
  1428. function isRef(r) {
  1429. return !!(r && r.__v_isRef === true);
  1430. }
  1431. function ref(value) {
  1432. return createRef(value, false);
  1433. }
  1434. function shallowRef(value) {
  1435. return createRef(value, true);
  1436. }
  1437. function createRef(rawValue, shallow) {
  1438. if (isRef(rawValue)) {
  1439. return rawValue;
  1440. }
  1441. return new RefImpl(rawValue, shallow);
  1442. }
  1443. class RefImpl {
  1444. constructor(value, __v_isShallow) {
  1445. this.__v_isShallow = __v_isShallow;
  1446. this.dep = void 0;
  1447. this.__v_isRef = true;
  1448. this._rawValue = __v_isShallow ? value : toRaw(value);
  1449. this._value = __v_isShallow ? value : toReactive(value);
  1450. }
  1451. get value() {
  1452. trackRefValue(this);
  1453. return this._value;
  1454. }
  1455. set value(newVal) {
  1456. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1457. newVal = useDirectValue ? newVal : toRaw(newVal);
  1458. if (hasChanged(newVal, this._rawValue)) {
  1459. const oldVal = this._rawValue;
  1460. this._rawValue = newVal;
  1461. this._value = useDirectValue ? newVal : toReactive(newVal);
  1462. triggerRefValue(this, 4, newVal, oldVal);
  1463. }
  1464. }
  1465. }
  1466. function triggerRef(ref2) {
  1467. triggerRefValue(ref2, 4, ref2.value );
  1468. }
  1469. function unref(ref2) {
  1470. return isRef(ref2) ? ref2.value : ref2;
  1471. }
  1472. function toValue(source) {
  1473. return isFunction(source) ? source() : unref(source);
  1474. }
  1475. const shallowUnwrapHandlers = {
  1476. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1477. set: (target, key, value, receiver) => {
  1478. const oldValue = target[key];
  1479. if (isRef(oldValue) && !isRef(value)) {
  1480. oldValue.value = value;
  1481. return true;
  1482. } else {
  1483. return Reflect.set(target, key, value, receiver);
  1484. }
  1485. }
  1486. };
  1487. function proxyRefs(objectWithRefs) {
  1488. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1489. }
  1490. class CustomRefImpl {
  1491. constructor(factory) {
  1492. this.dep = void 0;
  1493. this.__v_isRef = true;
  1494. const { get, set } = factory(
  1495. () => trackRefValue(this),
  1496. () => triggerRefValue(this)
  1497. );
  1498. this._get = get;
  1499. this._set = set;
  1500. }
  1501. get value() {
  1502. return this._get();
  1503. }
  1504. set value(newVal) {
  1505. this._set(newVal);
  1506. }
  1507. }
  1508. function customRef(factory) {
  1509. return new CustomRefImpl(factory);
  1510. }
  1511. function toRefs(object) {
  1512. if (!isProxy(object)) {
  1513. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1514. }
  1515. const ret = isArray(object) ? new Array(object.length) : {};
  1516. for (const key in object) {
  1517. ret[key] = propertyToRef(object, key);
  1518. }
  1519. return ret;
  1520. }
  1521. class ObjectRefImpl {
  1522. constructor(_object, _key, _defaultValue) {
  1523. this._object = _object;
  1524. this._key = _key;
  1525. this._defaultValue = _defaultValue;
  1526. this.__v_isRef = true;
  1527. }
  1528. get value() {
  1529. const val = this._object[this._key];
  1530. return val === void 0 ? this._defaultValue : val;
  1531. }
  1532. set value(newVal) {
  1533. this._object[this._key] = newVal;
  1534. }
  1535. get dep() {
  1536. return getDepFromReactive(toRaw(this._object), this._key);
  1537. }
  1538. }
  1539. class GetterRefImpl {
  1540. constructor(_getter) {
  1541. this._getter = _getter;
  1542. this.__v_isRef = true;
  1543. this.__v_isReadonly = true;
  1544. }
  1545. get value() {
  1546. return this._getter();
  1547. }
  1548. }
  1549. function toRef(source, key, defaultValue) {
  1550. if (isRef(source)) {
  1551. return source;
  1552. } else if (isFunction(source)) {
  1553. return new GetterRefImpl(source);
  1554. } else if (isObject(source) && arguments.length > 1) {
  1555. return propertyToRef(source, key, defaultValue);
  1556. } else {
  1557. return ref(source);
  1558. }
  1559. }
  1560. function propertyToRef(source, key, defaultValue) {
  1561. const val = source[key];
  1562. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1563. }
  1564. const TrackOpTypes = {
  1565. "GET": "get",
  1566. "HAS": "has",
  1567. "ITERATE": "iterate"
  1568. };
  1569. const TriggerOpTypes = {
  1570. "SET": "set",
  1571. "ADD": "add",
  1572. "DELETE": "delete",
  1573. "CLEAR": "clear"
  1574. };
  1575. const stack$1 = [];
  1576. function pushWarningContext(vnode) {
  1577. stack$1.push(vnode);
  1578. }
  1579. function popWarningContext() {
  1580. stack$1.pop();
  1581. }
  1582. let isWarning = false;
  1583. function warn$1(msg, ...args) {
  1584. if (isWarning) return;
  1585. isWarning = true;
  1586. pauseTracking();
  1587. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  1588. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1589. const trace = getComponentTrace();
  1590. if (appWarnHandler) {
  1591. callWithErrorHandling(
  1592. appWarnHandler,
  1593. instance,
  1594. 11,
  1595. [
  1596. // eslint-disable-next-line no-restricted-syntax
  1597. msg + args.map((a) => {
  1598. var _a, _b;
  1599. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  1600. }).join(""),
  1601. instance && instance.proxy,
  1602. trace.map(
  1603. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  1604. ).join("\n"),
  1605. trace
  1606. ]
  1607. );
  1608. } else {
  1609. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1610. if (trace.length && // avoid spamming console during tests
  1611. true) {
  1612. warnArgs.push(`
  1613. `, ...formatTrace(trace));
  1614. }
  1615. console.warn(...warnArgs);
  1616. }
  1617. resetTracking();
  1618. isWarning = false;
  1619. }
  1620. function getComponentTrace() {
  1621. let currentVNode = stack$1[stack$1.length - 1];
  1622. if (!currentVNode) {
  1623. return [];
  1624. }
  1625. const normalizedStack = [];
  1626. while (currentVNode) {
  1627. const last = normalizedStack[0];
  1628. if (last && last.vnode === currentVNode) {
  1629. last.recurseCount++;
  1630. } else {
  1631. normalizedStack.push({
  1632. vnode: currentVNode,
  1633. recurseCount: 0
  1634. });
  1635. }
  1636. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1637. currentVNode = parentInstance && parentInstance.vnode;
  1638. }
  1639. return normalizedStack;
  1640. }
  1641. function formatTrace(trace) {
  1642. const logs = [];
  1643. trace.forEach((entry, i) => {
  1644. logs.push(...i === 0 ? [] : [`
  1645. `], ...formatTraceEntry(entry));
  1646. });
  1647. return logs;
  1648. }
  1649. function formatTraceEntry({ vnode, recurseCount }) {
  1650. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1651. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1652. const open = ` at <${formatComponentName(
  1653. vnode.component,
  1654. vnode.type,
  1655. isRoot
  1656. )}`;
  1657. const close = `>` + postfix;
  1658. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1659. }
  1660. function formatProps(props) {
  1661. const res = [];
  1662. const keys = Object.keys(props);
  1663. keys.slice(0, 3).forEach((key) => {
  1664. res.push(...formatProp(key, props[key]));
  1665. });
  1666. if (keys.length > 3) {
  1667. res.push(` ...`);
  1668. }
  1669. return res;
  1670. }
  1671. function formatProp(key, value, raw) {
  1672. if (isString(value)) {
  1673. value = JSON.stringify(value);
  1674. return raw ? value : [`${key}=${value}`];
  1675. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1676. return raw ? value : [`${key}=${value}`];
  1677. } else if (isRef(value)) {
  1678. value = formatProp(key, toRaw(value.value), true);
  1679. return raw ? value : [`${key}=Ref<`, value, `>`];
  1680. } else if (isFunction(value)) {
  1681. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1682. } else {
  1683. value = toRaw(value);
  1684. return raw ? value : [`${key}=`, value];
  1685. }
  1686. }
  1687. function assertNumber(val, type) {
  1688. if (val === void 0) {
  1689. return;
  1690. } else if (typeof val !== "number") {
  1691. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  1692. } else if (isNaN(val)) {
  1693. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  1694. }
  1695. }
  1696. const ErrorCodes = {
  1697. "SETUP_FUNCTION": 0,
  1698. "0": "SETUP_FUNCTION",
  1699. "RENDER_FUNCTION": 1,
  1700. "1": "RENDER_FUNCTION",
  1701. "WATCH_GETTER": 2,
  1702. "2": "WATCH_GETTER",
  1703. "WATCH_CALLBACK": 3,
  1704. "3": "WATCH_CALLBACK",
  1705. "WATCH_CLEANUP": 4,
  1706. "4": "WATCH_CLEANUP",
  1707. "NATIVE_EVENT_HANDLER": 5,
  1708. "5": "NATIVE_EVENT_HANDLER",
  1709. "COMPONENT_EVENT_HANDLER": 6,
  1710. "6": "COMPONENT_EVENT_HANDLER",
  1711. "VNODE_HOOK": 7,
  1712. "7": "VNODE_HOOK",
  1713. "DIRECTIVE_HOOK": 8,
  1714. "8": "DIRECTIVE_HOOK",
  1715. "TRANSITION_HOOK": 9,
  1716. "9": "TRANSITION_HOOK",
  1717. "APP_ERROR_HANDLER": 10,
  1718. "10": "APP_ERROR_HANDLER",
  1719. "APP_WARN_HANDLER": 11,
  1720. "11": "APP_WARN_HANDLER",
  1721. "FUNCTION_REF": 12,
  1722. "12": "FUNCTION_REF",
  1723. "ASYNC_COMPONENT_LOADER": 13,
  1724. "13": "ASYNC_COMPONENT_LOADER",
  1725. "SCHEDULER": 14,
  1726. "14": "SCHEDULER",
  1727. "COMPONENT_UPDATE": 15,
  1728. "15": "COMPONENT_UPDATE"
  1729. };
  1730. const ErrorTypeStrings$1 = {
  1731. ["sp"]: "serverPrefetch hook",
  1732. ["bc"]: "beforeCreate hook",
  1733. ["c"]: "created hook",
  1734. ["bm"]: "beforeMount hook",
  1735. ["m"]: "mounted hook",
  1736. ["bu"]: "beforeUpdate hook",
  1737. ["u"]: "updated",
  1738. ["bum"]: "beforeUnmount hook",
  1739. ["um"]: "unmounted hook",
  1740. ["a"]: "activated hook",
  1741. ["da"]: "deactivated hook",
  1742. ["ec"]: "errorCaptured hook",
  1743. ["rtc"]: "renderTracked hook",
  1744. ["rtg"]: "renderTriggered hook",
  1745. [0]: "setup function",
  1746. [1]: "render function",
  1747. [2]: "watcher getter",
  1748. [3]: "watcher callback",
  1749. [4]: "watcher cleanup function",
  1750. [5]: "native event handler",
  1751. [6]: "component event handler",
  1752. [7]: "vnode hook",
  1753. [8]: "directive hook",
  1754. [9]: "transition hook",
  1755. [10]: "app errorHandler",
  1756. [11]: "app warnHandler",
  1757. [12]: "ref function",
  1758. [13]: "async component loader",
  1759. [14]: "scheduler flush",
  1760. [15]: "component update"
  1761. };
  1762. function callWithErrorHandling(fn, instance, type, args) {
  1763. try {
  1764. return args ? fn(...args) : fn();
  1765. } catch (err) {
  1766. handleError(err, instance, type);
  1767. }
  1768. }
  1769. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1770. if (isFunction(fn)) {
  1771. const res = callWithErrorHandling(fn, instance, type, args);
  1772. if (res && isPromise(res)) {
  1773. res.catch((err) => {
  1774. handleError(err, instance, type);
  1775. });
  1776. }
  1777. return res;
  1778. }
  1779. if (isArray(fn)) {
  1780. const values = [];
  1781. for (let i = 0; i < fn.length; i++) {
  1782. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1783. }
  1784. return values;
  1785. } else {
  1786. warn$1(
  1787. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  1788. );
  1789. }
  1790. }
  1791. function handleError(err, instance, type, throwInDev = true) {
  1792. const contextVNode = instance ? instance.vnode : null;
  1793. if (instance) {
  1794. let cur = instance.parent;
  1795. const exposedInstance = instance.proxy;
  1796. const errorInfo = ErrorTypeStrings$1[type] ;
  1797. while (cur) {
  1798. const errorCapturedHooks = cur.ec;
  1799. if (errorCapturedHooks) {
  1800. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1801. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1802. return;
  1803. }
  1804. }
  1805. }
  1806. cur = cur.parent;
  1807. }
  1808. const appErrorHandler = instance.appContext.config.errorHandler;
  1809. if (appErrorHandler) {
  1810. pauseTracking();
  1811. callWithErrorHandling(
  1812. appErrorHandler,
  1813. null,
  1814. 10,
  1815. [err, exposedInstance, errorInfo]
  1816. );
  1817. resetTracking();
  1818. return;
  1819. }
  1820. }
  1821. logError(err, type, contextVNode, throwInDev);
  1822. }
  1823. function logError(err, type, contextVNode, throwInDev = true) {
  1824. {
  1825. const info = ErrorTypeStrings$1[type];
  1826. if (contextVNode) {
  1827. pushWarningContext(contextVNode);
  1828. }
  1829. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1830. if (contextVNode) {
  1831. popWarningContext();
  1832. }
  1833. if (throwInDev) {
  1834. throw err;
  1835. } else {
  1836. console.error(err);
  1837. }
  1838. }
  1839. }
  1840. let isFlushing = false;
  1841. let isFlushPending = false;
  1842. const queue = [];
  1843. let flushIndex = 0;
  1844. const pendingPostFlushCbs = [];
  1845. let activePostFlushCbs = null;
  1846. let postFlushIndex = 0;
  1847. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1848. let currentFlushPromise = null;
  1849. const RECURSION_LIMIT = 100;
  1850. function nextTick(fn) {
  1851. const p = currentFlushPromise || resolvedPromise;
  1852. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  1853. }
  1854. function findInsertionIndex(id) {
  1855. let start = flushIndex + 1;
  1856. let end = queue.length;
  1857. while (start < end) {
  1858. const middle = start + end >>> 1;
  1859. const middleJob = queue[middle];
  1860. const middleJobId = getId(middleJob);
  1861. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  1862. start = middle + 1;
  1863. } else {
  1864. end = middle;
  1865. }
  1866. }
  1867. return start;
  1868. }
  1869. function queueJob(job) {
  1870. if (!queue.length || !queue.includes(
  1871. job,
  1872. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1873. )) {
  1874. if (job.id == null) {
  1875. queue.push(job);
  1876. } else {
  1877. queue.splice(findInsertionIndex(job.id), 0, job);
  1878. }
  1879. queueFlush();
  1880. }
  1881. }
  1882. function queueFlush() {
  1883. if (!isFlushing && !isFlushPending) {
  1884. isFlushPending = true;
  1885. currentFlushPromise = resolvedPromise.then(flushJobs);
  1886. }
  1887. }
  1888. function invalidateJob(job) {
  1889. const i = queue.indexOf(job);
  1890. if (i > flushIndex) {
  1891. queue.splice(i, 1);
  1892. }
  1893. }
  1894. function queuePostFlushCb(cb) {
  1895. if (!isArray(cb)) {
  1896. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1897. cb,
  1898. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1899. )) {
  1900. pendingPostFlushCbs.push(cb);
  1901. }
  1902. } else {
  1903. pendingPostFlushCbs.push(...cb);
  1904. }
  1905. queueFlush();
  1906. }
  1907. function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
  1908. {
  1909. seen = seen || /* @__PURE__ */ new Map();
  1910. }
  1911. for (; i < queue.length; i++) {
  1912. const cb = queue[i];
  1913. if (cb && cb.pre) {
  1914. if (instance && cb.id !== instance.uid) {
  1915. continue;
  1916. }
  1917. if (checkRecursiveUpdates(seen, cb)) {
  1918. continue;
  1919. }
  1920. queue.splice(i, 1);
  1921. i--;
  1922. cb();
  1923. }
  1924. }
  1925. }
  1926. function flushPostFlushCbs(seen) {
  1927. if (pendingPostFlushCbs.length) {
  1928. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  1929. (a, b) => getId(a) - getId(b)
  1930. );
  1931. pendingPostFlushCbs.length = 0;
  1932. if (activePostFlushCbs) {
  1933. activePostFlushCbs.push(...deduped);
  1934. return;
  1935. }
  1936. activePostFlushCbs = deduped;
  1937. {
  1938. seen = seen || /* @__PURE__ */ new Map();
  1939. }
  1940. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1941. const cb = activePostFlushCbs[postFlushIndex];
  1942. if (checkRecursiveUpdates(seen, cb)) {
  1943. continue;
  1944. }
  1945. if (cb.active !== false) cb();
  1946. }
  1947. activePostFlushCbs = null;
  1948. postFlushIndex = 0;
  1949. }
  1950. }
  1951. const getId = (job) => job.id == null ? Infinity : job.id;
  1952. const comparator = (a, b) => {
  1953. const diff = getId(a) - getId(b);
  1954. if (diff === 0) {
  1955. if (a.pre && !b.pre) return -1;
  1956. if (b.pre && !a.pre) return 1;
  1957. }
  1958. return diff;
  1959. };
  1960. function flushJobs(seen) {
  1961. isFlushPending = false;
  1962. isFlushing = true;
  1963. {
  1964. seen = seen || /* @__PURE__ */ new Map();
  1965. }
  1966. queue.sort(comparator);
  1967. const check = (job) => checkRecursiveUpdates(seen, job) ;
  1968. try {
  1969. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1970. const job = queue[flushIndex];
  1971. if (job && job.active !== false) {
  1972. if (check(job)) {
  1973. continue;
  1974. }
  1975. callWithErrorHandling(
  1976. job,
  1977. job.i,
  1978. job.i ? 15 : 14
  1979. );
  1980. }
  1981. }
  1982. } finally {
  1983. flushIndex = 0;
  1984. queue.length = 0;
  1985. flushPostFlushCbs(seen);
  1986. isFlushing = false;
  1987. currentFlushPromise = null;
  1988. if (queue.length || pendingPostFlushCbs.length) {
  1989. flushJobs(seen);
  1990. }
  1991. }
  1992. }
  1993. function checkRecursiveUpdates(seen, fn) {
  1994. if (!seen.has(fn)) {
  1995. seen.set(fn, 1);
  1996. } else {
  1997. const count = seen.get(fn);
  1998. if (count > RECURSION_LIMIT) {
  1999. const instance = fn.i;
  2000. const componentName = instance && getComponentName(instance.type);
  2001. handleError(
  2002. `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.`,
  2003. null,
  2004. 10
  2005. );
  2006. return true;
  2007. } else {
  2008. seen.set(fn, count + 1);
  2009. }
  2010. }
  2011. }
  2012. let isHmrUpdating = false;
  2013. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2014. {
  2015. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2016. createRecord: tryWrap(createRecord),
  2017. rerender: tryWrap(rerender),
  2018. reload: tryWrap(reload)
  2019. };
  2020. }
  2021. const map = /* @__PURE__ */ new Map();
  2022. function registerHMR(instance) {
  2023. const id = instance.type.__hmrId;
  2024. let record = map.get(id);
  2025. if (!record) {
  2026. createRecord(id, instance.type);
  2027. record = map.get(id);
  2028. }
  2029. record.instances.add(instance);
  2030. }
  2031. function unregisterHMR(instance) {
  2032. map.get(instance.type.__hmrId).instances.delete(instance);
  2033. }
  2034. function createRecord(id, initialDef) {
  2035. if (map.has(id)) {
  2036. return false;
  2037. }
  2038. map.set(id, {
  2039. initialDef: normalizeClassComponent(initialDef),
  2040. instances: /* @__PURE__ */ new Set()
  2041. });
  2042. return true;
  2043. }
  2044. function normalizeClassComponent(component) {
  2045. return isClassComponent(component) ? component.__vccOpts : component;
  2046. }
  2047. function rerender(id, newRender) {
  2048. const record = map.get(id);
  2049. if (!record) {
  2050. return;
  2051. }
  2052. record.initialDef.render = newRender;
  2053. [...record.instances].forEach((instance) => {
  2054. if (newRender) {
  2055. instance.render = newRender;
  2056. normalizeClassComponent(instance.type).render = newRender;
  2057. }
  2058. instance.renderCache = [];
  2059. isHmrUpdating = true;
  2060. instance.effect.dirty = true;
  2061. instance.update();
  2062. isHmrUpdating = false;
  2063. });
  2064. }
  2065. function reload(id, newComp) {
  2066. const record = map.get(id);
  2067. if (!record) return;
  2068. newComp = normalizeClassComponent(newComp);
  2069. updateComponentDef(record.initialDef, newComp);
  2070. const instances = [...record.instances];
  2071. for (let i = 0; i < instances.length; i++) {
  2072. const instance = instances[i];
  2073. const oldComp = normalizeClassComponent(instance.type);
  2074. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2075. if (!dirtyInstances) {
  2076. if (oldComp !== record.initialDef) {
  2077. updateComponentDef(oldComp, newComp);
  2078. }
  2079. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2080. }
  2081. dirtyInstances.add(instance);
  2082. instance.appContext.propsCache.delete(instance.type);
  2083. instance.appContext.emitsCache.delete(instance.type);
  2084. instance.appContext.optionsCache.delete(instance.type);
  2085. if (instance.ceReload) {
  2086. dirtyInstances.add(instance);
  2087. instance.ceReload(newComp.styles);
  2088. dirtyInstances.delete(instance);
  2089. } else if (instance.parent) {
  2090. instance.parent.effect.dirty = true;
  2091. queueJob(() => {
  2092. instance.parent.update();
  2093. dirtyInstances.delete(instance);
  2094. });
  2095. } else if (instance.appContext.reload) {
  2096. instance.appContext.reload();
  2097. } else if (typeof window !== "undefined") {
  2098. window.location.reload();
  2099. } else {
  2100. console.warn(
  2101. "[HMR] Root or manually mounted instance modified. Full reload required."
  2102. );
  2103. }
  2104. }
  2105. queuePostFlushCb(() => {
  2106. hmrDirtyComponents.clear();
  2107. });
  2108. }
  2109. function updateComponentDef(oldComp, newComp) {
  2110. extend(oldComp, newComp);
  2111. for (const key in oldComp) {
  2112. if (key !== "__file" && !(key in newComp)) {
  2113. delete oldComp[key];
  2114. }
  2115. }
  2116. }
  2117. function tryWrap(fn) {
  2118. return (id, arg) => {
  2119. try {
  2120. return fn(id, arg);
  2121. } catch (e) {
  2122. console.error(e);
  2123. console.warn(
  2124. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2125. );
  2126. }
  2127. };
  2128. }
  2129. let devtools$1;
  2130. let buffer = [];
  2131. let devtoolsNotInstalled = false;
  2132. function emit$1(event, ...args) {
  2133. if (devtools$1) {
  2134. devtools$1.emit(event, ...args);
  2135. } else if (!devtoolsNotInstalled) {
  2136. buffer.push({ event, args });
  2137. }
  2138. }
  2139. function setDevtoolsHook$1(hook, target) {
  2140. var _a, _b;
  2141. devtools$1 = hook;
  2142. if (devtools$1) {
  2143. devtools$1.enabled = true;
  2144. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2145. buffer = [];
  2146. } else if (
  2147. // handle late devtools injection - only do this if we are in an actual
  2148. // browser environment to avoid the timer handle stalling test runner exit
  2149. // (#4815)
  2150. typeof window !== "undefined" && // some envs mock window but not fully
  2151. window.HTMLElement && // also exclude jsdom
  2152. // eslint-disable-next-line no-restricted-syntax
  2153. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2154. ) {
  2155. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2156. replay.push((newHook) => {
  2157. setDevtoolsHook$1(newHook, target);
  2158. });
  2159. setTimeout(() => {
  2160. if (!devtools$1) {
  2161. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2162. devtoolsNotInstalled = true;
  2163. buffer = [];
  2164. }
  2165. }, 3e3);
  2166. } else {
  2167. devtoolsNotInstalled = true;
  2168. buffer = [];
  2169. }
  2170. }
  2171. function devtoolsInitApp(app, version) {
  2172. emit$1("app:init" /* APP_INIT */, app, version, {
  2173. Fragment,
  2174. Text,
  2175. Comment,
  2176. Static
  2177. });
  2178. }
  2179. function devtoolsUnmountApp(app) {
  2180. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2181. }
  2182. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  2183. "component:added" /* COMPONENT_ADDED */
  2184. );
  2185. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2186. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2187. "component:removed" /* COMPONENT_REMOVED */
  2188. );
  2189. const devtoolsComponentRemoved = (component) => {
  2190. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2191. !devtools$1.cleanupBuffer(component)) {
  2192. _devtoolsComponentRemoved(component);
  2193. }
  2194. };
  2195. /*! #__NO_SIDE_EFFECTS__ */
  2196. // @__NO_SIDE_EFFECTS__
  2197. function createDevtoolsComponentHook(hook) {
  2198. return (component) => {
  2199. emit$1(
  2200. hook,
  2201. component.appContext.app,
  2202. component.uid,
  2203. component.parent ? component.parent.uid : void 0,
  2204. component
  2205. );
  2206. };
  2207. }
  2208. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2209. "perf:start" /* PERFORMANCE_START */
  2210. );
  2211. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2212. "perf:end" /* PERFORMANCE_END */
  2213. );
  2214. function createDevtoolsPerformanceHook(hook) {
  2215. return (component, type, time) => {
  2216. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2217. };
  2218. }
  2219. function devtoolsComponentEmit(component, event, params) {
  2220. emit$1(
  2221. "component:emit" /* COMPONENT_EMIT */,
  2222. component.appContext.app,
  2223. component,
  2224. event,
  2225. params
  2226. );
  2227. }
  2228. let currentRenderingInstance = null;
  2229. let currentScopeId = null;
  2230. function setCurrentRenderingInstance(instance) {
  2231. const prev = currentRenderingInstance;
  2232. currentRenderingInstance = instance;
  2233. currentScopeId = instance && instance.type.__scopeId || null;
  2234. return prev;
  2235. }
  2236. function pushScopeId(id) {
  2237. currentScopeId = id;
  2238. }
  2239. function popScopeId() {
  2240. currentScopeId = null;
  2241. }
  2242. const withScopeId = (_id) => withCtx;
  2243. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2244. if (!ctx) return fn;
  2245. if (fn._n) {
  2246. return fn;
  2247. }
  2248. const renderFnWithContext = (...args) => {
  2249. if (renderFnWithContext._d) {
  2250. setBlockTracking(-1);
  2251. }
  2252. const prevInstance = setCurrentRenderingInstance(ctx);
  2253. let res;
  2254. try {
  2255. res = fn(...args);
  2256. } finally {
  2257. setCurrentRenderingInstance(prevInstance);
  2258. if (renderFnWithContext._d) {
  2259. setBlockTracking(1);
  2260. }
  2261. }
  2262. {
  2263. devtoolsComponentUpdated(ctx);
  2264. }
  2265. return res;
  2266. };
  2267. renderFnWithContext._n = true;
  2268. renderFnWithContext._c = true;
  2269. renderFnWithContext._d = true;
  2270. return renderFnWithContext;
  2271. }
  2272. function validateDirectiveName(name) {
  2273. if (isBuiltInDirective(name)) {
  2274. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2275. }
  2276. }
  2277. function withDirectives(vnode, directives) {
  2278. if (currentRenderingInstance === null) {
  2279. warn$1(`withDirectives can only be used inside render functions.`);
  2280. return vnode;
  2281. }
  2282. const instance = getComponentPublicInstance(currentRenderingInstance);
  2283. const bindings = vnode.dirs || (vnode.dirs = []);
  2284. for (let i = 0; i < directives.length; i++) {
  2285. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  2286. if (dir) {
  2287. if (isFunction(dir)) {
  2288. dir = {
  2289. mounted: dir,
  2290. updated: dir
  2291. };
  2292. }
  2293. if (dir.deep) {
  2294. traverse(value);
  2295. }
  2296. bindings.push({
  2297. dir,
  2298. instance,
  2299. value,
  2300. oldValue: void 0,
  2301. arg,
  2302. modifiers
  2303. });
  2304. }
  2305. }
  2306. return vnode;
  2307. }
  2308. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  2309. const bindings = vnode.dirs;
  2310. const oldBindings = prevVNode && prevVNode.dirs;
  2311. for (let i = 0; i < bindings.length; i++) {
  2312. const binding = bindings[i];
  2313. if (oldBindings) {
  2314. binding.oldValue = oldBindings[i].value;
  2315. }
  2316. let hook = binding.dir[name];
  2317. if (hook) {
  2318. pauseTracking();
  2319. callWithAsyncErrorHandling(hook, instance, 8, [
  2320. vnode.el,
  2321. binding,
  2322. vnode,
  2323. prevVNode
  2324. ]);
  2325. resetTracking();
  2326. }
  2327. }
  2328. }
  2329. const leaveCbKey = Symbol("_leaveCb");
  2330. const enterCbKey$1 = Symbol("_enterCb");
  2331. function useTransitionState() {
  2332. const state = {
  2333. isMounted: false,
  2334. isLeaving: false,
  2335. isUnmounting: false,
  2336. leavingVNodes: /* @__PURE__ */ new Map()
  2337. };
  2338. onMounted(() => {
  2339. state.isMounted = true;
  2340. });
  2341. onBeforeUnmount(() => {
  2342. state.isUnmounting = true;
  2343. });
  2344. return state;
  2345. }
  2346. const TransitionHookValidator = [Function, Array];
  2347. const BaseTransitionPropsValidators = {
  2348. mode: String,
  2349. appear: Boolean,
  2350. persisted: Boolean,
  2351. // enter
  2352. onBeforeEnter: TransitionHookValidator,
  2353. onEnter: TransitionHookValidator,
  2354. onAfterEnter: TransitionHookValidator,
  2355. onEnterCancelled: TransitionHookValidator,
  2356. // leave
  2357. onBeforeLeave: TransitionHookValidator,
  2358. onLeave: TransitionHookValidator,
  2359. onAfterLeave: TransitionHookValidator,
  2360. onLeaveCancelled: TransitionHookValidator,
  2361. // appear
  2362. onBeforeAppear: TransitionHookValidator,
  2363. onAppear: TransitionHookValidator,
  2364. onAfterAppear: TransitionHookValidator,
  2365. onAppearCancelled: TransitionHookValidator
  2366. };
  2367. const recursiveGetSubtree = (instance) => {
  2368. const subTree = instance.subTree;
  2369. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  2370. };
  2371. const BaseTransitionImpl = {
  2372. name: `BaseTransition`,
  2373. props: BaseTransitionPropsValidators,
  2374. setup(props, { slots }) {
  2375. const instance = getCurrentInstance();
  2376. const state = useTransitionState();
  2377. return () => {
  2378. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  2379. if (!children || !children.length) {
  2380. return;
  2381. }
  2382. let child = children[0];
  2383. if (children.length > 1) {
  2384. let hasFound = false;
  2385. for (const c of children) {
  2386. if (c.type !== Comment) {
  2387. if (hasFound) {
  2388. warn$1(
  2389. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  2390. );
  2391. break;
  2392. }
  2393. child = c;
  2394. hasFound = true;
  2395. }
  2396. }
  2397. }
  2398. const rawProps = toRaw(props);
  2399. const { mode } = rawProps;
  2400. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  2401. warn$1(`invalid <transition> mode: ${mode}`);
  2402. }
  2403. if (state.isLeaving) {
  2404. return emptyPlaceholder(child);
  2405. }
  2406. const innerChild = getKeepAliveChild(child);
  2407. if (!innerChild) {
  2408. return emptyPlaceholder(child);
  2409. }
  2410. let enterHooks = resolveTransitionHooks(
  2411. innerChild,
  2412. rawProps,
  2413. state,
  2414. instance,
  2415. // #11061, ensure enterHooks is fresh after clone
  2416. (hooks) => enterHooks = hooks
  2417. );
  2418. setTransitionHooks(innerChild, enterHooks);
  2419. const oldChild = instance.subTree;
  2420. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  2421. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
  2422. const leavingHooks = resolveTransitionHooks(
  2423. oldInnerChild,
  2424. rawProps,
  2425. state,
  2426. instance
  2427. );
  2428. setTransitionHooks(oldInnerChild, leavingHooks);
  2429. if (mode === "out-in" && innerChild.type !== Comment) {
  2430. state.isLeaving = true;
  2431. leavingHooks.afterLeave = () => {
  2432. state.isLeaving = false;
  2433. if (instance.update.active !== false) {
  2434. instance.effect.dirty = true;
  2435. instance.update();
  2436. }
  2437. };
  2438. return emptyPlaceholder(child);
  2439. } else if (mode === "in-out" && innerChild.type !== Comment) {
  2440. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  2441. const leavingVNodesCache = getLeavingNodesForType(
  2442. state,
  2443. oldInnerChild
  2444. );
  2445. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  2446. el[leaveCbKey] = () => {
  2447. earlyRemove();
  2448. el[leaveCbKey] = void 0;
  2449. delete enterHooks.delayedLeave;
  2450. };
  2451. enterHooks.delayedLeave = delayedLeave;
  2452. };
  2453. }
  2454. }
  2455. return child;
  2456. };
  2457. }
  2458. };
  2459. const BaseTransition = BaseTransitionImpl;
  2460. function getLeavingNodesForType(state, vnode) {
  2461. const { leavingVNodes } = state;
  2462. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  2463. if (!leavingVNodesCache) {
  2464. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  2465. leavingVNodes.set(vnode.type, leavingVNodesCache);
  2466. }
  2467. return leavingVNodesCache;
  2468. }
  2469. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  2470. const {
  2471. appear,
  2472. mode,
  2473. persisted = false,
  2474. onBeforeEnter,
  2475. onEnter,
  2476. onAfterEnter,
  2477. onEnterCancelled,
  2478. onBeforeLeave,
  2479. onLeave,
  2480. onAfterLeave,
  2481. onLeaveCancelled,
  2482. onBeforeAppear,
  2483. onAppear,
  2484. onAfterAppear,
  2485. onAppearCancelled
  2486. } = props;
  2487. const key = String(vnode.key);
  2488. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  2489. const callHook = (hook, args) => {
  2490. hook && callWithAsyncErrorHandling(
  2491. hook,
  2492. instance,
  2493. 9,
  2494. args
  2495. );
  2496. };
  2497. const callAsyncHook = (hook, args) => {
  2498. const done = args[1];
  2499. callHook(hook, args);
  2500. if (isArray(hook)) {
  2501. if (hook.every((hook2) => hook2.length <= 1)) done();
  2502. } else if (hook.length <= 1) {
  2503. done();
  2504. }
  2505. };
  2506. const hooks = {
  2507. mode,
  2508. persisted,
  2509. beforeEnter(el) {
  2510. let hook = onBeforeEnter;
  2511. if (!state.isMounted) {
  2512. if (appear) {
  2513. hook = onBeforeAppear || onBeforeEnter;
  2514. } else {
  2515. return;
  2516. }
  2517. }
  2518. if (el[leaveCbKey]) {
  2519. el[leaveCbKey](
  2520. true
  2521. /* cancelled */
  2522. );
  2523. }
  2524. const leavingVNode = leavingVNodesCache[key];
  2525. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  2526. leavingVNode.el[leaveCbKey]();
  2527. }
  2528. callHook(hook, [el]);
  2529. },
  2530. enter(el) {
  2531. let hook = onEnter;
  2532. let afterHook = onAfterEnter;
  2533. let cancelHook = onEnterCancelled;
  2534. if (!state.isMounted) {
  2535. if (appear) {
  2536. hook = onAppear || onEnter;
  2537. afterHook = onAfterAppear || onAfterEnter;
  2538. cancelHook = onAppearCancelled || onEnterCancelled;
  2539. } else {
  2540. return;
  2541. }
  2542. }
  2543. let called = false;
  2544. const done = el[enterCbKey$1] = (cancelled) => {
  2545. if (called) return;
  2546. called = true;
  2547. if (cancelled) {
  2548. callHook(cancelHook, [el]);
  2549. } else {
  2550. callHook(afterHook, [el]);
  2551. }
  2552. if (hooks.delayedLeave) {
  2553. hooks.delayedLeave();
  2554. }
  2555. el[enterCbKey$1] = void 0;
  2556. };
  2557. if (hook) {
  2558. callAsyncHook(hook, [el, done]);
  2559. } else {
  2560. done();
  2561. }
  2562. },
  2563. leave(el, remove) {
  2564. const key2 = String(vnode.key);
  2565. if (el[enterCbKey$1]) {
  2566. el[enterCbKey$1](
  2567. true
  2568. /* cancelled */
  2569. );
  2570. }
  2571. if (state.isUnmounting) {
  2572. return remove();
  2573. }
  2574. callHook(onBeforeLeave, [el]);
  2575. let called = false;
  2576. const done = el[leaveCbKey] = (cancelled) => {
  2577. if (called) return;
  2578. called = true;
  2579. remove();
  2580. if (cancelled) {
  2581. callHook(onLeaveCancelled, [el]);
  2582. } else {
  2583. callHook(onAfterLeave, [el]);
  2584. }
  2585. el[leaveCbKey] = void 0;
  2586. if (leavingVNodesCache[key2] === vnode) {
  2587. delete leavingVNodesCache[key2];
  2588. }
  2589. };
  2590. leavingVNodesCache[key2] = vnode;
  2591. if (onLeave) {
  2592. callAsyncHook(onLeave, [el, done]);
  2593. } else {
  2594. done();
  2595. }
  2596. },
  2597. clone(vnode2) {
  2598. const hooks2 = resolveTransitionHooks(
  2599. vnode2,
  2600. props,
  2601. state,
  2602. instance,
  2603. postClone
  2604. );
  2605. if (postClone) postClone(hooks2);
  2606. return hooks2;
  2607. }
  2608. };
  2609. return hooks;
  2610. }
  2611. function emptyPlaceholder(vnode) {
  2612. if (isKeepAlive(vnode)) {
  2613. vnode = cloneVNode(vnode);
  2614. vnode.children = null;
  2615. return vnode;
  2616. }
  2617. }
  2618. function getKeepAliveChild(vnode) {
  2619. if (!isKeepAlive(vnode)) {
  2620. return vnode;
  2621. }
  2622. if (vnode.component) {
  2623. return vnode.component.subTree;
  2624. }
  2625. const { shapeFlag, children } = vnode;
  2626. if (children) {
  2627. if (shapeFlag & 16) {
  2628. return children[0];
  2629. }
  2630. if (shapeFlag & 32 && isFunction(children.default)) {
  2631. return children.default();
  2632. }
  2633. }
  2634. }
  2635. function setTransitionHooks(vnode, hooks) {
  2636. if (vnode.shapeFlag & 6 && vnode.component) {
  2637. setTransitionHooks(vnode.component.subTree, hooks);
  2638. } else if (vnode.shapeFlag & 128) {
  2639. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  2640. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  2641. } else {
  2642. vnode.transition = hooks;
  2643. }
  2644. }
  2645. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  2646. let ret = [];
  2647. let keyedFragmentCount = 0;
  2648. for (let i = 0; i < children.length; i++) {
  2649. let child = children[i];
  2650. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  2651. if (child.type === Fragment) {
  2652. if (child.patchFlag & 128) keyedFragmentCount++;
  2653. ret = ret.concat(
  2654. getTransitionRawChildren(child.children, keepComment, key)
  2655. );
  2656. } else if (keepComment || child.type !== Comment) {
  2657. ret.push(key != null ? cloneVNode(child, { key }) : child);
  2658. }
  2659. }
  2660. if (keyedFragmentCount > 1) {
  2661. for (let i = 0; i < ret.length; i++) {
  2662. ret[i].patchFlag = -2;
  2663. }
  2664. }
  2665. return ret;
  2666. }
  2667. /*! #__NO_SIDE_EFFECTS__ */
  2668. // @__NO_SIDE_EFFECTS__
  2669. function defineComponent(options, extraOptions) {
  2670. return isFunction(options) ? (
  2671. // #8326: extend call and options.name access are considered side-effects
  2672. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  2673. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  2674. ) : options;
  2675. }
  2676. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  2677. /*! #__NO_SIDE_EFFECTS__ */
  2678. // @__NO_SIDE_EFFECTS__
  2679. function defineAsyncComponent(source) {
  2680. if (isFunction(source)) {
  2681. source = { loader: source };
  2682. }
  2683. const {
  2684. loader,
  2685. loadingComponent,
  2686. errorComponent,
  2687. delay = 200,
  2688. timeout,
  2689. // undefined = never times out
  2690. suspensible = true,
  2691. onError: userOnError
  2692. } = source;
  2693. let pendingRequest = null;
  2694. let resolvedComp;
  2695. let retries = 0;
  2696. const retry = () => {
  2697. retries++;
  2698. pendingRequest = null;
  2699. return load();
  2700. };
  2701. const load = () => {
  2702. let thisRequest;
  2703. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  2704. err = err instanceof Error ? err : new Error(String(err));
  2705. if (userOnError) {
  2706. return new Promise((resolve, reject) => {
  2707. const userRetry = () => resolve(retry());
  2708. const userFail = () => reject(err);
  2709. userOnError(err, userRetry, userFail, retries + 1);
  2710. });
  2711. } else {
  2712. throw err;
  2713. }
  2714. }).then((comp) => {
  2715. if (thisRequest !== pendingRequest && pendingRequest) {
  2716. return pendingRequest;
  2717. }
  2718. if (!comp) {
  2719. warn$1(
  2720. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  2721. );
  2722. }
  2723. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  2724. comp = comp.default;
  2725. }
  2726. if (comp && !isObject(comp) && !isFunction(comp)) {
  2727. throw new Error(`Invalid async component load result: ${comp}`);
  2728. }
  2729. resolvedComp = comp;
  2730. return comp;
  2731. }));
  2732. };
  2733. return defineComponent({
  2734. name: "AsyncComponentWrapper",
  2735. __asyncLoader: load,
  2736. get __asyncResolved() {
  2737. return resolvedComp;
  2738. },
  2739. setup() {
  2740. const instance = currentInstance;
  2741. if (resolvedComp) {
  2742. return () => createInnerComp(resolvedComp, instance);
  2743. }
  2744. const onError = (err) => {
  2745. pendingRequest = null;
  2746. handleError(
  2747. err,
  2748. instance,
  2749. 13,
  2750. !errorComponent
  2751. );
  2752. };
  2753. if (suspensible && instance.suspense || false) {
  2754. return load().then((comp) => {
  2755. return () => createInnerComp(comp, instance);
  2756. }).catch((err) => {
  2757. onError(err);
  2758. return () => errorComponent ? createVNode(errorComponent, {
  2759. error: err
  2760. }) : null;
  2761. });
  2762. }
  2763. const loaded = ref(false);
  2764. const error = ref();
  2765. const delayed = ref(!!delay);
  2766. if (delay) {
  2767. setTimeout(() => {
  2768. delayed.value = false;
  2769. }, delay);
  2770. }
  2771. if (timeout != null) {
  2772. setTimeout(() => {
  2773. if (!loaded.value && !error.value) {
  2774. const err = new Error(
  2775. `Async component timed out after ${timeout}ms.`
  2776. );
  2777. onError(err);
  2778. error.value = err;
  2779. }
  2780. }, timeout);
  2781. }
  2782. load().then(() => {
  2783. loaded.value = true;
  2784. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  2785. instance.parent.effect.dirty = true;
  2786. queueJob(instance.parent.update);
  2787. }
  2788. }).catch((err) => {
  2789. onError(err);
  2790. error.value = err;
  2791. });
  2792. return () => {
  2793. if (loaded.value && resolvedComp) {
  2794. return createInnerComp(resolvedComp, instance);
  2795. } else if (error.value && errorComponent) {
  2796. return createVNode(errorComponent, {
  2797. error: error.value
  2798. });
  2799. } else if (loadingComponent && !delayed.value) {
  2800. return createVNode(loadingComponent);
  2801. }
  2802. };
  2803. }
  2804. });
  2805. }
  2806. function createInnerComp(comp, parent) {
  2807. const { ref: ref2, props, children, ce } = parent.vnode;
  2808. const vnode = createVNode(comp, props, children);
  2809. vnode.ref = ref2;
  2810. vnode.ce = ce;
  2811. delete parent.vnode.ce;
  2812. return vnode;
  2813. }
  2814. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  2815. const KeepAliveImpl = {
  2816. name: `KeepAlive`,
  2817. // Marker for special handling inside the renderer. We are not using a ===
  2818. // check directly on KeepAlive in the renderer, because importing it directly
  2819. // would prevent it from being tree-shaken.
  2820. __isKeepAlive: true,
  2821. props: {
  2822. include: [String, RegExp, Array],
  2823. exclude: [String, RegExp, Array],
  2824. max: [String, Number]
  2825. },
  2826. setup(props, { slots }) {
  2827. const instance = getCurrentInstance();
  2828. const sharedContext = instance.ctx;
  2829. const cache = /* @__PURE__ */ new Map();
  2830. const keys = /* @__PURE__ */ new Set();
  2831. let current = null;
  2832. {
  2833. instance.__v_cache = cache;
  2834. }
  2835. const parentSuspense = instance.suspense;
  2836. const {
  2837. renderer: {
  2838. p: patch,
  2839. m: move,
  2840. um: _unmount,
  2841. o: { createElement }
  2842. }
  2843. } = sharedContext;
  2844. const storageContainer = createElement("div");
  2845. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  2846. const instance2 = vnode.component;
  2847. move(vnode, container, anchor, 0, parentSuspense);
  2848. patch(
  2849. instance2.vnode,
  2850. vnode,
  2851. container,
  2852. anchor,
  2853. instance2,
  2854. parentSuspense,
  2855. namespace,
  2856. vnode.slotScopeIds,
  2857. optimized
  2858. );
  2859. queuePostRenderEffect(() => {
  2860. instance2.isDeactivated = false;
  2861. if (instance2.a) {
  2862. invokeArrayFns(instance2.a);
  2863. }
  2864. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  2865. if (vnodeHook) {
  2866. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  2867. }
  2868. }, parentSuspense);
  2869. {
  2870. devtoolsComponentAdded(instance2);
  2871. }
  2872. };
  2873. sharedContext.deactivate = (vnode) => {
  2874. const instance2 = vnode.component;
  2875. invalidateMount(instance2.m);
  2876. invalidateMount(instance2.a);
  2877. move(vnode, storageContainer, null, 1, parentSuspense);
  2878. queuePostRenderEffect(() => {
  2879. if (instance2.da) {
  2880. invokeArrayFns(instance2.da);
  2881. }
  2882. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  2883. if (vnodeHook) {
  2884. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  2885. }
  2886. instance2.isDeactivated = true;
  2887. }, parentSuspense);
  2888. {
  2889. devtoolsComponentAdded(instance2);
  2890. }
  2891. };
  2892. function unmount(vnode) {
  2893. resetShapeFlag(vnode);
  2894. _unmount(vnode, instance, parentSuspense, true);
  2895. }
  2896. function pruneCache(filter) {
  2897. cache.forEach((vnode, key) => {
  2898. const name = getComponentName(vnode.type);
  2899. if (name && (!filter || !filter(name))) {
  2900. pruneCacheEntry(key);
  2901. }
  2902. });
  2903. }
  2904. function pruneCacheEntry(key) {
  2905. const cached = cache.get(key);
  2906. if (cached && (!current || !isSameVNodeType(cached, current))) {
  2907. unmount(cached);
  2908. } else if (current) {
  2909. resetShapeFlag(current);
  2910. }
  2911. cache.delete(key);
  2912. keys.delete(key);
  2913. }
  2914. watch(
  2915. () => [props.include, props.exclude],
  2916. ([include, exclude]) => {
  2917. include && pruneCache((name) => matches(include, name));
  2918. exclude && pruneCache((name) => !matches(exclude, name));
  2919. },
  2920. // prune post-render after `current` has been updated
  2921. { flush: "post", deep: true }
  2922. );
  2923. let pendingCacheKey = null;
  2924. const cacheSubtree = () => {
  2925. if (pendingCacheKey != null) {
  2926. if (isSuspense(instance.subTree.type)) {
  2927. queuePostRenderEffect(() => {
  2928. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  2929. }, instance.subTree.suspense);
  2930. } else {
  2931. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  2932. }
  2933. }
  2934. };
  2935. onMounted(cacheSubtree);
  2936. onUpdated(cacheSubtree);
  2937. onBeforeUnmount(() => {
  2938. cache.forEach((cached) => {
  2939. const { subTree, suspense } = instance;
  2940. const vnode = getInnerChild(subTree);
  2941. if (cached.type === vnode.type && cached.key === vnode.key) {
  2942. resetShapeFlag(vnode);
  2943. const da = vnode.component.da;
  2944. da && queuePostRenderEffect(da, suspense);
  2945. return;
  2946. }
  2947. unmount(cached);
  2948. });
  2949. });
  2950. return () => {
  2951. pendingCacheKey = null;
  2952. if (!slots.default) {
  2953. return null;
  2954. }
  2955. const children = slots.default();
  2956. const rawVNode = children[0];
  2957. if (children.length > 1) {
  2958. {
  2959. warn$1(`KeepAlive should contain exactly one component child.`);
  2960. }
  2961. current = null;
  2962. return children;
  2963. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  2964. current = null;
  2965. return rawVNode;
  2966. }
  2967. let vnode = getInnerChild(rawVNode);
  2968. if (vnode.type === Comment) {
  2969. current = null;
  2970. return vnode;
  2971. }
  2972. const comp = vnode.type;
  2973. const name = getComponentName(
  2974. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  2975. );
  2976. const { include, exclude, max } = props;
  2977. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  2978. current = vnode;
  2979. return rawVNode;
  2980. }
  2981. const key = vnode.key == null ? comp : vnode.key;
  2982. const cachedVNode = cache.get(key);
  2983. if (vnode.el) {
  2984. vnode = cloneVNode(vnode);
  2985. if (rawVNode.shapeFlag & 128) {
  2986. rawVNode.ssContent = vnode;
  2987. }
  2988. }
  2989. pendingCacheKey = key;
  2990. if (cachedVNode) {
  2991. vnode.el = cachedVNode.el;
  2992. vnode.component = cachedVNode.component;
  2993. if (vnode.transition) {
  2994. setTransitionHooks(vnode, vnode.transition);
  2995. }
  2996. vnode.shapeFlag |= 512;
  2997. keys.delete(key);
  2998. keys.add(key);
  2999. } else {
  3000. keys.add(key);
  3001. if (max && keys.size > parseInt(max, 10)) {
  3002. pruneCacheEntry(keys.values().next().value);
  3003. }
  3004. }
  3005. vnode.shapeFlag |= 256;
  3006. current = vnode;
  3007. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  3008. };
  3009. }
  3010. };
  3011. const KeepAlive = KeepAliveImpl;
  3012. function matches(pattern, name) {
  3013. if (isArray(pattern)) {
  3014. return pattern.some((p) => matches(p, name));
  3015. } else if (isString(pattern)) {
  3016. return pattern.split(",").includes(name);
  3017. } else if (isRegExp(pattern)) {
  3018. return pattern.test(name);
  3019. }
  3020. return false;
  3021. }
  3022. function onActivated(hook, target) {
  3023. registerKeepAliveHook(hook, "a", target);
  3024. }
  3025. function onDeactivated(hook, target) {
  3026. registerKeepAliveHook(hook, "da", target);
  3027. }
  3028. function registerKeepAliveHook(hook, type, target = currentInstance) {
  3029. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  3030. let current = target;
  3031. while (current) {
  3032. if (current.isDeactivated) {
  3033. return;
  3034. }
  3035. current = current.parent;
  3036. }
  3037. return hook();
  3038. });
  3039. injectHook(type, wrappedHook, target);
  3040. if (target) {
  3041. let current = target.parent;
  3042. while (current && current.parent) {
  3043. if (isKeepAlive(current.parent.vnode)) {
  3044. injectToKeepAliveRoot(wrappedHook, type, target, current);
  3045. }
  3046. current = current.parent;
  3047. }
  3048. }
  3049. }
  3050. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  3051. const injected = injectHook(
  3052. type,
  3053. hook,
  3054. keepAliveRoot,
  3055. true
  3056. /* prepend */
  3057. );
  3058. onUnmounted(() => {
  3059. remove(keepAliveRoot[type], injected);
  3060. }, target);
  3061. }
  3062. function resetShapeFlag(vnode) {
  3063. vnode.shapeFlag &= ~256;
  3064. vnode.shapeFlag &= ~512;
  3065. }
  3066. function getInnerChild(vnode) {
  3067. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  3068. }
  3069. function injectHook(type, hook, target = currentInstance, prepend = false) {
  3070. if (target) {
  3071. const hooks = target[type] || (target[type] = []);
  3072. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  3073. pauseTracking();
  3074. const reset = setCurrentInstance(target);
  3075. const res = callWithAsyncErrorHandling(hook, target, type, args);
  3076. reset();
  3077. resetTracking();
  3078. return res;
  3079. });
  3080. if (prepend) {
  3081. hooks.unshift(wrappedHook);
  3082. } else {
  3083. hooks.push(wrappedHook);
  3084. }
  3085. return wrappedHook;
  3086. } else {
  3087. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  3088. warn$1(
  3089. `${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.` )
  3090. );
  3091. }
  3092. }
  3093. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  3094. if (!isInSSRComponentSetup || lifecycle === "sp") {
  3095. injectHook(lifecycle, (...args) => hook(...args), target);
  3096. }
  3097. };
  3098. const onBeforeMount = createHook("bm");
  3099. const onMounted = createHook("m");
  3100. const onBeforeUpdate = createHook("bu");
  3101. const onUpdated = createHook("u");
  3102. const onBeforeUnmount = createHook("bum");
  3103. const onUnmounted = createHook("um");
  3104. const onServerPrefetch = createHook("sp");
  3105. const onRenderTriggered = createHook(
  3106. "rtg"
  3107. );
  3108. const onRenderTracked = createHook(
  3109. "rtc"
  3110. );
  3111. function onErrorCaptured(hook, target = currentInstance) {
  3112. injectHook("ec", hook, target);
  3113. }
  3114. const COMPONENTS = "components";
  3115. const DIRECTIVES = "directives";
  3116. function resolveComponent(name, maybeSelfReference) {
  3117. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  3118. }
  3119. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  3120. function resolveDynamicComponent(component) {
  3121. if (isString(component)) {
  3122. return resolveAsset(COMPONENTS, component, false) || component;
  3123. } else {
  3124. return component || NULL_DYNAMIC_COMPONENT;
  3125. }
  3126. }
  3127. function resolveDirective(name) {
  3128. return resolveAsset(DIRECTIVES, name);
  3129. }
  3130. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  3131. const instance = currentRenderingInstance || currentInstance;
  3132. if (instance) {
  3133. const Component = instance.type;
  3134. if (type === COMPONENTS) {
  3135. const selfName = getComponentName(
  3136. Component,
  3137. false
  3138. );
  3139. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  3140. return Component;
  3141. }
  3142. }
  3143. const res = (
  3144. // local registration
  3145. // check instance[type] first which is resolved for options API
  3146. resolve(instance[type] || Component[type], name) || // global registration
  3147. resolve(instance.appContext[type], name)
  3148. );
  3149. if (!res && maybeSelfReference) {
  3150. return Component;
  3151. }
  3152. if (warnMissing && !res) {
  3153. const extra = type === COMPONENTS ? `
  3154. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  3155. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  3156. }
  3157. return res;
  3158. } else {
  3159. warn$1(
  3160. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  3161. );
  3162. }
  3163. }
  3164. function resolve(registry, name) {
  3165. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  3166. }
  3167. function renderList(source, renderItem, cache, index) {
  3168. let ret;
  3169. const cached = cache && cache[index];
  3170. if (isArray(source) || isString(source)) {
  3171. ret = new Array(source.length);
  3172. for (let i = 0, l = source.length; i < l; i++) {
  3173. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  3174. }
  3175. } else if (typeof source === "number") {
  3176. if (!Number.isInteger(source)) {
  3177. warn$1(`The v-for range expect an integer value but got ${source}.`);
  3178. }
  3179. ret = new Array(source);
  3180. for (let i = 0; i < source; i++) {
  3181. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  3182. }
  3183. } else if (isObject(source)) {
  3184. if (source[Symbol.iterator]) {
  3185. ret = Array.from(
  3186. source,
  3187. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  3188. );
  3189. } else {
  3190. const keys = Object.keys(source);
  3191. ret = new Array(keys.length);
  3192. for (let i = 0, l = keys.length; i < l; i++) {
  3193. const key = keys[i];
  3194. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  3195. }
  3196. }
  3197. } else {
  3198. ret = [];
  3199. }
  3200. if (cache) {
  3201. cache[index] = ret;
  3202. }
  3203. return ret;
  3204. }
  3205. function createSlots(slots, dynamicSlots) {
  3206. for (let i = 0; i < dynamicSlots.length; i++) {
  3207. const slot = dynamicSlots[i];
  3208. if (isArray(slot)) {
  3209. for (let j = 0; j < slot.length; j++) {
  3210. slots[slot[j].name] = slot[j].fn;
  3211. }
  3212. } else if (slot) {
  3213. slots[slot.name] = slot.key ? (...args) => {
  3214. const res = slot.fn(...args);
  3215. if (res) res.key = slot.key;
  3216. return res;
  3217. } : slot.fn;
  3218. }
  3219. }
  3220. return slots;
  3221. }
  3222. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  3223. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  3224. if (name !== "default") props.name = name;
  3225. return createVNode("slot", props, fallback && fallback());
  3226. }
  3227. let slot = slots[name];
  3228. if (slot && slot.length > 1) {
  3229. warn$1(
  3230. `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.`
  3231. );
  3232. slot = () => [];
  3233. }
  3234. if (slot && slot._c) {
  3235. slot._d = false;
  3236. }
  3237. openBlock();
  3238. const validSlotContent = slot && ensureValidVNode(slot(props));
  3239. const rendered = createBlock(
  3240. Fragment,
  3241. {
  3242. key: (props.key || // slot content array of a dynamic conditional slot may have a branch
  3243. // key attached in the `createSlots` helper, respect that
  3244. validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
  3245. (!validSlotContent && fallback ? "_fb" : "")
  3246. },
  3247. validSlotContent || (fallback ? fallback() : []),
  3248. validSlotContent && slots._ === 1 ? 64 : -2
  3249. );
  3250. if (!noSlotted && rendered.scopeId) {
  3251. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  3252. }
  3253. if (slot && slot._c) {
  3254. slot._d = true;
  3255. }
  3256. return rendered;
  3257. }
  3258. function ensureValidVNode(vnodes) {
  3259. return vnodes.some((child) => {
  3260. if (!isVNode(child)) return true;
  3261. if (child.type === Comment) return false;
  3262. if (child.type === Fragment && !ensureValidVNode(child.children))
  3263. return false;
  3264. return true;
  3265. }) ? vnodes : null;
  3266. }
  3267. function toHandlers(obj, preserveCaseIfNecessary) {
  3268. const ret = {};
  3269. if (!isObject(obj)) {
  3270. warn$1(`v-on with no argument expects an object value.`);
  3271. return ret;
  3272. }
  3273. for (const key in obj) {
  3274. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  3275. }
  3276. return ret;
  3277. }
  3278. const getPublicInstance = (i) => {
  3279. if (!i) return null;
  3280. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  3281. return getPublicInstance(i.parent);
  3282. };
  3283. const publicPropertiesMap = (
  3284. // Move PURE marker to new line to workaround compiler discarding it
  3285. // due to type annotation
  3286. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  3287. $: (i) => i,
  3288. $el: (i) => i.vnode.el,
  3289. $data: (i) => i.data,
  3290. $props: (i) => shallowReadonly(i.props) ,
  3291. $attrs: (i) => shallowReadonly(i.attrs) ,
  3292. $slots: (i) => shallowReadonly(i.slots) ,
  3293. $refs: (i) => shallowReadonly(i.refs) ,
  3294. $parent: (i) => getPublicInstance(i.parent),
  3295. $root: (i) => getPublicInstance(i.root),
  3296. $emit: (i) => i.emit,
  3297. $options: (i) => resolveMergedOptions(i) ,
  3298. $forceUpdate: (i) => i.f || (i.f = () => {
  3299. i.effect.dirty = true;
  3300. queueJob(i.update);
  3301. }),
  3302. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  3303. $watch: (i) => instanceWatch.bind(i)
  3304. })
  3305. );
  3306. const isReservedPrefix = (key) => key === "_" || key === "$";
  3307. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  3308. const PublicInstanceProxyHandlers = {
  3309. get({ _: instance }, key) {
  3310. if (key === "__v_skip") {
  3311. return true;
  3312. }
  3313. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  3314. if (key === "__isVue") {
  3315. return true;
  3316. }
  3317. let normalizedProps;
  3318. if (key[0] !== "$") {
  3319. const n = accessCache[key];
  3320. if (n !== void 0) {
  3321. switch (n) {
  3322. case 1 /* SETUP */:
  3323. return setupState[key];
  3324. case 2 /* DATA */:
  3325. return data[key];
  3326. case 4 /* CONTEXT */:
  3327. return ctx[key];
  3328. case 3 /* PROPS */:
  3329. return props[key];
  3330. }
  3331. } else if (hasSetupBinding(setupState, key)) {
  3332. accessCache[key] = 1 /* SETUP */;
  3333. return setupState[key];
  3334. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  3335. accessCache[key] = 2 /* DATA */;
  3336. return data[key];
  3337. } else if (
  3338. // only cache other properties when instance has declared (thus stable)
  3339. // props
  3340. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  3341. ) {
  3342. accessCache[key] = 3 /* PROPS */;
  3343. return props[key];
  3344. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  3345. accessCache[key] = 4 /* CONTEXT */;
  3346. return ctx[key];
  3347. } else if (shouldCacheAccess) {
  3348. accessCache[key] = 0 /* OTHER */;
  3349. }
  3350. }
  3351. const publicGetter = publicPropertiesMap[key];
  3352. let cssModule, globalProperties;
  3353. if (publicGetter) {
  3354. if (key === "$attrs") {
  3355. track(instance.attrs, "get", "");
  3356. markAttrsAccessed();
  3357. } else if (key === "$slots") {
  3358. track(instance, "get", key);
  3359. }
  3360. return publicGetter(instance);
  3361. } else if (
  3362. // css module (injected by vue-loader)
  3363. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  3364. ) {
  3365. return cssModule;
  3366. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  3367. accessCache[key] = 4 /* CONTEXT */;
  3368. return ctx[key];
  3369. } else if (
  3370. // global properties
  3371. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  3372. ) {
  3373. {
  3374. return globalProperties[key];
  3375. }
  3376. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  3377. // to infinite warning loop
  3378. key.indexOf("__v") !== 0)) {
  3379. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  3380. warn$1(
  3381. `Property ${JSON.stringify(
  3382. key
  3383. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  3384. );
  3385. } else if (instance === currentRenderingInstance) {
  3386. warn$1(
  3387. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  3388. );
  3389. }
  3390. }
  3391. },
  3392. set({ _: instance }, key, value) {
  3393. const { data, setupState, ctx } = instance;
  3394. if (hasSetupBinding(setupState, key)) {
  3395. setupState[key] = value;
  3396. return true;
  3397. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  3398. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  3399. return false;
  3400. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  3401. data[key] = value;
  3402. return true;
  3403. } else if (hasOwn(instance.props, key)) {
  3404. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  3405. return false;
  3406. }
  3407. if (key[0] === "$" && key.slice(1) in instance) {
  3408. warn$1(
  3409. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  3410. );
  3411. return false;
  3412. } else {
  3413. if (key in instance.appContext.config.globalProperties) {
  3414. Object.defineProperty(ctx, key, {
  3415. enumerable: true,
  3416. configurable: true,
  3417. value
  3418. });
  3419. } else {
  3420. ctx[key] = value;
  3421. }
  3422. }
  3423. return true;
  3424. },
  3425. has({
  3426. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  3427. }, key) {
  3428. let normalizedProps;
  3429. 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);
  3430. },
  3431. defineProperty(target, key, descriptor) {
  3432. if (descriptor.get != null) {
  3433. target._.accessCache[key] = 0;
  3434. } else if (hasOwn(descriptor, "value")) {
  3435. this.set(target, key, descriptor.value, null);
  3436. }
  3437. return Reflect.defineProperty(target, key, descriptor);
  3438. }
  3439. };
  3440. {
  3441. PublicInstanceProxyHandlers.ownKeys = (target) => {
  3442. warn$1(
  3443. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  3444. );
  3445. return Reflect.ownKeys(target);
  3446. };
  3447. }
  3448. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
  3449. {},
  3450. PublicInstanceProxyHandlers,
  3451. {
  3452. get(target, key) {
  3453. if (key === Symbol.unscopables) {
  3454. return;
  3455. }
  3456. return PublicInstanceProxyHandlers.get(target, key, target);
  3457. },
  3458. has(_, key) {
  3459. const has = key[0] !== "_" && !isGloballyAllowed(key);
  3460. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  3461. warn$1(
  3462. `Property ${JSON.stringify(
  3463. key
  3464. )} should not start with _ which is a reserved prefix for Vue internals.`
  3465. );
  3466. }
  3467. return has;
  3468. }
  3469. }
  3470. );
  3471. function createDevRenderContext(instance) {
  3472. const target = {};
  3473. Object.defineProperty(target, `_`, {
  3474. configurable: true,
  3475. enumerable: false,
  3476. get: () => instance
  3477. });
  3478. Object.keys(publicPropertiesMap).forEach((key) => {
  3479. Object.defineProperty(target, key, {
  3480. configurable: true,
  3481. enumerable: false,
  3482. get: () => publicPropertiesMap[key](instance),
  3483. // intercepted by the proxy so no need for implementation,
  3484. // but needed to prevent set errors
  3485. set: NOOP
  3486. });
  3487. });
  3488. return target;
  3489. }
  3490. function exposePropsOnRenderContext(instance) {
  3491. const {
  3492. ctx,
  3493. propsOptions: [propsOptions]
  3494. } = instance;
  3495. if (propsOptions) {
  3496. Object.keys(propsOptions).forEach((key) => {
  3497. Object.defineProperty(ctx, key, {
  3498. enumerable: true,
  3499. configurable: true,
  3500. get: () => instance.props[key],
  3501. set: NOOP
  3502. });
  3503. });
  3504. }
  3505. }
  3506. function exposeSetupStateOnRenderContext(instance) {
  3507. const { ctx, setupState } = instance;
  3508. Object.keys(toRaw(setupState)).forEach((key) => {
  3509. if (!setupState.__isScriptSetup) {
  3510. if (isReservedPrefix(key[0])) {
  3511. warn$1(
  3512. `setup() return property ${JSON.stringify(
  3513. key
  3514. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  3515. );
  3516. return;
  3517. }
  3518. Object.defineProperty(ctx, key, {
  3519. enumerable: true,
  3520. configurable: true,
  3521. get: () => setupState[key],
  3522. set: NOOP
  3523. });
  3524. }
  3525. });
  3526. }
  3527. const warnRuntimeUsage = (method) => warn$1(
  3528. `${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.`
  3529. );
  3530. function defineProps() {
  3531. {
  3532. warnRuntimeUsage(`defineProps`);
  3533. }
  3534. return null;
  3535. }
  3536. function defineEmits() {
  3537. {
  3538. warnRuntimeUsage(`defineEmits`);
  3539. }
  3540. return null;
  3541. }
  3542. function defineExpose(exposed) {
  3543. {
  3544. warnRuntimeUsage(`defineExpose`);
  3545. }
  3546. }
  3547. function defineOptions(options) {
  3548. {
  3549. warnRuntimeUsage(`defineOptions`);
  3550. }
  3551. }
  3552. function defineSlots() {
  3553. {
  3554. warnRuntimeUsage(`defineSlots`);
  3555. }
  3556. return null;
  3557. }
  3558. function defineModel() {
  3559. {
  3560. warnRuntimeUsage("defineModel");
  3561. }
  3562. }
  3563. function withDefaults(props, defaults) {
  3564. {
  3565. warnRuntimeUsage(`withDefaults`);
  3566. }
  3567. return null;
  3568. }
  3569. function useSlots() {
  3570. return getContext().slots;
  3571. }
  3572. function useAttrs() {
  3573. return getContext().attrs;
  3574. }
  3575. function getContext() {
  3576. const i = getCurrentInstance();
  3577. if (!i) {
  3578. warn$1(`useContext() called without active instance.`);
  3579. }
  3580. return i.setupContext || (i.setupContext = createSetupContext(i));
  3581. }
  3582. function normalizePropsOrEmits(props) {
  3583. return isArray(props) ? props.reduce(
  3584. (normalized, p) => (normalized[p] = null, normalized),
  3585. {}
  3586. ) : props;
  3587. }
  3588. function mergeDefaults(raw, defaults) {
  3589. const props = normalizePropsOrEmits(raw);
  3590. for (const key in defaults) {
  3591. if (key.startsWith("__skip")) continue;
  3592. let opt = props[key];
  3593. if (opt) {
  3594. if (isArray(opt) || isFunction(opt)) {
  3595. opt = props[key] = { type: opt, default: defaults[key] };
  3596. } else {
  3597. opt.default = defaults[key];
  3598. }
  3599. } else if (opt === null) {
  3600. opt = props[key] = { default: defaults[key] };
  3601. } else {
  3602. warn$1(`props default key "${key}" has no corresponding declaration.`);
  3603. }
  3604. if (opt && defaults[`__skip_${key}`]) {
  3605. opt.skipFactory = true;
  3606. }
  3607. }
  3608. return props;
  3609. }
  3610. function mergeModels(a, b) {
  3611. if (!a || !b) return a || b;
  3612. if (isArray(a) && isArray(b)) return a.concat(b);
  3613. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  3614. }
  3615. function createPropsRestProxy(props, excludedKeys) {
  3616. const ret = {};
  3617. for (const key in props) {
  3618. if (!excludedKeys.includes(key)) {
  3619. Object.defineProperty(ret, key, {
  3620. enumerable: true,
  3621. get: () => props[key]
  3622. });
  3623. }
  3624. }
  3625. return ret;
  3626. }
  3627. function withAsyncContext(getAwaitable) {
  3628. const ctx = getCurrentInstance();
  3629. if (!ctx) {
  3630. warn$1(
  3631. `withAsyncContext called without active current instance. This is likely a bug.`
  3632. );
  3633. }
  3634. let awaitable = getAwaitable();
  3635. unsetCurrentInstance();
  3636. if (isPromise(awaitable)) {
  3637. awaitable = awaitable.catch((e) => {
  3638. setCurrentInstance(ctx);
  3639. throw e;
  3640. });
  3641. }
  3642. return [awaitable, () => setCurrentInstance(ctx)];
  3643. }
  3644. function createDuplicateChecker() {
  3645. const cache = /* @__PURE__ */ Object.create(null);
  3646. return (type, key) => {
  3647. if (cache[key]) {
  3648. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  3649. } else {
  3650. cache[key] = type;
  3651. }
  3652. };
  3653. }
  3654. let shouldCacheAccess = true;
  3655. function applyOptions(instance) {
  3656. const options = resolveMergedOptions(instance);
  3657. const publicThis = instance.proxy;
  3658. const ctx = instance.ctx;
  3659. shouldCacheAccess = false;
  3660. if (options.beforeCreate) {
  3661. callHook$1(options.beforeCreate, instance, "bc");
  3662. }
  3663. const {
  3664. // state
  3665. data: dataOptions,
  3666. computed: computedOptions,
  3667. methods,
  3668. watch: watchOptions,
  3669. provide: provideOptions,
  3670. inject: injectOptions,
  3671. // lifecycle
  3672. created,
  3673. beforeMount,
  3674. mounted,
  3675. beforeUpdate,
  3676. updated,
  3677. activated,
  3678. deactivated,
  3679. beforeDestroy,
  3680. beforeUnmount,
  3681. destroyed,
  3682. unmounted,
  3683. render,
  3684. renderTracked,
  3685. renderTriggered,
  3686. errorCaptured,
  3687. serverPrefetch,
  3688. // public API
  3689. expose,
  3690. inheritAttrs,
  3691. // assets
  3692. components,
  3693. directives,
  3694. filters
  3695. } = options;
  3696. const checkDuplicateProperties = createDuplicateChecker() ;
  3697. {
  3698. const [propsOptions] = instance.propsOptions;
  3699. if (propsOptions) {
  3700. for (const key in propsOptions) {
  3701. checkDuplicateProperties("Props" /* PROPS */, key);
  3702. }
  3703. }
  3704. }
  3705. if (injectOptions) {
  3706. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  3707. }
  3708. if (methods) {
  3709. for (const key in methods) {
  3710. const methodHandler = methods[key];
  3711. if (isFunction(methodHandler)) {
  3712. {
  3713. Object.defineProperty(ctx, key, {
  3714. value: methodHandler.bind(publicThis),
  3715. configurable: true,
  3716. enumerable: true,
  3717. writable: true
  3718. });
  3719. }
  3720. {
  3721. checkDuplicateProperties("Methods" /* METHODS */, key);
  3722. }
  3723. } else {
  3724. warn$1(
  3725. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  3726. );
  3727. }
  3728. }
  3729. }
  3730. if (dataOptions) {
  3731. if (!isFunction(dataOptions)) {
  3732. warn$1(
  3733. `The data option must be a function. Plain object usage is no longer supported.`
  3734. );
  3735. }
  3736. const data = dataOptions.call(publicThis, publicThis);
  3737. if (isPromise(data)) {
  3738. warn$1(
  3739. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  3740. );
  3741. }
  3742. if (!isObject(data)) {
  3743. warn$1(`data() should return an object.`);
  3744. } else {
  3745. instance.data = reactive(data);
  3746. {
  3747. for (const key in data) {
  3748. checkDuplicateProperties("Data" /* DATA */, key);
  3749. if (!isReservedPrefix(key[0])) {
  3750. Object.defineProperty(ctx, key, {
  3751. configurable: true,
  3752. enumerable: true,
  3753. get: () => data[key],
  3754. set: NOOP
  3755. });
  3756. }
  3757. }
  3758. }
  3759. }
  3760. }
  3761. shouldCacheAccess = true;
  3762. if (computedOptions) {
  3763. for (const key in computedOptions) {
  3764. const opt = computedOptions[key];
  3765. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  3766. if (get === NOOP) {
  3767. warn$1(`Computed property "${key}" has no getter.`);
  3768. }
  3769. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  3770. warn$1(
  3771. `Write operation failed: computed property "${key}" is readonly.`
  3772. );
  3773. } ;
  3774. const c = computed({
  3775. get,
  3776. set
  3777. });
  3778. Object.defineProperty(ctx, key, {
  3779. enumerable: true,
  3780. configurable: true,
  3781. get: () => c.value,
  3782. set: (v) => c.value = v
  3783. });
  3784. {
  3785. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  3786. }
  3787. }
  3788. }
  3789. if (watchOptions) {
  3790. for (const key in watchOptions) {
  3791. createWatcher(watchOptions[key], ctx, publicThis, key);
  3792. }
  3793. }
  3794. if (provideOptions) {
  3795. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  3796. Reflect.ownKeys(provides).forEach((key) => {
  3797. provide(key, provides[key]);
  3798. });
  3799. }
  3800. if (created) {
  3801. callHook$1(created, instance, "c");
  3802. }
  3803. function registerLifecycleHook(register, hook) {
  3804. if (isArray(hook)) {
  3805. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  3806. } else if (hook) {
  3807. register(hook.bind(publicThis));
  3808. }
  3809. }
  3810. registerLifecycleHook(onBeforeMount, beforeMount);
  3811. registerLifecycleHook(onMounted, mounted);
  3812. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  3813. registerLifecycleHook(onUpdated, updated);
  3814. registerLifecycleHook(onActivated, activated);
  3815. registerLifecycleHook(onDeactivated, deactivated);
  3816. registerLifecycleHook(onErrorCaptured, errorCaptured);
  3817. registerLifecycleHook(onRenderTracked, renderTracked);
  3818. registerLifecycleHook(onRenderTriggered, renderTriggered);
  3819. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  3820. registerLifecycleHook(onUnmounted, unmounted);
  3821. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  3822. if (isArray(expose)) {
  3823. if (expose.length) {
  3824. const exposed = instance.exposed || (instance.exposed = {});
  3825. expose.forEach((key) => {
  3826. Object.defineProperty(exposed, key, {
  3827. get: () => publicThis[key],
  3828. set: (val) => publicThis[key] = val
  3829. });
  3830. });
  3831. } else if (!instance.exposed) {
  3832. instance.exposed = {};
  3833. }
  3834. }
  3835. if (render && instance.render === NOOP) {
  3836. instance.render = render;
  3837. }
  3838. if (inheritAttrs != null) {
  3839. instance.inheritAttrs = inheritAttrs;
  3840. }
  3841. if (components) instance.components = components;
  3842. if (directives) instance.directives = directives;
  3843. }
  3844. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  3845. if (isArray(injectOptions)) {
  3846. injectOptions = normalizeInject(injectOptions);
  3847. }
  3848. for (const key in injectOptions) {
  3849. const opt = injectOptions[key];
  3850. let injected;
  3851. if (isObject(opt)) {
  3852. if ("default" in opt) {
  3853. injected = inject(
  3854. opt.from || key,
  3855. opt.default,
  3856. true
  3857. );
  3858. } else {
  3859. injected = inject(opt.from || key);
  3860. }
  3861. } else {
  3862. injected = inject(opt);
  3863. }
  3864. if (isRef(injected)) {
  3865. Object.defineProperty(ctx, key, {
  3866. enumerable: true,
  3867. configurable: true,
  3868. get: () => injected.value,
  3869. set: (v) => injected.value = v
  3870. });
  3871. } else {
  3872. ctx[key] = injected;
  3873. }
  3874. {
  3875. checkDuplicateProperties("Inject" /* INJECT */, key);
  3876. }
  3877. }
  3878. }
  3879. function callHook$1(hook, instance, type) {
  3880. callWithAsyncErrorHandling(
  3881. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  3882. instance,
  3883. type
  3884. );
  3885. }
  3886. function createWatcher(raw, ctx, publicThis, key) {
  3887. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  3888. if (isString(raw)) {
  3889. const handler = ctx[raw];
  3890. if (isFunction(handler)) {
  3891. watch(getter, handler);
  3892. } else {
  3893. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  3894. }
  3895. } else if (isFunction(raw)) {
  3896. watch(getter, raw.bind(publicThis));
  3897. } else if (isObject(raw)) {
  3898. if (isArray(raw)) {
  3899. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  3900. } else {
  3901. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  3902. if (isFunction(handler)) {
  3903. watch(getter, handler, raw);
  3904. } else {
  3905. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  3906. }
  3907. }
  3908. } else {
  3909. warn$1(`Invalid watch option: "${key}"`, raw);
  3910. }
  3911. }
  3912. function resolveMergedOptions(instance) {
  3913. const base = instance.type;
  3914. const { mixins, extends: extendsOptions } = base;
  3915. const {
  3916. mixins: globalMixins,
  3917. optionsCache: cache,
  3918. config: { optionMergeStrategies }
  3919. } = instance.appContext;
  3920. const cached = cache.get(base);
  3921. let resolved;
  3922. if (cached) {
  3923. resolved = cached;
  3924. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  3925. {
  3926. resolved = base;
  3927. }
  3928. } else {
  3929. resolved = {};
  3930. if (globalMixins.length) {
  3931. globalMixins.forEach(
  3932. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  3933. );
  3934. }
  3935. mergeOptions(resolved, base, optionMergeStrategies);
  3936. }
  3937. if (isObject(base)) {
  3938. cache.set(base, resolved);
  3939. }
  3940. return resolved;
  3941. }
  3942. function mergeOptions(to, from, strats, asMixin = false) {
  3943. const { mixins, extends: extendsOptions } = from;
  3944. if (extendsOptions) {
  3945. mergeOptions(to, extendsOptions, strats, true);
  3946. }
  3947. if (mixins) {
  3948. mixins.forEach(
  3949. (m) => mergeOptions(to, m, strats, true)
  3950. );
  3951. }
  3952. for (const key in from) {
  3953. if (asMixin && key === "expose") {
  3954. warn$1(
  3955. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  3956. );
  3957. } else {
  3958. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  3959. to[key] = strat ? strat(to[key], from[key]) : from[key];
  3960. }
  3961. }
  3962. return to;
  3963. }
  3964. const internalOptionMergeStrats = {
  3965. data: mergeDataFn,
  3966. props: mergeEmitsOrPropsOptions,
  3967. emits: mergeEmitsOrPropsOptions,
  3968. // objects
  3969. methods: mergeObjectOptions,
  3970. computed: mergeObjectOptions,
  3971. // lifecycle
  3972. beforeCreate: mergeAsArray$1,
  3973. created: mergeAsArray$1,
  3974. beforeMount: mergeAsArray$1,
  3975. mounted: mergeAsArray$1,
  3976. beforeUpdate: mergeAsArray$1,
  3977. updated: mergeAsArray$1,
  3978. beforeDestroy: mergeAsArray$1,
  3979. beforeUnmount: mergeAsArray$1,
  3980. destroyed: mergeAsArray$1,
  3981. unmounted: mergeAsArray$1,
  3982. activated: mergeAsArray$1,
  3983. deactivated: mergeAsArray$1,
  3984. errorCaptured: mergeAsArray$1,
  3985. serverPrefetch: mergeAsArray$1,
  3986. // assets
  3987. components: mergeObjectOptions,
  3988. directives: mergeObjectOptions,
  3989. // watch
  3990. watch: mergeWatchOptions,
  3991. // provide / inject
  3992. provide: mergeDataFn,
  3993. inject: mergeInject
  3994. };
  3995. function mergeDataFn(to, from) {
  3996. if (!from) {
  3997. return to;
  3998. }
  3999. if (!to) {
  4000. return from;
  4001. }
  4002. return function mergedDataFn() {
  4003. return (extend)(
  4004. isFunction(to) ? to.call(this, this) : to,
  4005. isFunction(from) ? from.call(this, this) : from
  4006. );
  4007. };
  4008. }
  4009. function mergeInject(to, from) {
  4010. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  4011. }
  4012. function normalizeInject(raw) {
  4013. if (isArray(raw)) {
  4014. const res = {};
  4015. for (let i = 0; i < raw.length; i++) {
  4016. res[raw[i]] = raw[i];
  4017. }
  4018. return res;
  4019. }
  4020. return raw;
  4021. }
  4022. function mergeAsArray$1(to, from) {
  4023. return to ? [...new Set([].concat(to, from))] : from;
  4024. }
  4025. function mergeObjectOptions(to, from) {
  4026. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  4027. }
  4028. function mergeEmitsOrPropsOptions(to, from) {
  4029. if (to) {
  4030. if (isArray(to) && isArray(from)) {
  4031. return [.../* @__PURE__ */ new Set([...to, ...from])];
  4032. }
  4033. return extend(
  4034. /* @__PURE__ */ Object.create(null),
  4035. normalizePropsOrEmits(to),
  4036. normalizePropsOrEmits(from != null ? from : {})
  4037. );
  4038. } else {
  4039. return from;
  4040. }
  4041. }
  4042. function mergeWatchOptions(to, from) {
  4043. if (!to) return from;
  4044. if (!from) return to;
  4045. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  4046. for (const key in from) {
  4047. merged[key] = mergeAsArray$1(to[key], from[key]);
  4048. }
  4049. return merged;
  4050. }
  4051. function createAppContext() {
  4052. return {
  4053. app: null,
  4054. config: {
  4055. isNativeTag: NO,
  4056. performance: false,
  4057. globalProperties: {},
  4058. optionMergeStrategies: {},
  4059. errorHandler: void 0,
  4060. warnHandler: void 0,
  4061. compilerOptions: {}
  4062. },
  4063. mixins: [],
  4064. components: {},
  4065. directives: {},
  4066. provides: /* @__PURE__ */ Object.create(null),
  4067. optionsCache: /* @__PURE__ */ new WeakMap(),
  4068. propsCache: /* @__PURE__ */ new WeakMap(),
  4069. emitsCache: /* @__PURE__ */ new WeakMap()
  4070. };
  4071. }
  4072. let uid$1 = 0;
  4073. function createAppAPI(render, hydrate) {
  4074. return function createApp(rootComponent, rootProps = null) {
  4075. if (!isFunction(rootComponent)) {
  4076. rootComponent = extend({}, rootComponent);
  4077. }
  4078. if (rootProps != null && !isObject(rootProps)) {
  4079. warn$1(`root props passed to app.mount() must be an object.`);
  4080. rootProps = null;
  4081. }
  4082. const context = createAppContext();
  4083. const installedPlugins = /* @__PURE__ */ new WeakSet();
  4084. let isMounted = false;
  4085. const app = context.app = {
  4086. _uid: uid$1++,
  4087. _component: rootComponent,
  4088. _props: rootProps,
  4089. _container: null,
  4090. _context: context,
  4091. _instance: null,
  4092. version,
  4093. get config() {
  4094. return context.config;
  4095. },
  4096. set config(v) {
  4097. {
  4098. warn$1(
  4099. `app.config cannot be replaced. Modify individual options instead.`
  4100. );
  4101. }
  4102. },
  4103. use(plugin, ...options) {
  4104. if (installedPlugins.has(plugin)) {
  4105. warn$1(`Plugin has already been applied to target app.`);
  4106. } else if (plugin && isFunction(plugin.install)) {
  4107. installedPlugins.add(plugin);
  4108. plugin.install(app, ...options);
  4109. } else if (isFunction(plugin)) {
  4110. installedPlugins.add(plugin);
  4111. plugin(app, ...options);
  4112. } else {
  4113. warn$1(
  4114. `A plugin must either be a function or an object with an "install" function.`
  4115. );
  4116. }
  4117. return app;
  4118. },
  4119. mixin(mixin) {
  4120. {
  4121. if (!context.mixins.includes(mixin)) {
  4122. context.mixins.push(mixin);
  4123. } else {
  4124. warn$1(
  4125. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  4126. );
  4127. }
  4128. }
  4129. return app;
  4130. },
  4131. component(name, component) {
  4132. {
  4133. validateComponentName(name, context.config);
  4134. }
  4135. if (!component) {
  4136. return context.components[name];
  4137. }
  4138. if (context.components[name]) {
  4139. warn$1(`Component "${name}" has already been registered in target app.`);
  4140. }
  4141. context.components[name] = component;
  4142. return app;
  4143. },
  4144. directive(name, directive) {
  4145. {
  4146. validateDirectiveName(name);
  4147. }
  4148. if (!directive) {
  4149. return context.directives[name];
  4150. }
  4151. if (context.directives[name]) {
  4152. warn$1(`Directive "${name}" has already been registered in target app.`);
  4153. }
  4154. context.directives[name] = directive;
  4155. return app;
  4156. },
  4157. mount(rootContainer, isHydrate, namespace) {
  4158. if (!isMounted) {
  4159. if (rootContainer.__vue_app__) {
  4160. warn$1(
  4161. `There is already an app instance mounted on the host container.
  4162. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  4163. );
  4164. }
  4165. const vnode = createVNode(rootComponent, rootProps);
  4166. vnode.appContext = context;
  4167. if (namespace === true) {
  4168. namespace = "svg";
  4169. } else if (namespace === false) {
  4170. namespace = void 0;
  4171. }
  4172. {
  4173. context.reload = () => {
  4174. render(
  4175. cloneVNode(vnode),
  4176. rootContainer,
  4177. namespace
  4178. );
  4179. };
  4180. }
  4181. if (isHydrate && hydrate) {
  4182. hydrate(vnode, rootContainer);
  4183. } else {
  4184. render(vnode, rootContainer, namespace);
  4185. }
  4186. isMounted = true;
  4187. app._container = rootContainer;
  4188. rootContainer.__vue_app__ = app;
  4189. {
  4190. app._instance = vnode.component;
  4191. devtoolsInitApp(app, version);
  4192. }
  4193. return getComponentPublicInstance(vnode.component);
  4194. } else {
  4195. warn$1(
  4196. `App has already been mounted.
  4197. 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)\``
  4198. );
  4199. }
  4200. },
  4201. unmount() {
  4202. if (isMounted) {
  4203. render(null, app._container);
  4204. {
  4205. app._instance = null;
  4206. devtoolsUnmountApp(app);
  4207. }
  4208. delete app._container.__vue_app__;
  4209. } else {
  4210. warn$1(`Cannot unmount an app that is not mounted.`);
  4211. }
  4212. },
  4213. provide(key, value) {
  4214. if (key in context.provides) {
  4215. warn$1(
  4216. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  4217. );
  4218. }
  4219. context.provides[key] = value;
  4220. return app;
  4221. },
  4222. runWithContext(fn) {
  4223. const lastApp = currentApp;
  4224. currentApp = app;
  4225. try {
  4226. return fn();
  4227. } finally {
  4228. currentApp = lastApp;
  4229. }
  4230. }
  4231. };
  4232. return app;
  4233. };
  4234. }
  4235. let currentApp = null;
  4236. function provide(key, value) {
  4237. if (!currentInstance) {
  4238. {
  4239. warn$1(`provide() can only be used inside setup().`);
  4240. }
  4241. } else {
  4242. let provides = currentInstance.provides;
  4243. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  4244. if (parentProvides === provides) {
  4245. provides = currentInstance.provides = Object.create(parentProvides);
  4246. }
  4247. provides[key] = value;
  4248. }
  4249. }
  4250. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  4251. const instance = currentInstance || currentRenderingInstance;
  4252. if (instance || currentApp) {
  4253. const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  4254. if (provides && key in provides) {
  4255. return provides[key];
  4256. } else if (arguments.length > 1) {
  4257. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  4258. } else {
  4259. warn$1(`injection "${String(key)}" not found.`);
  4260. }
  4261. } else {
  4262. warn$1(`inject() can only be used inside setup() or functional components.`);
  4263. }
  4264. }
  4265. function hasInjectionContext() {
  4266. return !!(currentInstance || currentRenderingInstance || currentApp);
  4267. }
  4268. const internalObjectProto = {};
  4269. const createInternalObject = () => Object.create(internalObjectProto);
  4270. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  4271. function initProps(instance, rawProps, isStateful, isSSR = false) {
  4272. const props = {};
  4273. const attrs = createInternalObject();
  4274. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  4275. setFullProps(instance, rawProps, props, attrs);
  4276. for (const key in instance.propsOptions[0]) {
  4277. if (!(key in props)) {
  4278. props[key] = void 0;
  4279. }
  4280. }
  4281. {
  4282. validateProps(rawProps || {}, props, instance);
  4283. }
  4284. if (isStateful) {
  4285. instance.props = isSSR ? props : shallowReactive(props);
  4286. } else {
  4287. if (!instance.type.props) {
  4288. instance.props = attrs;
  4289. } else {
  4290. instance.props = props;
  4291. }
  4292. }
  4293. instance.attrs = attrs;
  4294. }
  4295. function isInHmrContext(instance) {
  4296. while (instance) {
  4297. if (instance.type.__hmrId) return true;
  4298. instance = instance.parent;
  4299. }
  4300. }
  4301. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  4302. const {
  4303. props,
  4304. attrs,
  4305. vnode: { patchFlag }
  4306. } = instance;
  4307. const rawCurrentProps = toRaw(props);
  4308. const [options] = instance.propsOptions;
  4309. let hasAttrsChanged = false;
  4310. if (
  4311. // always force full diff in dev
  4312. // - #1942 if hmr is enabled with sfc component
  4313. // - vite#872 non-sfc component used by sfc component
  4314. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  4315. ) {
  4316. if (patchFlag & 8) {
  4317. const propsToUpdate = instance.vnode.dynamicProps;
  4318. for (let i = 0; i < propsToUpdate.length; i++) {
  4319. let key = propsToUpdate[i];
  4320. if (isEmitListener(instance.emitsOptions, key)) {
  4321. continue;
  4322. }
  4323. const value = rawProps[key];
  4324. if (options) {
  4325. if (hasOwn(attrs, key)) {
  4326. if (value !== attrs[key]) {
  4327. attrs[key] = value;
  4328. hasAttrsChanged = true;
  4329. }
  4330. } else {
  4331. const camelizedKey = camelize(key);
  4332. props[camelizedKey] = resolvePropValue(
  4333. options,
  4334. rawCurrentProps,
  4335. camelizedKey,
  4336. value,
  4337. instance,
  4338. false
  4339. );
  4340. }
  4341. } else {
  4342. if (value !== attrs[key]) {
  4343. attrs[key] = value;
  4344. hasAttrsChanged = true;
  4345. }
  4346. }
  4347. }
  4348. }
  4349. } else {
  4350. if (setFullProps(instance, rawProps, props, attrs)) {
  4351. hasAttrsChanged = true;
  4352. }
  4353. let kebabKey;
  4354. for (const key in rawCurrentProps) {
  4355. if (!rawProps || // for camelCase
  4356. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  4357. // and converted to camelCase (#955)
  4358. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  4359. if (options) {
  4360. if (rawPrevProps && // for camelCase
  4361. (rawPrevProps[key] !== void 0 || // for kebab-case
  4362. rawPrevProps[kebabKey] !== void 0)) {
  4363. props[key] = resolvePropValue(
  4364. options,
  4365. rawCurrentProps,
  4366. key,
  4367. void 0,
  4368. instance,
  4369. true
  4370. );
  4371. }
  4372. } else {
  4373. delete props[key];
  4374. }
  4375. }
  4376. }
  4377. if (attrs !== rawCurrentProps) {
  4378. for (const key in attrs) {
  4379. if (!rawProps || !hasOwn(rawProps, key) && true) {
  4380. delete attrs[key];
  4381. hasAttrsChanged = true;
  4382. }
  4383. }
  4384. }
  4385. }
  4386. if (hasAttrsChanged) {
  4387. trigger(instance.attrs, "set", "");
  4388. }
  4389. {
  4390. validateProps(rawProps || {}, props, instance);
  4391. }
  4392. }
  4393. function setFullProps(instance, rawProps, props, attrs) {
  4394. const [options, needCastKeys] = instance.propsOptions;
  4395. let hasAttrsChanged = false;
  4396. let rawCastValues;
  4397. if (rawProps) {
  4398. for (let key in rawProps) {
  4399. if (isReservedProp(key)) {
  4400. continue;
  4401. }
  4402. const value = rawProps[key];
  4403. let camelKey;
  4404. if (options && hasOwn(options, camelKey = camelize(key))) {
  4405. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  4406. props[camelKey] = value;
  4407. } else {
  4408. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  4409. }
  4410. } else if (!isEmitListener(instance.emitsOptions, key)) {
  4411. if (!(key in attrs) || value !== attrs[key]) {
  4412. attrs[key] = value;
  4413. hasAttrsChanged = true;
  4414. }
  4415. }
  4416. }
  4417. }
  4418. if (needCastKeys) {
  4419. const rawCurrentProps = toRaw(props);
  4420. const castValues = rawCastValues || EMPTY_OBJ;
  4421. for (let i = 0; i < needCastKeys.length; i++) {
  4422. const key = needCastKeys[i];
  4423. props[key] = resolvePropValue(
  4424. options,
  4425. rawCurrentProps,
  4426. key,
  4427. castValues[key],
  4428. instance,
  4429. !hasOwn(castValues, key)
  4430. );
  4431. }
  4432. }
  4433. return hasAttrsChanged;
  4434. }
  4435. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  4436. const opt = options[key];
  4437. if (opt != null) {
  4438. const hasDefault = hasOwn(opt, "default");
  4439. if (hasDefault && value === void 0) {
  4440. const defaultValue = opt.default;
  4441. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  4442. const { propsDefaults } = instance;
  4443. if (key in propsDefaults) {
  4444. value = propsDefaults[key];
  4445. } else {
  4446. const reset = setCurrentInstance(instance);
  4447. value = propsDefaults[key] = defaultValue.call(
  4448. null,
  4449. props
  4450. );
  4451. reset();
  4452. }
  4453. } else {
  4454. value = defaultValue;
  4455. }
  4456. }
  4457. if (opt[0 /* shouldCast */]) {
  4458. if (isAbsent && !hasDefault) {
  4459. value = false;
  4460. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  4461. value = true;
  4462. }
  4463. }
  4464. }
  4465. return value;
  4466. }
  4467. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  4468. function normalizePropsOptions(comp, appContext, asMixin = false) {
  4469. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  4470. const cached = cache.get(comp);
  4471. if (cached) {
  4472. return cached;
  4473. }
  4474. const raw = comp.props;
  4475. const normalized = {};
  4476. const needCastKeys = [];
  4477. let hasExtends = false;
  4478. if (!isFunction(comp)) {
  4479. const extendProps = (raw2) => {
  4480. hasExtends = true;
  4481. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  4482. extend(normalized, props);
  4483. if (keys) needCastKeys.push(...keys);
  4484. };
  4485. if (!asMixin && appContext.mixins.length) {
  4486. appContext.mixins.forEach(extendProps);
  4487. }
  4488. if (comp.extends) {
  4489. extendProps(comp.extends);
  4490. }
  4491. if (comp.mixins) {
  4492. comp.mixins.forEach(extendProps);
  4493. }
  4494. }
  4495. if (!raw && !hasExtends) {
  4496. if (isObject(comp)) {
  4497. cache.set(comp, EMPTY_ARR);
  4498. }
  4499. return EMPTY_ARR;
  4500. }
  4501. if (isArray(raw)) {
  4502. for (let i = 0; i < raw.length; i++) {
  4503. if (!isString(raw[i])) {
  4504. warn$1(`props must be strings when using array syntax.`, raw[i]);
  4505. }
  4506. const normalizedKey = camelize(raw[i]);
  4507. if (validatePropName(normalizedKey)) {
  4508. normalized[normalizedKey] = EMPTY_OBJ;
  4509. }
  4510. }
  4511. } else if (raw) {
  4512. if (!isObject(raw)) {
  4513. warn$1(`invalid props options`, raw);
  4514. }
  4515. for (const key in raw) {
  4516. const normalizedKey = camelize(key);
  4517. if (validatePropName(normalizedKey)) {
  4518. const opt = raw[key];
  4519. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  4520. const propType = prop.type;
  4521. let shouldCast = false;
  4522. let shouldCastTrue = true;
  4523. if (isArray(propType)) {
  4524. for (let index = 0; index < propType.length; ++index) {
  4525. const type = propType[index];
  4526. const typeName = isFunction(type) && type.name;
  4527. if (typeName === "Boolean") {
  4528. shouldCast = true;
  4529. break;
  4530. } else if (typeName === "String") {
  4531. shouldCastTrue = false;
  4532. }
  4533. }
  4534. } else {
  4535. shouldCast = isFunction(propType) && propType.name === "Boolean";
  4536. }
  4537. prop[0 /* shouldCast */] = shouldCast;
  4538. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  4539. if (shouldCast || hasOwn(prop, "default")) {
  4540. needCastKeys.push(normalizedKey);
  4541. }
  4542. }
  4543. }
  4544. }
  4545. const res = [normalized, needCastKeys];
  4546. if (isObject(comp)) {
  4547. cache.set(comp, res);
  4548. }
  4549. return res;
  4550. }
  4551. function validatePropName(key) {
  4552. if (key[0] !== "$" && !isReservedProp(key)) {
  4553. return true;
  4554. } else {
  4555. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  4556. }
  4557. return false;
  4558. }
  4559. function getType(ctor) {
  4560. if (ctor === null) {
  4561. return "null";
  4562. }
  4563. if (typeof ctor === "function") {
  4564. return ctor.name || "";
  4565. } else if (typeof ctor === "object") {
  4566. const name = ctor.constructor && ctor.constructor.name;
  4567. return name || "";
  4568. }
  4569. return "";
  4570. }
  4571. function validateProps(rawProps, props, instance) {
  4572. const resolvedValues = toRaw(props);
  4573. const options = instance.propsOptions[0];
  4574. for (const key in options) {
  4575. let opt = options[key];
  4576. if (opt == null) continue;
  4577. validateProp(
  4578. key,
  4579. resolvedValues[key],
  4580. opt,
  4581. shallowReadonly(resolvedValues) ,
  4582. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  4583. );
  4584. }
  4585. }
  4586. function validateProp(name, value, prop, props, isAbsent) {
  4587. const { type, required, validator, skipCheck } = prop;
  4588. if (required && isAbsent) {
  4589. warn$1('Missing required prop: "' + name + '"');
  4590. return;
  4591. }
  4592. if (value == null && !required) {
  4593. return;
  4594. }
  4595. if (type != null && type !== true && !skipCheck) {
  4596. let isValid = false;
  4597. const types = isArray(type) ? type : [type];
  4598. const expectedTypes = [];
  4599. for (let i = 0; i < types.length && !isValid; i++) {
  4600. const { valid, expectedType } = assertType(value, types[i]);
  4601. expectedTypes.push(expectedType || "");
  4602. isValid = valid;
  4603. }
  4604. if (!isValid) {
  4605. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  4606. return;
  4607. }
  4608. }
  4609. if (validator && !validator(value, props)) {
  4610. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  4611. }
  4612. }
  4613. const isSimpleType = /* @__PURE__ */ makeMap(
  4614. "String,Number,Boolean,Function,Symbol,BigInt"
  4615. );
  4616. function assertType(value, type) {
  4617. let valid;
  4618. const expectedType = getType(type);
  4619. if (isSimpleType(expectedType)) {
  4620. const t = typeof value;
  4621. valid = t === expectedType.toLowerCase();
  4622. if (!valid && t === "object") {
  4623. valid = value instanceof type;
  4624. }
  4625. } else if (expectedType === "Object") {
  4626. valid = isObject(value);
  4627. } else if (expectedType === "Array") {
  4628. valid = isArray(value);
  4629. } else if (expectedType === "null") {
  4630. valid = value === null;
  4631. } else {
  4632. valid = value instanceof type;
  4633. }
  4634. return {
  4635. valid,
  4636. expectedType
  4637. };
  4638. }
  4639. function getInvalidTypeMessage(name, value, expectedTypes) {
  4640. if (expectedTypes.length === 0) {
  4641. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  4642. }
  4643. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  4644. const expectedType = expectedTypes[0];
  4645. const receivedType = toRawType(value);
  4646. const expectedValue = styleValue(value, expectedType);
  4647. const receivedValue = styleValue(value, receivedType);
  4648. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  4649. message += ` with value ${expectedValue}`;
  4650. }
  4651. message += `, got ${receivedType} `;
  4652. if (isExplicable(receivedType)) {
  4653. message += `with value ${receivedValue}.`;
  4654. }
  4655. return message;
  4656. }
  4657. function styleValue(value, type) {
  4658. if (type === "String") {
  4659. return `"${value}"`;
  4660. } else if (type === "Number") {
  4661. return `${Number(value)}`;
  4662. } else {
  4663. return `${value}`;
  4664. }
  4665. }
  4666. function isExplicable(type) {
  4667. const explicitTypes = ["string", "number", "boolean"];
  4668. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  4669. }
  4670. function isBoolean(...args) {
  4671. return args.some((elem) => elem.toLowerCase() === "boolean");
  4672. }
  4673. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  4674. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  4675. const normalizeSlot = (key, rawSlot, ctx) => {
  4676. if (rawSlot._n) {
  4677. return rawSlot;
  4678. }
  4679. const normalized = withCtx((...args) => {
  4680. if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
  4681. warn$1(
  4682. `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.`
  4683. );
  4684. }
  4685. return normalizeSlotValue(rawSlot(...args));
  4686. }, ctx);
  4687. normalized._c = false;
  4688. return normalized;
  4689. };
  4690. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  4691. const ctx = rawSlots._ctx;
  4692. for (const key in rawSlots) {
  4693. if (isInternalKey(key)) continue;
  4694. const value = rawSlots[key];
  4695. if (isFunction(value)) {
  4696. slots[key] = normalizeSlot(key, value, ctx);
  4697. } else if (value != null) {
  4698. {
  4699. warn$1(
  4700. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  4701. );
  4702. }
  4703. const normalized = normalizeSlotValue(value);
  4704. slots[key] = () => normalized;
  4705. }
  4706. }
  4707. };
  4708. const normalizeVNodeSlots = (instance, children) => {
  4709. if (!isKeepAlive(instance.vnode) && true) {
  4710. warn$1(
  4711. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  4712. );
  4713. }
  4714. const normalized = normalizeSlotValue(children);
  4715. instance.slots.default = () => normalized;
  4716. };
  4717. const assignSlots = (slots, children, optimized) => {
  4718. for (const key in children) {
  4719. if (optimized || key !== "_") {
  4720. slots[key] = children[key];
  4721. }
  4722. }
  4723. };
  4724. const initSlots = (instance, children, optimized) => {
  4725. const slots = instance.slots = createInternalObject();
  4726. if (instance.vnode.shapeFlag & 32) {
  4727. const type = children._;
  4728. if (type) {
  4729. assignSlots(slots, children, optimized);
  4730. if (optimized) {
  4731. def(slots, "_", type, true);
  4732. }
  4733. } else {
  4734. normalizeObjectSlots(children, slots);
  4735. }
  4736. } else if (children) {
  4737. normalizeVNodeSlots(instance, children);
  4738. }
  4739. };
  4740. const updateSlots = (instance, children, optimized) => {
  4741. const { vnode, slots } = instance;
  4742. let needDeletionCheck = true;
  4743. let deletionComparisonTarget = EMPTY_OBJ;
  4744. if (vnode.shapeFlag & 32) {
  4745. const type = children._;
  4746. if (type) {
  4747. if (isHmrUpdating) {
  4748. assignSlots(slots, children, optimized);
  4749. trigger(instance, "set", "$slots");
  4750. } else if (optimized && type === 1) {
  4751. needDeletionCheck = false;
  4752. } else {
  4753. assignSlots(slots, children, optimized);
  4754. }
  4755. } else {
  4756. needDeletionCheck = !children.$stable;
  4757. normalizeObjectSlots(children, slots);
  4758. }
  4759. deletionComparisonTarget = children;
  4760. } else if (children) {
  4761. normalizeVNodeSlots(instance, children);
  4762. deletionComparisonTarget = { default: 1 };
  4763. }
  4764. if (needDeletionCheck) {
  4765. for (const key in slots) {
  4766. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  4767. delete slots[key];
  4768. }
  4769. }
  4770. }
  4771. };
  4772. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  4773. if (isArray(rawRef)) {
  4774. rawRef.forEach(
  4775. (r, i) => setRef(
  4776. r,
  4777. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  4778. parentSuspense,
  4779. vnode,
  4780. isUnmount
  4781. )
  4782. );
  4783. return;
  4784. }
  4785. if (isAsyncWrapper(vnode) && !isUnmount) {
  4786. return;
  4787. }
  4788. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  4789. const value = isUnmount ? null : refValue;
  4790. const { i: owner, r: ref } = rawRef;
  4791. if (!owner) {
  4792. warn$1(
  4793. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  4794. );
  4795. return;
  4796. }
  4797. const oldRef = oldRawRef && oldRawRef.r;
  4798. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  4799. const setupState = owner.setupState;
  4800. if (oldRef != null && oldRef !== ref) {
  4801. if (isString(oldRef)) {
  4802. refs[oldRef] = null;
  4803. if (hasOwn(setupState, oldRef)) {
  4804. setupState[oldRef] = null;
  4805. }
  4806. } else if (isRef(oldRef)) {
  4807. oldRef.value = null;
  4808. }
  4809. }
  4810. if (isFunction(ref)) {
  4811. callWithErrorHandling(ref, owner, 12, [value, refs]);
  4812. } else {
  4813. const _isString = isString(ref);
  4814. const _isRef = isRef(ref);
  4815. if (_isString || _isRef) {
  4816. const doSet = () => {
  4817. if (rawRef.f) {
  4818. const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  4819. if (isUnmount) {
  4820. isArray(existing) && remove(existing, refValue);
  4821. } else {
  4822. if (!isArray(existing)) {
  4823. if (_isString) {
  4824. refs[ref] = [refValue];
  4825. if (hasOwn(setupState, ref)) {
  4826. setupState[ref] = refs[ref];
  4827. }
  4828. } else {
  4829. ref.value = [refValue];
  4830. if (rawRef.k) refs[rawRef.k] = ref.value;
  4831. }
  4832. } else if (!existing.includes(refValue)) {
  4833. existing.push(refValue);
  4834. }
  4835. }
  4836. } else if (_isString) {
  4837. refs[ref] = value;
  4838. if (hasOwn(setupState, ref)) {
  4839. setupState[ref] = value;
  4840. }
  4841. } else if (_isRef) {
  4842. ref.value = value;
  4843. if (rawRef.k) refs[rawRef.k] = value;
  4844. } else {
  4845. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4846. }
  4847. };
  4848. if (value) {
  4849. doSet.id = -1;
  4850. queuePostRenderEffect(doSet, parentSuspense);
  4851. } else {
  4852. doSet();
  4853. }
  4854. } else {
  4855. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4856. }
  4857. }
  4858. }
  4859. const TeleportEndKey = Symbol("_vte");
  4860. const isTeleport = (type) => type.__isTeleport;
  4861. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  4862. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  4863. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  4864. const resolveTarget = (props, select) => {
  4865. const targetSelector = props && props.to;
  4866. if (isString(targetSelector)) {
  4867. if (!select) {
  4868. warn$1(
  4869. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  4870. );
  4871. return null;
  4872. } else {
  4873. const target = select(targetSelector);
  4874. if (!target && !isTeleportDisabled(props)) {
  4875. warn$1(
  4876. `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.`
  4877. );
  4878. }
  4879. return target;
  4880. }
  4881. } else {
  4882. if (!targetSelector && !isTeleportDisabled(props)) {
  4883. warn$1(`Invalid Teleport target: ${targetSelector}`);
  4884. }
  4885. return targetSelector;
  4886. }
  4887. };
  4888. const TeleportImpl = {
  4889. name: "Teleport",
  4890. __isTeleport: true,
  4891. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  4892. const {
  4893. mc: mountChildren,
  4894. pc: patchChildren,
  4895. pbc: patchBlockChildren,
  4896. o: { insert, querySelector, createText, createComment }
  4897. } = internals;
  4898. const disabled = isTeleportDisabled(n2.props);
  4899. let { shapeFlag, children, dynamicChildren } = n2;
  4900. if (isHmrUpdating) {
  4901. optimized = false;
  4902. dynamicChildren = null;
  4903. }
  4904. if (n1 == null) {
  4905. const placeholder = n2.el = createComment("teleport start") ;
  4906. const mainAnchor = n2.anchor = createComment("teleport end") ;
  4907. insert(placeholder, container, anchor);
  4908. insert(mainAnchor, container, anchor);
  4909. const target = n2.target = resolveTarget(n2.props, querySelector);
  4910. const targetAnchor = prepareAnchor(target, n2, createText, insert);
  4911. if (target) {
  4912. if (namespace === "svg" || isTargetSVG(target)) {
  4913. namespace = "svg";
  4914. } else if (namespace === "mathml" || isTargetMathML(target)) {
  4915. namespace = "mathml";
  4916. }
  4917. } else if (!disabled) {
  4918. warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
  4919. }
  4920. const mount = (container2, anchor2) => {
  4921. if (shapeFlag & 16) {
  4922. mountChildren(
  4923. children,
  4924. container2,
  4925. anchor2,
  4926. parentComponent,
  4927. parentSuspense,
  4928. namespace,
  4929. slotScopeIds,
  4930. optimized
  4931. );
  4932. }
  4933. };
  4934. if (disabled) {
  4935. mount(container, mainAnchor);
  4936. } else if (target) {
  4937. mount(target, targetAnchor);
  4938. }
  4939. } else {
  4940. n2.el = n1.el;
  4941. n2.targetStart = n1.targetStart;
  4942. const mainAnchor = n2.anchor = n1.anchor;
  4943. const target = n2.target = n1.target;
  4944. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  4945. const wasDisabled = isTeleportDisabled(n1.props);
  4946. const currentContainer = wasDisabled ? container : target;
  4947. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  4948. if (namespace === "svg" || isTargetSVG(target)) {
  4949. namespace = "svg";
  4950. } else if (namespace === "mathml" || isTargetMathML(target)) {
  4951. namespace = "mathml";
  4952. }
  4953. if (dynamicChildren) {
  4954. patchBlockChildren(
  4955. n1.dynamicChildren,
  4956. dynamicChildren,
  4957. currentContainer,
  4958. parentComponent,
  4959. parentSuspense,
  4960. namespace,
  4961. slotScopeIds
  4962. );
  4963. traverseStaticChildren(n1, n2, true);
  4964. } else if (!optimized) {
  4965. patchChildren(
  4966. n1,
  4967. n2,
  4968. currentContainer,
  4969. currentAnchor,
  4970. parentComponent,
  4971. parentSuspense,
  4972. namespace,
  4973. slotScopeIds,
  4974. false
  4975. );
  4976. }
  4977. if (disabled) {
  4978. if (!wasDisabled) {
  4979. moveTeleport(
  4980. n2,
  4981. container,
  4982. mainAnchor,
  4983. internals,
  4984. 1
  4985. );
  4986. } else {
  4987. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  4988. n2.props.to = n1.props.to;
  4989. }
  4990. }
  4991. } else {
  4992. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  4993. const nextTarget = n2.target = resolveTarget(
  4994. n2.props,
  4995. querySelector
  4996. );
  4997. if (nextTarget) {
  4998. moveTeleport(
  4999. n2,
  5000. nextTarget,
  5001. null,
  5002. internals,
  5003. 0
  5004. );
  5005. } else {
  5006. warn$1(
  5007. "Invalid Teleport target on update:",
  5008. target,
  5009. `(${typeof target})`
  5010. );
  5011. }
  5012. } else if (wasDisabled) {
  5013. moveTeleport(
  5014. n2,
  5015. target,
  5016. targetAnchor,
  5017. internals,
  5018. 1
  5019. );
  5020. }
  5021. }
  5022. }
  5023. updateCssVars(n2);
  5024. },
  5025. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  5026. const {
  5027. shapeFlag,
  5028. children,
  5029. anchor,
  5030. targetStart,
  5031. targetAnchor,
  5032. target,
  5033. props
  5034. } = vnode;
  5035. if (target) {
  5036. hostRemove(targetStart);
  5037. hostRemove(targetAnchor);
  5038. }
  5039. doRemove && hostRemove(anchor);
  5040. if (shapeFlag & 16) {
  5041. const shouldRemove = doRemove || !isTeleportDisabled(props);
  5042. for (let i = 0; i < children.length; i++) {
  5043. const child = children[i];
  5044. unmount(
  5045. child,
  5046. parentComponent,
  5047. parentSuspense,
  5048. shouldRemove,
  5049. !!child.dynamicChildren
  5050. );
  5051. }
  5052. }
  5053. },
  5054. move: moveTeleport,
  5055. hydrate: hydrateTeleport
  5056. };
  5057. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  5058. if (moveType === 0) {
  5059. insert(vnode.targetAnchor, container, parentAnchor);
  5060. }
  5061. const { el, anchor, shapeFlag, children, props } = vnode;
  5062. const isReorder = moveType === 2;
  5063. if (isReorder) {
  5064. insert(el, container, parentAnchor);
  5065. }
  5066. if (!isReorder || isTeleportDisabled(props)) {
  5067. if (shapeFlag & 16) {
  5068. for (let i = 0; i < children.length; i++) {
  5069. move(
  5070. children[i],
  5071. container,
  5072. parentAnchor,
  5073. 2
  5074. );
  5075. }
  5076. }
  5077. }
  5078. if (isReorder) {
  5079. insert(anchor, container, parentAnchor);
  5080. }
  5081. }
  5082. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  5083. o: { nextSibling, parentNode, querySelector, insert, createText }
  5084. }, hydrateChildren) {
  5085. const target = vnode.target = resolveTarget(
  5086. vnode.props,
  5087. querySelector
  5088. );
  5089. if (target) {
  5090. const targetNode = target._lpa || target.firstChild;
  5091. if (vnode.shapeFlag & 16) {
  5092. if (isTeleportDisabled(vnode.props)) {
  5093. vnode.anchor = hydrateChildren(
  5094. nextSibling(node),
  5095. vnode,
  5096. parentNode(node),
  5097. parentComponent,
  5098. parentSuspense,
  5099. slotScopeIds,
  5100. optimized
  5101. );
  5102. vnode.targetStart = targetNode;
  5103. vnode.targetAnchor = targetNode && nextSibling(targetNode);
  5104. } else {
  5105. vnode.anchor = nextSibling(node);
  5106. let targetAnchor = targetNode;
  5107. while (targetAnchor) {
  5108. if (targetAnchor && targetAnchor.nodeType === 8) {
  5109. if (targetAnchor.data === "teleport start anchor") {
  5110. vnode.targetStart = targetAnchor;
  5111. } else if (targetAnchor.data === "teleport anchor") {
  5112. vnode.targetAnchor = targetAnchor;
  5113. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  5114. break;
  5115. }
  5116. }
  5117. targetAnchor = nextSibling(targetAnchor);
  5118. }
  5119. if (!vnode.targetAnchor) {
  5120. prepareAnchor(target, vnode, createText, insert);
  5121. }
  5122. hydrateChildren(
  5123. targetNode && nextSibling(targetNode),
  5124. vnode,
  5125. target,
  5126. parentComponent,
  5127. parentSuspense,
  5128. slotScopeIds,
  5129. optimized
  5130. );
  5131. }
  5132. }
  5133. updateCssVars(vnode);
  5134. }
  5135. return vnode.anchor && nextSibling(vnode.anchor);
  5136. }
  5137. const Teleport = TeleportImpl;
  5138. function updateCssVars(vnode) {
  5139. const ctx = vnode.ctx;
  5140. if (ctx && ctx.ut) {
  5141. let node = vnode.children[0].el;
  5142. while (node && node !== vnode.targetAnchor) {
  5143. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  5144. node = node.nextSibling;
  5145. }
  5146. ctx.ut();
  5147. }
  5148. }
  5149. function prepareAnchor(target, vnode, createText, insert) {
  5150. const targetStart = vnode.targetStart = createText("");
  5151. const targetAnchor = vnode.targetAnchor = createText("");
  5152. targetStart[TeleportEndKey] = targetAnchor;
  5153. if (target) {
  5154. insert(targetStart, target);
  5155. insert(targetAnchor, target);
  5156. }
  5157. return targetAnchor;
  5158. }
  5159. let hasLoggedMismatchError = false;
  5160. const logMismatchError = () => {
  5161. if (hasLoggedMismatchError) {
  5162. return;
  5163. }
  5164. console.error("Hydration completed but contains mismatches.");
  5165. hasLoggedMismatchError = true;
  5166. };
  5167. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  5168. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  5169. const getContainerType = (container) => {
  5170. if (isSVGContainer(container)) return "svg";
  5171. if (isMathMLContainer(container)) return "mathml";
  5172. return void 0;
  5173. };
  5174. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  5175. function createHydrationFunctions(rendererInternals) {
  5176. const {
  5177. mt: mountComponent,
  5178. p: patch,
  5179. o: {
  5180. patchProp,
  5181. createText,
  5182. nextSibling,
  5183. parentNode,
  5184. remove,
  5185. insert,
  5186. createComment
  5187. }
  5188. } = rendererInternals;
  5189. const hydrate = (vnode, container) => {
  5190. if (!container.hasChildNodes()) {
  5191. warn$1(
  5192. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  5193. );
  5194. patch(null, vnode, container);
  5195. flushPostFlushCbs();
  5196. container._vnode = vnode;
  5197. return;
  5198. }
  5199. hydrateNode(container.firstChild, vnode, null, null, null);
  5200. flushPostFlushCbs();
  5201. container._vnode = vnode;
  5202. };
  5203. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  5204. optimized = optimized || !!vnode.dynamicChildren;
  5205. const isFragmentStart = isComment(node) && node.data === "[";
  5206. const onMismatch = () => handleMismatch(
  5207. node,
  5208. vnode,
  5209. parentComponent,
  5210. parentSuspense,
  5211. slotScopeIds,
  5212. isFragmentStart
  5213. );
  5214. const { type, ref, shapeFlag, patchFlag } = vnode;
  5215. let domType = node.nodeType;
  5216. vnode.el = node;
  5217. {
  5218. def(node, "__vnode", vnode, true);
  5219. def(node, "__vueParentComponent", parentComponent, true);
  5220. }
  5221. if (patchFlag === -2) {
  5222. optimized = false;
  5223. vnode.dynamicChildren = null;
  5224. }
  5225. let nextNode = null;
  5226. switch (type) {
  5227. case Text:
  5228. if (domType !== 3 /* TEXT */) {
  5229. if (vnode.children === "") {
  5230. insert(vnode.el = createText(""), parentNode(node), node);
  5231. nextNode = node;
  5232. } else {
  5233. nextNode = onMismatch();
  5234. }
  5235. } else {
  5236. if (node.data !== vnode.children) {
  5237. warn$1(
  5238. `Hydration text mismatch in`,
  5239. node.parentNode,
  5240. `
  5241. - rendered on server: ${JSON.stringify(
  5242. node.data
  5243. )}
  5244. - expected on client: ${JSON.stringify(vnode.children)}`
  5245. );
  5246. logMismatchError();
  5247. node.data = vnode.children;
  5248. }
  5249. nextNode = nextSibling(node);
  5250. }
  5251. break;
  5252. case Comment:
  5253. if (isTemplateNode(node)) {
  5254. nextNode = nextSibling(node);
  5255. replaceNode(
  5256. vnode.el = node.content.firstChild,
  5257. node,
  5258. parentComponent
  5259. );
  5260. } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  5261. nextNode = onMismatch();
  5262. } else {
  5263. nextNode = nextSibling(node);
  5264. }
  5265. break;
  5266. case Static:
  5267. if (isFragmentStart) {
  5268. node = nextSibling(node);
  5269. domType = node.nodeType;
  5270. }
  5271. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  5272. nextNode = node;
  5273. const needToAdoptContent = !vnode.children.length;
  5274. for (let i = 0; i < vnode.staticCount; i++) {
  5275. if (needToAdoptContent)
  5276. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  5277. if (i === vnode.staticCount - 1) {
  5278. vnode.anchor = nextNode;
  5279. }
  5280. nextNode = nextSibling(nextNode);
  5281. }
  5282. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  5283. } else {
  5284. onMismatch();
  5285. }
  5286. break;
  5287. case Fragment:
  5288. if (!isFragmentStart) {
  5289. nextNode = onMismatch();
  5290. } else {
  5291. nextNode = hydrateFragment(
  5292. node,
  5293. vnode,
  5294. parentComponent,
  5295. parentSuspense,
  5296. slotScopeIds,
  5297. optimized
  5298. );
  5299. }
  5300. break;
  5301. default:
  5302. if (shapeFlag & 1) {
  5303. if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  5304. nextNode = onMismatch();
  5305. } else {
  5306. nextNode = hydrateElement(
  5307. node,
  5308. vnode,
  5309. parentComponent,
  5310. parentSuspense,
  5311. slotScopeIds,
  5312. optimized
  5313. );
  5314. }
  5315. } else if (shapeFlag & 6) {
  5316. vnode.slotScopeIds = slotScopeIds;
  5317. const container = parentNode(node);
  5318. if (isFragmentStart) {
  5319. nextNode = locateClosingAnchor(node);
  5320. } else if (isComment(node) && node.data === "teleport start") {
  5321. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  5322. } else {
  5323. nextNode = nextSibling(node);
  5324. }
  5325. mountComponent(
  5326. vnode,
  5327. container,
  5328. null,
  5329. parentComponent,
  5330. parentSuspense,
  5331. getContainerType(container),
  5332. optimized
  5333. );
  5334. if (isAsyncWrapper(vnode)) {
  5335. let subTree;
  5336. if (isFragmentStart) {
  5337. subTree = createVNode(Fragment);
  5338. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  5339. } else {
  5340. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  5341. }
  5342. subTree.el = node;
  5343. vnode.component.subTree = subTree;
  5344. }
  5345. } else if (shapeFlag & 64) {
  5346. if (domType !== 8 /* COMMENT */) {
  5347. nextNode = onMismatch();
  5348. } else {
  5349. nextNode = vnode.type.hydrate(
  5350. node,
  5351. vnode,
  5352. parentComponent,
  5353. parentSuspense,
  5354. slotScopeIds,
  5355. optimized,
  5356. rendererInternals,
  5357. hydrateChildren
  5358. );
  5359. }
  5360. } else if (shapeFlag & 128) {
  5361. nextNode = vnode.type.hydrate(
  5362. node,
  5363. vnode,
  5364. parentComponent,
  5365. parentSuspense,
  5366. getContainerType(parentNode(node)),
  5367. slotScopeIds,
  5368. optimized,
  5369. rendererInternals,
  5370. hydrateNode
  5371. );
  5372. } else {
  5373. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  5374. }
  5375. }
  5376. if (ref != null) {
  5377. setRef(ref, null, parentSuspense, vnode);
  5378. }
  5379. return nextNode;
  5380. };
  5381. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  5382. optimized = optimized || !!vnode.dynamicChildren;
  5383. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  5384. const forcePatch = type === "input" || type === "option";
  5385. {
  5386. if (dirs) {
  5387. invokeDirectiveHook(vnode, null, parentComponent, "created");
  5388. }
  5389. let needCallTransitionHooks = false;
  5390. if (isTemplateNode(el)) {
  5391. needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  5392. const content = el.content.firstChild;
  5393. if (needCallTransitionHooks) {
  5394. transition.beforeEnter(content);
  5395. }
  5396. replaceNode(content, el, parentComponent);
  5397. vnode.el = el = content;
  5398. }
  5399. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  5400. !(props && (props.innerHTML || props.textContent))) {
  5401. let next = hydrateChildren(
  5402. el.firstChild,
  5403. vnode,
  5404. el,
  5405. parentComponent,
  5406. parentSuspense,
  5407. slotScopeIds,
  5408. optimized
  5409. );
  5410. let hasWarned = false;
  5411. while (next) {
  5412. if (!hasWarned) {
  5413. warn$1(
  5414. `Hydration children mismatch on`,
  5415. el,
  5416. `
  5417. Server rendered element contains more child nodes than client vdom.`
  5418. );
  5419. hasWarned = true;
  5420. }
  5421. logMismatchError();
  5422. const cur = next;
  5423. next = next.nextSibling;
  5424. remove(cur);
  5425. }
  5426. } else if (shapeFlag & 8) {
  5427. if (el.textContent !== vnode.children) {
  5428. warn$1(
  5429. `Hydration text content mismatch on`,
  5430. el,
  5431. `
  5432. - rendered on server: ${el.textContent}
  5433. - expected on client: ${vnode.children}`
  5434. );
  5435. logMismatchError();
  5436. el.textContent = vnode.children;
  5437. }
  5438. }
  5439. if (props) {
  5440. {
  5441. const isCustomElement = el.tagName.includes("-");
  5442. for (const key in props) {
  5443. if (// #11189 skip if this node has directives that have created hooks
  5444. // as it could have mutated the DOM in any possible way
  5445. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  5446. logMismatchError();
  5447. }
  5448. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  5449. key[0] === "." || isCustomElement) {
  5450. patchProp(el, key, null, props[key], void 0, parentComponent);
  5451. }
  5452. }
  5453. }
  5454. }
  5455. let vnodeHooks;
  5456. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  5457. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  5458. }
  5459. if (dirs) {
  5460. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  5461. }
  5462. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  5463. queueEffectWithSuspense(() => {
  5464. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  5465. needCallTransitionHooks && transition.enter(el);
  5466. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  5467. }, parentSuspense);
  5468. }
  5469. }
  5470. return el.nextSibling;
  5471. };
  5472. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  5473. optimized = optimized || !!parentVNode.dynamicChildren;
  5474. const children = parentVNode.children;
  5475. const l = children.length;
  5476. let hasWarned = false;
  5477. for (let i = 0; i < l; i++) {
  5478. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  5479. const isText = vnode.type === Text;
  5480. if (node) {
  5481. if (isText && !optimized) {
  5482. let next = children[i + 1];
  5483. if (next && (next = normalizeVNode(next)).type === Text) {
  5484. insert(
  5485. createText(
  5486. node.data.slice(vnode.children.length)
  5487. ),
  5488. container,
  5489. nextSibling(node)
  5490. );
  5491. node.data = vnode.children;
  5492. }
  5493. }
  5494. node = hydrateNode(
  5495. node,
  5496. vnode,
  5497. parentComponent,
  5498. parentSuspense,
  5499. slotScopeIds,
  5500. optimized
  5501. );
  5502. } else if (isText && !vnode.children) {
  5503. insert(vnode.el = createText(""), container);
  5504. } else {
  5505. if (!hasWarned) {
  5506. warn$1(
  5507. `Hydration children mismatch on`,
  5508. container,
  5509. `
  5510. Server rendered element contains fewer child nodes than client vdom.`
  5511. );
  5512. hasWarned = true;
  5513. }
  5514. logMismatchError();
  5515. patch(
  5516. null,
  5517. vnode,
  5518. container,
  5519. null,
  5520. parentComponent,
  5521. parentSuspense,
  5522. getContainerType(container),
  5523. slotScopeIds
  5524. );
  5525. }
  5526. }
  5527. return node;
  5528. };
  5529. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  5530. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  5531. if (fragmentSlotScopeIds) {
  5532. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  5533. }
  5534. const container = parentNode(node);
  5535. const next = hydrateChildren(
  5536. nextSibling(node),
  5537. vnode,
  5538. container,
  5539. parentComponent,
  5540. parentSuspense,
  5541. slotScopeIds,
  5542. optimized
  5543. );
  5544. if (next && isComment(next) && next.data === "]") {
  5545. return nextSibling(vnode.anchor = next);
  5546. } else {
  5547. logMismatchError();
  5548. insert(vnode.anchor = createComment(`]`), container, next);
  5549. return next;
  5550. }
  5551. };
  5552. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  5553. warn$1(
  5554. `Hydration node mismatch:
  5555. - rendered on server:`,
  5556. node,
  5557. node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  5558. `
  5559. - expected on client:`,
  5560. vnode.type
  5561. );
  5562. logMismatchError();
  5563. vnode.el = null;
  5564. if (isFragment) {
  5565. const end = locateClosingAnchor(node);
  5566. while (true) {
  5567. const next2 = nextSibling(node);
  5568. if (next2 && next2 !== end) {
  5569. remove(next2);
  5570. } else {
  5571. break;
  5572. }
  5573. }
  5574. }
  5575. const next = nextSibling(node);
  5576. const container = parentNode(node);
  5577. remove(node);
  5578. patch(
  5579. null,
  5580. vnode,
  5581. container,
  5582. next,
  5583. parentComponent,
  5584. parentSuspense,
  5585. getContainerType(container),
  5586. slotScopeIds
  5587. );
  5588. return next;
  5589. };
  5590. const locateClosingAnchor = (node, open = "[", close = "]") => {
  5591. let match = 0;
  5592. while (node) {
  5593. node = nextSibling(node);
  5594. if (node && isComment(node)) {
  5595. if (node.data === open) match++;
  5596. if (node.data === close) {
  5597. if (match === 0) {
  5598. return nextSibling(node);
  5599. } else {
  5600. match--;
  5601. }
  5602. }
  5603. }
  5604. }
  5605. return node;
  5606. };
  5607. const replaceNode = (newNode, oldNode, parentComponent) => {
  5608. const parentNode2 = oldNode.parentNode;
  5609. if (parentNode2) {
  5610. parentNode2.replaceChild(newNode, oldNode);
  5611. }
  5612. let parent = parentComponent;
  5613. while (parent) {
  5614. if (parent.vnode.el === oldNode) {
  5615. parent.vnode.el = parent.subTree.el = newNode;
  5616. }
  5617. parent = parent.parent;
  5618. }
  5619. };
  5620. const isTemplateNode = (node) => {
  5621. return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
  5622. };
  5623. return [hydrate, hydrateNode];
  5624. }
  5625. function propHasMismatch(el, key, clientValue, vnode, instance) {
  5626. let mismatchType;
  5627. let mismatchKey;
  5628. let actual;
  5629. let expected;
  5630. if (key === "class") {
  5631. actual = el.getAttribute("class");
  5632. expected = normalizeClass(clientValue);
  5633. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  5634. mismatchType = mismatchKey = `class`;
  5635. }
  5636. } else if (key === "style") {
  5637. actual = el.getAttribute("style") || "";
  5638. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  5639. const actualMap = toStyleMap(actual);
  5640. const expectedMap = toStyleMap(expected);
  5641. if (vnode.dirs) {
  5642. for (const { dir, value } of vnode.dirs) {
  5643. if (dir.name === "show" && !value) {
  5644. expectedMap.set("display", "none");
  5645. }
  5646. }
  5647. }
  5648. if (instance) {
  5649. resolveCssVars(instance, vnode, expectedMap);
  5650. }
  5651. if (!isMapEqual(actualMap, expectedMap)) {
  5652. mismatchType = mismatchKey = "style";
  5653. }
  5654. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  5655. if (isBooleanAttr(key)) {
  5656. actual = el.hasAttribute(key);
  5657. expected = includeBooleanAttr(clientValue);
  5658. } else if (clientValue == null) {
  5659. actual = el.hasAttribute(key);
  5660. expected = false;
  5661. } else {
  5662. if (el.hasAttribute(key)) {
  5663. actual = el.getAttribute(key);
  5664. } else if (key === "value" && el.tagName === "TEXTAREA") {
  5665. actual = el.value;
  5666. } else {
  5667. actual = false;
  5668. }
  5669. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  5670. }
  5671. if (actual !== expected) {
  5672. mismatchType = `attribute`;
  5673. mismatchKey = key;
  5674. }
  5675. }
  5676. if (mismatchType) {
  5677. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  5678. const preSegment = `Hydration ${mismatchType} mismatch on`;
  5679. const postSegment = `
  5680. - rendered on server: ${format(actual)}
  5681. - expected on client: ${format(expected)}
  5682. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  5683. You should fix the source of the mismatch.`;
  5684. {
  5685. warn$1(preSegment, el, postSegment);
  5686. }
  5687. return true;
  5688. }
  5689. return false;
  5690. }
  5691. function toClassSet(str) {
  5692. return new Set(str.trim().split(/\s+/));
  5693. }
  5694. function isSetEqual(a, b) {
  5695. if (a.size !== b.size) {
  5696. return false;
  5697. }
  5698. for (const s of a) {
  5699. if (!b.has(s)) {
  5700. return false;
  5701. }
  5702. }
  5703. return true;
  5704. }
  5705. function toStyleMap(str) {
  5706. const styleMap = /* @__PURE__ */ new Map();
  5707. for (const item of str.split(";")) {
  5708. let [key, value] = item.split(":");
  5709. key = key.trim();
  5710. value = value && value.trim();
  5711. if (key && value) {
  5712. styleMap.set(key, value);
  5713. }
  5714. }
  5715. return styleMap;
  5716. }
  5717. function isMapEqual(a, b) {
  5718. if (a.size !== b.size) {
  5719. return false;
  5720. }
  5721. for (const [key, value] of a) {
  5722. if (value !== b.get(key)) {
  5723. return false;
  5724. }
  5725. }
  5726. return true;
  5727. }
  5728. function resolveCssVars(instance, vnode, expectedMap) {
  5729. const root = instance.subTree;
  5730. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  5731. const cssVars = instance.getCssVars();
  5732. for (const key in cssVars) {
  5733. expectedMap.set(`--${key}`, String(cssVars[key]));
  5734. }
  5735. }
  5736. if (vnode === root && instance.parent) {
  5737. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  5738. }
  5739. }
  5740. let supported;
  5741. let perf;
  5742. function startMeasure(instance, type) {
  5743. if (instance.appContext.config.performance && isSupported()) {
  5744. perf.mark(`vue-${type}-${instance.uid}`);
  5745. }
  5746. {
  5747. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  5748. }
  5749. }
  5750. function endMeasure(instance, type) {
  5751. if (instance.appContext.config.performance && isSupported()) {
  5752. const startTag = `vue-${type}-${instance.uid}`;
  5753. const endTag = startTag + `:end`;
  5754. perf.mark(endTag);
  5755. perf.measure(
  5756. `<${formatComponentName(instance, instance.type)}> ${type}`,
  5757. startTag,
  5758. endTag
  5759. );
  5760. perf.clearMarks(startTag);
  5761. perf.clearMarks(endTag);
  5762. }
  5763. {
  5764. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  5765. }
  5766. }
  5767. function isSupported() {
  5768. if (supported !== void 0) {
  5769. return supported;
  5770. }
  5771. if (typeof window !== "undefined" && window.performance) {
  5772. supported = true;
  5773. perf = window.performance;
  5774. } else {
  5775. supported = false;
  5776. }
  5777. return supported;
  5778. }
  5779. const queuePostRenderEffect = queueEffectWithSuspense ;
  5780. function createRenderer(options) {
  5781. return baseCreateRenderer(options);
  5782. }
  5783. function createHydrationRenderer(options) {
  5784. return baseCreateRenderer(options, createHydrationFunctions);
  5785. }
  5786. function baseCreateRenderer(options, createHydrationFns) {
  5787. const target = getGlobalThis();
  5788. target.__VUE__ = true;
  5789. {
  5790. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  5791. }
  5792. const {
  5793. insert: hostInsert,
  5794. remove: hostRemove,
  5795. patchProp: hostPatchProp,
  5796. createElement: hostCreateElement,
  5797. createText: hostCreateText,
  5798. createComment: hostCreateComment,
  5799. setText: hostSetText,
  5800. setElementText: hostSetElementText,
  5801. parentNode: hostParentNode,
  5802. nextSibling: hostNextSibling,
  5803. setScopeId: hostSetScopeId = NOOP,
  5804. insertStaticContent: hostInsertStaticContent
  5805. } = options;
  5806. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  5807. if (n1 === n2) {
  5808. return;
  5809. }
  5810. if (n1 && !isSameVNodeType(n1, n2)) {
  5811. anchor = getNextHostNode(n1);
  5812. unmount(n1, parentComponent, parentSuspense, true);
  5813. n1 = null;
  5814. }
  5815. if (n2.patchFlag === -2) {
  5816. optimized = false;
  5817. n2.dynamicChildren = null;
  5818. }
  5819. const { type, ref, shapeFlag } = n2;
  5820. switch (type) {
  5821. case Text:
  5822. processText(n1, n2, container, anchor);
  5823. break;
  5824. case Comment:
  5825. processCommentNode(n1, n2, container, anchor);
  5826. break;
  5827. case Static:
  5828. if (n1 == null) {
  5829. mountStaticNode(n2, container, anchor, namespace);
  5830. } else {
  5831. patchStaticNode(n1, n2, container, namespace);
  5832. }
  5833. break;
  5834. case Fragment:
  5835. processFragment(
  5836. n1,
  5837. n2,
  5838. container,
  5839. anchor,
  5840. parentComponent,
  5841. parentSuspense,
  5842. namespace,
  5843. slotScopeIds,
  5844. optimized
  5845. );
  5846. break;
  5847. default:
  5848. if (shapeFlag & 1) {
  5849. processElement(
  5850. n1,
  5851. n2,
  5852. container,
  5853. anchor,
  5854. parentComponent,
  5855. parentSuspense,
  5856. namespace,
  5857. slotScopeIds,
  5858. optimized
  5859. );
  5860. } else if (shapeFlag & 6) {
  5861. processComponent(
  5862. n1,
  5863. n2,
  5864. container,
  5865. anchor,
  5866. parentComponent,
  5867. parentSuspense,
  5868. namespace,
  5869. slotScopeIds,
  5870. optimized
  5871. );
  5872. } else if (shapeFlag & 64) {
  5873. type.process(
  5874. n1,
  5875. n2,
  5876. container,
  5877. anchor,
  5878. parentComponent,
  5879. parentSuspense,
  5880. namespace,
  5881. slotScopeIds,
  5882. optimized,
  5883. internals
  5884. );
  5885. } else if (shapeFlag & 128) {
  5886. type.process(
  5887. n1,
  5888. n2,
  5889. container,
  5890. anchor,
  5891. parentComponent,
  5892. parentSuspense,
  5893. namespace,
  5894. slotScopeIds,
  5895. optimized,
  5896. internals
  5897. );
  5898. } else {
  5899. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  5900. }
  5901. }
  5902. if (ref != null && parentComponent) {
  5903. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  5904. }
  5905. };
  5906. const processText = (n1, n2, container, anchor) => {
  5907. if (n1 == null) {
  5908. hostInsert(
  5909. n2.el = hostCreateText(n2.children),
  5910. container,
  5911. anchor
  5912. );
  5913. } else {
  5914. const el = n2.el = n1.el;
  5915. if (n2.children !== n1.children) {
  5916. hostSetText(el, n2.children);
  5917. }
  5918. }
  5919. };
  5920. const processCommentNode = (n1, n2, container, anchor) => {
  5921. if (n1 == null) {
  5922. hostInsert(
  5923. n2.el = hostCreateComment(n2.children || ""),
  5924. container,
  5925. anchor
  5926. );
  5927. } else {
  5928. n2.el = n1.el;
  5929. }
  5930. };
  5931. const mountStaticNode = (n2, container, anchor, namespace) => {
  5932. [n2.el, n2.anchor] = hostInsertStaticContent(
  5933. n2.children,
  5934. container,
  5935. anchor,
  5936. namespace,
  5937. n2.el,
  5938. n2.anchor
  5939. );
  5940. };
  5941. const patchStaticNode = (n1, n2, container, namespace) => {
  5942. if (n2.children !== n1.children) {
  5943. const anchor = hostNextSibling(n1.anchor);
  5944. removeStaticNode(n1);
  5945. [n2.el, n2.anchor] = hostInsertStaticContent(
  5946. n2.children,
  5947. container,
  5948. anchor,
  5949. namespace
  5950. );
  5951. } else {
  5952. n2.el = n1.el;
  5953. n2.anchor = n1.anchor;
  5954. }
  5955. };
  5956. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  5957. let next;
  5958. while (el && el !== anchor) {
  5959. next = hostNextSibling(el);
  5960. hostInsert(el, container, nextSibling);
  5961. el = next;
  5962. }
  5963. hostInsert(anchor, container, nextSibling);
  5964. };
  5965. const removeStaticNode = ({ el, anchor }) => {
  5966. let next;
  5967. while (el && el !== anchor) {
  5968. next = hostNextSibling(el);
  5969. hostRemove(el);
  5970. el = next;
  5971. }
  5972. hostRemove(anchor);
  5973. };
  5974. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  5975. if (n2.type === "svg") {
  5976. namespace = "svg";
  5977. } else if (n2.type === "math") {
  5978. namespace = "mathml";
  5979. }
  5980. if (n1 == null) {
  5981. mountElement(
  5982. n2,
  5983. container,
  5984. anchor,
  5985. parentComponent,
  5986. parentSuspense,
  5987. namespace,
  5988. slotScopeIds,
  5989. optimized
  5990. );
  5991. } else {
  5992. patchElement(
  5993. n1,
  5994. n2,
  5995. parentComponent,
  5996. parentSuspense,
  5997. namespace,
  5998. slotScopeIds,
  5999. optimized
  6000. );
  6001. }
  6002. };
  6003. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6004. let el;
  6005. let vnodeHook;
  6006. const { props, shapeFlag, transition, dirs } = vnode;
  6007. el = vnode.el = hostCreateElement(
  6008. vnode.type,
  6009. namespace,
  6010. props && props.is,
  6011. props
  6012. );
  6013. if (shapeFlag & 8) {
  6014. hostSetElementText(el, vnode.children);
  6015. } else if (shapeFlag & 16) {
  6016. mountChildren(
  6017. vnode.children,
  6018. el,
  6019. null,
  6020. parentComponent,
  6021. parentSuspense,
  6022. resolveChildrenNamespace(vnode, namespace),
  6023. slotScopeIds,
  6024. optimized
  6025. );
  6026. }
  6027. if (dirs) {
  6028. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6029. }
  6030. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6031. if (props) {
  6032. for (const key in props) {
  6033. if (key !== "value" && !isReservedProp(key)) {
  6034. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  6035. }
  6036. }
  6037. if ("value" in props) {
  6038. hostPatchProp(el, "value", null, props.value, namespace);
  6039. }
  6040. if (vnodeHook = props.onVnodeBeforeMount) {
  6041. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6042. }
  6043. }
  6044. {
  6045. def(el, "__vnode", vnode, true);
  6046. def(el, "__vueParentComponent", parentComponent, true);
  6047. }
  6048. if (dirs) {
  6049. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6050. }
  6051. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  6052. if (needCallTransitionHooks) {
  6053. transition.beforeEnter(el);
  6054. }
  6055. hostInsert(el, container, anchor);
  6056. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6057. queuePostRenderEffect(() => {
  6058. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6059. needCallTransitionHooks && transition.enter(el);
  6060. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6061. }, parentSuspense);
  6062. }
  6063. };
  6064. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6065. if (scopeId) {
  6066. hostSetScopeId(el, scopeId);
  6067. }
  6068. if (slotScopeIds) {
  6069. for (let i = 0; i < slotScopeIds.length; i++) {
  6070. hostSetScopeId(el, slotScopeIds[i]);
  6071. }
  6072. }
  6073. if (parentComponent) {
  6074. let subTree = parentComponent.subTree;
  6075. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  6076. subTree = filterSingleRoot(subTree.children) || subTree;
  6077. }
  6078. if (vnode === subTree) {
  6079. const parentVNode = parentComponent.vnode;
  6080. setScopeId(
  6081. el,
  6082. parentVNode,
  6083. parentVNode.scopeId,
  6084. parentVNode.slotScopeIds,
  6085. parentComponent.parent
  6086. );
  6087. }
  6088. }
  6089. };
  6090. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  6091. for (let i = start; i < children.length; i++) {
  6092. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  6093. patch(
  6094. null,
  6095. child,
  6096. container,
  6097. anchor,
  6098. parentComponent,
  6099. parentSuspense,
  6100. namespace,
  6101. slotScopeIds,
  6102. optimized
  6103. );
  6104. }
  6105. };
  6106. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6107. const el = n2.el = n1.el;
  6108. {
  6109. el.__vnode = n2;
  6110. }
  6111. let { patchFlag, dynamicChildren, dirs } = n2;
  6112. patchFlag |= n1.patchFlag & 16;
  6113. const oldProps = n1.props || EMPTY_OBJ;
  6114. const newProps = n2.props || EMPTY_OBJ;
  6115. let vnodeHook;
  6116. parentComponent && toggleRecurse(parentComponent, false);
  6117. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  6118. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6119. }
  6120. if (dirs) {
  6121. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  6122. }
  6123. parentComponent && toggleRecurse(parentComponent, true);
  6124. if (isHmrUpdating) {
  6125. patchFlag = 0;
  6126. optimized = false;
  6127. dynamicChildren = null;
  6128. }
  6129. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  6130. hostSetElementText(el, "");
  6131. }
  6132. if (dynamicChildren) {
  6133. patchBlockChildren(
  6134. n1.dynamicChildren,
  6135. dynamicChildren,
  6136. el,
  6137. parentComponent,
  6138. parentSuspense,
  6139. resolveChildrenNamespace(n2, namespace),
  6140. slotScopeIds
  6141. );
  6142. {
  6143. traverseStaticChildren(n1, n2);
  6144. }
  6145. } else if (!optimized) {
  6146. patchChildren(
  6147. n1,
  6148. n2,
  6149. el,
  6150. null,
  6151. parentComponent,
  6152. parentSuspense,
  6153. resolveChildrenNamespace(n2, namespace),
  6154. slotScopeIds,
  6155. false
  6156. );
  6157. }
  6158. if (patchFlag > 0) {
  6159. if (patchFlag & 16) {
  6160. patchProps(el, oldProps, newProps, parentComponent, namespace);
  6161. } else {
  6162. if (patchFlag & 2) {
  6163. if (oldProps.class !== newProps.class) {
  6164. hostPatchProp(el, "class", null, newProps.class, namespace);
  6165. }
  6166. }
  6167. if (patchFlag & 4) {
  6168. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  6169. }
  6170. if (patchFlag & 8) {
  6171. const propsToUpdate = n2.dynamicProps;
  6172. for (let i = 0; i < propsToUpdate.length; i++) {
  6173. const key = propsToUpdate[i];
  6174. const prev = oldProps[key];
  6175. const next = newProps[key];
  6176. if (next !== prev || key === "value") {
  6177. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  6178. }
  6179. }
  6180. }
  6181. }
  6182. if (patchFlag & 1) {
  6183. if (n1.children !== n2.children) {
  6184. hostSetElementText(el, n2.children);
  6185. }
  6186. }
  6187. } else if (!optimized && dynamicChildren == null) {
  6188. patchProps(el, oldProps, newProps, parentComponent, namespace);
  6189. }
  6190. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  6191. queuePostRenderEffect(() => {
  6192. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6193. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  6194. }, parentSuspense);
  6195. }
  6196. };
  6197. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  6198. for (let i = 0; i < newChildren.length; i++) {
  6199. const oldVNode = oldChildren[i];
  6200. const newVNode = newChildren[i];
  6201. const container = (
  6202. // oldVNode may be an errored async setup() component inside Suspense
  6203. // which will not have a mounted element
  6204. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  6205. // of the Fragment itself so it can move its children.
  6206. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  6207. // which also requires the correct parent container
  6208. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  6209. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  6210. // In other cases, the parent container is not actually used so we
  6211. // just pass the block element here to avoid a DOM parentNode call.
  6212. fallbackContainer
  6213. )
  6214. );
  6215. patch(
  6216. oldVNode,
  6217. newVNode,
  6218. container,
  6219. null,
  6220. parentComponent,
  6221. parentSuspense,
  6222. namespace,
  6223. slotScopeIds,
  6224. true
  6225. );
  6226. }
  6227. };
  6228. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  6229. if (oldProps !== newProps) {
  6230. if (oldProps !== EMPTY_OBJ) {
  6231. for (const key in oldProps) {
  6232. if (!isReservedProp(key) && !(key in newProps)) {
  6233. hostPatchProp(
  6234. el,
  6235. key,
  6236. oldProps[key],
  6237. null,
  6238. namespace,
  6239. parentComponent
  6240. );
  6241. }
  6242. }
  6243. }
  6244. for (const key in newProps) {
  6245. if (isReservedProp(key)) continue;
  6246. const next = newProps[key];
  6247. const prev = oldProps[key];
  6248. if (next !== prev && key !== "value") {
  6249. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  6250. }
  6251. }
  6252. if ("value" in newProps) {
  6253. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  6254. }
  6255. }
  6256. };
  6257. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6258. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  6259. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  6260. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  6261. if (
  6262. // #5523 dev root fragment may inherit directives
  6263. isHmrUpdating || patchFlag & 2048
  6264. ) {
  6265. patchFlag = 0;
  6266. optimized = false;
  6267. dynamicChildren = null;
  6268. }
  6269. if (fragmentSlotScopeIds) {
  6270. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6271. }
  6272. if (n1 == null) {
  6273. hostInsert(fragmentStartAnchor, container, anchor);
  6274. hostInsert(fragmentEndAnchor, container, anchor);
  6275. mountChildren(
  6276. // #10007
  6277. // such fragment like `<></>` will be compiled into
  6278. // a fragment which doesn't have a children.
  6279. // In this case fallback to an empty array
  6280. n2.children || [],
  6281. container,
  6282. fragmentEndAnchor,
  6283. parentComponent,
  6284. parentSuspense,
  6285. namespace,
  6286. slotScopeIds,
  6287. optimized
  6288. );
  6289. } else {
  6290. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  6291. // of renderSlot() with no valid children
  6292. n1.dynamicChildren) {
  6293. patchBlockChildren(
  6294. n1.dynamicChildren,
  6295. dynamicChildren,
  6296. container,
  6297. parentComponent,
  6298. parentSuspense,
  6299. namespace,
  6300. slotScopeIds
  6301. );
  6302. {
  6303. traverseStaticChildren(n1, n2);
  6304. }
  6305. } else {
  6306. patchChildren(
  6307. n1,
  6308. n2,
  6309. container,
  6310. fragmentEndAnchor,
  6311. parentComponent,
  6312. parentSuspense,
  6313. namespace,
  6314. slotScopeIds,
  6315. optimized
  6316. );
  6317. }
  6318. }
  6319. };
  6320. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6321. n2.slotScopeIds = slotScopeIds;
  6322. if (n1 == null) {
  6323. if (n2.shapeFlag & 512) {
  6324. parentComponent.ctx.activate(
  6325. n2,
  6326. container,
  6327. anchor,
  6328. namespace,
  6329. optimized
  6330. );
  6331. } else {
  6332. mountComponent(
  6333. n2,
  6334. container,
  6335. anchor,
  6336. parentComponent,
  6337. parentSuspense,
  6338. namespace,
  6339. optimized
  6340. );
  6341. }
  6342. } else {
  6343. updateComponent(n1, n2, optimized);
  6344. }
  6345. };
  6346. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  6347. const instance = (initialVNode.component = createComponentInstance(
  6348. initialVNode,
  6349. parentComponent,
  6350. parentSuspense
  6351. ));
  6352. if (instance.type.__hmrId) {
  6353. registerHMR(instance);
  6354. }
  6355. {
  6356. pushWarningContext(initialVNode);
  6357. startMeasure(instance, `mount`);
  6358. }
  6359. if (isKeepAlive(initialVNode)) {
  6360. instance.ctx.renderer = internals;
  6361. }
  6362. {
  6363. {
  6364. startMeasure(instance, `init`);
  6365. }
  6366. setupComponent(instance, false, optimized);
  6367. {
  6368. endMeasure(instance, `init`);
  6369. }
  6370. }
  6371. if (instance.asyncDep) {
  6372. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  6373. if (!initialVNode.el) {
  6374. const placeholder = instance.subTree = createVNode(Comment);
  6375. processCommentNode(null, placeholder, container, anchor);
  6376. }
  6377. } else {
  6378. setupRenderEffect(
  6379. instance,
  6380. initialVNode,
  6381. container,
  6382. anchor,
  6383. parentSuspense,
  6384. namespace,
  6385. optimized
  6386. );
  6387. }
  6388. {
  6389. popWarningContext();
  6390. endMeasure(instance, `mount`);
  6391. }
  6392. };
  6393. const updateComponent = (n1, n2, optimized) => {
  6394. const instance = n2.component = n1.component;
  6395. if (shouldUpdateComponent(n1, n2, optimized)) {
  6396. if (instance.asyncDep && !instance.asyncResolved) {
  6397. {
  6398. pushWarningContext(n2);
  6399. }
  6400. updateComponentPreRender(instance, n2, optimized);
  6401. {
  6402. popWarningContext();
  6403. }
  6404. return;
  6405. } else {
  6406. instance.next = n2;
  6407. invalidateJob(instance.update);
  6408. instance.effect.dirty = true;
  6409. instance.update();
  6410. }
  6411. } else {
  6412. n2.el = n1.el;
  6413. instance.vnode = n2;
  6414. }
  6415. };
  6416. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  6417. const componentUpdateFn = () => {
  6418. if (!instance.isMounted) {
  6419. let vnodeHook;
  6420. const { el, props } = initialVNode;
  6421. const { bm, m, parent } = instance;
  6422. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  6423. toggleRecurse(instance, false);
  6424. if (bm) {
  6425. invokeArrayFns(bm);
  6426. }
  6427. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  6428. invokeVNodeHook(vnodeHook, parent, initialVNode);
  6429. }
  6430. toggleRecurse(instance, true);
  6431. if (el && hydrateNode) {
  6432. const hydrateSubTree = () => {
  6433. {
  6434. startMeasure(instance, `render`);
  6435. }
  6436. instance.subTree = renderComponentRoot(instance);
  6437. {
  6438. endMeasure(instance, `render`);
  6439. }
  6440. {
  6441. startMeasure(instance, `hydrate`);
  6442. }
  6443. hydrateNode(
  6444. el,
  6445. instance.subTree,
  6446. instance,
  6447. parentSuspense,
  6448. null
  6449. );
  6450. {
  6451. endMeasure(instance, `hydrate`);
  6452. }
  6453. };
  6454. if (isAsyncWrapperVNode) {
  6455. initialVNode.type.__asyncLoader().then(
  6456. // note: we are moving the render call into an async callback,
  6457. // which means it won't track dependencies - but it's ok because
  6458. // a server-rendered async wrapper is already in resolved state
  6459. // and it will never need to change.
  6460. () => !instance.isUnmounted && hydrateSubTree()
  6461. );
  6462. } else {
  6463. hydrateSubTree();
  6464. }
  6465. } else {
  6466. {
  6467. startMeasure(instance, `render`);
  6468. }
  6469. const subTree = instance.subTree = renderComponentRoot(instance);
  6470. {
  6471. endMeasure(instance, `render`);
  6472. }
  6473. {
  6474. startMeasure(instance, `patch`);
  6475. }
  6476. patch(
  6477. null,
  6478. subTree,
  6479. container,
  6480. anchor,
  6481. instance,
  6482. parentSuspense,
  6483. namespace
  6484. );
  6485. {
  6486. endMeasure(instance, `patch`);
  6487. }
  6488. initialVNode.el = subTree.el;
  6489. }
  6490. if (m) {
  6491. queuePostRenderEffect(m, parentSuspense);
  6492. }
  6493. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  6494. const scopedInitialVNode = initialVNode;
  6495. queuePostRenderEffect(
  6496. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  6497. parentSuspense
  6498. );
  6499. }
  6500. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  6501. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  6502. }
  6503. instance.isMounted = true;
  6504. {
  6505. devtoolsComponentAdded(instance);
  6506. }
  6507. initialVNode = container = anchor = null;
  6508. } else {
  6509. let { next, bu, u, parent, vnode } = instance;
  6510. {
  6511. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  6512. if (nonHydratedAsyncRoot) {
  6513. if (next) {
  6514. next.el = vnode.el;
  6515. updateComponentPreRender(instance, next, optimized);
  6516. }
  6517. nonHydratedAsyncRoot.asyncDep.then(() => {
  6518. if (!instance.isUnmounted) {
  6519. componentUpdateFn();
  6520. }
  6521. });
  6522. return;
  6523. }
  6524. }
  6525. let originNext = next;
  6526. let vnodeHook;
  6527. {
  6528. pushWarningContext(next || instance.vnode);
  6529. }
  6530. toggleRecurse(instance, false);
  6531. if (next) {
  6532. next.el = vnode.el;
  6533. updateComponentPreRender(instance, next, optimized);
  6534. } else {
  6535. next = vnode;
  6536. }
  6537. if (bu) {
  6538. invokeArrayFns(bu);
  6539. }
  6540. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  6541. invokeVNodeHook(vnodeHook, parent, next, vnode);
  6542. }
  6543. toggleRecurse(instance, true);
  6544. {
  6545. startMeasure(instance, `render`);
  6546. }
  6547. const nextTree = renderComponentRoot(instance);
  6548. {
  6549. endMeasure(instance, `render`);
  6550. }
  6551. const prevTree = instance.subTree;
  6552. instance.subTree = nextTree;
  6553. {
  6554. startMeasure(instance, `patch`);
  6555. }
  6556. patch(
  6557. prevTree,
  6558. nextTree,
  6559. // parent may have changed if it's in a teleport
  6560. hostParentNode(prevTree.el),
  6561. // anchor may have changed if it's in a fragment
  6562. getNextHostNode(prevTree),
  6563. instance,
  6564. parentSuspense,
  6565. namespace
  6566. );
  6567. {
  6568. endMeasure(instance, `patch`);
  6569. }
  6570. next.el = nextTree.el;
  6571. if (originNext === null) {
  6572. updateHOCHostEl(instance, nextTree.el);
  6573. }
  6574. if (u) {
  6575. queuePostRenderEffect(u, parentSuspense);
  6576. }
  6577. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  6578. queuePostRenderEffect(
  6579. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  6580. parentSuspense
  6581. );
  6582. }
  6583. {
  6584. devtoolsComponentUpdated(instance);
  6585. }
  6586. {
  6587. popWarningContext();
  6588. }
  6589. }
  6590. };
  6591. const effect = instance.effect = new ReactiveEffect(
  6592. componentUpdateFn,
  6593. NOOP,
  6594. () => queueJob(update),
  6595. instance.scope
  6596. // track it in component's effect scope
  6597. );
  6598. const update = instance.update = () => {
  6599. if (effect.dirty) {
  6600. effect.run();
  6601. }
  6602. };
  6603. update.i = instance;
  6604. update.id = instance.uid;
  6605. toggleRecurse(instance, true);
  6606. {
  6607. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  6608. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  6609. }
  6610. update();
  6611. };
  6612. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  6613. nextVNode.component = instance;
  6614. const prevProps = instance.vnode.props;
  6615. instance.vnode = nextVNode;
  6616. instance.next = null;
  6617. updateProps(instance, nextVNode.props, prevProps, optimized);
  6618. updateSlots(instance, nextVNode.children, optimized);
  6619. pauseTracking();
  6620. flushPreFlushCbs(instance);
  6621. resetTracking();
  6622. };
  6623. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  6624. const c1 = n1 && n1.children;
  6625. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  6626. const c2 = n2.children;
  6627. const { patchFlag, shapeFlag } = n2;
  6628. if (patchFlag > 0) {
  6629. if (patchFlag & 128) {
  6630. patchKeyedChildren(
  6631. c1,
  6632. c2,
  6633. container,
  6634. anchor,
  6635. parentComponent,
  6636. parentSuspense,
  6637. namespace,
  6638. slotScopeIds,
  6639. optimized
  6640. );
  6641. return;
  6642. } else if (patchFlag & 256) {
  6643. patchUnkeyedChildren(
  6644. c1,
  6645. c2,
  6646. container,
  6647. anchor,
  6648. parentComponent,
  6649. parentSuspense,
  6650. namespace,
  6651. slotScopeIds,
  6652. optimized
  6653. );
  6654. return;
  6655. }
  6656. }
  6657. if (shapeFlag & 8) {
  6658. if (prevShapeFlag & 16) {
  6659. unmountChildren(c1, parentComponent, parentSuspense);
  6660. }
  6661. if (c2 !== c1) {
  6662. hostSetElementText(container, c2);
  6663. }
  6664. } else {
  6665. if (prevShapeFlag & 16) {
  6666. if (shapeFlag & 16) {
  6667. patchKeyedChildren(
  6668. c1,
  6669. c2,
  6670. container,
  6671. anchor,
  6672. parentComponent,
  6673. parentSuspense,
  6674. namespace,
  6675. slotScopeIds,
  6676. optimized
  6677. );
  6678. } else {
  6679. unmountChildren(c1, parentComponent, parentSuspense, true);
  6680. }
  6681. } else {
  6682. if (prevShapeFlag & 8) {
  6683. hostSetElementText(container, "");
  6684. }
  6685. if (shapeFlag & 16) {
  6686. mountChildren(
  6687. c2,
  6688. container,
  6689. anchor,
  6690. parentComponent,
  6691. parentSuspense,
  6692. namespace,
  6693. slotScopeIds,
  6694. optimized
  6695. );
  6696. }
  6697. }
  6698. }
  6699. };
  6700. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6701. c1 = c1 || EMPTY_ARR;
  6702. c2 = c2 || EMPTY_ARR;
  6703. const oldLength = c1.length;
  6704. const newLength = c2.length;
  6705. const commonLength = Math.min(oldLength, newLength);
  6706. let i;
  6707. for (i = 0; i < commonLength; i++) {
  6708. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  6709. patch(
  6710. c1[i],
  6711. nextChild,
  6712. container,
  6713. null,
  6714. parentComponent,
  6715. parentSuspense,
  6716. namespace,
  6717. slotScopeIds,
  6718. optimized
  6719. );
  6720. }
  6721. if (oldLength > newLength) {
  6722. unmountChildren(
  6723. c1,
  6724. parentComponent,
  6725. parentSuspense,
  6726. true,
  6727. false,
  6728. commonLength
  6729. );
  6730. } else {
  6731. mountChildren(
  6732. c2,
  6733. container,
  6734. anchor,
  6735. parentComponent,
  6736. parentSuspense,
  6737. namespace,
  6738. slotScopeIds,
  6739. optimized,
  6740. commonLength
  6741. );
  6742. }
  6743. };
  6744. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6745. let i = 0;
  6746. const l2 = c2.length;
  6747. let e1 = c1.length - 1;
  6748. let e2 = l2 - 1;
  6749. while (i <= e1 && i <= e2) {
  6750. const n1 = c1[i];
  6751. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  6752. if (isSameVNodeType(n1, n2)) {
  6753. patch(
  6754. n1,
  6755. n2,
  6756. container,
  6757. null,
  6758. parentComponent,
  6759. parentSuspense,
  6760. namespace,
  6761. slotScopeIds,
  6762. optimized
  6763. );
  6764. } else {
  6765. break;
  6766. }
  6767. i++;
  6768. }
  6769. while (i <= e1 && i <= e2) {
  6770. const n1 = c1[e1];
  6771. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  6772. if (isSameVNodeType(n1, n2)) {
  6773. patch(
  6774. n1,
  6775. n2,
  6776. container,
  6777. null,
  6778. parentComponent,
  6779. parentSuspense,
  6780. namespace,
  6781. slotScopeIds,
  6782. optimized
  6783. );
  6784. } else {
  6785. break;
  6786. }
  6787. e1--;
  6788. e2--;
  6789. }
  6790. if (i > e1) {
  6791. if (i <= e2) {
  6792. const nextPos = e2 + 1;
  6793. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  6794. while (i <= e2) {
  6795. patch(
  6796. null,
  6797. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  6798. container,
  6799. anchor,
  6800. parentComponent,
  6801. parentSuspense,
  6802. namespace,
  6803. slotScopeIds,
  6804. optimized
  6805. );
  6806. i++;
  6807. }
  6808. }
  6809. } else if (i > e2) {
  6810. while (i <= e1) {
  6811. unmount(c1[i], parentComponent, parentSuspense, true);
  6812. i++;
  6813. }
  6814. } else {
  6815. const s1 = i;
  6816. const s2 = i;
  6817. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  6818. for (i = s2; i <= e2; i++) {
  6819. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  6820. if (nextChild.key != null) {
  6821. if (keyToNewIndexMap.has(nextChild.key)) {
  6822. warn$1(
  6823. `Duplicate keys found during update:`,
  6824. JSON.stringify(nextChild.key),
  6825. `Make sure keys are unique.`
  6826. );
  6827. }
  6828. keyToNewIndexMap.set(nextChild.key, i);
  6829. }
  6830. }
  6831. let j;
  6832. let patched = 0;
  6833. const toBePatched = e2 - s2 + 1;
  6834. let moved = false;
  6835. let maxNewIndexSoFar = 0;
  6836. const newIndexToOldIndexMap = new Array(toBePatched);
  6837. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  6838. for (i = s1; i <= e1; i++) {
  6839. const prevChild = c1[i];
  6840. if (patched >= toBePatched) {
  6841. unmount(prevChild, parentComponent, parentSuspense, true);
  6842. continue;
  6843. }
  6844. let newIndex;
  6845. if (prevChild.key != null) {
  6846. newIndex = keyToNewIndexMap.get(prevChild.key);
  6847. } else {
  6848. for (j = s2; j <= e2; j++) {
  6849. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  6850. newIndex = j;
  6851. break;
  6852. }
  6853. }
  6854. }
  6855. if (newIndex === void 0) {
  6856. unmount(prevChild, parentComponent, parentSuspense, true);
  6857. } else {
  6858. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  6859. if (newIndex >= maxNewIndexSoFar) {
  6860. maxNewIndexSoFar = newIndex;
  6861. } else {
  6862. moved = true;
  6863. }
  6864. patch(
  6865. prevChild,
  6866. c2[newIndex],
  6867. container,
  6868. null,
  6869. parentComponent,
  6870. parentSuspense,
  6871. namespace,
  6872. slotScopeIds,
  6873. optimized
  6874. );
  6875. patched++;
  6876. }
  6877. }
  6878. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  6879. j = increasingNewIndexSequence.length - 1;
  6880. for (i = toBePatched - 1; i >= 0; i--) {
  6881. const nextIndex = s2 + i;
  6882. const nextChild = c2[nextIndex];
  6883. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  6884. if (newIndexToOldIndexMap[i] === 0) {
  6885. patch(
  6886. null,
  6887. nextChild,
  6888. container,
  6889. anchor,
  6890. parentComponent,
  6891. parentSuspense,
  6892. namespace,
  6893. slotScopeIds,
  6894. optimized
  6895. );
  6896. } else if (moved) {
  6897. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  6898. move(nextChild, container, anchor, 2);
  6899. } else {
  6900. j--;
  6901. }
  6902. }
  6903. }
  6904. }
  6905. };
  6906. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  6907. const { el, type, transition, children, shapeFlag } = vnode;
  6908. if (shapeFlag & 6) {
  6909. move(vnode.component.subTree, container, anchor, moveType);
  6910. return;
  6911. }
  6912. if (shapeFlag & 128) {
  6913. vnode.suspense.move(container, anchor, moveType);
  6914. return;
  6915. }
  6916. if (shapeFlag & 64) {
  6917. type.move(vnode, container, anchor, internals);
  6918. return;
  6919. }
  6920. if (type === Fragment) {
  6921. hostInsert(el, container, anchor);
  6922. for (let i = 0; i < children.length; i++) {
  6923. move(children[i], container, anchor, moveType);
  6924. }
  6925. hostInsert(vnode.anchor, container, anchor);
  6926. return;
  6927. }
  6928. if (type === Static) {
  6929. moveStaticNode(vnode, container, anchor);
  6930. return;
  6931. }
  6932. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  6933. if (needTransition2) {
  6934. if (moveType === 0) {
  6935. transition.beforeEnter(el);
  6936. hostInsert(el, container, anchor);
  6937. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  6938. } else {
  6939. const { leave, delayLeave, afterLeave } = transition;
  6940. const remove2 = () => hostInsert(el, container, anchor);
  6941. const performLeave = () => {
  6942. leave(el, () => {
  6943. remove2();
  6944. afterLeave && afterLeave();
  6945. });
  6946. };
  6947. if (delayLeave) {
  6948. delayLeave(el, remove2, performLeave);
  6949. } else {
  6950. performLeave();
  6951. }
  6952. }
  6953. } else {
  6954. hostInsert(el, container, anchor);
  6955. }
  6956. };
  6957. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  6958. const {
  6959. type,
  6960. props,
  6961. ref,
  6962. children,
  6963. dynamicChildren,
  6964. shapeFlag,
  6965. patchFlag,
  6966. dirs,
  6967. cacheIndex
  6968. } = vnode;
  6969. if (patchFlag === -2) {
  6970. optimized = false;
  6971. }
  6972. if (ref != null) {
  6973. setRef(ref, null, parentSuspense, vnode, true);
  6974. }
  6975. if (cacheIndex != null) {
  6976. parentComponent.renderCache[cacheIndex] = void 0;
  6977. }
  6978. if (shapeFlag & 256) {
  6979. parentComponent.ctx.deactivate(vnode);
  6980. return;
  6981. }
  6982. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  6983. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  6984. let vnodeHook;
  6985. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  6986. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6987. }
  6988. if (shapeFlag & 6) {
  6989. unmountComponent(vnode.component, parentSuspense, doRemove);
  6990. } else {
  6991. if (shapeFlag & 128) {
  6992. vnode.suspense.unmount(parentSuspense, doRemove);
  6993. return;
  6994. }
  6995. if (shouldInvokeDirs) {
  6996. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  6997. }
  6998. if (shapeFlag & 64) {
  6999. vnode.type.remove(
  7000. vnode,
  7001. parentComponent,
  7002. parentSuspense,
  7003. internals,
  7004. doRemove
  7005. );
  7006. } else if (dynamicChildren && // #5154
  7007. // when v-once is used inside a block, setBlockTracking(-1) marks the
  7008. // parent block with hasOnce: true
  7009. // so that it doesn't take the fast path during unmount - otherwise
  7010. // components nested in v-once are never unmounted.
  7011. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7012. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7013. unmountChildren(
  7014. dynamicChildren,
  7015. parentComponent,
  7016. parentSuspense,
  7017. false,
  7018. true
  7019. );
  7020. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7021. unmountChildren(children, parentComponent, parentSuspense);
  7022. }
  7023. if (doRemove) {
  7024. remove(vnode);
  7025. }
  7026. }
  7027. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7028. queuePostRenderEffect(() => {
  7029. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7030. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  7031. }, parentSuspense);
  7032. }
  7033. };
  7034. const remove = (vnode) => {
  7035. const { type, el, anchor, transition } = vnode;
  7036. if (type === Fragment) {
  7037. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  7038. vnode.children.forEach((child) => {
  7039. if (child.type === Comment) {
  7040. hostRemove(child.el);
  7041. } else {
  7042. remove(child);
  7043. }
  7044. });
  7045. } else {
  7046. removeFragment(el, anchor);
  7047. }
  7048. return;
  7049. }
  7050. if (type === Static) {
  7051. removeStaticNode(vnode);
  7052. return;
  7053. }
  7054. const performRemove = () => {
  7055. hostRemove(el);
  7056. if (transition && !transition.persisted && transition.afterLeave) {
  7057. transition.afterLeave();
  7058. }
  7059. };
  7060. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  7061. const { leave, delayLeave } = transition;
  7062. const performLeave = () => leave(el, performRemove);
  7063. if (delayLeave) {
  7064. delayLeave(vnode.el, performRemove, performLeave);
  7065. } else {
  7066. performLeave();
  7067. }
  7068. } else {
  7069. performRemove();
  7070. }
  7071. };
  7072. const removeFragment = (cur, end) => {
  7073. let next;
  7074. while (cur !== end) {
  7075. next = hostNextSibling(cur);
  7076. hostRemove(cur);
  7077. cur = next;
  7078. }
  7079. hostRemove(end);
  7080. };
  7081. const unmountComponent = (instance, parentSuspense, doRemove) => {
  7082. if (instance.type.__hmrId) {
  7083. unregisterHMR(instance);
  7084. }
  7085. const { bum, scope, update, subTree, um, m, a } = instance;
  7086. invalidateMount(m);
  7087. invalidateMount(a);
  7088. if (bum) {
  7089. invokeArrayFns(bum);
  7090. }
  7091. scope.stop();
  7092. if (update) {
  7093. update.active = false;
  7094. unmount(subTree, instance, parentSuspense, doRemove);
  7095. }
  7096. if (um) {
  7097. queuePostRenderEffect(um, parentSuspense);
  7098. }
  7099. queuePostRenderEffect(() => {
  7100. instance.isUnmounted = true;
  7101. }, parentSuspense);
  7102. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  7103. parentSuspense.deps--;
  7104. if (parentSuspense.deps === 0) {
  7105. parentSuspense.resolve();
  7106. }
  7107. }
  7108. {
  7109. devtoolsComponentRemoved(instance);
  7110. }
  7111. };
  7112. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  7113. for (let i = start; i < children.length; i++) {
  7114. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  7115. }
  7116. };
  7117. const getNextHostNode = (vnode) => {
  7118. if (vnode.shapeFlag & 6) {
  7119. return getNextHostNode(vnode.component.subTree);
  7120. }
  7121. if (vnode.shapeFlag & 128) {
  7122. return vnode.suspense.next();
  7123. }
  7124. const el = hostNextSibling(vnode.anchor || vnode.el);
  7125. const teleportEnd = el && el[TeleportEndKey];
  7126. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  7127. };
  7128. let isFlushing = false;
  7129. const render = (vnode, container, namespace) => {
  7130. if (vnode == null) {
  7131. if (container._vnode) {
  7132. unmount(container._vnode, null, null, true);
  7133. }
  7134. } else {
  7135. patch(
  7136. container._vnode || null,
  7137. vnode,
  7138. container,
  7139. null,
  7140. null,
  7141. null,
  7142. namespace
  7143. );
  7144. }
  7145. container._vnode = vnode;
  7146. if (!isFlushing) {
  7147. isFlushing = true;
  7148. flushPreFlushCbs();
  7149. flushPostFlushCbs();
  7150. isFlushing = false;
  7151. }
  7152. };
  7153. const internals = {
  7154. p: patch,
  7155. um: unmount,
  7156. m: move,
  7157. r: remove,
  7158. mt: mountComponent,
  7159. mc: mountChildren,
  7160. pc: patchChildren,
  7161. pbc: patchBlockChildren,
  7162. n: getNextHostNode,
  7163. o: options
  7164. };
  7165. let hydrate;
  7166. let hydrateNode;
  7167. if (createHydrationFns) {
  7168. [hydrate, hydrateNode] = createHydrationFns(
  7169. internals
  7170. );
  7171. }
  7172. return {
  7173. render,
  7174. hydrate,
  7175. createApp: createAppAPI(render, hydrate)
  7176. };
  7177. }
  7178. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  7179. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  7180. }
  7181. function toggleRecurse({ effect, update }, allowed) {
  7182. effect.allowRecurse = update.allowRecurse = allowed;
  7183. }
  7184. function needTransition(parentSuspense, transition) {
  7185. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  7186. }
  7187. function traverseStaticChildren(n1, n2, shallow = false) {
  7188. const ch1 = n1.children;
  7189. const ch2 = n2.children;
  7190. if (isArray(ch1) && isArray(ch2)) {
  7191. for (let i = 0; i < ch1.length; i++) {
  7192. const c1 = ch1[i];
  7193. let c2 = ch2[i];
  7194. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  7195. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  7196. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  7197. c2.el = c1.el;
  7198. }
  7199. if (!shallow && c2.patchFlag !== -2)
  7200. traverseStaticChildren(c1, c2);
  7201. }
  7202. if (c2.type === Text) {
  7203. c2.el = c1.el;
  7204. }
  7205. if (c2.type === Comment && !c2.el) {
  7206. c2.el = c1.el;
  7207. }
  7208. }
  7209. }
  7210. }
  7211. function getSequence(arr) {
  7212. const p = arr.slice();
  7213. const result = [0];
  7214. let i, j, u, v, c;
  7215. const len = arr.length;
  7216. for (i = 0; i < len; i++) {
  7217. const arrI = arr[i];
  7218. if (arrI !== 0) {
  7219. j = result[result.length - 1];
  7220. if (arr[j] < arrI) {
  7221. p[i] = j;
  7222. result.push(i);
  7223. continue;
  7224. }
  7225. u = 0;
  7226. v = result.length - 1;
  7227. while (u < v) {
  7228. c = u + v >> 1;
  7229. if (arr[result[c]] < arrI) {
  7230. u = c + 1;
  7231. } else {
  7232. v = c;
  7233. }
  7234. }
  7235. if (arrI < arr[result[u]]) {
  7236. if (u > 0) {
  7237. p[i] = result[u - 1];
  7238. }
  7239. result[u] = i;
  7240. }
  7241. }
  7242. }
  7243. u = result.length;
  7244. v = result[u - 1];
  7245. while (u-- > 0) {
  7246. result[u] = v;
  7247. v = p[v];
  7248. }
  7249. return result;
  7250. }
  7251. function locateNonHydratedAsyncRoot(instance) {
  7252. const subComponent = instance.subTree.component;
  7253. if (subComponent) {
  7254. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  7255. return subComponent;
  7256. } else {
  7257. return locateNonHydratedAsyncRoot(subComponent);
  7258. }
  7259. }
  7260. }
  7261. function invalidateMount(hooks) {
  7262. if (hooks) {
  7263. for (let i = 0; i < hooks.length; i++) hooks[i].active = false;
  7264. }
  7265. }
  7266. const ssrContextKey = Symbol.for("v-scx");
  7267. const useSSRContext = () => {
  7268. {
  7269. const ctx = inject(ssrContextKey);
  7270. if (!ctx) {
  7271. warn$1(
  7272. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  7273. );
  7274. }
  7275. return ctx;
  7276. }
  7277. };
  7278. function watchEffect(effect, options) {
  7279. return doWatch(effect, null, options);
  7280. }
  7281. function watchPostEffect(effect, options) {
  7282. return doWatch(
  7283. effect,
  7284. null,
  7285. extend({}, options, { flush: "post" })
  7286. );
  7287. }
  7288. function watchSyncEffect(effect, options) {
  7289. return doWatch(
  7290. effect,
  7291. null,
  7292. extend({}, options, { flush: "sync" })
  7293. );
  7294. }
  7295. const INITIAL_WATCHER_VALUE = {};
  7296. function watch(source, cb, options) {
  7297. if (!isFunction(cb)) {
  7298. warn$1(
  7299. `\`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.`
  7300. );
  7301. }
  7302. return doWatch(source, cb, options);
  7303. }
  7304. function doWatch(source, cb, {
  7305. immediate,
  7306. deep,
  7307. flush,
  7308. once,
  7309. onTrack,
  7310. onTrigger
  7311. } = EMPTY_OBJ) {
  7312. if (cb && once) {
  7313. const _cb = cb;
  7314. cb = (...args) => {
  7315. _cb(...args);
  7316. unwatch();
  7317. };
  7318. }
  7319. if (deep !== void 0 && typeof deep === "number") {
  7320. warn$1(
  7321. `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
  7322. );
  7323. }
  7324. if (!cb) {
  7325. if (immediate !== void 0) {
  7326. warn$1(
  7327. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  7328. );
  7329. }
  7330. if (deep !== void 0) {
  7331. warn$1(
  7332. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  7333. );
  7334. }
  7335. if (once !== void 0) {
  7336. warn$1(
  7337. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  7338. );
  7339. }
  7340. }
  7341. const warnInvalidSource = (s) => {
  7342. warn$1(
  7343. `Invalid watch source: `,
  7344. s,
  7345. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  7346. );
  7347. };
  7348. const instance = currentInstance;
  7349. const reactiveGetter = (source2) => deep === true ? source2 : (
  7350. // for deep: false, only traverse root-level properties
  7351. traverse(source2, deep === false ? 1 : void 0)
  7352. );
  7353. let getter;
  7354. let forceTrigger = false;
  7355. let isMultiSource = false;
  7356. if (isRef(source)) {
  7357. getter = () => source.value;
  7358. forceTrigger = isShallow(source);
  7359. } else if (isReactive(source)) {
  7360. getter = () => reactiveGetter(source);
  7361. forceTrigger = true;
  7362. } else if (isArray(source)) {
  7363. isMultiSource = true;
  7364. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  7365. getter = () => source.map((s) => {
  7366. if (isRef(s)) {
  7367. return s.value;
  7368. } else if (isReactive(s)) {
  7369. return reactiveGetter(s);
  7370. } else if (isFunction(s)) {
  7371. return callWithErrorHandling(s, instance, 2);
  7372. } else {
  7373. warnInvalidSource(s);
  7374. }
  7375. });
  7376. } else if (isFunction(source)) {
  7377. if (cb) {
  7378. getter = () => callWithErrorHandling(source, instance, 2);
  7379. } else {
  7380. getter = () => {
  7381. if (cleanup) {
  7382. cleanup();
  7383. }
  7384. return callWithAsyncErrorHandling(
  7385. source,
  7386. instance,
  7387. 3,
  7388. [onCleanup]
  7389. );
  7390. };
  7391. }
  7392. } else {
  7393. getter = NOOP;
  7394. warnInvalidSource(source);
  7395. }
  7396. if (cb && deep) {
  7397. const baseGetter = getter;
  7398. getter = () => traverse(baseGetter());
  7399. }
  7400. let cleanup;
  7401. let onCleanup = (fn) => {
  7402. cleanup = effect.onStop = () => {
  7403. callWithErrorHandling(fn, instance, 4);
  7404. cleanup = effect.onStop = void 0;
  7405. };
  7406. };
  7407. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  7408. const job = () => {
  7409. if (!effect.active || !effect.dirty) {
  7410. return;
  7411. }
  7412. if (cb) {
  7413. const newValue = effect.run();
  7414. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  7415. if (cleanup) {
  7416. cleanup();
  7417. }
  7418. callWithAsyncErrorHandling(cb, instance, 3, [
  7419. newValue,
  7420. // pass undefined as the old value when it's changed for the first time
  7421. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  7422. onCleanup
  7423. ]);
  7424. oldValue = newValue;
  7425. }
  7426. } else {
  7427. effect.run();
  7428. }
  7429. };
  7430. job.allowRecurse = !!cb;
  7431. let scheduler;
  7432. if (flush === "sync") {
  7433. scheduler = job;
  7434. } else if (flush === "post") {
  7435. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  7436. } else {
  7437. job.pre = true;
  7438. if (instance) job.id = instance.uid;
  7439. scheduler = () => queueJob(job);
  7440. }
  7441. const effect = new ReactiveEffect(getter, NOOP, scheduler);
  7442. const scope = getCurrentScope();
  7443. const unwatch = () => {
  7444. effect.stop();
  7445. if (scope) {
  7446. remove(scope.effects, effect);
  7447. }
  7448. };
  7449. {
  7450. effect.onTrack = onTrack;
  7451. effect.onTrigger = onTrigger;
  7452. }
  7453. if (cb) {
  7454. if (immediate) {
  7455. job();
  7456. } else {
  7457. oldValue = effect.run();
  7458. }
  7459. } else if (flush === "post") {
  7460. queuePostRenderEffect(
  7461. effect.run.bind(effect),
  7462. instance && instance.suspense
  7463. );
  7464. } else {
  7465. effect.run();
  7466. }
  7467. return unwatch;
  7468. }
  7469. function instanceWatch(source, value, options) {
  7470. const publicThis = this.proxy;
  7471. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  7472. let cb;
  7473. if (isFunction(value)) {
  7474. cb = value;
  7475. } else {
  7476. cb = value.handler;
  7477. options = value;
  7478. }
  7479. const reset = setCurrentInstance(this);
  7480. const res = doWatch(getter, cb.bind(publicThis), options);
  7481. reset();
  7482. return res;
  7483. }
  7484. function createPathGetter(ctx, path) {
  7485. const segments = path.split(".");
  7486. return () => {
  7487. let cur = ctx;
  7488. for (let i = 0; i < segments.length && cur; i++) {
  7489. cur = cur[segments[i]];
  7490. }
  7491. return cur;
  7492. };
  7493. }
  7494. function traverse(value, depth = Infinity, seen) {
  7495. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  7496. return value;
  7497. }
  7498. seen = seen || /* @__PURE__ */ new Set();
  7499. if (seen.has(value)) {
  7500. return value;
  7501. }
  7502. seen.add(value);
  7503. depth--;
  7504. if (isRef(value)) {
  7505. traverse(value.value, depth, seen);
  7506. } else if (isArray(value)) {
  7507. for (let i = 0; i < value.length; i++) {
  7508. traverse(value[i], depth, seen);
  7509. }
  7510. } else if (isSet(value) || isMap(value)) {
  7511. value.forEach((v) => {
  7512. traverse(v, depth, seen);
  7513. });
  7514. } else if (isPlainObject(value)) {
  7515. for (const key in value) {
  7516. traverse(value[key], depth, seen);
  7517. }
  7518. for (const key of Object.getOwnPropertySymbols(value)) {
  7519. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  7520. traverse(value[key], depth, seen);
  7521. }
  7522. }
  7523. }
  7524. return value;
  7525. }
  7526. function useModel(props, name, options = EMPTY_OBJ) {
  7527. const i = getCurrentInstance();
  7528. if (!i) {
  7529. warn$1(`useModel() called without active instance.`);
  7530. return ref();
  7531. }
  7532. if (!i.propsOptions[0][name]) {
  7533. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  7534. return ref();
  7535. }
  7536. const camelizedName = camelize(name);
  7537. const hyphenatedName = hyphenate(name);
  7538. const modifiers = getModelModifiers(props, name);
  7539. const res = customRef((track, trigger) => {
  7540. let localValue;
  7541. let prevSetValue = EMPTY_OBJ;
  7542. let prevEmittedValue;
  7543. watchSyncEffect(() => {
  7544. const propValue = props[name];
  7545. if (hasChanged(localValue, propValue)) {
  7546. localValue = propValue;
  7547. trigger();
  7548. }
  7549. });
  7550. return {
  7551. get() {
  7552. track();
  7553. return options.get ? options.get(localValue) : localValue;
  7554. },
  7555. set(value) {
  7556. const emittedValue = options.set ? options.set(value) : value;
  7557. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  7558. return;
  7559. }
  7560. const rawProps = i.vnode.props;
  7561. if (!(rawProps && // check if parent has passed v-model
  7562. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
  7563. localValue = value;
  7564. trigger();
  7565. }
  7566. i.emit(`update:${name}`, emittedValue);
  7567. if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
  7568. trigger();
  7569. }
  7570. prevSetValue = value;
  7571. prevEmittedValue = emittedValue;
  7572. }
  7573. };
  7574. });
  7575. res[Symbol.iterator] = () => {
  7576. let i2 = 0;
  7577. return {
  7578. next() {
  7579. if (i2 < 2) {
  7580. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  7581. } else {
  7582. return { done: true };
  7583. }
  7584. }
  7585. };
  7586. };
  7587. return res;
  7588. }
  7589. const getModelModifiers = (props, modelName) => {
  7590. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  7591. };
  7592. function emit(instance, event, ...rawArgs) {
  7593. if (instance.isUnmounted) return;
  7594. const props = instance.vnode.props || EMPTY_OBJ;
  7595. {
  7596. const {
  7597. emitsOptions,
  7598. propsOptions: [propsOptions]
  7599. } = instance;
  7600. if (emitsOptions) {
  7601. if (!(event in emitsOptions) && true) {
  7602. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  7603. warn$1(
  7604. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  7605. );
  7606. }
  7607. } else {
  7608. const validator = emitsOptions[event];
  7609. if (isFunction(validator)) {
  7610. const isValid = validator(...rawArgs);
  7611. if (!isValid) {
  7612. warn$1(
  7613. `Invalid event arguments: event validation failed for event "${event}".`
  7614. );
  7615. }
  7616. }
  7617. }
  7618. }
  7619. }
  7620. let args = rawArgs;
  7621. const isModelListener = event.startsWith("update:");
  7622. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  7623. if (modifiers) {
  7624. if (modifiers.trim) {
  7625. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  7626. }
  7627. if (modifiers.number) {
  7628. args = rawArgs.map(looseToNumber);
  7629. }
  7630. }
  7631. {
  7632. devtoolsComponentEmit(instance, event, args);
  7633. }
  7634. {
  7635. const lowerCaseEvent = event.toLowerCase();
  7636. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  7637. warn$1(
  7638. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  7639. instance,
  7640. instance.type
  7641. )} 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(
  7642. event
  7643. )}" instead of "${event}".`
  7644. );
  7645. }
  7646. }
  7647. let handlerName;
  7648. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  7649. props[handlerName = toHandlerKey(camelize(event))];
  7650. if (!handler && isModelListener) {
  7651. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  7652. }
  7653. if (handler) {
  7654. callWithAsyncErrorHandling(
  7655. handler,
  7656. instance,
  7657. 6,
  7658. args
  7659. );
  7660. }
  7661. const onceHandler = props[handlerName + `Once`];
  7662. if (onceHandler) {
  7663. if (!instance.emitted) {
  7664. instance.emitted = {};
  7665. } else if (instance.emitted[handlerName]) {
  7666. return;
  7667. }
  7668. instance.emitted[handlerName] = true;
  7669. callWithAsyncErrorHandling(
  7670. onceHandler,
  7671. instance,
  7672. 6,
  7673. args
  7674. );
  7675. }
  7676. }
  7677. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  7678. const cache = appContext.emitsCache;
  7679. const cached = cache.get(comp);
  7680. if (cached !== void 0) {
  7681. return cached;
  7682. }
  7683. const raw = comp.emits;
  7684. let normalized = {};
  7685. let hasExtends = false;
  7686. if (!isFunction(comp)) {
  7687. const extendEmits = (raw2) => {
  7688. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  7689. if (normalizedFromExtend) {
  7690. hasExtends = true;
  7691. extend(normalized, normalizedFromExtend);
  7692. }
  7693. };
  7694. if (!asMixin && appContext.mixins.length) {
  7695. appContext.mixins.forEach(extendEmits);
  7696. }
  7697. if (comp.extends) {
  7698. extendEmits(comp.extends);
  7699. }
  7700. if (comp.mixins) {
  7701. comp.mixins.forEach(extendEmits);
  7702. }
  7703. }
  7704. if (!raw && !hasExtends) {
  7705. if (isObject(comp)) {
  7706. cache.set(comp, null);
  7707. }
  7708. return null;
  7709. }
  7710. if (isArray(raw)) {
  7711. raw.forEach((key) => normalized[key] = null);
  7712. } else {
  7713. extend(normalized, raw);
  7714. }
  7715. if (isObject(comp)) {
  7716. cache.set(comp, normalized);
  7717. }
  7718. return normalized;
  7719. }
  7720. function isEmitListener(options, key) {
  7721. if (!options || !isOn(key)) {
  7722. return false;
  7723. }
  7724. key = key.slice(2).replace(/Once$/, "");
  7725. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  7726. }
  7727. let accessedAttrs = false;
  7728. function markAttrsAccessed() {
  7729. accessedAttrs = true;
  7730. }
  7731. function renderComponentRoot(instance) {
  7732. const {
  7733. type: Component,
  7734. vnode,
  7735. proxy,
  7736. withProxy,
  7737. propsOptions: [propsOptions],
  7738. slots,
  7739. attrs,
  7740. emit,
  7741. render,
  7742. renderCache,
  7743. props,
  7744. data,
  7745. setupState,
  7746. ctx,
  7747. inheritAttrs
  7748. } = instance;
  7749. const prev = setCurrentRenderingInstance(instance);
  7750. let result;
  7751. let fallthroughAttrs;
  7752. {
  7753. accessedAttrs = false;
  7754. }
  7755. try {
  7756. if (vnode.shapeFlag & 4) {
  7757. const proxyToUse = withProxy || proxy;
  7758. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  7759. get(target, key, receiver) {
  7760. warn$1(
  7761. `Property '${String(
  7762. key
  7763. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  7764. );
  7765. return Reflect.get(target, key, receiver);
  7766. }
  7767. }) : proxyToUse;
  7768. result = normalizeVNode(
  7769. render.call(
  7770. thisProxy,
  7771. proxyToUse,
  7772. renderCache,
  7773. true ? shallowReadonly(props) : props,
  7774. setupState,
  7775. data,
  7776. ctx
  7777. )
  7778. );
  7779. fallthroughAttrs = attrs;
  7780. } else {
  7781. const render2 = Component;
  7782. if (attrs === props) {
  7783. markAttrsAccessed();
  7784. }
  7785. result = normalizeVNode(
  7786. render2.length > 1 ? render2(
  7787. true ? shallowReadonly(props) : props,
  7788. true ? {
  7789. get attrs() {
  7790. markAttrsAccessed();
  7791. return shallowReadonly(attrs);
  7792. },
  7793. slots,
  7794. emit
  7795. } : { attrs, slots, emit }
  7796. ) : render2(
  7797. true ? shallowReadonly(props) : props,
  7798. null
  7799. )
  7800. );
  7801. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  7802. }
  7803. } catch (err) {
  7804. blockStack.length = 0;
  7805. handleError(err, instance, 1);
  7806. result = createVNode(Comment);
  7807. }
  7808. let root = result;
  7809. let setRoot = void 0;
  7810. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  7811. [root, setRoot] = getChildRoot(result);
  7812. }
  7813. if (fallthroughAttrs && inheritAttrs !== false) {
  7814. const keys = Object.keys(fallthroughAttrs);
  7815. const { shapeFlag } = root;
  7816. if (keys.length) {
  7817. if (shapeFlag & (1 | 6)) {
  7818. if (propsOptions && keys.some(isModelListener)) {
  7819. fallthroughAttrs = filterModelListeners(
  7820. fallthroughAttrs,
  7821. propsOptions
  7822. );
  7823. }
  7824. root = cloneVNode(root, fallthroughAttrs, false, true);
  7825. } else if (!accessedAttrs && root.type !== Comment) {
  7826. const allAttrs = Object.keys(attrs);
  7827. const eventAttrs = [];
  7828. const extraAttrs = [];
  7829. for (let i = 0, l = allAttrs.length; i < l; i++) {
  7830. const key = allAttrs[i];
  7831. if (isOn(key)) {
  7832. if (!isModelListener(key)) {
  7833. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  7834. }
  7835. } else {
  7836. extraAttrs.push(key);
  7837. }
  7838. }
  7839. if (extraAttrs.length) {
  7840. warn$1(
  7841. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  7842. );
  7843. }
  7844. if (eventAttrs.length) {
  7845. warn$1(
  7846. `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.`
  7847. );
  7848. }
  7849. }
  7850. }
  7851. }
  7852. if (vnode.dirs) {
  7853. if (!isElementRoot(root)) {
  7854. warn$1(
  7855. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  7856. );
  7857. }
  7858. root = cloneVNode(root, null, false, true);
  7859. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  7860. }
  7861. if (vnode.transition) {
  7862. if (!isElementRoot(root)) {
  7863. warn$1(
  7864. `Component inside <Transition> renders non-element root node that cannot be animated.`
  7865. );
  7866. }
  7867. root.transition = vnode.transition;
  7868. }
  7869. if (setRoot) {
  7870. setRoot(root);
  7871. } else {
  7872. result = root;
  7873. }
  7874. setCurrentRenderingInstance(prev);
  7875. return result;
  7876. }
  7877. const getChildRoot = (vnode) => {
  7878. const rawChildren = vnode.children;
  7879. const dynamicChildren = vnode.dynamicChildren;
  7880. const childRoot = filterSingleRoot(rawChildren, false);
  7881. if (!childRoot) {
  7882. return [vnode, void 0];
  7883. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  7884. return getChildRoot(childRoot);
  7885. }
  7886. const index = rawChildren.indexOf(childRoot);
  7887. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  7888. const setRoot = (updatedRoot) => {
  7889. rawChildren[index] = updatedRoot;
  7890. if (dynamicChildren) {
  7891. if (dynamicIndex > -1) {
  7892. dynamicChildren[dynamicIndex] = updatedRoot;
  7893. } else if (updatedRoot.patchFlag > 0) {
  7894. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  7895. }
  7896. }
  7897. };
  7898. return [normalizeVNode(childRoot), setRoot];
  7899. };
  7900. function filterSingleRoot(children, recurse = true) {
  7901. let singleRoot;
  7902. for (let i = 0; i < children.length; i++) {
  7903. const child = children[i];
  7904. if (isVNode(child)) {
  7905. if (child.type !== Comment || child.children === "v-if") {
  7906. if (singleRoot) {
  7907. return;
  7908. } else {
  7909. singleRoot = child;
  7910. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  7911. return filterSingleRoot(singleRoot.children);
  7912. }
  7913. }
  7914. }
  7915. } else {
  7916. return;
  7917. }
  7918. }
  7919. return singleRoot;
  7920. }
  7921. const getFunctionalFallthrough = (attrs) => {
  7922. let res;
  7923. for (const key in attrs) {
  7924. if (key === "class" || key === "style" || isOn(key)) {
  7925. (res || (res = {}))[key] = attrs[key];
  7926. }
  7927. }
  7928. return res;
  7929. };
  7930. const filterModelListeners = (attrs, props) => {
  7931. const res = {};
  7932. for (const key in attrs) {
  7933. if (!isModelListener(key) || !(key.slice(9) in props)) {
  7934. res[key] = attrs[key];
  7935. }
  7936. }
  7937. return res;
  7938. };
  7939. const isElementRoot = (vnode) => {
  7940. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  7941. };
  7942. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  7943. const { props: prevProps, children: prevChildren, component } = prevVNode;
  7944. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  7945. const emits = component.emitsOptions;
  7946. if ((prevChildren || nextChildren) && isHmrUpdating) {
  7947. return true;
  7948. }
  7949. if (nextVNode.dirs || nextVNode.transition) {
  7950. return true;
  7951. }
  7952. if (optimized && patchFlag >= 0) {
  7953. if (patchFlag & 1024) {
  7954. return true;
  7955. }
  7956. if (patchFlag & 16) {
  7957. if (!prevProps) {
  7958. return !!nextProps;
  7959. }
  7960. return hasPropsChanged(prevProps, nextProps, emits);
  7961. } else if (patchFlag & 8) {
  7962. const dynamicProps = nextVNode.dynamicProps;
  7963. for (let i = 0; i < dynamicProps.length; i++) {
  7964. const key = dynamicProps[i];
  7965. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  7966. return true;
  7967. }
  7968. }
  7969. }
  7970. } else {
  7971. if (prevChildren || nextChildren) {
  7972. if (!nextChildren || !nextChildren.$stable) {
  7973. return true;
  7974. }
  7975. }
  7976. if (prevProps === nextProps) {
  7977. return false;
  7978. }
  7979. if (!prevProps) {
  7980. return !!nextProps;
  7981. }
  7982. if (!nextProps) {
  7983. return true;
  7984. }
  7985. return hasPropsChanged(prevProps, nextProps, emits);
  7986. }
  7987. return false;
  7988. }
  7989. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  7990. const nextKeys = Object.keys(nextProps);
  7991. if (nextKeys.length !== Object.keys(prevProps).length) {
  7992. return true;
  7993. }
  7994. for (let i = 0; i < nextKeys.length; i++) {
  7995. const key = nextKeys[i];
  7996. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  7997. return true;
  7998. }
  7999. }
  8000. return false;
  8001. }
  8002. function updateHOCHostEl({ vnode, parent }, el) {
  8003. while (parent) {
  8004. const root = parent.subTree;
  8005. if (root.suspense && root.suspense.activeBranch === vnode) {
  8006. root.el = vnode.el;
  8007. }
  8008. if (root === vnode) {
  8009. (vnode = parent.vnode).el = el;
  8010. parent = parent.parent;
  8011. } else {
  8012. break;
  8013. }
  8014. }
  8015. }
  8016. const isSuspense = (type) => type.__isSuspense;
  8017. let suspenseId = 0;
  8018. const SuspenseImpl = {
  8019. name: "Suspense",
  8020. // In order to make Suspense tree-shakable, we need to avoid importing it
  8021. // directly in the renderer. The renderer checks for the __isSuspense flag
  8022. // on a vnode's type and calls the `process` method, passing in renderer
  8023. // internals.
  8024. __isSuspense: true,
  8025. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8026. if (n1 == null) {
  8027. mountSuspense(
  8028. n2,
  8029. container,
  8030. anchor,
  8031. parentComponent,
  8032. parentSuspense,
  8033. namespace,
  8034. slotScopeIds,
  8035. optimized,
  8036. rendererInternals
  8037. );
  8038. } else {
  8039. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  8040. n2.suspense = n1.suspense;
  8041. n2.suspense.vnode = n2;
  8042. n2.el = n1.el;
  8043. return;
  8044. }
  8045. patchSuspense(
  8046. n1,
  8047. n2,
  8048. container,
  8049. anchor,
  8050. parentComponent,
  8051. namespace,
  8052. slotScopeIds,
  8053. optimized,
  8054. rendererInternals
  8055. );
  8056. }
  8057. },
  8058. hydrate: hydrateSuspense,
  8059. normalize: normalizeSuspenseChildren
  8060. };
  8061. const Suspense = SuspenseImpl ;
  8062. function triggerEvent(vnode, name) {
  8063. const eventListener = vnode.props && vnode.props[name];
  8064. if (isFunction(eventListener)) {
  8065. eventListener();
  8066. }
  8067. }
  8068. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8069. const {
  8070. p: patch,
  8071. o: { createElement }
  8072. } = rendererInternals;
  8073. const hiddenContainer = createElement("div");
  8074. const suspense = vnode.suspense = createSuspenseBoundary(
  8075. vnode,
  8076. parentSuspense,
  8077. parentComponent,
  8078. container,
  8079. hiddenContainer,
  8080. anchor,
  8081. namespace,
  8082. slotScopeIds,
  8083. optimized,
  8084. rendererInternals
  8085. );
  8086. patch(
  8087. null,
  8088. suspense.pendingBranch = vnode.ssContent,
  8089. hiddenContainer,
  8090. null,
  8091. parentComponent,
  8092. suspense,
  8093. namespace,
  8094. slotScopeIds
  8095. );
  8096. if (suspense.deps > 0) {
  8097. triggerEvent(vnode, "onPending");
  8098. triggerEvent(vnode, "onFallback");
  8099. patch(
  8100. null,
  8101. vnode.ssFallback,
  8102. container,
  8103. anchor,
  8104. parentComponent,
  8105. null,
  8106. // fallback tree will not have suspense context
  8107. namespace,
  8108. slotScopeIds
  8109. );
  8110. setActiveBranch(suspense, vnode.ssFallback);
  8111. } else {
  8112. suspense.resolve(false, true);
  8113. }
  8114. }
  8115. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  8116. const suspense = n2.suspense = n1.suspense;
  8117. suspense.vnode = n2;
  8118. n2.el = n1.el;
  8119. const newBranch = n2.ssContent;
  8120. const newFallback = n2.ssFallback;
  8121. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  8122. if (pendingBranch) {
  8123. suspense.pendingBranch = newBranch;
  8124. if (isSameVNodeType(newBranch, pendingBranch)) {
  8125. patch(
  8126. pendingBranch,
  8127. newBranch,
  8128. suspense.hiddenContainer,
  8129. null,
  8130. parentComponent,
  8131. suspense,
  8132. namespace,
  8133. slotScopeIds,
  8134. optimized
  8135. );
  8136. if (suspense.deps <= 0) {
  8137. suspense.resolve();
  8138. } else if (isInFallback) {
  8139. if (!isHydrating) {
  8140. patch(
  8141. activeBranch,
  8142. newFallback,
  8143. container,
  8144. anchor,
  8145. parentComponent,
  8146. null,
  8147. // fallback tree will not have suspense context
  8148. namespace,
  8149. slotScopeIds,
  8150. optimized
  8151. );
  8152. setActiveBranch(suspense, newFallback);
  8153. }
  8154. }
  8155. } else {
  8156. suspense.pendingId = suspenseId++;
  8157. if (isHydrating) {
  8158. suspense.isHydrating = false;
  8159. suspense.activeBranch = pendingBranch;
  8160. } else {
  8161. unmount(pendingBranch, parentComponent, suspense);
  8162. }
  8163. suspense.deps = 0;
  8164. suspense.effects.length = 0;
  8165. suspense.hiddenContainer = createElement("div");
  8166. if (isInFallback) {
  8167. patch(
  8168. null,
  8169. newBranch,
  8170. suspense.hiddenContainer,
  8171. null,
  8172. parentComponent,
  8173. suspense,
  8174. namespace,
  8175. slotScopeIds,
  8176. optimized
  8177. );
  8178. if (suspense.deps <= 0) {
  8179. suspense.resolve();
  8180. } else {
  8181. patch(
  8182. activeBranch,
  8183. newFallback,
  8184. container,
  8185. anchor,
  8186. parentComponent,
  8187. null,
  8188. // fallback tree will not have suspense context
  8189. namespace,
  8190. slotScopeIds,
  8191. optimized
  8192. );
  8193. setActiveBranch(suspense, newFallback);
  8194. }
  8195. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  8196. patch(
  8197. activeBranch,
  8198. newBranch,
  8199. container,
  8200. anchor,
  8201. parentComponent,
  8202. suspense,
  8203. namespace,
  8204. slotScopeIds,
  8205. optimized
  8206. );
  8207. suspense.resolve(true);
  8208. } else {
  8209. patch(
  8210. null,
  8211. newBranch,
  8212. suspense.hiddenContainer,
  8213. null,
  8214. parentComponent,
  8215. suspense,
  8216. namespace,
  8217. slotScopeIds,
  8218. optimized
  8219. );
  8220. if (suspense.deps <= 0) {
  8221. suspense.resolve();
  8222. }
  8223. }
  8224. }
  8225. } else {
  8226. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  8227. patch(
  8228. activeBranch,
  8229. newBranch,
  8230. container,
  8231. anchor,
  8232. parentComponent,
  8233. suspense,
  8234. namespace,
  8235. slotScopeIds,
  8236. optimized
  8237. );
  8238. setActiveBranch(suspense, newBranch);
  8239. } else {
  8240. triggerEvent(n2, "onPending");
  8241. suspense.pendingBranch = newBranch;
  8242. if (newBranch.shapeFlag & 512) {
  8243. suspense.pendingId = newBranch.component.suspenseId;
  8244. } else {
  8245. suspense.pendingId = suspenseId++;
  8246. }
  8247. patch(
  8248. null,
  8249. newBranch,
  8250. suspense.hiddenContainer,
  8251. null,
  8252. parentComponent,
  8253. suspense,
  8254. namespace,
  8255. slotScopeIds,
  8256. optimized
  8257. );
  8258. if (suspense.deps <= 0) {
  8259. suspense.resolve();
  8260. } else {
  8261. const { timeout, pendingId } = suspense;
  8262. if (timeout > 0) {
  8263. setTimeout(() => {
  8264. if (suspense.pendingId === pendingId) {
  8265. suspense.fallback(newFallback);
  8266. }
  8267. }, timeout);
  8268. } else if (timeout === 0) {
  8269. suspense.fallback(newFallback);
  8270. }
  8271. }
  8272. }
  8273. }
  8274. }
  8275. let hasWarned = false;
  8276. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  8277. if (!hasWarned) {
  8278. hasWarned = true;
  8279. console[console.info ? "info" : "log"](
  8280. `<Suspense> is an experimental feature and its API will likely change.`
  8281. );
  8282. }
  8283. const {
  8284. p: patch,
  8285. m: move,
  8286. um: unmount,
  8287. n: next,
  8288. o: { parentNode, remove }
  8289. } = rendererInternals;
  8290. let parentSuspenseId;
  8291. const isSuspensible = isVNodeSuspensible(vnode);
  8292. if (isSuspensible) {
  8293. if (parentSuspense && parentSuspense.pendingBranch) {
  8294. parentSuspenseId = parentSuspense.pendingId;
  8295. parentSuspense.deps++;
  8296. }
  8297. }
  8298. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  8299. {
  8300. assertNumber(timeout, `Suspense timeout`);
  8301. }
  8302. const initialAnchor = anchor;
  8303. const suspense = {
  8304. vnode,
  8305. parent: parentSuspense,
  8306. parentComponent,
  8307. namespace,
  8308. container,
  8309. hiddenContainer,
  8310. deps: 0,
  8311. pendingId: suspenseId++,
  8312. timeout: typeof timeout === "number" ? timeout : -1,
  8313. activeBranch: null,
  8314. pendingBranch: null,
  8315. isInFallback: !isHydrating,
  8316. isHydrating,
  8317. isUnmounted: false,
  8318. effects: [],
  8319. resolve(resume = false, sync = false) {
  8320. {
  8321. if (!resume && !suspense.pendingBranch) {
  8322. throw new Error(
  8323. `suspense.resolve() is called without a pending branch.`
  8324. );
  8325. }
  8326. if (suspense.isUnmounted) {
  8327. throw new Error(
  8328. `suspense.resolve() is called on an already unmounted suspense boundary.`
  8329. );
  8330. }
  8331. }
  8332. const {
  8333. vnode: vnode2,
  8334. activeBranch,
  8335. pendingBranch,
  8336. pendingId,
  8337. effects,
  8338. parentComponent: parentComponent2,
  8339. container: container2
  8340. } = suspense;
  8341. let delayEnter = false;
  8342. if (suspense.isHydrating) {
  8343. suspense.isHydrating = false;
  8344. } else if (!resume) {
  8345. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  8346. if (delayEnter) {
  8347. activeBranch.transition.afterLeave = () => {
  8348. if (pendingId === suspense.pendingId) {
  8349. move(
  8350. pendingBranch,
  8351. container2,
  8352. anchor === initialAnchor ? next(activeBranch) : anchor,
  8353. 0
  8354. );
  8355. queuePostFlushCb(effects);
  8356. }
  8357. };
  8358. }
  8359. if (activeBranch) {
  8360. if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
  8361. anchor = next(activeBranch);
  8362. }
  8363. unmount(activeBranch, parentComponent2, suspense, true);
  8364. }
  8365. if (!delayEnter) {
  8366. move(pendingBranch, container2, anchor, 0);
  8367. }
  8368. }
  8369. setActiveBranch(suspense, pendingBranch);
  8370. suspense.pendingBranch = null;
  8371. suspense.isInFallback = false;
  8372. let parent = suspense.parent;
  8373. let hasUnresolvedAncestor = false;
  8374. while (parent) {
  8375. if (parent.pendingBranch) {
  8376. parent.effects.push(...effects);
  8377. hasUnresolvedAncestor = true;
  8378. break;
  8379. }
  8380. parent = parent.parent;
  8381. }
  8382. if (!hasUnresolvedAncestor && !delayEnter) {
  8383. queuePostFlushCb(effects);
  8384. }
  8385. suspense.effects = [];
  8386. if (isSuspensible) {
  8387. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  8388. parentSuspense.deps--;
  8389. if (parentSuspense.deps === 0 && !sync) {
  8390. parentSuspense.resolve();
  8391. }
  8392. }
  8393. }
  8394. triggerEvent(vnode2, "onResolve");
  8395. },
  8396. fallback(fallbackVNode) {
  8397. if (!suspense.pendingBranch) {
  8398. return;
  8399. }
  8400. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  8401. triggerEvent(vnode2, "onFallback");
  8402. const anchor2 = next(activeBranch);
  8403. const mountFallback = () => {
  8404. if (!suspense.isInFallback) {
  8405. return;
  8406. }
  8407. patch(
  8408. null,
  8409. fallbackVNode,
  8410. container2,
  8411. anchor2,
  8412. parentComponent2,
  8413. null,
  8414. // fallback tree will not have suspense context
  8415. namespace2,
  8416. slotScopeIds,
  8417. optimized
  8418. );
  8419. setActiveBranch(suspense, fallbackVNode);
  8420. };
  8421. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  8422. if (delayEnter) {
  8423. activeBranch.transition.afterLeave = mountFallback;
  8424. }
  8425. suspense.isInFallback = true;
  8426. unmount(
  8427. activeBranch,
  8428. parentComponent2,
  8429. null,
  8430. // no suspense so unmount hooks fire now
  8431. true
  8432. // shouldRemove
  8433. );
  8434. if (!delayEnter) {
  8435. mountFallback();
  8436. }
  8437. },
  8438. move(container2, anchor2, type) {
  8439. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  8440. suspense.container = container2;
  8441. },
  8442. next() {
  8443. return suspense.activeBranch && next(suspense.activeBranch);
  8444. },
  8445. registerDep(instance, setupRenderEffect, optimized2) {
  8446. const isInPendingSuspense = !!suspense.pendingBranch;
  8447. if (isInPendingSuspense) {
  8448. suspense.deps++;
  8449. }
  8450. const hydratedEl = instance.vnode.el;
  8451. instance.asyncDep.catch((err) => {
  8452. handleError(err, instance, 0);
  8453. }).then((asyncSetupResult) => {
  8454. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  8455. return;
  8456. }
  8457. instance.asyncResolved = true;
  8458. const { vnode: vnode2 } = instance;
  8459. {
  8460. pushWarningContext(vnode2);
  8461. }
  8462. handleSetupResult(instance, asyncSetupResult, false);
  8463. if (hydratedEl) {
  8464. vnode2.el = hydratedEl;
  8465. }
  8466. const placeholder = !hydratedEl && instance.subTree.el;
  8467. setupRenderEffect(
  8468. instance,
  8469. vnode2,
  8470. // component may have been moved before resolve.
  8471. // if this is not a hydration, instance.subTree will be the comment
  8472. // placeholder.
  8473. parentNode(hydratedEl || instance.subTree.el),
  8474. // anchor will not be used if this is hydration, so only need to
  8475. // consider the comment placeholder case.
  8476. hydratedEl ? null : next(instance.subTree),
  8477. suspense,
  8478. namespace,
  8479. optimized2
  8480. );
  8481. if (placeholder) {
  8482. remove(placeholder);
  8483. }
  8484. updateHOCHostEl(instance, vnode2.el);
  8485. {
  8486. popWarningContext();
  8487. }
  8488. if (isInPendingSuspense && --suspense.deps === 0) {
  8489. suspense.resolve();
  8490. }
  8491. });
  8492. },
  8493. unmount(parentSuspense2, doRemove) {
  8494. suspense.isUnmounted = true;
  8495. if (suspense.activeBranch) {
  8496. unmount(
  8497. suspense.activeBranch,
  8498. parentComponent,
  8499. parentSuspense2,
  8500. doRemove
  8501. );
  8502. }
  8503. if (suspense.pendingBranch) {
  8504. unmount(
  8505. suspense.pendingBranch,
  8506. parentComponent,
  8507. parentSuspense2,
  8508. doRemove
  8509. );
  8510. }
  8511. }
  8512. };
  8513. return suspense;
  8514. }
  8515. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  8516. const suspense = vnode.suspense = createSuspenseBoundary(
  8517. vnode,
  8518. parentSuspense,
  8519. parentComponent,
  8520. node.parentNode,
  8521. // eslint-disable-next-line no-restricted-globals
  8522. document.createElement("div"),
  8523. null,
  8524. namespace,
  8525. slotScopeIds,
  8526. optimized,
  8527. rendererInternals,
  8528. true
  8529. );
  8530. const result = hydrateNode(
  8531. node,
  8532. suspense.pendingBranch = vnode.ssContent,
  8533. parentComponent,
  8534. suspense,
  8535. slotScopeIds,
  8536. optimized
  8537. );
  8538. if (suspense.deps === 0) {
  8539. suspense.resolve(false, true);
  8540. }
  8541. return result;
  8542. }
  8543. function normalizeSuspenseChildren(vnode) {
  8544. const { shapeFlag, children } = vnode;
  8545. const isSlotChildren = shapeFlag & 32;
  8546. vnode.ssContent = normalizeSuspenseSlot(
  8547. isSlotChildren ? children.default : children
  8548. );
  8549. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  8550. }
  8551. function normalizeSuspenseSlot(s) {
  8552. let block;
  8553. if (isFunction(s)) {
  8554. const trackBlock = isBlockTreeEnabled && s._c;
  8555. if (trackBlock) {
  8556. s._d = false;
  8557. openBlock();
  8558. }
  8559. s = s();
  8560. if (trackBlock) {
  8561. s._d = true;
  8562. block = currentBlock;
  8563. closeBlock();
  8564. }
  8565. }
  8566. if (isArray(s)) {
  8567. const singleChild = filterSingleRoot(s);
  8568. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  8569. warn$1(`<Suspense> slots expect a single root node.`);
  8570. }
  8571. s = singleChild;
  8572. }
  8573. s = normalizeVNode(s);
  8574. if (block && !s.dynamicChildren) {
  8575. s.dynamicChildren = block.filter((c) => c !== s);
  8576. }
  8577. return s;
  8578. }
  8579. function queueEffectWithSuspense(fn, suspense) {
  8580. if (suspense && suspense.pendingBranch) {
  8581. if (isArray(fn)) {
  8582. suspense.effects.push(...fn);
  8583. } else {
  8584. suspense.effects.push(fn);
  8585. }
  8586. } else {
  8587. queuePostFlushCb(fn);
  8588. }
  8589. }
  8590. function setActiveBranch(suspense, branch) {
  8591. suspense.activeBranch = branch;
  8592. const { vnode, parentComponent } = suspense;
  8593. let el = branch.el;
  8594. while (!el && branch.component) {
  8595. branch = branch.component.subTree;
  8596. el = branch.el;
  8597. }
  8598. vnode.el = el;
  8599. if (parentComponent && parentComponent.subTree === vnode) {
  8600. parentComponent.vnode.el = el;
  8601. updateHOCHostEl(parentComponent, el);
  8602. }
  8603. }
  8604. function isVNodeSuspensible(vnode) {
  8605. const suspensible = vnode.props && vnode.props.suspensible;
  8606. return suspensible != null && suspensible !== false;
  8607. }
  8608. const Fragment = Symbol.for("v-fgt");
  8609. const Text = Symbol.for("v-txt");
  8610. const Comment = Symbol.for("v-cmt");
  8611. const Static = Symbol.for("v-stc");
  8612. const blockStack = [];
  8613. let currentBlock = null;
  8614. function openBlock(disableTracking = false) {
  8615. blockStack.push(currentBlock = disableTracking ? null : []);
  8616. }
  8617. function closeBlock() {
  8618. blockStack.pop();
  8619. currentBlock = blockStack[blockStack.length - 1] || null;
  8620. }
  8621. let isBlockTreeEnabled = 1;
  8622. function setBlockTracking(value) {
  8623. isBlockTreeEnabled += value;
  8624. if (value < 0 && currentBlock) {
  8625. currentBlock.hasOnce = true;
  8626. }
  8627. }
  8628. function setupBlock(vnode) {
  8629. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  8630. closeBlock();
  8631. if (isBlockTreeEnabled > 0 && currentBlock) {
  8632. currentBlock.push(vnode);
  8633. }
  8634. return vnode;
  8635. }
  8636. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  8637. return setupBlock(
  8638. createBaseVNode(
  8639. type,
  8640. props,
  8641. children,
  8642. patchFlag,
  8643. dynamicProps,
  8644. shapeFlag,
  8645. true
  8646. )
  8647. );
  8648. }
  8649. function createBlock(type, props, children, patchFlag, dynamicProps) {
  8650. return setupBlock(
  8651. createVNode(
  8652. type,
  8653. props,
  8654. children,
  8655. patchFlag,
  8656. dynamicProps,
  8657. true
  8658. )
  8659. );
  8660. }
  8661. function isVNode(value) {
  8662. return value ? value.__v_isVNode === true : false;
  8663. }
  8664. function isSameVNodeType(n1, n2) {
  8665. if (n2.shapeFlag & 6 && n1.component) {
  8666. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  8667. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  8668. n1.shapeFlag &= ~256;
  8669. n2.shapeFlag &= ~512;
  8670. return false;
  8671. }
  8672. }
  8673. return n1.type === n2.type && n1.key === n2.key;
  8674. }
  8675. let vnodeArgsTransformer;
  8676. function transformVNodeArgs(transformer) {
  8677. vnodeArgsTransformer = transformer;
  8678. }
  8679. const createVNodeWithArgsTransform = (...args) => {
  8680. return _createVNode(
  8681. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  8682. );
  8683. };
  8684. const normalizeKey = ({ key }) => key != null ? key : null;
  8685. const normalizeRef = ({
  8686. ref,
  8687. ref_key,
  8688. ref_for
  8689. }) => {
  8690. if (typeof ref === "number") {
  8691. ref = "" + ref;
  8692. }
  8693. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  8694. };
  8695. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  8696. const vnode = {
  8697. __v_isVNode: true,
  8698. __v_skip: true,
  8699. type,
  8700. props,
  8701. key: props && normalizeKey(props),
  8702. ref: props && normalizeRef(props),
  8703. scopeId: currentScopeId,
  8704. slotScopeIds: null,
  8705. children,
  8706. component: null,
  8707. suspense: null,
  8708. ssContent: null,
  8709. ssFallback: null,
  8710. dirs: null,
  8711. transition: null,
  8712. el: null,
  8713. anchor: null,
  8714. target: null,
  8715. targetStart: null,
  8716. targetAnchor: null,
  8717. staticCount: 0,
  8718. shapeFlag,
  8719. patchFlag,
  8720. dynamicProps,
  8721. dynamicChildren: null,
  8722. appContext: null,
  8723. ctx: currentRenderingInstance
  8724. };
  8725. if (needFullChildrenNormalization) {
  8726. normalizeChildren(vnode, children);
  8727. if (shapeFlag & 128) {
  8728. type.normalize(vnode);
  8729. }
  8730. } else if (children) {
  8731. vnode.shapeFlag |= isString(children) ? 8 : 16;
  8732. }
  8733. if (vnode.key !== vnode.key) {
  8734. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  8735. }
  8736. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  8737. !isBlockNode && // has current parent block
  8738. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  8739. // component nodes also should always be patched, because even if the
  8740. // component doesn't need to update, it needs to persist the instance on to
  8741. // the next vnode so that it can be properly unmounted later.
  8742. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  8743. // vnode should not be considered dynamic due to handler caching.
  8744. vnode.patchFlag !== 32) {
  8745. currentBlock.push(vnode);
  8746. }
  8747. return vnode;
  8748. }
  8749. const createVNode = createVNodeWithArgsTransform ;
  8750. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  8751. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  8752. if (!type) {
  8753. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  8754. }
  8755. type = Comment;
  8756. }
  8757. if (isVNode(type)) {
  8758. const cloned = cloneVNode(
  8759. type,
  8760. props,
  8761. true
  8762. /* mergeRef: true */
  8763. );
  8764. if (children) {
  8765. normalizeChildren(cloned, children);
  8766. }
  8767. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  8768. if (cloned.shapeFlag & 6) {
  8769. currentBlock[currentBlock.indexOf(type)] = cloned;
  8770. } else {
  8771. currentBlock.push(cloned);
  8772. }
  8773. }
  8774. cloned.patchFlag = -2;
  8775. return cloned;
  8776. }
  8777. if (isClassComponent(type)) {
  8778. type = type.__vccOpts;
  8779. }
  8780. if (props) {
  8781. props = guardReactiveProps(props);
  8782. let { class: klass, style } = props;
  8783. if (klass && !isString(klass)) {
  8784. props.class = normalizeClass(klass);
  8785. }
  8786. if (isObject(style)) {
  8787. if (isProxy(style) && !isArray(style)) {
  8788. style = extend({}, style);
  8789. }
  8790. props.style = normalizeStyle(style);
  8791. }
  8792. }
  8793. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  8794. if (shapeFlag & 4 && isProxy(type)) {
  8795. type = toRaw(type);
  8796. warn$1(
  8797. `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\`.`,
  8798. `
  8799. Component that was made reactive: `,
  8800. type
  8801. );
  8802. }
  8803. return createBaseVNode(
  8804. type,
  8805. props,
  8806. children,
  8807. patchFlag,
  8808. dynamicProps,
  8809. shapeFlag,
  8810. isBlockNode,
  8811. true
  8812. );
  8813. }
  8814. function guardReactiveProps(props) {
  8815. if (!props) return null;
  8816. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  8817. }
  8818. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  8819. const { props, ref, patchFlag, children, transition } = vnode;
  8820. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  8821. const cloned = {
  8822. __v_isVNode: true,
  8823. __v_skip: true,
  8824. type: vnode.type,
  8825. props: mergedProps,
  8826. key: mergedProps && normalizeKey(mergedProps),
  8827. ref: extraProps && extraProps.ref ? (
  8828. // #2078 in the case of <component :is="vnode" ref="extra"/>
  8829. // if the vnode itself already has a ref, cloneVNode will need to merge
  8830. // the refs so the single vnode can be set on multiple refs
  8831. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  8832. ) : ref,
  8833. scopeId: vnode.scopeId,
  8834. slotScopeIds: vnode.slotScopeIds,
  8835. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  8836. target: vnode.target,
  8837. targetStart: vnode.targetStart,
  8838. targetAnchor: vnode.targetAnchor,
  8839. staticCount: vnode.staticCount,
  8840. shapeFlag: vnode.shapeFlag,
  8841. // if the vnode is cloned with extra props, we can no longer assume its
  8842. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  8843. // note: preserve flag for fragments since they use the flag for children
  8844. // fast paths only.
  8845. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  8846. dynamicProps: vnode.dynamicProps,
  8847. dynamicChildren: vnode.dynamicChildren,
  8848. appContext: vnode.appContext,
  8849. dirs: vnode.dirs,
  8850. transition,
  8851. // These should technically only be non-null on mounted VNodes. However,
  8852. // they *should* be copied for kept-alive vnodes. So we just always copy
  8853. // them since them being non-null during a mount doesn't affect the logic as
  8854. // they will simply be overwritten.
  8855. component: vnode.component,
  8856. suspense: vnode.suspense,
  8857. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  8858. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  8859. el: vnode.el,
  8860. anchor: vnode.anchor,
  8861. ctx: vnode.ctx,
  8862. ce: vnode.ce
  8863. };
  8864. if (transition && cloneTransition) {
  8865. setTransitionHooks(
  8866. cloned,
  8867. transition.clone(cloned)
  8868. );
  8869. }
  8870. return cloned;
  8871. }
  8872. function deepCloneVNode(vnode) {
  8873. const cloned = cloneVNode(vnode);
  8874. if (isArray(vnode.children)) {
  8875. cloned.children = vnode.children.map(deepCloneVNode);
  8876. }
  8877. return cloned;
  8878. }
  8879. function createTextVNode(text = " ", flag = 0) {
  8880. return createVNode(Text, null, text, flag);
  8881. }
  8882. function createStaticVNode(content, numberOfNodes) {
  8883. const vnode = createVNode(Static, null, content);
  8884. vnode.staticCount = numberOfNodes;
  8885. return vnode;
  8886. }
  8887. function createCommentVNode(text = "", asBlock = false) {
  8888. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  8889. }
  8890. function normalizeVNode(child) {
  8891. if (child == null || typeof child === "boolean") {
  8892. return createVNode(Comment);
  8893. } else if (isArray(child)) {
  8894. return createVNode(
  8895. Fragment,
  8896. null,
  8897. // #3666, avoid reference pollution when reusing vnode
  8898. child.slice()
  8899. );
  8900. } else if (typeof child === "object") {
  8901. return cloneIfMounted(child);
  8902. } else {
  8903. return createVNode(Text, null, String(child));
  8904. }
  8905. }
  8906. function cloneIfMounted(child) {
  8907. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  8908. }
  8909. function normalizeChildren(vnode, children) {
  8910. let type = 0;
  8911. const { shapeFlag } = vnode;
  8912. if (children == null) {
  8913. children = null;
  8914. } else if (isArray(children)) {
  8915. type = 16;
  8916. } else if (typeof children === "object") {
  8917. if (shapeFlag & (1 | 64)) {
  8918. const slot = children.default;
  8919. if (slot) {
  8920. slot._c && (slot._d = false);
  8921. normalizeChildren(vnode, slot());
  8922. slot._c && (slot._d = true);
  8923. }
  8924. return;
  8925. } else {
  8926. type = 32;
  8927. const slotFlag = children._;
  8928. if (!slotFlag && !isInternalObject(children)) {
  8929. children._ctx = currentRenderingInstance;
  8930. } else if (slotFlag === 3 && currentRenderingInstance) {
  8931. if (currentRenderingInstance.slots._ === 1) {
  8932. children._ = 1;
  8933. } else {
  8934. children._ = 2;
  8935. vnode.patchFlag |= 1024;
  8936. }
  8937. }
  8938. }
  8939. } else if (isFunction(children)) {
  8940. children = { default: children, _ctx: currentRenderingInstance };
  8941. type = 32;
  8942. } else {
  8943. children = String(children);
  8944. if (shapeFlag & 64) {
  8945. type = 16;
  8946. children = [createTextVNode(children)];
  8947. } else {
  8948. type = 8;
  8949. }
  8950. }
  8951. vnode.children = children;
  8952. vnode.shapeFlag |= type;
  8953. }
  8954. function mergeProps(...args) {
  8955. const ret = {};
  8956. for (let i = 0; i < args.length; i++) {
  8957. const toMerge = args[i];
  8958. for (const key in toMerge) {
  8959. if (key === "class") {
  8960. if (ret.class !== toMerge.class) {
  8961. ret.class = normalizeClass([ret.class, toMerge.class]);
  8962. }
  8963. } else if (key === "style") {
  8964. ret.style = normalizeStyle([ret.style, toMerge.style]);
  8965. } else if (isOn(key)) {
  8966. const existing = ret[key];
  8967. const incoming = toMerge[key];
  8968. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  8969. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  8970. }
  8971. } else if (key !== "") {
  8972. ret[key] = toMerge[key];
  8973. }
  8974. }
  8975. }
  8976. return ret;
  8977. }
  8978. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  8979. callWithAsyncErrorHandling(hook, instance, 7, [
  8980. vnode,
  8981. prevVNode
  8982. ]);
  8983. }
  8984. const emptyAppContext = createAppContext();
  8985. let uid = 0;
  8986. function createComponentInstance(vnode, parent, suspense) {
  8987. const type = vnode.type;
  8988. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  8989. const instance = {
  8990. uid: uid++,
  8991. vnode,
  8992. type,
  8993. parent,
  8994. appContext,
  8995. root: null,
  8996. // to be immediately set
  8997. next: null,
  8998. subTree: null,
  8999. // will be set synchronously right after creation
  9000. effect: null,
  9001. update: null,
  9002. // will be set synchronously right after creation
  9003. scope: new EffectScope(
  9004. true
  9005. /* detached */
  9006. ),
  9007. render: null,
  9008. proxy: null,
  9009. exposed: null,
  9010. exposeProxy: null,
  9011. withProxy: null,
  9012. provides: parent ? parent.provides : Object.create(appContext.provides),
  9013. accessCache: null,
  9014. renderCache: [],
  9015. // local resolved assets
  9016. components: null,
  9017. directives: null,
  9018. // resolved props and emits options
  9019. propsOptions: normalizePropsOptions(type, appContext),
  9020. emitsOptions: normalizeEmitsOptions(type, appContext),
  9021. // emit
  9022. emit: null,
  9023. // to be set immediately
  9024. emitted: null,
  9025. // props default value
  9026. propsDefaults: EMPTY_OBJ,
  9027. // inheritAttrs
  9028. inheritAttrs: type.inheritAttrs,
  9029. // state
  9030. ctx: EMPTY_OBJ,
  9031. data: EMPTY_OBJ,
  9032. props: EMPTY_OBJ,
  9033. attrs: EMPTY_OBJ,
  9034. slots: EMPTY_OBJ,
  9035. refs: EMPTY_OBJ,
  9036. setupState: EMPTY_OBJ,
  9037. setupContext: null,
  9038. // suspense related
  9039. suspense,
  9040. suspenseId: suspense ? suspense.pendingId : 0,
  9041. asyncDep: null,
  9042. asyncResolved: false,
  9043. // lifecycle hooks
  9044. // not using enums here because it results in computed properties
  9045. isMounted: false,
  9046. isUnmounted: false,
  9047. isDeactivated: false,
  9048. bc: null,
  9049. c: null,
  9050. bm: null,
  9051. m: null,
  9052. bu: null,
  9053. u: null,
  9054. um: null,
  9055. bum: null,
  9056. da: null,
  9057. a: null,
  9058. rtg: null,
  9059. rtc: null,
  9060. ec: null,
  9061. sp: null
  9062. };
  9063. {
  9064. instance.ctx = createDevRenderContext(instance);
  9065. }
  9066. instance.root = parent ? parent.root : instance;
  9067. instance.emit = emit.bind(null, instance);
  9068. if (vnode.ce) {
  9069. vnode.ce(instance);
  9070. }
  9071. return instance;
  9072. }
  9073. let currentInstance = null;
  9074. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  9075. let internalSetCurrentInstance;
  9076. let setInSSRSetupState;
  9077. {
  9078. internalSetCurrentInstance = (i) => {
  9079. currentInstance = i;
  9080. };
  9081. setInSSRSetupState = (v) => {
  9082. isInSSRComponentSetup = v;
  9083. };
  9084. }
  9085. const setCurrentInstance = (instance) => {
  9086. const prev = currentInstance;
  9087. internalSetCurrentInstance(instance);
  9088. instance.scope.on();
  9089. return () => {
  9090. instance.scope.off();
  9091. internalSetCurrentInstance(prev);
  9092. };
  9093. };
  9094. const unsetCurrentInstance = () => {
  9095. currentInstance && currentInstance.scope.off();
  9096. internalSetCurrentInstance(null);
  9097. };
  9098. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  9099. function validateComponentName(name, { isNativeTag }) {
  9100. if (isBuiltInTag(name) || isNativeTag(name)) {
  9101. warn$1(
  9102. "Do not use built-in or reserved HTML elements as component id: " + name
  9103. );
  9104. }
  9105. }
  9106. function isStatefulComponent(instance) {
  9107. return instance.vnode.shapeFlag & 4;
  9108. }
  9109. let isInSSRComponentSetup = false;
  9110. function setupComponent(instance, isSSR = false, optimized = false) {
  9111. isSSR && setInSSRSetupState(isSSR);
  9112. const { props, children } = instance.vnode;
  9113. const isStateful = isStatefulComponent(instance);
  9114. initProps(instance, props, isStateful, isSSR);
  9115. initSlots(instance, children, optimized);
  9116. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  9117. isSSR && setInSSRSetupState(false);
  9118. return setupResult;
  9119. }
  9120. function setupStatefulComponent(instance, isSSR) {
  9121. var _a;
  9122. const Component = instance.type;
  9123. {
  9124. if (Component.name) {
  9125. validateComponentName(Component.name, instance.appContext.config);
  9126. }
  9127. if (Component.components) {
  9128. const names = Object.keys(Component.components);
  9129. for (let i = 0; i < names.length; i++) {
  9130. validateComponentName(names[i], instance.appContext.config);
  9131. }
  9132. }
  9133. if (Component.directives) {
  9134. const names = Object.keys(Component.directives);
  9135. for (let i = 0; i < names.length; i++) {
  9136. validateDirectiveName(names[i]);
  9137. }
  9138. }
  9139. if (Component.compilerOptions && isRuntimeOnly()) {
  9140. warn$1(
  9141. `"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.`
  9142. );
  9143. }
  9144. }
  9145. instance.accessCache = /* @__PURE__ */ Object.create(null);
  9146. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  9147. {
  9148. exposePropsOnRenderContext(instance);
  9149. }
  9150. const { setup } = Component;
  9151. if (setup) {
  9152. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  9153. const reset = setCurrentInstance(instance);
  9154. pauseTracking();
  9155. const setupResult = callWithErrorHandling(
  9156. setup,
  9157. instance,
  9158. 0,
  9159. [
  9160. shallowReadonly(instance.props) ,
  9161. setupContext
  9162. ]
  9163. );
  9164. resetTracking();
  9165. reset();
  9166. if (isPromise(setupResult)) {
  9167. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  9168. if (isSSR) {
  9169. return setupResult.then((resolvedResult) => {
  9170. handleSetupResult(instance, resolvedResult, isSSR);
  9171. }).catch((e) => {
  9172. handleError(e, instance, 0);
  9173. });
  9174. } else {
  9175. instance.asyncDep = setupResult;
  9176. if (!instance.suspense) {
  9177. const name = (_a = Component.name) != null ? _a : "Anonymous";
  9178. warn$1(
  9179. `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.`
  9180. );
  9181. }
  9182. }
  9183. } else {
  9184. handleSetupResult(instance, setupResult, isSSR);
  9185. }
  9186. } else {
  9187. finishComponentSetup(instance, isSSR);
  9188. }
  9189. }
  9190. function handleSetupResult(instance, setupResult, isSSR) {
  9191. if (isFunction(setupResult)) {
  9192. {
  9193. instance.render = setupResult;
  9194. }
  9195. } else if (isObject(setupResult)) {
  9196. if (isVNode(setupResult)) {
  9197. warn$1(
  9198. `setup() should not return VNodes directly - return a render function instead.`
  9199. );
  9200. }
  9201. {
  9202. instance.devtoolsRawSetupState = setupResult;
  9203. }
  9204. instance.setupState = proxyRefs(setupResult);
  9205. {
  9206. exposeSetupStateOnRenderContext(instance);
  9207. }
  9208. } else if (setupResult !== void 0) {
  9209. warn$1(
  9210. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  9211. );
  9212. }
  9213. finishComponentSetup(instance, isSSR);
  9214. }
  9215. let compile$1;
  9216. let installWithProxy;
  9217. function registerRuntimeCompiler(_compile) {
  9218. compile$1 = _compile;
  9219. installWithProxy = (i) => {
  9220. if (i.render._rc) {
  9221. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  9222. }
  9223. };
  9224. }
  9225. const isRuntimeOnly = () => !compile$1;
  9226. function finishComponentSetup(instance, isSSR, skipOptions) {
  9227. const Component = instance.type;
  9228. if (!instance.render) {
  9229. if (!isSSR && compile$1 && !Component.render) {
  9230. const template = Component.template || resolveMergedOptions(instance).template;
  9231. if (template) {
  9232. {
  9233. startMeasure(instance, `compile`);
  9234. }
  9235. const { isCustomElement, compilerOptions } = instance.appContext.config;
  9236. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  9237. const finalCompilerOptions = extend(
  9238. extend(
  9239. {
  9240. isCustomElement,
  9241. delimiters
  9242. },
  9243. compilerOptions
  9244. ),
  9245. componentCompilerOptions
  9246. );
  9247. Component.render = compile$1(template, finalCompilerOptions);
  9248. {
  9249. endMeasure(instance, `compile`);
  9250. }
  9251. }
  9252. }
  9253. instance.render = Component.render || NOOP;
  9254. if (installWithProxy) {
  9255. installWithProxy(instance);
  9256. }
  9257. }
  9258. {
  9259. const reset = setCurrentInstance(instance);
  9260. pauseTracking();
  9261. try {
  9262. applyOptions(instance);
  9263. } finally {
  9264. resetTracking();
  9265. reset();
  9266. }
  9267. }
  9268. if (!Component.render && instance.render === NOOP && !isSSR) {
  9269. if (!compile$1 && Component.template) {
  9270. warn$1(
  9271. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
  9272. );
  9273. } else {
  9274. warn$1(`Component is missing template or render function: `, Component);
  9275. }
  9276. }
  9277. }
  9278. const attrsProxyHandlers = {
  9279. get(target, key) {
  9280. markAttrsAccessed();
  9281. track(target, "get", "");
  9282. return target[key];
  9283. },
  9284. set() {
  9285. warn$1(`setupContext.attrs is readonly.`);
  9286. return false;
  9287. },
  9288. deleteProperty() {
  9289. warn$1(`setupContext.attrs is readonly.`);
  9290. return false;
  9291. }
  9292. } ;
  9293. function getSlotsProxy(instance) {
  9294. return new Proxy(instance.slots, {
  9295. get(target, key) {
  9296. track(instance, "get", "$slots");
  9297. return target[key];
  9298. }
  9299. });
  9300. }
  9301. function createSetupContext(instance) {
  9302. const expose = (exposed) => {
  9303. {
  9304. if (instance.exposed) {
  9305. warn$1(`expose() should be called only once per setup().`);
  9306. }
  9307. if (exposed != null) {
  9308. let exposedType = typeof exposed;
  9309. if (exposedType === "object") {
  9310. if (isArray(exposed)) {
  9311. exposedType = "array";
  9312. } else if (isRef(exposed)) {
  9313. exposedType = "ref";
  9314. }
  9315. }
  9316. if (exposedType !== "object") {
  9317. warn$1(
  9318. `expose() should be passed a plain object, received ${exposedType}.`
  9319. );
  9320. }
  9321. }
  9322. }
  9323. instance.exposed = exposed || {};
  9324. };
  9325. {
  9326. let attrsProxy;
  9327. let slotsProxy;
  9328. return Object.freeze({
  9329. get attrs() {
  9330. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  9331. },
  9332. get slots() {
  9333. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  9334. },
  9335. get emit() {
  9336. return (event, ...args) => instance.emit(event, ...args);
  9337. },
  9338. expose
  9339. });
  9340. }
  9341. }
  9342. function getComponentPublicInstance(instance) {
  9343. if (instance.exposed) {
  9344. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  9345. get(target, key) {
  9346. if (key in target) {
  9347. return target[key];
  9348. } else if (key in publicPropertiesMap) {
  9349. return publicPropertiesMap[key](instance);
  9350. }
  9351. },
  9352. has(target, key) {
  9353. return key in target || key in publicPropertiesMap;
  9354. }
  9355. }));
  9356. } else {
  9357. return instance.proxy;
  9358. }
  9359. }
  9360. const classifyRE = /(?:^|[-_])(\w)/g;
  9361. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  9362. function getComponentName(Component, includeInferred = true) {
  9363. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  9364. }
  9365. function formatComponentName(instance, Component, isRoot = false) {
  9366. let name = getComponentName(Component);
  9367. if (!name && Component.__file) {
  9368. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  9369. if (match) {
  9370. name = match[1];
  9371. }
  9372. }
  9373. if (!name && instance && instance.parent) {
  9374. const inferFromRegistry = (registry) => {
  9375. for (const key in registry) {
  9376. if (registry[key] === Component) {
  9377. return key;
  9378. }
  9379. }
  9380. };
  9381. name = inferFromRegistry(
  9382. instance.components || instance.parent.type.components
  9383. ) || inferFromRegistry(instance.appContext.components);
  9384. }
  9385. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  9386. }
  9387. function isClassComponent(value) {
  9388. return isFunction(value) && "__vccOpts" in value;
  9389. }
  9390. const computed = (getterOrOptions, debugOptions) => {
  9391. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  9392. {
  9393. const i = getCurrentInstance();
  9394. if (i && i.appContext.config.warnRecursiveComputed) {
  9395. c._warnRecursive = true;
  9396. }
  9397. }
  9398. return c;
  9399. };
  9400. function h(type, propsOrChildren, children) {
  9401. const l = arguments.length;
  9402. if (l === 2) {
  9403. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  9404. if (isVNode(propsOrChildren)) {
  9405. return createVNode(type, null, [propsOrChildren]);
  9406. }
  9407. return createVNode(type, propsOrChildren);
  9408. } else {
  9409. return createVNode(type, null, propsOrChildren);
  9410. }
  9411. } else {
  9412. if (l > 3) {
  9413. children = Array.prototype.slice.call(arguments, 2);
  9414. } else if (l === 3 && isVNode(children)) {
  9415. children = [children];
  9416. }
  9417. return createVNode(type, propsOrChildren, children);
  9418. }
  9419. }
  9420. function initCustomFormatter() {
  9421. if (typeof window === "undefined") {
  9422. return;
  9423. }
  9424. const vueStyle = { style: "color:#3ba776" };
  9425. const numberStyle = { style: "color:#1677ff" };
  9426. const stringStyle = { style: "color:#f5222d" };
  9427. const keywordStyle = { style: "color:#eb2f96" };
  9428. const formatter = {
  9429. __vue_custom_formatter: true,
  9430. header(obj) {
  9431. if (!isObject(obj)) {
  9432. return null;
  9433. }
  9434. if (obj.__isVue) {
  9435. return ["div", vueStyle, `VueInstance`];
  9436. } else if (isRef(obj)) {
  9437. return [
  9438. "div",
  9439. {},
  9440. ["span", vueStyle, genRefFlag(obj)],
  9441. "<",
  9442. formatValue(obj.value),
  9443. `>`
  9444. ];
  9445. } else if (isReactive(obj)) {
  9446. return [
  9447. "div",
  9448. {},
  9449. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  9450. "<",
  9451. formatValue(obj),
  9452. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  9453. ];
  9454. } else if (isReadonly(obj)) {
  9455. return [
  9456. "div",
  9457. {},
  9458. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  9459. "<",
  9460. formatValue(obj),
  9461. ">"
  9462. ];
  9463. }
  9464. return null;
  9465. },
  9466. hasBody(obj) {
  9467. return obj && obj.__isVue;
  9468. },
  9469. body(obj) {
  9470. if (obj && obj.__isVue) {
  9471. return [
  9472. "div",
  9473. {},
  9474. ...formatInstance(obj.$)
  9475. ];
  9476. }
  9477. }
  9478. };
  9479. function formatInstance(instance) {
  9480. const blocks = [];
  9481. if (instance.type.props && instance.props) {
  9482. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  9483. }
  9484. if (instance.setupState !== EMPTY_OBJ) {
  9485. blocks.push(createInstanceBlock("setup", instance.setupState));
  9486. }
  9487. if (instance.data !== EMPTY_OBJ) {
  9488. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  9489. }
  9490. const computed = extractKeys(instance, "computed");
  9491. if (computed) {
  9492. blocks.push(createInstanceBlock("computed", computed));
  9493. }
  9494. const injected = extractKeys(instance, "inject");
  9495. if (injected) {
  9496. blocks.push(createInstanceBlock("injected", injected));
  9497. }
  9498. blocks.push([
  9499. "div",
  9500. {},
  9501. [
  9502. "span",
  9503. {
  9504. style: keywordStyle.style + ";opacity:0.66"
  9505. },
  9506. "$ (internal): "
  9507. ],
  9508. ["object", { object: instance }]
  9509. ]);
  9510. return blocks;
  9511. }
  9512. function createInstanceBlock(type, target) {
  9513. target = extend({}, target);
  9514. if (!Object.keys(target).length) {
  9515. return ["span", {}];
  9516. }
  9517. return [
  9518. "div",
  9519. { style: "line-height:1.25em;margin-bottom:0.6em" },
  9520. [
  9521. "div",
  9522. {
  9523. style: "color:#476582"
  9524. },
  9525. type
  9526. ],
  9527. [
  9528. "div",
  9529. {
  9530. style: "padding-left:1.25em"
  9531. },
  9532. ...Object.keys(target).map((key) => {
  9533. return [
  9534. "div",
  9535. {},
  9536. ["span", keywordStyle, key + ": "],
  9537. formatValue(target[key], false)
  9538. ];
  9539. })
  9540. ]
  9541. ];
  9542. }
  9543. function formatValue(v, asRaw = true) {
  9544. if (typeof v === "number") {
  9545. return ["span", numberStyle, v];
  9546. } else if (typeof v === "string") {
  9547. return ["span", stringStyle, JSON.stringify(v)];
  9548. } else if (typeof v === "boolean") {
  9549. return ["span", keywordStyle, v];
  9550. } else if (isObject(v)) {
  9551. return ["object", { object: asRaw ? toRaw(v) : v }];
  9552. } else {
  9553. return ["span", stringStyle, String(v)];
  9554. }
  9555. }
  9556. function extractKeys(instance, type) {
  9557. const Comp = instance.type;
  9558. if (isFunction(Comp)) {
  9559. return;
  9560. }
  9561. const extracted = {};
  9562. for (const key in instance.ctx) {
  9563. if (isKeyOfType(Comp, key, type)) {
  9564. extracted[key] = instance.ctx[key];
  9565. }
  9566. }
  9567. return extracted;
  9568. }
  9569. function isKeyOfType(Comp, key, type) {
  9570. const opts = Comp[type];
  9571. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  9572. return true;
  9573. }
  9574. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  9575. return true;
  9576. }
  9577. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  9578. return true;
  9579. }
  9580. }
  9581. function genRefFlag(v) {
  9582. if (isShallow(v)) {
  9583. return `ShallowRef`;
  9584. }
  9585. if (v.effect) {
  9586. return `ComputedRef`;
  9587. }
  9588. return `Ref`;
  9589. }
  9590. if (window.devtoolsFormatters) {
  9591. window.devtoolsFormatters.push(formatter);
  9592. } else {
  9593. window.devtoolsFormatters = [formatter];
  9594. }
  9595. }
  9596. function withMemo(memo, render, cache, index) {
  9597. const cached = cache[index];
  9598. if (cached && isMemoSame(cached, memo)) {
  9599. return cached;
  9600. }
  9601. const ret = render();
  9602. ret.memo = memo.slice();
  9603. ret.cacheIndex = index;
  9604. return cache[index] = ret;
  9605. }
  9606. function isMemoSame(cached, memo) {
  9607. const prev = cached.memo;
  9608. if (prev.length != memo.length) {
  9609. return false;
  9610. }
  9611. for (let i = 0; i < prev.length; i++) {
  9612. if (hasChanged(prev[i], memo[i])) {
  9613. return false;
  9614. }
  9615. }
  9616. if (isBlockTreeEnabled > 0 && currentBlock) {
  9617. currentBlock.push(cached);
  9618. }
  9619. return true;
  9620. }
  9621. const version = "3.4.38";
  9622. const warn = warn$1 ;
  9623. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  9624. const devtools = devtools$1 ;
  9625. const setDevtoolsHook = setDevtoolsHook$1 ;
  9626. const ssrUtils = null;
  9627. const resolveFilter = null;
  9628. const compatUtils = null;
  9629. const DeprecationTypes = null;
  9630. const svgNS = "http://www.w3.org/2000/svg";
  9631. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  9632. const doc = typeof document !== "undefined" ? document : null;
  9633. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  9634. const nodeOps = {
  9635. insert: (child, parent, anchor) => {
  9636. parent.insertBefore(child, anchor || null);
  9637. },
  9638. remove: (child) => {
  9639. const parent = child.parentNode;
  9640. if (parent) {
  9641. parent.removeChild(child);
  9642. }
  9643. },
  9644. createElement: (tag, namespace, is, props) => {
  9645. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  9646. if (tag === "select" && props && props.multiple != null) {
  9647. el.setAttribute("multiple", props.multiple);
  9648. }
  9649. return el;
  9650. },
  9651. createText: (text) => doc.createTextNode(text),
  9652. createComment: (text) => doc.createComment(text),
  9653. setText: (node, text) => {
  9654. node.nodeValue = text;
  9655. },
  9656. setElementText: (el, text) => {
  9657. el.textContent = text;
  9658. },
  9659. parentNode: (node) => node.parentNode,
  9660. nextSibling: (node) => node.nextSibling,
  9661. querySelector: (selector) => doc.querySelector(selector),
  9662. setScopeId(el, id) {
  9663. el.setAttribute(id, "");
  9664. },
  9665. // __UNSAFE__
  9666. // Reason: innerHTML.
  9667. // Static content here can only come from compiled templates.
  9668. // As long as the user only uses trusted templates, this is safe.
  9669. insertStaticContent(content, parent, anchor, namespace, start, end) {
  9670. const before = anchor ? anchor.previousSibling : parent.lastChild;
  9671. if (start && (start === end || start.nextSibling)) {
  9672. while (true) {
  9673. parent.insertBefore(start.cloneNode(true), anchor);
  9674. if (start === end || !(start = start.nextSibling)) break;
  9675. }
  9676. } else {
  9677. templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
  9678. const template = templateContainer.content;
  9679. if (namespace === "svg" || namespace === "mathml") {
  9680. const wrapper = template.firstChild;
  9681. while (wrapper.firstChild) {
  9682. template.appendChild(wrapper.firstChild);
  9683. }
  9684. template.removeChild(wrapper);
  9685. }
  9686. parent.insertBefore(template, anchor);
  9687. }
  9688. return [
  9689. // first
  9690. before ? before.nextSibling : parent.firstChild,
  9691. // last
  9692. anchor ? anchor.previousSibling : parent.lastChild
  9693. ];
  9694. }
  9695. };
  9696. const TRANSITION$1 = "transition";
  9697. const ANIMATION = "animation";
  9698. const vtcKey = Symbol("_vtc");
  9699. const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
  9700. Transition.displayName = "Transition";
  9701. const DOMTransitionPropsValidators = {
  9702. name: String,
  9703. type: String,
  9704. css: {
  9705. type: Boolean,
  9706. default: true
  9707. },
  9708. duration: [String, Number, Object],
  9709. enterFromClass: String,
  9710. enterActiveClass: String,
  9711. enterToClass: String,
  9712. appearFromClass: String,
  9713. appearActiveClass: String,
  9714. appearToClass: String,
  9715. leaveFromClass: String,
  9716. leaveActiveClass: String,
  9717. leaveToClass: String
  9718. };
  9719. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
  9720. {},
  9721. BaseTransitionPropsValidators,
  9722. DOMTransitionPropsValidators
  9723. );
  9724. const callHook = (hook, args = []) => {
  9725. if (isArray(hook)) {
  9726. hook.forEach((h2) => h2(...args));
  9727. } else if (hook) {
  9728. hook(...args);
  9729. }
  9730. };
  9731. const hasExplicitCallback = (hook) => {
  9732. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  9733. };
  9734. function resolveTransitionProps(rawProps) {
  9735. const baseProps = {};
  9736. for (const key in rawProps) {
  9737. if (!(key in DOMTransitionPropsValidators)) {
  9738. baseProps[key] = rawProps[key];
  9739. }
  9740. }
  9741. if (rawProps.css === false) {
  9742. return baseProps;
  9743. }
  9744. const {
  9745. name = "v",
  9746. type,
  9747. duration,
  9748. enterFromClass = `${name}-enter-from`,
  9749. enterActiveClass = `${name}-enter-active`,
  9750. enterToClass = `${name}-enter-to`,
  9751. appearFromClass = enterFromClass,
  9752. appearActiveClass = enterActiveClass,
  9753. appearToClass = enterToClass,
  9754. leaveFromClass = `${name}-leave-from`,
  9755. leaveActiveClass = `${name}-leave-active`,
  9756. leaveToClass = `${name}-leave-to`
  9757. } = rawProps;
  9758. const durations = normalizeDuration(duration);
  9759. const enterDuration = durations && durations[0];
  9760. const leaveDuration = durations && durations[1];
  9761. const {
  9762. onBeforeEnter,
  9763. onEnter,
  9764. onEnterCancelled,
  9765. onLeave,
  9766. onLeaveCancelled,
  9767. onBeforeAppear = onBeforeEnter,
  9768. onAppear = onEnter,
  9769. onAppearCancelled = onEnterCancelled
  9770. } = baseProps;
  9771. const finishEnter = (el, isAppear, done) => {
  9772. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9773. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  9774. done && done();
  9775. };
  9776. const finishLeave = (el, done) => {
  9777. el._isLeaving = false;
  9778. removeTransitionClass(el, leaveFromClass);
  9779. removeTransitionClass(el, leaveToClass);
  9780. removeTransitionClass(el, leaveActiveClass);
  9781. done && done();
  9782. };
  9783. const makeEnterHook = (isAppear) => {
  9784. return (el, done) => {
  9785. const hook = isAppear ? onAppear : onEnter;
  9786. const resolve = () => finishEnter(el, isAppear, done);
  9787. callHook(hook, [el, resolve]);
  9788. nextFrame(() => {
  9789. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  9790. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9791. if (!hasExplicitCallback(hook)) {
  9792. whenTransitionEnds(el, type, enterDuration, resolve);
  9793. }
  9794. });
  9795. };
  9796. };
  9797. return extend(baseProps, {
  9798. onBeforeEnter(el) {
  9799. callHook(onBeforeEnter, [el]);
  9800. addTransitionClass(el, enterFromClass);
  9801. addTransitionClass(el, enterActiveClass);
  9802. },
  9803. onBeforeAppear(el) {
  9804. callHook(onBeforeAppear, [el]);
  9805. addTransitionClass(el, appearFromClass);
  9806. addTransitionClass(el, appearActiveClass);
  9807. },
  9808. onEnter: makeEnterHook(false),
  9809. onAppear: makeEnterHook(true),
  9810. onLeave(el, done) {
  9811. el._isLeaving = true;
  9812. const resolve = () => finishLeave(el, done);
  9813. addTransitionClass(el, leaveFromClass);
  9814. addTransitionClass(el, leaveActiveClass);
  9815. forceReflow();
  9816. nextFrame(() => {
  9817. if (!el._isLeaving) {
  9818. return;
  9819. }
  9820. removeTransitionClass(el, leaveFromClass);
  9821. addTransitionClass(el, leaveToClass);
  9822. if (!hasExplicitCallback(onLeave)) {
  9823. whenTransitionEnds(el, type, leaveDuration, resolve);
  9824. }
  9825. });
  9826. callHook(onLeave, [el, resolve]);
  9827. },
  9828. onEnterCancelled(el) {
  9829. finishEnter(el, false);
  9830. callHook(onEnterCancelled, [el]);
  9831. },
  9832. onAppearCancelled(el) {
  9833. finishEnter(el, true);
  9834. callHook(onAppearCancelled, [el]);
  9835. },
  9836. onLeaveCancelled(el) {
  9837. finishLeave(el);
  9838. callHook(onLeaveCancelled, [el]);
  9839. }
  9840. });
  9841. }
  9842. function normalizeDuration(duration) {
  9843. if (duration == null) {
  9844. return null;
  9845. } else if (isObject(duration)) {
  9846. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  9847. } else {
  9848. const n = NumberOf(duration);
  9849. return [n, n];
  9850. }
  9851. }
  9852. function NumberOf(val) {
  9853. const res = toNumber(val);
  9854. {
  9855. assertNumber(res, "<transition> explicit duration");
  9856. }
  9857. return res;
  9858. }
  9859. function addTransitionClass(el, cls) {
  9860. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  9861. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  9862. }
  9863. function removeTransitionClass(el, cls) {
  9864. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  9865. const _vtc = el[vtcKey];
  9866. if (_vtc) {
  9867. _vtc.delete(cls);
  9868. if (!_vtc.size) {
  9869. el[vtcKey] = void 0;
  9870. }
  9871. }
  9872. }
  9873. function nextFrame(cb) {
  9874. requestAnimationFrame(() => {
  9875. requestAnimationFrame(cb);
  9876. });
  9877. }
  9878. let endId = 0;
  9879. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  9880. const id = el._endId = ++endId;
  9881. const resolveIfNotStale = () => {
  9882. if (id === el._endId) {
  9883. resolve();
  9884. }
  9885. };
  9886. if (explicitTimeout) {
  9887. return setTimeout(resolveIfNotStale, explicitTimeout);
  9888. }
  9889. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  9890. if (!type) {
  9891. return resolve();
  9892. }
  9893. const endEvent = type + "end";
  9894. let ended = 0;
  9895. const end = () => {
  9896. el.removeEventListener(endEvent, onEnd);
  9897. resolveIfNotStale();
  9898. };
  9899. const onEnd = (e) => {
  9900. if (e.target === el && ++ended >= propCount) {
  9901. end();
  9902. }
  9903. };
  9904. setTimeout(() => {
  9905. if (ended < propCount) {
  9906. end();
  9907. }
  9908. }, timeout + 1);
  9909. el.addEventListener(endEvent, onEnd);
  9910. }
  9911. function getTransitionInfo(el, expectedType) {
  9912. const styles = window.getComputedStyle(el);
  9913. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  9914. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  9915. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  9916. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  9917. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  9918. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  9919. const animationTimeout = getTimeout(animationDelays, animationDurations);
  9920. let type = null;
  9921. let timeout = 0;
  9922. let propCount = 0;
  9923. if (expectedType === TRANSITION$1) {
  9924. if (transitionTimeout > 0) {
  9925. type = TRANSITION$1;
  9926. timeout = transitionTimeout;
  9927. propCount = transitionDurations.length;
  9928. }
  9929. } else if (expectedType === ANIMATION) {
  9930. if (animationTimeout > 0) {
  9931. type = ANIMATION;
  9932. timeout = animationTimeout;
  9933. propCount = animationDurations.length;
  9934. }
  9935. } else {
  9936. timeout = Math.max(transitionTimeout, animationTimeout);
  9937. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  9938. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  9939. }
  9940. const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
  9941. getStyleProperties(`${TRANSITION$1}Property`).toString()
  9942. );
  9943. return {
  9944. type,
  9945. timeout,
  9946. propCount,
  9947. hasTransform
  9948. };
  9949. }
  9950. function getTimeout(delays, durations) {
  9951. while (delays.length < durations.length) {
  9952. delays = delays.concat(delays);
  9953. }
  9954. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  9955. }
  9956. function toMs(s) {
  9957. if (s === "auto") return 0;
  9958. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  9959. }
  9960. function forceReflow() {
  9961. return document.body.offsetHeight;
  9962. }
  9963. function patchClass(el, value, isSVG) {
  9964. const transitionClasses = el[vtcKey];
  9965. if (transitionClasses) {
  9966. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  9967. }
  9968. if (value == null) {
  9969. el.removeAttribute("class");
  9970. } else if (isSVG) {
  9971. el.setAttribute("class", value);
  9972. } else {
  9973. el.className = value;
  9974. }
  9975. }
  9976. const vShowOriginalDisplay = Symbol("_vod");
  9977. const vShowHidden = Symbol("_vsh");
  9978. const vShow = {
  9979. beforeMount(el, { value }, { transition }) {
  9980. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  9981. if (transition && value) {
  9982. transition.beforeEnter(el);
  9983. } else {
  9984. setDisplay(el, value);
  9985. }
  9986. },
  9987. mounted(el, { value }, { transition }) {
  9988. if (transition && value) {
  9989. transition.enter(el);
  9990. }
  9991. },
  9992. updated(el, { value, oldValue }, { transition }) {
  9993. if (!value === !oldValue) return;
  9994. if (transition) {
  9995. if (value) {
  9996. transition.beforeEnter(el);
  9997. setDisplay(el, true);
  9998. transition.enter(el);
  9999. } else {
  10000. transition.leave(el, () => {
  10001. setDisplay(el, false);
  10002. });
  10003. }
  10004. } else {
  10005. setDisplay(el, value);
  10006. }
  10007. },
  10008. beforeUnmount(el, { value }) {
  10009. setDisplay(el, value);
  10010. }
  10011. };
  10012. {
  10013. vShow.name = "show";
  10014. }
  10015. function setDisplay(el, value) {
  10016. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  10017. el[vShowHidden] = !value;
  10018. }
  10019. const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
  10020. function useCssVars(getter) {
  10021. const instance = getCurrentInstance();
  10022. if (!instance) {
  10023. warn(`useCssVars is called without current active component instance.`);
  10024. return;
  10025. }
  10026. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  10027. Array.from(
  10028. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  10029. ).forEach((node) => setVarsOnNode(node, vars));
  10030. };
  10031. {
  10032. instance.getCssVars = () => getter(instance.proxy);
  10033. }
  10034. const setVars = () => {
  10035. const vars = getter(instance.proxy);
  10036. setVarsOnVNode(instance.subTree, vars);
  10037. updateTeleports(vars);
  10038. };
  10039. onBeforeMount(() => {
  10040. watchPostEffect(setVars);
  10041. });
  10042. onMounted(() => {
  10043. const ob = new MutationObserver(setVars);
  10044. ob.observe(instance.subTree.el.parentNode, { childList: true });
  10045. onUnmounted(() => ob.disconnect());
  10046. });
  10047. }
  10048. function setVarsOnVNode(vnode, vars) {
  10049. if (vnode.shapeFlag & 128) {
  10050. const suspense = vnode.suspense;
  10051. vnode = suspense.activeBranch;
  10052. if (suspense.pendingBranch && !suspense.isHydrating) {
  10053. suspense.effects.push(() => {
  10054. setVarsOnVNode(suspense.activeBranch, vars);
  10055. });
  10056. }
  10057. }
  10058. while (vnode.component) {
  10059. vnode = vnode.component.subTree;
  10060. }
  10061. if (vnode.shapeFlag & 1 && vnode.el) {
  10062. setVarsOnNode(vnode.el, vars);
  10063. } else if (vnode.type === Fragment) {
  10064. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  10065. } else if (vnode.type === Static) {
  10066. let { el, anchor } = vnode;
  10067. while (el) {
  10068. setVarsOnNode(el, vars);
  10069. if (el === anchor) break;
  10070. el = el.nextSibling;
  10071. }
  10072. }
  10073. }
  10074. function setVarsOnNode(el, vars) {
  10075. if (el.nodeType === 1) {
  10076. const style = el.style;
  10077. let cssText = "";
  10078. for (const key in vars) {
  10079. style.setProperty(`--${key}`, vars[key]);
  10080. cssText += `--${key}: ${vars[key]};`;
  10081. }
  10082. style[CSS_VAR_TEXT] = cssText;
  10083. }
  10084. }
  10085. const displayRE = /(^|;)\s*display\s*:/;
  10086. function patchStyle(el, prev, next) {
  10087. const style = el.style;
  10088. const isCssString = isString(next);
  10089. let hasControlledDisplay = false;
  10090. if (next && !isCssString) {
  10091. if (prev) {
  10092. if (!isString(prev)) {
  10093. for (const key in prev) {
  10094. if (next[key] == null) {
  10095. setStyle(style, key, "");
  10096. }
  10097. }
  10098. } else {
  10099. for (const prevStyle of prev.split(";")) {
  10100. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  10101. if (next[key] == null) {
  10102. setStyle(style, key, "");
  10103. }
  10104. }
  10105. }
  10106. }
  10107. for (const key in next) {
  10108. if (key === "display") {
  10109. hasControlledDisplay = true;
  10110. }
  10111. setStyle(style, key, next[key]);
  10112. }
  10113. } else {
  10114. if (isCssString) {
  10115. if (prev !== next) {
  10116. const cssVarText = style[CSS_VAR_TEXT];
  10117. if (cssVarText) {
  10118. next += ";" + cssVarText;
  10119. }
  10120. style.cssText = next;
  10121. hasControlledDisplay = displayRE.test(next);
  10122. }
  10123. } else if (prev) {
  10124. el.removeAttribute("style");
  10125. }
  10126. }
  10127. if (vShowOriginalDisplay in el) {
  10128. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  10129. if (el[vShowHidden]) {
  10130. style.display = "none";
  10131. }
  10132. }
  10133. }
  10134. const semicolonRE = /[^\\];\s*$/;
  10135. const importantRE = /\s*!important$/;
  10136. function setStyle(style, name, val) {
  10137. if (isArray(val)) {
  10138. val.forEach((v) => setStyle(style, name, v));
  10139. } else {
  10140. if (val == null) val = "";
  10141. {
  10142. if (semicolonRE.test(val)) {
  10143. warn(
  10144. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  10145. );
  10146. }
  10147. }
  10148. if (name.startsWith("--")) {
  10149. style.setProperty(name, val);
  10150. } else {
  10151. const prefixed = autoPrefix(style, name);
  10152. if (importantRE.test(val)) {
  10153. style.setProperty(
  10154. hyphenate(prefixed),
  10155. val.replace(importantRE, ""),
  10156. "important"
  10157. );
  10158. } else {
  10159. style[prefixed] = val;
  10160. }
  10161. }
  10162. }
  10163. }
  10164. const prefixes = ["Webkit", "Moz", "ms"];
  10165. const prefixCache = {};
  10166. function autoPrefix(style, rawName) {
  10167. const cached = prefixCache[rawName];
  10168. if (cached) {
  10169. return cached;
  10170. }
  10171. let name = camelize(rawName);
  10172. if (name !== "filter" && name in style) {
  10173. return prefixCache[rawName] = name;
  10174. }
  10175. name = capitalize(name);
  10176. for (let i = 0; i < prefixes.length; i++) {
  10177. const prefixed = prefixes[i] + name;
  10178. if (prefixed in style) {
  10179. return prefixCache[rawName] = prefixed;
  10180. }
  10181. }
  10182. return rawName;
  10183. }
  10184. const xlinkNS = "http://www.w3.org/1999/xlink";
  10185. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  10186. if (isSVG && key.startsWith("xlink:")) {
  10187. if (value == null) {
  10188. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  10189. } else {
  10190. el.setAttributeNS(xlinkNS, key, value);
  10191. }
  10192. } else {
  10193. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  10194. el.removeAttribute(key);
  10195. } else {
  10196. el.setAttribute(
  10197. key,
  10198. isBoolean ? "" : isSymbol(value) ? String(value) : value
  10199. );
  10200. }
  10201. }
  10202. }
  10203. function patchDOMProp(el, key, value, parentComponent) {
  10204. if (key === "innerHTML" || key === "textContent") {
  10205. if (value == null) return;
  10206. el[key] = value;
  10207. return;
  10208. }
  10209. const tag = el.tagName;
  10210. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  10211. !tag.includes("-")) {
  10212. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  10213. const newValue = value == null ? "" : String(value);
  10214. if (oldValue !== newValue || !("_value" in el)) {
  10215. el.value = newValue;
  10216. }
  10217. if (value == null) {
  10218. el.removeAttribute(key);
  10219. }
  10220. el._value = value;
  10221. return;
  10222. }
  10223. let needRemove = false;
  10224. if (value === "" || value == null) {
  10225. const type = typeof el[key];
  10226. if (type === "boolean") {
  10227. value = includeBooleanAttr(value);
  10228. } else if (value == null && type === "string") {
  10229. value = "";
  10230. needRemove = true;
  10231. } else if (type === "number") {
  10232. value = 0;
  10233. needRemove = true;
  10234. }
  10235. }
  10236. try {
  10237. el[key] = value;
  10238. } catch (e) {
  10239. if (!needRemove) {
  10240. warn(
  10241. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  10242. e
  10243. );
  10244. }
  10245. }
  10246. needRemove && el.removeAttribute(key);
  10247. }
  10248. function addEventListener(el, event, handler, options) {
  10249. el.addEventListener(event, handler, options);
  10250. }
  10251. function removeEventListener(el, event, handler, options) {
  10252. el.removeEventListener(event, handler, options);
  10253. }
  10254. const veiKey = Symbol("_vei");
  10255. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  10256. const invokers = el[veiKey] || (el[veiKey] = {});
  10257. const existingInvoker = invokers[rawName];
  10258. if (nextValue && existingInvoker) {
  10259. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  10260. } else {
  10261. const [name, options] = parseName(rawName);
  10262. if (nextValue) {
  10263. const invoker = invokers[rawName] = createInvoker(
  10264. sanitizeEventValue(nextValue, rawName) ,
  10265. instance
  10266. );
  10267. addEventListener(el, name, invoker, options);
  10268. } else if (existingInvoker) {
  10269. removeEventListener(el, name, existingInvoker, options);
  10270. invokers[rawName] = void 0;
  10271. }
  10272. }
  10273. }
  10274. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  10275. function parseName(name) {
  10276. let options;
  10277. if (optionsModifierRE.test(name)) {
  10278. options = {};
  10279. let m;
  10280. while (m = name.match(optionsModifierRE)) {
  10281. name = name.slice(0, name.length - m[0].length);
  10282. options[m[0].toLowerCase()] = true;
  10283. }
  10284. }
  10285. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  10286. return [event, options];
  10287. }
  10288. let cachedNow = 0;
  10289. const p = /* @__PURE__ */ Promise.resolve();
  10290. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  10291. function createInvoker(initialValue, instance) {
  10292. const invoker = (e) => {
  10293. if (!e._vts) {
  10294. e._vts = Date.now();
  10295. } else if (e._vts <= invoker.attached) {
  10296. return;
  10297. }
  10298. callWithAsyncErrorHandling(
  10299. patchStopImmediatePropagation(e, invoker.value),
  10300. instance,
  10301. 5,
  10302. [e]
  10303. );
  10304. };
  10305. invoker.value = initialValue;
  10306. invoker.attached = getNow();
  10307. return invoker;
  10308. }
  10309. function sanitizeEventValue(value, propName) {
  10310. if (isFunction(value) || isArray(value)) {
  10311. return value;
  10312. }
  10313. warn(
  10314. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  10315. Expected function or array of functions, received type ${typeof value}.`
  10316. );
  10317. return NOOP;
  10318. }
  10319. function patchStopImmediatePropagation(e, value) {
  10320. if (isArray(value)) {
  10321. const originalStop = e.stopImmediatePropagation;
  10322. e.stopImmediatePropagation = () => {
  10323. originalStop.call(e);
  10324. e._stopped = true;
  10325. };
  10326. return value.map(
  10327. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  10328. );
  10329. } else {
  10330. return value;
  10331. }
  10332. }
  10333. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  10334. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  10335. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  10336. const isSVG = namespace === "svg";
  10337. if (key === "class") {
  10338. patchClass(el, nextValue, isSVG);
  10339. } else if (key === "style") {
  10340. patchStyle(el, prevValue, nextValue);
  10341. } else if (isOn(key)) {
  10342. if (!isModelListener(key)) {
  10343. patchEvent(el, key, prevValue, nextValue, parentComponent);
  10344. }
  10345. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  10346. patchDOMProp(el, key, nextValue);
  10347. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  10348. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  10349. }
  10350. } else {
  10351. if (key === "true-value") {
  10352. el._trueValue = nextValue;
  10353. } else if (key === "false-value") {
  10354. el._falseValue = nextValue;
  10355. }
  10356. patchAttr(el, key, nextValue, isSVG);
  10357. }
  10358. };
  10359. function shouldSetAsProp(el, key, value, isSVG) {
  10360. if (isSVG) {
  10361. if (key === "innerHTML" || key === "textContent") {
  10362. return true;
  10363. }
  10364. if (key in el && isNativeOn(key) && isFunction(value)) {
  10365. return true;
  10366. }
  10367. return false;
  10368. }
  10369. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  10370. return false;
  10371. }
  10372. if (key === "form") {
  10373. return false;
  10374. }
  10375. if (key === "list" && el.tagName === "INPUT") {
  10376. return false;
  10377. }
  10378. if (key === "type" && el.tagName === "TEXTAREA") {
  10379. return false;
  10380. }
  10381. if (key === "width" || key === "height") {
  10382. const tag = el.tagName;
  10383. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  10384. return false;
  10385. }
  10386. }
  10387. if (isNativeOn(key) && isString(value)) {
  10388. return false;
  10389. }
  10390. return key in el;
  10391. }
  10392. /*! #__NO_SIDE_EFFECTS__ */
  10393. // @__NO_SIDE_EFFECTS__
  10394. function defineCustomElement(options, extraOptions, hydrate2) {
  10395. const Comp = defineComponent(options, extraOptions);
  10396. class VueCustomElement extends VueElement {
  10397. constructor(initialProps) {
  10398. super(Comp, initialProps, hydrate2);
  10399. }
  10400. }
  10401. VueCustomElement.def = Comp;
  10402. return VueCustomElement;
  10403. }
  10404. /*! #__NO_SIDE_EFFECTS__ */
  10405. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  10406. return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
  10407. };
  10408. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  10409. };
  10410. class VueElement extends BaseClass {
  10411. constructor(_def, _props = {}, hydrate2) {
  10412. super();
  10413. this._def = _def;
  10414. this._props = _props;
  10415. /**
  10416. * @internal
  10417. */
  10418. this._instance = null;
  10419. this._connected = false;
  10420. this._resolved = false;
  10421. this._numberProps = null;
  10422. this._ob = null;
  10423. if (this.shadowRoot && hydrate2) {
  10424. hydrate2(this._createVNode(), this.shadowRoot);
  10425. } else {
  10426. if (this.shadowRoot) {
  10427. warn(
  10428. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  10429. );
  10430. }
  10431. this.attachShadow({ mode: "open" });
  10432. if (!this._def.__asyncLoader) {
  10433. this._resolveProps(this._def);
  10434. }
  10435. }
  10436. }
  10437. connectedCallback() {
  10438. this._connected = true;
  10439. if (!this._instance) {
  10440. if (this._resolved) {
  10441. this._update();
  10442. } else {
  10443. this._resolveDef();
  10444. }
  10445. }
  10446. }
  10447. disconnectedCallback() {
  10448. this._connected = false;
  10449. nextTick(() => {
  10450. if (!this._connected) {
  10451. if (this._ob) {
  10452. this._ob.disconnect();
  10453. this._ob = null;
  10454. }
  10455. render(null, this.shadowRoot);
  10456. this._instance = null;
  10457. }
  10458. });
  10459. }
  10460. /**
  10461. * resolve inner component definition (handle possible async component)
  10462. */
  10463. _resolveDef() {
  10464. this._resolved = true;
  10465. for (let i = 0; i < this.attributes.length; i++) {
  10466. this._setAttr(this.attributes[i].name);
  10467. }
  10468. this._ob = new MutationObserver((mutations) => {
  10469. for (const m of mutations) {
  10470. this._setAttr(m.attributeName);
  10471. }
  10472. });
  10473. this._ob.observe(this, { attributes: true });
  10474. const resolve = (def, isAsync = false) => {
  10475. const { props, styles } = def;
  10476. let numberProps;
  10477. if (props && !isArray(props)) {
  10478. for (const key in props) {
  10479. const opt = props[key];
  10480. if (opt === Number || opt && opt.type === Number) {
  10481. if (key in this._props) {
  10482. this._props[key] = toNumber(this._props[key]);
  10483. }
  10484. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  10485. }
  10486. }
  10487. }
  10488. this._numberProps = numberProps;
  10489. if (isAsync) {
  10490. this._resolveProps(def);
  10491. }
  10492. this._applyStyles(styles);
  10493. this._update();
  10494. };
  10495. const asyncDef = this._def.__asyncLoader;
  10496. if (asyncDef) {
  10497. asyncDef().then((def) => resolve(def, true));
  10498. } else {
  10499. resolve(this._def);
  10500. }
  10501. }
  10502. _resolveProps(def) {
  10503. const { props } = def;
  10504. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  10505. for (const key of Object.keys(this)) {
  10506. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  10507. this._setProp(key, this[key], true, false);
  10508. }
  10509. }
  10510. for (const key of declaredPropKeys.map(camelize)) {
  10511. Object.defineProperty(this, key, {
  10512. get() {
  10513. return this._getProp(key);
  10514. },
  10515. set(val) {
  10516. this._setProp(key, val);
  10517. }
  10518. });
  10519. }
  10520. }
  10521. _setAttr(key) {
  10522. let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
  10523. const camelKey = camelize(key);
  10524. if (this._numberProps && this._numberProps[camelKey]) {
  10525. value = toNumber(value);
  10526. }
  10527. this._setProp(camelKey, value, false);
  10528. }
  10529. /**
  10530. * @internal
  10531. */
  10532. _getProp(key) {
  10533. return this._props[key];
  10534. }
  10535. /**
  10536. * @internal
  10537. */
  10538. _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
  10539. if (val !== this._props[key]) {
  10540. this._props[key] = val;
  10541. if (shouldUpdate && this._instance) {
  10542. this._update();
  10543. }
  10544. if (shouldReflect) {
  10545. if (val === true) {
  10546. this.setAttribute(hyphenate(key), "");
  10547. } else if (typeof val === "string" || typeof val === "number") {
  10548. this.setAttribute(hyphenate(key), val + "");
  10549. } else if (!val) {
  10550. this.removeAttribute(hyphenate(key));
  10551. }
  10552. }
  10553. }
  10554. }
  10555. _update() {
  10556. render(this._createVNode(), this.shadowRoot);
  10557. }
  10558. _createVNode() {
  10559. const vnode = createVNode(this._def, extend({}, this._props));
  10560. if (!this._instance) {
  10561. vnode.ce = (instance) => {
  10562. this._instance = instance;
  10563. instance.isCE = true;
  10564. {
  10565. instance.ceReload = (newStyles) => {
  10566. if (this._styles) {
  10567. this._styles.forEach((s) => this.shadowRoot.removeChild(s));
  10568. this._styles.length = 0;
  10569. }
  10570. this._applyStyles(newStyles);
  10571. this._instance = null;
  10572. this._update();
  10573. };
  10574. }
  10575. const dispatch = (event, args) => {
  10576. this.dispatchEvent(
  10577. new CustomEvent(event, {
  10578. detail: args
  10579. })
  10580. );
  10581. };
  10582. instance.emit = (event, ...args) => {
  10583. dispatch(event, args);
  10584. if (hyphenate(event) !== event) {
  10585. dispatch(hyphenate(event), args);
  10586. }
  10587. };
  10588. let parent = this;
  10589. while (parent = parent && (parent.parentNode || parent.host)) {
  10590. if (parent instanceof VueElement) {
  10591. instance.parent = parent._instance;
  10592. instance.provides = parent._instance.provides;
  10593. break;
  10594. }
  10595. }
  10596. };
  10597. }
  10598. return vnode;
  10599. }
  10600. _applyStyles(styles) {
  10601. if (styles) {
  10602. styles.forEach((css) => {
  10603. const s = document.createElement("style");
  10604. s.textContent = css;
  10605. this.shadowRoot.appendChild(s);
  10606. {
  10607. (this._styles || (this._styles = [])).push(s);
  10608. }
  10609. });
  10610. }
  10611. }
  10612. }
  10613. function useCssModule(name = "$style") {
  10614. {
  10615. const instance = getCurrentInstance();
  10616. if (!instance) {
  10617. warn(`useCssModule must be called inside setup()`);
  10618. return EMPTY_OBJ;
  10619. }
  10620. const modules = instance.type.__cssModules;
  10621. if (!modules) {
  10622. warn(`Current instance does not have CSS modules injected.`);
  10623. return EMPTY_OBJ;
  10624. }
  10625. const mod = modules[name];
  10626. if (!mod) {
  10627. warn(`Current instance does not have CSS module named "${name}".`);
  10628. return EMPTY_OBJ;
  10629. }
  10630. return mod;
  10631. }
  10632. }
  10633. const positionMap = /* @__PURE__ */ new WeakMap();
  10634. const newPositionMap = /* @__PURE__ */ new WeakMap();
  10635. const moveCbKey = Symbol("_moveCb");
  10636. const enterCbKey = Symbol("_enterCb");
  10637. const TransitionGroupImpl = {
  10638. name: "TransitionGroup",
  10639. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  10640. tag: String,
  10641. moveClass: String
  10642. }),
  10643. setup(props, { slots }) {
  10644. const instance = getCurrentInstance();
  10645. const state = useTransitionState();
  10646. let prevChildren;
  10647. let children;
  10648. onUpdated(() => {
  10649. if (!prevChildren.length) {
  10650. return;
  10651. }
  10652. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  10653. if (!hasCSSTransform(
  10654. prevChildren[0].el,
  10655. instance.vnode.el,
  10656. moveClass
  10657. )) {
  10658. return;
  10659. }
  10660. prevChildren.forEach(callPendingCbs);
  10661. prevChildren.forEach(recordPosition);
  10662. const movedChildren = prevChildren.filter(applyTranslation);
  10663. forceReflow();
  10664. movedChildren.forEach((c) => {
  10665. const el = c.el;
  10666. const style = el.style;
  10667. addTransitionClass(el, moveClass);
  10668. style.transform = style.webkitTransform = style.transitionDuration = "";
  10669. const cb = el[moveCbKey] = (e) => {
  10670. if (e && e.target !== el) {
  10671. return;
  10672. }
  10673. if (!e || /transform$/.test(e.propertyName)) {
  10674. el.removeEventListener("transitionend", cb);
  10675. el[moveCbKey] = null;
  10676. removeTransitionClass(el, moveClass);
  10677. }
  10678. };
  10679. el.addEventListener("transitionend", cb);
  10680. });
  10681. });
  10682. return () => {
  10683. const rawProps = toRaw(props);
  10684. const cssTransitionProps = resolveTransitionProps(rawProps);
  10685. let tag = rawProps.tag || Fragment;
  10686. prevChildren = [];
  10687. if (children) {
  10688. for (let i = 0; i < children.length; i++) {
  10689. const child = children[i];
  10690. if (child.el && child.el instanceof Element) {
  10691. prevChildren.push(child);
  10692. setTransitionHooks(
  10693. child,
  10694. resolveTransitionHooks(
  10695. child,
  10696. cssTransitionProps,
  10697. state,
  10698. instance
  10699. )
  10700. );
  10701. positionMap.set(
  10702. child,
  10703. child.el.getBoundingClientRect()
  10704. );
  10705. }
  10706. }
  10707. }
  10708. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  10709. for (let i = 0; i < children.length; i++) {
  10710. const child = children[i];
  10711. if (child.key != null) {
  10712. setTransitionHooks(
  10713. child,
  10714. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  10715. );
  10716. } else {
  10717. warn(`<TransitionGroup> children must be keyed.`);
  10718. }
  10719. }
  10720. return createVNode(tag, null, children);
  10721. };
  10722. }
  10723. };
  10724. const removeMode = (props) => delete props.mode;
  10725. /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
  10726. const TransitionGroup = TransitionGroupImpl;
  10727. function callPendingCbs(c) {
  10728. const el = c.el;
  10729. if (el[moveCbKey]) {
  10730. el[moveCbKey]();
  10731. }
  10732. if (el[enterCbKey]) {
  10733. el[enterCbKey]();
  10734. }
  10735. }
  10736. function recordPosition(c) {
  10737. newPositionMap.set(c, c.el.getBoundingClientRect());
  10738. }
  10739. function applyTranslation(c) {
  10740. const oldPos = positionMap.get(c);
  10741. const newPos = newPositionMap.get(c);
  10742. const dx = oldPos.left - newPos.left;
  10743. const dy = oldPos.top - newPos.top;
  10744. if (dx || dy) {
  10745. const s = c.el.style;
  10746. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  10747. s.transitionDuration = "0s";
  10748. return c;
  10749. }
  10750. }
  10751. function hasCSSTransform(el, root, moveClass) {
  10752. const clone = el.cloneNode();
  10753. const _vtc = el[vtcKey];
  10754. if (_vtc) {
  10755. _vtc.forEach((cls) => {
  10756. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  10757. });
  10758. }
  10759. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  10760. clone.style.display = "none";
  10761. const container = root.nodeType === 1 ? root : root.parentNode;
  10762. container.appendChild(clone);
  10763. const { hasTransform } = getTransitionInfo(clone);
  10764. container.removeChild(clone);
  10765. return hasTransform;
  10766. }
  10767. const getModelAssigner = (vnode) => {
  10768. const fn = vnode.props["onUpdate:modelValue"] || false;
  10769. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  10770. };
  10771. function onCompositionStart(e) {
  10772. e.target.composing = true;
  10773. }
  10774. function onCompositionEnd(e) {
  10775. const target = e.target;
  10776. if (target.composing) {
  10777. target.composing = false;
  10778. target.dispatchEvent(new Event("input"));
  10779. }
  10780. }
  10781. const assignKey = Symbol("_assign");
  10782. const vModelText = {
  10783. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  10784. el[assignKey] = getModelAssigner(vnode);
  10785. const castToNumber = number || vnode.props && vnode.props.type === "number";
  10786. addEventListener(el, lazy ? "change" : "input", (e) => {
  10787. if (e.target.composing) return;
  10788. let domValue = el.value;
  10789. if (trim) {
  10790. domValue = domValue.trim();
  10791. }
  10792. if (castToNumber) {
  10793. domValue = looseToNumber(domValue);
  10794. }
  10795. el[assignKey](domValue);
  10796. });
  10797. if (trim) {
  10798. addEventListener(el, "change", () => {
  10799. el.value = el.value.trim();
  10800. });
  10801. }
  10802. if (!lazy) {
  10803. addEventListener(el, "compositionstart", onCompositionStart);
  10804. addEventListener(el, "compositionend", onCompositionEnd);
  10805. addEventListener(el, "change", onCompositionEnd);
  10806. }
  10807. },
  10808. // set value on mounted so it's after min/max for type="range"
  10809. mounted(el, { value }) {
  10810. el.value = value == null ? "" : value;
  10811. },
  10812. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  10813. el[assignKey] = getModelAssigner(vnode);
  10814. if (el.composing) return;
  10815. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  10816. const newValue = value == null ? "" : value;
  10817. if (elValue === newValue) {
  10818. return;
  10819. }
  10820. if (document.activeElement === el && el.type !== "range") {
  10821. if (lazy && value === oldValue) {
  10822. return;
  10823. }
  10824. if (trim && el.value.trim() === newValue) {
  10825. return;
  10826. }
  10827. }
  10828. el.value = newValue;
  10829. }
  10830. };
  10831. const vModelCheckbox = {
  10832. // #4096 array checkboxes need to be deep traversed
  10833. deep: true,
  10834. created(el, _, vnode) {
  10835. el[assignKey] = getModelAssigner(vnode);
  10836. addEventListener(el, "change", () => {
  10837. const modelValue = el._modelValue;
  10838. const elementValue = getValue(el);
  10839. const checked = el.checked;
  10840. const assign = el[assignKey];
  10841. if (isArray(modelValue)) {
  10842. const index = looseIndexOf(modelValue, elementValue);
  10843. const found = index !== -1;
  10844. if (checked && !found) {
  10845. assign(modelValue.concat(elementValue));
  10846. } else if (!checked && found) {
  10847. const filtered = [...modelValue];
  10848. filtered.splice(index, 1);
  10849. assign(filtered);
  10850. }
  10851. } else if (isSet(modelValue)) {
  10852. const cloned = new Set(modelValue);
  10853. if (checked) {
  10854. cloned.add(elementValue);
  10855. } else {
  10856. cloned.delete(elementValue);
  10857. }
  10858. assign(cloned);
  10859. } else {
  10860. assign(getCheckboxValue(el, checked));
  10861. }
  10862. });
  10863. },
  10864. // set initial checked on mount to wait for true-value/false-value
  10865. mounted: setChecked,
  10866. beforeUpdate(el, binding, vnode) {
  10867. el[assignKey] = getModelAssigner(vnode);
  10868. setChecked(el, binding, vnode);
  10869. }
  10870. };
  10871. function setChecked(el, { value, oldValue }, vnode) {
  10872. el._modelValue = value;
  10873. if (isArray(value)) {
  10874. el.checked = looseIndexOf(value, vnode.props.value) > -1;
  10875. } else if (isSet(value)) {
  10876. el.checked = value.has(vnode.props.value);
  10877. } else if (value !== oldValue) {
  10878. el.checked = looseEqual(value, getCheckboxValue(el, true));
  10879. }
  10880. }
  10881. const vModelRadio = {
  10882. created(el, { value }, vnode) {
  10883. el.checked = looseEqual(value, vnode.props.value);
  10884. el[assignKey] = getModelAssigner(vnode);
  10885. addEventListener(el, "change", () => {
  10886. el[assignKey](getValue(el));
  10887. });
  10888. },
  10889. beforeUpdate(el, { value, oldValue }, vnode) {
  10890. el[assignKey] = getModelAssigner(vnode);
  10891. if (value !== oldValue) {
  10892. el.checked = looseEqual(value, vnode.props.value);
  10893. }
  10894. }
  10895. };
  10896. const vModelSelect = {
  10897. // <select multiple> value need to be deep traversed
  10898. deep: true,
  10899. created(el, { value, modifiers: { number } }, vnode) {
  10900. const isSetModel = isSet(value);
  10901. addEventListener(el, "change", () => {
  10902. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  10903. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  10904. );
  10905. el[assignKey](
  10906. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  10907. );
  10908. el._assigning = true;
  10909. nextTick(() => {
  10910. el._assigning = false;
  10911. });
  10912. });
  10913. el[assignKey] = getModelAssigner(vnode);
  10914. },
  10915. // set value in mounted & updated because <select> relies on its children
  10916. // <option>s.
  10917. mounted(el, { value, modifiers: { number } }) {
  10918. setSelected(el, value);
  10919. },
  10920. beforeUpdate(el, _binding, vnode) {
  10921. el[assignKey] = getModelAssigner(vnode);
  10922. },
  10923. updated(el, { value, modifiers: { number } }) {
  10924. if (!el._assigning) {
  10925. setSelected(el, value);
  10926. }
  10927. }
  10928. };
  10929. function setSelected(el, value, number) {
  10930. const isMultiple = el.multiple;
  10931. const isArrayValue = isArray(value);
  10932. if (isMultiple && !isArrayValue && !isSet(value)) {
  10933. warn(
  10934. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  10935. );
  10936. return;
  10937. }
  10938. for (let i = 0, l = el.options.length; i < l; i++) {
  10939. const option = el.options[i];
  10940. const optionValue = getValue(option);
  10941. if (isMultiple) {
  10942. if (isArrayValue) {
  10943. const optionType = typeof optionValue;
  10944. if (optionType === "string" || optionType === "number") {
  10945. option.selected = value.some((v) => String(v) === String(optionValue));
  10946. } else {
  10947. option.selected = looseIndexOf(value, optionValue) > -1;
  10948. }
  10949. } else {
  10950. option.selected = value.has(optionValue);
  10951. }
  10952. } else if (looseEqual(getValue(option), value)) {
  10953. if (el.selectedIndex !== i) el.selectedIndex = i;
  10954. return;
  10955. }
  10956. }
  10957. if (!isMultiple && el.selectedIndex !== -1) {
  10958. el.selectedIndex = -1;
  10959. }
  10960. }
  10961. function getValue(el) {
  10962. return "_value" in el ? el._value : el.value;
  10963. }
  10964. function getCheckboxValue(el, checked) {
  10965. const key = checked ? "_trueValue" : "_falseValue";
  10966. return key in el ? el[key] : checked;
  10967. }
  10968. const vModelDynamic = {
  10969. created(el, binding, vnode) {
  10970. callModelHook(el, binding, vnode, null, "created");
  10971. },
  10972. mounted(el, binding, vnode) {
  10973. callModelHook(el, binding, vnode, null, "mounted");
  10974. },
  10975. beforeUpdate(el, binding, vnode, prevVNode) {
  10976. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  10977. },
  10978. updated(el, binding, vnode, prevVNode) {
  10979. callModelHook(el, binding, vnode, prevVNode, "updated");
  10980. }
  10981. };
  10982. function resolveDynamicModel(tagName, type) {
  10983. switch (tagName) {
  10984. case "SELECT":
  10985. return vModelSelect;
  10986. case "TEXTAREA":
  10987. return vModelText;
  10988. default:
  10989. switch (type) {
  10990. case "checkbox":
  10991. return vModelCheckbox;
  10992. case "radio":
  10993. return vModelRadio;
  10994. default:
  10995. return vModelText;
  10996. }
  10997. }
  10998. }
  10999. function callModelHook(el, binding, vnode, prevVNode, hook) {
  11000. const modelToUse = resolveDynamicModel(
  11001. el.tagName,
  11002. vnode.props && vnode.props.type
  11003. );
  11004. const fn = modelToUse[hook];
  11005. fn && fn(el, binding, vnode, prevVNode);
  11006. }
  11007. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  11008. const modifierGuards = {
  11009. stop: (e) => e.stopPropagation(),
  11010. prevent: (e) => e.preventDefault(),
  11011. self: (e) => e.target !== e.currentTarget,
  11012. ctrl: (e) => !e.ctrlKey,
  11013. shift: (e) => !e.shiftKey,
  11014. alt: (e) => !e.altKey,
  11015. meta: (e) => !e.metaKey,
  11016. left: (e) => "button" in e && e.button !== 0,
  11017. middle: (e) => "button" in e && e.button !== 1,
  11018. right: (e) => "button" in e && e.button !== 2,
  11019. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  11020. };
  11021. const withModifiers = (fn, modifiers) => {
  11022. const cache = fn._withMods || (fn._withMods = {});
  11023. const cacheKey = modifiers.join(".");
  11024. return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
  11025. for (let i = 0; i < modifiers.length; i++) {
  11026. const guard = modifierGuards[modifiers[i]];
  11027. if (guard && guard(event, modifiers)) return;
  11028. }
  11029. return fn(event, ...args);
  11030. });
  11031. };
  11032. const keyNames = {
  11033. esc: "escape",
  11034. space: " ",
  11035. up: "arrow-up",
  11036. left: "arrow-left",
  11037. right: "arrow-right",
  11038. down: "arrow-down",
  11039. delete: "backspace"
  11040. };
  11041. const withKeys = (fn, modifiers) => {
  11042. const cache = fn._withKeys || (fn._withKeys = {});
  11043. const cacheKey = modifiers.join(".");
  11044. return cache[cacheKey] || (cache[cacheKey] = (event) => {
  11045. if (!("key" in event)) {
  11046. return;
  11047. }
  11048. const eventKey = hyphenate(event.key);
  11049. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  11050. return fn(event);
  11051. }
  11052. });
  11053. };
  11054. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  11055. let renderer;
  11056. let enabledHydration = false;
  11057. function ensureRenderer() {
  11058. return renderer || (renderer = createRenderer(rendererOptions));
  11059. }
  11060. function ensureHydrationRenderer() {
  11061. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  11062. enabledHydration = true;
  11063. return renderer;
  11064. }
  11065. const render = (...args) => {
  11066. ensureRenderer().render(...args);
  11067. };
  11068. const hydrate = (...args) => {
  11069. ensureHydrationRenderer().hydrate(...args);
  11070. };
  11071. const createApp = (...args) => {
  11072. const app = ensureRenderer().createApp(...args);
  11073. {
  11074. injectNativeTagCheck(app);
  11075. injectCompilerOptionsCheck(app);
  11076. }
  11077. const { mount } = app;
  11078. app.mount = (containerOrSelector) => {
  11079. const container = normalizeContainer(containerOrSelector);
  11080. if (!container) return;
  11081. const component = app._component;
  11082. if (!isFunction(component) && !component.render && !component.template) {
  11083. component.template = container.innerHTML;
  11084. }
  11085. container.innerHTML = "";
  11086. const proxy = mount(container, false, resolveRootNamespace(container));
  11087. if (container instanceof Element) {
  11088. container.removeAttribute("v-cloak");
  11089. container.setAttribute("data-v-app", "");
  11090. }
  11091. return proxy;
  11092. };
  11093. return app;
  11094. };
  11095. const createSSRApp = (...args) => {
  11096. const app = ensureHydrationRenderer().createApp(...args);
  11097. {
  11098. injectNativeTagCheck(app);
  11099. injectCompilerOptionsCheck(app);
  11100. }
  11101. const { mount } = app;
  11102. app.mount = (containerOrSelector) => {
  11103. const container = normalizeContainer(containerOrSelector);
  11104. if (container) {
  11105. return mount(container, true, resolveRootNamespace(container));
  11106. }
  11107. };
  11108. return app;
  11109. };
  11110. function resolveRootNamespace(container) {
  11111. if (container instanceof SVGElement) {
  11112. return "svg";
  11113. }
  11114. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  11115. return "mathml";
  11116. }
  11117. }
  11118. function injectNativeTagCheck(app) {
  11119. Object.defineProperty(app.config, "isNativeTag", {
  11120. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  11121. writable: false
  11122. });
  11123. }
  11124. function injectCompilerOptionsCheck(app) {
  11125. if (isRuntimeOnly()) {
  11126. const isCustomElement = app.config.isCustomElement;
  11127. Object.defineProperty(app.config, "isCustomElement", {
  11128. get() {
  11129. return isCustomElement;
  11130. },
  11131. set() {
  11132. warn(
  11133. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  11134. );
  11135. }
  11136. });
  11137. const compilerOptions = app.config.compilerOptions;
  11138. 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.
  11139. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  11140. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  11141. - 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`;
  11142. Object.defineProperty(app.config, "compilerOptions", {
  11143. get() {
  11144. warn(msg);
  11145. return compilerOptions;
  11146. },
  11147. set() {
  11148. warn(msg);
  11149. }
  11150. });
  11151. }
  11152. }
  11153. function normalizeContainer(container) {
  11154. if (isString(container)) {
  11155. const res = document.querySelector(container);
  11156. if (!res) {
  11157. warn(
  11158. `Failed to mount app: mount target selector "${container}" returned null.`
  11159. );
  11160. }
  11161. return res;
  11162. }
  11163. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  11164. warn(
  11165. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  11166. );
  11167. }
  11168. return container;
  11169. }
  11170. const initDirectivesForSSR = NOOP;
  11171. var runtimeDom = /*#__PURE__*/Object.freeze({
  11172. __proto__: null,
  11173. BaseTransition: BaseTransition,
  11174. BaseTransitionPropsValidators: BaseTransitionPropsValidators,
  11175. Comment: Comment,
  11176. DeprecationTypes: DeprecationTypes,
  11177. EffectScope: EffectScope,
  11178. ErrorCodes: ErrorCodes,
  11179. ErrorTypeStrings: ErrorTypeStrings,
  11180. Fragment: Fragment,
  11181. KeepAlive: KeepAlive,
  11182. ReactiveEffect: ReactiveEffect,
  11183. Static: Static,
  11184. Suspense: Suspense,
  11185. Teleport: Teleport,
  11186. Text: Text,
  11187. TrackOpTypes: TrackOpTypes,
  11188. Transition: Transition,
  11189. TransitionGroup: TransitionGroup,
  11190. TriggerOpTypes: TriggerOpTypes,
  11191. VueElement: VueElement,
  11192. assertNumber: assertNumber,
  11193. callWithAsyncErrorHandling: callWithAsyncErrorHandling,
  11194. callWithErrorHandling: callWithErrorHandling,
  11195. camelize: camelize,
  11196. capitalize: capitalize,
  11197. cloneVNode: cloneVNode,
  11198. compatUtils: compatUtils,
  11199. computed: computed,
  11200. createApp: createApp,
  11201. createBlock: createBlock,
  11202. createCommentVNode: createCommentVNode,
  11203. createElementBlock: createElementBlock,
  11204. createElementVNode: createBaseVNode,
  11205. createHydrationRenderer: createHydrationRenderer,
  11206. createPropsRestProxy: createPropsRestProxy,
  11207. createRenderer: createRenderer,
  11208. createSSRApp: createSSRApp,
  11209. createSlots: createSlots,
  11210. createStaticVNode: createStaticVNode,
  11211. createTextVNode: createTextVNode,
  11212. createVNode: createVNode,
  11213. customRef: customRef,
  11214. defineAsyncComponent: defineAsyncComponent,
  11215. defineComponent: defineComponent,
  11216. defineCustomElement: defineCustomElement,
  11217. defineEmits: defineEmits,
  11218. defineExpose: defineExpose,
  11219. defineModel: defineModel,
  11220. defineOptions: defineOptions,
  11221. defineProps: defineProps,
  11222. defineSSRCustomElement: defineSSRCustomElement,
  11223. defineSlots: defineSlots,
  11224. devtools: devtools,
  11225. effect: effect,
  11226. effectScope: effectScope,
  11227. getCurrentInstance: getCurrentInstance,
  11228. getCurrentScope: getCurrentScope,
  11229. getTransitionRawChildren: getTransitionRawChildren,
  11230. guardReactiveProps: guardReactiveProps,
  11231. h: h,
  11232. handleError: handleError,
  11233. hasInjectionContext: hasInjectionContext,
  11234. hydrate: hydrate,
  11235. initCustomFormatter: initCustomFormatter,
  11236. initDirectivesForSSR: initDirectivesForSSR,
  11237. inject: inject,
  11238. isMemoSame: isMemoSame,
  11239. isProxy: isProxy,
  11240. isReactive: isReactive,
  11241. isReadonly: isReadonly,
  11242. isRef: isRef,
  11243. isRuntimeOnly: isRuntimeOnly,
  11244. isShallow: isShallow,
  11245. isVNode: isVNode,
  11246. markRaw: markRaw,
  11247. mergeDefaults: mergeDefaults,
  11248. mergeModels: mergeModels,
  11249. mergeProps: mergeProps,
  11250. nextTick: nextTick,
  11251. normalizeClass: normalizeClass,
  11252. normalizeProps: normalizeProps,
  11253. normalizeStyle: normalizeStyle,
  11254. onActivated: onActivated,
  11255. onBeforeMount: onBeforeMount,
  11256. onBeforeUnmount: onBeforeUnmount,
  11257. onBeforeUpdate: onBeforeUpdate,
  11258. onDeactivated: onDeactivated,
  11259. onErrorCaptured: onErrorCaptured,
  11260. onMounted: onMounted,
  11261. onRenderTracked: onRenderTracked,
  11262. onRenderTriggered: onRenderTriggered,
  11263. onScopeDispose: onScopeDispose,
  11264. onServerPrefetch: onServerPrefetch,
  11265. onUnmounted: onUnmounted,
  11266. onUpdated: onUpdated,
  11267. openBlock: openBlock,
  11268. popScopeId: popScopeId,
  11269. provide: provide,
  11270. proxyRefs: proxyRefs,
  11271. pushScopeId: pushScopeId,
  11272. queuePostFlushCb: queuePostFlushCb,
  11273. reactive: reactive,
  11274. readonly: readonly,
  11275. ref: ref,
  11276. registerRuntimeCompiler: registerRuntimeCompiler,
  11277. render: render,
  11278. renderList: renderList,
  11279. renderSlot: renderSlot,
  11280. resolveComponent: resolveComponent,
  11281. resolveDirective: resolveDirective,
  11282. resolveDynamicComponent: resolveDynamicComponent,
  11283. resolveFilter: resolveFilter,
  11284. resolveTransitionHooks: resolveTransitionHooks,
  11285. setBlockTracking: setBlockTracking,
  11286. setDevtoolsHook: setDevtoolsHook,
  11287. setTransitionHooks: setTransitionHooks,
  11288. shallowReactive: shallowReactive,
  11289. shallowReadonly: shallowReadonly,
  11290. shallowRef: shallowRef,
  11291. ssrContextKey: ssrContextKey,
  11292. ssrUtils: ssrUtils,
  11293. stop: stop,
  11294. toDisplayString: toDisplayString,
  11295. toHandlerKey: toHandlerKey,
  11296. toHandlers: toHandlers,
  11297. toRaw: toRaw,
  11298. toRef: toRef,
  11299. toRefs: toRefs,
  11300. toValue: toValue,
  11301. transformVNodeArgs: transformVNodeArgs,
  11302. triggerRef: triggerRef,
  11303. unref: unref,
  11304. useAttrs: useAttrs,
  11305. useCssModule: useCssModule,
  11306. useCssVars: useCssVars,
  11307. useModel: useModel,
  11308. useSSRContext: useSSRContext,
  11309. useSlots: useSlots,
  11310. useTransitionState: useTransitionState,
  11311. vModelCheckbox: vModelCheckbox,
  11312. vModelDynamic: vModelDynamic,
  11313. vModelRadio: vModelRadio,
  11314. vModelSelect: vModelSelect,
  11315. vModelText: vModelText,
  11316. vShow: vShow,
  11317. version: version,
  11318. warn: warn,
  11319. watch: watch,
  11320. watchEffect: watchEffect,
  11321. watchPostEffect: watchPostEffect,
  11322. watchSyncEffect: watchSyncEffect,
  11323. withAsyncContext: withAsyncContext,
  11324. withCtx: withCtx,
  11325. withDefaults: withDefaults,
  11326. withDirectives: withDirectives,
  11327. withKeys: withKeys,
  11328. withMemo: withMemo,
  11329. withModifiers: withModifiers,
  11330. withScopeId: withScopeId
  11331. });
  11332. function initDev() {
  11333. {
  11334. {
  11335. console.info(
  11336. `You are running a development build of Vue.
  11337. Make sure to use the production build (*.prod.js) when deploying for production.`
  11338. );
  11339. }
  11340. initCustomFormatter();
  11341. }
  11342. }
  11343. const FRAGMENT = Symbol(`Fragment` );
  11344. const TELEPORT = Symbol(`Teleport` );
  11345. const SUSPENSE = Symbol(`Suspense` );
  11346. const KEEP_ALIVE = Symbol(`KeepAlive` );
  11347. const BASE_TRANSITION = Symbol(`BaseTransition` );
  11348. const OPEN_BLOCK = Symbol(`openBlock` );
  11349. const CREATE_BLOCK = Symbol(`createBlock` );
  11350. const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
  11351. const CREATE_VNODE = Symbol(`createVNode` );
  11352. const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
  11353. const CREATE_COMMENT = Symbol(`createCommentVNode` );
  11354. const CREATE_TEXT = Symbol(`createTextVNode` );
  11355. const CREATE_STATIC = Symbol(`createStaticVNode` );
  11356. const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
  11357. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  11358. `resolveDynamicComponent`
  11359. );
  11360. const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
  11361. const RESOLVE_FILTER = Symbol(`resolveFilter` );
  11362. const WITH_DIRECTIVES = Symbol(`withDirectives` );
  11363. const RENDER_LIST = Symbol(`renderList` );
  11364. const RENDER_SLOT = Symbol(`renderSlot` );
  11365. const CREATE_SLOTS = Symbol(`createSlots` );
  11366. const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
  11367. const MERGE_PROPS = Symbol(`mergeProps` );
  11368. const NORMALIZE_CLASS = Symbol(`normalizeClass` );
  11369. const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
  11370. const NORMALIZE_PROPS = Symbol(`normalizeProps` );
  11371. const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
  11372. const TO_HANDLERS = Symbol(`toHandlers` );
  11373. const CAMELIZE = Symbol(`camelize` );
  11374. const CAPITALIZE = Symbol(`capitalize` );
  11375. const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
  11376. const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
  11377. const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
  11378. const POP_SCOPE_ID = Symbol(`popScopeId` );
  11379. const WITH_CTX = Symbol(`withCtx` );
  11380. const UNREF = Symbol(`unref` );
  11381. const IS_REF = Symbol(`isRef` );
  11382. const WITH_MEMO = Symbol(`withMemo` );
  11383. const IS_MEMO_SAME = Symbol(`isMemoSame` );
  11384. const helperNameMap = {
  11385. [FRAGMENT]: `Fragment`,
  11386. [TELEPORT]: `Teleport`,
  11387. [SUSPENSE]: `Suspense`,
  11388. [KEEP_ALIVE]: `KeepAlive`,
  11389. [BASE_TRANSITION]: `BaseTransition`,
  11390. [OPEN_BLOCK]: `openBlock`,
  11391. [CREATE_BLOCK]: `createBlock`,
  11392. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  11393. [CREATE_VNODE]: `createVNode`,
  11394. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  11395. [CREATE_COMMENT]: `createCommentVNode`,
  11396. [CREATE_TEXT]: `createTextVNode`,
  11397. [CREATE_STATIC]: `createStaticVNode`,
  11398. [RESOLVE_COMPONENT]: `resolveComponent`,
  11399. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  11400. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  11401. [RESOLVE_FILTER]: `resolveFilter`,
  11402. [WITH_DIRECTIVES]: `withDirectives`,
  11403. [RENDER_LIST]: `renderList`,
  11404. [RENDER_SLOT]: `renderSlot`,
  11405. [CREATE_SLOTS]: `createSlots`,
  11406. [TO_DISPLAY_STRING]: `toDisplayString`,
  11407. [MERGE_PROPS]: `mergeProps`,
  11408. [NORMALIZE_CLASS]: `normalizeClass`,
  11409. [NORMALIZE_STYLE]: `normalizeStyle`,
  11410. [NORMALIZE_PROPS]: `normalizeProps`,
  11411. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  11412. [TO_HANDLERS]: `toHandlers`,
  11413. [CAMELIZE]: `camelize`,
  11414. [CAPITALIZE]: `capitalize`,
  11415. [TO_HANDLER_KEY]: `toHandlerKey`,
  11416. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  11417. [PUSH_SCOPE_ID]: `pushScopeId`,
  11418. [POP_SCOPE_ID]: `popScopeId`,
  11419. [WITH_CTX]: `withCtx`,
  11420. [UNREF]: `unref`,
  11421. [IS_REF]: `isRef`,
  11422. [WITH_MEMO]: `withMemo`,
  11423. [IS_MEMO_SAME]: `isMemoSame`
  11424. };
  11425. function registerRuntimeHelpers(helpers) {
  11426. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  11427. helperNameMap[s] = helpers[s];
  11428. });
  11429. }
  11430. const locStub = {
  11431. start: { line: 1, column: 1, offset: 0 },
  11432. end: { line: 1, column: 1, offset: 0 },
  11433. source: ""
  11434. };
  11435. function createRoot(children, source = "") {
  11436. return {
  11437. type: 0,
  11438. source,
  11439. children,
  11440. helpers: /* @__PURE__ */ new Set(),
  11441. components: [],
  11442. directives: [],
  11443. hoists: [],
  11444. imports: [],
  11445. cached: 0,
  11446. temps: 0,
  11447. codegenNode: void 0,
  11448. loc: locStub
  11449. };
  11450. }
  11451. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  11452. if (context) {
  11453. if (isBlock) {
  11454. context.helper(OPEN_BLOCK);
  11455. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  11456. } else {
  11457. context.helper(getVNodeHelper(context.inSSR, isComponent));
  11458. }
  11459. if (directives) {
  11460. context.helper(WITH_DIRECTIVES);
  11461. }
  11462. }
  11463. return {
  11464. type: 13,
  11465. tag,
  11466. props,
  11467. children,
  11468. patchFlag,
  11469. dynamicProps,
  11470. directives,
  11471. isBlock,
  11472. disableTracking,
  11473. isComponent,
  11474. loc
  11475. };
  11476. }
  11477. function createArrayExpression(elements, loc = locStub) {
  11478. return {
  11479. type: 17,
  11480. loc,
  11481. elements
  11482. };
  11483. }
  11484. function createObjectExpression(properties, loc = locStub) {
  11485. return {
  11486. type: 15,
  11487. loc,
  11488. properties
  11489. };
  11490. }
  11491. function createObjectProperty(key, value) {
  11492. return {
  11493. type: 16,
  11494. loc: locStub,
  11495. key: isString(key) ? createSimpleExpression(key, true) : key,
  11496. value
  11497. };
  11498. }
  11499. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  11500. return {
  11501. type: 4,
  11502. loc,
  11503. content,
  11504. isStatic,
  11505. constType: isStatic ? 3 : constType
  11506. };
  11507. }
  11508. function createCompoundExpression(children, loc = locStub) {
  11509. return {
  11510. type: 8,
  11511. loc,
  11512. children
  11513. };
  11514. }
  11515. function createCallExpression(callee, args = [], loc = locStub) {
  11516. return {
  11517. type: 14,
  11518. loc,
  11519. callee,
  11520. arguments: args
  11521. };
  11522. }
  11523. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  11524. return {
  11525. type: 18,
  11526. params,
  11527. returns,
  11528. newline,
  11529. isSlot,
  11530. loc
  11531. };
  11532. }
  11533. function createConditionalExpression(test, consequent, alternate, newline = true) {
  11534. return {
  11535. type: 19,
  11536. test,
  11537. consequent,
  11538. alternate,
  11539. newline,
  11540. loc: locStub
  11541. };
  11542. }
  11543. function createCacheExpression(index, value, isVOnce = false) {
  11544. return {
  11545. type: 20,
  11546. index,
  11547. value,
  11548. isVOnce,
  11549. loc: locStub
  11550. };
  11551. }
  11552. function createBlockStatement(body) {
  11553. return {
  11554. type: 21,
  11555. body,
  11556. loc: locStub
  11557. };
  11558. }
  11559. function getVNodeHelper(ssr, isComponent) {
  11560. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  11561. }
  11562. function getVNodeBlockHelper(ssr, isComponent) {
  11563. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  11564. }
  11565. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  11566. if (!node.isBlock) {
  11567. node.isBlock = true;
  11568. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  11569. helper(OPEN_BLOCK);
  11570. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  11571. }
  11572. }
  11573. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  11574. const defaultDelimitersClose = new Uint8Array([125, 125]);
  11575. function isTagStartChar(c) {
  11576. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  11577. }
  11578. function isWhitespace(c) {
  11579. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  11580. }
  11581. function isEndOfTagSection(c) {
  11582. return c === 47 || c === 62 || isWhitespace(c);
  11583. }
  11584. function toCharCodes(str) {
  11585. const ret = new Uint8Array(str.length);
  11586. for (let i = 0; i < str.length; i++) {
  11587. ret[i] = str.charCodeAt(i);
  11588. }
  11589. return ret;
  11590. }
  11591. const Sequences = {
  11592. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  11593. // CDATA[
  11594. CdataEnd: new Uint8Array([93, 93, 62]),
  11595. // ]]>
  11596. CommentEnd: new Uint8Array([45, 45, 62]),
  11597. // `-->`
  11598. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  11599. // `<\/script`
  11600. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  11601. // `</style`
  11602. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  11603. // `</title`
  11604. TextareaEnd: new Uint8Array([
  11605. 60,
  11606. 47,
  11607. 116,
  11608. 101,
  11609. 120,
  11610. 116,
  11611. 97,
  11612. 114,
  11613. 101,
  11614. 97
  11615. ])
  11616. // `</textarea
  11617. };
  11618. class Tokenizer {
  11619. constructor(stack, cbs) {
  11620. this.stack = stack;
  11621. this.cbs = cbs;
  11622. /** The current state the tokenizer is in. */
  11623. this.state = 1;
  11624. /** The read buffer. */
  11625. this.buffer = "";
  11626. /** The beginning of the section that is currently being read. */
  11627. this.sectionStart = 0;
  11628. /** The index within the buffer that we are currently looking at. */
  11629. this.index = 0;
  11630. /** The start of the last entity. */
  11631. this.entityStart = 0;
  11632. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  11633. this.baseState = 1;
  11634. /** For special parsing behavior inside of script and style tags. */
  11635. this.inRCDATA = false;
  11636. /** For disabling RCDATA tags handling */
  11637. this.inXML = false;
  11638. /** For disabling interpolation parsing in v-pre */
  11639. this.inVPre = false;
  11640. /** Record newline positions for fast line / column calculation */
  11641. this.newlines = [];
  11642. this.mode = 0;
  11643. this.delimiterOpen = defaultDelimitersOpen;
  11644. this.delimiterClose = defaultDelimitersClose;
  11645. this.delimiterIndex = -1;
  11646. this.currentSequence = void 0;
  11647. this.sequenceIndex = 0;
  11648. }
  11649. get inSFCRoot() {
  11650. return this.mode === 2 && this.stack.length === 0;
  11651. }
  11652. reset() {
  11653. this.state = 1;
  11654. this.mode = 0;
  11655. this.buffer = "";
  11656. this.sectionStart = 0;
  11657. this.index = 0;
  11658. this.baseState = 1;
  11659. this.inRCDATA = false;
  11660. this.currentSequence = void 0;
  11661. this.newlines.length = 0;
  11662. this.delimiterOpen = defaultDelimitersOpen;
  11663. this.delimiterClose = defaultDelimitersClose;
  11664. }
  11665. /**
  11666. * Generate Position object with line / column information using recorded
  11667. * newline positions. We know the index is always going to be an already
  11668. * processed index, so all the newlines up to this index should have been
  11669. * recorded.
  11670. */
  11671. getPos(index) {
  11672. let line = 1;
  11673. let column = index + 1;
  11674. for (let i = this.newlines.length - 1; i >= 0; i--) {
  11675. const newlineIndex = this.newlines[i];
  11676. if (index > newlineIndex) {
  11677. line = i + 2;
  11678. column = index - newlineIndex;
  11679. break;
  11680. }
  11681. }
  11682. return {
  11683. column,
  11684. line,
  11685. offset: index
  11686. };
  11687. }
  11688. peek() {
  11689. return this.buffer.charCodeAt(this.index + 1);
  11690. }
  11691. stateText(c) {
  11692. if (c === 60) {
  11693. if (this.index > this.sectionStart) {
  11694. this.cbs.ontext(this.sectionStart, this.index);
  11695. }
  11696. this.state = 5;
  11697. this.sectionStart = this.index;
  11698. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  11699. this.state = 2;
  11700. this.delimiterIndex = 0;
  11701. this.stateInterpolationOpen(c);
  11702. }
  11703. }
  11704. stateInterpolationOpen(c) {
  11705. if (c === this.delimiterOpen[this.delimiterIndex]) {
  11706. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  11707. const start = this.index + 1 - this.delimiterOpen.length;
  11708. if (start > this.sectionStart) {
  11709. this.cbs.ontext(this.sectionStart, start);
  11710. }
  11711. this.state = 3;
  11712. this.sectionStart = start;
  11713. } else {
  11714. this.delimiterIndex++;
  11715. }
  11716. } else if (this.inRCDATA) {
  11717. this.state = 32;
  11718. this.stateInRCDATA(c);
  11719. } else {
  11720. this.state = 1;
  11721. this.stateText(c);
  11722. }
  11723. }
  11724. stateInterpolation(c) {
  11725. if (c === this.delimiterClose[0]) {
  11726. this.state = 4;
  11727. this.delimiterIndex = 0;
  11728. this.stateInterpolationClose(c);
  11729. }
  11730. }
  11731. stateInterpolationClose(c) {
  11732. if (c === this.delimiterClose[this.delimiterIndex]) {
  11733. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  11734. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  11735. if (this.inRCDATA) {
  11736. this.state = 32;
  11737. } else {
  11738. this.state = 1;
  11739. }
  11740. this.sectionStart = this.index + 1;
  11741. } else {
  11742. this.delimiterIndex++;
  11743. }
  11744. } else {
  11745. this.state = 3;
  11746. this.stateInterpolation(c);
  11747. }
  11748. }
  11749. stateSpecialStartSequence(c) {
  11750. const isEnd = this.sequenceIndex === this.currentSequence.length;
  11751. const isMatch = isEnd ? (
  11752. // If we are at the end of the sequence, make sure the tag name has ended
  11753. isEndOfTagSection(c)
  11754. ) : (
  11755. // Otherwise, do a case-insensitive comparison
  11756. (c | 32) === this.currentSequence[this.sequenceIndex]
  11757. );
  11758. if (!isMatch) {
  11759. this.inRCDATA = false;
  11760. } else if (!isEnd) {
  11761. this.sequenceIndex++;
  11762. return;
  11763. }
  11764. this.sequenceIndex = 0;
  11765. this.state = 6;
  11766. this.stateInTagName(c);
  11767. }
  11768. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  11769. stateInRCDATA(c) {
  11770. if (this.sequenceIndex === this.currentSequence.length) {
  11771. if (c === 62 || isWhitespace(c)) {
  11772. const endOfText = this.index - this.currentSequence.length;
  11773. if (this.sectionStart < endOfText) {
  11774. const actualIndex = this.index;
  11775. this.index = endOfText;
  11776. this.cbs.ontext(this.sectionStart, endOfText);
  11777. this.index = actualIndex;
  11778. }
  11779. this.sectionStart = endOfText + 2;
  11780. this.stateInClosingTagName(c);
  11781. this.inRCDATA = false;
  11782. return;
  11783. }
  11784. this.sequenceIndex = 0;
  11785. }
  11786. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  11787. this.sequenceIndex += 1;
  11788. } else if (this.sequenceIndex === 0) {
  11789. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  11790. if (c === this.delimiterOpen[0]) {
  11791. this.state = 2;
  11792. this.delimiterIndex = 0;
  11793. this.stateInterpolationOpen(c);
  11794. }
  11795. } else if (this.fastForwardTo(60)) {
  11796. this.sequenceIndex = 1;
  11797. }
  11798. } else {
  11799. this.sequenceIndex = Number(c === 60);
  11800. }
  11801. }
  11802. stateCDATASequence(c) {
  11803. if (c === Sequences.Cdata[this.sequenceIndex]) {
  11804. if (++this.sequenceIndex === Sequences.Cdata.length) {
  11805. this.state = 28;
  11806. this.currentSequence = Sequences.CdataEnd;
  11807. this.sequenceIndex = 0;
  11808. this.sectionStart = this.index + 1;
  11809. }
  11810. } else {
  11811. this.sequenceIndex = 0;
  11812. this.state = 23;
  11813. this.stateInDeclaration(c);
  11814. }
  11815. }
  11816. /**
  11817. * When we wait for one specific character, we can speed things up
  11818. * by skipping through the buffer until we find it.
  11819. *
  11820. * @returns Whether the character was found.
  11821. */
  11822. fastForwardTo(c) {
  11823. while (++this.index < this.buffer.length) {
  11824. const cc = this.buffer.charCodeAt(this.index);
  11825. if (cc === 10) {
  11826. this.newlines.push(this.index);
  11827. }
  11828. if (cc === c) {
  11829. return true;
  11830. }
  11831. }
  11832. this.index = this.buffer.length - 1;
  11833. return false;
  11834. }
  11835. /**
  11836. * Comments and CDATA end with `-->` and `]]>`.
  11837. *
  11838. * Their common qualities are:
  11839. * - Their end sequences have a distinct character they start with.
  11840. * - That character is then repeated, so we have to check multiple repeats.
  11841. * - All characters but the start character of the sequence can be skipped.
  11842. */
  11843. stateInCommentLike(c) {
  11844. if (c === this.currentSequence[this.sequenceIndex]) {
  11845. if (++this.sequenceIndex === this.currentSequence.length) {
  11846. if (this.currentSequence === Sequences.CdataEnd) {
  11847. this.cbs.oncdata(this.sectionStart, this.index - 2);
  11848. } else {
  11849. this.cbs.oncomment(this.sectionStart, this.index - 2);
  11850. }
  11851. this.sequenceIndex = 0;
  11852. this.sectionStart = this.index + 1;
  11853. this.state = 1;
  11854. }
  11855. } else if (this.sequenceIndex === 0) {
  11856. if (this.fastForwardTo(this.currentSequence[0])) {
  11857. this.sequenceIndex = 1;
  11858. }
  11859. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  11860. this.sequenceIndex = 0;
  11861. }
  11862. }
  11863. startSpecial(sequence, offset) {
  11864. this.enterRCDATA(sequence, offset);
  11865. this.state = 31;
  11866. }
  11867. enterRCDATA(sequence, offset) {
  11868. this.inRCDATA = true;
  11869. this.currentSequence = sequence;
  11870. this.sequenceIndex = offset;
  11871. }
  11872. stateBeforeTagName(c) {
  11873. if (c === 33) {
  11874. this.state = 22;
  11875. this.sectionStart = this.index + 1;
  11876. } else if (c === 63) {
  11877. this.state = 24;
  11878. this.sectionStart = this.index + 1;
  11879. } else if (isTagStartChar(c)) {
  11880. this.sectionStart = this.index;
  11881. if (this.mode === 0) {
  11882. this.state = 6;
  11883. } else if (this.inSFCRoot) {
  11884. this.state = 34;
  11885. } else if (!this.inXML) {
  11886. if (c === 116) {
  11887. this.state = 30;
  11888. } else {
  11889. this.state = c === 115 ? 29 : 6;
  11890. }
  11891. } else {
  11892. this.state = 6;
  11893. }
  11894. } else if (c === 47) {
  11895. this.state = 8;
  11896. } else {
  11897. this.state = 1;
  11898. this.stateText(c);
  11899. }
  11900. }
  11901. stateInTagName(c) {
  11902. if (isEndOfTagSection(c)) {
  11903. this.handleTagName(c);
  11904. }
  11905. }
  11906. stateInSFCRootTagName(c) {
  11907. if (isEndOfTagSection(c)) {
  11908. const tag = this.buffer.slice(this.sectionStart, this.index);
  11909. if (tag !== "template") {
  11910. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  11911. }
  11912. this.handleTagName(c);
  11913. }
  11914. }
  11915. handleTagName(c) {
  11916. this.cbs.onopentagname(this.sectionStart, this.index);
  11917. this.sectionStart = -1;
  11918. this.state = 11;
  11919. this.stateBeforeAttrName(c);
  11920. }
  11921. stateBeforeClosingTagName(c) {
  11922. if (isWhitespace(c)) ; else if (c === 62) {
  11923. {
  11924. this.cbs.onerr(14, this.index);
  11925. }
  11926. this.state = 1;
  11927. this.sectionStart = this.index + 1;
  11928. } else {
  11929. this.state = isTagStartChar(c) ? 9 : 27;
  11930. this.sectionStart = this.index;
  11931. }
  11932. }
  11933. stateInClosingTagName(c) {
  11934. if (c === 62 || isWhitespace(c)) {
  11935. this.cbs.onclosetag(this.sectionStart, this.index);
  11936. this.sectionStart = -1;
  11937. this.state = 10;
  11938. this.stateAfterClosingTagName(c);
  11939. }
  11940. }
  11941. stateAfterClosingTagName(c) {
  11942. if (c === 62) {
  11943. this.state = 1;
  11944. this.sectionStart = this.index + 1;
  11945. }
  11946. }
  11947. stateBeforeAttrName(c) {
  11948. if (c === 62) {
  11949. this.cbs.onopentagend(this.index);
  11950. if (this.inRCDATA) {
  11951. this.state = 32;
  11952. } else {
  11953. this.state = 1;
  11954. }
  11955. this.sectionStart = this.index + 1;
  11956. } else if (c === 47) {
  11957. this.state = 7;
  11958. if (this.peek() !== 62) {
  11959. this.cbs.onerr(22, this.index);
  11960. }
  11961. } else if (c === 60 && this.peek() === 47) {
  11962. this.cbs.onopentagend(this.index);
  11963. this.state = 5;
  11964. this.sectionStart = this.index;
  11965. } else if (!isWhitespace(c)) {
  11966. if (c === 61) {
  11967. this.cbs.onerr(
  11968. 19,
  11969. this.index
  11970. );
  11971. }
  11972. this.handleAttrStart(c);
  11973. }
  11974. }
  11975. handleAttrStart(c) {
  11976. if (c === 118 && this.peek() === 45) {
  11977. this.state = 13;
  11978. this.sectionStart = this.index;
  11979. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  11980. this.cbs.ondirname(this.index, this.index + 1);
  11981. this.state = 14;
  11982. this.sectionStart = this.index + 1;
  11983. } else {
  11984. this.state = 12;
  11985. this.sectionStart = this.index;
  11986. }
  11987. }
  11988. stateInSelfClosingTag(c) {
  11989. if (c === 62) {
  11990. this.cbs.onselfclosingtag(this.index);
  11991. this.state = 1;
  11992. this.sectionStart = this.index + 1;
  11993. this.inRCDATA = false;
  11994. } else if (!isWhitespace(c)) {
  11995. this.state = 11;
  11996. this.stateBeforeAttrName(c);
  11997. }
  11998. }
  11999. stateInAttrName(c) {
  12000. if (c === 61 || isEndOfTagSection(c)) {
  12001. this.cbs.onattribname(this.sectionStart, this.index);
  12002. this.handleAttrNameEnd(c);
  12003. } else if (c === 34 || c === 39 || c === 60) {
  12004. this.cbs.onerr(
  12005. 17,
  12006. this.index
  12007. );
  12008. }
  12009. }
  12010. stateInDirName(c) {
  12011. if (c === 61 || isEndOfTagSection(c)) {
  12012. this.cbs.ondirname(this.sectionStart, this.index);
  12013. this.handleAttrNameEnd(c);
  12014. } else if (c === 58) {
  12015. this.cbs.ondirname(this.sectionStart, this.index);
  12016. this.state = 14;
  12017. this.sectionStart = this.index + 1;
  12018. } else if (c === 46) {
  12019. this.cbs.ondirname(this.sectionStart, this.index);
  12020. this.state = 16;
  12021. this.sectionStart = this.index + 1;
  12022. }
  12023. }
  12024. stateInDirArg(c) {
  12025. if (c === 61 || isEndOfTagSection(c)) {
  12026. this.cbs.ondirarg(this.sectionStart, this.index);
  12027. this.handleAttrNameEnd(c);
  12028. } else if (c === 91) {
  12029. this.state = 15;
  12030. } else if (c === 46) {
  12031. this.cbs.ondirarg(this.sectionStart, this.index);
  12032. this.state = 16;
  12033. this.sectionStart = this.index + 1;
  12034. }
  12035. }
  12036. stateInDynamicDirArg(c) {
  12037. if (c === 93) {
  12038. this.state = 14;
  12039. } else if (c === 61 || isEndOfTagSection(c)) {
  12040. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  12041. this.handleAttrNameEnd(c);
  12042. {
  12043. this.cbs.onerr(
  12044. 27,
  12045. this.index
  12046. );
  12047. }
  12048. }
  12049. }
  12050. stateInDirModifier(c) {
  12051. if (c === 61 || isEndOfTagSection(c)) {
  12052. this.cbs.ondirmodifier(this.sectionStart, this.index);
  12053. this.handleAttrNameEnd(c);
  12054. } else if (c === 46) {
  12055. this.cbs.ondirmodifier(this.sectionStart, this.index);
  12056. this.sectionStart = this.index + 1;
  12057. }
  12058. }
  12059. handleAttrNameEnd(c) {
  12060. this.sectionStart = this.index;
  12061. this.state = 17;
  12062. this.cbs.onattribnameend(this.index);
  12063. this.stateAfterAttrName(c);
  12064. }
  12065. stateAfterAttrName(c) {
  12066. if (c === 61) {
  12067. this.state = 18;
  12068. } else if (c === 47 || c === 62) {
  12069. this.cbs.onattribend(0, this.sectionStart);
  12070. this.sectionStart = -1;
  12071. this.state = 11;
  12072. this.stateBeforeAttrName(c);
  12073. } else if (!isWhitespace(c)) {
  12074. this.cbs.onattribend(0, this.sectionStart);
  12075. this.handleAttrStart(c);
  12076. }
  12077. }
  12078. stateBeforeAttrValue(c) {
  12079. if (c === 34) {
  12080. this.state = 19;
  12081. this.sectionStart = this.index + 1;
  12082. } else if (c === 39) {
  12083. this.state = 20;
  12084. this.sectionStart = this.index + 1;
  12085. } else if (!isWhitespace(c)) {
  12086. this.sectionStart = this.index;
  12087. this.state = 21;
  12088. this.stateInAttrValueNoQuotes(c);
  12089. }
  12090. }
  12091. handleInAttrValue(c, quote) {
  12092. if (c === quote || this.fastForwardTo(quote)) {
  12093. this.cbs.onattribdata(this.sectionStart, this.index);
  12094. this.sectionStart = -1;
  12095. this.cbs.onattribend(
  12096. quote === 34 ? 3 : 2,
  12097. this.index + 1
  12098. );
  12099. this.state = 11;
  12100. }
  12101. }
  12102. stateInAttrValueDoubleQuotes(c) {
  12103. this.handleInAttrValue(c, 34);
  12104. }
  12105. stateInAttrValueSingleQuotes(c) {
  12106. this.handleInAttrValue(c, 39);
  12107. }
  12108. stateInAttrValueNoQuotes(c) {
  12109. if (isWhitespace(c) || c === 62) {
  12110. this.cbs.onattribdata(this.sectionStart, this.index);
  12111. this.sectionStart = -1;
  12112. this.cbs.onattribend(1, this.index);
  12113. this.state = 11;
  12114. this.stateBeforeAttrName(c);
  12115. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  12116. this.cbs.onerr(
  12117. 18,
  12118. this.index
  12119. );
  12120. } else ;
  12121. }
  12122. stateBeforeDeclaration(c) {
  12123. if (c === 91) {
  12124. this.state = 26;
  12125. this.sequenceIndex = 0;
  12126. } else {
  12127. this.state = c === 45 ? 25 : 23;
  12128. }
  12129. }
  12130. stateInDeclaration(c) {
  12131. if (c === 62 || this.fastForwardTo(62)) {
  12132. this.state = 1;
  12133. this.sectionStart = this.index + 1;
  12134. }
  12135. }
  12136. stateInProcessingInstruction(c) {
  12137. if (c === 62 || this.fastForwardTo(62)) {
  12138. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  12139. this.state = 1;
  12140. this.sectionStart = this.index + 1;
  12141. }
  12142. }
  12143. stateBeforeComment(c) {
  12144. if (c === 45) {
  12145. this.state = 28;
  12146. this.currentSequence = Sequences.CommentEnd;
  12147. this.sequenceIndex = 2;
  12148. this.sectionStart = this.index + 1;
  12149. } else {
  12150. this.state = 23;
  12151. }
  12152. }
  12153. stateInSpecialComment(c) {
  12154. if (c === 62 || this.fastForwardTo(62)) {
  12155. this.cbs.oncomment(this.sectionStart, this.index);
  12156. this.state = 1;
  12157. this.sectionStart = this.index + 1;
  12158. }
  12159. }
  12160. stateBeforeSpecialS(c) {
  12161. if (c === Sequences.ScriptEnd[3]) {
  12162. this.startSpecial(Sequences.ScriptEnd, 4);
  12163. } else if (c === Sequences.StyleEnd[3]) {
  12164. this.startSpecial(Sequences.StyleEnd, 4);
  12165. } else {
  12166. this.state = 6;
  12167. this.stateInTagName(c);
  12168. }
  12169. }
  12170. stateBeforeSpecialT(c) {
  12171. if (c === Sequences.TitleEnd[3]) {
  12172. this.startSpecial(Sequences.TitleEnd, 4);
  12173. } else if (c === Sequences.TextareaEnd[3]) {
  12174. this.startSpecial(Sequences.TextareaEnd, 4);
  12175. } else {
  12176. this.state = 6;
  12177. this.stateInTagName(c);
  12178. }
  12179. }
  12180. startEntity() {
  12181. }
  12182. stateInEntity() {
  12183. }
  12184. /**
  12185. * Iterates through the buffer, calling the function corresponding to the current state.
  12186. *
  12187. * States that are more likely to be hit are higher up, as a performance improvement.
  12188. */
  12189. parse(input) {
  12190. this.buffer = input;
  12191. while (this.index < this.buffer.length) {
  12192. const c = this.buffer.charCodeAt(this.index);
  12193. if (c === 10) {
  12194. this.newlines.push(this.index);
  12195. }
  12196. switch (this.state) {
  12197. case 1: {
  12198. this.stateText(c);
  12199. break;
  12200. }
  12201. case 2: {
  12202. this.stateInterpolationOpen(c);
  12203. break;
  12204. }
  12205. case 3: {
  12206. this.stateInterpolation(c);
  12207. break;
  12208. }
  12209. case 4: {
  12210. this.stateInterpolationClose(c);
  12211. break;
  12212. }
  12213. case 31: {
  12214. this.stateSpecialStartSequence(c);
  12215. break;
  12216. }
  12217. case 32: {
  12218. this.stateInRCDATA(c);
  12219. break;
  12220. }
  12221. case 26: {
  12222. this.stateCDATASequence(c);
  12223. break;
  12224. }
  12225. case 19: {
  12226. this.stateInAttrValueDoubleQuotes(c);
  12227. break;
  12228. }
  12229. case 12: {
  12230. this.stateInAttrName(c);
  12231. break;
  12232. }
  12233. case 13: {
  12234. this.stateInDirName(c);
  12235. break;
  12236. }
  12237. case 14: {
  12238. this.stateInDirArg(c);
  12239. break;
  12240. }
  12241. case 15: {
  12242. this.stateInDynamicDirArg(c);
  12243. break;
  12244. }
  12245. case 16: {
  12246. this.stateInDirModifier(c);
  12247. break;
  12248. }
  12249. case 28: {
  12250. this.stateInCommentLike(c);
  12251. break;
  12252. }
  12253. case 27: {
  12254. this.stateInSpecialComment(c);
  12255. break;
  12256. }
  12257. case 11: {
  12258. this.stateBeforeAttrName(c);
  12259. break;
  12260. }
  12261. case 6: {
  12262. this.stateInTagName(c);
  12263. break;
  12264. }
  12265. case 34: {
  12266. this.stateInSFCRootTagName(c);
  12267. break;
  12268. }
  12269. case 9: {
  12270. this.stateInClosingTagName(c);
  12271. break;
  12272. }
  12273. case 5: {
  12274. this.stateBeforeTagName(c);
  12275. break;
  12276. }
  12277. case 17: {
  12278. this.stateAfterAttrName(c);
  12279. break;
  12280. }
  12281. case 20: {
  12282. this.stateInAttrValueSingleQuotes(c);
  12283. break;
  12284. }
  12285. case 18: {
  12286. this.stateBeforeAttrValue(c);
  12287. break;
  12288. }
  12289. case 8: {
  12290. this.stateBeforeClosingTagName(c);
  12291. break;
  12292. }
  12293. case 10: {
  12294. this.stateAfterClosingTagName(c);
  12295. break;
  12296. }
  12297. case 29: {
  12298. this.stateBeforeSpecialS(c);
  12299. break;
  12300. }
  12301. case 30: {
  12302. this.stateBeforeSpecialT(c);
  12303. break;
  12304. }
  12305. case 21: {
  12306. this.stateInAttrValueNoQuotes(c);
  12307. break;
  12308. }
  12309. case 7: {
  12310. this.stateInSelfClosingTag(c);
  12311. break;
  12312. }
  12313. case 23: {
  12314. this.stateInDeclaration(c);
  12315. break;
  12316. }
  12317. case 22: {
  12318. this.stateBeforeDeclaration(c);
  12319. break;
  12320. }
  12321. case 25: {
  12322. this.stateBeforeComment(c);
  12323. break;
  12324. }
  12325. case 24: {
  12326. this.stateInProcessingInstruction(c);
  12327. break;
  12328. }
  12329. case 33: {
  12330. this.stateInEntity();
  12331. break;
  12332. }
  12333. }
  12334. this.index++;
  12335. }
  12336. this.cleanup();
  12337. this.finish();
  12338. }
  12339. /**
  12340. * Remove data that has already been consumed from the buffer.
  12341. */
  12342. cleanup() {
  12343. if (this.sectionStart !== this.index) {
  12344. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  12345. this.cbs.ontext(this.sectionStart, this.index);
  12346. this.sectionStart = this.index;
  12347. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  12348. this.cbs.onattribdata(this.sectionStart, this.index);
  12349. this.sectionStart = this.index;
  12350. }
  12351. }
  12352. }
  12353. finish() {
  12354. this.handleTrailingData();
  12355. this.cbs.onend();
  12356. }
  12357. /** Handle any trailing data. */
  12358. handleTrailingData() {
  12359. const endIndex = this.buffer.length;
  12360. if (this.sectionStart >= endIndex) {
  12361. return;
  12362. }
  12363. if (this.state === 28) {
  12364. if (this.currentSequence === Sequences.CdataEnd) {
  12365. this.cbs.oncdata(this.sectionStart, endIndex);
  12366. } else {
  12367. this.cbs.oncomment(this.sectionStart, endIndex);
  12368. }
  12369. } 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 {
  12370. this.cbs.ontext(this.sectionStart, endIndex);
  12371. }
  12372. }
  12373. emitCodePoint(cp, consumed) {
  12374. }
  12375. }
  12376. function defaultOnError(error) {
  12377. throw error;
  12378. }
  12379. function defaultOnWarn(msg) {
  12380. console.warn(`[Vue warn] ${msg.message}`);
  12381. }
  12382. function createCompilerError(code, loc, messages, additionalMessage) {
  12383. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  12384. const error = new SyntaxError(String(msg));
  12385. error.code = code;
  12386. error.loc = loc;
  12387. return error;
  12388. }
  12389. const errorMessages = {
  12390. // parse errors
  12391. [0]: "Illegal comment.",
  12392. [1]: "CDATA section is allowed only in XML context.",
  12393. [2]: "Duplicate attribute.",
  12394. [3]: "End tag cannot have attributes.",
  12395. [4]: "Illegal '/' in tags.",
  12396. [5]: "Unexpected EOF in tag.",
  12397. [6]: "Unexpected EOF in CDATA section.",
  12398. [7]: "Unexpected EOF in comment.",
  12399. [8]: "Unexpected EOF in script.",
  12400. [9]: "Unexpected EOF in tag.",
  12401. [10]: "Incorrectly closed comment.",
  12402. [11]: "Incorrectly opened comment.",
  12403. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  12404. [13]: "Attribute value was expected.",
  12405. [14]: "End tag name was expected.",
  12406. [15]: "Whitespace was expected.",
  12407. [16]: "Unexpected '<!--' in comment.",
  12408. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  12409. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  12410. [19]: "Attribute name cannot start with '='.",
  12411. [21]: "'<?' is allowed only in XML context.",
  12412. [20]: `Unexpected null character.`,
  12413. [22]: "Illegal '/' in tags.",
  12414. // Vue-specific parse errors
  12415. [23]: "Invalid end tag.",
  12416. [24]: "Element is missing end tag.",
  12417. [25]: "Interpolation end sign was not found.",
  12418. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  12419. [26]: "Legal directive name was expected.",
  12420. // transform errors
  12421. [28]: `v-if/v-else-if is missing expression.`,
  12422. [29]: `v-if/else branches must use unique keys.`,
  12423. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  12424. [31]: `v-for is missing expression.`,
  12425. [32]: `v-for has invalid expression.`,
  12426. [33]: `<template v-for> key should be placed on the <template> tag.`,
  12427. [34]: `v-bind is missing expression.`,
  12428. [52]: `v-bind with same-name shorthand only allows static argument.`,
  12429. [35]: `v-on is missing expression.`,
  12430. [36]: `Unexpected custom directive on <slot> outlet.`,
  12431. [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.`,
  12432. [38]: `Duplicate slot names found. `,
  12433. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  12434. [40]: `v-slot can only be used on components or <template> tags.`,
  12435. [41]: `v-model is missing expression.`,
  12436. [42]: `v-model value must be a valid JavaScript member expression.`,
  12437. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  12438. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  12439. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  12440. [45]: `Error parsing JavaScript expression: `,
  12441. [46]: `<KeepAlive> expects exactly one child component.`,
  12442. [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.`,
  12443. // generic errors
  12444. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  12445. [48]: `ES module mode is not supported in this build of compiler.`,
  12446. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  12447. [50]: `"scopeId" option is only supported in module mode.`,
  12448. // just to fulfill types
  12449. [53]: ``
  12450. };
  12451. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  12452. function isCoreComponent(tag) {
  12453. switch (tag) {
  12454. case "Teleport":
  12455. case "teleport":
  12456. return TELEPORT;
  12457. case "Suspense":
  12458. case "suspense":
  12459. return SUSPENSE;
  12460. case "KeepAlive":
  12461. case "keep-alive":
  12462. return KEEP_ALIVE;
  12463. case "BaseTransition":
  12464. case "base-transition":
  12465. return BASE_TRANSITION;
  12466. }
  12467. }
  12468. const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
  12469. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  12470. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  12471. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  12472. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  12473. const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
  12474. const isMemberExpressionBrowser = (exp) => {
  12475. const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
  12476. let state = 0 /* inMemberExp */;
  12477. let stateStack = [];
  12478. let currentOpenBracketCount = 0;
  12479. let currentOpenParensCount = 0;
  12480. let currentStringType = null;
  12481. for (let i = 0; i < path.length; i++) {
  12482. const char = path.charAt(i);
  12483. switch (state) {
  12484. case 0 /* inMemberExp */:
  12485. if (char === "[") {
  12486. stateStack.push(state);
  12487. state = 1 /* inBrackets */;
  12488. currentOpenBracketCount++;
  12489. } else if (char === "(") {
  12490. stateStack.push(state);
  12491. state = 2 /* inParens */;
  12492. currentOpenParensCount++;
  12493. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  12494. return false;
  12495. }
  12496. break;
  12497. case 1 /* inBrackets */:
  12498. if (char === `'` || char === `"` || char === "`") {
  12499. stateStack.push(state);
  12500. state = 3 /* inString */;
  12501. currentStringType = char;
  12502. } else if (char === `[`) {
  12503. currentOpenBracketCount++;
  12504. } else if (char === `]`) {
  12505. if (!--currentOpenBracketCount) {
  12506. state = stateStack.pop();
  12507. }
  12508. }
  12509. break;
  12510. case 2 /* inParens */:
  12511. if (char === `'` || char === `"` || char === "`") {
  12512. stateStack.push(state);
  12513. state = 3 /* inString */;
  12514. currentStringType = char;
  12515. } else if (char === `(`) {
  12516. currentOpenParensCount++;
  12517. } else if (char === `)`) {
  12518. if (i === path.length - 1) {
  12519. return false;
  12520. }
  12521. if (!--currentOpenParensCount) {
  12522. state = stateStack.pop();
  12523. }
  12524. }
  12525. break;
  12526. case 3 /* inString */:
  12527. if (char === currentStringType) {
  12528. state = stateStack.pop();
  12529. currentStringType = null;
  12530. }
  12531. break;
  12532. }
  12533. }
  12534. return !currentOpenBracketCount && !currentOpenParensCount;
  12535. };
  12536. const isMemberExpression = isMemberExpressionBrowser ;
  12537. const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  12538. const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
  12539. const isFnExpression = isFnExpressionBrowser ;
  12540. function assert(condition, msg) {
  12541. if (!condition) {
  12542. throw new Error(msg || `unexpected compiler condition`);
  12543. }
  12544. }
  12545. function findDir(node, name, allowEmpty = false) {
  12546. for (let i = 0; i < node.props.length; i++) {
  12547. const p = node.props[i];
  12548. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  12549. return p;
  12550. }
  12551. }
  12552. }
  12553. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  12554. for (let i = 0; i < node.props.length; i++) {
  12555. const p = node.props[i];
  12556. if (p.type === 6) {
  12557. if (dynamicOnly) continue;
  12558. if (p.name === name && (p.value || allowEmpty)) {
  12559. return p;
  12560. }
  12561. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  12562. return p;
  12563. }
  12564. }
  12565. }
  12566. function isStaticArgOf(arg, name) {
  12567. return !!(arg && isStaticExp(arg) && arg.content === name);
  12568. }
  12569. function hasDynamicKeyVBind(node) {
  12570. return node.props.some(
  12571. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  12572. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  12573. !p.arg.isStatic)
  12574. // v-bind:[foo]
  12575. );
  12576. }
  12577. function isText$1(node) {
  12578. return node.type === 5 || node.type === 2;
  12579. }
  12580. function isVSlot(p) {
  12581. return p.type === 7 && p.name === "slot";
  12582. }
  12583. function isTemplateNode(node) {
  12584. return node.type === 1 && node.tagType === 3;
  12585. }
  12586. function isSlotOutlet(node) {
  12587. return node.type === 1 && node.tagType === 2;
  12588. }
  12589. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  12590. function getUnnormalizedProps(props, callPath = []) {
  12591. if (props && !isString(props) && props.type === 14) {
  12592. const callee = props.callee;
  12593. if (!isString(callee) && propsHelperSet.has(callee)) {
  12594. return getUnnormalizedProps(
  12595. props.arguments[0],
  12596. callPath.concat(props)
  12597. );
  12598. }
  12599. }
  12600. return [props, callPath];
  12601. }
  12602. function injectProp(node, prop, context) {
  12603. let propsWithInjection;
  12604. let props = node.type === 13 ? node.props : node.arguments[2];
  12605. let callPath = [];
  12606. let parentCall;
  12607. if (props && !isString(props) && props.type === 14) {
  12608. const ret = getUnnormalizedProps(props);
  12609. props = ret[0];
  12610. callPath = ret[1];
  12611. parentCall = callPath[callPath.length - 1];
  12612. }
  12613. if (props == null || isString(props)) {
  12614. propsWithInjection = createObjectExpression([prop]);
  12615. } else if (props.type === 14) {
  12616. const first = props.arguments[0];
  12617. if (!isString(first) && first.type === 15) {
  12618. if (!hasProp(prop, first)) {
  12619. first.properties.unshift(prop);
  12620. }
  12621. } else {
  12622. if (props.callee === TO_HANDLERS) {
  12623. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  12624. createObjectExpression([prop]),
  12625. props
  12626. ]);
  12627. } else {
  12628. props.arguments.unshift(createObjectExpression([prop]));
  12629. }
  12630. }
  12631. !propsWithInjection && (propsWithInjection = props);
  12632. } else if (props.type === 15) {
  12633. if (!hasProp(prop, props)) {
  12634. props.properties.unshift(prop);
  12635. }
  12636. propsWithInjection = props;
  12637. } else {
  12638. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  12639. createObjectExpression([prop]),
  12640. props
  12641. ]);
  12642. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  12643. parentCall = callPath[callPath.length - 2];
  12644. }
  12645. }
  12646. if (node.type === 13) {
  12647. if (parentCall) {
  12648. parentCall.arguments[0] = propsWithInjection;
  12649. } else {
  12650. node.props = propsWithInjection;
  12651. }
  12652. } else {
  12653. if (parentCall) {
  12654. parentCall.arguments[0] = propsWithInjection;
  12655. } else {
  12656. node.arguments[2] = propsWithInjection;
  12657. }
  12658. }
  12659. }
  12660. function hasProp(prop, props) {
  12661. let result = false;
  12662. if (prop.key.type === 4) {
  12663. const propKeyName = prop.key.content;
  12664. result = props.properties.some(
  12665. (p) => p.key.type === 4 && p.key.content === propKeyName
  12666. );
  12667. }
  12668. return result;
  12669. }
  12670. function toValidAssetId(name, type) {
  12671. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  12672. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  12673. })}`;
  12674. }
  12675. function getMemoedVNodeCall(node) {
  12676. if (node.type === 14 && node.callee === WITH_MEMO) {
  12677. return node.arguments[1].returns;
  12678. } else {
  12679. return node;
  12680. }
  12681. }
  12682. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
  12683. const defaultParserOptions = {
  12684. parseMode: "base",
  12685. ns: 0,
  12686. delimiters: [`{{`, `}}`],
  12687. getNamespace: () => 0,
  12688. isVoidTag: NO,
  12689. isPreTag: NO,
  12690. isCustomElement: NO,
  12691. onError: defaultOnError,
  12692. onWarn: defaultOnWarn,
  12693. comments: true,
  12694. prefixIdentifiers: false
  12695. };
  12696. let currentOptions = defaultParserOptions;
  12697. let currentRoot = null;
  12698. let currentInput = "";
  12699. let currentOpenTag = null;
  12700. let currentProp = null;
  12701. let currentAttrValue = "";
  12702. let currentAttrStartIndex = -1;
  12703. let currentAttrEndIndex = -1;
  12704. let inPre = 0;
  12705. let inVPre = false;
  12706. let currentVPreBoundary = null;
  12707. const stack = [];
  12708. const tokenizer = new Tokenizer(stack, {
  12709. onerr: emitError,
  12710. ontext(start, end) {
  12711. onText(getSlice(start, end), start, end);
  12712. },
  12713. ontextentity(char, start, end) {
  12714. onText(char, start, end);
  12715. },
  12716. oninterpolation(start, end) {
  12717. if (inVPre) {
  12718. return onText(getSlice(start, end), start, end);
  12719. }
  12720. let innerStart = start + tokenizer.delimiterOpen.length;
  12721. let innerEnd = end - tokenizer.delimiterClose.length;
  12722. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  12723. innerStart++;
  12724. }
  12725. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  12726. innerEnd--;
  12727. }
  12728. let exp = getSlice(innerStart, innerEnd);
  12729. if (exp.includes("&")) {
  12730. {
  12731. exp = currentOptions.decodeEntities(exp, false);
  12732. }
  12733. }
  12734. addNode({
  12735. type: 5,
  12736. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  12737. loc: getLoc(start, end)
  12738. });
  12739. },
  12740. onopentagname(start, end) {
  12741. const name = getSlice(start, end);
  12742. currentOpenTag = {
  12743. type: 1,
  12744. tag: name,
  12745. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  12746. tagType: 0,
  12747. // will be refined on tag close
  12748. props: [],
  12749. children: [],
  12750. loc: getLoc(start - 1, end),
  12751. codegenNode: void 0
  12752. };
  12753. },
  12754. onopentagend(end) {
  12755. endOpenTag(end);
  12756. },
  12757. onclosetag(start, end) {
  12758. const name = getSlice(start, end);
  12759. if (!currentOptions.isVoidTag(name)) {
  12760. let found = false;
  12761. for (let i = 0; i < stack.length; i++) {
  12762. const e = stack[i];
  12763. if (e.tag.toLowerCase() === name.toLowerCase()) {
  12764. found = true;
  12765. if (i > 0) {
  12766. emitError(24, stack[0].loc.start.offset);
  12767. }
  12768. for (let j = 0; j <= i; j++) {
  12769. const el = stack.shift();
  12770. onCloseTag(el, end, j < i);
  12771. }
  12772. break;
  12773. }
  12774. }
  12775. if (!found) {
  12776. emitError(23, backTrack(start, 60));
  12777. }
  12778. }
  12779. },
  12780. onselfclosingtag(end) {
  12781. const name = currentOpenTag.tag;
  12782. currentOpenTag.isSelfClosing = true;
  12783. endOpenTag(end);
  12784. if (stack[0] && stack[0].tag === name) {
  12785. onCloseTag(stack.shift(), end);
  12786. }
  12787. },
  12788. onattribname(start, end) {
  12789. currentProp = {
  12790. type: 6,
  12791. name: getSlice(start, end),
  12792. nameLoc: getLoc(start, end),
  12793. value: void 0,
  12794. loc: getLoc(start)
  12795. };
  12796. },
  12797. ondirname(start, end) {
  12798. const raw = getSlice(start, end);
  12799. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  12800. if (!inVPre && name === "") {
  12801. emitError(26, start);
  12802. }
  12803. if (inVPre || name === "") {
  12804. currentProp = {
  12805. type: 6,
  12806. name: raw,
  12807. nameLoc: getLoc(start, end),
  12808. value: void 0,
  12809. loc: getLoc(start)
  12810. };
  12811. } else {
  12812. currentProp = {
  12813. type: 7,
  12814. name,
  12815. rawName: raw,
  12816. exp: void 0,
  12817. arg: void 0,
  12818. modifiers: raw === "." ? ["prop"] : [],
  12819. loc: getLoc(start)
  12820. };
  12821. if (name === "pre") {
  12822. inVPre = tokenizer.inVPre = true;
  12823. currentVPreBoundary = currentOpenTag;
  12824. const props = currentOpenTag.props;
  12825. for (let i = 0; i < props.length; i++) {
  12826. if (props[i].type === 7) {
  12827. props[i] = dirToAttr(props[i]);
  12828. }
  12829. }
  12830. }
  12831. }
  12832. },
  12833. ondirarg(start, end) {
  12834. if (start === end) return;
  12835. const arg = getSlice(start, end);
  12836. if (inVPre) {
  12837. currentProp.name += arg;
  12838. setLocEnd(currentProp.nameLoc, end);
  12839. } else {
  12840. const isStatic = arg[0] !== `[`;
  12841. currentProp.arg = createExp(
  12842. isStatic ? arg : arg.slice(1, -1),
  12843. isStatic,
  12844. getLoc(start, end),
  12845. isStatic ? 3 : 0
  12846. );
  12847. }
  12848. },
  12849. ondirmodifier(start, end) {
  12850. const mod = getSlice(start, end);
  12851. if (inVPre) {
  12852. currentProp.name += "." + mod;
  12853. setLocEnd(currentProp.nameLoc, end);
  12854. } else if (currentProp.name === "slot") {
  12855. const arg = currentProp.arg;
  12856. if (arg) {
  12857. arg.content += "." + mod;
  12858. setLocEnd(arg.loc, end);
  12859. }
  12860. } else {
  12861. currentProp.modifiers.push(mod);
  12862. }
  12863. },
  12864. onattribdata(start, end) {
  12865. currentAttrValue += getSlice(start, end);
  12866. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  12867. currentAttrEndIndex = end;
  12868. },
  12869. onattribentity(char, start, end) {
  12870. currentAttrValue += char;
  12871. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  12872. currentAttrEndIndex = end;
  12873. },
  12874. onattribnameend(end) {
  12875. const start = currentProp.loc.start.offset;
  12876. const name = getSlice(start, end);
  12877. if (currentProp.type === 7) {
  12878. currentProp.rawName = name;
  12879. }
  12880. if (currentOpenTag.props.some(
  12881. (p) => (p.type === 7 ? p.rawName : p.name) === name
  12882. )) {
  12883. emitError(2, start);
  12884. }
  12885. },
  12886. onattribend(quote, end) {
  12887. if (currentOpenTag && currentProp) {
  12888. setLocEnd(currentProp.loc, end);
  12889. if (quote !== 0) {
  12890. if (currentAttrValue.includes("&")) {
  12891. currentAttrValue = currentOptions.decodeEntities(
  12892. currentAttrValue,
  12893. true
  12894. );
  12895. }
  12896. if (currentProp.type === 6) {
  12897. if (currentProp.name === "class") {
  12898. currentAttrValue = condense(currentAttrValue).trim();
  12899. }
  12900. if (quote === 1 && !currentAttrValue) {
  12901. emitError(13, end);
  12902. }
  12903. currentProp.value = {
  12904. type: 2,
  12905. content: currentAttrValue,
  12906. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  12907. };
  12908. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  12909. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  12910. }
  12911. } else {
  12912. let expParseMode = 0 /* Normal */;
  12913. currentProp.exp = createExp(
  12914. currentAttrValue,
  12915. false,
  12916. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  12917. 0,
  12918. expParseMode
  12919. );
  12920. if (currentProp.name === "for") {
  12921. currentProp.forParseResult = parseForExpression(currentProp.exp);
  12922. }
  12923. }
  12924. }
  12925. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  12926. currentOpenTag.props.push(currentProp);
  12927. }
  12928. }
  12929. currentAttrValue = "";
  12930. currentAttrStartIndex = currentAttrEndIndex = -1;
  12931. },
  12932. oncomment(start, end) {
  12933. if (currentOptions.comments) {
  12934. addNode({
  12935. type: 3,
  12936. content: getSlice(start, end),
  12937. loc: getLoc(start - 4, end + 3)
  12938. });
  12939. }
  12940. },
  12941. onend() {
  12942. const end = currentInput.length;
  12943. if (tokenizer.state !== 1) {
  12944. switch (tokenizer.state) {
  12945. case 5:
  12946. case 8:
  12947. emitError(5, end);
  12948. break;
  12949. case 3:
  12950. case 4:
  12951. emitError(
  12952. 25,
  12953. tokenizer.sectionStart
  12954. );
  12955. break;
  12956. case 28:
  12957. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  12958. emitError(6, end);
  12959. } else {
  12960. emitError(7, end);
  12961. }
  12962. break;
  12963. case 6:
  12964. case 7:
  12965. case 9:
  12966. case 11:
  12967. case 12:
  12968. case 13:
  12969. case 14:
  12970. case 15:
  12971. case 16:
  12972. case 17:
  12973. case 18:
  12974. case 19:
  12975. case 20:
  12976. case 21:
  12977. emitError(9, end);
  12978. break;
  12979. }
  12980. }
  12981. for (let index = 0; index < stack.length; index++) {
  12982. onCloseTag(stack[index], end - 1);
  12983. emitError(24, stack[index].loc.start.offset);
  12984. }
  12985. },
  12986. oncdata(start, end) {
  12987. if (stack[0].ns !== 0) {
  12988. onText(getSlice(start, end), start, end);
  12989. } else {
  12990. emitError(1, start - 9);
  12991. }
  12992. },
  12993. onprocessinginstruction(start) {
  12994. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  12995. emitError(
  12996. 21,
  12997. start - 1
  12998. );
  12999. }
  13000. }
  13001. });
  13002. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  13003. const stripParensRE = /^\(|\)$/g;
  13004. function parseForExpression(input) {
  13005. const loc = input.loc;
  13006. const exp = input.content;
  13007. const inMatch = exp.match(forAliasRE);
  13008. if (!inMatch) return;
  13009. const [, LHS, RHS] = inMatch;
  13010. const createAliasExpression = (content, offset, asParam = false) => {
  13011. const start = loc.start.offset + offset;
  13012. const end = start + content.length;
  13013. return createExp(
  13014. content,
  13015. false,
  13016. getLoc(start, end),
  13017. 0,
  13018. asParam ? 1 /* Params */ : 0 /* Normal */
  13019. );
  13020. };
  13021. const result = {
  13022. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  13023. value: void 0,
  13024. key: void 0,
  13025. index: void 0,
  13026. finalized: false
  13027. };
  13028. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  13029. const trimmedOffset = LHS.indexOf(valueContent);
  13030. const iteratorMatch = valueContent.match(forIteratorRE);
  13031. if (iteratorMatch) {
  13032. valueContent = valueContent.replace(forIteratorRE, "").trim();
  13033. const keyContent = iteratorMatch[1].trim();
  13034. let keyOffset;
  13035. if (keyContent) {
  13036. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  13037. result.key = createAliasExpression(keyContent, keyOffset, true);
  13038. }
  13039. if (iteratorMatch[2]) {
  13040. const indexContent = iteratorMatch[2].trim();
  13041. if (indexContent) {
  13042. result.index = createAliasExpression(
  13043. indexContent,
  13044. exp.indexOf(
  13045. indexContent,
  13046. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  13047. ),
  13048. true
  13049. );
  13050. }
  13051. }
  13052. }
  13053. if (valueContent) {
  13054. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  13055. }
  13056. return result;
  13057. }
  13058. function getSlice(start, end) {
  13059. return currentInput.slice(start, end);
  13060. }
  13061. function endOpenTag(end) {
  13062. if (tokenizer.inSFCRoot) {
  13063. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  13064. }
  13065. addNode(currentOpenTag);
  13066. const { tag, ns } = currentOpenTag;
  13067. if (ns === 0 && currentOptions.isPreTag(tag)) {
  13068. inPre++;
  13069. }
  13070. if (currentOptions.isVoidTag(tag)) {
  13071. onCloseTag(currentOpenTag, end);
  13072. } else {
  13073. stack.unshift(currentOpenTag);
  13074. if (ns === 1 || ns === 2) {
  13075. tokenizer.inXML = true;
  13076. }
  13077. }
  13078. currentOpenTag = null;
  13079. }
  13080. function onText(content, start, end) {
  13081. {
  13082. const tag = stack[0] && stack[0].tag;
  13083. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  13084. content = currentOptions.decodeEntities(content, false);
  13085. }
  13086. }
  13087. const parent = stack[0] || currentRoot;
  13088. const lastNode = parent.children[parent.children.length - 1];
  13089. if (lastNode && lastNode.type === 2) {
  13090. lastNode.content += content;
  13091. setLocEnd(lastNode.loc, end);
  13092. } else {
  13093. parent.children.push({
  13094. type: 2,
  13095. content,
  13096. loc: getLoc(start, end)
  13097. });
  13098. }
  13099. }
  13100. function onCloseTag(el, end, isImplied = false) {
  13101. if (isImplied) {
  13102. setLocEnd(el.loc, backTrack(end, 60));
  13103. } else {
  13104. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  13105. }
  13106. if (tokenizer.inSFCRoot) {
  13107. if (el.children.length) {
  13108. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  13109. } else {
  13110. el.innerLoc.end = extend({}, el.innerLoc.start);
  13111. }
  13112. el.innerLoc.source = getSlice(
  13113. el.innerLoc.start.offset,
  13114. el.innerLoc.end.offset
  13115. );
  13116. }
  13117. const { tag, ns } = el;
  13118. if (!inVPre) {
  13119. if (tag === "slot") {
  13120. el.tagType = 2;
  13121. } else if (isFragmentTemplate(el)) {
  13122. el.tagType = 3;
  13123. } else if (isComponent(el)) {
  13124. el.tagType = 1;
  13125. }
  13126. }
  13127. if (!tokenizer.inRCDATA) {
  13128. el.children = condenseWhitespace(el.children, el.tag);
  13129. }
  13130. if (ns === 0 && currentOptions.isPreTag(tag)) {
  13131. inPre--;
  13132. }
  13133. if (currentVPreBoundary === el) {
  13134. inVPre = tokenizer.inVPre = false;
  13135. currentVPreBoundary = null;
  13136. }
  13137. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  13138. tokenizer.inXML = false;
  13139. }
  13140. }
  13141. function lookAhead(index, c) {
  13142. let i = index;
  13143. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
  13144. return i;
  13145. }
  13146. function backTrack(index, c) {
  13147. let i = index;
  13148. while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
  13149. return i;
  13150. }
  13151. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  13152. function isFragmentTemplate({ tag, props }) {
  13153. if (tag === "template") {
  13154. for (let i = 0; i < props.length; i++) {
  13155. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  13156. return true;
  13157. }
  13158. }
  13159. }
  13160. return false;
  13161. }
  13162. function isComponent({ tag, props }) {
  13163. if (currentOptions.isCustomElement(tag)) {
  13164. return false;
  13165. }
  13166. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  13167. return true;
  13168. }
  13169. for (let i = 0; i < props.length; i++) {
  13170. const p = props[i];
  13171. if (p.type === 6) {
  13172. if (p.name === "is" && p.value) {
  13173. if (p.value.content.startsWith("vue:")) {
  13174. return true;
  13175. }
  13176. }
  13177. }
  13178. }
  13179. return false;
  13180. }
  13181. function isUpperCase(c) {
  13182. return c > 64 && c < 91;
  13183. }
  13184. const windowsNewlineRE = /\r\n/g;
  13185. function condenseWhitespace(nodes, tag) {
  13186. const shouldCondense = currentOptions.whitespace !== "preserve";
  13187. let removedWhitespace = false;
  13188. for (let i = 0; i < nodes.length; i++) {
  13189. const node = nodes[i];
  13190. if (node.type === 2) {
  13191. if (!inPre) {
  13192. if (isAllWhitespace(node.content)) {
  13193. const prev = nodes[i - 1] && nodes[i - 1].type;
  13194. const next = nodes[i + 1] && nodes[i + 1].type;
  13195. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  13196. removedWhitespace = true;
  13197. nodes[i] = null;
  13198. } else {
  13199. node.content = " ";
  13200. }
  13201. } else if (shouldCondense) {
  13202. node.content = condense(node.content);
  13203. }
  13204. } else {
  13205. node.content = node.content.replace(windowsNewlineRE, "\n");
  13206. }
  13207. }
  13208. }
  13209. if (inPre && tag && currentOptions.isPreTag(tag)) {
  13210. const first = nodes[0];
  13211. if (first && first.type === 2) {
  13212. first.content = first.content.replace(/^\r?\n/, "");
  13213. }
  13214. }
  13215. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  13216. }
  13217. function isAllWhitespace(str) {
  13218. for (let i = 0; i < str.length; i++) {
  13219. if (!isWhitespace(str.charCodeAt(i))) {
  13220. return false;
  13221. }
  13222. }
  13223. return true;
  13224. }
  13225. function hasNewlineChar(str) {
  13226. for (let i = 0; i < str.length; i++) {
  13227. const c = str.charCodeAt(i);
  13228. if (c === 10 || c === 13) {
  13229. return true;
  13230. }
  13231. }
  13232. return false;
  13233. }
  13234. function condense(str) {
  13235. let ret = "";
  13236. let prevCharIsWhitespace = false;
  13237. for (let i = 0; i < str.length; i++) {
  13238. if (isWhitespace(str.charCodeAt(i))) {
  13239. if (!prevCharIsWhitespace) {
  13240. ret += " ";
  13241. prevCharIsWhitespace = true;
  13242. }
  13243. } else {
  13244. ret += str[i];
  13245. prevCharIsWhitespace = false;
  13246. }
  13247. }
  13248. return ret;
  13249. }
  13250. function addNode(node) {
  13251. (stack[0] || currentRoot).children.push(node);
  13252. }
  13253. function getLoc(start, end) {
  13254. return {
  13255. start: tokenizer.getPos(start),
  13256. // @ts-expect-error allow late attachment
  13257. end: end == null ? end : tokenizer.getPos(end),
  13258. // @ts-expect-error allow late attachment
  13259. source: end == null ? end : getSlice(start, end)
  13260. };
  13261. }
  13262. function setLocEnd(loc, end) {
  13263. loc.end = tokenizer.getPos(end);
  13264. loc.source = getSlice(loc.start.offset, end);
  13265. }
  13266. function dirToAttr(dir) {
  13267. const attr = {
  13268. type: 6,
  13269. name: dir.rawName,
  13270. nameLoc: getLoc(
  13271. dir.loc.start.offset,
  13272. dir.loc.start.offset + dir.rawName.length
  13273. ),
  13274. value: void 0,
  13275. loc: dir.loc
  13276. };
  13277. if (dir.exp) {
  13278. const loc = dir.exp.loc;
  13279. if (loc.end.offset < dir.loc.end.offset) {
  13280. loc.start.offset--;
  13281. loc.start.column--;
  13282. loc.end.offset++;
  13283. loc.end.column++;
  13284. }
  13285. attr.value = {
  13286. type: 2,
  13287. content: dir.exp.content,
  13288. loc
  13289. };
  13290. }
  13291. return attr;
  13292. }
  13293. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  13294. const exp = createSimpleExpression(content, isStatic, loc, constType);
  13295. return exp;
  13296. }
  13297. function emitError(code, index, message) {
  13298. currentOptions.onError(
  13299. createCompilerError(code, getLoc(index, index), void 0, message)
  13300. );
  13301. }
  13302. function reset() {
  13303. tokenizer.reset();
  13304. currentOpenTag = null;
  13305. currentProp = null;
  13306. currentAttrValue = "";
  13307. currentAttrStartIndex = -1;
  13308. currentAttrEndIndex = -1;
  13309. stack.length = 0;
  13310. }
  13311. function baseParse(input, options) {
  13312. reset();
  13313. currentInput = input;
  13314. currentOptions = extend({}, defaultParserOptions);
  13315. if (options) {
  13316. let key;
  13317. for (key in options) {
  13318. if (options[key] != null) {
  13319. currentOptions[key] = options[key];
  13320. }
  13321. }
  13322. }
  13323. {
  13324. if (!currentOptions.decodeEntities) {
  13325. throw new Error(
  13326. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  13327. );
  13328. }
  13329. }
  13330. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  13331. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  13332. const delimiters = options && options.delimiters;
  13333. if (delimiters) {
  13334. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  13335. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  13336. }
  13337. const root = currentRoot = createRoot([], input);
  13338. tokenizer.parse(currentInput);
  13339. root.loc = getLoc(0, input.length);
  13340. root.children = condenseWhitespace(root.children);
  13341. currentRoot = null;
  13342. return root;
  13343. }
  13344. function hoistStatic(root, context) {
  13345. walk(
  13346. root,
  13347. context,
  13348. // Root node is unfortunately non-hoistable due to potential parent
  13349. // fallthrough attributes.
  13350. isSingleElementRoot(root, root.children[0])
  13351. );
  13352. }
  13353. function isSingleElementRoot(root, child) {
  13354. const { children } = root;
  13355. return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
  13356. }
  13357. function walk(node, context, doNotHoistNode = false) {
  13358. const { children } = node;
  13359. const originalCount = children.length;
  13360. let hoistedCount = 0;
  13361. for (let i = 0; i < children.length; i++) {
  13362. const child = children[i];
  13363. if (child.type === 1 && child.tagType === 0) {
  13364. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  13365. if (constantType > 0) {
  13366. if (constantType >= 2) {
  13367. child.codegenNode.patchFlag = -1;
  13368. child.codegenNode = context.hoist(child.codegenNode);
  13369. hoistedCount++;
  13370. continue;
  13371. }
  13372. } else {
  13373. const codegenNode = child.codegenNode;
  13374. if (codegenNode.type === 13) {
  13375. const flag = codegenNode.patchFlag;
  13376. if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  13377. const props = getNodeProps(child);
  13378. if (props) {
  13379. codegenNode.props = context.hoist(props);
  13380. }
  13381. }
  13382. if (codegenNode.dynamicProps) {
  13383. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  13384. }
  13385. }
  13386. }
  13387. }
  13388. if (child.type === 1) {
  13389. const isComponent = child.tagType === 1;
  13390. if (isComponent) {
  13391. context.scopes.vSlot++;
  13392. }
  13393. walk(child, context);
  13394. if (isComponent) {
  13395. context.scopes.vSlot--;
  13396. }
  13397. } else if (child.type === 11) {
  13398. walk(child, context, child.children.length === 1);
  13399. } else if (child.type === 9) {
  13400. for (let i2 = 0; i2 < child.branches.length; i2++) {
  13401. walk(
  13402. child.branches[i2],
  13403. context,
  13404. child.branches[i2].children.length === 1
  13405. );
  13406. }
  13407. }
  13408. }
  13409. if (hoistedCount && context.transformHoist) {
  13410. context.transformHoist(children, context, node);
  13411. }
  13412. if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  13413. const hoisted = context.hoist(
  13414. createArrayExpression(node.codegenNode.children)
  13415. );
  13416. if (context.hmr) {
  13417. hoisted.content = `[...${hoisted.content}]`;
  13418. }
  13419. node.codegenNode.children = hoisted;
  13420. }
  13421. }
  13422. function getConstantType(node, context) {
  13423. const { constantCache } = context;
  13424. switch (node.type) {
  13425. case 1:
  13426. if (node.tagType !== 0) {
  13427. return 0;
  13428. }
  13429. const cached = constantCache.get(node);
  13430. if (cached !== void 0) {
  13431. return cached;
  13432. }
  13433. const codegenNode = node.codegenNode;
  13434. if (codegenNode.type !== 13) {
  13435. return 0;
  13436. }
  13437. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
  13438. return 0;
  13439. }
  13440. if (codegenNode.patchFlag === void 0) {
  13441. let returnType2 = 3;
  13442. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  13443. if (generatedPropsType === 0) {
  13444. constantCache.set(node, 0);
  13445. return 0;
  13446. }
  13447. if (generatedPropsType < returnType2) {
  13448. returnType2 = generatedPropsType;
  13449. }
  13450. for (let i = 0; i < node.children.length; i++) {
  13451. const childType = getConstantType(node.children[i], context);
  13452. if (childType === 0) {
  13453. constantCache.set(node, 0);
  13454. return 0;
  13455. }
  13456. if (childType < returnType2) {
  13457. returnType2 = childType;
  13458. }
  13459. }
  13460. if (returnType2 > 1) {
  13461. for (let i = 0; i < node.props.length; i++) {
  13462. const p = node.props[i];
  13463. if (p.type === 7 && p.name === "bind" && p.exp) {
  13464. const expType = getConstantType(p.exp, context);
  13465. if (expType === 0) {
  13466. constantCache.set(node, 0);
  13467. return 0;
  13468. }
  13469. if (expType < returnType2) {
  13470. returnType2 = expType;
  13471. }
  13472. }
  13473. }
  13474. }
  13475. if (codegenNode.isBlock) {
  13476. for (let i = 0; i < node.props.length; i++) {
  13477. const p = node.props[i];
  13478. if (p.type === 7) {
  13479. constantCache.set(node, 0);
  13480. return 0;
  13481. }
  13482. }
  13483. context.removeHelper(OPEN_BLOCK);
  13484. context.removeHelper(
  13485. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  13486. );
  13487. codegenNode.isBlock = false;
  13488. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  13489. }
  13490. constantCache.set(node, returnType2);
  13491. return returnType2;
  13492. } else {
  13493. constantCache.set(node, 0);
  13494. return 0;
  13495. }
  13496. case 2:
  13497. case 3:
  13498. return 3;
  13499. case 9:
  13500. case 11:
  13501. case 10:
  13502. return 0;
  13503. case 5:
  13504. case 12:
  13505. return getConstantType(node.content, context);
  13506. case 4:
  13507. return node.constType;
  13508. case 8:
  13509. let returnType = 3;
  13510. for (let i = 0; i < node.children.length; i++) {
  13511. const child = node.children[i];
  13512. if (isString(child) || isSymbol(child)) {
  13513. continue;
  13514. }
  13515. const childType = getConstantType(child, context);
  13516. if (childType === 0) {
  13517. return 0;
  13518. } else if (childType < returnType) {
  13519. returnType = childType;
  13520. }
  13521. }
  13522. return returnType;
  13523. default:
  13524. return 0;
  13525. }
  13526. }
  13527. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  13528. NORMALIZE_CLASS,
  13529. NORMALIZE_STYLE,
  13530. NORMALIZE_PROPS,
  13531. GUARD_REACTIVE_PROPS
  13532. ]);
  13533. function getConstantTypeOfHelperCall(value, context) {
  13534. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  13535. const arg = value.arguments[0];
  13536. if (arg.type === 4) {
  13537. return getConstantType(arg, context);
  13538. } else if (arg.type === 14) {
  13539. return getConstantTypeOfHelperCall(arg, context);
  13540. }
  13541. }
  13542. return 0;
  13543. }
  13544. function getGeneratedPropsConstantType(node, context) {
  13545. let returnType = 3;
  13546. const props = getNodeProps(node);
  13547. if (props && props.type === 15) {
  13548. const { properties } = props;
  13549. for (let i = 0; i < properties.length; i++) {
  13550. const { key, value } = properties[i];
  13551. const keyType = getConstantType(key, context);
  13552. if (keyType === 0) {
  13553. return keyType;
  13554. }
  13555. if (keyType < returnType) {
  13556. returnType = keyType;
  13557. }
  13558. let valueType;
  13559. if (value.type === 4) {
  13560. valueType = getConstantType(value, context);
  13561. } else if (value.type === 14) {
  13562. valueType = getConstantTypeOfHelperCall(value, context);
  13563. } else {
  13564. valueType = 0;
  13565. }
  13566. if (valueType === 0) {
  13567. return valueType;
  13568. }
  13569. if (valueType < returnType) {
  13570. returnType = valueType;
  13571. }
  13572. }
  13573. }
  13574. return returnType;
  13575. }
  13576. function getNodeProps(node) {
  13577. const codegenNode = node.codegenNode;
  13578. if (codegenNode.type === 13) {
  13579. return codegenNode.props;
  13580. }
  13581. }
  13582. function createTransformContext(root, {
  13583. filename = "",
  13584. prefixIdentifiers = false,
  13585. hoistStatic: hoistStatic2 = false,
  13586. hmr = false,
  13587. cacheHandlers = false,
  13588. nodeTransforms = [],
  13589. directiveTransforms = {},
  13590. transformHoist = null,
  13591. isBuiltInComponent = NOOP,
  13592. isCustomElement = NOOP,
  13593. expressionPlugins = [],
  13594. scopeId = null,
  13595. slotted = true,
  13596. ssr = false,
  13597. inSSR = false,
  13598. ssrCssVars = ``,
  13599. bindingMetadata = EMPTY_OBJ,
  13600. inline = false,
  13601. isTS = false,
  13602. onError = defaultOnError,
  13603. onWarn = defaultOnWarn,
  13604. compatConfig
  13605. }) {
  13606. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  13607. const context = {
  13608. // options
  13609. filename,
  13610. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  13611. prefixIdentifiers,
  13612. hoistStatic: hoistStatic2,
  13613. hmr,
  13614. cacheHandlers,
  13615. nodeTransforms,
  13616. directiveTransforms,
  13617. transformHoist,
  13618. isBuiltInComponent,
  13619. isCustomElement,
  13620. expressionPlugins,
  13621. scopeId,
  13622. slotted,
  13623. ssr,
  13624. inSSR,
  13625. ssrCssVars,
  13626. bindingMetadata,
  13627. inline,
  13628. isTS,
  13629. onError,
  13630. onWarn,
  13631. compatConfig,
  13632. // state
  13633. root,
  13634. helpers: /* @__PURE__ */ new Map(),
  13635. components: /* @__PURE__ */ new Set(),
  13636. directives: /* @__PURE__ */ new Set(),
  13637. hoists: [],
  13638. imports: [],
  13639. constantCache: /* @__PURE__ */ new WeakMap(),
  13640. temps: 0,
  13641. cached: 0,
  13642. identifiers: /* @__PURE__ */ Object.create(null),
  13643. scopes: {
  13644. vFor: 0,
  13645. vSlot: 0,
  13646. vPre: 0,
  13647. vOnce: 0
  13648. },
  13649. parent: null,
  13650. grandParent: null,
  13651. currentNode: root,
  13652. childIndex: 0,
  13653. inVOnce: false,
  13654. // methods
  13655. helper(name) {
  13656. const count = context.helpers.get(name) || 0;
  13657. context.helpers.set(name, count + 1);
  13658. return name;
  13659. },
  13660. removeHelper(name) {
  13661. const count = context.helpers.get(name);
  13662. if (count) {
  13663. const currentCount = count - 1;
  13664. if (!currentCount) {
  13665. context.helpers.delete(name);
  13666. } else {
  13667. context.helpers.set(name, currentCount);
  13668. }
  13669. }
  13670. },
  13671. helperString(name) {
  13672. return `_${helperNameMap[context.helper(name)]}`;
  13673. },
  13674. replaceNode(node) {
  13675. {
  13676. if (!context.currentNode) {
  13677. throw new Error(`Node being replaced is already removed.`);
  13678. }
  13679. if (!context.parent) {
  13680. throw new Error(`Cannot replace root node.`);
  13681. }
  13682. }
  13683. context.parent.children[context.childIndex] = context.currentNode = node;
  13684. },
  13685. removeNode(node) {
  13686. if (!context.parent) {
  13687. throw new Error(`Cannot remove root node.`);
  13688. }
  13689. const list = context.parent.children;
  13690. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  13691. if (removalIndex < 0) {
  13692. throw new Error(`node being removed is not a child of current parent`);
  13693. }
  13694. if (!node || node === context.currentNode) {
  13695. context.currentNode = null;
  13696. context.onNodeRemoved();
  13697. } else {
  13698. if (context.childIndex > removalIndex) {
  13699. context.childIndex--;
  13700. context.onNodeRemoved();
  13701. }
  13702. }
  13703. context.parent.children.splice(removalIndex, 1);
  13704. },
  13705. onNodeRemoved: NOOP,
  13706. addIdentifiers(exp) {
  13707. },
  13708. removeIdentifiers(exp) {
  13709. },
  13710. hoist(exp) {
  13711. if (isString(exp)) exp = createSimpleExpression(exp);
  13712. context.hoists.push(exp);
  13713. const identifier = createSimpleExpression(
  13714. `_hoisted_${context.hoists.length}`,
  13715. false,
  13716. exp.loc,
  13717. 2
  13718. );
  13719. identifier.hoisted = exp;
  13720. return identifier;
  13721. },
  13722. cache(exp, isVNode = false) {
  13723. return createCacheExpression(context.cached++, exp, isVNode);
  13724. }
  13725. };
  13726. return context;
  13727. }
  13728. function transform(root, options) {
  13729. const context = createTransformContext(root, options);
  13730. traverseNode(root, context);
  13731. if (options.hoistStatic) {
  13732. hoistStatic(root, context);
  13733. }
  13734. if (!options.ssr) {
  13735. createRootCodegen(root, context);
  13736. }
  13737. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  13738. root.components = [...context.components];
  13739. root.directives = [...context.directives];
  13740. root.imports = context.imports;
  13741. root.hoists = context.hoists;
  13742. root.temps = context.temps;
  13743. root.cached = context.cached;
  13744. root.transformed = true;
  13745. }
  13746. function createRootCodegen(root, context) {
  13747. const { helper } = context;
  13748. const { children } = root;
  13749. if (children.length === 1) {
  13750. const child = children[0];
  13751. if (isSingleElementRoot(root, child) && child.codegenNode) {
  13752. const codegenNode = child.codegenNode;
  13753. if (codegenNode.type === 13) {
  13754. convertToBlock(codegenNode, context);
  13755. }
  13756. root.codegenNode = codegenNode;
  13757. } else {
  13758. root.codegenNode = child;
  13759. }
  13760. } else if (children.length > 1) {
  13761. let patchFlag = 64;
  13762. let patchFlagText = PatchFlagNames[64];
  13763. if (children.filter((c) => c.type !== 3).length === 1) {
  13764. patchFlag |= 2048;
  13765. patchFlagText += `, ${PatchFlagNames[2048]}`;
  13766. }
  13767. root.codegenNode = createVNodeCall(
  13768. context,
  13769. helper(FRAGMENT),
  13770. void 0,
  13771. root.children,
  13772. patchFlag,
  13773. void 0,
  13774. void 0,
  13775. true,
  13776. void 0,
  13777. false
  13778. );
  13779. } else ;
  13780. }
  13781. function traverseChildren(parent, context) {
  13782. let i = 0;
  13783. const nodeRemoved = () => {
  13784. i--;
  13785. };
  13786. for (; i < parent.children.length; i++) {
  13787. const child = parent.children[i];
  13788. if (isString(child)) continue;
  13789. context.grandParent = context.parent;
  13790. context.parent = parent;
  13791. context.childIndex = i;
  13792. context.onNodeRemoved = nodeRemoved;
  13793. traverseNode(child, context);
  13794. }
  13795. }
  13796. function traverseNode(node, context) {
  13797. context.currentNode = node;
  13798. const { nodeTransforms } = context;
  13799. const exitFns = [];
  13800. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  13801. const onExit = nodeTransforms[i2](node, context);
  13802. if (onExit) {
  13803. if (isArray(onExit)) {
  13804. exitFns.push(...onExit);
  13805. } else {
  13806. exitFns.push(onExit);
  13807. }
  13808. }
  13809. if (!context.currentNode) {
  13810. return;
  13811. } else {
  13812. node = context.currentNode;
  13813. }
  13814. }
  13815. switch (node.type) {
  13816. case 3:
  13817. if (!context.ssr) {
  13818. context.helper(CREATE_COMMENT);
  13819. }
  13820. break;
  13821. case 5:
  13822. if (!context.ssr) {
  13823. context.helper(TO_DISPLAY_STRING);
  13824. }
  13825. break;
  13826. case 9:
  13827. for (let i2 = 0; i2 < node.branches.length; i2++) {
  13828. traverseNode(node.branches[i2], context);
  13829. }
  13830. break;
  13831. case 10:
  13832. case 11:
  13833. case 1:
  13834. case 0:
  13835. traverseChildren(node, context);
  13836. break;
  13837. }
  13838. context.currentNode = node;
  13839. let i = exitFns.length;
  13840. while (i--) {
  13841. exitFns[i]();
  13842. }
  13843. }
  13844. function createStructuralDirectiveTransform(name, fn) {
  13845. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  13846. return (node, context) => {
  13847. if (node.type === 1) {
  13848. const { props } = node;
  13849. if (node.tagType === 3 && props.some(isVSlot)) {
  13850. return;
  13851. }
  13852. const exitFns = [];
  13853. for (let i = 0; i < props.length; i++) {
  13854. const prop = props[i];
  13855. if (prop.type === 7 && matches(prop.name)) {
  13856. props.splice(i, 1);
  13857. i--;
  13858. const onExit = fn(node, prop, context);
  13859. if (onExit) exitFns.push(onExit);
  13860. }
  13861. }
  13862. return exitFns;
  13863. }
  13864. };
  13865. }
  13866. const PURE_ANNOTATION = `/*#__PURE__*/`;
  13867. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  13868. function createCodegenContext(ast, {
  13869. mode = "function",
  13870. prefixIdentifiers = mode === "module",
  13871. sourceMap = false,
  13872. filename = `template.vue.html`,
  13873. scopeId = null,
  13874. optimizeImports = false,
  13875. runtimeGlobalName = `Vue`,
  13876. runtimeModuleName = `vue`,
  13877. ssrRuntimeModuleName = "vue/server-renderer",
  13878. ssr = false,
  13879. isTS = false,
  13880. inSSR = false
  13881. }) {
  13882. const context = {
  13883. mode,
  13884. prefixIdentifiers,
  13885. sourceMap,
  13886. filename,
  13887. scopeId,
  13888. optimizeImports,
  13889. runtimeGlobalName,
  13890. runtimeModuleName,
  13891. ssrRuntimeModuleName,
  13892. ssr,
  13893. isTS,
  13894. inSSR,
  13895. source: ast.source,
  13896. code: ``,
  13897. column: 1,
  13898. line: 1,
  13899. offset: 0,
  13900. indentLevel: 0,
  13901. pure: false,
  13902. map: void 0,
  13903. helper(key) {
  13904. return `_${helperNameMap[key]}`;
  13905. },
  13906. push(code, newlineIndex = -2 /* None */, node) {
  13907. context.code += code;
  13908. },
  13909. indent() {
  13910. newline(++context.indentLevel);
  13911. },
  13912. deindent(withoutNewLine = false) {
  13913. if (withoutNewLine) {
  13914. --context.indentLevel;
  13915. } else {
  13916. newline(--context.indentLevel);
  13917. }
  13918. },
  13919. newline() {
  13920. newline(context.indentLevel);
  13921. }
  13922. };
  13923. function newline(n) {
  13924. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  13925. }
  13926. return context;
  13927. }
  13928. function generate(ast, options = {}) {
  13929. const context = createCodegenContext(ast, options);
  13930. if (options.onContextCreated) options.onContextCreated(context);
  13931. const {
  13932. mode,
  13933. push,
  13934. prefixIdentifiers,
  13935. indent,
  13936. deindent,
  13937. newline,
  13938. scopeId,
  13939. ssr
  13940. } = context;
  13941. const helpers = Array.from(ast.helpers);
  13942. const hasHelpers = helpers.length > 0;
  13943. const useWithBlock = !prefixIdentifiers && mode !== "module";
  13944. const preambleContext = context;
  13945. {
  13946. genFunctionPreamble(ast, preambleContext);
  13947. }
  13948. const functionName = ssr ? `ssrRender` : `render`;
  13949. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  13950. const signature = args.join(", ");
  13951. {
  13952. push(`function ${functionName}(${signature}) {`);
  13953. }
  13954. indent();
  13955. if (useWithBlock) {
  13956. push(`with (_ctx) {`);
  13957. indent();
  13958. if (hasHelpers) {
  13959. push(
  13960. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  13961. `,
  13962. -1 /* End */
  13963. );
  13964. newline();
  13965. }
  13966. }
  13967. if (ast.components.length) {
  13968. genAssets(ast.components, "component", context);
  13969. if (ast.directives.length || ast.temps > 0) {
  13970. newline();
  13971. }
  13972. }
  13973. if (ast.directives.length) {
  13974. genAssets(ast.directives, "directive", context);
  13975. if (ast.temps > 0) {
  13976. newline();
  13977. }
  13978. }
  13979. if (ast.temps > 0) {
  13980. push(`let `);
  13981. for (let i = 0; i < ast.temps; i++) {
  13982. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  13983. }
  13984. }
  13985. if (ast.components.length || ast.directives.length || ast.temps) {
  13986. push(`
  13987. `, 0 /* Start */);
  13988. newline();
  13989. }
  13990. if (!ssr) {
  13991. push(`return `);
  13992. }
  13993. if (ast.codegenNode) {
  13994. genNode(ast.codegenNode, context);
  13995. } else {
  13996. push(`null`);
  13997. }
  13998. if (useWithBlock) {
  13999. deindent();
  14000. push(`}`);
  14001. }
  14002. deindent();
  14003. push(`}`);
  14004. return {
  14005. ast,
  14006. code: context.code,
  14007. preamble: ``,
  14008. map: context.map ? context.map.toJSON() : void 0
  14009. };
  14010. }
  14011. function genFunctionPreamble(ast, context) {
  14012. const {
  14013. ssr,
  14014. prefixIdentifiers,
  14015. push,
  14016. newline,
  14017. runtimeModuleName,
  14018. runtimeGlobalName,
  14019. ssrRuntimeModuleName
  14020. } = context;
  14021. const VueBinding = runtimeGlobalName;
  14022. const helpers = Array.from(ast.helpers);
  14023. if (helpers.length > 0) {
  14024. {
  14025. push(`const _Vue = ${VueBinding}
  14026. `, -1 /* End */);
  14027. if (ast.hoists.length) {
  14028. const staticHelpers = [
  14029. CREATE_VNODE,
  14030. CREATE_ELEMENT_VNODE,
  14031. CREATE_COMMENT,
  14032. CREATE_TEXT,
  14033. CREATE_STATIC
  14034. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  14035. push(`const { ${staticHelpers} } = _Vue
  14036. `, -1 /* End */);
  14037. }
  14038. }
  14039. }
  14040. genHoists(ast.hoists, context);
  14041. newline();
  14042. push(`return `);
  14043. }
  14044. function genAssets(assets, type, { helper, push, newline, isTS }) {
  14045. const resolver = helper(
  14046. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  14047. );
  14048. for (let i = 0; i < assets.length; i++) {
  14049. let id = assets[i];
  14050. const maybeSelfReference = id.endsWith("__self");
  14051. if (maybeSelfReference) {
  14052. id = id.slice(0, -6);
  14053. }
  14054. push(
  14055. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  14056. );
  14057. if (i < assets.length - 1) {
  14058. newline();
  14059. }
  14060. }
  14061. }
  14062. function genHoists(hoists, context) {
  14063. if (!hoists.length) {
  14064. return;
  14065. }
  14066. context.pure = true;
  14067. const { push, newline, helper, scopeId, mode } = context;
  14068. newline();
  14069. for (let i = 0; i < hoists.length; i++) {
  14070. const exp = hoists[i];
  14071. if (exp) {
  14072. push(
  14073. `const _hoisted_${i + 1} = ${``}`
  14074. );
  14075. genNode(exp, context);
  14076. newline();
  14077. }
  14078. }
  14079. context.pure = false;
  14080. }
  14081. function isText(n) {
  14082. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  14083. }
  14084. function genNodeListAsArray(nodes, context) {
  14085. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  14086. context.push(`[`);
  14087. multilines && context.indent();
  14088. genNodeList(nodes, context, multilines);
  14089. multilines && context.deindent();
  14090. context.push(`]`);
  14091. }
  14092. function genNodeList(nodes, context, multilines = false, comma = true) {
  14093. const { push, newline } = context;
  14094. for (let i = 0; i < nodes.length; i++) {
  14095. const node = nodes[i];
  14096. if (isString(node)) {
  14097. push(node, -3 /* Unknown */);
  14098. } else if (isArray(node)) {
  14099. genNodeListAsArray(node, context);
  14100. } else {
  14101. genNode(node, context);
  14102. }
  14103. if (i < nodes.length - 1) {
  14104. if (multilines) {
  14105. comma && push(",");
  14106. newline();
  14107. } else {
  14108. comma && push(", ");
  14109. }
  14110. }
  14111. }
  14112. }
  14113. function genNode(node, context) {
  14114. if (isString(node)) {
  14115. context.push(node, -3 /* Unknown */);
  14116. return;
  14117. }
  14118. if (isSymbol(node)) {
  14119. context.push(context.helper(node));
  14120. return;
  14121. }
  14122. switch (node.type) {
  14123. case 1:
  14124. case 9:
  14125. case 11:
  14126. assert(
  14127. node.codegenNode != null,
  14128. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  14129. );
  14130. genNode(node.codegenNode, context);
  14131. break;
  14132. case 2:
  14133. genText(node, context);
  14134. break;
  14135. case 4:
  14136. genExpression(node, context);
  14137. break;
  14138. case 5:
  14139. genInterpolation(node, context);
  14140. break;
  14141. case 12:
  14142. genNode(node.codegenNode, context);
  14143. break;
  14144. case 8:
  14145. genCompoundExpression(node, context);
  14146. break;
  14147. case 3:
  14148. genComment(node, context);
  14149. break;
  14150. case 13:
  14151. genVNodeCall(node, context);
  14152. break;
  14153. case 14:
  14154. genCallExpression(node, context);
  14155. break;
  14156. case 15:
  14157. genObjectExpression(node, context);
  14158. break;
  14159. case 17:
  14160. genArrayExpression(node, context);
  14161. break;
  14162. case 18:
  14163. genFunctionExpression(node, context);
  14164. break;
  14165. case 19:
  14166. genConditionalExpression(node, context);
  14167. break;
  14168. case 20:
  14169. genCacheExpression(node, context);
  14170. break;
  14171. case 21:
  14172. genNodeList(node.body, context, true, false);
  14173. break;
  14174. case 22:
  14175. break;
  14176. case 23:
  14177. break;
  14178. case 24:
  14179. break;
  14180. case 25:
  14181. break;
  14182. case 26:
  14183. break;
  14184. case 10:
  14185. break;
  14186. default:
  14187. {
  14188. assert(false, `unhandled codegen node type: ${node.type}`);
  14189. const exhaustiveCheck = node;
  14190. return exhaustiveCheck;
  14191. }
  14192. }
  14193. }
  14194. function genText(node, context) {
  14195. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  14196. }
  14197. function genExpression(node, context) {
  14198. const { content, isStatic } = node;
  14199. context.push(
  14200. isStatic ? JSON.stringify(content) : content,
  14201. -3 /* Unknown */,
  14202. node
  14203. );
  14204. }
  14205. function genInterpolation(node, context) {
  14206. const { push, helper, pure } = context;
  14207. if (pure) push(PURE_ANNOTATION);
  14208. push(`${helper(TO_DISPLAY_STRING)}(`);
  14209. genNode(node.content, context);
  14210. push(`)`);
  14211. }
  14212. function genCompoundExpression(node, context) {
  14213. for (let i = 0; i < node.children.length; i++) {
  14214. const child = node.children[i];
  14215. if (isString(child)) {
  14216. context.push(child, -3 /* Unknown */);
  14217. } else {
  14218. genNode(child, context);
  14219. }
  14220. }
  14221. }
  14222. function genExpressionAsPropertyKey(node, context) {
  14223. const { push } = context;
  14224. if (node.type === 8) {
  14225. push(`[`);
  14226. genCompoundExpression(node, context);
  14227. push(`]`);
  14228. } else if (node.isStatic) {
  14229. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  14230. push(text, -2 /* None */, node);
  14231. } else {
  14232. push(`[${node.content}]`, -3 /* Unknown */, node);
  14233. }
  14234. }
  14235. function genComment(node, context) {
  14236. const { push, helper, pure } = context;
  14237. if (pure) {
  14238. push(PURE_ANNOTATION);
  14239. }
  14240. push(
  14241. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  14242. -3 /* Unknown */,
  14243. node
  14244. );
  14245. }
  14246. function genVNodeCall(node, context) {
  14247. const { push, helper, pure } = context;
  14248. const {
  14249. tag,
  14250. props,
  14251. children,
  14252. patchFlag,
  14253. dynamicProps,
  14254. directives,
  14255. isBlock,
  14256. disableTracking,
  14257. isComponent
  14258. } = node;
  14259. let patchFlagString;
  14260. if (patchFlag) {
  14261. {
  14262. if (patchFlag < 0) {
  14263. patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  14264. } else {
  14265. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  14266. patchFlagString = patchFlag + ` /* ${flagNames} */`;
  14267. }
  14268. }
  14269. }
  14270. if (directives) {
  14271. push(helper(WITH_DIRECTIVES) + `(`);
  14272. }
  14273. if (isBlock) {
  14274. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  14275. }
  14276. if (pure) {
  14277. push(PURE_ANNOTATION);
  14278. }
  14279. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  14280. push(helper(callHelper) + `(`, -2 /* None */, node);
  14281. genNodeList(
  14282. genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
  14283. context
  14284. );
  14285. push(`)`);
  14286. if (isBlock) {
  14287. push(`)`);
  14288. }
  14289. if (directives) {
  14290. push(`, `);
  14291. genNode(directives, context);
  14292. push(`)`);
  14293. }
  14294. }
  14295. function genNullableArgs(args) {
  14296. let i = args.length;
  14297. while (i--) {
  14298. if (args[i] != null) break;
  14299. }
  14300. return args.slice(0, i + 1).map((arg) => arg || `null`);
  14301. }
  14302. function genCallExpression(node, context) {
  14303. const { push, helper, pure } = context;
  14304. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  14305. if (pure) {
  14306. push(PURE_ANNOTATION);
  14307. }
  14308. push(callee + `(`, -2 /* None */, node);
  14309. genNodeList(node.arguments, context);
  14310. push(`)`);
  14311. }
  14312. function genObjectExpression(node, context) {
  14313. const { push, indent, deindent, newline } = context;
  14314. const { properties } = node;
  14315. if (!properties.length) {
  14316. push(`{}`, -2 /* None */, node);
  14317. return;
  14318. }
  14319. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  14320. push(multilines ? `{` : `{ `);
  14321. multilines && indent();
  14322. for (let i = 0; i < properties.length; i++) {
  14323. const { key, value } = properties[i];
  14324. genExpressionAsPropertyKey(key, context);
  14325. push(`: `);
  14326. genNode(value, context);
  14327. if (i < properties.length - 1) {
  14328. push(`,`);
  14329. newline();
  14330. }
  14331. }
  14332. multilines && deindent();
  14333. push(multilines ? `}` : ` }`);
  14334. }
  14335. function genArrayExpression(node, context) {
  14336. genNodeListAsArray(node.elements, context);
  14337. }
  14338. function genFunctionExpression(node, context) {
  14339. const { push, indent, deindent } = context;
  14340. const { params, returns, body, newline, isSlot } = node;
  14341. if (isSlot) {
  14342. push(`_${helperNameMap[WITH_CTX]}(`);
  14343. }
  14344. push(`(`, -2 /* None */, node);
  14345. if (isArray(params)) {
  14346. genNodeList(params, context);
  14347. } else if (params) {
  14348. genNode(params, context);
  14349. }
  14350. push(`) => `);
  14351. if (newline || body) {
  14352. push(`{`);
  14353. indent();
  14354. }
  14355. if (returns) {
  14356. if (newline) {
  14357. push(`return `);
  14358. }
  14359. if (isArray(returns)) {
  14360. genNodeListAsArray(returns, context);
  14361. } else {
  14362. genNode(returns, context);
  14363. }
  14364. } else if (body) {
  14365. genNode(body, context);
  14366. }
  14367. if (newline || body) {
  14368. deindent();
  14369. push(`}`);
  14370. }
  14371. if (isSlot) {
  14372. push(`)`);
  14373. }
  14374. }
  14375. function genConditionalExpression(node, context) {
  14376. const { test, consequent, alternate, newline: needNewline } = node;
  14377. const { push, indent, deindent, newline } = context;
  14378. if (test.type === 4) {
  14379. const needsParens = !isSimpleIdentifier(test.content);
  14380. needsParens && push(`(`);
  14381. genExpression(test, context);
  14382. needsParens && push(`)`);
  14383. } else {
  14384. push(`(`);
  14385. genNode(test, context);
  14386. push(`)`);
  14387. }
  14388. needNewline && indent();
  14389. context.indentLevel++;
  14390. needNewline || push(` `);
  14391. push(`? `);
  14392. genNode(consequent, context);
  14393. context.indentLevel--;
  14394. needNewline && newline();
  14395. needNewline || push(` `);
  14396. push(`: `);
  14397. const isNested = alternate.type === 19;
  14398. if (!isNested) {
  14399. context.indentLevel++;
  14400. }
  14401. genNode(alternate, context);
  14402. if (!isNested) {
  14403. context.indentLevel--;
  14404. }
  14405. needNewline && deindent(
  14406. true
  14407. /* without newline */
  14408. );
  14409. }
  14410. function genCacheExpression(node, context) {
  14411. const { push, helper, indent, deindent, newline } = context;
  14412. push(`_cache[${node.index}] || (`);
  14413. if (node.isVOnce) {
  14414. indent();
  14415. push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
  14416. newline();
  14417. push(`(`);
  14418. }
  14419. push(`_cache[${node.index}] = `);
  14420. genNode(node.value, context);
  14421. if (node.isVOnce) {
  14422. push(`).cacheIndex = ${node.index},`);
  14423. newline();
  14424. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  14425. newline();
  14426. push(`_cache[${node.index}]`);
  14427. deindent();
  14428. }
  14429. push(`)`);
  14430. }
  14431. const prohibitedKeywordRE = new RegExp(
  14432. "\\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"
  14433. );
  14434. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  14435. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  14436. const exp = node.content;
  14437. if (!exp.trim()) {
  14438. return;
  14439. }
  14440. try {
  14441. new Function(
  14442. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  14443. );
  14444. } catch (e) {
  14445. let message = e.message;
  14446. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  14447. if (keywordMatch) {
  14448. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  14449. }
  14450. context.onError(
  14451. createCompilerError(
  14452. 45,
  14453. node.loc,
  14454. void 0,
  14455. message
  14456. )
  14457. );
  14458. }
  14459. }
  14460. const transformExpression = (node, context) => {
  14461. if (node.type === 5) {
  14462. node.content = processExpression(
  14463. node.content,
  14464. context
  14465. );
  14466. } else if (node.type === 1) {
  14467. for (let i = 0; i < node.props.length; i++) {
  14468. const dir = node.props[i];
  14469. if (dir.type === 7 && dir.name !== "for") {
  14470. const exp = dir.exp;
  14471. const arg = dir.arg;
  14472. if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
  14473. dir.exp = processExpression(
  14474. exp,
  14475. context,
  14476. // slot args must be processed as function params
  14477. dir.name === "slot"
  14478. );
  14479. }
  14480. if (arg && arg.type === 4 && !arg.isStatic) {
  14481. dir.arg = processExpression(arg, context);
  14482. }
  14483. }
  14484. }
  14485. }
  14486. };
  14487. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  14488. {
  14489. {
  14490. validateBrowserExpression(node, context, asParams, asRawStatements);
  14491. }
  14492. return node;
  14493. }
  14494. }
  14495. const transformIf = createStructuralDirectiveTransform(
  14496. /^(if|else|else-if)$/,
  14497. (node, dir, context) => {
  14498. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  14499. const siblings = context.parent.children;
  14500. let i = siblings.indexOf(ifNode);
  14501. let key = 0;
  14502. while (i-- >= 0) {
  14503. const sibling = siblings[i];
  14504. if (sibling && sibling.type === 9) {
  14505. key += sibling.branches.length;
  14506. }
  14507. }
  14508. return () => {
  14509. if (isRoot) {
  14510. ifNode.codegenNode = createCodegenNodeForBranch(
  14511. branch,
  14512. key,
  14513. context
  14514. );
  14515. } else {
  14516. const parentCondition = getParentCondition(ifNode.codegenNode);
  14517. parentCondition.alternate = createCodegenNodeForBranch(
  14518. branch,
  14519. key + ifNode.branches.length - 1,
  14520. context
  14521. );
  14522. }
  14523. };
  14524. });
  14525. }
  14526. );
  14527. function processIf(node, dir, context, processCodegen) {
  14528. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  14529. const loc = dir.exp ? dir.exp.loc : node.loc;
  14530. context.onError(
  14531. createCompilerError(28, dir.loc)
  14532. );
  14533. dir.exp = createSimpleExpression(`true`, false, loc);
  14534. }
  14535. if (dir.exp) {
  14536. validateBrowserExpression(dir.exp, context);
  14537. }
  14538. if (dir.name === "if") {
  14539. const branch = createIfBranch(node, dir);
  14540. const ifNode = {
  14541. type: 9,
  14542. loc: node.loc,
  14543. branches: [branch]
  14544. };
  14545. context.replaceNode(ifNode);
  14546. if (processCodegen) {
  14547. return processCodegen(ifNode, branch, true);
  14548. }
  14549. } else {
  14550. const siblings = context.parent.children;
  14551. const comments = [];
  14552. let i = siblings.indexOf(node);
  14553. while (i-- >= -1) {
  14554. const sibling = siblings[i];
  14555. if (sibling && sibling.type === 3) {
  14556. context.removeNode(sibling);
  14557. comments.unshift(sibling);
  14558. continue;
  14559. }
  14560. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  14561. context.removeNode(sibling);
  14562. continue;
  14563. }
  14564. if (sibling && sibling.type === 9) {
  14565. if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  14566. context.onError(
  14567. createCompilerError(30, node.loc)
  14568. );
  14569. }
  14570. context.removeNode();
  14571. const branch = createIfBranch(node, dir);
  14572. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  14573. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  14574. branch.children = [...comments, ...branch.children];
  14575. }
  14576. {
  14577. const key = branch.userKey;
  14578. if (key) {
  14579. sibling.branches.forEach(({ userKey }) => {
  14580. if (isSameKey(userKey, key)) {
  14581. context.onError(
  14582. createCompilerError(
  14583. 29,
  14584. branch.userKey.loc
  14585. )
  14586. );
  14587. }
  14588. });
  14589. }
  14590. }
  14591. sibling.branches.push(branch);
  14592. const onExit = processCodegen && processCodegen(sibling, branch, false);
  14593. traverseNode(branch, context);
  14594. if (onExit) onExit();
  14595. context.currentNode = null;
  14596. } else {
  14597. context.onError(
  14598. createCompilerError(30, node.loc)
  14599. );
  14600. }
  14601. break;
  14602. }
  14603. }
  14604. }
  14605. function createIfBranch(node, dir) {
  14606. const isTemplateIf = node.tagType === 3;
  14607. return {
  14608. type: 10,
  14609. loc: node.loc,
  14610. condition: dir.name === "else" ? void 0 : dir.exp,
  14611. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  14612. userKey: findProp(node, `key`),
  14613. isTemplateIf
  14614. };
  14615. }
  14616. function createCodegenNodeForBranch(branch, keyIndex, context) {
  14617. if (branch.condition) {
  14618. return createConditionalExpression(
  14619. branch.condition,
  14620. createChildrenCodegenNode(branch, keyIndex, context),
  14621. // make sure to pass in asBlock: true so that the comment node call
  14622. // closes the current block.
  14623. createCallExpression(context.helper(CREATE_COMMENT), [
  14624. '"v-if"' ,
  14625. "true"
  14626. ])
  14627. );
  14628. } else {
  14629. return createChildrenCodegenNode(branch, keyIndex, context);
  14630. }
  14631. }
  14632. function createChildrenCodegenNode(branch, keyIndex, context) {
  14633. const { helper } = context;
  14634. const keyProperty = createObjectProperty(
  14635. `key`,
  14636. createSimpleExpression(
  14637. `${keyIndex}`,
  14638. false,
  14639. locStub,
  14640. 2
  14641. )
  14642. );
  14643. const { children } = branch;
  14644. const firstChild = children[0];
  14645. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  14646. if (needFragmentWrapper) {
  14647. if (children.length === 1 && firstChild.type === 11) {
  14648. const vnodeCall = firstChild.codegenNode;
  14649. injectProp(vnodeCall, keyProperty, context);
  14650. return vnodeCall;
  14651. } else {
  14652. let patchFlag = 64;
  14653. let patchFlagText = PatchFlagNames[64];
  14654. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  14655. patchFlag |= 2048;
  14656. patchFlagText += `, ${PatchFlagNames[2048]}`;
  14657. }
  14658. return createVNodeCall(
  14659. context,
  14660. helper(FRAGMENT),
  14661. createObjectExpression([keyProperty]),
  14662. children,
  14663. patchFlag,
  14664. void 0,
  14665. void 0,
  14666. true,
  14667. false,
  14668. false,
  14669. branch.loc
  14670. );
  14671. }
  14672. } else {
  14673. const ret = firstChild.codegenNode;
  14674. const vnodeCall = getMemoedVNodeCall(ret);
  14675. if (vnodeCall.type === 13) {
  14676. convertToBlock(vnodeCall, context);
  14677. }
  14678. injectProp(vnodeCall, keyProperty, context);
  14679. return ret;
  14680. }
  14681. }
  14682. function isSameKey(a, b) {
  14683. if (!a || a.type !== b.type) {
  14684. return false;
  14685. }
  14686. if (a.type === 6) {
  14687. if (a.value.content !== b.value.content) {
  14688. return false;
  14689. }
  14690. } else {
  14691. const exp = a.exp;
  14692. const branchExp = b.exp;
  14693. if (exp.type !== branchExp.type) {
  14694. return false;
  14695. }
  14696. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  14697. return false;
  14698. }
  14699. }
  14700. return true;
  14701. }
  14702. function getParentCondition(node) {
  14703. while (true) {
  14704. if (node.type === 19) {
  14705. if (node.alternate.type === 19) {
  14706. node = node.alternate;
  14707. } else {
  14708. return node;
  14709. }
  14710. } else if (node.type === 20) {
  14711. node = node.value;
  14712. }
  14713. }
  14714. }
  14715. const transformBind = (dir, _node, context) => {
  14716. const { modifiers, loc } = dir;
  14717. const arg = dir.arg;
  14718. let { exp } = dir;
  14719. if (exp && exp.type === 4 && !exp.content.trim()) {
  14720. {
  14721. exp = void 0;
  14722. }
  14723. }
  14724. if (!exp) {
  14725. if (arg.type !== 4 || !arg.isStatic) {
  14726. context.onError(
  14727. createCompilerError(
  14728. 52,
  14729. arg.loc
  14730. )
  14731. );
  14732. return {
  14733. props: [
  14734. createObjectProperty(arg, createSimpleExpression("", true, loc))
  14735. ]
  14736. };
  14737. }
  14738. transformBindShorthand(dir);
  14739. exp = dir.exp;
  14740. }
  14741. if (arg.type !== 4) {
  14742. arg.children.unshift(`(`);
  14743. arg.children.push(`) || ""`);
  14744. } else if (!arg.isStatic) {
  14745. arg.content = `${arg.content} || ""`;
  14746. }
  14747. if (modifiers.includes("camel")) {
  14748. if (arg.type === 4) {
  14749. if (arg.isStatic) {
  14750. arg.content = camelize(arg.content);
  14751. } else {
  14752. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  14753. }
  14754. } else {
  14755. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  14756. arg.children.push(`)`);
  14757. }
  14758. }
  14759. if (!context.inSSR) {
  14760. if (modifiers.includes("prop")) {
  14761. injectPrefix(arg, ".");
  14762. }
  14763. if (modifiers.includes("attr")) {
  14764. injectPrefix(arg, "^");
  14765. }
  14766. }
  14767. return {
  14768. props: [createObjectProperty(arg, exp)]
  14769. };
  14770. };
  14771. const transformBindShorthand = (dir, context) => {
  14772. const arg = dir.arg;
  14773. const propName = camelize(arg.content);
  14774. dir.exp = createSimpleExpression(propName, false, arg.loc);
  14775. };
  14776. const injectPrefix = (arg, prefix) => {
  14777. if (arg.type === 4) {
  14778. if (arg.isStatic) {
  14779. arg.content = prefix + arg.content;
  14780. } else {
  14781. arg.content = `\`${prefix}\${${arg.content}}\``;
  14782. }
  14783. } else {
  14784. arg.children.unshift(`'${prefix}' + (`);
  14785. arg.children.push(`)`);
  14786. }
  14787. };
  14788. const transformFor = createStructuralDirectiveTransform(
  14789. "for",
  14790. (node, dir, context) => {
  14791. const { helper, removeHelper } = context;
  14792. return processFor(node, dir, context, (forNode) => {
  14793. const renderExp = createCallExpression(helper(RENDER_LIST), [
  14794. forNode.source
  14795. ]);
  14796. const isTemplate = isTemplateNode(node);
  14797. const memo = findDir(node, "memo");
  14798. const keyProp = findProp(node, `key`, false, true);
  14799. if (keyProp && keyProp.type === 7 && !keyProp.exp) {
  14800. transformBindShorthand(keyProp);
  14801. }
  14802. const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
  14803. const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
  14804. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  14805. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  14806. forNode.codegenNode = createVNodeCall(
  14807. context,
  14808. helper(FRAGMENT),
  14809. void 0,
  14810. renderExp,
  14811. fragmentFlag,
  14812. void 0,
  14813. void 0,
  14814. true,
  14815. !isStableFragment,
  14816. false,
  14817. node.loc
  14818. );
  14819. return () => {
  14820. let childBlock;
  14821. const { children } = forNode;
  14822. if (isTemplate) {
  14823. node.children.some((c) => {
  14824. if (c.type === 1) {
  14825. const key = findProp(c, "key");
  14826. if (key) {
  14827. context.onError(
  14828. createCompilerError(
  14829. 33,
  14830. key.loc
  14831. )
  14832. );
  14833. return true;
  14834. }
  14835. }
  14836. });
  14837. }
  14838. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  14839. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  14840. if (slotOutlet) {
  14841. childBlock = slotOutlet.codegenNode;
  14842. if (isTemplate && keyProperty) {
  14843. injectProp(childBlock, keyProperty, context);
  14844. }
  14845. } else if (needFragmentWrapper) {
  14846. childBlock = createVNodeCall(
  14847. context,
  14848. helper(FRAGMENT),
  14849. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  14850. node.children,
  14851. 64,
  14852. void 0,
  14853. void 0,
  14854. true,
  14855. void 0,
  14856. false
  14857. );
  14858. } else {
  14859. childBlock = children[0].codegenNode;
  14860. if (isTemplate && keyProperty) {
  14861. injectProp(childBlock, keyProperty, context);
  14862. }
  14863. if (childBlock.isBlock !== !isStableFragment) {
  14864. if (childBlock.isBlock) {
  14865. removeHelper(OPEN_BLOCK);
  14866. removeHelper(
  14867. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  14868. );
  14869. } else {
  14870. removeHelper(
  14871. getVNodeHelper(context.inSSR, childBlock.isComponent)
  14872. );
  14873. }
  14874. }
  14875. childBlock.isBlock = !isStableFragment;
  14876. if (childBlock.isBlock) {
  14877. helper(OPEN_BLOCK);
  14878. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  14879. } else {
  14880. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  14881. }
  14882. }
  14883. if (memo) {
  14884. const loop = createFunctionExpression(
  14885. createForLoopParams(forNode.parseResult, [
  14886. createSimpleExpression(`_cached`)
  14887. ])
  14888. );
  14889. loop.body = createBlockStatement([
  14890. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  14891. createCompoundExpression([
  14892. `if (_cached`,
  14893. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  14894. ` && ${context.helperString(
  14895. IS_MEMO_SAME
  14896. )}(_cached, _memo)) return _cached`
  14897. ]),
  14898. createCompoundExpression([`const _item = `, childBlock]),
  14899. createSimpleExpression(`_item.memo = _memo`),
  14900. createSimpleExpression(`return _item`)
  14901. ]);
  14902. renderExp.arguments.push(
  14903. loop,
  14904. createSimpleExpression(`_cache`),
  14905. createSimpleExpression(String(context.cached++))
  14906. );
  14907. } else {
  14908. renderExp.arguments.push(
  14909. createFunctionExpression(
  14910. createForLoopParams(forNode.parseResult),
  14911. childBlock,
  14912. true
  14913. )
  14914. );
  14915. }
  14916. };
  14917. });
  14918. }
  14919. );
  14920. function processFor(node, dir, context, processCodegen) {
  14921. if (!dir.exp) {
  14922. context.onError(
  14923. createCompilerError(31, dir.loc)
  14924. );
  14925. return;
  14926. }
  14927. const parseResult = dir.forParseResult;
  14928. if (!parseResult) {
  14929. context.onError(
  14930. createCompilerError(32, dir.loc)
  14931. );
  14932. return;
  14933. }
  14934. finalizeForParseResult(parseResult, context);
  14935. const { addIdentifiers, removeIdentifiers, scopes } = context;
  14936. const { source, value, key, index } = parseResult;
  14937. const forNode = {
  14938. type: 11,
  14939. loc: dir.loc,
  14940. source,
  14941. valueAlias: value,
  14942. keyAlias: key,
  14943. objectIndexAlias: index,
  14944. parseResult,
  14945. children: isTemplateNode(node) ? node.children : [node]
  14946. };
  14947. context.replaceNode(forNode);
  14948. scopes.vFor++;
  14949. const onExit = processCodegen && processCodegen(forNode);
  14950. return () => {
  14951. scopes.vFor--;
  14952. if (onExit) onExit();
  14953. };
  14954. }
  14955. function finalizeForParseResult(result, context) {
  14956. if (result.finalized) return;
  14957. {
  14958. validateBrowserExpression(result.source, context);
  14959. if (result.key) {
  14960. validateBrowserExpression(
  14961. result.key,
  14962. context,
  14963. true
  14964. );
  14965. }
  14966. if (result.index) {
  14967. validateBrowserExpression(
  14968. result.index,
  14969. context,
  14970. true
  14971. );
  14972. }
  14973. if (result.value) {
  14974. validateBrowserExpression(
  14975. result.value,
  14976. context,
  14977. true
  14978. );
  14979. }
  14980. }
  14981. result.finalized = true;
  14982. }
  14983. function createForLoopParams({ value, key, index }, memoArgs = []) {
  14984. return createParamsList([value, key, index, ...memoArgs]);
  14985. }
  14986. function createParamsList(args) {
  14987. let i = args.length;
  14988. while (i--) {
  14989. if (args[i]) break;
  14990. }
  14991. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  14992. }
  14993. const defaultFallback = createSimpleExpression(`undefined`, false);
  14994. const trackSlotScopes = (node, context) => {
  14995. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  14996. const vSlot = findDir(node, "slot");
  14997. if (vSlot) {
  14998. vSlot.exp;
  14999. context.scopes.vSlot++;
  15000. return () => {
  15001. context.scopes.vSlot--;
  15002. };
  15003. }
  15004. }
  15005. };
  15006. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  15007. props,
  15008. children,
  15009. false,
  15010. true,
  15011. children.length ? children[0].loc : loc
  15012. );
  15013. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  15014. context.helper(WITH_CTX);
  15015. const { children, loc } = node;
  15016. const slotsProperties = [];
  15017. const dynamicSlots = [];
  15018. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  15019. const onComponentSlot = findDir(node, "slot", true);
  15020. if (onComponentSlot) {
  15021. const { arg, exp } = onComponentSlot;
  15022. if (arg && !isStaticExp(arg)) {
  15023. hasDynamicSlots = true;
  15024. }
  15025. slotsProperties.push(
  15026. createObjectProperty(
  15027. arg || createSimpleExpression("default", true),
  15028. buildSlotFn(exp, void 0, children, loc)
  15029. )
  15030. );
  15031. }
  15032. let hasTemplateSlots = false;
  15033. let hasNamedDefaultSlot = false;
  15034. const implicitDefaultChildren = [];
  15035. const seenSlotNames = /* @__PURE__ */ new Set();
  15036. let conditionalBranchIndex = 0;
  15037. for (let i = 0; i < children.length; i++) {
  15038. const slotElement = children[i];
  15039. let slotDir;
  15040. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  15041. if (slotElement.type !== 3) {
  15042. implicitDefaultChildren.push(slotElement);
  15043. }
  15044. continue;
  15045. }
  15046. if (onComponentSlot) {
  15047. context.onError(
  15048. createCompilerError(37, slotDir.loc)
  15049. );
  15050. break;
  15051. }
  15052. hasTemplateSlots = true;
  15053. const { children: slotChildren, loc: slotLoc } = slotElement;
  15054. const {
  15055. arg: slotName = createSimpleExpression(`default`, true),
  15056. exp: slotProps,
  15057. loc: dirLoc
  15058. } = slotDir;
  15059. let staticSlotName;
  15060. if (isStaticExp(slotName)) {
  15061. staticSlotName = slotName ? slotName.content : `default`;
  15062. } else {
  15063. hasDynamicSlots = true;
  15064. }
  15065. const vFor = findDir(slotElement, "for");
  15066. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  15067. let vIf;
  15068. let vElse;
  15069. if (vIf = findDir(slotElement, "if")) {
  15070. hasDynamicSlots = true;
  15071. dynamicSlots.push(
  15072. createConditionalExpression(
  15073. vIf.exp,
  15074. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  15075. defaultFallback
  15076. )
  15077. );
  15078. } else if (vElse = findDir(
  15079. slotElement,
  15080. /^else(-if)?$/,
  15081. true
  15082. /* allowEmpty */
  15083. )) {
  15084. let j = i;
  15085. let prev;
  15086. while (j--) {
  15087. prev = children[j];
  15088. if (prev.type !== 3) {
  15089. break;
  15090. }
  15091. }
  15092. if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
  15093. let conditional = dynamicSlots[dynamicSlots.length - 1];
  15094. while (conditional.alternate.type === 19) {
  15095. conditional = conditional.alternate;
  15096. }
  15097. conditional.alternate = vElse.exp ? createConditionalExpression(
  15098. vElse.exp,
  15099. buildDynamicSlot(
  15100. slotName,
  15101. slotFunction,
  15102. conditionalBranchIndex++
  15103. ),
  15104. defaultFallback
  15105. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  15106. } else {
  15107. context.onError(
  15108. createCompilerError(30, vElse.loc)
  15109. );
  15110. }
  15111. } else if (vFor) {
  15112. hasDynamicSlots = true;
  15113. const parseResult = vFor.forParseResult;
  15114. if (parseResult) {
  15115. finalizeForParseResult(parseResult, context);
  15116. dynamicSlots.push(
  15117. createCallExpression(context.helper(RENDER_LIST), [
  15118. parseResult.source,
  15119. createFunctionExpression(
  15120. createForLoopParams(parseResult),
  15121. buildDynamicSlot(slotName, slotFunction),
  15122. true
  15123. )
  15124. ])
  15125. );
  15126. } else {
  15127. context.onError(
  15128. createCompilerError(
  15129. 32,
  15130. vFor.loc
  15131. )
  15132. );
  15133. }
  15134. } else {
  15135. if (staticSlotName) {
  15136. if (seenSlotNames.has(staticSlotName)) {
  15137. context.onError(
  15138. createCompilerError(
  15139. 38,
  15140. dirLoc
  15141. )
  15142. );
  15143. continue;
  15144. }
  15145. seenSlotNames.add(staticSlotName);
  15146. if (staticSlotName === "default") {
  15147. hasNamedDefaultSlot = true;
  15148. }
  15149. }
  15150. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  15151. }
  15152. }
  15153. if (!onComponentSlot) {
  15154. const buildDefaultSlotProperty = (props, children2) => {
  15155. const fn = buildSlotFn(props, void 0, children2, loc);
  15156. return createObjectProperty(`default`, fn);
  15157. };
  15158. if (!hasTemplateSlots) {
  15159. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  15160. } else if (implicitDefaultChildren.length && // #3766
  15161. // with whitespace: 'preserve', whitespaces between slots will end up in
  15162. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  15163. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  15164. if (hasNamedDefaultSlot) {
  15165. context.onError(
  15166. createCompilerError(
  15167. 39,
  15168. implicitDefaultChildren[0].loc
  15169. )
  15170. );
  15171. } else {
  15172. slotsProperties.push(
  15173. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  15174. );
  15175. }
  15176. }
  15177. }
  15178. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  15179. let slots = createObjectExpression(
  15180. slotsProperties.concat(
  15181. createObjectProperty(
  15182. `_`,
  15183. // 2 = compiled but dynamic = can skip normalization, but must run diff
  15184. // 1 = compiled and static = can skip normalization AND diff as optimized
  15185. createSimpleExpression(
  15186. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  15187. false
  15188. )
  15189. )
  15190. ),
  15191. loc
  15192. );
  15193. if (dynamicSlots.length) {
  15194. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  15195. slots,
  15196. createArrayExpression(dynamicSlots)
  15197. ]);
  15198. }
  15199. return {
  15200. slots,
  15201. hasDynamicSlots
  15202. };
  15203. }
  15204. function buildDynamicSlot(name, fn, index) {
  15205. const props = [
  15206. createObjectProperty(`name`, name),
  15207. createObjectProperty(`fn`, fn)
  15208. ];
  15209. if (index != null) {
  15210. props.push(
  15211. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  15212. );
  15213. }
  15214. return createObjectExpression(props);
  15215. }
  15216. function hasForwardedSlots(children) {
  15217. for (let i = 0; i < children.length; i++) {
  15218. const child = children[i];
  15219. switch (child.type) {
  15220. case 1:
  15221. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  15222. return true;
  15223. }
  15224. break;
  15225. case 9:
  15226. if (hasForwardedSlots(child.branches)) return true;
  15227. break;
  15228. case 10:
  15229. case 11:
  15230. if (hasForwardedSlots(child.children)) return true;
  15231. break;
  15232. }
  15233. }
  15234. return false;
  15235. }
  15236. function isNonWhitespaceContent(node) {
  15237. if (node.type !== 2 && node.type !== 12)
  15238. return true;
  15239. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  15240. }
  15241. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  15242. const transformElement = (node, context) => {
  15243. return function postTransformElement() {
  15244. node = context.currentNode;
  15245. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  15246. return;
  15247. }
  15248. const { tag, props } = node;
  15249. const isComponent = node.tagType === 1;
  15250. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  15251. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  15252. let vnodeProps;
  15253. let vnodeChildren;
  15254. let patchFlag = 0;
  15255. let vnodeDynamicProps;
  15256. let dynamicPropNames;
  15257. let vnodeDirectives;
  15258. let shouldUseBlock = (
  15259. // dynamic component may resolve to plain elements
  15260. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  15261. // updates inside get proper isSVG flag at runtime. (#639, #643)
  15262. // This is technically web-specific, but splitting the logic out of core
  15263. // leads to too much unnecessary complexity.
  15264. (tag === "svg" || tag === "foreignObject" || tag === "math")
  15265. );
  15266. if (props.length > 0) {
  15267. const propsBuildResult = buildProps(
  15268. node,
  15269. context,
  15270. void 0,
  15271. isComponent,
  15272. isDynamicComponent
  15273. );
  15274. vnodeProps = propsBuildResult.props;
  15275. patchFlag = propsBuildResult.patchFlag;
  15276. dynamicPropNames = propsBuildResult.dynamicPropNames;
  15277. const directives = propsBuildResult.directives;
  15278. vnodeDirectives = directives && directives.length ? createArrayExpression(
  15279. directives.map((dir) => buildDirectiveArgs(dir, context))
  15280. ) : void 0;
  15281. if (propsBuildResult.shouldUseBlock) {
  15282. shouldUseBlock = true;
  15283. }
  15284. }
  15285. if (node.children.length > 0) {
  15286. if (vnodeTag === KEEP_ALIVE) {
  15287. shouldUseBlock = true;
  15288. patchFlag |= 1024;
  15289. if (node.children.length > 1) {
  15290. context.onError(
  15291. createCompilerError(46, {
  15292. start: node.children[0].loc.start,
  15293. end: node.children[node.children.length - 1].loc.end,
  15294. source: ""
  15295. })
  15296. );
  15297. }
  15298. }
  15299. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  15300. vnodeTag !== TELEPORT && // explained above.
  15301. vnodeTag !== KEEP_ALIVE;
  15302. if (shouldBuildAsSlots) {
  15303. const { slots, hasDynamicSlots } = buildSlots(node, context);
  15304. vnodeChildren = slots;
  15305. if (hasDynamicSlots) {
  15306. patchFlag |= 1024;
  15307. }
  15308. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  15309. const child = node.children[0];
  15310. const type = child.type;
  15311. const hasDynamicTextChild = type === 5 || type === 8;
  15312. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  15313. patchFlag |= 1;
  15314. }
  15315. if (hasDynamicTextChild || type === 2) {
  15316. vnodeChildren = child;
  15317. } else {
  15318. vnodeChildren = node.children;
  15319. }
  15320. } else {
  15321. vnodeChildren = node.children;
  15322. }
  15323. }
  15324. if (dynamicPropNames && dynamicPropNames.length) {
  15325. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  15326. }
  15327. node.codegenNode = createVNodeCall(
  15328. context,
  15329. vnodeTag,
  15330. vnodeProps,
  15331. vnodeChildren,
  15332. patchFlag === 0 ? void 0 : patchFlag,
  15333. vnodeDynamicProps,
  15334. vnodeDirectives,
  15335. !!shouldUseBlock,
  15336. false,
  15337. isComponent,
  15338. node.loc
  15339. );
  15340. };
  15341. };
  15342. function resolveComponentType(node, context, ssr = false) {
  15343. let { tag } = node;
  15344. const isExplicitDynamic = isComponentTag(tag);
  15345. const isProp = findProp(
  15346. node,
  15347. "is",
  15348. false,
  15349. true
  15350. /* allow empty */
  15351. );
  15352. if (isProp) {
  15353. if (isExplicitDynamic || false) {
  15354. let exp;
  15355. if (isProp.type === 6) {
  15356. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  15357. } else {
  15358. exp = isProp.exp;
  15359. if (!exp) {
  15360. exp = createSimpleExpression(`is`, false, isProp.arg.loc);
  15361. }
  15362. }
  15363. if (exp) {
  15364. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  15365. exp
  15366. ]);
  15367. }
  15368. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  15369. tag = isProp.value.content.slice(4);
  15370. }
  15371. }
  15372. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  15373. if (builtIn) {
  15374. if (!ssr) context.helper(builtIn);
  15375. return builtIn;
  15376. }
  15377. context.helper(RESOLVE_COMPONENT);
  15378. context.components.add(tag);
  15379. return toValidAssetId(tag, `component`);
  15380. }
  15381. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  15382. const { tag, loc: elementLoc, children } = node;
  15383. let properties = [];
  15384. const mergeArgs = [];
  15385. const runtimeDirectives = [];
  15386. const hasChildren = children.length > 0;
  15387. let shouldUseBlock = false;
  15388. let patchFlag = 0;
  15389. let hasRef = false;
  15390. let hasClassBinding = false;
  15391. let hasStyleBinding = false;
  15392. let hasHydrationEventBinding = false;
  15393. let hasDynamicKeys = false;
  15394. let hasVnodeHook = false;
  15395. const dynamicPropNames = [];
  15396. const pushMergeArg = (arg) => {
  15397. if (properties.length) {
  15398. mergeArgs.push(
  15399. createObjectExpression(dedupeProperties(properties), elementLoc)
  15400. );
  15401. properties = [];
  15402. }
  15403. if (arg) mergeArgs.push(arg);
  15404. };
  15405. const pushRefVForMarker = () => {
  15406. if (context.scopes.vFor > 0) {
  15407. properties.push(
  15408. createObjectProperty(
  15409. createSimpleExpression("ref_for", true),
  15410. createSimpleExpression("true")
  15411. )
  15412. );
  15413. }
  15414. };
  15415. const analyzePatchFlag = ({ key, value }) => {
  15416. if (isStaticExp(key)) {
  15417. const name = key.content;
  15418. const isEventHandler = isOn(name);
  15419. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  15420. // dedicated fast path.
  15421. name.toLowerCase() !== "onclick" && // omit v-model handlers
  15422. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  15423. !isReservedProp(name)) {
  15424. hasHydrationEventBinding = true;
  15425. }
  15426. if (isEventHandler && isReservedProp(name)) {
  15427. hasVnodeHook = true;
  15428. }
  15429. if (isEventHandler && value.type === 14) {
  15430. value = value.arguments[0];
  15431. }
  15432. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  15433. return;
  15434. }
  15435. if (name === "ref") {
  15436. hasRef = true;
  15437. } else if (name === "class") {
  15438. hasClassBinding = true;
  15439. } else if (name === "style") {
  15440. hasStyleBinding = true;
  15441. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  15442. dynamicPropNames.push(name);
  15443. }
  15444. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  15445. dynamicPropNames.push(name);
  15446. }
  15447. } else {
  15448. hasDynamicKeys = true;
  15449. }
  15450. };
  15451. for (let i = 0; i < props.length; i++) {
  15452. const prop = props[i];
  15453. if (prop.type === 6) {
  15454. const { loc, name, nameLoc, value } = prop;
  15455. let isStatic = true;
  15456. if (name === "ref") {
  15457. hasRef = true;
  15458. pushRefVForMarker();
  15459. }
  15460. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  15461. continue;
  15462. }
  15463. properties.push(
  15464. createObjectProperty(
  15465. createSimpleExpression(name, true, nameLoc),
  15466. createSimpleExpression(
  15467. value ? value.content : "",
  15468. isStatic,
  15469. value ? value.loc : loc
  15470. )
  15471. )
  15472. );
  15473. } else {
  15474. const { name, arg, exp, loc, modifiers } = prop;
  15475. const isVBind = name === "bind";
  15476. const isVOn = name === "on";
  15477. if (name === "slot") {
  15478. if (!isComponent) {
  15479. context.onError(
  15480. createCompilerError(40, loc)
  15481. );
  15482. }
  15483. continue;
  15484. }
  15485. if (name === "once" || name === "memo") {
  15486. continue;
  15487. }
  15488. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  15489. continue;
  15490. }
  15491. if (isVOn && ssr) {
  15492. continue;
  15493. }
  15494. if (
  15495. // #938: elements with dynamic keys should be forced into blocks
  15496. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  15497. // before children
  15498. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  15499. ) {
  15500. shouldUseBlock = true;
  15501. }
  15502. if (isVBind && isStaticArgOf(arg, "ref")) {
  15503. pushRefVForMarker();
  15504. }
  15505. if (!arg && (isVBind || isVOn)) {
  15506. hasDynamicKeys = true;
  15507. if (exp) {
  15508. if (isVBind) {
  15509. pushRefVForMarker();
  15510. pushMergeArg();
  15511. mergeArgs.push(exp);
  15512. } else {
  15513. pushMergeArg({
  15514. type: 14,
  15515. loc,
  15516. callee: context.helper(TO_HANDLERS),
  15517. arguments: isComponent ? [exp] : [exp, `true`]
  15518. });
  15519. }
  15520. } else {
  15521. context.onError(
  15522. createCompilerError(
  15523. isVBind ? 34 : 35,
  15524. loc
  15525. )
  15526. );
  15527. }
  15528. continue;
  15529. }
  15530. if (isVBind && modifiers.includes("prop")) {
  15531. patchFlag |= 32;
  15532. }
  15533. const directiveTransform = context.directiveTransforms[name];
  15534. if (directiveTransform) {
  15535. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  15536. !ssr && props2.forEach(analyzePatchFlag);
  15537. if (isVOn && arg && !isStaticExp(arg)) {
  15538. pushMergeArg(createObjectExpression(props2, elementLoc));
  15539. } else {
  15540. properties.push(...props2);
  15541. }
  15542. if (needRuntime) {
  15543. runtimeDirectives.push(prop);
  15544. if (isSymbol(needRuntime)) {
  15545. directiveImportMap.set(prop, needRuntime);
  15546. }
  15547. }
  15548. } else if (!isBuiltInDirective(name)) {
  15549. runtimeDirectives.push(prop);
  15550. if (hasChildren) {
  15551. shouldUseBlock = true;
  15552. }
  15553. }
  15554. }
  15555. }
  15556. let propsExpression = void 0;
  15557. if (mergeArgs.length) {
  15558. pushMergeArg();
  15559. if (mergeArgs.length > 1) {
  15560. propsExpression = createCallExpression(
  15561. context.helper(MERGE_PROPS),
  15562. mergeArgs,
  15563. elementLoc
  15564. );
  15565. } else {
  15566. propsExpression = mergeArgs[0];
  15567. }
  15568. } else if (properties.length) {
  15569. propsExpression = createObjectExpression(
  15570. dedupeProperties(properties),
  15571. elementLoc
  15572. );
  15573. }
  15574. if (hasDynamicKeys) {
  15575. patchFlag |= 16;
  15576. } else {
  15577. if (hasClassBinding && !isComponent) {
  15578. patchFlag |= 2;
  15579. }
  15580. if (hasStyleBinding && !isComponent) {
  15581. patchFlag |= 4;
  15582. }
  15583. if (dynamicPropNames.length) {
  15584. patchFlag |= 8;
  15585. }
  15586. if (hasHydrationEventBinding) {
  15587. patchFlag |= 32;
  15588. }
  15589. }
  15590. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  15591. patchFlag |= 512;
  15592. }
  15593. if (!context.inSSR && propsExpression) {
  15594. switch (propsExpression.type) {
  15595. case 15:
  15596. let classKeyIndex = -1;
  15597. let styleKeyIndex = -1;
  15598. let hasDynamicKey = false;
  15599. for (let i = 0; i < propsExpression.properties.length; i++) {
  15600. const key = propsExpression.properties[i].key;
  15601. if (isStaticExp(key)) {
  15602. if (key.content === "class") {
  15603. classKeyIndex = i;
  15604. } else if (key.content === "style") {
  15605. styleKeyIndex = i;
  15606. }
  15607. } else if (!key.isHandlerKey) {
  15608. hasDynamicKey = true;
  15609. }
  15610. }
  15611. const classProp = propsExpression.properties[classKeyIndex];
  15612. const styleProp = propsExpression.properties[styleKeyIndex];
  15613. if (!hasDynamicKey) {
  15614. if (classProp && !isStaticExp(classProp.value)) {
  15615. classProp.value = createCallExpression(
  15616. context.helper(NORMALIZE_CLASS),
  15617. [classProp.value]
  15618. );
  15619. }
  15620. if (styleProp && // the static style is compiled into an object,
  15621. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  15622. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  15623. // v-bind:style with static literal object
  15624. styleProp.value.type === 17)) {
  15625. styleProp.value = createCallExpression(
  15626. context.helper(NORMALIZE_STYLE),
  15627. [styleProp.value]
  15628. );
  15629. }
  15630. } else {
  15631. propsExpression = createCallExpression(
  15632. context.helper(NORMALIZE_PROPS),
  15633. [propsExpression]
  15634. );
  15635. }
  15636. break;
  15637. case 14:
  15638. break;
  15639. default:
  15640. propsExpression = createCallExpression(
  15641. context.helper(NORMALIZE_PROPS),
  15642. [
  15643. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  15644. propsExpression
  15645. ])
  15646. ]
  15647. );
  15648. break;
  15649. }
  15650. }
  15651. return {
  15652. props: propsExpression,
  15653. directives: runtimeDirectives,
  15654. patchFlag,
  15655. dynamicPropNames,
  15656. shouldUseBlock
  15657. };
  15658. }
  15659. function dedupeProperties(properties) {
  15660. const knownProps = /* @__PURE__ */ new Map();
  15661. const deduped = [];
  15662. for (let i = 0; i < properties.length; i++) {
  15663. const prop = properties[i];
  15664. if (prop.key.type === 8 || !prop.key.isStatic) {
  15665. deduped.push(prop);
  15666. continue;
  15667. }
  15668. const name = prop.key.content;
  15669. const existing = knownProps.get(name);
  15670. if (existing) {
  15671. if (name === "style" || name === "class" || isOn(name)) {
  15672. mergeAsArray(existing, prop);
  15673. }
  15674. } else {
  15675. knownProps.set(name, prop);
  15676. deduped.push(prop);
  15677. }
  15678. }
  15679. return deduped;
  15680. }
  15681. function mergeAsArray(existing, incoming) {
  15682. if (existing.value.type === 17) {
  15683. existing.value.elements.push(incoming.value);
  15684. } else {
  15685. existing.value = createArrayExpression(
  15686. [existing.value, incoming.value],
  15687. existing.loc
  15688. );
  15689. }
  15690. }
  15691. function buildDirectiveArgs(dir, context) {
  15692. const dirArgs = [];
  15693. const runtime = directiveImportMap.get(dir);
  15694. if (runtime) {
  15695. dirArgs.push(context.helperString(runtime));
  15696. } else {
  15697. {
  15698. context.helper(RESOLVE_DIRECTIVE);
  15699. context.directives.add(dir.name);
  15700. dirArgs.push(toValidAssetId(dir.name, `directive`));
  15701. }
  15702. }
  15703. const { loc } = dir;
  15704. if (dir.exp) dirArgs.push(dir.exp);
  15705. if (dir.arg) {
  15706. if (!dir.exp) {
  15707. dirArgs.push(`void 0`);
  15708. }
  15709. dirArgs.push(dir.arg);
  15710. }
  15711. if (Object.keys(dir.modifiers).length) {
  15712. if (!dir.arg) {
  15713. if (!dir.exp) {
  15714. dirArgs.push(`void 0`);
  15715. }
  15716. dirArgs.push(`void 0`);
  15717. }
  15718. const trueExpression = createSimpleExpression(`true`, false, loc);
  15719. dirArgs.push(
  15720. createObjectExpression(
  15721. dir.modifiers.map(
  15722. (modifier) => createObjectProperty(modifier, trueExpression)
  15723. ),
  15724. loc
  15725. )
  15726. );
  15727. }
  15728. return createArrayExpression(dirArgs, dir.loc);
  15729. }
  15730. function stringifyDynamicPropNames(props) {
  15731. let propsNamesString = `[`;
  15732. for (let i = 0, l = props.length; i < l; i++) {
  15733. propsNamesString += JSON.stringify(props[i]);
  15734. if (i < l - 1) propsNamesString += ", ";
  15735. }
  15736. return propsNamesString + `]`;
  15737. }
  15738. function isComponentTag(tag) {
  15739. return tag === "component" || tag === "Component";
  15740. }
  15741. const transformSlotOutlet = (node, context) => {
  15742. if (isSlotOutlet(node)) {
  15743. const { children, loc } = node;
  15744. const { slotName, slotProps } = processSlotOutlet(node, context);
  15745. const slotArgs = [
  15746. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  15747. slotName,
  15748. "{}",
  15749. "undefined",
  15750. "true"
  15751. ];
  15752. let expectedLen = 2;
  15753. if (slotProps) {
  15754. slotArgs[2] = slotProps;
  15755. expectedLen = 3;
  15756. }
  15757. if (children.length) {
  15758. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  15759. expectedLen = 4;
  15760. }
  15761. if (context.scopeId && !context.slotted) {
  15762. expectedLen = 5;
  15763. }
  15764. slotArgs.splice(expectedLen);
  15765. node.codegenNode = createCallExpression(
  15766. context.helper(RENDER_SLOT),
  15767. slotArgs,
  15768. loc
  15769. );
  15770. }
  15771. };
  15772. function processSlotOutlet(node, context) {
  15773. let slotName = `"default"`;
  15774. let slotProps = void 0;
  15775. const nonNameProps = [];
  15776. for (let i = 0; i < node.props.length; i++) {
  15777. const p = node.props[i];
  15778. if (p.type === 6) {
  15779. if (p.value) {
  15780. if (p.name === "name") {
  15781. slotName = JSON.stringify(p.value.content);
  15782. } else {
  15783. p.name = camelize(p.name);
  15784. nonNameProps.push(p);
  15785. }
  15786. }
  15787. } else {
  15788. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  15789. if (p.exp) {
  15790. slotName = p.exp;
  15791. } else if (p.arg && p.arg.type === 4) {
  15792. const name = camelize(p.arg.content);
  15793. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  15794. }
  15795. } else {
  15796. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  15797. p.arg.content = camelize(p.arg.content);
  15798. }
  15799. nonNameProps.push(p);
  15800. }
  15801. }
  15802. }
  15803. if (nonNameProps.length > 0) {
  15804. const { props, directives } = buildProps(
  15805. node,
  15806. context,
  15807. nonNameProps,
  15808. false,
  15809. false
  15810. );
  15811. slotProps = props;
  15812. if (directives.length) {
  15813. context.onError(
  15814. createCompilerError(
  15815. 36,
  15816. directives[0].loc
  15817. )
  15818. );
  15819. }
  15820. }
  15821. return {
  15822. slotName,
  15823. slotProps
  15824. };
  15825. }
  15826. const transformOn$1 = (dir, node, context, augmentor) => {
  15827. const { loc, modifiers, arg } = dir;
  15828. if (!dir.exp && !modifiers.length) {
  15829. context.onError(createCompilerError(35, loc));
  15830. }
  15831. let eventName;
  15832. if (arg.type === 4) {
  15833. if (arg.isStatic) {
  15834. let rawName = arg.content;
  15835. if (rawName.startsWith("vnode")) {
  15836. context.onError(createCompilerError(51, arg.loc));
  15837. }
  15838. if (rawName.startsWith("vue:")) {
  15839. rawName = `vnode-${rawName.slice(4)}`;
  15840. }
  15841. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  15842. // for non-element and vnode lifecycle event listeners, auto convert
  15843. // it to camelCase. See issue #2249
  15844. toHandlerKey(camelize(rawName))
  15845. ) : (
  15846. // preserve case for plain element listeners that have uppercase
  15847. // letters, as these may be custom elements' custom events
  15848. `on:${rawName}`
  15849. );
  15850. eventName = createSimpleExpression(eventString, true, arg.loc);
  15851. } else {
  15852. eventName = createCompoundExpression([
  15853. `${context.helperString(TO_HANDLER_KEY)}(`,
  15854. arg,
  15855. `)`
  15856. ]);
  15857. }
  15858. } else {
  15859. eventName = arg;
  15860. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  15861. eventName.children.push(`)`);
  15862. }
  15863. let exp = dir.exp;
  15864. if (exp && !exp.content.trim()) {
  15865. exp = void 0;
  15866. }
  15867. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  15868. if (exp) {
  15869. const isMemberExp = isMemberExpression(exp);
  15870. const isInlineStatement = !(isMemberExp || isFnExpression(exp));
  15871. const hasMultipleStatements = exp.content.includes(`;`);
  15872. {
  15873. validateBrowserExpression(
  15874. exp,
  15875. context,
  15876. false,
  15877. hasMultipleStatements
  15878. );
  15879. }
  15880. if (isInlineStatement || shouldCache && isMemberExp) {
  15881. exp = createCompoundExpression([
  15882. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  15883. exp,
  15884. hasMultipleStatements ? `}` : `)`
  15885. ]);
  15886. }
  15887. }
  15888. let ret = {
  15889. props: [
  15890. createObjectProperty(
  15891. eventName,
  15892. exp || createSimpleExpression(`() => {}`, false, loc)
  15893. )
  15894. ]
  15895. };
  15896. if (augmentor) {
  15897. ret = augmentor(ret);
  15898. }
  15899. if (shouldCache) {
  15900. ret.props[0].value = context.cache(ret.props[0].value);
  15901. }
  15902. ret.props.forEach((p) => p.key.isHandlerKey = true);
  15903. return ret;
  15904. };
  15905. const transformText = (node, context) => {
  15906. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  15907. return () => {
  15908. const children = node.children;
  15909. let currentContainer = void 0;
  15910. let hasText = false;
  15911. for (let i = 0; i < children.length; i++) {
  15912. const child = children[i];
  15913. if (isText$1(child)) {
  15914. hasText = true;
  15915. for (let j = i + 1; j < children.length; j++) {
  15916. const next = children[j];
  15917. if (isText$1(next)) {
  15918. if (!currentContainer) {
  15919. currentContainer = children[i] = createCompoundExpression(
  15920. [child],
  15921. child.loc
  15922. );
  15923. }
  15924. currentContainer.children.push(` + `, next);
  15925. children.splice(j, 1);
  15926. j--;
  15927. } else {
  15928. currentContainer = void 0;
  15929. break;
  15930. }
  15931. }
  15932. }
  15933. }
  15934. if (!hasText || // if this is a plain element with a single text child, leave it
  15935. // as-is since the runtime has dedicated fast path for this by directly
  15936. // setting textContent of the element.
  15937. // for component root it's always normalized anyway.
  15938. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  15939. // custom directives can potentially add DOM elements arbitrarily,
  15940. // we need to avoid setting textContent of the element at runtime
  15941. // to avoid accidentally overwriting the DOM elements added
  15942. // by the user through custom directives.
  15943. !node.props.find(
  15944. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  15945. ) && // in compat mode, <template> tags with no special directives
  15946. // will be rendered as a fragment so its children must be
  15947. // converted into vnodes.
  15948. true)) {
  15949. return;
  15950. }
  15951. for (let i = 0; i < children.length; i++) {
  15952. const child = children[i];
  15953. if (isText$1(child) || child.type === 8) {
  15954. const callArgs = [];
  15955. if (child.type !== 2 || child.content !== " ") {
  15956. callArgs.push(child);
  15957. }
  15958. if (!context.ssr && getConstantType(child, context) === 0) {
  15959. callArgs.push(
  15960. 1 + (` /* ${PatchFlagNames[1]} */` )
  15961. );
  15962. }
  15963. children[i] = {
  15964. type: 12,
  15965. content: child,
  15966. loc: child.loc,
  15967. codegenNode: createCallExpression(
  15968. context.helper(CREATE_TEXT),
  15969. callArgs
  15970. )
  15971. };
  15972. }
  15973. }
  15974. };
  15975. }
  15976. };
  15977. const seen$1 = /* @__PURE__ */ new WeakSet();
  15978. const transformOnce = (node, context) => {
  15979. if (node.type === 1 && findDir(node, "once", true)) {
  15980. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  15981. return;
  15982. }
  15983. seen$1.add(node);
  15984. context.inVOnce = true;
  15985. context.helper(SET_BLOCK_TRACKING);
  15986. return () => {
  15987. context.inVOnce = false;
  15988. const cur = context.currentNode;
  15989. if (cur.codegenNode) {
  15990. cur.codegenNode = context.cache(
  15991. cur.codegenNode,
  15992. true
  15993. /* isVNode */
  15994. );
  15995. }
  15996. };
  15997. }
  15998. };
  15999. const transformModel$1 = (dir, node, context) => {
  16000. const { exp, arg } = dir;
  16001. if (!exp) {
  16002. context.onError(
  16003. createCompilerError(41, dir.loc)
  16004. );
  16005. return createTransformProps();
  16006. }
  16007. const rawExp = exp.loc.source;
  16008. const expString = exp.type === 4 ? exp.content : rawExp;
  16009. const bindingType = context.bindingMetadata[rawExp];
  16010. if (bindingType === "props" || bindingType === "props-aliased") {
  16011. context.onError(createCompilerError(44, exp.loc));
  16012. return createTransformProps();
  16013. }
  16014. const maybeRef = false;
  16015. if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
  16016. context.onError(
  16017. createCompilerError(42, exp.loc)
  16018. );
  16019. return createTransformProps();
  16020. }
  16021. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  16022. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  16023. let assignmentExp;
  16024. const eventArg = context.isTS ? `($event: any)` : `$event`;
  16025. {
  16026. assignmentExp = createCompoundExpression([
  16027. `${eventArg} => ((`,
  16028. exp,
  16029. `) = $event)`
  16030. ]);
  16031. }
  16032. const props = [
  16033. // modelValue: foo
  16034. createObjectProperty(propName, dir.exp),
  16035. // "onUpdate:modelValue": $event => (foo = $event)
  16036. createObjectProperty(eventName, assignmentExp)
  16037. ];
  16038. if (dir.modifiers.length && node.tagType === 1) {
  16039. const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  16040. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  16041. props.push(
  16042. createObjectProperty(
  16043. modifiersKey,
  16044. createSimpleExpression(
  16045. `{ ${modifiers} }`,
  16046. false,
  16047. dir.loc,
  16048. 2
  16049. )
  16050. )
  16051. );
  16052. }
  16053. return createTransformProps(props);
  16054. };
  16055. function createTransformProps(props = []) {
  16056. return { props };
  16057. }
  16058. const seen = /* @__PURE__ */ new WeakSet();
  16059. const transformMemo = (node, context) => {
  16060. if (node.type === 1) {
  16061. const dir = findDir(node, "memo");
  16062. if (!dir || seen.has(node)) {
  16063. return;
  16064. }
  16065. seen.add(node);
  16066. return () => {
  16067. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  16068. if (codegenNode && codegenNode.type === 13) {
  16069. if (node.tagType !== 1) {
  16070. convertToBlock(codegenNode, context);
  16071. }
  16072. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  16073. dir.exp,
  16074. createFunctionExpression(void 0, codegenNode),
  16075. `_cache`,
  16076. String(context.cached++)
  16077. ]);
  16078. }
  16079. };
  16080. }
  16081. };
  16082. function getBaseTransformPreset(prefixIdentifiers) {
  16083. return [
  16084. [
  16085. transformOnce,
  16086. transformIf,
  16087. transformMemo,
  16088. transformFor,
  16089. ...[],
  16090. ...[transformExpression] ,
  16091. transformSlotOutlet,
  16092. transformElement,
  16093. trackSlotScopes,
  16094. transformText
  16095. ],
  16096. {
  16097. on: transformOn$1,
  16098. bind: transformBind,
  16099. model: transformModel$1
  16100. }
  16101. ];
  16102. }
  16103. function baseCompile(source, options = {}) {
  16104. const onError = options.onError || defaultOnError;
  16105. const isModuleMode = options.mode === "module";
  16106. {
  16107. if (options.prefixIdentifiers === true) {
  16108. onError(createCompilerError(47));
  16109. } else if (isModuleMode) {
  16110. onError(createCompilerError(48));
  16111. }
  16112. }
  16113. const prefixIdentifiers = false;
  16114. if (options.cacheHandlers) {
  16115. onError(createCompilerError(49));
  16116. }
  16117. if (options.scopeId && !isModuleMode) {
  16118. onError(createCompilerError(50));
  16119. }
  16120. const resolvedOptions = extend({}, options, {
  16121. prefixIdentifiers
  16122. });
  16123. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  16124. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  16125. transform(
  16126. ast,
  16127. extend({}, resolvedOptions, {
  16128. nodeTransforms: [
  16129. ...nodeTransforms,
  16130. ...options.nodeTransforms || []
  16131. // user transforms
  16132. ],
  16133. directiveTransforms: extend(
  16134. {},
  16135. directiveTransforms,
  16136. options.directiveTransforms || {}
  16137. // user transforms
  16138. )
  16139. })
  16140. );
  16141. return generate(ast, resolvedOptions);
  16142. }
  16143. const noopDirectiveTransform = () => ({ props: [] });
  16144. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  16145. const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
  16146. const V_MODEL_TEXT = Symbol(`vModelText` );
  16147. const V_MODEL_SELECT = Symbol(`vModelSelect` );
  16148. const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
  16149. const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
  16150. const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
  16151. const V_SHOW = Symbol(`vShow` );
  16152. const TRANSITION = Symbol(`Transition` );
  16153. const TRANSITION_GROUP = Symbol(`TransitionGroup` );
  16154. registerRuntimeHelpers({
  16155. [V_MODEL_RADIO]: `vModelRadio`,
  16156. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  16157. [V_MODEL_TEXT]: `vModelText`,
  16158. [V_MODEL_SELECT]: `vModelSelect`,
  16159. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  16160. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  16161. [V_ON_WITH_KEYS]: `withKeys`,
  16162. [V_SHOW]: `vShow`,
  16163. [TRANSITION]: `Transition`,
  16164. [TRANSITION_GROUP]: `TransitionGroup`
  16165. });
  16166. let decoder;
  16167. function decodeHtmlBrowser(raw, asAttr = false) {
  16168. if (!decoder) {
  16169. decoder = document.createElement("div");
  16170. }
  16171. if (asAttr) {
  16172. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  16173. return decoder.children[0].getAttribute("foo");
  16174. } else {
  16175. decoder.innerHTML = raw;
  16176. return decoder.textContent;
  16177. }
  16178. }
  16179. const parserOptions = {
  16180. parseMode: "html",
  16181. isVoidTag,
  16182. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  16183. isPreTag: (tag) => tag === "pre",
  16184. decodeEntities: decodeHtmlBrowser ,
  16185. isBuiltInComponent: (tag) => {
  16186. if (tag === "Transition" || tag === "transition") {
  16187. return TRANSITION;
  16188. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  16189. return TRANSITION_GROUP;
  16190. }
  16191. },
  16192. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  16193. getNamespace(tag, parent, rootNamespace) {
  16194. let ns = parent ? parent.ns : rootNamespace;
  16195. if (parent && ns === 2) {
  16196. if (parent.tag === "annotation-xml") {
  16197. if (tag === "svg") {
  16198. return 1;
  16199. }
  16200. if (parent.props.some(
  16201. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  16202. )) {
  16203. ns = 0;
  16204. }
  16205. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  16206. ns = 0;
  16207. }
  16208. } else if (parent && ns === 1) {
  16209. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  16210. ns = 0;
  16211. }
  16212. }
  16213. if (ns === 0) {
  16214. if (tag === "svg") {
  16215. return 1;
  16216. }
  16217. if (tag === "math") {
  16218. return 2;
  16219. }
  16220. }
  16221. return ns;
  16222. }
  16223. };
  16224. const transformStyle = (node) => {
  16225. if (node.type === 1) {
  16226. node.props.forEach((p, i) => {
  16227. if (p.type === 6 && p.name === "style" && p.value) {
  16228. node.props[i] = {
  16229. type: 7,
  16230. name: `bind`,
  16231. arg: createSimpleExpression(`style`, true, p.loc),
  16232. exp: parseInlineCSS(p.value.content, p.loc),
  16233. modifiers: [],
  16234. loc: p.loc
  16235. };
  16236. }
  16237. });
  16238. }
  16239. };
  16240. const parseInlineCSS = (cssText, loc) => {
  16241. const normalized = parseStringStyle(cssText);
  16242. return createSimpleExpression(
  16243. JSON.stringify(normalized),
  16244. false,
  16245. loc,
  16246. 3
  16247. );
  16248. };
  16249. function createDOMCompilerError(code, loc) {
  16250. return createCompilerError(
  16251. code,
  16252. loc,
  16253. DOMErrorMessages
  16254. );
  16255. }
  16256. const DOMErrorMessages = {
  16257. [53]: `v-html is missing expression.`,
  16258. [54]: `v-html will override element children.`,
  16259. [55]: `v-text is missing expression.`,
  16260. [56]: `v-text will override element children.`,
  16261. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  16262. [58]: `v-model argument is not supported on plain elements.`,
  16263. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  16264. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  16265. [61]: `v-show is missing expression.`,
  16266. [62]: `<Transition> expects exactly one child element or component.`,
  16267. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  16268. };
  16269. const transformVHtml = (dir, node, context) => {
  16270. const { exp, loc } = dir;
  16271. if (!exp) {
  16272. context.onError(
  16273. createDOMCompilerError(53, loc)
  16274. );
  16275. }
  16276. if (node.children.length) {
  16277. context.onError(
  16278. createDOMCompilerError(54, loc)
  16279. );
  16280. node.children.length = 0;
  16281. }
  16282. return {
  16283. props: [
  16284. createObjectProperty(
  16285. createSimpleExpression(`innerHTML`, true, loc),
  16286. exp || createSimpleExpression("", true)
  16287. )
  16288. ]
  16289. };
  16290. };
  16291. const transformVText = (dir, node, context) => {
  16292. const { exp, loc } = dir;
  16293. if (!exp) {
  16294. context.onError(
  16295. createDOMCompilerError(55, loc)
  16296. );
  16297. }
  16298. if (node.children.length) {
  16299. context.onError(
  16300. createDOMCompilerError(56, loc)
  16301. );
  16302. node.children.length = 0;
  16303. }
  16304. return {
  16305. props: [
  16306. createObjectProperty(
  16307. createSimpleExpression(`textContent`, true),
  16308. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  16309. context.helperString(TO_DISPLAY_STRING),
  16310. [exp],
  16311. loc
  16312. ) : createSimpleExpression("", true)
  16313. )
  16314. ]
  16315. };
  16316. };
  16317. const transformModel = (dir, node, context) => {
  16318. const baseResult = transformModel$1(dir, node, context);
  16319. if (!baseResult.props.length || node.tagType === 1) {
  16320. return baseResult;
  16321. }
  16322. if (dir.arg) {
  16323. context.onError(
  16324. createDOMCompilerError(
  16325. 58,
  16326. dir.arg.loc
  16327. )
  16328. );
  16329. }
  16330. function checkDuplicatedValue() {
  16331. const value = findDir(node, "bind");
  16332. if (value && isStaticArgOf(value.arg, "value")) {
  16333. context.onError(
  16334. createDOMCompilerError(
  16335. 60,
  16336. value.loc
  16337. )
  16338. );
  16339. }
  16340. }
  16341. const { tag } = node;
  16342. const isCustomElement = context.isCustomElement(tag);
  16343. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  16344. let directiveToUse = V_MODEL_TEXT;
  16345. let isInvalidType = false;
  16346. if (tag === "input" || isCustomElement) {
  16347. const type = findProp(node, `type`);
  16348. if (type) {
  16349. if (type.type === 7) {
  16350. directiveToUse = V_MODEL_DYNAMIC;
  16351. } else if (type.value) {
  16352. switch (type.value.content) {
  16353. case "radio":
  16354. directiveToUse = V_MODEL_RADIO;
  16355. break;
  16356. case "checkbox":
  16357. directiveToUse = V_MODEL_CHECKBOX;
  16358. break;
  16359. case "file":
  16360. isInvalidType = true;
  16361. context.onError(
  16362. createDOMCompilerError(
  16363. 59,
  16364. dir.loc
  16365. )
  16366. );
  16367. break;
  16368. default:
  16369. checkDuplicatedValue();
  16370. break;
  16371. }
  16372. }
  16373. } else if (hasDynamicKeyVBind(node)) {
  16374. directiveToUse = V_MODEL_DYNAMIC;
  16375. } else {
  16376. checkDuplicatedValue();
  16377. }
  16378. } else if (tag === "select") {
  16379. directiveToUse = V_MODEL_SELECT;
  16380. } else {
  16381. checkDuplicatedValue();
  16382. }
  16383. if (!isInvalidType) {
  16384. baseResult.needRuntime = context.helper(directiveToUse);
  16385. }
  16386. } else {
  16387. context.onError(
  16388. createDOMCompilerError(
  16389. 57,
  16390. dir.loc
  16391. )
  16392. );
  16393. }
  16394. baseResult.props = baseResult.props.filter(
  16395. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  16396. );
  16397. return baseResult;
  16398. };
  16399. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  16400. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  16401. // event propagation management
  16402. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  16403. );
  16404. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  16405. const isKeyboardEvent = /* @__PURE__ */ makeMap(
  16406. `onkeyup,onkeydown,onkeypress`,
  16407. true
  16408. );
  16409. const resolveModifiers = (key, modifiers, context, loc) => {
  16410. const keyModifiers = [];
  16411. const nonKeyModifiers = [];
  16412. const eventOptionModifiers = [];
  16413. for (let i = 0; i < modifiers.length; i++) {
  16414. const modifier = modifiers[i];
  16415. if (isEventOptionModifier(modifier)) {
  16416. eventOptionModifiers.push(modifier);
  16417. } else {
  16418. if (maybeKeyModifier(modifier)) {
  16419. if (isStaticExp(key)) {
  16420. if (isKeyboardEvent(key.content)) {
  16421. keyModifiers.push(modifier);
  16422. } else {
  16423. nonKeyModifiers.push(modifier);
  16424. }
  16425. } else {
  16426. keyModifiers.push(modifier);
  16427. nonKeyModifiers.push(modifier);
  16428. }
  16429. } else {
  16430. if (isNonKeyModifier(modifier)) {
  16431. nonKeyModifiers.push(modifier);
  16432. } else {
  16433. keyModifiers.push(modifier);
  16434. }
  16435. }
  16436. }
  16437. }
  16438. return {
  16439. keyModifiers,
  16440. nonKeyModifiers,
  16441. eventOptionModifiers
  16442. };
  16443. };
  16444. const transformClick = (key, event) => {
  16445. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  16446. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  16447. `(`,
  16448. key,
  16449. `) === "onClick" ? "${event}" : (`,
  16450. key,
  16451. `)`
  16452. ]) : key;
  16453. };
  16454. const transformOn = (dir, node, context) => {
  16455. return transformOn$1(dir, node, context, (baseResult) => {
  16456. const { modifiers } = dir;
  16457. if (!modifiers.length) return baseResult;
  16458. let { key, value: handlerExp } = baseResult.props[0];
  16459. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  16460. if (nonKeyModifiers.includes("right")) {
  16461. key = transformClick(key, `onContextmenu`);
  16462. }
  16463. if (nonKeyModifiers.includes("middle")) {
  16464. key = transformClick(key, `onMouseup`);
  16465. }
  16466. if (nonKeyModifiers.length) {
  16467. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  16468. handlerExp,
  16469. JSON.stringify(nonKeyModifiers)
  16470. ]);
  16471. }
  16472. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  16473. (!isStaticExp(key) || isKeyboardEvent(key.content))) {
  16474. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  16475. handlerExp,
  16476. JSON.stringify(keyModifiers)
  16477. ]);
  16478. }
  16479. if (eventOptionModifiers.length) {
  16480. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  16481. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  16482. }
  16483. return {
  16484. props: [createObjectProperty(key, handlerExp)]
  16485. };
  16486. });
  16487. };
  16488. const transformShow = (dir, node, context) => {
  16489. const { exp, loc } = dir;
  16490. if (!exp) {
  16491. context.onError(
  16492. createDOMCompilerError(61, loc)
  16493. );
  16494. }
  16495. return {
  16496. props: [],
  16497. needRuntime: context.helper(V_SHOW)
  16498. };
  16499. };
  16500. const transformTransition = (node, context) => {
  16501. if (node.type === 1 && node.tagType === 1) {
  16502. const component = context.isBuiltInComponent(node.tag);
  16503. if (component === TRANSITION) {
  16504. return () => {
  16505. if (!node.children.length) {
  16506. return;
  16507. }
  16508. if (hasMultipleChildren(node)) {
  16509. context.onError(
  16510. createDOMCompilerError(
  16511. 62,
  16512. {
  16513. start: node.children[0].loc.start,
  16514. end: node.children[node.children.length - 1].loc.end,
  16515. source: ""
  16516. }
  16517. )
  16518. );
  16519. }
  16520. const child = node.children[0];
  16521. if (child.type === 1) {
  16522. for (const p of child.props) {
  16523. if (p.type === 7 && p.name === "show") {
  16524. node.props.push({
  16525. type: 6,
  16526. name: "persisted",
  16527. nameLoc: node.loc,
  16528. value: void 0,
  16529. loc: node.loc
  16530. });
  16531. }
  16532. }
  16533. }
  16534. };
  16535. }
  16536. }
  16537. };
  16538. function hasMultipleChildren(node) {
  16539. const children = node.children = node.children.filter(
  16540. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  16541. );
  16542. const child = children[0];
  16543. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  16544. }
  16545. const ignoreSideEffectTags = (node, context) => {
  16546. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  16547. context.onError(
  16548. createDOMCompilerError(
  16549. 63,
  16550. node.loc
  16551. )
  16552. );
  16553. context.removeNode();
  16554. }
  16555. };
  16556. const DOMNodeTransforms = [
  16557. transformStyle,
  16558. ...[transformTransition]
  16559. ];
  16560. const DOMDirectiveTransforms = {
  16561. cloak: noopDirectiveTransform,
  16562. html: transformVHtml,
  16563. text: transformVText,
  16564. model: transformModel,
  16565. // override compiler-core
  16566. on: transformOn,
  16567. // override compiler-core
  16568. show: transformShow
  16569. };
  16570. function compile(src, options = {}) {
  16571. return baseCompile(
  16572. src,
  16573. extend({}, parserOptions, options, {
  16574. nodeTransforms: [
  16575. // ignore <script> and <tag>
  16576. // this is not put inside DOMNodeTransforms because that list is used
  16577. // by compiler-ssr to generate vnode fallback branches
  16578. ignoreSideEffectTags,
  16579. ...DOMNodeTransforms,
  16580. ...options.nodeTransforms || []
  16581. ],
  16582. directiveTransforms: extend(
  16583. {},
  16584. DOMDirectiveTransforms,
  16585. options.directiveTransforms || {}
  16586. ),
  16587. transformHoist: null
  16588. })
  16589. );
  16590. }
  16591. {
  16592. initDev();
  16593. }
  16594. const compileCache = /* @__PURE__ */ new WeakMap();
  16595. function getCache(options) {
  16596. let c = compileCache.get(options != null ? options : EMPTY_OBJ);
  16597. if (!c) {
  16598. c = /* @__PURE__ */ Object.create(null);
  16599. compileCache.set(options != null ? options : EMPTY_OBJ, c);
  16600. }
  16601. return c;
  16602. }
  16603. function compileToFunction(template, options) {
  16604. if (!isString(template)) {
  16605. if (template.nodeType) {
  16606. template = template.innerHTML;
  16607. } else {
  16608. warn(`invalid template option: `, template);
  16609. return NOOP;
  16610. }
  16611. }
  16612. const key = template;
  16613. const cache = getCache(options);
  16614. const cached = cache[key];
  16615. if (cached) {
  16616. return cached;
  16617. }
  16618. if (template[0] === "#") {
  16619. const el = document.querySelector(template);
  16620. if (!el) {
  16621. warn(`Template element not found or is empty: ${template}`);
  16622. }
  16623. template = el ? el.innerHTML : ``;
  16624. }
  16625. const opts = extend(
  16626. {
  16627. hoistStatic: true,
  16628. onError: onError ,
  16629. onWarn: (e) => onError(e, true)
  16630. },
  16631. options
  16632. );
  16633. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  16634. opts.isCustomElement = (tag) => !!customElements.get(tag);
  16635. }
  16636. const { code } = compile(template, opts);
  16637. function onError(err, asWarning = false) {
  16638. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  16639. const codeFrame = err.loc && generateCodeFrame(
  16640. template,
  16641. err.loc.start.offset,
  16642. err.loc.end.offset
  16643. );
  16644. warn(codeFrame ? `${message}
  16645. ${codeFrame}` : message);
  16646. }
  16647. const render = new Function("Vue", code)(runtimeDom);
  16648. render._rc = true;
  16649. return cache[key] = render;
  16650. }
  16651. registerRuntimeCompiler(compileToFunction);
  16652. export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction as compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };