vue.esm-browser.js 550 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097
  1. /**
  2. * vue v3.5.43
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. // @__NO_SIDE_EFFECTS__
  7. function makeMap(str) {
  8. const map = /* @__PURE__ */ Object.create(null);
  9. for (const key of str.split(",")) map[key] = 1;
  10. return (val) => val in map;
  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(
  64. (str) => {
  65. return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
  66. }
  67. );
  68. const hyphenateRE = /\B([A-Z])/g;
  69. const hyphenate = cacheStringFunction(
  70. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  71. );
  72. const capitalize = cacheStringFunction((str) => {
  73. return str.charAt(0).toUpperCase() + str.slice(1);
  74. });
  75. const toHandlerKey = cacheStringFunction(
  76. (str) => {
  77. const s = str ? `on${capitalize(str)}` : ``;
  78. return s;
  79. }
  80. );
  81. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  82. const invokeArrayFns = (fns, ...arg) => {
  83. for (let i = 0; i < fns.length; i++) {
  84. fns[i](...arg);
  85. }
  86. };
  87. const def = (obj, key, value, writable = false) => {
  88. Object.defineProperty(obj, key, {
  89. configurable: true,
  90. enumerable: false,
  91. writable,
  92. value
  93. });
  94. };
  95. const looseToNumber = (val) => {
  96. const n = parseFloat(val);
  97. return isNaN(n) ? val : n;
  98. };
  99. const toNumber = (val) => {
  100. const n = isString(val) ? Number(val) : NaN;
  101. return isNaN(n) ? val : n;
  102. };
  103. let _globalThis;
  104. const getGlobalThis = () => {
  105. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  106. };
  107. function genCacheKey(source, options) {
  108. return source + JSON.stringify(
  109. options,
  110. (_, val) => typeof val === "function" ? val.toString() : val
  111. );
  112. }
  113. const PatchFlagNames = {
  114. [1]: `TEXT`,
  115. [2]: `CLASS`,
  116. [4]: `STYLE`,
  117. [8]: `PROPS`,
  118. [16]: `FULL_PROPS`,
  119. [32]: `NEED_HYDRATION`,
  120. [64]: `STABLE_FRAGMENT`,
  121. [128]: `KEYED_FRAGMENT`,
  122. [256]: `UNKEYED_FRAGMENT`,
  123. [512]: `NEED_PATCH`,
  124. [1024]: `DYNAMIC_SLOTS`,
  125. [2048]: `DEV_ROOT_FRAGMENT`,
  126. [-1]: `CACHED`,
  127. [-2]: `BAIL`
  128. };
  129. const slotFlagsText = {
  130. [1]: "STABLE",
  131. [2]: "DYNAMIC",
  132. [3]: "FORWARDED"
  133. };
  134. const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
  135. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  136. const range = 2;
  137. function generateCodeFrame(source, start = 0, end = source.length) {
  138. start = Math.max(0, Math.min(start, source.length));
  139. end = Math.max(0, Math.min(end, source.length));
  140. if (start > end) return "";
  141. let lines = source.split(/(\r?\n)/);
  142. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  143. lines = lines.filter((_, idx) => idx % 2 === 0);
  144. let count = 0;
  145. const res = [];
  146. for (let i = 0; i < lines.length; i++) {
  147. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  148. if (count >= start) {
  149. for (let j = i - range; j <= i + range || end > count; j++) {
  150. if (j < 0 || j >= lines.length) continue;
  151. const line = j + 1;
  152. res.push(
  153. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  154. );
  155. const lineLength = lines[j].length;
  156. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  157. if (j === i) {
  158. const pad = start - (count - (lineLength + newLineSeqLength));
  159. const length = Math.max(
  160. 1,
  161. end > count ? lineLength - pad : end - start
  162. );
  163. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  164. } else if (j > i) {
  165. if (end > count) {
  166. const length = Math.max(Math.min(end - count, lineLength), 1);
  167. res.push(` | ` + "^".repeat(length));
  168. }
  169. count += lineLength + newLineSeqLength;
  170. }
  171. }
  172. break;
  173. }
  174. }
  175. return res.join("\n");
  176. }
  177. function normalizeStyle(value) {
  178. if (isArray(value)) {
  179. const res = {};
  180. for (let i = 0; i < value.length; i++) {
  181. const item = value[i];
  182. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  183. if (normalized) {
  184. for (const key in normalized) {
  185. res[key] = normalized[key];
  186. }
  187. }
  188. }
  189. return res;
  190. } else if (isString(value) || isObject(value)) {
  191. return value;
  192. }
  193. }
  194. const listDelimiterRE = /;(?![^(]*\))/g;
  195. const propertyDelimiterRE = /:([^]+)/;
  196. const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
  197. function parseStringStyle(cssText) {
  198. const ret = {};
  199. cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
  200. if (item) {
  201. const tmp = item.split(propertyDelimiterRE);
  202. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  203. }
  204. });
  205. return ret;
  206. }
  207. function stringifyStyle(styles) {
  208. if (!styles) return "";
  209. if (isString(styles)) return styles;
  210. let ret = "";
  211. for (const key in styles) {
  212. const value = styles[key];
  213. if (isString(value) || typeof value === "number") {
  214. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  215. ret += `${normalizedKey}:${value};`;
  216. }
  217. }
  218. return ret;
  219. }
  220. function normalizeClass(value) {
  221. let res = "";
  222. if (isString(value)) {
  223. res = value;
  224. } else if (isArray(value)) {
  225. for (let i = 0; i < value.length; i++) {
  226. const normalized = normalizeClass(value[i]);
  227. if (normalized) {
  228. res += normalized + " ";
  229. }
  230. }
  231. } else if (isObject(value)) {
  232. for (const name in value) {
  233. if (value[name]) {
  234. res += name + " ";
  235. }
  236. }
  237. }
  238. return res.trim();
  239. }
  240. function normalizeProps(props) {
  241. if (!props) return null;
  242. let { class: klass, style } = props;
  243. if (klass && !isString(klass)) {
  244. props.class = normalizeClass(klass);
  245. }
  246. if (style) {
  247. props.style = normalizeStyle(style);
  248. }
  249. return props;
  250. }
  251. 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";
  252. 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";
  253. 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";
  254. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  255. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  256. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  257. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  258. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  259. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  260. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  261. const isBooleanAttr = /* @__PURE__ */ makeMap(
  262. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  263. );
  264. function includeBooleanAttr(value) {
  265. return !!value || value === "";
  266. }
  267. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  268. `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`
  269. );
  270. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  271. `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`
  272. );
  273. function isRenderableAttrValue(value) {
  274. if (value == null) {
  275. return false;
  276. }
  277. const type = typeof value;
  278. return type === "string" || type === "number" || type === "boolean";
  279. }
  280. const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
  281. function getEscapedCssVarName(key, doubleEscape) {
  282. return key.replace(
  283. cssVarNameEscapeSymbolsRE,
  284. (s) => `\\${s}`
  285. );
  286. }
  287. function looseCompareArrays(a, b, seen) {
  288. if (a.length !== b.length) return false;
  289. let equal = true;
  290. for (let i = 0; equal && i < a.length; i++) {
  291. equal = looseEqual(a[i], b[i], seen);
  292. }
  293. return equal;
  294. }
  295. function looseCompareCollections(a, b, seen) {
  296. if (a.size !== b.size) return false;
  297. const candidates = Array.from(b);
  298. const matched = new Uint8Array(candidates.length);
  299. for (const item of a) {
  300. let index = -1;
  301. for (let i = 0; i < candidates.length; i++) {
  302. if (!matched[i] && looseEqual(item, candidates[i], seen)) {
  303. index = i;
  304. break;
  305. }
  306. }
  307. if (index < 0) return false;
  308. matched[index] = 1;
  309. }
  310. return true;
  311. }
  312. function looseCompareObjects(a, b, seen) {
  313. let aValidType = isMap(a);
  314. let bValidType = isMap(b);
  315. if (aValidType || bValidType) {
  316. return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
  317. }
  318. aValidType = isSet(a);
  319. bValidType = isSet(b);
  320. if (aValidType || bValidType) {
  321. return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
  322. }
  323. const aKeysCount = Object.keys(a).length;
  324. const bKeysCount = Object.keys(b).length;
  325. if (aKeysCount !== bKeysCount) {
  326. return false;
  327. }
  328. for (const key in a) {
  329. const aHasKey = a.hasOwnProperty(key);
  330. const bHasKey = b.hasOwnProperty(key);
  331. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
  332. return false;
  333. }
  334. }
  335. return String(a) === String(b);
  336. }
  337. function looseCompareNested(a, b, seen, compare) {
  338. if (!seen) {
  339. seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
  340. }
  341. const [seenA, seenB] = seen;
  342. if (seenA.has(a) || seenB.has(b)) {
  343. return seenA.get(a) === b && seenB.get(b) === a;
  344. }
  345. seenA.set(a, b);
  346. seenB.set(b, a);
  347. const equal = compare(a, b, seen);
  348. seenA.delete(a);
  349. seenB.delete(b);
  350. return equal;
  351. }
  352. function looseEqual(a, b, seen) {
  353. if (a === b) return true;
  354. let aValidType = isDate(a);
  355. let bValidType = isDate(b);
  356. if (aValidType || bValidType) {
  357. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  358. }
  359. aValidType = isSymbol(a);
  360. bValidType = isSymbol(b);
  361. if (aValidType || bValidType) {
  362. return a === b;
  363. }
  364. aValidType = isArray(a);
  365. bValidType = isArray(b);
  366. if (aValidType || bValidType) {
  367. return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
  368. }
  369. aValidType = isObject(a);
  370. bValidType = isObject(b);
  371. if (aValidType || bValidType) {
  372. if (!aValidType || !bValidType) {
  373. return false;
  374. }
  375. return looseCompareNested(a, b, seen, looseCompareObjects);
  376. }
  377. return String(a) === String(b);
  378. }
  379. function looseIndexOf(arr, val) {
  380. return arr.findIndex((item) => looseEqual(item, val));
  381. }
  382. const isRef$1 = (val) => {
  383. return !!(val && val["__v_isRef"] === true);
  384. };
  385. const toDisplayString = (val) => {
  386. 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);
  387. };
  388. const replacer = (_key, val) => {
  389. if (isRef$1(val)) {
  390. return replacer(_key, val.value);
  391. } else if (isMap(val)) {
  392. return {
  393. [`Map(${val.size})`]: [...val.entries()].reduce(
  394. (entries, [key, val2], i) => {
  395. entries[stringifySymbol(key, i) + " =>"] = val2;
  396. return entries;
  397. },
  398. {}
  399. )
  400. };
  401. } else if (isSet(val)) {
  402. return {
  403. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  404. };
  405. } else if (isSymbol(val)) {
  406. return stringifySymbol(val);
  407. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  408. return String(val);
  409. }
  410. return val;
  411. };
  412. const stringifySymbol = (v, i = "") => {
  413. var _a;
  414. return (
  415. // Symbol.description in es2019+ so we need to cast here to pass
  416. // the lib: es2016 check
  417. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  418. );
  419. };
  420. function normalizeCssVarValue(value) {
  421. if (value == null) {
  422. return "initial";
  423. }
  424. if (typeof value === "string") {
  425. return value === "" ? " " : value;
  426. }
  427. if (typeof value !== "number" || !Number.isFinite(value)) {
  428. {
  429. console.warn(
  430. "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
  431. value
  432. );
  433. }
  434. }
  435. return String(value);
  436. }
  437. function warn$2(msg, ...args) {
  438. console.warn(`[Vue warn] ${msg}`, ...args);
  439. }
  440. let activeEffectScope;
  441. class EffectScope {
  442. // TODO isolatedDeclarations "__v_skip"
  443. constructor(detached = false) {
  444. this.detached = detached;
  445. /**
  446. * @internal
  447. */
  448. this._active = true;
  449. /**
  450. * @internal track `on` calls, allow `on` call multiple times
  451. */
  452. this._on = 0;
  453. /**
  454. * @internal
  455. */
  456. this.effects = [];
  457. /**
  458. * @internal
  459. */
  460. this.cleanups = [];
  461. this._isPaused = false;
  462. this._warnOnRun = true;
  463. this.__v_skip = true;
  464. if (!detached && activeEffectScope) {
  465. if (activeEffectScope.active) {
  466. this.parent = activeEffectScope;
  467. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  468. this
  469. ) - 1;
  470. } else {
  471. this._active = false;
  472. this._warnOnRun = false;
  473. }
  474. }
  475. }
  476. get active() {
  477. return this._active;
  478. }
  479. pause() {
  480. if (this._active) {
  481. this._isPaused = true;
  482. let i, l;
  483. if (this.scopes) {
  484. const scopes = this.scopes.slice();
  485. for (i = 0, l = scopes.length; i < l; i++) {
  486. scopes[i].pause();
  487. }
  488. }
  489. for (i = 0, l = this.effects.length; i < l; i++) {
  490. this.effects[i].pause();
  491. }
  492. }
  493. }
  494. /**
  495. * Resumes the effect scope, including all child scopes and effects.
  496. */
  497. resume() {
  498. if (this._active) {
  499. if (this._isPaused) {
  500. this._isPaused = false;
  501. let i, l;
  502. if (this.scopes) {
  503. const scopes = this.scopes.slice();
  504. for (i = 0, l = scopes.length; i < l; i++) {
  505. scopes[i].resume();
  506. }
  507. }
  508. const effects = this.effects.slice();
  509. for (i = 0, l = effects.length; i < l; i++) {
  510. effects[i].resume();
  511. }
  512. }
  513. }
  514. }
  515. run(fn) {
  516. if (this._active) {
  517. const currentEffectScope = activeEffectScope;
  518. try {
  519. activeEffectScope = this;
  520. return fn();
  521. } finally {
  522. activeEffectScope = currentEffectScope;
  523. }
  524. } else if (this._warnOnRun) {
  525. warn$2(`cannot run an inactive effect scope.`);
  526. }
  527. }
  528. /**
  529. * This should only be called on non-detached scopes
  530. * @internal
  531. */
  532. on() {
  533. if (++this._on === 1) {
  534. this.prevScope = activeEffectScope;
  535. activeEffectScope = this;
  536. }
  537. }
  538. /**
  539. * This should only be called on non-detached scopes
  540. * @internal
  541. */
  542. off() {
  543. if (this._on > 0 && --this._on === 0) {
  544. if (activeEffectScope === this) {
  545. activeEffectScope = this.prevScope;
  546. } else {
  547. let current = activeEffectScope;
  548. while (current) {
  549. if (current.prevScope === this) {
  550. current.prevScope = this.prevScope;
  551. break;
  552. }
  553. current = current.prevScope;
  554. }
  555. }
  556. this.prevScope = void 0;
  557. }
  558. }
  559. stop(fromParent) {
  560. if (this._active) {
  561. this._active = false;
  562. let i, l;
  563. for (i = 0, l = this.effects.length; i < l; i++) {
  564. this.effects[i].stop();
  565. }
  566. this.effects.length = 0;
  567. for (i = 0, l = this.cleanups.length; i < l; i++) {
  568. this.cleanups[i]();
  569. }
  570. this.cleanups.length = 0;
  571. if (this.scopes) {
  572. const scopes = this.scopes.slice();
  573. for (i = 0, l = scopes.length; i < l; i++) {
  574. scopes[i].stop(true);
  575. }
  576. this.scopes.length = 0;
  577. }
  578. if (!this.detached && this.parent && !fromParent) {
  579. const last = this.parent.scopes.pop();
  580. if (last && last !== this) {
  581. this.parent.scopes[this.index] = last;
  582. last.index = this.index;
  583. }
  584. }
  585. this.parent = void 0;
  586. }
  587. }
  588. }
  589. function effectScope(detached) {
  590. return new EffectScope(detached);
  591. }
  592. function getCurrentScope() {
  593. return activeEffectScope;
  594. }
  595. function onScopeDispose(fn, failSilently = false) {
  596. if (activeEffectScope) {
  597. activeEffectScope.cleanups.push(fn);
  598. } else if (!failSilently) {
  599. warn$2(
  600. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  601. );
  602. }
  603. }
  604. let activeSub;
  605. const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
  606. class ReactiveEffect {
  607. constructor(fn) {
  608. this.fn = fn;
  609. /**
  610. * @internal
  611. */
  612. this.deps = void 0;
  613. /**
  614. * @internal
  615. */
  616. this.depsTail = void 0;
  617. /**
  618. * @internal
  619. */
  620. this.flags = 1 | 4;
  621. /**
  622. * @internal
  623. */
  624. this.next = void 0;
  625. /**
  626. * @internal
  627. */
  628. this.cleanup = void 0;
  629. this.scheduler = void 0;
  630. if (activeEffectScope) {
  631. if (activeEffectScope.active) {
  632. activeEffectScope.effects.push(this);
  633. } else {
  634. this.flags &= -2;
  635. }
  636. }
  637. }
  638. pause() {
  639. this.flags |= 64;
  640. }
  641. resume() {
  642. if (this.flags & 64) {
  643. this.flags &= -65;
  644. if (pausedQueueEffects.has(this)) {
  645. pausedQueueEffects.delete(this);
  646. this.trigger();
  647. }
  648. }
  649. }
  650. /**
  651. * @internal
  652. */
  653. notify() {
  654. if (this.flags & 2 && !(this.flags & 32)) {
  655. return;
  656. }
  657. if (!(this.flags & 8)) {
  658. batch(this);
  659. }
  660. }
  661. run() {
  662. if (!(this.flags & 1)) {
  663. return this.fn();
  664. }
  665. this.flags |= 2;
  666. cleanupEffect(this);
  667. prepareDeps(this);
  668. const prevEffect = activeSub;
  669. const prevShouldTrack = shouldTrack;
  670. activeSub = this;
  671. shouldTrack = true;
  672. try {
  673. return this.fn();
  674. } finally {
  675. if (activeSub !== this) {
  676. warn$2(
  677. "Active effect was not restored correctly - this is likely a Vue internal bug."
  678. );
  679. }
  680. cleanupDeps(this);
  681. activeSub = prevEffect;
  682. shouldTrack = prevShouldTrack;
  683. this.flags &= -3;
  684. }
  685. }
  686. stop() {
  687. if (this.flags & 1) {
  688. for (let link = this.deps; link; link = link.nextDep) {
  689. removeSub(link);
  690. }
  691. this.deps = this.depsTail = void 0;
  692. cleanupEffect(this);
  693. this.onStop && this.onStop();
  694. this.flags &= -2;
  695. }
  696. }
  697. trigger() {
  698. if (this.flags & 64) {
  699. pausedQueueEffects.add(this);
  700. } else if (this.scheduler) {
  701. this.scheduler();
  702. } else {
  703. this.runIfDirty();
  704. }
  705. }
  706. /**
  707. * @internal
  708. */
  709. runIfDirty() {
  710. if (isDirty(this)) {
  711. this.run();
  712. }
  713. }
  714. get dirty() {
  715. return isDirty(this);
  716. }
  717. }
  718. let batchDepth = 0;
  719. let batchedSub;
  720. let batchedComputed;
  721. function batch(sub, isComputed = false) {
  722. sub.flags |= 8;
  723. if (isComputed) {
  724. sub.next = batchedComputed;
  725. batchedComputed = sub;
  726. return;
  727. }
  728. sub.next = batchedSub;
  729. batchedSub = sub;
  730. }
  731. function startBatch() {
  732. batchDepth++;
  733. }
  734. function endBatch() {
  735. if (--batchDepth > 0) {
  736. return;
  737. }
  738. if (batchedComputed) {
  739. let e = batchedComputed;
  740. batchedComputed = void 0;
  741. while (e) {
  742. const next = e.next;
  743. e.next = void 0;
  744. e.flags &= -9;
  745. e = next;
  746. }
  747. }
  748. let error;
  749. while (batchedSub) {
  750. let e = batchedSub;
  751. batchedSub = void 0;
  752. while (e) {
  753. const next = e.next;
  754. e.next = void 0;
  755. e.flags &= -9;
  756. if (e.flags & 1) {
  757. try {
  758. ;
  759. e.trigger();
  760. } catch (err) {
  761. if (!error) error = err;
  762. }
  763. }
  764. e = next;
  765. }
  766. }
  767. if (error) throw error;
  768. }
  769. function prepareDeps(sub) {
  770. for (let link = sub.deps; link; link = link.nextDep) {
  771. link.version = -1;
  772. link.prevActiveLink = link.dep.activeLink;
  773. link.dep.activeLink = link;
  774. }
  775. }
  776. function cleanupDeps(sub) {
  777. let head;
  778. let tail = sub.depsTail;
  779. let link = tail;
  780. while (link) {
  781. const prev = link.prevDep;
  782. if (link.version === -1) {
  783. if (link === tail) tail = prev;
  784. removeSub(link);
  785. removeDep(link);
  786. } else {
  787. head = link;
  788. }
  789. link.dep.activeLink = link.prevActiveLink;
  790. link.prevActiveLink = void 0;
  791. link = prev;
  792. }
  793. sub.deps = head;
  794. sub.depsTail = tail;
  795. }
  796. function isDirty(sub) {
  797. for (let link = sub.deps; link; link = link.nextDep) {
  798. if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
  799. return true;
  800. }
  801. }
  802. if (sub._dirty) {
  803. return true;
  804. }
  805. return false;
  806. }
  807. function refreshComputed(computed) {
  808. if (computed.flags & 4 && !(computed.flags & 16)) {
  809. return;
  810. }
  811. computed.flags &= -17;
  812. if (computed.globalVersion === globalVersion) {
  813. return;
  814. }
  815. computed.globalVersion = globalVersion;
  816. if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
  817. return;
  818. }
  819. computed.flags |= 2;
  820. const dep = computed.dep;
  821. const prevSub = activeSub;
  822. const prevShouldTrack = shouldTrack;
  823. activeSub = computed;
  824. shouldTrack = true;
  825. try {
  826. prepareDeps(computed);
  827. const value = computed.fn(computed._value);
  828. if (dep.version === 0 || hasChanged(value, computed._value)) {
  829. computed.flags |= 128;
  830. computed._value = value;
  831. dep.version++;
  832. }
  833. } catch (err) {
  834. dep.version++;
  835. throw err;
  836. } finally {
  837. activeSub = prevSub;
  838. shouldTrack = prevShouldTrack;
  839. cleanupDeps(computed);
  840. computed.flags &= -3;
  841. }
  842. }
  843. function removeSub(link, soft = false) {
  844. const { dep, prevSub, nextSub } = link;
  845. if (prevSub) {
  846. prevSub.nextSub = nextSub;
  847. link.prevSub = void 0;
  848. }
  849. if (nextSub) {
  850. nextSub.prevSub = prevSub;
  851. link.nextSub = void 0;
  852. }
  853. if (dep.subsHead === link) {
  854. dep.subsHead = nextSub;
  855. }
  856. if (dep.subs === link) {
  857. dep.subs = prevSub;
  858. if (!prevSub && dep.computed) {
  859. dep.computed.flags &= -5;
  860. for (let l = dep.computed.deps; l; l = l.nextDep) {
  861. removeSub(l, true);
  862. }
  863. }
  864. }
  865. if (!soft && !--dep.sc && dep.map) {
  866. dep.map.delete(dep.key);
  867. }
  868. }
  869. function removeDep(link) {
  870. const { prevDep, nextDep } = link;
  871. if (prevDep) {
  872. prevDep.nextDep = nextDep;
  873. link.prevDep = void 0;
  874. }
  875. if (nextDep) {
  876. nextDep.prevDep = prevDep;
  877. link.nextDep = void 0;
  878. }
  879. }
  880. function effect(fn, options) {
  881. if (fn.effect instanceof ReactiveEffect) {
  882. fn = fn.effect.fn;
  883. }
  884. const e = new ReactiveEffect(fn);
  885. if (options) {
  886. extend(e, options);
  887. }
  888. try {
  889. e.run();
  890. } catch (err) {
  891. e.stop();
  892. throw err;
  893. }
  894. const runner = e.run.bind(e);
  895. runner.effect = e;
  896. return runner;
  897. }
  898. function stop(runner) {
  899. runner.effect.stop();
  900. }
  901. let shouldTrack = true;
  902. const trackStack = [];
  903. function pauseTracking() {
  904. trackStack.push(shouldTrack);
  905. shouldTrack = false;
  906. }
  907. function resetTracking() {
  908. const last = trackStack.pop();
  909. shouldTrack = last === void 0 ? true : last;
  910. }
  911. function cleanupEffect(e) {
  912. const { cleanup } = e;
  913. e.cleanup = void 0;
  914. if (cleanup) {
  915. const prevSub = activeSub;
  916. activeSub = void 0;
  917. try {
  918. cleanup();
  919. } finally {
  920. activeSub = prevSub;
  921. }
  922. }
  923. }
  924. let globalVersion = 0;
  925. class Link {
  926. constructor(sub, dep) {
  927. this.sub = sub;
  928. this.dep = dep;
  929. this.version = dep.version;
  930. this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
  931. }
  932. }
  933. class Dep {
  934. // TODO isolatedDeclarations "__v_skip"
  935. constructor(computed) {
  936. this.computed = computed;
  937. this.version = 0;
  938. /**
  939. * Link between this dep and the current active effect
  940. */
  941. this.activeLink = void 0;
  942. /**
  943. * Doubly linked list representing the subscribing effects (tail)
  944. */
  945. this.subs = void 0;
  946. /**
  947. * For object property deps cleanup
  948. */
  949. this.map = void 0;
  950. this.key = void 0;
  951. /**
  952. * Subscriber counter
  953. */
  954. this.sc = 0;
  955. /**
  956. * @internal
  957. */
  958. this.__v_skip = true;
  959. {
  960. this.subsHead = void 0;
  961. }
  962. }
  963. track(debugInfo) {
  964. if (!activeSub || !shouldTrack || activeSub === this.computed) {
  965. return;
  966. }
  967. let link = this.activeLink;
  968. if (link === void 0 || link.sub !== activeSub) {
  969. link = this.activeLink = new Link(activeSub, this);
  970. if (!activeSub.deps) {
  971. activeSub.deps = activeSub.depsTail = link;
  972. } else {
  973. link.prevDep = activeSub.depsTail;
  974. activeSub.depsTail.nextDep = link;
  975. activeSub.depsTail = link;
  976. }
  977. addSub(link);
  978. } else if (link.version === -1) {
  979. link.version = this.version;
  980. if (link.nextDep) {
  981. const next = link.nextDep;
  982. next.prevDep = link.prevDep;
  983. if (link.prevDep) {
  984. link.prevDep.nextDep = next;
  985. }
  986. link.prevDep = activeSub.depsTail;
  987. link.nextDep = void 0;
  988. activeSub.depsTail.nextDep = link;
  989. activeSub.depsTail = link;
  990. if (activeSub.deps === link) {
  991. activeSub.deps = next;
  992. }
  993. }
  994. }
  995. if (activeSub.onTrack) {
  996. activeSub.onTrack(
  997. extend(
  998. {
  999. effect: activeSub
  1000. },
  1001. debugInfo
  1002. )
  1003. );
  1004. }
  1005. return link;
  1006. }
  1007. trigger(debugInfo) {
  1008. this.version++;
  1009. globalVersion++;
  1010. this.notify(debugInfo);
  1011. }
  1012. notify(debugInfo) {
  1013. startBatch();
  1014. try {
  1015. if (true) {
  1016. for (let head = this.subsHead; head; head = head.nextSub) {
  1017. if (head.sub.onTrigger && !(head.sub.flags & 8)) {
  1018. head.sub.onTrigger(
  1019. extend(
  1020. {
  1021. effect: head.sub
  1022. },
  1023. debugInfo
  1024. )
  1025. );
  1026. }
  1027. }
  1028. }
  1029. for (let link = this.subs; link; link = link.prevSub) {
  1030. if (link.sub.notify()) {
  1031. ;
  1032. link.sub.dep.notify();
  1033. }
  1034. }
  1035. } finally {
  1036. endBatch();
  1037. }
  1038. }
  1039. }
  1040. function addSub(link) {
  1041. link.dep.sc++;
  1042. if (link.sub.flags & 4) {
  1043. const computed = link.dep.computed;
  1044. if (computed && !link.dep.subs) {
  1045. computed.flags |= 4 | 16;
  1046. for (let l = computed.deps; l; l = l.nextDep) {
  1047. addSub(l);
  1048. }
  1049. }
  1050. const currentTail = link.dep.subs;
  1051. if (currentTail !== link) {
  1052. link.prevSub = currentTail;
  1053. if (currentTail) currentTail.nextSub = link;
  1054. }
  1055. if (link.dep.subsHead === void 0) {
  1056. link.dep.subsHead = link;
  1057. }
  1058. link.dep.subs = link;
  1059. }
  1060. }
  1061. const targetMap = /* @__PURE__ */ new WeakMap();
  1062. const ITERATE_KEY = /* @__PURE__ */ Symbol(
  1063. "Object iterate"
  1064. );
  1065. const MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(
  1066. "Map keys iterate"
  1067. );
  1068. const ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(
  1069. "Array iterate"
  1070. );
  1071. function track(target, type, key) {
  1072. if (shouldTrack && activeSub) {
  1073. let depsMap = targetMap.get(target);
  1074. if (!depsMap) {
  1075. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  1076. }
  1077. let dep = depsMap.get(key);
  1078. if (!dep) {
  1079. depsMap.set(key, dep = new Dep());
  1080. dep.map = depsMap;
  1081. dep.key = key;
  1082. }
  1083. {
  1084. dep.track({
  1085. target,
  1086. type,
  1087. key
  1088. });
  1089. }
  1090. }
  1091. }
  1092. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  1093. const depsMap = targetMap.get(target);
  1094. if (!depsMap) {
  1095. globalVersion++;
  1096. return;
  1097. }
  1098. const run = (dep) => {
  1099. if (dep) {
  1100. {
  1101. dep.trigger({
  1102. target,
  1103. type,
  1104. key,
  1105. newValue,
  1106. oldValue,
  1107. oldTarget
  1108. });
  1109. }
  1110. }
  1111. };
  1112. startBatch();
  1113. if (type === "clear") {
  1114. depsMap.forEach(run);
  1115. } else {
  1116. const targetIsArray = isArray(target);
  1117. const isArrayIndex = targetIsArray && isIntegerKey(key);
  1118. if (targetIsArray && key === "length") {
  1119. const newLength = Number(newValue);
  1120. depsMap.forEach((dep, key2) => {
  1121. if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
  1122. run(dep);
  1123. }
  1124. });
  1125. } else {
  1126. if (key !== void 0 || depsMap.has(void 0)) {
  1127. run(depsMap.get(key));
  1128. }
  1129. if (isArrayIndex) {
  1130. run(depsMap.get(ARRAY_ITERATE_KEY));
  1131. }
  1132. switch (type) {
  1133. case "add":
  1134. if (!targetIsArray) {
  1135. run(depsMap.get(ITERATE_KEY));
  1136. if (isMap(target)) {
  1137. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1138. }
  1139. } else if (isArrayIndex) {
  1140. run(depsMap.get("length"));
  1141. }
  1142. break;
  1143. case "delete":
  1144. if (!targetIsArray) {
  1145. run(depsMap.get(ITERATE_KEY));
  1146. if (isMap(target)) {
  1147. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1148. }
  1149. }
  1150. break;
  1151. case "set":
  1152. if (isMap(target)) {
  1153. run(depsMap.get(ITERATE_KEY));
  1154. }
  1155. break;
  1156. }
  1157. }
  1158. }
  1159. endBatch();
  1160. }
  1161. function getDepFromReactive(object, key) {
  1162. const depMap = targetMap.get(object);
  1163. return depMap && depMap.get(key);
  1164. }
  1165. function reactiveReadArray(array) {
  1166. const raw = toRaw(array);
  1167. if (raw === array) return raw;
  1168. track(raw, "iterate", ARRAY_ITERATE_KEY);
  1169. if (isShallow(array)) return raw;
  1170. if (!isReadonly(array)) return raw.map(toReactive);
  1171. return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
  1172. }
  1173. function shallowReadArray(arr) {
  1174. track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
  1175. return arr;
  1176. }
  1177. function toWrapped(target, item) {
  1178. if (isReadonly(target)) {
  1179. return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
  1180. }
  1181. return toReactive(item);
  1182. }
  1183. const arrayInstrumentations = {
  1184. __proto__: null,
  1185. [Symbol.iterator]() {
  1186. return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
  1187. },
  1188. concat(...args) {
  1189. return reactiveReadArray(this).concat(
  1190. ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
  1191. );
  1192. },
  1193. entries() {
  1194. return iterator(this, "entries", (value) => {
  1195. value[1] = toWrapped(this, value[1]);
  1196. return value;
  1197. });
  1198. },
  1199. every(fn, thisArg) {
  1200. return apply(this, "every", fn, thisArg, void 0, arguments);
  1201. },
  1202. filter(fn, thisArg) {
  1203. return apply(
  1204. this,
  1205. "filter",
  1206. fn,
  1207. thisArg,
  1208. (v) => v.map((item) => toWrapped(this, item)),
  1209. arguments
  1210. );
  1211. },
  1212. find(fn, thisArg) {
  1213. return apply(
  1214. this,
  1215. "find",
  1216. fn,
  1217. thisArg,
  1218. (item) => toWrapped(this, item),
  1219. arguments
  1220. );
  1221. },
  1222. findIndex(fn, thisArg) {
  1223. return apply(this, "findIndex", fn, thisArg, void 0, arguments);
  1224. },
  1225. findLast(fn, thisArg) {
  1226. return apply(
  1227. this,
  1228. "findLast",
  1229. fn,
  1230. thisArg,
  1231. (item) => toWrapped(this, item),
  1232. arguments
  1233. );
  1234. },
  1235. findLastIndex(fn, thisArg) {
  1236. return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
  1237. },
  1238. // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
  1239. forEach(fn, thisArg) {
  1240. return apply(this, "forEach", fn, thisArg, void 0, arguments);
  1241. },
  1242. includes(...args) {
  1243. return searchProxy(this, "includes", args);
  1244. },
  1245. indexOf(...args) {
  1246. return searchProxy(this, "indexOf", args);
  1247. },
  1248. join(separator) {
  1249. return reactiveReadArray(this).join(separator);
  1250. },
  1251. // keys() iterator only reads `length`, no optimization required
  1252. lastIndexOf(...args) {
  1253. return searchProxy(this, "lastIndexOf", args);
  1254. },
  1255. map(fn, thisArg) {
  1256. return apply(this, "map", fn, thisArg, void 0, arguments);
  1257. },
  1258. pop() {
  1259. return noTracking(this, "pop");
  1260. },
  1261. push(...args) {
  1262. return noTracking(this, "push", args);
  1263. },
  1264. reduce(fn, ...args) {
  1265. return reduce(this, "reduce", fn, args);
  1266. },
  1267. reduceRight(fn, ...args) {
  1268. return reduce(this, "reduceRight", fn, args);
  1269. },
  1270. shift() {
  1271. return noTracking(this, "shift");
  1272. },
  1273. // slice could use ARRAY_ITERATE but also seems to beg for range tracking
  1274. some(fn, thisArg) {
  1275. return apply(this, "some", fn, thisArg, void 0, arguments);
  1276. },
  1277. splice(...args) {
  1278. return noTracking(this, "splice", args);
  1279. },
  1280. toReversed() {
  1281. return reactiveReadArray(this).toReversed();
  1282. },
  1283. toSorted(comparer) {
  1284. return reactiveReadArray(this).toSorted(comparer);
  1285. },
  1286. toSpliced(...args) {
  1287. return reactiveReadArray(this).toSpliced(...args);
  1288. },
  1289. unshift(...args) {
  1290. return noTracking(this, "unshift", args);
  1291. },
  1292. values() {
  1293. return iterator(this, "values", (item) => toWrapped(this, item));
  1294. }
  1295. };
  1296. function iterator(self, method, wrapValue) {
  1297. const arr = shallowReadArray(self);
  1298. const iter = arr[method]();
  1299. if (arr !== self && !isShallow(self)) {
  1300. iter._next = iter.next;
  1301. iter.next = () => {
  1302. const result = iter._next();
  1303. if (!result.done) {
  1304. result.value = wrapValue(result.value);
  1305. }
  1306. return result;
  1307. };
  1308. }
  1309. return iter;
  1310. }
  1311. const arrayProto = Array.prototype;
  1312. function apply(self, method, fn, thisArg, wrappedRetFn, args) {
  1313. const arr = shallowReadArray(self);
  1314. const needsWrap = arr !== self && !isShallow(self);
  1315. const methodFn = arr[method];
  1316. if (methodFn !== arrayProto[method]) {
  1317. const result2 = methodFn.apply(self, args);
  1318. return needsWrap ? toReactive(result2) : result2;
  1319. }
  1320. let wrappedFn = fn;
  1321. if (arr !== self) {
  1322. if (needsWrap) {
  1323. wrappedFn = function(item, index) {
  1324. return fn.call(this, toWrapped(self, item), index, self);
  1325. };
  1326. } else if (fn.length > 2) {
  1327. wrappedFn = function(item, index) {
  1328. return fn.call(this, item, index, self);
  1329. };
  1330. }
  1331. }
  1332. const result = methodFn.call(arr, wrappedFn, thisArg);
  1333. return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
  1334. }
  1335. function reduce(self, method, fn, args) {
  1336. const arr = shallowReadArray(self);
  1337. const needsWrap = arr !== self && !isShallow(self);
  1338. let wrappedFn = fn;
  1339. let wrapInitialAccumulator = false;
  1340. if (arr !== self) {
  1341. if (needsWrap) {
  1342. wrapInitialAccumulator = args.length === 0;
  1343. wrappedFn = function(acc, item, index) {
  1344. if (wrapInitialAccumulator) {
  1345. wrapInitialAccumulator = false;
  1346. acc = toWrapped(self, acc);
  1347. }
  1348. return fn.call(this, acc, toWrapped(self, item), index, self);
  1349. };
  1350. } else if (fn.length > 3) {
  1351. wrappedFn = function(acc, item, index) {
  1352. return fn.call(this, acc, item, index, self);
  1353. };
  1354. }
  1355. }
  1356. const result = arr[method](wrappedFn, ...args);
  1357. return wrapInitialAccumulator ? toWrapped(self, result) : result;
  1358. }
  1359. function searchProxy(self, method, args) {
  1360. const arr = toRaw(self);
  1361. track(arr, "iterate", ARRAY_ITERATE_KEY);
  1362. const res = arr[method](...args);
  1363. if ((res === -1 || res === false) && isProxy(args[0])) {
  1364. args[0] = toRaw(args[0]);
  1365. return arr[method](...args);
  1366. }
  1367. return res;
  1368. }
  1369. function noTracking(self, method, args = []) {
  1370. pauseTracking();
  1371. startBatch();
  1372. const res = toRaw(self)[method].apply(self, args);
  1373. endBatch();
  1374. resetTracking();
  1375. return res;
  1376. }
  1377. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  1378. const builtInSymbols = new Set(
  1379. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1380. );
  1381. function hasOwnProperty(key) {
  1382. if (!isSymbol(key)) key = String(key);
  1383. const obj = toRaw(this);
  1384. track(obj, "has", key);
  1385. return obj.hasOwnProperty(key);
  1386. }
  1387. class BaseReactiveHandler {
  1388. constructor(_isReadonly = false, _isShallow = false) {
  1389. this._isReadonly = _isReadonly;
  1390. this._isShallow = _isShallow;
  1391. }
  1392. get(target, key, receiver) {
  1393. if (key === "__v_skip") return target["__v_skip"];
  1394. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  1395. if (key === "__v_isReactive") {
  1396. return !isReadonly2;
  1397. } else if (key === "__v_isReadonly") {
  1398. return isReadonly2;
  1399. } else if (key === "__v_isShallow") {
  1400. return isShallow2;
  1401. } else if (key === "__v_raw") {
  1402. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  1403. // this means the receiver is a user proxy of the reactive proxy
  1404. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  1405. return target;
  1406. }
  1407. return;
  1408. }
  1409. const targetIsArray = isArray(target);
  1410. if (!isReadonly2) {
  1411. let fn;
  1412. if (targetIsArray && (fn = arrayInstrumentations[key])) {
  1413. return fn;
  1414. }
  1415. if (key === "hasOwnProperty") {
  1416. return hasOwnProperty;
  1417. }
  1418. }
  1419. const res = Reflect.get(
  1420. target,
  1421. key,
  1422. // if this is a proxy wrapping a ref, return methods using the raw ref
  1423. // as receiver so that we don't have to call `toRaw` on the ref in all
  1424. // its class methods
  1425. isRef(target) ? target : receiver
  1426. );
  1427. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1428. return res;
  1429. }
  1430. if (!isReadonly2) {
  1431. track(target, "get", key);
  1432. }
  1433. if (isShallow2) {
  1434. return res;
  1435. }
  1436. if (isRef(res)) {
  1437. const value = targetIsArray && isIntegerKey(key) ? res : res.value;
  1438. return isReadonly2 && isObject(value) ? readonly(value) : value;
  1439. }
  1440. if (isObject(res)) {
  1441. return isReadonly2 ? readonly(res) : reactive(res);
  1442. }
  1443. return res;
  1444. }
  1445. }
  1446. class MutableReactiveHandler extends BaseReactiveHandler {
  1447. constructor(isShallow2 = false) {
  1448. super(false, isShallow2);
  1449. }
  1450. set(target, key, value, receiver) {
  1451. let oldValue = target[key];
  1452. const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
  1453. if (!this._isShallow) {
  1454. const isOldValueReadonly = isReadonly(oldValue);
  1455. if (!isShallow(value) && !isReadonly(value)) {
  1456. oldValue = toRaw(oldValue);
  1457. value = toRaw(value);
  1458. }
  1459. if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
  1460. if (isOldValueReadonly) {
  1461. {
  1462. warn$2(
  1463. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1464. target[key]
  1465. );
  1466. }
  1467. return true;
  1468. } else {
  1469. oldValue.value = value;
  1470. return true;
  1471. }
  1472. }
  1473. }
  1474. const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
  1475. const result = Reflect.set(
  1476. target,
  1477. key,
  1478. value,
  1479. isRef(target) ? target : receiver
  1480. );
  1481. if (target === toRaw(receiver) && result) {
  1482. if (!hadKey) {
  1483. trigger(target, "add", key, value);
  1484. } else if (hasChanged(value, oldValue)) {
  1485. trigger(target, "set", key, value, oldValue);
  1486. }
  1487. }
  1488. return result;
  1489. }
  1490. deleteProperty(target, key) {
  1491. const hadKey = hasOwn(target, key);
  1492. const oldValue = target[key];
  1493. const result = Reflect.deleteProperty(target, key);
  1494. if (result && hadKey) {
  1495. trigger(target, "delete", key, void 0, oldValue);
  1496. }
  1497. return result;
  1498. }
  1499. has(target, key) {
  1500. const result = Reflect.has(target, key);
  1501. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  1502. track(target, "has", key);
  1503. }
  1504. return result;
  1505. }
  1506. ownKeys(target) {
  1507. track(
  1508. target,
  1509. "iterate",
  1510. isArray(target) ? "length" : ITERATE_KEY
  1511. );
  1512. return Reflect.ownKeys(target);
  1513. }
  1514. }
  1515. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  1516. constructor(isShallow2 = false) {
  1517. super(true, isShallow2);
  1518. }
  1519. set(target, key) {
  1520. {
  1521. warn$2(
  1522. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1523. target
  1524. );
  1525. }
  1526. return true;
  1527. }
  1528. deleteProperty(target, key) {
  1529. {
  1530. warn$2(
  1531. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  1532. target
  1533. );
  1534. }
  1535. return true;
  1536. }
  1537. }
  1538. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  1539. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  1540. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
  1541. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  1542. const toShallow = (value) => value;
  1543. const getProto = (v) => Reflect.getPrototypeOf(v);
  1544. function createIterableMethod(method, isReadonly2, isShallow2) {
  1545. return function(...args) {
  1546. const target = this["__v_raw"];
  1547. const rawTarget = toRaw(target);
  1548. const targetIsMap = isMap(rawTarget);
  1549. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1550. const isKeyOnly = method === "keys" && targetIsMap;
  1551. const innerIterator = target[method](...args);
  1552. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1553. !isReadonly2 && track(
  1554. rawTarget,
  1555. "iterate",
  1556. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1557. );
  1558. return extend(
  1559. // inheriting all iterator properties
  1560. Object.create(innerIterator),
  1561. {
  1562. // iterator protocol
  1563. next() {
  1564. const { value, done } = innerIterator.next();
  1565. return done ? { value, done } : {
  1566. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1567. done
  1568. };
  1569. }
  1570. }
  1571. );
  1572. };
  1573. }
  1574. function createReadonlyMethod(type) {
  1575. return function(...args) {
  1576. {
  1577. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1578. warn$2(
  1579. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1580. toRaw(this)
  1581. );
  1582. }
  1583. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1584. };
  1585. }
  1586. function createInstrumentations(readonly, shallow) {
  1587. const instrumentations = {
  1588. get(key) {
  1589. const target = this["__v_raw"];
  1590. const rawTarget = toRaw(target);
  1591. const rawKey = toRaw(key);
  1592. if (!readonly) {
  1593. if (hasChanged(key, rawKey)) {
  1594. track(rawTarget, "get", key);
  1595. }
  1596. track(rawTarget, "get", rawKey);
  1597. }
  1598. const { has } = getProto(rawTarget);
  1599. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1600. if (has.call(rawTarget, key)) {
  1601. return wrap(target.get(key));
  1602. } else if (has.call(rawTarget, rawKey)) {
  1603. return wrap(target.get(rawKey));
  1604. } else if (target !== rawTarget) {
  1605. target.get(key);
  1606. }
  1607. },
  1608. get size() {
  1609. const target = this["__v_raw"];
  1610. !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
  1611. return target.size;
  1612. },
  1613. has(key) {
  1614. const target = this["__v_raw"];
  1615. const rawTarget = toRaw(target);
  1616. const rawKey = toRaw(key);
  1617. if (!readonly) {
  1618. if (hasChanged(key, rawKey)) {
  1619. track(rawTarget, "has", key);
  1620. }
  1621. track(rawTarget, "has", rawKey);
  1622. }
  1623. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  1624. },
  1625. forEach(callback, thisArg) {
  1626. const observed = this;
  1627. const target = observed["__v_raw"];
  1628. const rawTarget = toRaw(target);
  1629. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1630. !readonly && track(rawTarget, "iterate", ITERATE_KEY);
  1631. return target.forEach((value, key) => {
  1632. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1633. });
  1634. }
  1635. };
  1636. extend(
  1637. instrumentations,
  1638. readonly ? {
  1639. add: createReadonlyMethod("add"),
  1640. set: createReadonlyMethod("set"),
  1641. delete: createReadonlyMethod("delete"),
  1642. clear: createReadonlyMethod("clear")
  1643. } : {
  1644. add(value) {
  1645. const target = toRaw(this);
  1646. const proto = getProto(target);
  1647. const rawValue = toRaw(value);
  1648. const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;
  1649. const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);
  1650. if (!hadKey) {
  1651. target.add(valueToAdd);
  1652. trigger(target, "add", valueToAdd, valueToAdd);
  1653. }
  1654. return this;
  1655. },
  1656. set(key, value) {
  1657. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1658. value = toRaw(value);
  1659. }
  1660. const target = toRaw(this);
  1661. const { has, get } = getProto(target);
  1662. let hadKey = has.call(target, key);
  1663. if (!hadKey) {
  1664. key = toRaw(key);
  1665. hadKey = has.call(target, key);
  1666. } else {
  1667. checkIdentityKeys(target, has, key);
  1668. }
  1669. const oldValue = get.call(target, key);
  1670. target.set(key, value);
  1671. if (!hadKey) {
  1672. trigger(target, "add", key, value);
  1673. } else if (hasChanged(value, oldValue)) {
  1674. trigger(target, "set", key, value, oldValue);
  1675. }
  1676. return this;
  1677. },
  1678. delete(key) {
  1679. const target = toRaw(this);
  1680. const { has, get } = getProto(target);
  1681. let hadKey = has.call(target, key);
  1682. if (!hadKey) {
  1683. key = toRaw(key);
  1684. hadKey = has.call(target, key);
  1685. } else {
  1686. checkIdentityKeys(target, has, key);
  1687. }
  1688. const oldValue = get ? get.call(target, key) : void 0;
  1689. const result = target.delete(key);
  1690. if (hadKey) {
  1691. trigger(target, "delete", key, void 0, oldValue);
  1692. }
  1693. return result;
  1694. },
  1695. clear() {
  1696. const target = toRaw(this);
  1697. const hadItems = target.size !== 0;
  1698. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1699. const result = target.clear();
  1700. if (hadItems) {
  1701. trigger(
  1702. target,
  1703. "clear",
  1704. void 0,
  1705. void 0,
  1706. oldTarget
  1707. );
  1708. }
  1709. return result;
  1710. }
  1711. }
  1712. );
  1713. const iteratorMethods = [
  1714. "keys",
  1715. "values",
  1716. "entries",
  1717. Symbol.iterator
  1718. ];
  1719. iteratorMethods.forEach((method) => {
  1720. instrumentations[method] = createIterableMethod(method, readonly, shallow);
  1721. });
  1722. return instrumentations;
  1723. }
  1724. function createInstrumentationGetter(isReadonly2, shallow) {
  1725. const instrumentations = createInstrumentations(isReadonly2, shallow);
  1726. return (target, key, receiver) => {
  1727. if (key === "__v_isReactive") {
  1728. return !isReadonly2;
  1729. } else if (key === "__v_isReadonly") {
  1730. return isReadonly2;
  1731. } else if (key === "__v_raw") {
  1732. return target;
  1733. }
  1734. return Reflect.get(
  1735. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1736. key,
  1737. receiver
  1738. );
  1739. };
  1740. }
  1741. const mutableCollectionHandlers = {
  1742. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1743. };
  1744. const shallowCollectionHandlers = {
  1745. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1746. };
  1747. const readonlyCollectionHandlers = {
  1748. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1749. };
  1750. const shallowReadonlyCollectionHandlers = {
  1751. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1752. };
  1753. function checkIdentityKeys(target, has, key) {
  1754. const rawKey = toRaw(key);
  1755. if (rawKey !== key && has.call(target, rawKey)) {
  1756. const type = toRawType(target);
  1757. warn$2(
  1758. `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.`
  1759. );
  1760. }
  1761. }
  1762. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1763. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1764. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1765. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1766. function targetTypeMap(rawType) {
  1767. switch (rawType) {
  1768. case "Object":
  1769. case "Array":
  1770. return 1 /* COMMON */;
  1771. case "Map":
  1772. case "Set":
  1773. case "WeakMap":
  1774. case "WeakSet":
  1775. return 2 /* COLLECTION */;
  1776. default:
  1777. return 0 /* INVALID */;
  1778. }
  1779. }
  1780. // @__NO_SIDE_EFFECTS__
  1781. function reactive(target) {
  1782. if (/* @__PURE__ */ isReadonly(target)) {
  1783. return target;
  1784. }
  1785. return createReactiveObject(
  1786. target,
  1787. false,
  1788. mutableHandlers,
  1789. mutableCollectionHandlers,
  1790. reactiveMap
  1791. );
  1792. }
  1793. // @__NO_SIDE_EFFECTS__
  1794. function shallowReactive(target) {
  1795. return createReactiveObject(
  1796. target,
  1797. false,
  1798. shallowReactiveHandlers,
  1799. shallowCollectionHandlers,
  1800. shallowReactiveMap
  1801. );
  1802. }
  1803. // @__NO_SIDE_EFFECTS__
  1804. function readonly(target) {
  1805. return createReactiveObject(
  1806. target,
  1807. true,
  1808. readonlyHandlers,
  1809. readonlyCollectionHandlers,
  1810. readonlyMap
  1811. );
  1812. }
  1813. // @__NO_SIDE_EFFECTS__
  1814. function shallowReadonly(target) {
  1815. return createReactiveObject(
  1816. target,
  1817. true,
  1818. shallowReadonlyHandlers,
  1819. shallowReadonlyCollectionHandlers,
  1820. shallowReadonlyMap
  1821. );
  1822. }
  1823. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1824. if (!isObject(target)) {
  1825. {
  1826. warn$2(
  1827. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1828. target
  1829. )}`
  1830. );
  1831. }
  1832. return target;
  1833. }
  1834. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1835. return target;
  1836. }
  1837. if (target["__v_skip"] || !Object.isExtensible(target)) {
  1838. return target;
  1839. }
  1840. const existingProxy = proxyMap.get(target);
  1841. if (existingProxy) {
  1842. return existingProxy;
  1843. }
  1844. const targetType = targetTypeMap(toRawType(target));
  1845. if (targetType === 0 /* INVALID */) {
  1846. return target;
  1847. }
  1848. const proxy = new Proxy(
  1849. target,
  1850. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1851. );
  1852. proxyMap.set(target, proxy);
  1853. return proxy;
  1854. }
  1855. // @__NO_SIDE_EFFECTS__
  1856. function isReactive(value) {
  1857. if (/* @__PURE__ */ isReadonly(value)) {
  1858. return /* @__PURE__ */ isReactive(value["__v_raw"]);
  1859. }
  1860. return !!(value && value["__v_isReactive"]);
  1861. }
  1862. // @__NO_SIDE_EFFECTS__
  1863. function isReadonly(value) {
  1864. return !!(value && value["__v_isReadonly"]);
  1865. }
  1866. // @__NO_SIDE_EFFECTS__
  1867. function isShallow(value) {
  1868. return !!(value && value["__v_isShallow"]);
  1869. }
  1870. // @__NO_SIDE_EFFECTS__
  1871. function isProxy(value) {
  1872. return value ? !!value["__v_raw"] : false;
  1873. }
  1874. // @__NO_SIDE_EFFECTS__
  1875. function toRaw(observed) {
  1876. const raw = observed && observed["__v_raw"];
  1877. return raw ? /* @__PURE__ */ toRaw(raw) : observed;
  1878. }
  1879. function markRaw(value) {
  1880. if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
  1881. def(value, "__v_skip", true);
  1882. }
  1883. return value;
  1884. }
  1885. const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;
  1886. const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
  1887. // @__NO_SIDE_EFFECTS__
  1888. function isRef(r) {
  1889. return r ? r["__v_isRef"] === true : false;
  1890. }
  1891. // @__NO_SIDE_EFFECTS__
  1892. function ref(value) {
  1893. return createRef(value, false);
  1894. }
  1895. // @__NO_SIDE_EFFECTS__
  1896. function shallowRef(value) {
  1897. return createRef(value, true);
  1898. }
  1899. function createRef(rawValue, shallow) {
  1900. if (/* @__PURE__ */ isRef(rawValue)) {
  1901. return rawValue;
  1902. }
  1903. return new RefImpl(rawValue, shallow);
  1904. }
  1905. class RefImpl {
  1906. constructor(value, isShallow2) {
  1907. this.dep = new Dep();
  1908. this["__v_isRef"] = true;
  1909. this["__v_isShallow"] = false;
  1910. this._rawValue = isShallow2 ? value : toRaw(value);
  1911. this._value = isShallow2 ? value : toReactive(value);
  1912. this["__v_isShallow"] = isShallow2;
  1913. }
  1914. get value() {
  1915. {
  1916. this.dep.track({
  1917. target: this,
  1918. type: "get",
  1919. key: "value"
  1920. });
  1921. }
  1922. return this._value;
  1923. }
  1924. set value(newValue) {
  1925. const oldValue = this._rawValue;
  1926. const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
  1927. newValue = useDirectValue ? newValue : toRaw(newValue);
  1928. if (hasChanged(newValue, oldValue)) {
  1929. this._rawValue = newValue;
  1930. this._value = useDirectValue ? newValue : toReactive(newValue);
  1931. {
  1932. this.dep.trigger({
  1933. target: this,
  1934. type: "set",
  1935. key: "value",
  1936. newValue,
  1937. oldValue
  1938. });
  1939. }
  1940. }
  1941. }
  1942. }
  1943. function triggerRef(ref2) {
  1944. if (ref2.dep) {
  1945. {
  1946. ref2.dep.trigger({
  1947. target: ref2,
  1948. type: "set",
  1949. key: "value",
  1950. newValue: ref2._value
  1951. });
  1952. }
  1953. }
  1954. }
  1955. function unref(ref2) {
  1956. return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;
  1957. }
  1958. function toValue(source) {
  1959. return isFunction(source) ? source() : unref(source);
  1960. }
  1961. const shallowUnwrapHandlers = {
  1962. get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
  1963. set: (target, key, value, receiver) => {
  1964. const oldValue = target[key];
  1965. if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
  1966. oldValue.value = value;
  1967. return true;
  1968. } else {
  1969. return Reflect.set(target, key, value, receiver);
  1970. }
  1971. }
  1972. };
  1973. function proxyRefs(objectWithRefs) {
  1974. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1975. }
  1976. class CustomRefImpl {
  1977. constructor(factory) {
  1978. this["__v_isRef"] = true;
  1979. this._value = void 0;
  1980. const dep = this.dep = new Dep();
  1981. const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
  1982. this._get = get;
  1983. this._set = set;
  1984. }
  1985. get value() {
  1986. return this._value = this._get();
  1987. }
  1988. set value(newVal) {
  1989. this._set(newVal);
  1990. }
  1991. }
  1992. function customRef(factory) {
  1993. return new CustomRefImpl(factory);
  1994. }
  1995. // @__NO_SIDE_EFFECTS__
  1996. function toRefs(object) {
  1997. if (!isProxy(object)) {
  1998. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1999. }
  2000. const ret = isArray(object) ? new Array(object.length) : {};
  2001. for (const key in object) {
  2002. ret[key] = propertyToRef(object, key);
  2003. }
  2004. return ret;
  2005. }
  2006. class ObjectRefImpl {
  2007. constructor(_object, key, _defaultValue) {
  2008. this._object = _object;
  2009. this._defaultValue = _defaultValue;
  2010. this["__v_isRef"] = true;
  2011. this._value = void 0;
  2012. this._key = isSymbol(key) ? key : String(key);
  2013. this._raw = toRaw(_object);
  2014. let shallow = true;
  2015. let obj = _object;
  2016. if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) {
  2017. do {
  2018. shallow = !isProxy(obj) || isShallow(obj);
  2019. } while (shallow && (obj = obj["__v_raw"]));
  2020. }
  2021. this._shallow = shallow;
  2022. }
  2023. get value() {
  2024. let val = this._object[this._key];
  2025. if (this._shallow) {
  2026. val = unref(val);
  2027. }
  2028. return this._value = val === void 0 ? this._defaultValue : val;
  2029. }
  2030. set value(newVal) {
  2031. if (this._shallow && /* @__PURE__ */ isRef(this._raw[this._key])) {
  2032. const nestedRef = this._object[this._key];
  2033. if (/* @__PURE__ */ isRef(nestedRef)) {
  2034. nestedRef.value = newVal;
  2035. return;
  2036. }
  2037. }
  2038. this._object[this._key] = newVal;
  2039. }
  2040. get dep() {
  2041. return getDepFromReactive(this._raw, this._key);
  2042. }
  2043. }
  2044. class GetterRefImpl {
  2045. constructor(_getter) {
  2046. this._getter = _getter;
  2047. this["__v_isRef"] = true;
  2048. this["__v_isReadonly"] = true;
  2049. this._value = void 0;
  2050. }
  2051. get value() {
  2052. return this._value = this._getter();
  2053. }
  2054. }
  2055. // @__NO_SIDE_EFFECTS__
  2056. function toRef(source, key, defaultValue) {
  2057. if (/* @__PURE__ */ isRef(source)) {
  2058. return source;
  2059. } else if (isFunction(source)) {
  2060. return new GetterRefImpl(source);
  2061. } else if (isObject(source) && arguments.length > 1) {
  2062. return propertyToRef(source, key, defaultValue);
  2063. } else {
  2064. return /* @__PURE__ */ ref(source);
  2065. }
  2066. }
  2067. function propertyToRef(source, key, defaultValue) {
  2068. return new ObjectRefImpl(source, key, defaultValue);
  2069. }
  2070. class ComputedRefImpl {
  2071. constructor(fn, setter, isSSR) {
  2072. this.fn = fn;
  2073. this.setter = setter;
  2074. /**
  2075. * @internal
  2076. */
  2077. this._value = void 0;
  2078. /**
  2079. * @internal
  2080. */
  2081. this.dep = new Dep(this);
  2082. /**
  2083. * @internal
  2084. */
  2085. this.__v_isRef = true;
  2086. // TODO isolatedDeclarations "__v_isReadonly"
  2087. // A computed is also a subscriber that tracks other deps
  2088. /**
  2089. * @internal
  2090. */
  2091. this.deps = void 0;
  2092. /**
  2093. * @internal
  2094. */
  2095. this.depsTail = void 0;
  2096. /**
  2097. * @internal
  2098. */
  2099. this.flags = 16;
  2100. /**
  2101. * @internal
  2102. */
  2103. this.globalVersion = globalVersion - 1;
  2104. /**
  2105. * @internal
  2106. */
  2107. this.next = void 0;
  2108. // for backwards compat
  2109. this.effect = this;
  2110. this["__v_isReadonly"] = !setter;
  2111. this.isSSR = isSSR;
  2112. }
  2113. /**
  2114. * @internal
  2115. */
  2116. notify() {
  2117. this.flags |= 16;
  2118. if (!(this.flags & 8) && // avoid infinite self recursion
  2119. activeSub !== this) {
  2120. batch(this, true);
  2121. return true;
  2122. }
  2123. }
  2124. get value() {
  2125. const link = this.dep.track({
  2126. target: this,
  2127. type: "get",
  2128. key: "value"
  2129. }) ;
  2130. refreshComputed(this);
  2131. if (link) {
  2132. link.version = this.dep.version;
  2133. }
  2134. return this._value;
  2135. }
  2136. set value(newValue) {
  2137. if (this.setter) {
  2138. this.setter(newValue);
  2139. } else {
  2140. warn$2("Write operation failed: computed value is readonly");
  2141. }
  2142. }
  2143. }
  2144. // @__NO_SIDE_EFFECTS__
  2145. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  2146. let getter;
  2147. let setter;
  2148. if (isFunction(getterOrOptions)) {
  2149. getter = getterOrOptions;
  2150. } else {
  2151. getter = getterOrOptions.get;
  2152. setter = getterOrOptions.set;
  2153. }
  2154. const cRef = new ComputedRefImpl(getter, setter, isSSR);
  2155. if (debugOptions && !isSSR) {
  2156. cRef.onTrack = debugOptions.onTrack;
  2157. cRef.onTrigger = debugOptions.onTrigger;
  2158. }
  2159. return cRef;
  2160. }
  2161. const TrackOpTypes = {
  2162. "GET": "get",
  2163. "HAS": "has",
  2164. "ITERATE": "iterate"
  2165. };
  2166. const TriggerOpTypes = {
  2167. "SET": "set",
  2168. "ADD": "add",
  2169. "DELETE": "delete",
  2170. "CLEAR": "clear"
  2171. };
  2172. const INITIAL_WATCHER_VALUE = {};
  2173. const cleanupMap = /* @__PURE__ */ new WeakMap();
  2174. let activeWatcher = void 0;
  2175. function getCurrentWatcher() {
  2176. return activeWatcher;
  2177. }
  2178. function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
  2179. if (owner) {
  2180. let cleanups = cleanupMap.get(owner);
  2181. if (!cleanups) cleanupMap.set(owner, cleanups = []);
  2182. cleanups.push(cleanupFn);
  2183. } else if (!failSilently) {
  2184. warn$2(
  2185. `onWatcherCleanup() was called when there was no active watcher to associate with.`
  2186. );
  2187. }
  2188. }
  2189. function watch$1(source, cb, options = EMPTY_OBJ) {
  2190. const { immediate, deep, once, scheduler, augmentJob, call } = options;
  2191. const warnInvalidSource = (s) => {
  2192. (options.onWarn || warn$2)(
  2193. `Invalid watch source: `,
  2194. s,
  2195. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  2196. );
  2197. };
  2198. const reactiveGetter = (source2) => {
  2199. if (deep) return source2;
  2200. if (isShallow(source2) || deep === false || deep === 0)
  2201. return traverse(source2, 1);
  2202. return traverse(source2);
  2203. };
  2204. let effect;
  2205. let getter;
  2206. let cleanup;
  2207. let boundCleanup;
  2208. let forceTrigger = false;
  2209. let isMultiSource = false;
  2210. if (isRef(source)) {
  2211. getter = () => source.value;
  2212. forceTrigger = isShallow(source);
  2213. } else if (isReactive(source)) {
  2214. getter = () => reactiveGetter(source);
  2215. forceTrigger = true;
  2216. } else if (isArray(source)) {
  2217. isMultiSource = true;
  2218. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  2219. getter = () => source.map((s) => {
  2220. if (isRef(s)) {
  2221. return s.value;
  2222. } else if (isReactive(s)) {
  2223. return reactiveGetter(s);
  2224. } else if (isFunction(s)) {
  2225. return call ? call(s, 2) : s();
  2226. } else {
  2227. warnInvalidSource(s);
  2228. }
  2229. });
  2230. } else if (isFunction(source)) {
  2231. if (cb) {
  2232. getter = call ? () => call(source, 2) : source;
  2233. } else {
  2234. getter = () => {
  2235. if (cleanup) {
  2236. pauseTracking();
  2237. try {
  2238. cleanup();
  2239. } finally {
  2240. resetTracking();
  2241. }
  2242. }
  2243. const currentEffect = activeWatcher;
  2244. activeWatcher = effect;
  2245. try {
  2246. return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
  2247. } finally {
  2248. activeWatcher = currentEffect;
  2249. }
  2250. };
  2251. }
  2252. } else {
  2253. getter = NOOP;
  2254. warnInvalidSource(source);
  2255. }
  2256. if (cb && deep) {
  2257. const baseGetter = getter;
  2258. const depth = deep === true ? Infinity : deep;
  2259. getter = () => traverse(baseGetter(), depth);
  2260. }
  2261. const scope = getCurrentScope();
  2262. const watchHandle = () => {
  2263. effect.stop();
  2264. if (scope && scope.active) {
  2265. remove(scope.effects, effect);
  2266. }
  2267. };
  2268. if (once && cb) {
  2269. const _cb = cb;
  2270. cb = (...args) => {
  2271. const res = _cb(...args);
  2272. watchHandle();
  2273. return res;
  2274. };
  2275. }
  2276. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2277. const job = (immediateFirstRun) => {
  2278. if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
  2279. return;
  2280. }
  2281. if (cb) {
  2282. const newValue = effect.run();
  2283. if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
  2284. if (cleanup) {
  2285. cleanup();
  2286. }
  2287. const currentWatcher = activeWatcher;
  2288. activeWatcher = effect;
  2289. try {
  2290. const args = [
  2291. newValue,
  2292. // pass undefined as the old value when it's changed for the first time
  2293. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  2294. boundCleanup
  2295. ];
  2296. oldValue = newValue;
  2297. call ? call(cb, 3, args) : (
  2298. // @ts-expect-error
  2299. cb(...args)
  2300. );
  2301. } finally {
  2302. activeWatcher = currentWatcher;
  2303. }
  2304. }
  2305. } else {
  2306. effect.run();
  2307. }
  2308. };
  2309. if (augmentJob) {
  2310. augmentJob(job);
  2311. }
  2312. effect = new ReactiveEffect(getter);
  2313. effect.scheduler = scheduler ? () => scheduler(job, false) : job;
  2314. boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
  2315. cleanup = effect.onStop = () => {
  2316. const cleanups = cleanupMap.get(effect);
  2317. if (cleanups) {
  2318. if (call) {
  2319. call(cleanups, 4);
  2320. } else {
  2321. for (const cleanup2 of cleanups) cleanup2();
  2322. }
  2323. cleanupMap.delete(effect);
  2324. }
  2325. };
  2326. {
  2327. effect.onTrack = options.onTrack;
  2328. effect.onTrigger = options.onTrigger;
  2329. }
  2330. if (cb) {
  2331. if (immediate) {
  2332. job(true);
  2333. } else {
  2334. oldValue = effect.run();
  2335. }
  2336. } else if (scheduler) {
  2337. scheduler(job.bind(null, true), true);
  2338. } else {
  2339. effect.run();
  2340. }
  2341. watchHandle.pause = effect.pause.bind(effect);
  2342. watchHandle.resume = effect.resume.bind(effect);
  2343. watchHandle.stop = watchHandle;
  2344. return watchHandle;
  2345. }
  2346. function traverse(value, depth = Infinity, seen) {
  2347. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  2348. return value;
  2349. }
  2350. seen = seen || /* @__PURE__ */ new Map();
  2351. if ((seen.get(value) || 0) >= depth) {
  2352. return value;
  2353. }
  2354. seen.set(value, depth);
  2355. depth--;
  2356. if (isRef(value)) {
  2357. traverse(value.value, depth, seen);
  2358. } else if (isArray(value)) {
  2359. for (let i = 0; i < value.length; i++) {
  2360. traverse(value[i], depth, seen);
  2361. }
  2362. } else if (isSet(value) || isMap(value)) {
  2363. value.forEach((v) => {
  2364. traverse(v, depth, seen);
  2365. });
  2366. } else if (isPlainObject(value)) {
  2367. for (const key in value) {
  2368. traverse(value[key], depth, seen);
  2369. }
  2370. for (const key of Object.getOwnPropertySymbols(value)) {
  2371. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  2372. traverse(value[key], depth, seen);
  2373. }
  2374. }
  2375. }
  2376. return value;
  2377. }
  2378. const stack$1 = [];
  2379. function pushWarningContext(vnode) {
  2380. stack$1.push(vnode);
  2381. }
  2382. function popWarningContext() {
  2383. stack$1.pop();
  2384. }
  2385. let isWarning = false;
  2386. function warn$1(msg, ...args) {
  2387. if (isWarning) return;
  2388. isWarning = true;
  2389. pauseTracking();
  2390. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  2391. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  2392. const trace = getComponentTrace();
  2393. if (appWarnHandler) {
  2394. callWithErrorHandling(
  2395. appWarnHandler,
  2396. instance,
  2397. 11,
  2398. [
  2399. // eslint-disable-next-line no-restricted-syntax
  2400. msg + args.map((a) => {
  2401. var _a, _b;
  2402. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  2403. }).join(""),
  2404. instance && instance.proxy,
  2405. trace.map(
  2406. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  2407. ).join("\n"),
  2408. trace
  2409. ]
  2410. );
  2411. } else {
  2412. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  2413. if (trace.length && // avoid spamming console during tests
  2414. true) {
  2415. warnArgs.push(`
  2416. `, ...formatTrace(trace));
  2417. }
  2418. console.warn(...warnArgs);
  2419. }
  2420. resetTracking();
  2421. isWarning = false;
  2422. }
  2423. function getComponentTrace() {
  2424. let currentVNode = stack$1[stack$1.length - 1];
  2425. if (!currentVNode) {
  2426. return [];
  2427. }
  2428. const normalizedStack = [];
  2429. while (currentVNode) {
  2430. const last = normalizedStack[0];
  2431. if (last && last.vnode === currentVNode) {
  2432. last.recurseCount++;
  2433. } else {
  2434. normalizedStack.push({
  2435. vnode: currentVNode,
  2436. recurseCount: 0
  2437. });
  2438. }
  2439. const parentInstance = currentVNode.component && currentVNode.component.parent;
  2440. currentVNode = parentInstance && parentInstance.vnode;
  2441. }
  2442. return normalizedStack;
  2443. }
  2444. function formatTrace(trace) {
  2445. const logs = [];
  2446. trace.forEach((entry, i) => {
  2447. logs.push(...i === 0 ? [] : [`
  2448. `], ...formatTraceEntry(entry));
  2449. });
  2450. return logs;
  2451. }
  2452. function formatTraceEntry({ vnode, recurseCount }) {
  2453. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  2454. const isRoot = vnode.component ? vnode.component.parent == null : false;
  2455. const open = ` at <${formatComponentName(
  2456. vnode.component,
  2457. vnode.type,
  2458. isRoot
  2459. )}`;
  2460. const close = `>` + postfix;
  2461. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  2462. }
  2463. function formatProps(props) {
  2464. const res = [];
  2465. const keys = Object.keys(props);
  2466. keys.slice(0, 3).forEach((key) => {
  2467. res.push(...formatProp(key, props[key]));
  2468. });
  2469. if (keys.length > 3) {
  2470. res.push(` ...`);
  2471. }
  2472. return res;
  2473. }
  2474. function formatProp(key, value, raw) {
  2475. if (isString(value)) {
  2476. value = JSON.stringify(value);
  2477. return raw ? value : [`${key}=${value}`];
  2478. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  2479. return raw ? value : [`${key}=${value}`];
  2480. } else if (isRef(value)) {
  2481. value = formatProp(key, toRaw(value.value), true);
  2482. return raw ? value : [`${key}=Ref<`, value, `>`];
  2483. } else if (isFunction(value)) {
  2484. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  2485. } else {
  2486. value = toRaw(value);
  2487. return raw ? value : [`${key}=`, value];
  2488. }
  2489. }
  2490. function assertNumber(val, type) {
  2491. if (val === void 0) {
  2492. return;
  2493. } else if (typeof val !== "number") {
  2494. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  2495. } else if (isNaN(val)) {
  2496. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  2497. }
  2498. }
  2499. const ErrorCodes = {
  2500. "SETUP_FUNCTION": 0,
  2501. "0": "SETUP_FUNCTION",
  2502. "RENDER_FUNCTION": 1,
  2503. "1": "RENDER_FUNCTION",
  2504. "NATIVE_EVENT_HANDLER": 5,
  2505. "5": "NATIVE_EVENT_HANDLER",
  2506. "COMPONENT_EVENT_HANDLER": 6,
  2507. "6": "COMPONENT_EVENT_HANDLER",
  2508. "VNODE_HOOK": 7,
  2509. "7": "VNODE_HOOK",
  2510. "DIRECTIVE_HOOK": 8,
  2511. "8": "DIRECTIVE_HOOK",
  2512. "TRANSITION_HOOK": 9,
  2513. "9": "TRANSITION_HOOK",
  2514. "APP_ERROR_HANDLER": 10,
  2515. "10": "APP_ERROR_HANDLER",
  2516. "APP_WARN_HANDLER": 11,
  2517. "11": "APP_WARN_HANDLER",
  2518. "FUNCTION_REF": 12,
  2519. "12": "FUNCTION_REF",
  2520. "ASYNC_COMPONENT_LOADER": 13,
  2521. "13": "ASYNC_COMPONENT_LOADER",
  2522. "SCHEDULER": 14,
  2523. "14": "SCHEDULER",
  2524. "COMPONENT_UPDATE": 15,
  2525. "15": "COMPONENT_UPDATE",
  2526. "APP_UNMOUNT_CLEANUP": 16,
  2527. "16": "APP_UNMOUNT_CLEANUP"
  2528. };
  2529. const ErrorTypeStrings$1 = {
  2530. ["sp"]: "serverPrefetch hook",
  2531. ["bc"]: "beforeCreate hook",
  2532. ["c"]: "created hook",
  2533. ["bm"]: "beforeMount hook",
  2534. ["m"]: "mounted hook",
  2535. ["bu"]: "beforeUpdate hook",
  2536. ["u"]: "updated",
  2537. ["bum"]: "beforeUnmount hook",
  2538. ["um"]: "unmounted hook",
  2539. ["a"]: "activated hook",
  2540. ["da"]: "deactivated hook",
  2541. ["ec"]: "errorCaptured hook",
  2542. ["rtc"]: "renderTracked hook",
  2543. ["rtg"]: "renderTriggered hook",
  2544. [0]: "setup function",
  2545. [1]: "render function",
  2546. [2]: "watcher getter",
  2547. [3]: "watcher callback",
  2548. [4]: "watcher cleanup function",
  2549. [5]: "native event handler",
  2550. [6]: "component event handler",
  2551. [7]: "vnode hook",
  2552. [8]: "directive hook",
  2553. [9]: "transition hook",
  2554. [10]: "app errorHandler",
  2555. [11]: "app warnHandler",
  2556. [12]: "ref function",
  2557. [13]: "async component loader",
  2558. [14]: "scheduler flush",
  2559. [15]: "component update",
  2560. [16]: "app unmount cleanup function"
  2561. };
  2562. function callWithErrorHandling(fn, instance, type, args) {
  2563. try {
  2564. return args ? fn(...args) : fn();
  2565. } catch (err) {
  2566. handleError(err, instance, type);
  2567. }
  2568. }
  2569. function callWithAsyncErrorHandling(fn, instance, type, args) {
  2570. if (isFunction(fn)) {
  2571. const res = callWithErrorHandling(fn, instance, type, args);
  2572. if (res && isPromise(res)) {
  2573. res.catch((err) => {
  2574. handleError(err, instance, type);
  2575. });
  2576. }
  2577. return res;
  2578. }
  2579. if (isArray(fn)) {
  2580. const values = [];
  2581. for (let i = 0; i < fn.length; i++) {
  2582. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  2583. }
  2584. return values;
  2585. } else {
  2586. warn$1(
  2587. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  2588. );
  2589. }
  2590. }
  2591. function handleError(err, instance, type, throwInDev = true) {
  2592. const contextVNode = instance ? instance.vnode : null;
  2593. const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
  2594. if (instance) {
  2595. let cur = instance.parent;
  2596. const exposedInstance = instance.proxy;
  2597. const errorInfo = ErrorTypeStrings$1[type] ;
  2598. while (cur) {
  2599. const errorCapturedHooks = cur.ec;
  2600. if (errorCapturedHooks) {
  2601. for (let i = 0; i < errorCapturedHooks.length; i++) {
  2602. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  2603. return;
  2604. }
  2605. }
  2606. }
  2607. cur = cur.parent;
  2608. }
  2609. if (errorHandler) {
  2610. pauseTracking();
  2611. callWithErrorHandling(errorHandler, null, 10, [
  2612. err,
  2613. exposedInstance,
  2614. errorInfo
  2615. ]);
  2616. resetTracking();
  2617. return;
  2618. }
  2619. }
  2620. logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
  2621. }
  2622. function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
  2623. {
  2624. const info = ErrorTypeStrings$1[type];
  2625. if (contextVNode) {
  2626. pushWarningContext(contextVNode);
  2627. }
  2628. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  2629. if (contextVNode) {
  2630. popWarningContext();
  2631. }
  2632. if (throwInDev) {
  2633. throw err;
  2634. } else {
  2635. console.error(err);
  2636. }
  2637. }
  2638. }
  2639. const queue = [];
  2640. let flushIndex = -1;
  2641. const pendingPostFlushCbs = [];
  2642. let activePostFlushCbs = null;
  2643. let postFlushIndex = 0;
  2644. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  2645. let currentFlushPromise = null;
  2646. const RECURSION_LIMIT = 100;
  2647. function nextTick(fn) {
  2648. const p = currentFlushPromise || resolvedPromise;
  2649. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  2650. }
  2651. function findInsertionIndex(id) {
  2652. let start = flushIndex + 1;
  2653. let end = queue.length;
  2654. while (start < end) {
  2655. const middle = start + end >>> 1;
  2656. const middleJob = queue[middle];
  2657. const middleJobId = getId(middleJob);
  2658. if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
  2659. start = middle + 1;
  2660. } else {
  2661. end = middle;
  2662. }
  2663. }
  2664. return start;
  2665. }
  2666. function queueJob(job) {
  2667. if (!(job.flags & 1)) {
  2668. const jobId = getId(job);
  2669. const lastJob = queue[queue.length - 1];
  2670. if (!lastJob || // fast path when the job id is larger than the tail
  2671. !(job.flags & 2) && jobId >= getId(lastJob)) {
  2672. queue.push(job);
  2673. } else {
  2674. queue.splice(findInsertionIndex(jobId), 0, job);
  2675. }
  2676. job.flags |= 1;
  2677. queueFlush();
  2678. }
  2679. }
  2680. function queueFlush() {
  2681. if (!currentFlushPromise) {
  2682. currentFlushPromise = resolvedPromise.then(flushJobs);
  2683. }
  2684. }
  2685. function queuePostFlushCb(cb) {
  2686. if (!isArray(cb)) {
  2687. if (activePostFlushCbs && cb.id === -1) {
  2688. activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
  2689. } else if (!(cb.flags & 1)) {
  2690. pendingPostFlushCbs.push(cb);
  2691. cb.flags |= 1;
  2692. }
  2693. } else {
  2694. for (let i = 0; i < cb.length; i++) {
  2695. pendingPostFlushCbs.push(cb[i]);
  2696. }
  2697. }
  2698. queueFlush();
  2699. }
  2700. function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
  2701. {
  2702. seen = seen || /* @__PURE__ */ new Map();
  2703. }
  2704. for (; i < queue.length; i++) {
  2705. const cb = queue[i];
  2706. if (cb && cb.flags & 2) {
  2707. if (instance && cb.id !== instance.uid) {
  2708. continue;
  2709. }
  2710. if (checkRecursiveUpdates(seen, cb)) {
  2711. continue;
  2712. }
  2713. queue.splice(i, 1);
  2714. i--;
  2715. if (cb.flags & 4) {
  2716. cb.flags &= -2;
  2717. }
  2718. cb();
  2719. if (!(cb.flags & 4)) {
  2720. cb.flags &= -2;
  2721. }
  2722. }
  2723. }
  2724. }
  2725. function flushPostFlushCbs(seen) {
  2726. if (pendingPostFlushCbs.length) {
  2727. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  2728. (a, b) => getId(a) - getId(b)
  2729. );
  2730. pendingPostFlushCbs.length = 0;
  2731. if (activePostFlushCbs) {
  2732. for (let i = 0; i < deduped.length; i++) {
  2733. activePostFlushCbs.push(deduped[i]);
  2734. }
  2735. return;
  2736. }
  2737. activePostFlushCbs = deduped;
  2738. {
  2739. seen = seen || /* @__PURE__ */ new Map();
  2740. }
  2741. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  2742. const cb = activePostFlushCbs[postFlushIndex];
  2743. if (checkRecursiveUpdates(seen, cb)) {
  2744. continue;
  2745. }
  2746. if (cb.flags & 4) {
  2747. cb.flags &= -2;
  2748. }
  2749. if (!(cb.flags & 8)) cb();
  2750. cb.flags &= -2;
  2751. }
  2752. activePostFlushCbs = null;
  2753. postFlushIndex = 0;
  2754. }
  2755. }
  2756. const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
  2757. function flushJobs(seen) {
  2758. {
  2759. seen = seen || /* @__PURE__ */ new Map();
  2760. }
  2761. const check = (job) => checkRecursiveUpdates(seen, job) ;
  2762. try {
  2763. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  2764. const job = queue[flushIndex];
  2765. if (job && !(job.flags & 8)) {
  2766. if (check(job)) {
  2767. continue;
  2768. }
  2769. if (job.flags & 4) {
  2770. job.flags &= ~1;
  2771. }
  2772. callWithErrorHandling(
  2773. job,
  2774. job.i,
  2775. job.i ? 15 : 14
  2776. );
  2777. if (!(job.flags & 4)) {
  2778. job.flags &= ~1;
  2779. }
  2780. }
  2781. }
  2782. } finally {
  2783. for (; flushIndex < queue.length; flushIndex++) {
  2784. const job = queue[flushIndex];
  2785. if (job) {
  2786. job.flags &= -2;
  2787. }
  2788. }
  2789. flushIndex = -1;
  2790. queue.length = 0;
  2791. flushPostFlushCbs(seen);
  2792. currentFlushPromise = null;
  2793. if (queue.length || pendingPostFlushCbs.length) {
  2794. flushJobs(seen);
  2795. }
  2796. }
  2797. }
  2798. function checkRecursiveUpdates(seen, fn) {
  2799. const count = seen.get(fn) || 0;
  2800. if (count > RECURSION_LIMIT) {
  2801. const instance = fn.i;
  2802. const componentName = instance && getComponentName(instance.type);
  2803. handleError(
  2804. `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.`,
  2805. null,
  2806. 10
  2807. );
  2808. return true;
  2809. }
  2810. seen.set(fn, count + 1);
  2811. return false;
  2812. }
  2813. let isHmrUpdating = false;
  2814. const setHmrUpdating = (v) => {
  2815. try {
  2816. return isHmrUpdating;
  2817. } finally {
  2818. isHmrUpdating = v;
  2819. }
  2820. };
  2821. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2822. {
  2823. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2824. createRecord: tryWrap(createRecord),
  2825. rerender: tryWrap(rerender),
  2826. reload: tryWrap(reload)
  2827. };
  2828. }
  2829. const map = /* @__PURE__ */ new Map();
  2830. function registerHMR(instance) {
  2831. const id = instance.type.__hmrId;
  2832. let record = map.get(id);
  2833. if (!record) {
  2834. createRecord(id, instance.type);
  2835. record = map.get(id);
  2836. }
  2837. record.instances.add(instance);
  2838. }
  2839. function unregisterHMR(instance) {
  2840. map.get(instance.type.__hmrId).instances.delete(instance);
  2841. }
  2842. function createRecord(id, initialDef) {
  2843. if (map.has(id)) {
  2844. return false;
  2845. }
  2846. map.set(id, {
  2847. initialDef: normalizeClassComponent(initialDef),
  2848. instances: /* @__PURE__ */ new Set()
  2849. });
  2850. return true;
  2851. }
  2852. function normalizeClassComponent(component) {
  2853. return isClassComponent(component) ? component.__vccOpts : component;
  2854. }
  2855. function rerender(id, newRender) {
  2856. const record = map.get(id);
  2857. if (!record) {
  2858. return;
  2859. }
  2860. record.initialDef.render = newRender;
  2861. [...record.instances].forEach((instance) => {
  2862. if (newRender) {
  2863. instance.render = newRender;
  2864. normalizeClassComponent(instance.type).render = newRender;
  2865. }
  2866. instance.renderCache = [];
  2867. isHmrUpdating = true;
  2868. if (!(instance.job.flags & 8)) {
  2869. instance.update();
  2870. }
  2871. isHmrUpdating = false;
  2872. });
  2873. }
  2874. function reload(id, newComp) {
  2875. const record = map.get(id);
  2876. if (!record) return;
  2877. newComp = normalizeClassComponent(newComp);
  2878. updateComponentDef(record.initialDef, newComp);
  2879. const instances = [...record.instances];
  2880. for (let i = 0; i < instances.length; i++) {
  2881. const instance = instances[i];
  2882. const oldComp = normalizeClassComponent(instance.type);
  2883. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2884. if (!dirtyInstances) {
  2885. if (oldComp !== record.initialDef) {
  2886. updateComponentDef(oldComp, newComp);
  2887. }
  2888. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2889. }
  2890. dirtyInstances.add(instance);
  2891. instance.appContext.propsCache.delete(instance.type);
  2892. instance.appContext.emitsCache.delete(instance.type);
  2893. instance.appContext.optionsCache.delete(instance.type);
  2894. if (instance.ceReload) {
  2895. dirtyInstances.add(instance);
  2896. instance.ceReload(newComp.styles);
  2897. dirtyInstances.delete(instance);
  2898. } else if (instance.parent) {
  2899. queueJob(() => {
  2900. if (!(instance.job.flags & 8)) {
  2901. isHmrUpdating = true;
  2902. instance.parent.update();
  2903. isHmrUpdating = false;
  2904. dirtyInstances.delete(instance);
  2905. }
  2906. });
  2907. } else if (instance.appContext.reload) {
  2908. instance.appContext.reload();
  2909. } else if (typeof window !== "undefined") {
  2910. window.location.reload();
  2911. } else {
  2912. console.warn(
  2913. "[HMR] Root or manually mounted instance modified. Full reload required."
  2914. );
  2915. }
  2916. if (instance.root.ce && instance !== instance.root) {
  2917. instance.root.ce._removeChildStyle(oldComp);
  2918. }
  2919. }
  2920. queuePostFlushCb(() => {
  2921. hmrDirtyComponents.clear();
  2922. });
  2923. }
  2924. function updateComponentDef(oldComp, newComp) {
  2925. extend(oldComp, newComp);
  2926. for (const key in oldComp) {
  2927. if (key !== "__file" && !(key in newComp)) {
  2928. delete oldComp[key];
  2929. }
  2930. }
  2931. }
  2932. function tryWrap(fn) {
  2933. return (id, arg) => {
  2934. try {
  2935. return fn(id, arg);
  2936. } catch (e) {
  2937. console.error(e);
  2938. console.warn(
  2939. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2940. );
  2941. }
  2942. };
  2943. }
  2944. let devtools$1;
  2945. let buffer = [];
  2946. let devtoolsNotInstalled = false;
  2947. function emit$1(event, ...args) {
  2948. if (devtools$1) {
  2949. devtools$1.emit(event, ...args);
  2950. } else if (!devtoolsNotInstalled) {
  2951. buffer.push({ event, args });
  2952. }
  2953. }
  2954. function setDevtoolsHook$1(hook, target) {
  2955. var _a, _b;
  2956. devtools$1 = hook;
  2957. if (devtools$1) {
  2958. devtools$1.enabled = true;
  2959. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2960. buffer = [];
  2961. } else if (
  2962. // handle late devtools injection - only do this if we are in an actual
  2963. // browser environment to avoid the timer handle stalling test runner exit
  2964. // (#4815)
  2965. typeof window !== "undefined" && // some envs mock window but not fully
  2966. window.HTMLElement && // also exclude jsdom
  2967. // eslint-disable-next-line no-restricted-syntax
  2968. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2969. ) {
  2970. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2971. replay.push((newHook) => {
  2972. setDevtoolsHook$1(newHook, target);
  2973. });
  2974. setTimeout(() => {
  2975. if (!devtools$1) {
  2976. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2977. devtoolsNotInstalled = true;
  2978. buffer = [];
  2979. }
  2980. }, 3e3);
  2981. } else {
  2982. devtoolsNotInstalled = true;
  2983. buffer = [];
  2984. }
  2985. }
  2986. function devtoolsInitApp(app, version) {
  2987. emit$1("app:init" /* APP_INIT */, app, version, {
  2988. Fragment,
  2989. Text,
  2990. Comment,
  2991. Static
  2992. });
  2993. }
  2994. function devtoolsUnmountApp(app) {
  2995. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2996. }
  2997. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
  2998. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2999. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  3000. "component:removed" /* COMPONENT_REMOVED */
  3001. );
  3002. const devtoolsComponentRemoved = (component) => {
  3003. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  3004. !devtools$1.cleanupBuffer(component)) {
  3005. _devtoolsComponentRemoved(component);
  3006. }
  3007. };
  3008. // @__NO_SIDE_EFFECTS__
  3009. function createDevtoolsComponentHook(hook) {
  3010. return (component) => {
  3011. emit$1(
  3012. hook,
  3013. component.appContext.app,
  3014. component.uid,
  3015. component.parent ? component.parent.uid : void 0,
  3016. component
  3017. );
  3018. };
  3019. }
  3020. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
  3021. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
  3022. function createDevtoolsPerformanceHook(hook) {
  3023. return (component, type, time) => {
  3024. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  3025. };
  3026. }
  3027. function devtoolsComponentEmit(component, event, params) {
  3028. emit$1(
  3029. "component:emit" /* COMPONENT_EMIT */,
  3030. component.appContext.app,
  3031. component,
  3032. event,
  3033. params
  3034. );
  3035. }
  3036. let currentRenderingInstance = null;
  3037. let currentScopeId = null;
  3038. function setCurrentRenderingInstance(instance) {
  3039. const prev = currentRenderingInstance;
  3040. currentRenderingInstance = instance;
  3041. currentScopeId = instance && instance.type.__scopeId || null;
  3042. return prev;
  3043. }
  3044. function pushScopeId(id) {
  3045. currentScopeId = id;
  3046. }
  3047. function popScopeId() {
  3048. currentScopeId = null;
  3049. }
  3050. const withScopeId = (_id) => withCtx;
  3051. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  3052. if (!ctx) return fn;
  3053. if (fn._n) {
  3054. return fn;
  3055. }
  3056. const renderFnWithContext = (...args) => {
  3057. if (renderFnWithContext._d) {
  3058. setBlockTracking(-1);
  3059. }
  3060. const prevInstance = setCurrentRenderingInstance(ctx);
  3061. const prevStackSize = blockStack.length;
  3062. let res;
  3063. try {
  3064. res = fn(...args);
  3065. } finally {
  3066. for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
  3067. setCurrentRenderingInstance(prevInstance);
  3068. if (renderFnWithContext._d) {
  3069. setBlockTracking(1);
  3070. }
  3071. }
  3072. {
  3073. devtoolsComponentUpdated(ctx);
  3074. }
  3075. return res;
  3076. };
  3077. renderFnWithContext._n = true;
  3078. renderFnWithContext._c = true;
  3079. renderFnWithContext._d = true;
  3080. return renderFnWithContext;
  3081. }
  3082. function validateDirectiveName(name) {
  3083. if (isBuiltInDirective(name)) {
  3084. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  3085. }
  3086. }
  3087. function withDirectives(vnode, directives) {
  3088. if (currentRenderingInstance === null) {
  3089. warn$1(`withDirectives can only be used inside render functions.`);
  3090. return vnode;
  3091. }
  3092. const instance = getComponentPublicInstance(currentRenderingInstance);
  3093. const bindings = vnode.dirs || (vnode.dirs = []);
  3094. for (let i = 0; i < directives.length; i++) {
  3095. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  3096. if (dir) {
  3097. if (isFunction(dir)) {
  3098. dir = {
  3099. mounted: dir,
  3100. updated: dir
  3101. };
  3102. }
  3103. if (dir.deep) {
  3104. traverse(value);
  3105. }
  3106. bindings.push({
  3107. dir,
  3108. instance,
  3109. value,
  3110. oldValue: void 0,
  3111. arg,
  3112. modifiers
  3113. });
  3114. }
  3115. }
  3116. return vnode;
  3117. }
  3118. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  3119. const bindings = vnode.dirs;
  3120. const oldBindings = prevVNode && prevVNode.dirs;
  3121. for (let i = 0; i < bindings.length; i++) {
  3122. const binding = bindings[i];
  3123. if (oldBindings) {
  3124. binding.oldValue = oldBindings[i].value;
  3125. }
  3126. let hook = binding.dir[name];
  3127. if (hook) {
  3128. pauseTracking();
  3129. callWithAsyncErrorHandling(hook, instance, 8, [
  3130. vnode.el,
  3131. binding,
  3132. vnode,
  3133. prevVNode
  3134. ]);
  3135. resetTracking();
  3136. }
  3137. }
  3138. }
  3139. function provide(key, value) {
  3140. {
  3141. if (!currentInstance || currentInstance.isMounted) {
  3142. warn$1(`provide() can only be used inside setup().`);
  3143. }
  3144. }
  3145. if (currentInstance) {
  3146. let provides = currentInstance.provides;
  3147. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  3148. if (parentProvides === provides) {
  3149. provides = currentInstance.provides = Object.create(parentProvides);
  3150. }
  3151. provides[key] = value;
  3152. }
  3153. }
  3154. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  3155. const instance = getCurrentInstance();
  3156. if (instance || currentApp) {
  3157. let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  3158. if (provides && key in provides) {
  3159. return provides[key];
  3160. } else if (arguments.length > 1) {
  3161. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  3162. } else {
  3163. warn$1(`injection "${String(key)}" not found.`);
  3164. }
  3165. } else {
  3166. warn$1(`inject() can only be used inside setup() or functional components.`);
  3167. }
  3168. }
  3169. function hasInjectionContext() {
  3170. return !!(getCurrentInstance() || currentApp);
  3171. }
  3172. const ssrContextKey = /* @__PURE__ */ Symbol.for("v-scx");
  3173. const useSSRContext = () => {
  3174. {
  3175. const ctx = inject(ssrContextKey);
  3176. if (!ctx) {
  3177. warn$1(
  3178. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  3179. );
  3180. }
  3181. return ctx;
  3182. }
  3183. };
  3184. function watchEffect(effect, options) {
  3185. return doWatch(effect, null, options);
  3186. }
  3187. function watchPostEffect(effect, options) {
  3188. return doWatch(
  3189. effect,
  3190. null,
  3191. extend({}, options, { flush: "post" })
  3192. );
  3193. }
  3194. function watchSyncEffect(effect, options) {
  3195. return doWatch(
  3196. effect,
  3197. null,
  3198. extend({}, options, { flush: "sync" })
  3199. );
  3200. }
  3201. function watch(source, cb, options) {
  3202. if (!isFunction(cb)) {
  3203. warn$1(
  3204. `\`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.`
  3205. );
  3206. }
  3207. return doWatch(source, cb, options);
  3208. }
  3209. function doWatch(source, cb, options = EMPTY_OBJ) {
  3210. const { immediate, deep, flush, once } = options;
  3211. if (!cb) {
  3212. if (immediate !== void 0) {
  3213. warn$1(
  3214. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  3215. );
  3216. }
  3217. if (deep !== void 0) {
  3218. warn$1(
  3219. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  3220. );
  3221. }
  3222. if (once !== void 0) {
  3223. warn$1(
  3224. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  3225. );
  3226. }
  3227. }
  3228. const baseWatchOptions = extend({}, options);
  3229. baseWatchOptions.onWarn = warn$1;
  3230. const runsImmediately = cb && immediate || !cb && flush !== "post";
  3231. let ssrCleanup;
  3232. if (isInSSRComponentSetup) {
  3233. if (flush === "sync") {
  3234. const ctx = useSSRContext();
  3235. ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
  3236. } else if (!runsImmediately) {
  3237. const watchStopHandle = () => {
  3238. };
  3239. watchStopHandle.stop = NOOP;
  3240. watchStopHandle.resume = NOOP;
  3241. watchStopHandle.pause = NOOP;
  3242. return watchStopHandle;
  3243. }
  3244. }
  3245. const instance = currentInstance;
  3246. baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
  3247. let isPre = false;
  3248. if (flush === "post") {
  3249. baseWatchOptions.scheduler = (job) => {
  3250. queuePostRenderEffect(job, instance && instance.suspense);
  3251. };
  3252. } else if (flush !== "sync") {
  3253. isPre = true;
  3254. baseWatchOptions.scheduler = (job, isFirstRun) => {
  3255. if (isFirstRun) {
  3256. job();
  3257. } else {
  3258. queueJob(job);
  3259. }
  3260. };
  3261. }
  3262. baseWatchOptions.augmentJob = (job) => {
  3263. if (cb) {
  3264. job.flags |= 4;
  3265. }
  3266. if (isPre) {
  3267. job.flags |= 2;
  3268. if (instance) {
  3269. job.id = instance.uid;
  3270. job.i = instance;
  3271. }
  3272. }
  3273. };
  3274. const watchHandle = watch$1(source, cb, baseWatchOptions);
  3275. if (isInSSRComponentSetup) {
  3276. if (ssrCleanup) {
  3277. ssrCleanup.push(watchHandle);
  3278. } else if (runsImmediately) {
  3279. watchHandle();
  3280. }
  3281. }
  3282. return watchHandle;
  3283. }
  3284. function instanceWatch(source, value, options) {
  3285. const publicThis = this.proxy;
  3286. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3287. let cb;
  3288. if (isFunction(value)) {
  3289. cb = value;
  3290. } else {
  3291. cb = value.handler;
  3292. options = value;
  3293. }
  3294. const reset = setCurrentInstance(this);
  3295. const res = doWatch(getter, cb.bind(publicThis), options);
  3296. reset();
  3297. return res;
  3298. }
  3299. function createPathGetter(ctx, path) {
  3300. const segments = path.split(".");
  3301. return () => {
  3302. let cur = ctx;
  3303. for (let i = 0; i < segments.length && cur; i++) {
  3304. cur = cur[segments[i]];
  3305. }
  3306. return cur;
  3307. };
  3308. }
  3309. const pendingMounts = /* @__PURE__ */ new WeakMap();
  3310. const TeleportEndKey = /* @__PURE__ */ Symbol("_vte");
  3311. const isTeleport = (type) => type.__isTeleport;
  3312. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  3313. const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
  3314. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  3315. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  3316. const resolveTarget = (props, select) => {
  3317. const targetSelector = props && props.to;
  3318. if (isString(targetSelector)) {
  3319. if (!select) {
  3320. warn$1(
  3321. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  3322. );
  3323. return null;
  3324. } else {
  3325. const target = select(targetSelector);
  3326. if (!target && !isTeleportDisabled(props)) {
  3327. warn$1(
  3328. `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.`
  3329. );
  3330. }
  3331. return target;
  3332. }
  3333. } else {
  3334. if (!targetSelector && !isTeleportDisabled(props)) {
  3335. warn$1(`Invalid Teleport target: ${targetSelector}`);
  3336. }
  3337. return targetSelector;
  3338. }
  3339. };
  3340. const TeleportImpl = {
  3341. name: "Teleport",
  3342. __isTeleport: true,
  3343. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  3344. const {
  3345. mc: mountChildren,
  3346. pc: patchChildren,
  3347. pbc: patchBlockChildren,
  3348. o: { insert, querySelector, createText, createComment, parentNode }
  3349. } = internals;
  3350. const disabled = isTeleportDisabled(n2.props);
  3351. let { dynamicChildren } = n2;
  3352. if (isHmrUpdating) {
  3353. optimized = false;
  3354. dynamicChildren = null;
  3355. }
  3356. const mount = (vnode, container2, anchor2) => {
  3357. if (vnode.shapeFlag & 16) {
  3358. mountChildren(
  3359. vnode.children,
  3360. container2,
  3361. anchor2,
  3362. parentComponent,
  3363. parentSuspense,
  3364. namespace,
  3365. slotScopeIds,
  3366. optimized
  3367. );
  3368. }
  3369. };
  3370. const mountToTarget = (vnode = n2) => {
  3371. const disabled2 = isTeleportDisabled(vnode.props);
  3372. const target = vnode.target = resolveTarget(vnode.props, querySelector);
  3373. const targetAnchor = prepareAnchor(target, vnode, createText, insert);
  3374. if (target) {
  3375. if (namespace !== "svg" && isTargetSVG(target)) {
  3376. namespace = "svg";
  3377. } else if (namespace !== "mathml" && isTargetMathML(target)) {
  3378. namespace = "mathml";
  3379. }
  3380. if (parentComponent && parentComponent.isCE) {
  3381. (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
  3382. }
  3383. if (!disabled2) {
  3384. mount(vnode, target, targetAnchor);
  3385. updateCssVars(vnode, false);
  3386. }
  3387. } else if (!disabled2) {
  3388. warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
  3389. }
  3390. };
  3391. const queuePendingMount = (vnode) => {
  3392. const mountJob = () => {
  3393. if (pendingMounts.get(vnode) !== mountJob) return;
  3394. pendingMounts.delete(vnode);
  3395. if (isTeleportDisabled(vnode.props)) {
  3396. const mountContainer = parentNode(vnode.el) || container;
  3397. mount(vnode, mountContainer, vnode.anchor);
  3398. updateCssVars(vnode, true);
  3399. }
  3400. mountToTarget(vnode);
  3401. };
  3402. pendingMounts.set(vnode, mountJob);
  3403. queuePostRenderEffect(mountJob, parentSuspense);
  3404. };
  3405. if (n1 == null) {
  3406. const placeholder = n2.el = createComment("teleport start") ;
  3407. const mainAnchor = n2.anchor = createComment("teleport end") ;
  3408. insert(placeholder, container, anchor);
  3409. insert(mainAnchor, container, anchor);
  3410. if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
  3411. queuePendingMount(n2);
  3412. return;
  3413. }
  3414. if (disabled) {
  3415. mount(n2, container, mainAnchor);
  3416. updateCssVars(n2, true);
  3417. }
  3418. mountToTarget();
  3419. } else {
  3420. n2.el = n1.el;
  3421. const mainAnchor = n2.anchor = n1.anchor;
  3422. const pendingMount = pendingMounts.get(n1);
  3423. if (pendingMount) {
  3424. pendingMount.flags |= 8;
  3425. pendingMounts.delete(n1);
  3426. queuePendingMount(n2);
  3427. return;
  3428. }
  3429. n2.targetStart = n1.targetStart;
  3430. const target = n2.target = n1.target;
  3431. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  3432. const wasDisabled = isTeleportDisabled(n1.props);
  3433. const currentContainer = wasDisabled ? container : target;
  3434. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  3435. if (namespace === "svg" || isTargetSVG(target)) {
  3436. namespace = "svg";
  3437. } else if (namespace === "mathml" || isTargetMathML(target)) {
  3438. namespace = "mathml";
  3439. }
  3440. if (dynamicChildren) {
  3441. patchBlockChildren(
  3442. n1.dynamicChildren,
  3443. dynamicChildren,
  3444. currentContainer,
  3445. parentComponent,
  3446. parentSuspense,
  3447. namespace,
  3448. slotScopeIds
  3449. );
  3450. traverseStaticChildren(n1, n2, false);
  3451. } else if (!optimized) {
  3452. patchChildren(
  3453. n1,
  3454. n2,
  3455. currentContainer,
  3456. currentAnchor,
  3457. parentComponent,
  3458. parentSuspense,
  3459. namespace,
  3460. slotScopeIds,
  3461. false
  3462. );
  3463. }
  3464. if (disabled) {
  3465. if (!wasDisabled) {
  3466. moveTeleport(
  3467. n2,
  3468. container,
  3469. mainAnchor,
  3470. internals,
  3471. 1
  3472. );
  3473. } else {
  3474. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  3475. n2.props.to = n1.props.to;
  3476. }
  3477. }
  3478. } else {
  3479. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  3480. const nextTarget = resolveTarget(n2.props, querySelector);
  3481. if (nextTarget) {
  3482. n2.target = nextTarget;
  3483. moveTeleport(
  3484. n2,
  3485. nextTarget,
  3486. null,
  3487. internals,
  3488. 0
  3489. );
  3490. } else {
  3491. warn$1(
  3492. "Invalid Teleport target on update:",
  3493. target,
  3494. `(${typeof target})`
  3495. );
  3496. }
  3497. } else if (wasDisabled) {
  3498. moveTeleport(
  3499. n2,
  3500. target,
  3501. targetAnchor,
  3502. internals,
  3503. 1
  3504. );
  3505. }
  3506. }
  3507. updateCssVars(n2, disabled);
  3508. }
  3509. },
  3510. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  3511. const {
  3512. shapeFlag,
  3513. children,
  3514. anchor,
  3515. targetStart,
  3516. targetAnchor,
  3517. target,
  3518. props
  3519. } = vnode;
  3520. const disabled = isTeleportDisabled(props);
  3521. const shouldRemove = doRemove || !disabled;
  3522. const pendingMount = pendingMounts.get(vnode);
  3523. if (pendingMount) {
  3524. pendingMount.flags |= 8;
  3525. pendingMounts.delete(vnode);
  3526. }
  3527. if (target) {
  3528. hostRemove(targetStart);
  3529. hostRemove(targetAnchor);
  3530. }
  3531. doRemove && hostRemove(anchor);
  3532. if (!pendingMount && (disabled || target) && shapeFlag & 16) {
  3533. for (let i = 0; i < children.length; i++) {
  3534. const child = children[i];
  3535. unmount(
  3536. child,
  3537. parentComponent,
  3538. parentSuspense,
  3539. shouldRemove,
  3540. !!child.dynamicChildren
  3541. );
  3542. }
  3543. }
  3544. },
  3545. move: moveTeleport,
  3546. hydrate: hydrateTeleport
  3547. };
  3548. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  3549. if (moveType === 0) {
  3550. insert(vnode.targetAnchor, container, parentAnchor);
  3551. }
  3552. const { el, anchor, shapeFlag, children, props } = vnode;
  3553. const isReorder = moveType === 2;
  3554. if (isReorder) {
  3555. insert(el, container, parentAnchor);
  3556. }
  3557. if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
  3558. if (shapeFlag & 16) {
  3559. for (let i = 0; i < children.length; i++) {
  3560. move(
  3561. children[i],
  3562. container,
  3563. parentAnchor,
  3564. 2
  3565. );
  3566. }
  3567. }
  3568. }
  3569. if (isReorder) {
  3570. insert(anchor, container, parentAnchor);
  3571. }
  3572. }
  3573. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  3574. o: { nextSibling, parentNode, querySelector, insert, createText }
  3575. }, hydrateChildren) {
  3576. function hydrateAnchor(target2, targetNode) {
  3577. let targetAnchor = targetNode;
  3578. while (targetAnchor) {
  3579. if (targetAnchor && targetAnchor.nodeType === 8) {
  3580. if (targetAnchor.data === "teleport start anchor") {
  3581. vnode.targetStart = targetAnchor;
  3582. } else if (targetAnchor.data === "teleport anchor") {
  3583. vnode.targetAnchor = targetAnchor;
  3584. target2._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  3585. break;
  3586. }
  3587. }
  3588. targetAnchor = nextSibling(targetAnchor);
  3589. }
  3590. }
  3591. function hydrateDisabledTeleport(node2, vnode2) {
  3592. vnode2.anchor = hydrateChildren(
  3593. nextSibling(node2),
  3594. vnode2,
  3595. parentNode(node2),
  3596. parentComponent,
  3597. parentSuspense,
  3598. slotScopeIds,
  3599. optimized
  3600. );
  3601. }
  3602. const target = vnode.target = resolveTarget(
  3603. vnode.props,
  3604. querySelector
  3605. );
  3606. const disabled = isTeleportDisabled(vnode.props);
  3607. if (target) {
  3608. const targetNode = target._lpa || target.firstChild;
  3609. if (vnode.shapeFlag & 16) {
  3610. if (disabled) {
  3611. hydrateDisabledTeleport(node, vnode);
  3612. hydrateAnchor(target, targetNode);
  3613. if (!vnode.targetAnchor) {
  3614. prepareAnchor(
  3615. target,
  3616. vnode,
  3617. createText,
  3618. insert,
  3619. // if target is the same as the main view, insert anchors before current node
  3620. // to avoid hydrating mismatch
  3621. parentNode(node) === target ? node : null
  3622. );
  3623. }
  3624. } else {
  3625. vnode.anchor = nextSibling(node);
  3626. hydrateAnchor(target, targetNode);
  3627. if (!vnode.targetAnchor) {
  3628. prepareAnchor(target, vnode, createText, insert);
  3629. }
  3630. hydrateChildren(
  3631. targetNode && nextSibling(targetNode),
  3632. vnode,
  3633. target,
  3634. parentComponent,
  3635. parentSuspense,
  3636. slotScopeIds,
  3637. optimized
  3638. );
  3639. }
  3640. }
  3641. updateCssVars(vnode, disabled);
  3642. } else if (disabled) {
  3643. if (vnode.shapeFlag & 16) {
  3644. hydrateDisabledTeleport(node, vnode);
  3645. vnode.targetStart = node;
  3646. vnode.targetAnchor = nextSibling(node);
  3647. }
  3648. }
  3649. return vnode.anchor && nextSibling(vnode.anchor);
  3650. }
  3651. const Teleport = TeleportImpl;
  3652. function updateCssVars(vnode, isDisabled) {
  3653. const ctx = vnode.ctx;
  3654. if (ctx && ctx.ut) {
  3655. let node, anchor;
  3656. if (isDisabled) {
  3657. node = vnode.el;
  3658. anchor = vnode.anchor;
  3659. } else {
  3660. node = vnode.targetStart;
  3661. anchor = vnode.targetAnchor;
  3662. }
  3663. while (node && node !== anchor) {
  3664. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  3665. node = node.nextSibling;
  3666. }
  3667. ctx.ut();
  3668. }
  3669. }
  3670. function prepareAnchor(target, vnode, createText, insert, anchor = null) {
  3671. const targetStart = vnode.targetStart = createText("");
  3672. const targetAnchor = vnode.targetAnchor = createText("");
  3673. targetStart[TeleportEndKey] = targetAnchor;
  3674. if (target) {
  3675. insert(targetStart, target, anchor);
  3676. insert(targetAnchor, target, anchor);
  3677. }
  3678. return targetAnchor;
  3679. }
  3680. const leaveCbKey = /* @__PURE__ */ Symbol("_leaveCb");
  3681. const enterCbKey$1 = /* @__PURE__ */ Symbol("_enterCb");
  3682. function useTransitionState() {
  3683. const state = {
  3684. isMounted: false,
  3685. isLeaving: false,
  3686. isUnmounting: false,
  3687. leavingVNodes: /* @__PURE__ */ new Map()
  3688. };
  3689. onMounted(() => {
  3690. state.isMounted = true;
  3691. });
  3692. onBeforeUnmount(() => {
  3693. state.isUnmounting = true;
  3694. });
  3695. return state;
  3696. }
  3697. const TransitionHookValidator = [Function, Array];
  3698. const BaseTransitionPropsValidators = {
  3699. mode: String,
  3700. appear: Boolean,
  3701. persisted: Boolean,
  3702. // enter
  3703. onBeforeEnter: TransitionHookValidator,
  3704. onEnter: TransitionHookValidator,
  3705. onAfterEnter: TransitionHookValidator,
  3706. onEnterCancelled: TransitionHookValidator,
  3707. // leave
  3708. onBeforeLeave: TransitionHookValidator,
  3709. onLeave: TransitionHookValidator,
  3710. onAfterLeave: TransitionHookValidator,
  3711. onLeaveCancelled: TransitionHookValidator,
  3712. // appear
  3713. onBeforeAppear: TransitionHookValidator,
  3714. onAppear: TransitionHookValidator,
  3715. onAfterAppear: TransitionHookValidator,
  3716. onAppearCancelled: TransitionHookValidator
  3717. };
  3718. const recursiveGetSubtree = (instance) => {
  3719. const subTree = instance.subTree;
  3720. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  3721. };
  3722. const BaseTransitionImpl = {
  3723. name: `BaseTransition`,
  3724. props: BaseTransitionPropsValidators,
  3725. setup(props, { slots }) {
  3726. const instance = getCurrentInstance();
  3727. const state = useTransitionState();
  3728. return () => {
  3729. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3730. const child = children && children.length ? findNonCommentChild(children) : (
  3731. // Keep explicit default-slot conditionals on the same transition path
  3732. // as regular v-if branches, which render a comment placeholder.
  3733. instance.subTree ? createCommentVNode() : void 0
  3734. );
  3735. if (!child) {
  3736. return;
  3737. }
  3738. const rawProps = toRaw(props);
  3739. const { mode } = rawProps;
  3740. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3741. warn$1(`invalid <transition> mode: ${mode}`);
  3742. }
  3743. if (state.isLeaving) {
  3744. return emptyPlaceholder(child);
  3745. }
  3746. const innerChild = getInnerChild$1(child);
  3747. if (!innerChild) {
  3748. return emptyPlaceholder(child);
  3749. }
  3750. let enterHooks = resolveTransitionHooks(
  3751. innerChild,
  3752. rawProps,
  3753. state,
  3754. instance,
  3755. // #11061, ensure enterHooks is fresh after clone
  3756. (hooks) => enterHooks = hooks
  3757. );
  3758. if (innerChild.type !== Comment) {
  3759. setTransitionHooks(innerChild, enterHooks);
  3760. }
  3761. let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
  3762. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
  3763. let leavingHooks = resolveTransitionHooks(
  3764. oldInnerChild,
  3765. rawProps,
  3766. state,
  3767. instance
  3768. );
  3769. setTransitionHooks(oldInnerChild, leavingHooks);
  3770. if (mode === "out-in" && innerChild.type !== Comment) {
  3771. state.isLeaving = true;
  3772. leavingHooks.afterLeave = () => {
  3773. state.isLeaving = false;
  3774. if (!(instance.job.flags & 8)) {
  3775. instance.update();
  3776. }
  3777. delete leavingHooks.afterLeave;
  3778. oldInnerChild = void 0;
  3779. };
  3780. return emptyPlaceholder(child);
  3781. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3782. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3783. const leavingVNodesCache = getLeavingNodesForType(
  3784. state,
  3785. oldInnerChild
  3786. );
  3787. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3788. el[leaveCbKey] = () => {
  3789. earlyRemove();
  3790. el[leaveCbKey] = void 0;
  3791. delete enterHooks.delayedLeave;
  3792. oldInnerChild = void 0;
  3793. };
  3794. enterHooks.delayedLeave = () => {
  3795. delayedLeave();
  3796. delete enterHooks.delayedLeave;
  3797. oldInnerChild = void 0;
  3798. };
  3799. };
  3800. } else {
  3801. oldInnerChild = void 0;
  3802. }
  3803. } else if (oldInnerChild) {
  3804. oldInnerChild = void 0;
  3805. }
  3806. return child;
  3807. };
  3808. }
  3809. };
  3810. function findNonCommentChild(children) {
  3811. let child = children[0];
  3812. if (children.length > 1) {
  3813. let hasFound = false;
  3814. for (const c of children) {
  3815. if (c.type !== Comment) {
  3816. if (hasFound) {
  3817. warn$1(
  3818. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3819. );
  3820. break;
  3821. }
  3822. child = c;
  3823. hasFound = true;
  3824. }
  3825. }
  3826. }
  3827. return child;
  3828. }
  3829. const BaseTransition = BaseTransitionImpl;
  3830. function getLeavingNodesForType(state, vnode) {
  3831. const { leavingVNodes } = state;
  3832. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3833. if (!leavingVNodesCache) {
  3834. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3835. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3836. }
  3837. return leavingVNodesCache;
  3838. }
  3839. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  3840. const {
  3841. appear,
  3842. mode,
  3843. persisted = false,
  3844. onBeforeEnter,
  3845. onEnter,
  3846. onAfterEnter,
  3847. onEnterCancelled,
  3848. onBeforeLeave,
  3849. onLeave,
  3850. onAfterLeave,
  3851. onLeaveCancelled,
  3852. onBeforeAppear,
  3853. onAppear,
  3854. onAfterAppear,
  3855. onAppearCancelled
  3856. } = props;
  3857. const key = String(vnode.key);
  3858. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3859. const callHook = (hook, args) => {
  3860. hook && callWithAsyncErrorHandling(
  3861. hook,
  3862. instance,
  3863. 9,
  3864. args
  3865. );
  3866. };
  3867. const callAsyncHook = (hook, args) => {
  3868. const done = args[1];
  3869. callHook(hook, args);
  3870. if (isArray(hook)) {
  3871. if (hook.every((hook2) => hook2.length <= 1)) done();
  3872. } else if (hook.length <= 1) {
  3873. done();
  3874. }
  3875. };
  3876. const hooks = {
  3877. mode,
  3878. persisted,
  3879. beforeEnter(el) {
  3880. let hook = onBeforeEnter;
  3881. if (!state.isMounted) {
  3882. if (appear) {
  3883. hook = onBeforeAppear || onBeforeEnter;
  3884. } else {
  3885. return;
  3886. }
  3887. }
  3888. if (el[leaveCbKey]) {
  3889. el[leaveCbKey](
  3890. true
  3891. /* cancelled */
  3892. );
  3893. }
  3894. const leavingVNode = leavingVNodesCache[key];
  3895. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3896. leavingVNode.el[leaveCbKey]();
  3897. }
  3898. callHook(hook, [el]);
  3899. },
  3900. enter(el) {
  3901. if (!isHmrUpdating && leavingVNodesCache[key] === vnode) return;
  3902. let hook = onEnter;
  3903. let afterHook = onAfterEnter;
  3904. let cancelHook = onEnterCancelled;
  3905. if (!state.isMounted) {
  3906. if (appear) {
  3907. hook = onAppear || onEnter;
  3908. afterHook = onAfterAppear || onAfterEnter;
  3909. cancelHook = onAppearCancelled || onEnterCancelled;
  3910. } else {
  3911. return;
  3912. }
  3913. }
  3914. let called = false;
  3915. el[enterCbKey$1] = (cancelled) => {
  3916. if (called) return;
  3917. called = true;
  3918. if (cancelled) {
  3919. callHook(cancelHook, [el]);
  3920. } else {
  3921. callHook(afterHook, [el]);
  3922. }
  3923. if (hooks.delayedLeave) {
  3924. hooks.delayedLeave();
  3925. }
  3926. el[enterCbKey$1] = void 0;
  3927. };
  3928. const done = el[enterCbKey$1].bind(null, false);
  3929. if (hook) {
  3930. callAsyncHook(hook, [el, done]);
  3931. } else {
  3932. done();
  3933. }
  3934. },
  3935. leave(el, remove) {
  3936. const key2 = String(vnode.key);
  3937. if (el[enterCbKey$1]) {
  3938. el[enterCbKey$1](
  3939. true
  3940. /* cancelled */
  3941. );
  3942. }
  3943. if (state.isUnmounting) {
  3944. return remove();
  3945. }
  3946. callHook(onBeforeLeave, [el]);
  3947. let called = false;
  3948. el[leaveCbKey] = (cancelled) => {
  3949. if (called) return;
  3950. called = true;
  3951. remove();
  3952. if (cancelled) {
  3953. callHook(onLeaveCancelled, [el]);
  3954. } else {
  3955. callHook(onAfterLeave, [el]);
  3956. }
  3957. el[leaveCbKey] = void 0;
  3958. if (leavingVNodesCache[key2] === vnode) {
  3959. delete leavingVNodesCache[key2];
  3960. }
  3961. };
  3962. const done = el[leaveCbKey].bind(null, false);
  3963. leavingVNodesCache[key2] = vnode;
  3964. if (onLeave) {
  3965. callAsyncHook(onLeave, [el, done]);
  3966. } else {
  3967. done();
  3968. }
  3969. },
  3970. clone(vnode2) {
  3971. const hooks2 = resolveTransitionHooks(
  3972. vnode2,
  3973. props,
  3974. state,
  3975. instance,
  3976. postClone
  3977. );
  3978. if (postClone) postClone(hooks2);
  3979. return hooks2;
  3980. }
  3981. };
  3982. return hooks;
  3983. }
  3984. function emptyPlaceholder(vnode) {
  3985. if (isKeepAlive(vnode)) {
  3986. vnode = cloneVNode(vnode);
  3987. vnode.children = null;
  3988. return vnode;
  3989. }
  3990. }
  3991. function getInnerChild$1(vnode) {
  3992. if (!isKeepAlive(vnode)) {
  3993. if (isTeleport(vnode.type) && vnode.children) {
  3994. return findNonCommentChild(vnode.children);
  3995. }
  3996. return vnode;
  3997. }
  3998. if (vnode.component) {
  3999. return vnode.component.subTree;
  4000. }
  4001. const { shapeFlag, children } = vnode;
  4002. if (children) {
  4003. if (shapeFlag & 16) {
  4004. return children[0];
  4005. }
  4006. if (shapeFlag & 32 && isFunction(children.default)) {
  4007. return children.default();
  4008. }
  4009. }
  4010. }
  4011. function setTransitionHooks(vnode, hooks) {
  4012. if (vnode.shapeFlag & 6 && vnode.component) {
  4013. vnode.transition = hooks;
  4014. const subTree = vnode.component.subTree;
  4015. setTransitionHooks(
  4016. isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
  4017. hooks
  4018. );
  4019. } else if (vnode.shapeFlag & 128) {
  4020. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  4021. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  4022. } else {
  4023. vnode.transition = hooks;
  4024. }
  4025. }
  4026. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  4027. let ret = [];
  4028. let keyedFragmentCount = 0;
  4029. for (let i = 0; i < children.length; i++) {
  4030. let child = children[i];
  4031. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  4032. if (child.type === Fragment) {
  4033. if (child.patchFlag & 128) keyedFragmentCount++;
  4034. ret = ret.concat(
  4035. getTransitionRawChildren(child.children, keepComment, key)
  4036. );
  4037. } else if (keepComment || child.type !== Comment) {
  4038. ret.push(key != null ? cloneVNode(child, { key }) : child);
  4039. }
  4040. }
  4041. if (keyedFragmentCount > 1) {
  4042. for (let i = 0; i < ret.length; i++) {
  4043. ret[i].patchFlag = -2;
  4044. }
  4045. }
  4046. return ret;
  4047. }
  4048. // @__NO_SIDE_EFFECTS__
  4049. function defineComponent(options, extraOptions) {
  4050. return isFunction(options) ? (
  4051. // #8236: extend call and options.name access are considered side-effects
  4052. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  4053. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  4054. ) : options;
  4055. }
  4056. function useId() {
  4057. const i = getCurrentInstance();
  4058. if (i) {
  4059. return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
  4060. } else {
  4061. warn$1(
  4062. `useId() is called when there is no active component instance to be associated with.`
  4063. );
  4064. }
  4065. return "";
  4066. }
  4067. function markAsyncBoundary(instance) {
  4068. instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
  4069. }
  4070. const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
  4071. function useTemplateRef(key) {
  4072. const i = getCurrentInstance();
  4073. const r = shallowRef(null);
  4074. if (i) {
  4075. const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
  4076. if (isTemplateRefKey(refs, key)) {
  4077. warn$1(`useTemplateRef('${key}') already exists.`);
  4078. } else {
  4079. Object.defineProperty(refs, key, {
  4080. enumerable: true,
  4081. get: () => r.value,
  4082. set: (val) => r.value = val
  4083. });
  4084. }
  4085. } else {
  4086. warn$1(
  4087. `useTemplateRef() is called when there is no active component instance to be associated with.`
  4088. );
  4089. }
  4090. const ret = readonly(r) ;
  4091. {
  4092. knownTemplateRefs.add(ret);
  4093. }
  4094. return ret;
  4095. }
  4096. function isTemplateRefKey(refs, key) {
  4097. let desc;
  4098. return !!((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable);
  4099. }
  4100. const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
  4101. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  4102. if (isArray(rawRef)) {
  4103. rawRef.forEach(
  4104. (r, i) => setRef(
  4105. r,
  4106. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  4107. parentSuspense,
  4108. vnode,
  4109. isUnmount
  4110. )
  4111. );
  4112. return;
  4113. }
  4114. if (isAsyncWrapper(vnode) && !isUnmount) {
  4115. if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
  4116. setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
  4117. }
  4118. return;
  4119. }
  4120. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  4121. const value = isUnmount ? null : refValue;
  4122. const { i: owner, r: ref } = rawRef;
  4123. if (!owner) {
  4124. warn$1(
  4125. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  4126. );
  4127. return;
  4128. }
  4129. const oldRef = oldRawRef && oldRawRef.r;
  4130. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  4131. const setupState = owner.setupState;
  4132. const rawSetupState = toRaw(setupState);
  4133. const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
  4134. {
  4135. if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
  4136. warn$1(
  4137. `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
  4138. );
  4139. }
  4140. if (knownTemplateRefs.has(rawSetupState[key])) {
  4141. return false;
  4142. }
  4143. }
  4144. if (isTemplateRefKey(refs, key)) {
  4145. return false;
  4146. }
  4147. return hasOwn(rawSetupState, key);
  4148. };
  4149. const canSetRef = (ref2, key) => {
  4150. if (knownTemplateRefs.has(ref2)) {
  4151. return false;
  4152. }
  4153. if (key && isTemplateRefKey(refs, key)) {
  4154. return false;
  4155. }
  4156. return true;
  4157. };
  4158. if (oldRef != null && oldRef !== ref) {
  4159. invalidatePendingSetRef(oldRawRef);
  4160. if (isString(oldRef)) {
  4161. refs[oldRef] = null;
  4162. if (canSetSetupRef(oldRef)) {
  4163. setupState[oldRef] = null;
  4164. }
  4165. } else if (isRef(oldRef)) {
  4166. const oldRawRefAtom = oldRawRef;
  4167. if (canSetRef(oldRef, oldRawRefAtom.k)) {
  4168. oldRef.value = null;
  4169. }
  4170. if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
  4171. }
  4172. }
  4173. if (isFunction(ref)) {
  4174. callWithErrorHandling(ref, owner, 12, [value, refs]);
  4175. } else {
  4176. const _isString = isString(ref);
  4177. const _isRef = isRef(ref);
  4178. if (_isString || _isRef) {
  4179. const doSet = () => {
  4180. if (rawRef.f) {
  4181. const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
  4182. if (isUnmount) {
  4183. isArray(existing) && remove(existing, refValue);
  4184. } else {
  4185. if (!isArray(existing)) {
  4186. if (_isString) {
  4187. refs[ref] = [refValue];
  4188. if (canSetSetupRef(ref)) {
  4189. setupState[ref] = refs[ref];
  4190. }
  4191. } else {
  4192. const newVal = [refValue];
  4193. if (canSetRef(ref, rawRef.k)) {
  4194. ref.value = newVal;
  4195. }
  4196. if (rawRef.k) refs[rawRef.k] = newVal;
  4197. }
  4198. } else if (!existing.includes(refValue)) {
  4199. existing.push(refValue);
  4200. }
  4201. }
  4202. } else if (_isString) {
  4203. refs[ref] = value;
  4204. if (canSetSetupRef(ref)) {
  4205. setupState[ref] = value;
  4206. }
  4207. } else if (_isRef) {
  4208. if (canSetRef(ref, rawRef.k)) {
  4209. ref.value = value;
  4210. }
  4211. if (rawRef.k) refs[rawRef.k] = value;
  4212. } else {
  4213. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4214. }
  4215. };
  4216. if (value) {
  4217. const job = () => {
  4218. doSet();
  4219. pendingSetRefMap.delete(rawRef);
  4220. };
  4221. job.id = -1;
  4222. pendingSetRefMap.set(rawRef, job);
  4223. queuePostRenderEffect(job, parentSuspense);
  4224. } else {
  4225. invalidatePendingSetRef(rawRef);
  4226. doSet();
  4227. }
  4228. } else {
  4229. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4230. }
  4231. }
  4232. }
  4233. function invalidatePendingSetRef(rawRef) {
  4234. const pendingSetRef = pendingSetRefMap.get(rawRef);
  4235. if (pendingSetRef) {
  4236. pendingSetRef.flags |= 8;
  4237. pendingSetRefMap.delete(rawRef);
  4238. }
  4239. }
  4240. let hasLoggedMismatchError = false;
  4241. const logMismatchError = () => {
  4242. if (hasLoggedMismatchError) {
  4243. return;
  4244. }
  4245. console.error("Hydration completed but contains mismatches.");
  4246. hasLoggedMismatchError = true;
  4247. };
  4248. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  4249. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  4250. const getContainerType = (container) => {
  4251. if (container.nodeType !== 1) return void 0;
  4252. if (isSVGContainer(container)) return "svg";
  4253. if (isMathMLContainer(container)) return "mathml";
  4254. return void 0;
  4255. };
  4256. const isComment = (node) => node.nodeType === 8;
  4257. function createHydrationFunctions(rendererInternals) {
  4258. const {
  4259. mt: mountComponent,
  4260. p: patch,
  4261. o: {
  4262. patchProp,
  4263. createText,
  4264. nextSibling,
  4265. parentNode,
  4266. remove,
  4267. insert,
  4268. createComment
  4269. }
  4270. } = rendererInternals;
  4271. const hydrate = (vnode, container) => {
  4272. if (!container.hasChildNodes()) {
  4273. warn$1(
  4274. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  4275. );
  4276. patch(null, vnode, container);
  4277. flushPostFlushCbs();
  4278. container._vnode = vnode;
  4279. return;
  4280. }
  4281. hydrateNode(container.firstChild, vnode, null, null, null);
  4282. flushPostFlushCbs();
  4283. container._vnode = vnode;
  4284. };
  4285. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  4286. optimized = optimized || !!vnode.dynamicChildren;
  4287. const isFragmentStart = isComment(node) && node.data === "[";
  4288. const onMismatch = () => handleMismatch(
  4289. node,
  4290. vnode,
  4291. parentComponent,
  4292. parentSuspense,
  4293. slotScopeIds,
  4294. isFragmentStart
  4295. );
  4296. const { type, ref, shapeFlag, patchFlag } = vnode;
  4297. let domType = node.nodeType;
  4298. vnode.el = node;
  4299. {
  4300. def(node, "__vnode", vnode, true);
  4301. def(node, "__vueParentComponent", parentComponent, true);
  4302. }
  4303. if (patchFlag === -2) {
  4304. optimized = false;
  4305. vnode.dynamicChildren = null;
  4306. }
  4307. let nextNode = null;
  4308. switch (type) {
  4309. case Text:
  4310. if (domType !== 3) {
  4311. if (vnode.children === "") {
  4312. insert(vnode.el = createText(""), parentNode(node), node);
  4313. nextNode = node;
  4314. } else {
  4315. nextNode = onMismatch();
  4316. }
  4317. } else {
  4318. if (node.data !== vnode.children) {
  4319. warn$1(
  4320. `Hydration text mismatch in`,
  4321. node.parentNode,
  4322. `
  4323. - rendered on server: ${JSON.stringify(
  4324. node.data
  4325. )}
  4326. - expected on client: ${JSON.stringify(vnode.children)}`
  4327. );
  4328. logMismatchError();
  4329. node.data = vnode.children;
  4330. }
  4331. nextNode = nextSibling(node);
  4332. }
  4333. break;
  4334. case Comment:
  4335. if (isTemplateNode(node)) {
  4336. nextNode = nextSibling(node);
  4337. replaceNode(
  4338. vnode.el = node.content.firstChild,
  4339. node,
  4340. parentComponent
  4341. );
  4342. } else if (domType !== 8 || isFragmentStart) {
  4343. nextNode = onMismatch();
  4344. } else {
  4345. nextNode = nextSibling(node);
  4346. }
  4347. break;
  4348. case Static:
  4349. if (isFragmentStart) {
  4350. node = nextSibling(node);
  4351. domType = node.nodeType;
  4352. }
  4353. if (domType === 1 || domType === 3) {
  4354. nextNode = node;
  4355. const needToAdoptContent = !vnode.children.length;
  4356. for (let i = 0; i < vnode.staticCount; i++) {
  4357. if (needToAdoptContent)
  4358. vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
  4359. if (i === vnode.staticCount - 1) {
  4360. vnode.anchor = nextNode;
  4361. }
  4362. nextNode = nextSibling(nextNode);
  4363. }
  4364. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  4365. } else {
  4366. onMismatch();
  4367. }
  4368. break;
  4369. case Fragment:
  4370. if (!isFragmentStart) {
  4371. nextNode = onMismatch();
  4372. } else {
  4373. nextNode = hydrateFragment(
  4374. node,
  4375. vnode,
  4376. parentComponent,
  4377. parentSuspense,
  4378. slotScopeIds,
  4379. optimized
  4380. );
  4381. }
  4382. break;
  4383. default:
  4384. if (shapeFlag & 1) {
  4385. if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  4386. nextNode = onMismatch();
  4387. } else {
  4388. nextNode = hydrateElement(
  4389. node,
  4390. vnode,
  4391. parentComponent,
  4392. parentSuspense,
  4393. slotScopeIds,
  4394. optimized
  4395. );
  4396. }
  4397. } else if (shapeFlag & 6) {
  4398. vnode.slotScopeIds = slotScopeIds;
  4399. const container = parentNode(node);
  4400. if (isFragmentStart) {
  4401. nextNode = locateClosingAnchor(node);
  4402. } else if (isComment(node) && node.data === "teleport start") {
  4403. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  4404. } else {
  4405. nextNode = nextSibling(node);
  4406. }
  4407. mountComponent(
  4408. vnode,
  4409. container,
  4410. null,
  4411. parentComponent,
  4412. parentSuspense,
  4413. getContainerType(container),
  4414. optimized
  4415. );
  4416. if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
  4417. let subTree;
  4418. if (isFragmentStart) {
  4419. subTree = createVNode(Static);
  4420. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  4421. } else {
  4422. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
  4423. node.nodeType === 8 ? Comment : "div"
  4424. );
  4425. }
  4426. subTree.el = node;
  4427. vnode.component.subTree = subTree;
  4428. }
  4429. } else if (shapeFlag & 64) {
  4430. if (domType !== 8) {
  4431. nextNode = onMismatch();
  4432. } else {
  4433. nextNode = vnode.type.hydrate(
  4434. node,
  4435. vnode,
  4436. parentComponent,
  4437. parentSuspense,
  4438. slotScopeIds,
  4439. optimized,
  4440. rendererInternals,
  4441. hydrateChildren
  4442. );
  4443. }
  4444. } else if (shapeFlag & 128) {
  4445. nextNode = vnode.type.hydrate(
  4446. node,
  4447. vnode,
  4448. parentComponent,
  4449. parentSuspense,
  4450. getContainerType(parentNode(node)),
  4451. slotScopeIds,
  4452. optimized,
  4453. rendererInternals,
  4454. hydrateNode
  4455. );
  4456. } else {
  4457. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  4458. }
  4459. }
  4460. if (ref != null) {
  4461. setRef(ref, null, parentSuspense, vnode);
  4462. }
  4463. return nextNode;
  4464. };
  4465. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4466. optimized = optimized || !!vnode.dynamicChildren;
  4467. const {
  4468. type,
  4469. dynamicProps,
  4470. props,
  4471. patchFlag,
  4472. shapeFlag,
  4473. dirs,
  4474. transition
  4475. } = vnode;
  4476. const forcePatch = type === "input" || type === "option";
  4477. {
  4478. if (dirs) {
  4479. invokeDirectiveHook(vnode, null, parentComponent, "created");
  4480. }
  4481. let needCallTransitionHooks = false;
  4482. if (isTemplateNode(el)) {
  4483. needCallTransitionHooks = needTransition(
  4484. null,
  4485. // no need check parentSuspense in hydration
  4486. transition
  4487. ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  4488. const content = el.content.firstChild;
  4489. if (needCallTransitionHooks) {
  4490. const cls = content.getAttribute("class");
  4491. if (cls) content.$cls = cls;
  4492. transition.beforeEnter(content);
  4493. }
  4494. replaceNode(content, el, parentComponent);
  4495. vnode.el = el = content;
  4496. }
  4497. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  4498. !(props && (props.innerHTML || props.textContent))) {
  4499. let next = hydrateChildren(
  4500. el.firstChild,
  4501. vnode,
  4502. el,
  4503. parentComponent,
  4504. parentSuspense,
  4505. slotScopeIds,
  4506. optimized
  4507. );
  4508. if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
  4509. warn$1(
  4510. `Hydration children mismatch on`,
  4511. el,
  4512. `
  4513. Server rendered element contains more child nodes than client vdom.`
  4514. );
  4515. logMismatchError();
  4516. }
  4517. while (next) {
  4518. const cur = next;
  4519. next = next.nextSibling;
  4520. remove(cur);
  4521. }
  4522. } else if (shapeFlag & 8) {
  4523. let clientText = vnode.children;
  4524. if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
  4525. clientText = clientText.slice(1);
  4526. }
  4527. const { textContent } = el;
  4528. if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
  4529. textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
  4530. if (!isMismatchAllowed(el, 0 /* TEXT */)) {
  4531. warn$1(
  4532. `Hydration text content mismatch on`,
  4533. el,
  4534. `
  4535. - rendered on server: ${textContent}
  4536. - expected on client: ${clientText}`
  4537. );
  4538. logMismatchError();
  4539. }
  4540. el.textContent = vnode.children;
  4541. }
  4542. }
  4543. if (props) {
  4544. {
  4545. const isCustomElement = el.tagName.includes("-");
  4546. const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
  4547. for (const key in props) {
  4548. if (// #11189 skip if this node has directives that have created hooks
  4549. // as it could have mutated the DOM in any possible way
  4550. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  4551. logMismatchError();
  4552. }
  4553. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  4554. key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
  4555. if (isUnchangedResourceProp(el, key, props[key])) {
  4556. continue;
  4557. }
  4558. patchProp(el, key, null, props[key], namespace, parentComponent);
  4559. }
  4560. }
  4561. }
  4562. }
  4563. let vnodeHooks;
  4564. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  4565. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4566. }
  4567. if (dirs) {
  4568. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4569. }
  4570. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  4571. queueEffectWithSuspense(() => {
  4572. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4573. needCallTransitionHooks && transition.enter(el);
  4574. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4575. }, parentSuspense);
  4576. }
  4577. }
  4578. return el.nextSibling;
  4579. };
  4580. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4581. optimized = optimized || !!parentVNode.dynamicChildren;
  4582. const children = parentVNode.children;
  4583. const l = children.length;
  4584. let hasCheckedMismatch = false;
  4585. for (let i = 0; i < l; i++) {
  4586. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  4587. const isText = vnode.type === Text;
  4588. if (node) {
  4589. if (isText && !optimized) {
  4590. if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
  4591. insert(
  4592. createText(
  4593. node.data.slice(vnode.children.length)
  4594. ),
  4595. container,
  4596. nextSibling(node)
  4597. );
  4598. node.data = vnode.children;
  4599. }
  4600. }
  4601. node = hydrateNode(
  4602. node,
  4603. vnode,
  4604. parentComponent,
  4605. parentSuspense,
  4606. slotScopeIds,
  4607. optimized
  4608. );
  4609. } else if (isText && !vnode.children) {
  4610. insert(vnode.el = createText(""), container);
  4611. } else {
  4612. if (!hasCheckedMismatch) {
  4613. hasCheckedMismatch = true;
  4614. if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
  4615. warn$1(
  4616. `Hydration children mismatch on`,
  4617. container,
  4618. `
  4619. Server rendered element contains fewer child nodes than client vdom.`
  4620. );
  4621. logMismatchError();
  4622. }
  4623. }
  4624. patch(
  4625. null,
  4626. vnode,
  4627. container,
  4628. null,
  4629. parentComponent,
  4630. parentSuspense,
  4631. getContainerType(container),
  4632. slotScopeIds
  4633. );
  4634. }
  4635. }
  4636. return node;
  4637. };
  4638. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4639. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  4640. if (fragmentSlotScopeIds) {
  4641. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4642. }
  4643. const container = parentNode(node);
  4644. const next = hydrateChildren(
  4645. nextSibling(node),
  4646. vnode,
  4647. container,
  4648. parentComponent,
  4649. parentSuspense,
  4650. slotScopeIds,
  4651. optimized
  4652. );
  4653. if (next && isComment(next) && next.data === "]") {
  4654. return nextSibling(vnode.anchor = next);
  4655. } else {
  4656. logMismatchError();
  4657. insert(vnode.anchor = createComment(`]`), container, next);
  4658. return next;
  4659. }
  4660. };
  4661. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  4662. if (!isNodeMismatchAllowed(node, vnode)) {
  4663. warn$1(
  4664. `Hydration node mismatch:
  4665. - rendered on server:`,
  4666. node,
  4667. node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  4668. `
  4669. - expected on client:`,
  4670. vnode.type
  4671. );
  4672. logMismatchError();
  4673. }
  4674. vnode.el = null;
  4675. if (isFragment) {
  4676. const end = locateClosingAnchor(node);
  4677. while (true) {
  4678. const next2 = nextSibling(node);
  4679. if (next2 && next2 !== end) {
  4680. remove(next2);
  4681. } else {
  4682. break;
  4683. }
  4684. }
  4685. }
  4686. const next = nextSibling(node);
  4687. const container = parentNode(node);
  4688. remove(node);
  4689. patch(
  4690. null,
  4691. vnode,
  4692. container,
  4693. next,
  4694. parentComponent,
  4695. parentSuspense,
  4696. getContainerType(container),
  4697. slotScopeIds
  4698. );
  4699. if (parentComponent) {
  4700. parentComponent.vnode.el = vnode.el;
  4701. updateHOCHostEl(parentComponent, vnode.el);
  4702. }
  4703. return next;
  4704. };
  4705. const locateClosingAnchor = (node, open = "[", close = "]") => {
  4706. let match = 0;
  4707. while (node) {
  4708. node = nextSibling(node);
  4709. if (node && isComment(node)) {
  4710. if (node.data === open) match++;
  4711. if (node.data === close) {
  4712. if (match === 0) {
  4713. return nextSibling(node);
  4714. } else {
  4715. match--;
  4716. }
  4717. }
  4718. }
  4719. }
  4720. return node;
  4721. };
  4722. const replaceNode = (newNode, oldNode, parentComponent) => {
  4723. const parentNode2 = oldNode.parentNode;
  4724. if (parentNode2) {
  4725. parentNode2.replaceChild(newNode, oldNode);
  4726. }
  4727. let parent = parentComponent;
  4728. while (parent) {
  4729. if (parent.vnode.el === oldNode) {
  4730. parent.vnode.el = parent.subTree.el = newNode;
  4731. }
  4732. parent = parent.parent;
  4733. }
  4734. };
  4735. const isTemplateNode = (node) => {
  4736. return node.nodeType === 1 && node.tagName === "TEMPLATE";
  4737. };
  4738. return [hydrate, hydrateNode];
  4739. }
  4740. const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
  4741. function isUnchangedResourceProp(el, key, clientValue) {
  4742. if (!resourceProps.has(key)) {
  4743. return false;
  4744. }
  4745. return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
  4746. }
  4747. function propHasMismatch(el, key, clientValue, vnode, instance) {
  4748. let mismatchType;
  4749. let mismatchKey;
  4750. let actual;
  4751. let expected;
  4752. if (key === "class") {
  4753. if (el.$cls) {
  4754. actual = el.$cls;
  4755. delete el.$cls;
  4756. } else {
  4757. actual = el.getAttribute("class");
  4758. }
  4759. expected = normalizeClass(clientValue);
  4760. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  4761. mismatchType = 2 /* CLASS */;
  4762. mismatchKey = `class`;
  4763. }
  4764. } else if (key === "style") {
  4765. actual = el.getAttribute("style") || "";
  4766. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  4767. const actualMap = toStyleMap(actual);
  4768. const expectedMap = toStyleMap(expected);
  4769. if (vnode.dirs) {
  4770. for (const { dir, value } of vnode.dirs) {
  4771. if (dir.name === "show" && !value) {
  4772. expectedMap.set("display", "none");
  4773. }
  4774. }
  4775. }
  4776. if (instance) {
  4777. resolveCssVars(instance, vnode, expectedMap);
  4778. }
  4779. if (!isMapEqual(actualMap, expectedMap)) {
  4780. mismatchType = 3 /* STYLE */;
  4781. mismatchKey = "style";
  4782. }
  4783. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  4784. if (key === "hidden") {
  4785. actual = normalizeHiddenValue(el.getAttribute(key));
  4786. expected = normalizeHiddenValue(clientValue);
  4787. } else if (isBooleanAttr(key)) {
  4788. actual = el.hasAttribute(key);
  4789. expected = includeBooleanAttr(clientValue);
  4790. } else if (clientValue == null) {
  4791. actual = el.hasAttribute(key);
  4792. expected = false;
  4793. } else {
  4794. if (el.hasAttribute(key)) {
  4795. actual = el.getAttribute(key);
  4796. } else if (key === "value" && el.tagName === "TEXTAREA") {
  4797. actual = el.value;
  4798. } else {
  4799. actual = false;
  4800. }
  4801. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  4802. }
  4803. if (actual !== expected) {
  4804. mismatchType = 4 /* ATTRIBUTE */;
  4805. mismatchKey = key;
  4806. }
  4807. }
  4808. if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
  4809. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  4810. const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
  4811. const postSegment = `
  4812. - rendered on server: ${format(actual)}
  4813. - expected on client: ${format(expected)}
  4814. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  4815. You should fix the source of the mismatch.`;
  4816. {
  4817. warn$1(preSegment, el, postSegment);
  4818. }
  4819. return true;
  4820. }
  4821. return false;
  4822. }
  4823. function normalizeHiddenValue(value) {
  4824. if (!isRenderableAttrValue(value)) {
  4825. return false;
  4826. }
  4827. if (isString(value)) {
  4828. return value.toLowerCase() === "until-found" ? "until-found" : "";
  4829. }
  4830. return includeBooleanAttr(value) ? "" : false;
  4831. }
  4832. function toClassSet(str) {
  4833. return new Set(str.trim().split(/\s+/));
  4834. }
  4835. function isSetEqual(a, b) {
  4836. if (a.size !== b.size) {
  4837. return false;
  4838. }
  4839. for (const s of a) {
  4840. if (!b.has(s)) {
  4841. return false;
  4842. }
  4843. }
  4844. return true;
  4845. }
  4846. function toStyleMap(str) {
  4847. const styleMap = /* @__PURE__ */ new Map();
  4848. for (const item of str.split(";")) {
  4849. let [key, value] = item.split(":");
  4850. key = key.trim();
  4851. value = value && value.trim();
  4852. if (key && value) {
  4853. styleMap.set(key, value);
  4854. }
  4855. }
  4856. return styleMap;
  4857. }
  4858. function isMapEqual(a, b) {
  4859. if (a.size !== b.size) {
  4860. return false;
  4861. }
  4862. for (const [key, value] of a) {
  4863. if (value !== b.get(key)) {
  4864. return false;
  4865. }
  4866. }
  4867. return true;
  4868. }
  4869. function resolveCssVars(instance, vnode, expectedMap) {
  4870. const root = instance.subTree;
  4871. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  4872. const cssVars = instance.getCssVars();
  4873. for (const key in cssVars) {
  4874. const value = normalizeCssVarValue(cssVars[key]);
  4875. expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
  4876. }
  4877. }
  4878. if (vnode === root && instance.parent) {
  4879. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  4880. }
  4881. }
  4882. const allowMismatchAttr = "data-allow-mismatch";
  4883. const MismatchTypeString = {
  4884. [0 /* TEXT */]: "text",
  4885. [1 /* CHILDREN */]: "children",
  4886. [2 /* CLASS */]: "class",
  4887. [3 /* STYLE */]: "style",
  4888. [4 /* ATTRIBUTE */]: "attribute"
  4889. };
  4890. function isMismatchAllowed(el, allowedType) {
  4891. if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
  4892. while (el && !el.hasAttribute(allowMismatchAttr)) {
  4893. el = el.parentElement;
  4894. }
  4895. }
  4896. return isMismatchAllowedByAttr(
  4897. el && el.getAttribute(allowMismatchAttr),
  4898. allowedType
  4899. );
  4900. }
  4901. function isMismatchAllowedByAttr(allowedAttr, allowedType) {
  4902. if (allowedAttr == null) {
  4903. return false;
  4904. } else if (allowedAttr === "") {
  4905. return true;
  4906. } else {
  4907. const list = allowedAttr.split(",");
  4908. if (allowedType === 0 /* TEXT */ && list.includes("children")) {
  4909. return true;
  4910. }
  4911. return list.includes(MismatchTypeString[allowedType]);
  4912. }
  4913. }
  4914. function isNodeMismatchAllowed(node, vnode) {
  4915. return isMismatchAllowed(node.parentElement, 1 /* CHILDREN */) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
  4916. }
  4917. function isMismatchAllowedByNode(node) {
  4918. return node.nodeType === 1 && isMismatchAllowedByAttr(
  4919. node.getAttribute(allowMismatchAttr),
  4920. 1 /* CHILDREN */
  4921. );
  4922. }
  4923. function isMismatchAllowedByVNode({ props }) {
  4924. const allowedAttr = props && props[allowMismatchAttr];
  4925. return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1 /* CHILDREN */);
  4926. }
  4927. const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
  4928. const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
  4929. const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
  4930. const id = requestIdleCallback(hydrate, { timeout });
  4931. return () => cancelIdleCallback(id);
  4932. };
  4933. function elementIsVisibleInViewport(el) {
  4934. const { top, left, bottom, right } = el.getBoundingClientRect();
  4935. const { innerHeight, innerWidth } = window;
  4936. return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
  4937. }
  4938. const hydrateOnVisible = (opts) => (hydrate, forEach) => {
  4939. const ob = new IntersectionObserver((entries) => {
  4940. for (const e of entries) {
  4941. if (!e.isIntersecting) continue;
  4942. ob.disconnect();
  4943. hydrate();
  4944. break;
  4945. }
  4946. }, opts);
  4947. forEach((el) => {
  4948. if (!(el instanceof Element)) return;
  4949. if (elementIsVisibleInViewport(el)) {
  4950. hydrate();
  4951. ob.disconnect();
  4952. return false;
  4953. }
  4954. ob.observe(el);
  4955. });
  4956. return () => ob.disconnect();
  4957. };
  4958. const hydrateOnMediaQuery = (query) => (hydrate) => {
  4959. if (query) {
  4960. const mql = matchMedia(query);
  4961. if (mql.matches) {
  4962. hydrate();
  4963. } else {
  4964. mql.addEventListener("change", hydrate, { once: true });
  4965. return () => mql.removeEventListener("change", hydrate);
  4966. }
  4967. }
  4968. };
  4969. const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
  4970. if (isString(interactions)) interactions = [interactions];
  4971. let hasHydrated = false;
  4972. const doHydrate = (e) => {
  4973. if (!hasHydrated) {
  4974. hasHydrated = true;
  4975. teardown();
  4976. hydrate();
  4977. e.target.dispatchEvent(new e.constructor(e.type, e));
  4978. }
  4979. };
  4980. const teardown = () => {
  4981. forEach((el) => {
  4982. for (const i of interactions) {
  4983. el.removeEventListener(i, doHydrate);
  4984. }
  4985. });
  4986. };
  4987. forEach((el) => {
  4988. for (const i of interactions) {
  4989. el.addEventListener(i, doHydrate, { once: true });
  4990. }
  4991. });
  4992. return teardown;
  4993. };
  4994. function forEachElement(node, cb) {
  4995. if (isComment(node) && node.data === "[") {
  4996. let depth = 1;
  4997. let next = node.nextSibling;
  4998. while (next) {
  4999. if (next.nodeType === 1) {
  5000. const result = cb(next);
  5001. if (result === false) {
  5002. break;
  5003. }
  5004. } else if (isComment(next)) {
  5005. if (next.data === "]") {
  5006. if (--depth === 0) break;
  5007. } else if (next.data === "[") {
  5008. depth++;
  5009. }
  5010. }
  5011. next = next.nextSibling;
  5012. }
  5013. } else {
  5014. cb(node);
  5015. }
  5016. }
  5017. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  5018. // @__NO_SIDE_EFFECTS__
  5019. function defineAsyncComponent(source) {
  5020. if (isFunction(source)) {
  5021. source = { loader: source };
  5022. }
  5023. const {
  5024. loader,
  5025. loadingComponent,
  5026. errorComponent,
  5027. delay = 200,
  5028. hydrate: hydrateStrategy,
  5029. timeout,
  5030. // undefined = never times out
  5031. suspensible = true,
  5032. onError: userOnError
  5033. } = source;
  5034. let pendingRequest = null;
  5035. let resolvedComp;
  5036. let retries = 0;
  5037. const retry = () => {
  5038. retries++;
  5039. pendingRequest = null;
  5040. return load();
  5041. };
  5042. const load = () => {
  5043. let thisRequest;
  5044. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  5045. err = err instanceof Error ? err : new Error(String(err));
  5046. if (userOnError) {
  5047. return new Promise((resolve, reject) => {
  5048. const userRetry = () => resolve(retry());
  5049. const userFail = () => reject(err);
  5050. userOnError(err, userRetry, userFail, retries + 1);
  5051. });
  5052. } else {
  5053. throw err;
  5054. }
  5055. }).then((comp) => {
  5056. if (thisRequest !== pendingRequest && pendingRequest) {
  5057. return pendingRequest;
  5058. }
  5059. if (!comp) {
  5060. warn$1(
  5061. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  5062. );
  5063. }
  5064. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  5065. comp = comp.default;
  5066. }
  5067. if (comp && !isObject(comp) && !isFunction(comp)) {
  5068. throw new Error(`Invalid async component load result: ${comp}`);
  5069. }
  5070. resolvedComp = comp;
  5071. return comp;
  5072. }));
  5073. };
  5074. return defineComponent({
  5075. name: "AsyncComponentWrapper",
  5076. __asyncLoader: load,
  5077. __asyncHydrate(el, instance, hydrate) {
  5078. const wasConnected = el.isConnected;
  5079. let patched = false;
  5080. (instance.bu || (instance.bu = [])).push(() => patched = true);
  5081. const performHydrate = () => {
  5082. if (patched) {
  5083. {
  5084. warn$1(
  5085. `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
  5086. );
  5087. }
  5088. return;
  5089. }
  5090. if (!el.parentNode || wasConnected && !el.isConnected) return;
  5091. hydrate();
  5092. };
  5093. const doHydrate = hydrateStrategy ? () => {
  5094. const teardown = hydrateStrategy(
  5095. performHydrate,
  5096. (cb) => forEachElement(el, cb)
  5097. );
  5098. if (teardown) {
  5099. (instance.bum || (instance.bum = [])).push(teardown);
  5100. }
  5101. } : performHydrate;
  5102. if (resolvedComp) {
  5103. doHydrate();
  5104. } else {
  5105. load().then(() => !instance.isUnmounted && doHydrate());
  5106. }
  5107. },
  5108. get __asyncResolved() {
  5109. return resolvedComp;
  5110. },
  5111. setup() {
  5112. const instance = currentInstance;
  5113. markAsyncBoundary(instance);
  5114. if (resolvedComp) {
  5115. return () => createInnerComp(resolvedComp, instance);
  5116. }
  5117. const onError = (err) => {
  5118. pendingRequest = null;
  5119. handleError(
  5120. err,
  5121. instance,
  5122. 13,
  5123. !errorComponent
  5124. );
  5125. };
  5126. if (suspensible && instance.suspense || isInSSRComponentSetup) {
  5127. return load().then((comp) => {
  5128. return () => createInnerComp(comp, instance);
  5129. }).catch((err) => {
  5130. onError(err);
  5131. return () => errorComponent ? createVNode(errorComponent, {
  5132. error: err
  5133. }) : null;
  5134. });
  5135. }
  5136. const loaded = ref(false);
  5137. const error = ref();
  5138. const delayed = ref(!!delay);
  5139. let timeoutTimer;
  5140. let delayTimer;
  5141. onUnmounted(() => {
  5142. if (timeoutTimer != null) clearTimeout(timeoutTimer);
  5143. if (delayTimer != null) clearTimeout(delayTimer);
  5144. });
  5145. if (delay) {
  5146. delayTimer = setTimeout(() => {
  5147. if (instance.isUnmounted) return;
  5148. delayed.value = false;
  5149. }, delay);
  5150. }
  5151. if (timeout != null) {
  5152. timeoutTimer = setTimeout(() => {
  5153. if (instance.isUnmounted) return;
  5154. if (!loaded.value && !error.value) {
  5155. const err = new Error(
  5156. `Async component timed out after ${timeout}ms.`
  5157. );
  5158. onError(err);
  5159. error.value = err;
  5160. }
  5161. }, timeout);
  5162. }
  5163. load().then(() => {
  5164. if (instance.isUnmounted) return;
  5165. loaded.value = true;
  5166. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  5167. instance.parent.update();
  5168. }
  5169. }).catch((err) => {
  5170. if (instance.isUnmounted) {
  5171. pendingRequest = null;
  5172. return;
  5173. }
  5174. onError(err);
  5175. error.value = err;
  5176. });
  5177. return () => {
  5178. if (loaded.value && resolvedComp) {
  5179. return createInnerComp(resolvedComp, instance);
  5180. } else if (error.value && errorComponent) {
  5181. return createVNode(errorComponent, {
  5182. error: error.value
  5183. });
  5184. } else if (loadingComponent && !delayed.value) {
  5185. return createInnerComp(
  5186. loadingComponent,
  5187. instance
  5188. );
  5189. }
  5190. };
  5191. }
  5192. });
  5193. }
  5194. function createInnerComp(comp, parent) {
  5195. const { ref: ref2, props, children, ce } = parent.vnode;
  5196. const vnode = createVNode(comp, props, children);
  5197. vnode.ref = ref2;
  5198. vnode.ce = ce;
  5199. delete parent.vnode.ce;
  5200. return vnode;
  5201. }
  5202. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  5203. const KeepAliveImpl = {
  5204. name: `KeepAlive`,
  5205. // Marker for special handling inside the renderer. We are not using a ===
  5206. // check directly on KeepAlive in the renderer, because importing it directly
  5207. // would prevent it from being tree-shaken.
  5208. __isKeepAlive: true,
  5209. props: {
  5210. include: [String, RegExp, Array],
  5211. exclude: [String, RegExp, Array],
  5212. max: [String, Number]
  5213. },
  5214. setup(props, { slots }) {
  5215. const instance = getCurrentInstance();
  5216. const sharedContext = instance.ctx;
  5217. if (!sharedContext.renderer) {
  5218. return () => {
  5219. const children = slots.default && slots.default();
  5220. return children && children.length === 1 ? children[0] : children;
  5221. };
  5222. }
  5223. const cache = /* @__PURE__ */ new Map();
  5224. const keys = /* @__PURE__ */ new Set();
  5225. let current = null;
  5226. {
  5227. instance.__v_cache = cache;
  5228. }
  5229. const parentSuspense = instance.suspense;
  5230. const {
  5231. renderer: {
  5232. p: patch,
  5233. m: move,
  5234. um: _unmount,
  5235. o: { createElement }
  5236. }
  5237. } = sharedContext;
  5238. const storageContainer = createElement("div");
  5239. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  5240. const instance2 = vnode.component;
  5241. move(vnode, container, anchor, 0, parentSuspense);
  5242. patch(
  5243. instance2.vnode,
  5244. vnode,
  5245. container,
  5246. anchor,
  5247. instance2,
  5248. parentSuspense,
  5249. namespace,
  5250. vnode.slotScopeIds,
  5251. optimized
  5252. );
  5253. queuePostRenderEffect(() => {
  5254. instance2.isDeactivated = false;
  5255. if (instance2.a) {
  5256. invokeArrayFns(instance2.a);
  5257. }
  5258. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  5259. if (vnodeHook) {
  5260. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  5261. }
  5262. }, parentSuspense);
  5263. {
  5264. devtoolsComponentAdded(instance2);
  5265. }
  5266. };
  5267. sharedContext.deactivate = (vnode) => {
  5268. const instance2 = vnode.component;
  5269. invalidateMount(instance2.m);
  5270. invalidateMount(instance2.a);
  5271. move(vnode, storageContainer, null, 1, parentSuspense);
  5272. queuePostRenderEffect(() => {
  5273. if (instance2.da) {
  5274. invokeArrayFns(instance2.da);
  5275. }
  5276. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  5277. if (vnodeHook) {
  5278. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  5279. }
  5280. instance2.isDeactivated = true;
  5281. }, parentSuspense);
  5282. {
  5283. devtoolsComponentAdded(instance2);
  5284. }
  5285. {
  5286. instance2.__keepAliveStorageContainer = storageContainer;
  5287. }
  5288. };
  5289. function unmount(vnode) {
  5290. resetShapeFlag(vnode);
  5291. _unmount(vnode, instance, parentSuspense, true);
  5292. }
  5293. function pruneCache(filter) {
  5294. cache.forEach((vnode, key) => {
  5295. const name = getComponentName(
  5296. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : vnode.type
  5297. );
  5298. if (name && !filter(name)) {
  5299. pruneCacheEntry(key);
  5300. }
  5301. });
  5302. }
  5303. function pruneCacheEntry(key) {
  5304. const cached = cache.get(key);
  5305. if (cached && (!current || !isSameVNodeType(cached, current))) {
  5306. unmount(cached);
  5307. } else if (current) {
  5308. resetShapeFlag(current);
  5309. }
  5310. cache.delete(key);
  5311. keys.delete(key);
  5312. }
  5313. watch(
  5314. () => [props.include, props.exclude],
  5315. ([include, exclude]) => {
  5316. include && pruneCache((name) => matches(include, name));
  5317. exclude && pruneCache((name) => !matches(exclude, name));
  5318. },
  5319. // prune post-render after `current` has been updated
  5320. { flush: "post", deep: true }
  5321. );
  5322. let pendingCacheKey = null;
  5323. const cacheSubtree = () => {
  5324. if (pendingCacheKey != null) {
  5325. if (isSuspense(instance.subTree.type)) {
  5326. queuePostRenderEffect(() => {
  5327. const vnode = getInnerChild(instance.subTree);
  5328. if (vnode.component) {
  5329. cache.set(pendingCacheKey, vnode);
  5330. }
  5331. }, instance.subTree.suspense);
  5332. } else {
  5333. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  5334. }
  5335. }
  5336. };
  5337. onMounted(cacheSubtree);
  5338. onUpdated(cacheSubtree);
  5339. onBeforeUnmount(() => {
  5340. cache.forEach((cached) => {
  5341. const { subTree, suspense } = instance;
  5342. const vnode = getInnerChild(subTree);
  5343. if (cached.type === vnode.type && cached.key === vnode.key) {
  5344. resetShapeFlag(vnode);
  5345. const da = vnode.component.da;
  5346. da && queuePostRenderEffect(da, suspense);
  5347. return;
  5348. }
  5349. unmount(cached);
  5350. });
  5351. });
  5352. return () => {
  5353. pendingCacheKey = null;
  5354. if (!slots.default) {
  5355. return current = null;
  5356. }
  5357. const children = slots.default();
  5358. const rawVNode = children[0];
  5359. if (children.length > 1) {
  5360. {
  5361. warn$1(`KeepAlive should contain exactly one component child.`);
  5362. }
  5363. current = null;
  5364. return children;
  5365. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  5366. current = null;
  5367. return rawVNode;
  5368. }
  5369. let vnode = getInnerChild(rawVNode);
  5370. if (vnode.type === Comment) {
  5371. current = null;
  5372. return vnode;
  5373. }
  5374. const comp = vnode.type;
  5375. const name = getComponentName(
  5376. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  5377. );
  5378. const { include, exclude, max } = props;
  5379. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  5380. vnode.shapeFlag &= -257;
  5381. current = vnode;
  5382. return rawVNode;
  5383. }
  5384. const key = vnode.key == null ? comp : vnode.key;
  5385. const cachedVNode = cache.get(key);
  5386. if (vnode.el) {
  5387. vnode = cloneVNode(vnode);
  5388. if (rawVNode.shapeFlag & 128) {
  5389. rawVNode.ssContent = vnode;
  5390. }
  5391. }
  5392. pendingCacheKey = key;
  5393. if (cachedVNode) {
  5394. vnode.el = cachedVNode.el;
  5395. vnode.component = cachedVNode.component;
  5396. if (vnode.transition) {
  5397. setTransitionHooks(vnode, vnode.transition);
  5398. }
  5399. vnode.shapeFlag |= 512;
  5400. keys.delete(key);
  5401. keys.add(key);
  5402. } else {
  5403. keys.add(key);
  5404. if (max && keys.size > parseInt(max, 10)) {
  5405. pruneCacheEntry(keys.values().next().value);
  5406. }
  5407. }
  5408. vnode.shapeFlag |= 256;
  5409. current = vnode;
  5410. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  5411. };
  5412. }
  5413. };
  5414. const KeepAlive = KeepAliveImpl;
  5415. function matches(pattern, name) {
  5416. if (isArray(pattern)) {
  5417. return pattern.some((p) => matches(p, name));
  5418. } else if (isString(pattern)) {
  5419. return pattern.split(",").includes(name);
  5420. } else if (isRegExp(pattern)) {
  5421. pattern.lastIndex = 0;
  5422. return pattern.test(name);
  5423. }
  5424. return false;
  5425. }
  5426. function onActivated(hook, target) {
  5427. registerKeepAliveHook(hook, "a", target);
  5428. }
  5429. function onDeactivated(hook, target) {
  5430. registerKeepAliveHook(hook, "da", target);
  5431. }
  5432. function registerKeepAliveHook(hook, type, target = currentInstance) {
  5433. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  5434. let current = target;
  5435. while (current) {
  5436. if (current.isDeactivated) {
  5437. return;
  5438. }
  5439. current = current.parent;
  5440. }
  5441. return hook();
  5442. });
  5443. injectHook(type, wrappedHook, target);
  5444. if (target) {
  5445. let current = target.parent;
  5446. while (current && current.parent) {
  5447. if (isKeepAlive(current.parent.vnode)) {
  5448. injectToKeepAliveRoot(wrappedHook, type, target, current);
  5449. }
  5450. current = current.parent;
  5451. }
  5452. }
  5453. }
  5454. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  5455. const injected = injectHook(
  5456. type,
  5457. hook,
  5458. keepAliveRoot,
  5459. true
  5460. /* prepend */
  5461. );
  5462. onUnmounted(() => {
  5463. remove(keepAliveRoot[type], injected);
  5464. }, target);
  5465. }
  5466. function resetShapeFlag(vnode) {
  5467. vnode.shapeFlag &= -257;
  5468. vnode.shapeFlag &= -513;
  5469. }
  5470. function getInnerChild(vnode) {
  5471. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  5472. }
  5473. function injectHook(type, hook, target = currentInstance, prepend = false) {
  5474. if (target) {
  5475. const hooks = target[type] || (target[type] = []);
  5476. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  5477. pauseTracking();
  5478. const reset = setCurrentInstance(target);
  5479. const res = callWithAsyncErrorHandling(hook, target, type, args);
  5480. reset();
  5481. resetTracking();
  5482. return res;
  5483. });
  5484. if (prepend) {
  5485. hooks.unshift(wrappedHook);
  5486. } else {
  5487. hooks.push(wrappedHook);
  5488. }
  5489. return wrappedHook;
  5490. } else {
  5491. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  5492. warn$1(
  5493. `${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.` )
  5494. );
  5495. }
  5496. }
  5497. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  5498. if (!isInSSRComponentSetup || lifecycle === "sp") {
  5499. injectHook(lifecycle, (...args) => hook(...args), target);
  5500. }
  5501. };
  5502. const onBeforeMount = createHook("bm");
  5503. const onMounted = createHook("m");
  5504. const onBeforeUpdate = createHook(
  5505. "bu"
  5506. );
  5507. const onUpdated = createHook("u");
  5508. const onBeforeUnmount = createHook(
  5509. "bum"
  5510. );
  5511. const onUnmounted = createHook("um");
  5512. const onServerPrefetch = createHook(
  5513. "sp"
  5514. );
  5515. const onRenderTriggered = createHook("rtg");
  5516. const onRenderTracked = createHook("rtc");
  5517. function onErrorCaptured(hook, target = currentInstance) {
  5518. injectHook("ec", hook, target);
  5519. }
  5520. const COMPONENTS = "components";
  5521. const DIRECTIVES = "directives";
  5522. function resolveComponent(name, maybeSelfReference) {
  5523. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  5524. }
  5525. const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for("v-ndc");
  5526. function resolveDynamicComponent(component) {
  5527. if (isString(component)) {
  5528. return resolveAsset(COMPONENTS, component, false) || component;
  5529. } else {
  5530. return component || NULL_DYNAMIC_COMPONENT;
  5531. }
  5532. }
  5533. function resolveDirective(name) {
  5534. return resolveAsset(DIRECTIVES, name);
  5535. }
  5536. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  5537. const instance = currentRenderingInstance || currentInstance;
  5538. if (instance) {
  5539. const Component = instance.type;
  5540. if (type === COMPONENTS) {
  5541. const selfName = getComponentName(
  5542. Component,
  5543. false
  5544. );
  5545. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  5546. return Component;
  5547. }
  5548. }
  5549. const res = (
  5550. // local registration
  5551. // check instance[type] first which is resolved for options API
  5552. resolve(instance[type] || Component[type], name) || // global registration
  5553. resolve(instance.appContext[type], name)
  5554. );
  5555. if (!res && maybeSelfReference) {
  5556. return Component;
  5557. }
  5558. if (warnMissing && !res) {
  5559. const extra = type === COMPONENTS ? `
  5560. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  5561. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  5562. }
  5563. return res;
  5564. } else {
  5565. warn$1(
  5566. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  5567. );
  5568. }
  5569. }
  5570. function resolve(registry, name) {
  5571. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  5572. }
  5573. function renderList(source, renderItem, cache, index) {
  5574. let ret;
  5575. const cached = cache && cache[index];
  5576. const sourceIsArray = isArray(source);
  5577. if (sourceIsArray || isString(source)) {
  5578. const sourceIsReactiveArray = sourceIsArray && isReactive(source);
  5579. let needsWrap = false;
  5580. let isReadonlySource = false;
  5581. if (sourceIsReactiveArray) {
  5582. needsWrap = !isShallow(source);
  5583. isReadonlySource = isReadonly(source);
  5584. source = shallowReadArray(source);
  5585. }
  5586. ret = new Array(source.length);
  5587. for (let i = 0, l = source.length; i < l; i++) {
  5588. ret[i] = renderItem(
  5589. needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
  5590. i,
  5591. void 0,
  5592. cached && cached[i]
  5593. );
  5594. }
  5595. } else if (typeof source === "number") {
  5596. if (!Number.isInteger(source) || source < 0) {
  5597. warn$1(
  5598. `The v-for range expects a positive integer value but got ${source}.`
  5599. );
  5600. ret = [];
  5601. } else {
  5602. ret = new Array(source);
  5603. for (let i = 0; i < source; i++) {
  5604. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  5605. }
  5606. }
  5607. } else if (isObject(source)) {
  5608. if (source[Symbol.iterator]) {
  5609. ret = Array.from(
  5610. source,
  5611. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  5612. );
  5613. } else {
  5614. const keys = Object.keys(source);
  5615. ret = new Array(keys.length);
  5616. for (let i = 0, l = keys.length; i < l; i++) {
  5617. const key = keys[i];
  5618. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  5619. }
  5620. }
  5621. } else {
  5622. ret = [];
  5623. }
  5624. if (cache) {
  5625. cache[index] = ret;
  5626. }
  5627. return ret;
  5628. }
  5629. function createSlots(slots, dynamicSlots) {
  5630. for (let i = 0; i < dynamicSlots.length; i++) {
  5631. const slot = dynamicSlots[i];
  5632. if (isArray(slot)) {
  5633. for (let j = 0; j < slot.length; j++) {
  5634. slots[slot[j].name] = slot[j].fn;
  5635. }
  5636. } else if (slot) {
  5637. slots[slot.name] = slot.key ? (...args) => {
  5638. const res = slot.fn(...args);
  5639. if (res) res.key = slot.key;
  5640. return res;
  5641. } : slot.fn;
  5642. }
  5643. }
  5644. return slots;
  5645. }
  5646. function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
  5647. if (props == null) props = {};
  5648. if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
  5649. const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
  5650. const hasProps = Object.keys(slotProps).length > 0;
  5651. if (name !== "default") slotProps.name = name;
  5652. return openBlock(), createBlock(
  5653. Fragment,
  5654. null,
  5655. [createVNode("slot", slotProps, fallback && fallback())],
  5656. hasProps ? -2 : 64
  5657. );
  5658. }
  5659. let slot = slots[name];
  5660. if (slot && slot.length > 1) {
  5661. warn$1(
  5662. `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.`
  5663. );
  5664. slot = () => [];
  5665. }
  5666. if (slot && slot._c) {
  5667. slot._d = false;
  5668. }
  5669. const prevStackSize = blockStack.length;
  5670. openBlock();
  5671. let rendered;
  5672. try {
  5673. const validSlotContent = slot && ensureValidVNode(slot(props));
  5674. const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
  5675. // key attached in the `createSlots` helper, respect that
  5676. validSlotContent && validSlotContent.key;
  5677. rendered = createBlock(
  5678. Fragment,
  5679. {
  5680. key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
  5681. (!validSlotContent && fallback ? "_fb" : "")
  5682. },
  5683. validSlotContent || (fallback ? fallback() : []),
  5684. validSlotContent && slots._ === 1 ? 64 : -2
  5685. );
  5686. } catch (err) {
  5687. for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
  5688. throw err;
  5689. } finally {
  5690. if (slot && slot._c) {
  5691. slot._d = true;
  5692. }
  5693. }
  5694. if (!noSlotted && rendered.scopeId) {
  5695. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  5696. }
  5697. return rendered;
  5698. }
  5699. function ensureValidVNode(vnodes) {
  5700. return vnodes.some((child) => {
  5701. if (!isVNode(child)) return true;
  5702. if (child.type === Comment) return false;
  5703. if (child.type === Fragment && !ensureValidVNode(child.children))
  5704. return false;
  5705. return true;
  5706. }) ? vnodes : null;
  5707. }
  5708. function toHandlers(obj, preserveCaseIfNecessary) {
  5709. const ret = {};
  5710. if (!isObject(obj)) {
  5711. warn$1(`v-on with no argument expects an object value.`);
  5712. return ret;
  5713. }
  5714. for (const key in obj) {
  5715. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  5716. }
  5717. return ret;
  5718. }
  5719. const getPublicInstance = (i) => {
  5720. if (!i) return null;
  5721. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  5722. return getPublicInstance(i.parent);
  5723. };
  5724. const resolveDevRootEl = (vnode) => {
  5725. let found = false;
  5726. while (true) {
  5727. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
  5728. const root = filterSingleRoot(vnode.children);
  5729. if (!root) {
  5730. return;
  5731. }
  5732. vnode = root;
  5733. found = true;
  5734. continue;
  5735. }
  5736. const component = vnode.component;
  5737. if (component && component.subTree) {
  5738. vnode = component.subTree;
  5739. continue;
  5740. }
  5741. const suspense = vnode.suspense;
  5742. if (suspense && suspense.activeBranch) {
  5743. vnode = suspense.activeBranch;
  5744. continue;
  5745. }
  5746. return found ? vnode.el : void 0;
  5747. }
  5748. };
  5749. const getDevRootFragmentEl = (i) => {
  5750. const el = i.subTree && resolveDevRootEl(i.subTree);
  5751. return el === void 0 ? i.vnode.el : el;
  5752. };
  5753. const publicPropertiesMap = (
  5754. // Move PURE marker to new line to workaround compiler discarding it
  5755. // due to type annotation
  5756. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  5757. $: (i) => i,
  5758. $el: (i) => getDevRootFragmentEl(i) ,
  5759. $data: (i) => i.data,
  5760. $props: (i) => shallowReadonly(i.props) ,
  5761. $attrs: (i) => shallowReadonly(i.attrs) ,
  5762. $slots: (i) => shallowReadonly(i.slots) ,
  5763. $refs: (i) => shallowReadonly(i.refs) ,
  5764. $parent: (i) => getPublicInstance(i.parent),
  5765. $root: (i) => getPublicInstance(i.root),
  5766. $host: (i) => i.ce,
  5767. $emit: (i) => i.emit,
  5768. $options: (i) => resolveMergedOptions(i) ,
  5769. $forceUpdate: (i) => i.f || (i.f = () => {
  5770. queueJob(i.update);
  5771. }),
  5772. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  5773. $watch: (i) => instanceWatch.bind(i)
  5774. })
  5775. );
  5776. const isReservedPrefix = (key) => key === "_" || key === "$";
  5777. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  5778. const PublicInstanceProxyHandlers = {
  5779. get({ _: instance }, key) {
  5780. if (key === "__v_skip") {
  5781. return true;
  5782. }
  5783. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  5784. if (key === "__isVue") {
  5785. return true;
  5786. }
  5787. if (key[0] !== "$") {
  5788. const n = accessCache[key];
  5789. if (n !== void 0) {
  5790. switch (n) {
  5791. case 1 /* SETUP */:
  5792. return setupState[key];
  5793. case 2 /* DATA */:
  5794. return data[key];
  5795. case 4 /* CONTEXT */:
  5796. return ctx[key];
  5797. case 3 /* PROPS */:
  5798. return props[key];
  5799. }
  5800. } else if (hasSetupBinding(setupState, key)) {
  5801. accessCache[key] = 1 /* SETUP */;
  5802. return setupState[key];
  5803. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5804. accessCache[key] = 2 /* DATA */;
  5805. return data[key];
  5806. } else if (hasOwn(props, key)) {
  5807. accessCache[key] = 3 /* PROPS */;
  5808. return props[key];
  5809. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5810. accessCache[key] = 4 /* CONTEXT */;
  5811. return ctx[key];
  5812. } else if (shouldCacheAccess) {
  5813. accessCache[key] = 0 /* OTHER */;
  5814. }
  5815. }
  5816. const publicGetter = publicPropertiesMap[key];
  5817. let cssModule, globalProperties;
  5818. if (publicGetter) {
  5819. if (key === "$attrs") {
  5820. track(instance.attrs, "get", "");
  5821. markAttrsAccessed();
  5822. } else if (key === "$slots") {
  5823. track(instance, "get", key);
  5824. }
  5825. return publicGetter(instance);
  5826. } else if (
  5827. // css module (injected by vue-loader)
  5828. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  5829. ) {
  5830. return cssModule;
  5831. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5832. accessCache[key] = 4 /* CONTEXT */;
  5833. return ctx[key];
  5834. } else if (
  5835. // global properties
  5836. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  5837. ) {
  5838. {
  5839. return globalProperties[key];
  5840. }
  5841. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  5842. // to infinite warning loop
  5843. key.indexOf("__v") !== 0)) {
  5844. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  5845. warn$1(
  5846. `Property ${JSON.stringify(
  5847. key
  5848. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  5849. );
  5850. } else if (instance === currentRenderingInstance) {
  5851. warn$1(
  5852. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  5853. );
  5854. }
  5855. }
  5856. },
  5857. set({ _: instance }, key, value) {
  5858. const { data, setupState, ctx } = instance;
  5859. if (hasSetupBinding(setupState, key)) {
  5860. setupState[key] = value;
  5861. return true;
  5862. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  5863. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  5864. return false;
  5865. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5866. data[key] = value;
  5867. return true;
  5868. } else if (hasOwn(instance.props, key)) {
  5869. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  5870. return false;
  5871. }
  5872. if (key[0] === "$" && key.slice(1) in instance) {
  5873. warn$1(
  5874. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  5875. );
  5876. return false;
  5877. } else {
  5878. if (key in instance.appContext.config.globalProperties) {
  5879. Object.defineProperty(ctx, key, {
  5880. enumerable: true,
  5881. configurable: true,
  5882. value
  5883. });
  5884. } else {
  5885. ctx[key] = value;
  5886. }
  5887. }
  5888. return true;
  5889. },
  5890. has({
  5891. _: { data, setupState, accessCache, ctx, appContext, props, type }
  5892. }, key) {
  5893. let cssModules;
  5894. return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || hasOwn(props, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
  5895. },
  5896. defineProperty(target, key, descriptor) {
  5897. if (descriptor.get != null) {
  5898. target._.accessCache[key] = 0;
  5899. } else if (hasOwn(descriptor, "value")) {
  5900. this.set(target, key, descriptor.value, null);
  5901. }
  5902. return Reflect.defineProperty(target, key, descriptor);
  5903. }
  5904. };
  5905. {
  5906. PublicInstanceProxyHandlers.ownKeys = (target) => {
  5907. warn$1(
  5908. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  5909. );
  5910. return Reflect.ownKeys(target);
  5911. };
  5912. }
  5913. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
  5914. get(target, key) {
  5915. if (key === Symbol.unscopables) {
  5916. return;
  5917. }
  5918. return PublicInstanceProxyHandlers.get(target, key, target);
  5919. },
  5920. has(_, key) {
  5921. const has = key[0] !== "_" && !isGloballyAllowed(key);
  5922. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  5923. warn$1(
  5924. `Property ${JSON.stringify(
  5925. key
  5926. )} should not start with _ which is a reserved prefix for Vue internals.`
  5927. );
  5928. }
  5929. return has;
  5930. }
  5931. });
  5932. function createDevRenderContext(instance) {
  5933. const target = {};
  5934. Object.defineProperty(target, `_`, {
  5935. configurable: true,
  5936. enumerable: false,
  5937. get: () => instance
  5938. });
  5939. Object.keys(publicPropertiesMap).forEach((key) => {
  5940. Object.defineProperty(target, key, {
  5941. configurable: true,
  5942. enumerable: false,
  5943. get: () => publicPropertiesMap[key](instance),
  5944. // intercepted by the proxy so no need for implementation,
  5945. // but needed to prevent set errors
  5946. set: NOOP
  5947. });
  5948. });
  5949. return target;
  5950. }
  5951. function exposePropsOnRenderContext(instance) {
  5952. const {
  5953. ctx,
  5954. propsOptions: [propsOptions]
  5955. } = instance;
  5956. if (propsOptions) {
  5957. Object.keys(propsOptions).forEach((key) => {
  5958. Object.defineProperty(ctx, key, {
  5959. enumerable: true,
  5960. configurable: true,
  5961. get: () => instance.props[key],
  5962. set: NOOP
  5963. });
  5964. });
  5965. }
  5966. }
  5967. function exposeSetupStateOnRenderContext(instance) {
  5968. const { ctx, setupState } = instance;
  5969. Object.keys(toRaw(setupState)).forEach((key) => {
  5970. if (!setupState.__isScriptSetup) {
  5971. if (isReservedPrefix(key[0])) {
  5972. warn$1(
  5973. `setup() return property ${JSON.stringify(
  5974. key
  5975. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  5976. );
  5977. return;
  5978. }
  5979. Object.defineProperty(ctx, key, {
  5980. enumerable: true,
  5981. configurable: true,
  5982. get: () => setupState[key],
  5983. set: NOOP
  5984. });
  5985. }
  5986. });
  5987. }
  5988. const warnRuntimeUsage = (method) => warn$1(
  5989. `${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.`
  5990. );
  5991. function defineProps() {
  5992. {
  5993. warnRuntimeUsage(`defineProps`);
  5994. }
  5995. return null;
  5996. }
  5997. function defineEmits() {
  5998. {
  5999. warnRuntimeUsage(`defineEmits`);
  6000. }
  6001. return null;
  6002. }
  6003. function defineExpose(exposed) {
  6004. {
  6005. warnRuntimeUsage(`defineExpose`);
  6006. }
  6007. }
  6008. function defineOptions(options) {
  6009. {
  6010. warnRuntimeUsage(`defineOptions`);
  6011. }
  6012. }
  6013. function defineSlots() {
  6014. {
  6015. warnRuntimeUsage(`defineSlots`);
  6016. }
  6017. return null;
  6018. }
  6019. function defineModel() {
  6020. {
  6021. warnRuntimeUsage("defineModel");
  6022. }
  6023. }
  6024. function withDefaults(props, defaults) {
  6025. {
  6026. warnRuntimeUsage(`withDefaults`);
  6027. }
  6028. return null;
  6029. }
  6030. function useSlots() {
  6031. return getContext("useSlots").slots;
  6032. }
  6033. function useAttrs() {
  6034. return getContext("useAttrs").attrs;
  6035. }
  6036. function getContext(calledFunctionName) {
  6037. const i = getCurrentInstance();
  6038. if (!i) {
  6039. warn$1(`${calledFunctionName}() called without active instance.`);
  6040. }
  6041. return i.setupContext || (i.setupContext = createSetupContext(i));
  6042. }
  6043. function normalizePropsOrEmits(props) {
  6044. return isArray(props) ? props.reduce(
  6045. (normalized, p) => (normalized[p] = null, normalized),
  6046. {}
  6047. ) : props;
  6048. }
  6049. function mergeDefaults(raw, defaults) {
  6050. const props = normalizePropsOrEmits(raw);
  6051. for (const key in defaults) {
  6052. if (key.startsWith("__skip")) continue;
  6053. let opt = props[key];
  6054. if (opt) {
  6055. if (isArray(opt) || isFunction(opt)) {
  6056. opt = props[key] = { type: opt, default: defaults[key] };
  6057. } else {
  6058. opt.default = defaults[key];
  6059. }
  6060. } else if (opt === null) {
  6061. opt = props[key] = { default: defaults[key] };
  6062. } else {
  6063. warn$1(`props default key "${key}" has no corresponding declaration.`);
  6064. }
  6065. if (opt && defaults[`__skip_${key}`]) {
  6066. opt.skipFactory = true;
  6067. }
  6068. }
  6069. return props;
  6070. }
  6071. function mergeModels(a, b) {
  6072. if (!a || !b) return a || b;
  6073. if (isArray(a) && isArray(b)) return a.concat(b);
  6074. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  6075. }
  6076. function createPropsRestProxy(props, excludedKeys) {
  6077. const ret = {};
  6078. for (const key in props) {
  6079. if (!excludedKeys.includes(key)) {
  6080. Object.defineProperty(ret, key, {
  6081. enumerable: true,
  6082. get: () => props[key]
  6083. });
  6084. }
  6085. }
  6086. return ret;
  6087. }
  6088. function withAsyncContext(getAwaitable) {
  6089. const ctx = getCurrentInstance();
  6090. const inSSRSetup = isInSSRComponentSetup;
  6091. if (!ctx) {
  6092. warn$1(
  6093. `withAsyncContext called without active current instance. This is likely a bug.`
  6094. );
  6095. }
  6096. let awaitable = getAwaitable();
  6097. unsetCurrentInstance();
  6098. if (inSSRSetup) {
  6099. setInSSRSetupState(false);
  6100. }
  6101. const restore = () => {
  6102. setCurrentInstance(ctx);
  6103. if (inSSRSetup) {
  6104. setInSSRSetupState(true);
  6105. }
  6106. };
  6107. const cleanup = () => {
  6108. if (getCurrentInstance() !== ctx) ctx.scope.off();
  6109. unsetCurrentInstance();
  6110. if (inSSRSetup) {
  6111. setInSSRSetupState(false);
  6112. }
  6113. };
  6114. if (isPromise(awaitable)) {
  6115. awaitable = awaitable.catch((e) => {
  6116. restore();
  6117. Promise.resolve().then(() => Promise.resolve().then(cleanup));
  6118. throw e;
  6119. });
  6120. }
  6121. return [
  6122. awaitable,
  6123. () => {
  6124. restore();
  6125. Promise.resolve().then(cleanup);
  6126. }
  6127. ];
  6128. }
  6129. function createDuplicateChecker() {
  6130. const cache = /* @__PURE__ */ Object.create(null);
  6131. return (type, key) => {
  6132. if (cache[key]) {
  6133. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  6134. } else {
  6135. cache[key] = type;
  6136. }
  6137. };
  6138. }
  6139. let shouldCacheAccess = true;
  6140. function applyOptions(instance) {
  6141. const options = resolveMergedOptions(instance);
  6142. const publicThis = instance.proxy;
  6143. const ctx = instance.ctx;
  6144. shouldCacheAccess = false;
  6145. if (options.beforeCreate) {
  6146. callHook$1(options.beforeCreate, instance, "bc");
  6147. }
  6148. const {
  6149. // state
  6150. data: dataOptions,
  6151. computed: computedOptions,
  6152. methods,
  6153. watch: watchOptions,
  6154. provide: provideOptions,
  6155. inject: injectOptions,
  6156. // lifecycle
  6157. created,
  6158. beforeMount,
  6159. mounted,
  6160. beforeUpdate,
  6161. updated,
  6162. activated,
  6163. deactivated,
  6164. beforeDestroy,
  6165. beforeUnmount,
  6166. destroyed,
  6167. unmounted,
  6168. render,
  6169. renderTracked,
  6170. renderTriggered,
  6171. errorCaptured,
  6172. serverPrefetch,
  6173. // public API
  6174. expose,
  6175. inheritAttrs,
  6176. // assets
  6177. components,
  6178. directives,
  6179. filters
  6180. } = options;
  6181. const checkDuplicateProperties = createDuplicateChecker() ;
  6182. {
  6183. const [propsOptions] = instance.propsOptions;
  6184. if (propsOptions) {
  6185. for (const key in propsOptions) {
  6186. checkDuplicateProperties("Props" /* PROPS */, key);
  6187. }
  6188. }
  6189. }
  6190. if (injectOptions) {
  6191. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  6192. }
  6193. if (methods) {
  6194. for (const key in methods) {
  6195. const methodHandler = methods[key];
  6196. if (isFunction(methodHandler)) {
  6197. {
  6198. Object.defineProperty(ctx, key, {
  6199. value: methodHandler.bind(publicThis),
  6200. configurable: true,
  6201. enumerable: true,
  6202. writable: true
  6203. });
  6204. }
  6205. {
  6206. checkDuplicateProperties("Methods" /* METHODS */, key);
  6207. }
  6208. } else {
  6209. warn$1(
  6210. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  6211. );
  6212. }
  6213. }
  6214. }
  6215. if (dataOptions) {
  6216. if (!isFunction(dataOptions)) {
  6217. warn$1(
  6218. `The data option must be a function. Plain object usage is no longer supported.`
  6219. );
  6220. }
  6221. const data = dataOptions.call(publicThis, publicThis);
  6222. if (isPromise(data)) {
  6223. warn$1(
  6224. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  6225. );
  6226. }
  6227. if (!isObject(data)) {
  6228. warn$1(`data() should return an object.`);
  6229. } else {
  6230. instance.data = reactive(data);
  6231. {
  6232. for (const key in data) {
  6233. checkDuplicateProperties("Data" /* DATA */, key);
  6234. if (!isReservedPrefix(key[0])) {
  6235. Object.defineProperty(ctx, key, {
  6236. configurable: true,
  6237. enumerable: true,
  6238. get: () => data[key],
  6239. set: NOOP
  6240. });
  6241. }
  6242. }
  6243. }
  6244. }
  6245. }
  6246. shouldCacheAccess = true;
  6247. if (computedOptions) {
  6248. for (const key in computedOptions) {
  6249. const opt = computedOptions[key];
  6250. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  6251. if (get === NOOP) {
  6252. warn$1(`Computed property "${key}" has no getter.`);
  6253. }
  6254. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  6255. warn$1(
  6256. `Write operation failed: computed property "${key}" is readonly.`
  6257. );
  6258. } ;
  6259. const c = computed({
  6260. get,
  6261. set
  6262. });
  6263. Object.defineProperty(ctx, key, {
  6264. enumerable: true,
  6265. configurable: true,
  6266. get: () => c.value,
  6267. set: (v) => c.value = v
  6268. });
  6269. {
  6270. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  6271. }
  6272. }
  6273. }
  6274. if (watchOptions) {
  6275. for (const key in watchOptions) {
  6276. createWatcher(watchOptions[key], ctx, publicThis, key);
  6277. }
  6278. }
  6279. if (provideOptions) {
  6280. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  6281. Reflect.ownKeys(provides).forEach((key) => {
  6282. provide(key, provides[key]);
  6283. });
  6284. }
  6285. if (created) {
  6286. callHook$1(created, instance, "c");
  6287. }
  6288. function registerLifecycleHook(register, hook) {
  6289. if (isArray(hook)) {
  6290. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  6291. } else if (hook) {
  6292. register(hook.bind(publicThis));
  6293. }
  6294. }
  6295. registerLifecycleHook(onBeforeMount, beforeMount);
  6296. registerLifecycleHook(onMounted, mounted);
  6297. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  6298. registerLifecycleHook(onUpdated, updated);
  6299. registerLifecycleHook(onActivated, activated);
  6300. registerLifecycleHook(onDeactivated, deactivated);
  6301. registerLifecycleHook(onErrorCaptured, errorCaptured);
  6302. registerLifecycleHook(onRenderTracked, renderTracked);
  6303. registerLifecycleHook(onRenderTriggered, renderTriggered);
  6304. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  6305. registerLifecycleHook(onUnmounted, unmounted);
  6306. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  6307. if (isArray(expose)) {
  6308. if (expose.length) {
  6309. const exposed = instance.exposed || (instance.exposed = {});
  6310. expose.forEach((key) => {
  6311. Object.defineProperty(exposed, key, {
  6312. get: () => publicThis[key],
  6313. set: (val) => publicThis[key] = val,
  6314. enumerable: true
  6315. });
  6316. });
  6317. } else if (!instance.exposed) {
  6318. instance.exposed = {};
  6319. }
  6320. }
  6321. if (render && instance.render === NOOP) {
  6322. instance.render = render;
  6323. }
  6324. if (inheritAttrs != null) {
  6325. instance.inheritAttrs = inheritAttrs;
  6326. }
  6327. if (components) instance.components = components;
  6328. if (directives) instance.directives = directives;
  6329. if (serverPrefetch) {
  6330. markAsyncBoundary(instance);
  6331. }
  6332. }
  6333. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  6334. if (isArray(injectOptions)) {
  6335. injectOptions = normalizeInject(injectOptions);
  6336. }
  6337. for (const key in injectOptions) {
  6338. const opt = injectOptions[key];
  6339. let injected;
  6340. if (isObject(opt)) {
  6341. if ("default" in opt) {
  6342. injected = inject(
  6343. opt.from || key,
  6344. opt.default,
  6345. true
  6346. );
  6347. } else {
  6348. injected = inject(opt.from || key);
  6349. }
  6350. } else {
  6351. injected = inject(opt);
  6352. }
  6353. if (isRef(injected)) {
  6354. Object.defineProperty(ctx, key, {
  6355. enumerable: true,
  6356. configurable: true,
  6357. get: () => injected.value,
  6358. set: (v) => injected.value = v
  6359. });
  6360. } else {
  6361. ctx[key] = injected;
  6362. }
  6363. {
  6364. checkDuplicateProperties("Inject" /* INJECT */, key);
  6365. }
  6366. }
  6367. }
  6368. function callHook$1(hook, instance, type) {
  6369. callWithAsyncErrorHandling(
  6370. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  6371. instance,
  6372. type
  6373. );
  6374. }
  6375. function createWatcher(raw, ctx, publicThis, key) {
  6376. let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  6377. if (isString(raw)) {
  6378. const handler = ctx[raw];
  6379. if (isFunction(handler)) {
  6380. {
  6381. watch(getter, handler);
  6382. }
  6383. } else {
  6384. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  6385. }
  6386. } else if (isFunction(raw)) {
  6387. {
  6388. watch(getter, raw.bind(publicThis));
  6389. }
  6390. } else if (isObject(raw)) {
  6391. if (isArray(raw)) {
  6392. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  6393. } else {
  6394. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  6395. if (isFunction(handler)) {
  6396. watch(getter, handler, raw);
  6397. } else {
  6398. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  6399. }
  6400. }
  6401. } else {
  6402. warn$1(`Invalid watch option: "${key}"`, raw);
  6403. }
  6404. }
  6405. function resolveMergedOptions(instance) {
  6406. const base = instance.type;
  6407. const { mixins, extends: extendsOptions } = base;
  6408. const {
  6409. mixins: globalMixins,
  6410. optionsCache: cache,
  6411. config: { optionMergeStrategies }
  6412. } = instance.appContext;
  6413. const cached = cache.get(base);
  6414. let resolved;
  6415. if (cached) {
  6416. resolved = cached;
  6417. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  6418. {
  6419. resolved = base;
  6420. }
  6421. } else {
  6422. resolved = {};
  6423. if (globalMixins.length) {
  6424. globalMixins.forEach(
  6425. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  6426. );
  6427. }
  6428. mergeOptions(resolved, base, optionMergeStrategies);
  6429. }
  6430. if (isObject(base)) {
  6431. cache.set(base, resolved);
  6432. }
  6433. return resolved;
  6434. }
  6435. function mergeOptions(to, from, strats, asMixin = false) {
  6436. const { mixins, extends: extendsOptions } = from;
  6437. if (extendsOptions) {
  6438. mergeOptions(to, extendsOptions, strats, true);
  6439. }
  6440. if (mixins) {
  6441. mixins.forEach(
  6442. (m) => mergeOptions(to, m, strats, true)
  6443. );
  6444. }
  6445. for (const key in from) {
  6446. if (asMixin && key === "expose") {
  6447. warn$1(
  6448. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  6449. );
  6450. } else {
  6451. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  6452. to[key] = strat ? strat(to[key], from[key]) : from[key];
  6453. }
  6454. }
  6455. return to;
  6456. }
  6457. const internalOptionMergeStrats = {
  6458. data: mergeDataFn,
  6459. props: mergeEmitsOrPropsOptions,
  6460. emits: mergeEmitsOrPropsOptions,
  6461. // objects
  6462. methods: mergeObjectOptions,
  6463. computed: mergeObjectOptions,
  6464. // lifecycle
  6465. beforeCreate: mergeAsArray$1,
  6466. created: mergeAsArray$1,
  6467. beforeMount: mergeAsArray$1,
  6468. mounted: mergeAsArray$1,
  6469. beforeUpdate: mergeAsArray$1,
  6470. updated: mergeAsArray$1,
  6471. beforeDestroy: mergeAsArray$1,
  6472. beforeUnmount: mergeAsArray$1,
  6473. destroyed: mergeAsArray$1,
  6474. unmounted: mergeAsArray$1,
  6475. activated: mergeAsArray$1,
  6476. deactivated: mergeAsArray$1,
  6477. errorCaptured: mergeAsArray$1,
  6478. serverPrefetch: mergeAsArray$1,
  6479. // assets
  6480. components: mergeObjectOptions,
  6481. directives: mergeObjectOptions,
  6482. // watch
  6483. watch: mergeWatchOptions,
  6484. // provide / inject
  6485. provide: mergeDataFn,
  6486. inject: mergeInject
  6487. };
  6488. function mergeDataFn(to, from) {
  6489. if (!from) {
  6490. return to;
  6491. }
  6492. if (!to) {
  6493. return from;
  6494. }
  6495. return function mergedDataFn() {
  6496. return (extend)(
  6497. isFunction(to) ? to.call(this, this) : to,
  6498. isFunction(from) ? from.call(this, this) : from
  6499. );
  6500. };
  6501. }
  6502. function mergeInject(to, from) {
  6503. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  6504. }
  6505. function normalizeInject(raw) {
  6506. if (isArray(raw)) {
  6507. const res = {};
  6508. for (let i = 0; i < raw.length; i++) {
  6509. res[raw[i]] = raw[i];
  6510. }
  6511. return res;
  6512. }
  6513. return raw;
  6514. }
  6515. function mergeAsArray$1(to, from) {
  6516. return to ? [...new Set([].concat(to, from))] : from;
  6517. }
  6518. function mergeObjectOptions(to, from) {
  6519. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  6520. }
  6521. function mergeEmitsOrPropsOptions(to, from) {
  6522. if (to) {
  6523. if (isArray(to) && isArray(from)) {
  6524. return [.../* @__PURE__ */ new Set([...to, ...from])];
  6525. }
  6526. return extend(
  6527. /* @__PURE__ */ Object.create(null),
  6528. normalizePropsOrEmits(to),
  6529. normalizePropsOrEmits(from != null ? from : {})
  6530. );
  6531. } else {
  6532. return from;
  6533. }
  6534. }
  6535. function mergeWatchOptions(to, from) {
  6536. if (!to) return from;
  6537. if (!from) return to;
  6538. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  6539. for (const key in from) {
  6540. merged[key] = mergeAsArray$1(to[key], from[key]);
  6541. }
  6542. return merged;
  6543. }
  6544. function createAppContext() {
  6545. return {
  6546. app: null,
  6547. config: {
  6548. isNativeTag: NO,
  6549. performance: false,
  6550. globalProperties: {},
  6551. optionMergeStrategies: {},
  6552. errorHandler: void 0,
  6553. warnHandler: void 0,
  6554. compilerOptions: {}
  6555. },
  6556. mixins: [],
  6557. components: {},
  6558. directives: {},
  6559. provides: /* @__PURE__ */ Object.create(null),
  6560. optionsCache: /* @__PURE__ */ new WeakMap(),
  6561. propsCache: /* @__PURE__ */ new WeakMap(),
  6562. emitsCache: /* @__PURE__ */ new WeakMap()
  6563. };
  6564. }
  6565. let uid$1 = 0;
  6566. function createAppAPI(render, hydrate) {
  6567. return function createApp(rootComponent, rootProps = null) {
  6568. if (!isFunction(rootComponent)) {
  6569. rootComponent = extend({}, rootComponent);
  6570. }
  6571. if (rootProps != null && !isObject(rootProps)) {
  6572. warn$1(`root props passed to app.mount() must be an object.`);
  6573. rootProps = null;
  6574. }
  6575. const context = createAppContext();
  6576. const installedPlugins = /* @__PURE__ */ new WeakSet();
  6577. const pluginCleanupFns = [];
  6578. let isMounted = false;
  6579. const app = context.app = {
  6580. _uid: uid$1++,
  6581. _component: rootComponent,
  6582. _props: rootProps,
  6583. _container: null,
  6584. _context: context,
  6585. _instance: null,
  6586. version,
  6587. get config() {
  6588. return context.config;
  6589. },
  6590. set config(v) {
  6591. {
  6592. warn$1(
  6593. `app.config cannot be replaced. Modify individual options instead.`
  6594. );
  6595. }
  6596. },
  6597. use(plugin, ...options) {
  6598. if (installedPlugins.has(plugin)) {
  6599. warn$1(`Plugin has already been applied to target app.`);
  6600. } else if (plugin && isFunction(plugin.install)) {
  6601. installedPlugins.add(plugin);
  6602. plugin.install(app, ...options);
  6603. } else if (isFunction(plugin)) {
  6604. installedPlugins.add(plugin);
  6605. plugin(app, ...options);
  6606. } else {
  6607. warn$1(
  6608. `A plugin must either be a function or an object with an "install" function.`
  6609. );
  6610. }
  6611. return app;
  6612. },
  6613. mixin(mixin) {
  6614. {
  6615. if (!context.mixins.includes(mixin)) {
  6616. context.mixins.push(mixin);
  6617. } else {
  6618. warn$1(
  6619. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  6620. );
  6621. }
  6622. }
  6623. return app;
  6624. },
  6625. component(name, component) {
  6626. {
  6627. validateComponentName(name, context.config);
  6628. }
  6629. if (!component) {
  6630. return context.components[name];
  6631. }
  6632. if (context.components[name]) {
  6633. warn$1(`Component "${name}" has already been registered in target app.`);
  6634. }
  6635. context.components[name] = component;
  6636. return app;
  6637. },
  6638. directive(name, directive) {
  6639. {
  6640. validateDirectiveName(name);
  6641. }
  6642. if (!directive) {
  6643. return context.directives[name];
  6644. }
  6645. if (context.directives[name]) {
  6646. warn$1(`Directive "${name}" has already been registered in target app.`);
  6647. }
  6648. context.directives[name] = directive;
  6649. return app;
  6650. },
  6651. mount(rootContainer, isHydrate, namespace) {
  6652. if (!isMounted) {
  6653. if (rootContainer.__vue_app__) {
  6654. warn$1(
  6655. `There is already an app instance mounted on the host container.
  6656. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  6657. );
  6658. }
  6659. const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
  6660. vnode.appContext = context;
  6661. if (namespace === true) {
  6662. namespace = "svg";
  6663. } else if (namespace === false) {
  6664. namespace = void 0;
  6665. }
  6666. {
  6667. context.reload = () => {
  6668. const cloned = cloneVNode(vnode);
  6669. cloned.el = null;
  6670. render(cloned, rootContainer, namespace);
  6671. };
  6672. }
  6673. if (isHydrate && hydrate) {
  6674. hydrate(vnode, rootContainer);
  6675. } else {
  6676. render(vnode, rootContainer, namespace);
  6677. }
  6678. isMounted = true;
  6679. app._container = rootContainer;
  6680. rootContainer.__vue_app__ = app;
  6681. {
  6682. app._instance = vnode.component;
  6683. devtoolsInitApp(app, version);
  6684. }
  6685. return getComponentPublicInstance(vnode.component);
  6686. } else {
  6687. warn$1(
  6688. `App has already been mounted.
  6689. 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)\``
  6690. );
  6691. }
  6692. },
  6693. onUnmount(cleanupFn) {
  6694. if (typeof cleanupFn !== "function") {
  6695. warn$1(
  6696. `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
  6697. );
  6698. }
  6699. pluginCleanupFns.push(cleanupFn);
  6700. },
  6701. unmount() {
  6702. if (isMounted) {
  6703. callWithAsyncErrorHandling(
  6704. pluginCleanupFns,
  6705. app._instance,
  6706. 16
  6707. );
  6708. render(null, app._container);
  6709. {
  6710. app._instance = null;
  6711. devtoolsUnmountApp(app);
  6712. }
  6713. delete app._container.__vue_app__;
  6714. } else {
  6715. warn$1(`Cannot unmount an app that is not mounted.`);
  6716. }
  6717. },
  6718. provide(key, value) {
  6719. if (key in context.provides) {
  6720. if (hasOwn(context.provides, key)) {
  6721. warn$1(
  6722. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  6723. );
  6724. } else {
  6725. warn$1(
  6726. `App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`
  6727. );
  6728. }
  6729. }
  6730. context.provides[key] = value;
  6731. return app;
  6732. },
  6733. runWithContext(fn) {
  6734. const lastApp = currentApp;
  6735. currentApp = app;
  6736. try {
  6737. return fn();
  6738. } finally {
  6739. currentApp = lastApp;
  6740. }
  6741. }
  6742. };
  6743. return app;
  6744. };
  6745. }
  6746. let currentApp = null;
  6747. function useModel(props, name, options = EMPTY_OBJ) {
  6748. const i = getCurrentInstance();
  6749. if (!i) {
  6750. warn$1(`useModel() called without active instance.`);
  6751. return ref();
  6752. }
  6753. const camelizedName = camelize(name);
  6754. if (!i.propsOptions[0][camelizedName]) {
  6755. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  6756. return ref();
  6757. }
  6758. const hyphenatedName = hyphenate(name);
  6759. const modifiers = getModelModifiers(props, camelizedName);
  6760. const res = customRef((track, trigger) => {
  6761. let localValue;
  6762. let prevSetValue = EMPTY_OBJ;
  6763. let prevEmittedValue;
  6764. watchSyncEffect(() => {
  6765. const propValue = props[camelizedName];
  6766. if (hasChanged(localValue, propValue)) {
  6767. localValue = propValue;
  6768. trigger();
  6769. }
  6770. });
  6771. return {
  6772. get() {
  6773. track();
  6774. return options.get ? options.get(localValue) : localValue;
  6775. },
  6776. set(value) {
  6777. const emittedValue = options.set ? options.set(value) : value;
  6778. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  6779. return;
  6780. }
  6781. const rawProps = i.vnode.props;
  6782. const hasVModel = !!(rawProps && // check if parent has passed v-model
  6783. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps));
  6784. if (!hasVModel) {
  6785. localValue = value;
  6786. trigger();
  6787. }
  6788. i.emit(`update:${name}`, emittedValue);
  6789. if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || // #13524: browsers differ in when they flush microtasks between
  6790. // event listeners. If a v-model listener emits an intermediate value
  6791. // and a following listener restores the model to its previous prop
  6792. // value before parent updates are flushed, the parent render can be
  6793. // deduped as having no prop change. Force a local update so DOM state
  6794. // such as an input's value is synchronized back to the current model.
  6795. hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) {
  6796. trigger();
  6797. }
  6798. prevSetValue = value;
  6799. prevEmittedValue = emittedValue;
  6800. }
  6801. };
  6802. });
  6803. res[Symbol.iterator] = () => {
  6804. let i2 = 0;
  6805. return {
  6806. next() {
  6807. if (i2 < 2) {
  6808. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  6809. } else {
  6810. return { done: true };
  6811. }
  6812. }
  6813. };
  6814. };
  6815. return res;
  6816. }
  6817. const getModelModifiers = (props, modelName) => {
  6818. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  6819. };
  6820. function emit(instance, event, ...rawArgs) {
  6821. if (instance.isUnmounted) return;
  6822. const props = instance.vnode.props || EMPTY_OBJ;
  6823. {
  6824. const {
  6825. emitsOptions,
  6826. propsOptions: [propsOptions]
  6827. } = instance;
  6828. if (emitsOptions) {
  6829. if (!(event in emitsOptions) && true) {
  6830. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  6831. warn$1(
  6832. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  6833. );
  6834. }
  6835. } else {
  6836. const validator = emitsOptions[event];
  6837. if (isFunction(validator)) {
  6838. const isValid = validator(...rawArgs);
  6839. if (!isValid) {
  6840. warn$1(
  6841. `Invalid event arguments: event validation failed for event "${event}".`
  6842. );
  6843. }
  6844. }
  6845. }
  6846. }
  6847. }
  6848. let args = rawArgs;
  6849. const isModelListener = event.startsWith("update:");
  6850. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  6851. if (modifiers) {
  6852. if (modifiers.trim) {
  6853. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  6854. }
  6855. if (modifiers.number) {
  6856. args = args.map(looseToNumber);
  6857. }
  6858. }
  6859. {
  6860. devtoolsComponentEmit(instance, event, args);
  6861. }
  6862. {
  6863. const lowerCaseEvent = event.toLowerCase();
  6864. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  6865. warn$1(
  6866. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  6867. instance,
  6868. instance.type
  6869. )} 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(
  6870. event
  6871. )}" instead of "${event}".`
  6872. );
  6873. }
  6874. }
  6875. let handlerName;
  6876. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  6877. props[handlerName = toHandlerKey(camelize(event))];
  6878. if (!handler && isModelListener) {
  6879. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  6880. }
  6881. if (handler) {
  6882. callWithAsyncErrorHandling(
  6883. handler,
  6884. instance,
  6885. 6,
  6886. args
  6887. );
  6888. }
  6889. const onceHandler = props[handlerName + `Once`];
  6890. if (onceHandler) {
  6891. if (!instance.emitted) {
  6892. instance.emitted = {};
  6893. } else if (instance.emitted[handlerName]) {
  6894. return;
  6895. }
  6896. instance.emitted[handlerName] = true;
  6897. callWithAsyncErrorHandling(
  6898. onceHandler,
  6899. instance,
  6900. 6,
  6901. args
  6902. );
  6903. }
  6904. }
  6905. const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
  6906. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  6907. const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
  6908. const cached = cache.get(comp);
  6909. if (cached !== void 0) {
  6910. return cached;
  6911. }
  6912. const raw = comp.emits;
  6913. let normalized = {};
  6914. let hasExtends = false;
  6915. if (!isFunction(comp)) {
  6916. const extendEmits = (raw2) => {
  6917. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  6918. if (normalizedFromExtend) {
  6919. hasExtends = true;
  6920. extend(normalized, normalizedFromExtend);
  6921. }
  6922. };
  6923. if (!asMixin && appContext.mixins.length) {
  6924. appContext.mixins.forEach(extendEmits);
  6925. }
  6926. if (comp.extends) {
  6927. extendEmits(comp.extends);
  6928. }
  6929. if (comp.mixins) {
  6930. comp.mixins.forEach(extendEmits);
  6931. }
  6932. }
  6933. if (!raw && !hasExtends) {
  6934. if (isObject(comp)) {
  6935. cache.set(comp, null);
  6936. }
  6937. return null;
  6938. }
  6939. if (isArray(raw)) {
  6940. raw.forEach((key) => normalized[key] = null);
  6941. } else {
  6942. extend(normalized, raw);
  6943. }
  6944. if (isObject(comp)) {
  6945. cache.set(comp, normalized);
  6946. }
  6947. return normalized;
  6948. }
  6949. function isEmitListener(options, key) {
  6950. if (!options || !isOn(key)) {
  6951. return false;
  6952. }
  6953. key = key.slice(2);
  6954. key = key === "Once" ? key : key.replace(/Once$/, "");
  6955. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  6956. }
  6957. let accessedAttrs = false;
  6958. function markAttrsAccessed() {
  6959. accessedAttrs = true;
  6960. }
  6961. function renderComponentRoot(instance) {
  6962. const {
  6963. type: Component,
  6964. vnode,
  6965. proxy,
  6966. withProxy,
  6967. propsOptions: [propsOptions],
  6968. slots,
  6969. attrs,
  6970. emit,
  6971. render,
  6972. renderCache,
  6973. props,
  6974. data,
  6975. setupState,
  6976. ctx,
  6977. inheritAttrs
  6978. } = instance;
  6979. const prev = setCurrentRenderingInstance(instance);
  6980. let result;
  6981. let fallthroughAttrs;
  6982. {
  6983. accessedAttrs = false;
  6984. }
  6985. try {
  6986. if (vnode.shapeFlag & 4) {
  6987. const proxyToUse = withProxy || proxy;
  6988. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  6989. get(target, key, receiver) {
  6990. warn$1(
  6991. `Property '${String(
  6992. key
  6993. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  6994. );
  6995. return Reflect.get(target, key, receiver);
  6996. }
  6997. }) : proxyToUse;
  6998. result = normalizeVNode(
  6999. render.call(
  7000. thisProxy,
  7001. proxyToUse,
  7002. renderCache,
  7003. true ? shallowReadonly(props) : props,
  7004. setupState,
  7005. data,
  7006. ctx
  7007. )
  7008. );
  7009. fallthroughAttrs = attrs;
  7010. } else {
  7011. const render2 = Component;
  7012. if (attrs === props) {
  7013. markAttrsAccessed();
  7014. }
  7015. result = normalizeVNode(
  7016. render2.length > 1 ? render2(
  7017. true ? shallowReadonly(props) : props,
  7018. true ? {
  7019. get attrs() {
  7020. markAttrsAccessed();
  7021. return shallowReadonly(attrs);
  7022. },
  7023. slots,
  7024. emit
  7025. } : { attrs, slots, emit }
  7026. ) : render2(
  7027. true ? shallowReadonly(props) : props,
  7028. null
  7029. )
  7030. );
  7031. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  7032. }
  7033. } catch (err) {
  7034. blockStack.length = 0;
  7035. handleError(err, instance, 1);
  7036. result = createVNode(Comment);
  7037. }
  7038. let root = result;
  7039. let setRoot = void 0;
  7040. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  7041. [root, setRoot] = getChildRoot(result);
  7042. }
  7043. if (fallthroughAttrs && inheritAttrs !== false) {
  7044. const keys = Object.keys(fallthroughAttrs);
  7045. const { shapeFlag } = root;
  7046. if (keys.length) {
  7047. if (shapeFlag & (1 | 6)) {
  7048. if (propsOptions && keys.some(isModelListener)) {
  7049. fallthroughAttrs = filterModelListeners(
  7050. fallthroughAttrs,
  7051. propsOptions
  7052. );
  7053. }
  7054. root = cloneVNode(root, fallthroughAttrs, false, true);
  7055. } else if (!accessedAttrs && root.type !== Comment) {
  7056. const allAttrs = Object.keys(attrs);
  7057. const eventAttrs = [];
  7058. const extraAttrs = [];
  7059. for (let i = 0, l = allAttrs.length; i < l; i++) {
  7060. const key = allAttrs[i];
  7061. if (isOn(key)) {
  7062. if (!isModelListener(key)) {
  7063. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  7064. }
  7065. } else {
  7066. extraAttrs.push(key);
  7067. }
  7068. }
  7069. if (extraAttrs.length) {
  7070. warn$1(
  7071. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
  7072. );
  7073. }
  7074. if (eventAttrs.length) {
  7075. warn$1(
  7076. `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.`
  7077. );
  7078. }
  7079. }
  7080. }
  7081. }
  7082. if (vnode.dirs) {
  7083. if (!isElementRoot(root)) {
  7084. warn$1(
  7085. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  7086. );
  7087. }
  7088. root = cloneVNode(root, null, false, true);
  7089. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  7090. }
  7091. if (vnode.transition) {
  7092. const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
  7093. if (!isElementRoot(child)) {
  7094. warn$1(
  7095. `Component inside <Transition> renders non-element root node that cannot be animated.`
  7096. );
  7097. }
  7098. setTransitionHooks(child, vnode.transition);
  7099. }
  7100. if (setRoot) {
  7101. setRoot(root);
  7102. } else {
  7103. result = root;
  7104. }
  7105. setCurrentRenderingInstance(prev);
  7106. return result;
  7107. }
  7108. const getChildRoot = (vnode) => {
  7109. const rawChildren = vnode.children;
  7110. const dynamicChildren = vnode.dynamicChildren;
  7111. const childRoot = filterSingleRoot(rawChildren, false);
  7112. if (!childRoot) {
  7113. return [vnode, void 0];
  7114. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  7115. return getChildRoot(childRoot);
  7116. }
  7117. const index = rawChildren.indexOf(childRoot);
  7118. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  7119. const setRoot = (updatedRoot) => {
  7120. rawChildren[index] = updatedRoot;
  7121. if (dynamicChildren) {
  7122. if (dynamicIndex > -1) {
  7123. dynamicChildren[dynamicIndex] = updatedRoot;
  7124. } else if (updatedRoot.patchFlag > 0) {
  7125. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  7126. }
  7127. }
  7128. };
  7129. return [normalizeVNode(childRoot), setRoot];
  7130. };
  7131. function filterSingleRoot(children, recurse = true) {
  7132. let singleRoot;
  7133. for (let i = 0; i < children.length; i++) {
  7134. const child = children[i];
  7135. if (isVNode(child)) {
  7136. if (child.type !== Comment || child.children === "v-if") {
  7137. if (singleRoot) {
  7138. return;
  7139. } else {
  7140. singleRoot = child;
  7141. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  7142. return filterSingleRoot(singleRoot.children);
  7143. }
  7144. }
  7145. }
  7146. } else {
  7147. return;
  7148. }
  7149. }
  7150. return singleRoot;
  7151. }
  7152. const getFunctionalFallthrough = (attrs) => {
  7153. let res;
  7154. for (const key in attrs) {
  7155. if (key === "class" || key === "style" || isOn(key)) {
  7156. (res || (res = {}))[key] = attrs[key];
  7157. }
  7158. }
  7159. return res;
  7160. };
  7161. const filterModelListeners = (attrs, props) => {
  7162. const res = {};
  7163. for (const key in attrs) {
  7164. if (!isModelListener(key) || !(key.slice(9) in props)) {
  7165. res[key] = attrs[key];
  7166. }
  7167. }
  7168. return res;
  7169. };
  7170. const isElementRoot = (vnode) => {
  7171. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  7172. };
  7173. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  7174. const { props: prevProps, children: prevChildren, component } = prevVNode;
  7175. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  7176. const emits = component.emitsOptions;
  7177. if ((prevChildren || nextChildren) && isHmrUpdating) {
  7178. return true;
  7179. }
  7180. if (nextVNode.dirs || nextVNode.transition) {
  7181. return true;
  7182. }
  7183. if (optimized && patchFlag >= 0) {
  7184. if (patchFlag & 1024) {
  7185. return true;
  7186. }
  7187. if (patchFlag & 16) {
  7188. if (!prevProps) {
  7189. return !!nextProps;
  7190. }
  7191. return hasPropsChanged(prevProps, nextProps, emits);
  7192. } else if (patchFlag & 8) {
  7193. const dynamicProps = nextVNode.dynamicProps;
  7194. for (let i = 0; i < dynamicProps.length; i++) {
  7195. const key = dynamicProps[i];
  7196. if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emits, key)) {
  7197. return true;
  7198. }
  7199. }
  7200. }
  7201. } else {
  7202. if (prevChildren || nextChildren) {
  7203. if (!nextChildren || !nextChildren.$stable) {
  7204. return true;
  7205. }
  7206. }
  7207. if (prevProps === nextProps) {
  7208. return false;
  7209. }
  7210. if (!prevProps) {
  7211. return !!nextProps;
  7212. }
  7213. if (!nextProps) {
  7214. return true;
  7215. }
  7216. return hasPropsChanged(prevProps, nextProps, emits);
  7217. }
  7218. return false;
  7219. }
  7220. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  7221. const nextKeys = Object.keys(nextProps);
  7222. if (nextKeys.length !== Object.keys(prevProps).length) {
  7223. return true;
  7224. }
  7225. for (let i = 0; i < nextKeys.length; i++) {
  7226. const key = nextKeys[i];
  7227. if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) {
  7228. return true;
  7229. }
  7230. }
  7231. return false;
  7232. }
  7233. function hasPropValueChanged(nextProps, prevProps, key) {
  7234. const nextProp = nextProps[key];
  7235. const prevProp = prevProps[key];
  7236. if (key === "style" && isObject(nextProp) && isObject(prevProp)) {
  7237. return !looseEqual(nextProp, prevProp);
  7238. }
  7239. return nextProp !== prevProp;
  7240. }
  7241. function updateHOCHostEl({ vnode, parent, suspense }, el) {
  7242. while (parent) {
  7243. const root = parent.subTree;
  7244. if (root.suspense && root.suspense.activeBranch === vnode) {
  7245. root.suspense.vnode.el = root.el = el;
  7246. vnode = root;
  7247. }
  7248. if (root === vnode) {
  7249. (vnode = parent.vnode).el = el;
  7250. parent = parent.parent;
  7251. } else {
  7252. break;
  7253. }
  7254. }
  7255. if (suspense && suspense.activeBranch === vnode) {
  7256. suspense.vnode.el = el;
  7257. }
  7258. }
  7259. const internalObjectProto = {};
  7260. const createInternalObject = () => Object.create(internalObjectProto);
  7261. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  7262. function initProps(instance, rawProps, isStateful, isSSR = false) {
  7263. const props = {};
  7264. const attrs = createInternalObject();
  7265. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  7266. setFullProps(instance, rawProps, props, attrs);
  7267. for (const key in instance.propsOptions[0]) {
  7268. if (!(key in props)) {
  7269. props[key] = void 0;
  7270. }
  7271. }
  7272. {
  7273. validateProps(rawProps || {}, props, instance);
  7274. }
  7275. if (isStateful) {
  7276. instance.props = isSSR ? props : shallowReactive(props);
  7277. } else {
  7278. if (!instance.type.props) {
  7279. instance.props = attrs;
  7280. } else {
  7281. instance.props = props;
  7282. }
  7283. }
  7284. instance.attrs = attrs;
  7285. }
  7286. function isInHmrContext(instance) {
  7287. while (instance) {
  7288. if (instance.type.__hmrId) return true;
  7289. instance = instance.parent;
  7290. }
  7291. }
  7292. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  7293. const {
  7294. props,
  7295. attrs,
  7296. vnode: { patchFlag }
  7297. } = instance;
  7298. const rawCurrentProps = toRaw(props);
  7299. const [options] = instance.propsOptions;
  7300. let hasAttrsChanged = false;
  7301. if (
  7302. // always force full diff in dev
  7303. // - #1942 if hmr is enabled with sfc component
  7304. // - vite#872 non-sfc component used by sfc component
  7305. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  7306. ) {
  7307. if (patchFlag & 8) {
  7308. const propsToUpdate = instance.vnode.dynamicProps;
  7309. for (let i = 0; i < propsToUpdate.length; i++) {
  7310. let key = propsToUpdate[i];
  7311. if (isEmitListener(instance.emitsOptions, key)) {
  7312. continue;
  7313. }
  7314. const value = rawProps[key];
  7315. if (options) {
  7316. if (hasOwn(attrs, key)) {
  7317. if (value !== attrs[key]) {
  7318. attrs[key] = value;
  7319. hasAttrsChanged = true;
  7320. }
  7321. } else {
  7322. const camelizedKey = camelize(key);
  7323. props[camelizedKey] = resolvePropValue(
  7324. options,
  7325. rawCurrentProps,
  7326. camelizedKey,
  7327. value,
  7328. instance,
  7329. false
  7330. );
  7331. }
  7332. } else {
  7333. if (value !== attrs[key]) {
  7334. attrs[key] = value;
  7335. hasAttrsChanged = true;
  7336. }
  7337. }
  7338. }
  7339. }
  7340. } else {
  7341. if (setFullProps(instance, rawProps, props, attrs)) {
  7342. hasAttrsChanged = true;
  7343. }
  7344. let kebabKey;
  7345. for (const key in rawCurrentProps) {
  7346. if (!rawProps || // for camelCase
  7347. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  7348. // and converted to camelCase (#955)
  7349. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  7350. if (options) {
  7351. if (rawPrevProps && // for camelCase
  7352. (rawPrevProps[key] !== void 0 || // for kebab-case
  7353. rawPrevProps[kebabKey] !== void 0)) {
  7354. props[key] = resolvePropValue(
  7355. options,
  7356. rawCurrentProps,
  7357. key,
  7358. void 0,
  7359. instance,
  7360. true
  7361. );
  7362. }
  7363. } else {
  7364. delete props[key];
  7365. }
  7366. }
  7367. }
  7368. if (attrs !== rawCurrentProps) {
  7369. for (const key in attrs) {
  7370. if (!rawProps || !hasOwn(rawProps, key) && true) {
  7371. delete attrs[key];
  7372. hasAttrsChanged = true;
  7373. }
  7374. }
  7375. }
  7376. }
  7377. if (hasAttrsChanged) {
  7378. trigger(instance.attrs, "set", "");
  7379. }
  7380. {
  7381. validateProps(rawProps || {}, props, instance);
  7382. }
  7383. }
  7384. function setFullProps(instance, rawProps, props, attrs) {
  7385. const [options, needCastKeys] = instance.propsOptions;
  7386. let hasAttrsChanged = false;
  7387. let rawCastValues;
  7388. if (rawProps) {
  7389. for (let key in rawProps) {
  7390. if (isReservedProp(key)) {
  7391. continue;
  7392. }
  7393. const value = rawProps[key];
  7394. let camelKey;
  7395. if (options && hasOwn(options, camelKey = camelize(key))) {
  7396. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  7397. props[camelKey] = value;
  7398. } else {
  7399. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  7400. }
  7401. } else if (!isEmitListener(instance.emitsOptions, key)) {
  7402. if (!(key in attrs) || value !== attrs[key]) {
  7403. attrs[key] = value;
  7404. hasAttrsChanged = true;
  7405. }
  7406. }
  7407. }
  7408. }
  7409. if (needCastKeys) {
  7410. const rawCurrentProps = toRaw(props);
  7411. const castValues = rawCastValues || EMPTY_OBJ;
  7412. for (let i = 0; i < needCastKeys.length; i++) {
  7413. const key = needCastKeys[i];
  7414. props[key] = resolvePropValue(
  7415. options,
  7416. rawCurrentProps,
  7417. key,
  7418. castValues[key],
  7419. instance,
  7420. !hasOwn(castValues, key)
  7421. );
  7422. }
  7423. }
  7424. return hasAttrsChanged;
  7425. }
  7426. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  7427. const opt = options[key];
  7428. if (opt != null) {
  7429. const hasDefault = hasOwn(opt, "default");
  7430. if (hasDefault && value === void 0) {
  7431. const defaultValue = opt.default;
  7432. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  7433. const { propsDefaults } = instance;
  7434. if (key in propsDefaults) {
  7435. value = propsDefaults[key];
  7436. } else {
  7437. const reset = setCurrentInstance(instance);
  7438. value = propsDefaults[key] = defaultValue.call(
  7439. null,
  7440. props
  7441. );
  7442. reset();
  7443. }
  7444. } else {
  7445. value = defaultValue;
  7446. }
  7447. if (instance.ce) {
  7448. instance.ce._setProp(key, value);
  7449. }
  7450. }
  7451. if (opt[0 /* shouldCast */]) {
  7452. if (isAbsent && !hasDefault) {
  7453. value = false;
  7454. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  7455. value = true;
  7456. }
  7457. }
  7458. }
  7459. return value;
  7460. }
  7461. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  7462. function normalizePropsOptions(comp, appContext, asMixin = false) {
  7463. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  7464. const cached = cache.get(comp);
  7465. if (cached) {
  7466. return cached;
  7467. }
  7468. const raw = comp.props;
  7469. const normalized = {};
  7470. const needCastKeys = [];
  7471. let hasExtends = false;
  7472. if (!isFunction(comp)) {
  7473. const extendProps = (raw2) => {
  7474. hasExtends = true;
  7475. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  7476. extend(normalized, props);
  7477. if (keys) needCastKeys.push(...keys);
  7478. };
  7479. if (!asMixin && appContext.mixins.length) {
  7480. appContext.mixins.forEach(extendProps);
  7481. }
  7482. if (comp.extends) {
  7483. extendProps(comp.extends);
  7484. }
  7485. if (comp.mixins) {
  7486. comp.mixins.forEach(extendProps);
  7487. }
  7488. }
  7489. if (!raw && !hasExtends) {
  7490. if (isObject(comp)) {
  7491. cache.set(comp, EMPTY_ARR);
  7492. }
  7493. return EMPTY_ARR;
  7494. }
  7495. if (isArray(raw)) {
  7496. for (let i = 0; i < raw.length; i++) {
  7497. if (!isString(raw[i])) {
  7498. warn$1(`props must be strings when using array syntax.`, raw[i]);
  7499. }
  7500. const normalizedKey = camelize(raw[i]);
  7501. if (validatePropName(normalizedKey)) {
  7502. normalized[normalizedKey] = EMPTY_OBJ;
  7503. }
  7504. }
  7505. } else if (raw) {
  7506. if (!isObject(raw)) {
  7507. warn$1(`invalid props options`, raw);
  7508. }
  7509. for (const key in raw) {
  7510. const normalizedKey = camelize(key);
  7511. if (validatePropName(normalizedKey)) {
  7512. const opt = raw[key];
  7513. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  7514. const propType = prop.type;
  7515. let shouldCast = false;
  7516. let shouldCastTrue = true;
  7517. if (isArray(propType)) {
  7518. for (let index = 0; index < propType.length; ++index) {
  7519. const type = propType[index];
  7520. const typeName = isFunction(type) && type.name;
  7521. if (typeName === "Boolean") {
  7522. shouldCast = true;
  7523. break;
  7524. } else if (typeName === "String") {
  7525. shouldCastTrue = false;
  7526. }
  7527. }
  7528. } else {
  7529. shouldCast = isFunction(propType) && propType.name === "Boolean";
  7530. }
  7531. prop[0 /* shouldCast */] = shouldCast;
  7532. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  7533. if (shouldCast || hasOwn(prop, "default")) {
  7534. needCastKeys.push(normalizedKey);
  7535. }
  7536. }
  7537. }
  7538. }
  7539. const res = [normalized, needCastKeys];
  7540. if (isObject(comp)) {
  7541. cache.set(comp, res);
  7542. }
  7543. return res;
  7544. }
  7545. function validatePropName(key) {
  7546. if (key[0] !== "$" && !isReservedProp(key)) {
  7547. return true;
  7548. } else {
  7549. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  7550. }
  7551. return false;
  7552. }
  7553. function getType(ctor) {
  7554. if (ctor === null) {
  7555. return "null";
  7556. }
  7557. if (typeof ctor === "function") {
  7558. return ctor.name || "";
  7559. } else if (typeof ctor === "object") {
  7560. const name = ctor.constructor && ctor.constructor.name;
  7561. return name || "";
  7562. }
  7563. return "";
  7564. }
  7565. function validateProps(rawProps, props, instance) {
  7566. const resolvedValues = toRaw(props);
  7567. const options = instance.propsOptions[0];
  7568. const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
  7569. for (const key in options) {
  7570. let opt = options[key];
  7571. if (opt == null) continue;
  7572. validateProp(
  7573. key,
  7574. resolvedValues[key],
  7575. opt,
  7576. shallowReadonly(resolvedValues) ,
  7577. !camelizePropsKey.includes(key)
  7578. );
  7579. }
  7580. }
  7581. function validateProp(name, value, prop, props, isAbsent) {
  7582. const { type, required, validator, skipCheck } = prop;
  7583. if (required && isAbsent) {
  7584. warn$1('Missing required prop: "' + name + '"');
  7585. return;
  7586. }
  7587. if (value == null && !required) {
  7588. return;
  7589. }
  7590. if (type != null && type !== true && !skipCheck) {
  7591. let isValid = false;
  7592. const types = isArray(type) ? type : [type];
  7593. const expectedTypes = [];
  7594. for (let i = 0; i < types.length && !isValid; i++) {
  7595. const { valid, expectedType } = assertType(value, types[i]);
  7596. expectedTypes.push(expectedType || "");
  7597. isValid = valid;
  7598. }
  7599. if (!isValid) {
  7600. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  7601. return;
  7602. }
  7603. }
  7604. if (validator && !validator(value, props)) {
  7605. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  7606. }
  7607. }
  7608. const isSimpleType = /* @__PURE__ */ makeMap(
  7609. "String,Number,Boolean,Function,Symbol,BigInt"
  7610. );
  7611. function assertType(value, type) {
  7612. let valid;
  7613. const expectedType = getType(type);
  7614. if (expectedType === "null") {
  7615. valid = value === null;
  7616. } else if (isSimpleType(expectedType)) {
  7617. const t = typeof value;
  7618. valid = t === expectedType.toLowerCase();
  7619. if (!valid && t === "object") {
  7620. valid = value instanceof type;
  7621. }
  7622. } else if (expectedType === "Object") {
  7623. valid = isObject(value);
  7624. } else if (expectedType === "Array") {
  7625. valid = isArray(value);
  7626. } else {
  7627. valid = value instanceof type;
  7628. }
  7629. return {
  7630. valid,
  7631. expectedType
  7632. };
  7633. }
  7634. function getInvalidTypeMessage(name, value, expectedTypes) {
  7635. if (expectedTypes.length === 0) {
  7636. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  7637. }
  7638. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  7639. const expectedType = expectedTypes[0];
  7640. const receivedType = toRawType(value);
  7641. const expectedValue = styleValue(value, expectedType);
  7642. const receivedValue = styleValue(value, receivedType);
  7643. if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) {
  7644. message += ` with value ${expectedValue}`;
  7645. }
  7646. message += `, got ${receivedType} `;
  7647. if (isExplicable(receivedType)) {
  7648. message += `with value ${receivedValue}.`;
  7649. }
  7650. return message;
  7651. }
  7652. function styleValue(value, type) {
  7653. if (isSymbol(value)) {
  7654. return value.toString();
  7655. } else if (type === "String") {
  7656. return `"${value}"`;
  7657. } else if (type === "Number") {
  7658. return `${Number(value)}`;
  7659. } else {
  7660. return `${value}`;
  7661. }
  7662. }
  7663. function isExplicable(type) {
  7664. const explicitTypes = ["string", "number", "boolean"];
  7665. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  7666. }
  7667. function isCoercible(...args) {
  7668. return args.every((elem) => {
  7669. const value = elem.toLowerCase();
  7670. return value !== "boolean" && value !== "symbol";
  7671. });
  7672. }
  7673. const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
  7674. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  7675. const normalizeSlot = (key, rawSlot, ctx) => {
  7676. if (rawSlot._n) {
  7677. return rawSlot;
  7678. }
  7679. const normalized = withCtx((...args) => {
  7680. if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
  7681. warn$1(
  7682. `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.`
  7683. );
  7684. }
  7685. return normalizeSlotValue(rawSlot(...args));
  7686. }, ctx);
  7687. normalized._c = false;
  7688. return normalized;
  7689. };
  7690. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  7691. const ctx = rawSlots._ctx;
  7692. for (const key in rawSlots) {
  7693. if (isInternalKey(key)) continue;
  7694. const value = rawSlots[key];
  7695. if (isFunction(value)) {
  7696. slots[key] = normalizeSlot(key, value, ctx);
  7697. } else if (value != null) {
  7698. {
  7699. warn$1(
  7700. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  7701. );
  7702. }
  7703. const normalized = normalizeSlotValue(value);
  7704. slots[key] = () => normalized;
  7705. }
  7706. }
  7707. };
  7708. const normalizeVNodeSlots = (instance, children) => {
  7709. if (!isKeepAlive(instance.vnode) && true) {
  7710. warn$1(
  7711. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  7712. );
  7713. }
  7714. const normalized = normalizeSlotValue(children);
  7715. instance.slots.default = () => normalized;
  7716. };
  7717. const assignSlots = (slots, children, optimized) => {
  7718. for (const key in children) {
  7719. if (optimized || !isInternalKey(key)) {
  7720. slots[key] = children[key];
  7721. }
  7722. }
  7723. };
  7724. const initSlots = (instance, children, optimized) => {
  7725. const slots = instance.slots = createInternalObject();
  7726. if (instance.vnode.shapeFlag & 32) {
  7727. const type = children._;
  7728. if (type) {
  7729. assignSlots(slots, children, optimized);
  7730. if (optimized) {
  7731. def(slots, "_", type, true);
  7732. }
  7733. } else {
  7734. normalizeObjectSlots(children, slots);
  7735. }
  7736. } else if (children) {
  7737. normalizeVNodeSlots(instance, children);
  7738. }
  7739. };
  7740. const updateSlots = (instance, children, optimized) => {
  7741. const { vnode, slots } = instance;
  7742. let needDeletionCheck = true;
  7743. let deletionComparisonTarget = EMPTY_OBJ;
  7744. if (vnode.shapeFlag & 32) {
  7745. const type = children._;
  7746. if (type) {
  7747. if (isHmrUpdating) {
  7748. assignSlots(slots, children, optimized);
  7749. trigger(instance, "set", "$slots");
  7750. } else if (optimized && type === 1) {
  7751. needDeletionCheck = false;
  7752. } else {
  7753. assignSlots(slots, children, optimized);
  7754. }
  7755. } else {
  7756. needDeletionCheck = !children.$stable;
  7757. normalizeObjectSlots(children, slots);
  7758. }
  7759. deletionComparisonTarget = children;
  7760. } else if (children) {
  7761. normalizeVNodeSlots(instance, children);
  7762. deletionComparisonTarget = { default: 1 };
  7763. }
  7764. if (needDeletionCheck) {
  7765. for (const key in slots) {
  7766. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  7767. delete slots[key];
  7768. }
  7769. }
  7770. }
  7771. };
  7772. let supported;
  7773. let perf;
  7774. function startMeasure(instance, type) {
  7775. if (instance.appContext.config.performance && isSupported()) {
  7776. perf.mark(`vue-${type}-${instance.uid}`);
  7777. }
  7778. {
  7779. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  7780. }
  7781. }
  7782. function endMeasure(instance, type) {
  7783. if (instance.appContext.config.performance && isSupported()) {
  7784. const startTag = `vue-${type}-${instance.uid}`;
  7785. const endTag = startTag + `:end`;
  7786. const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
  7787. perf.mark(endTag);
  7788. perf.measure(measureName, startTag, endTag);
  7789. perf.clearMeasures(measureName);
  7790. perf.clearMarks(startTag);
  7791. perf.clearMarks(endTag);
  7792. }
  7793. {
  7794. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  7795. }
  7796. }
  7797. function isSupported() {
  7798. if (supported !== void 0) {
  7799. return supported;
  7800. }
  7801. if (typeof window !== "undefined" && window.performance) {
  7802. supported = true;
  7803. perf = window.performance;
  7804. } else {
  7805. supported = false;
  7806. }
  7807. return supported;
  7808. }
  7809. const queuePostRenderEffect = queueEffectWithSuspense ;
  7810. function createRenderer(options) {
  7811. return baseCreateRenderer(options);
  7812. }
  7813. function createHydrationRenderer(options) {
  7814. return baseCreateRenderer(options, createHydrationFunctions);
  7815. }
  7816. function baseCreateRenderer(options, createHydrationFns) {
  7817. const target = getGlobalThis();
  7818. target.__VUE__ = true;
  7819. {
  7820. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  7821. }
  7822. const {
  7823. insert: hostInsert,
  7824. remove: hostRemove,
  7825. patchProp: hostPatchProp,
  7826. createElement: hostCreateElement,
  7827. createText: hostCreateText,
  7828. createComment: hostCreateComment,
  7829. setText: hostSetText,
  7830. setElementText: hostSetElementText,
  7831. parentNode: hostParentNode,
  7832. nextSibling: hostNextSibling,
  7833. setScopeId: hostSetScopeId = NOOP,
  7834. insertStaticContent: hostInsertStaticContent
  7835. } = options;
  7836. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  7837. if (n1 === n2) {
  7838. return;
  7839. }
  7840. if (n1 && !isSameVNodeType(n1, n2)) {
  7841. anchor = getNextHostNode(n1);
  7842. unmount(n1, parentComponent, parentSuspense, true);
  7843. n1 = null;
  7844. }
  7845. if (n2.patchFlag === -2) {
  7846. optimized = false;
  7847. n2.dynamicChildren = null;
  7848. }
  7849. if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
  7850. if (n2.dynamicChildren === EMPTY_ARR) {
  7851. n2.dynamicChildren = [];
  7852. }
  7853. n2.dynamicChildren.hasOnce = true;
  7854. }
  7855. const { type, ref, shapeFlag } = n2;
  7856. switch (type) {
  7857. case Text:
  7858. processText(n1, n2, container, anchor);
  7859. break;
  7860. case Comment:
  7861. processCommentNode(n1, n2, container, anchor);
  7862. break;
  7863. case Static:
  7864. if (n1 == null) {
  7865. mountStaticNode(n2, container, anchor, namespace);
  7866. } else {
  7867. patchStaticNode(n1, n2, container, namespace);
  7868. }
  7869. break;
  7870. case Fragment:
  7871. processFragment(
  7872. n1,
  7873. n2,
  7874. container,
  7875. anchor,
  7876. parentComponent,
  7877. parentSuspense,
  7878. namespace,
  7879. slotScopeIds,
  7880. optimized
  7881. );
  7882. break;
  7883. default:
  7884. if (shapeFlag & 1) {
  7885. processElement(
  7886. n1,
  7887. n2,
  7888. container,
  7889. anchor,
  7890. parentComponent,
  7891. parentSuspense,
  7892. namespace,
  7893. slotScopeIds,
  7894. optimized
  7895. );
  7896. } else if (shapeFlag & 6) {
  7897. processComponent(
  7898. n1,
  7899. n2,
  7900. container,
  7901. anchor,
  7902. parentComponent,
  7903. parentSuspense,
  7904. namespace,
  7905. slotScopeIds,
  7906. optimized
  7907. );
  7908. } else if (shapeFlag & 64) {
  7909. type.process(
  7910. n1,
  7911. n2,
  7912. container,
  7913. anchor,
  7914. parentComponent,
  7915. parentSuspense,
  7916. namespace,
  7917. slotScopeIds,
  7918. optimized,
  7919. internals
  7920. );
  7921. } else if (shapeFlag & 128) {
  7922. type.process(
  7923. n1,
  7924. n2,
  7925. container,
  7926. anchor,
  7927. parentComponent,
  7928. parentSuspense,
  7929. namespace,
  7930. slotScopeIds,
  7931. optimized,
  7932. internals
  7933. );
  7934. } else {
  7935. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  7936. }
  7937. }
  7938. if (ref != null && parentComponent) {
  7939. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  7940. } else if (ref == null && n1 && n1.ref != null) {
  7941. setRef(n1.ref, null, parentSuspense, n1, true);
  7942. }
  7943. };
  7944. const processText = (n1, n2, container, anchor) => {
  7945. if (n1 == null) {
  7946. hostInsert(
  7947. n2.el = hostCreateText(n2.children),
  7948. container,
  7949. anchor
  7950. );
  7951. } else {
  7952. const el = n2.el = n1.el;
  7953. if (n2.children !== n1.children) {
  7954. hostSetText(el, n2.children);
  7955. }
  7956. }
  7957. };
  7958. const processCommentNode = (n1, n2, container, anchor) => {
  7959. if (n1 == null) {
  7960. hostInsert(
  7961. n2.el = hostCreateComment(n2.children || ""),
  7962. container,
  7963. anchor
  7964. );
  7965. } else {
  7966. n2.el = n1.el;
  7967. }
  7968. };
  7969. const mountStaticNode = (n2, container, anchor, namespace) => {
  7970. [n2.el, n2.anchor] = hostInsertStaticContent(
  7971. n2.children,
  7972. container,
  7973. anchor,
  7974. namespace,
  7975. n2.el,
  7976. n2.anchor
  7977. );
  7978. };
  7979. const patchStaticNode = (n1, n2, container, namespace) => {
  7980. if (n2.children !== n1.children) {
  7981. const anchor = hostNextSibling(n1.anchor);
  7982. removeStaticNode(n1);
  7983. [n2.el, n2.anchor] = hostInsertStaticContent(
  7984. n2.children,
  7985. container,
  7986. anchor,
  7987. namespace
  7988. );
  7989. } else {
  7990. n2.el = n1.el;
  7991. n2.anchor = n1.anchor;
  7992. }
  7993. };
  7994. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  7995. let next;
  7996. while (el && el !== anchor) {
  7997. next = hostNextSibling(el);
  7998. hostInsert(el, container, nextSibling);
  7999. el = next;
  8000. }
  8001. hostInsert(anchor, container, nextSibling);
  8002. };
  8003. const removeStaticNode = ({ el, anchor }) => {
  8004. let next;
  8005. while (el && el !== anchor) {
  8006. next = hostNextSibling(el);
  8007. hostRemove(el);
  8008. el = next;
  8009. }
  8010. hostRemove(anchor);
  8011. };
  8012. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8013. if (n2.type === "svg") {
  8014. namespace = "svg";
  8015. } else if (n2.type === "math") {
  8016. namespace = "mathml";
  8017. }
  8018. if (n1 == null) {
  8019. mountElement(
  8020. n2,
  8021. container,
  8022. anchor,
  8023. parentComponent,
  8024. parentSuspense,
  8025. namespace,
  8026. slotScopeIds,
  8027. optimized
  8028. );
  8029. } else {
  8030. const customElement = n1.el && n1.el._isVueCE ? n1.el : null;
  8031. try {
  8032. if (customElement) {
  8033. customElement._beginPatch();
  8034. }
  8035. patchElement(
  8036. n1,
  8037. n2,
  8038. parentComponent,
  8039. parentSuspense,
  8040. namespace,
  8041. slotScopeIds,
  8042. optimized
  8043. );
  8044. } finally {
  8045. if (customElement) {
  8046. customElement._endPatch();
  8047. }
  8048. }
  8049. }
  8050. };
  8051. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8052. let el;
  8053. let vnodeHook;
  8054. const { props, shapeFlag, transition, dirs } = vnode;
  8055. el = vnode.el = hostCreateElement(
  8056. vnode.type,
  8057. namespace,
  8058. props && props.is,
  8059. props
  8060. );
  8061. if (shapeFlag & 8) {
  8062. hostSetElementText(el, vnode.children);
  8063. } else if (shapeFlag & 16) {
  8064. mountChildren(
  8065. vnode.children,
  8066. el,
  8067. null,
  8068. parentComponent,
  8069. parentSuspense,
  8070. resolveChildrenNamespace(vnode, namespace),
  8071. slotScopeIds,
  8072. optimized
  8073. );
  8074. }
  8075. if (dirs) {
  8076. invokeDirectiveHook(vnode, null, parentComponent, "created");
  8077. }
  8078. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  8079. if (props) {
  8080. for (const key in props) {
  8081. if (key !== "value" && !isReservedProp(key)) {
  8082. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  8083. }
  8084. }
  8085. if ("value" in props) {
  8086. hostPatchProp(el, "value", null, props.value, namespace);
  8087. }
  8088. if (vnodeHook = props.onVnodeBeforeMount) {
  8089. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8090. }
  8091. }
  8092. {
  8093. def(el, "__vnode", vnode, true);
  8094. def(el, "__vueParentComponent", parentComponent, true);
  8095. }
  8096. if (dirs) {
  8097. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  8098. }
  8099. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  8100. if (needCallTransitionHooks) {
  8101. transition.beforeEnter(el);
  8102. }
  8103. hostInsert(el, container, anchor);
  8104. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  8105. const isHmr = isHmrUpdating;
  8106. queuePostRenderEffect(() => {
  8107. let prev;
  8108. prev = setHmrUpdating(isHmr);
  8109. try {
  8110. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8111. needCallTransitionHooks && transition.enter(el);
  8112. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  8113. } finally {
  8114. setHmrUpdating(prev);
  8115. }
  8116. }, parentSuspense);
  8117. }
  8118. };
  8119. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  8120. if (scopeId) {
  8121. hostSetScopeId(el, scopeId);
  8122. }
  8123. if (slotScopeIds) {
  8124. for (let i = 0; i < slotScopeIds.length; i++) {
  8125. hostSetScopeId(el, slotScopeIds[i]);
  8126. }
  8127. }
  8128. if (parentComponent) {
  8129. let subTree = parentComponent.subTree;
  8130. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  8131. subTree = filterSingleRoot(subTree.children) || subTree;
  8132. }
  8133. if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
  8134. const parentVNode = parentComponent.vnode;
  8135. setScopeId(
  8136. el,
  8137. parentVNode,
  8138. parentVNode.scopeId,
  8139. parentVNode.slotScopeIds,
  8140. parentComponent.parent
  8141. );
  8142. }
  8143. }
  8144. };
  8145. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  8146. for (let i = start; i < children.length; i++) {
  8147. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  8148. patch(
  8149. null,
  8150. child,
  8151. container,
  8152. anchor,
  8153. parentComponent,
  8154. parentSuspense,
  8155. namespace,
  8156. slotScopeIds,
  8157. optimized
  8158. );
  8159. }
  8160. };
  8161. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8162. const el = n2.el = n1.el;
  8163. {
  8164. el.__vnode = n2;
  8165. }
  8166. let { patchFlag, dynamicChildren, dirs } = n2;
  8167. patchFlag |= n1.patchFlag & 16;
  8168. const oldProps = n1.props || EMPTY_OBJ;
  8169. const newProps = n2.props || EMPTY_OBJ;
  8170. let vnodeHook;
  8171. parentComponent && toggleRecurse(parentComponent, false);
  8172. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  8173. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  8174. }
  8175. if (dirs) {
  8176. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  8177. }
  8178. parentComponent && toggleRecurse(parentComponent, true);
  8179. if (
  8180. // HMR updated, force full diff
  8181. isHmrUpdating || // #6385 the old vnode may be a user-wrapped non-isomorphic block
  8182. // Force full diff when block metadata is unstable.
  8183. dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)
  8184. ) {
  8185. patchFlag = 0;
  8186. optimized = false;
  8187. dynamicChildren = null;
  8188. }
  8189. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  8190. hostSetElementText(el, "");
  8191. }
  8192. if (dynamicChildren) {
  8193. patchBlockChildren(
  8194. n1.dynamicChildren,
  8195. dynamicChildren,
  8196. el,
  8197. parentComponent,
  8198. parentSuspense,
  8199. resolveChildrenNamespace(n2, namespace),
  8200. slotScopeIds
  8201. );
  8202. {
  8203. traverseStaticChildren(n1, n2);
  8204. }
  8205. } else if (!optimized) {
  8206. patchChildren(
  8207. n1,
  8208. n2,
  8209. el,
  8210. null,
  8211. parentComponent,
  8212. parentSuspense,
  8213. resolveChildrenNamespace(n2, namespace),
  8214. slotScopeIds,
  8215. false
  8216. );
  8217. }
  8218. if (patchFlag > 0) {
  8219. if (patchFlag & 16) {
  8220. patchProps(el, oldProps, newProps, parentComponent, namespace);
  8221. } else {
  8222. if (patchFlag & 2) {
  8223. if (oldProps.class !== newProps.class) {
  8224. hostPatchProp(el, "class", null, newProps.class, namespace);
  8225. }
  8226. }
  8227. if (patchFlag & 4) {
  8228. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  8229. }
  8230. if (patchFlag & 8) {
  8231. const propsToUpdate = n2.dynamicProps;
  8232. for (let i = 0; i < propsToUpdate.length; i++) {
  8233. const key = propsToUpdate[i];
  8234. const prev = oldProps[key];
  8235. const next = newProps[key];
  8236. if (next !== prev || key === "value") {
  8237. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  8238. }
  8239. }
  8240. }
  8241. }
  8242. if (patchFlag & 1) {
  8243. if (n1.children !== n2.children) {
  8244. hostSetElementText(el, n2.children);
  8245. }
  8246. }
  8247. } else if (!optimized && dynamicChildren == null) {
  8248. patchProps(el, oldProps, newProps, parentComponent, namespace);
  8249. }
  8250. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  8251. queuePostRenderEffect(() => {
  8252. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  8253. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  8254. }, parentSuspense);
  8255. }
  8256. };
  8257. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  8258. for (let i = 0; i < newChildren.length; i++) {
  8259. const oldVNode = oldChildren[i];
  8260. const newVNode = newChildren[i];
  8261. const container = (
  8262. // oldVNode may be an errored async setup() component inside Suspense
  8263. // which will not have a mounted element
  8264. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  8265. // of the Fragment itself so it can move its children.
  8266. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  8267. // which also requires the correct parent container
  8268. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  8269. oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
  8270. // In other cases, the parent container is not actually used so we
  8271. // just pass the block element here to avoid a DOM parentNode call.
  8272. fallbackContainer
  8273. )
  8274. );
  8275. patch(
  8276. oldVNode,
  8277. newVNode,
  8278. container,
  8279. null,
  8280. parentComponent,
  8281. parentSuspense,
  8282. namespace,
  8283. slotScopeIds,
  8284. true
  8285. );
  8286. }
  8287. };
  8288. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  8289. if (oldProps !== newProps) {
  8290. if (oldProps !== EMPTY_OBJ) {
  8291. for (const key in oldProps) {
  8292. if (!isReservedProp(key) && !(key in newProps)) {
  8293. hostPatchProp(
  8294. el,
  8295. key,
  8296. oldProps[key],
  8297. null,
  8298. namespace,
  8299. parentComponent
  8300. );
  8301. }
  8302. }
  8303. }
  8304. for (const key in newProps) {
  8305. if (isReservedProp(key)) continue;
  8306. const next = newProps[key];
  8307. const prev = oldProps[key];
  8308. if (next !== prev && key !== "value") {
  8309. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  8310. }
  8311. }
  8312. if ("value" in newProps) {
  8313. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  8314. }
  8315. }
  8316. };
  8317. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8318. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  8319. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  8320. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  8321. if (
  8322. // #5523 dev root fragment may inherit directives
  8323. isHmrUpdating || patchFlag & 2048
  8324. ) {
  8325. patchFlag = 0;
  8326. optimized = false;
  8327. dynamicChildren = null;
  8328. }
  8329. if (fragmentSlotScopeIds) {
  8330. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  8331. }
  8332. if (n1 == null) {
  8333. hostInsert(fragmentStartAnchor, container, anchor);
  8334. hostInsert(fragmentEndAnchor, container, anchor);
  8335. mountChildren(
  8336. // #10007
  8337. // such fragment like `<></>` will be compiled into
  8338. // a fragment which doesn't have a children.
  8339. // In this case fallback to an empty array
  8340. n2.children || [],
  8341. container,
  8342. fragmentEndAnchor,
  8343. parentComponent,
  8344. parentSuspense,
  8345. namespace,
  8346. slotScopeIds,
  8347. optimized
  8348. );
  8349. } else {
  8350. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  8351. // of renderSlot() with no valid children
  8352. n1.dynamicChildren && n1.dynamicChildren.length === dynamicChildren.length) {
  8353. patchBlockChildren(
  8354. n1.dynamicChildren,
  8355. dynamicChildren,
  8356. container,
  8357. parentComponent,
  8358. parentSuspense,
  8359. namespace,
  8360. slotScopeIds
  8361. );
  8362. {
  8363. traverseStaticChildren(n1, n2);
  8364. }
  8365. } else {
  8366. patchChildren(
  8367. n1,
  8368. n2,
  8369. container,
  8370. fragmentEndAnchor,
  8371. parentComponent,
  8372. parentSuspense,
  8373. namespace,
  8374. slotScopeIds,
  8375. optimized
  8376. );
  8377. }
  8378. }
  8379. };
  8380. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8381. n2.slotScopeIds = slotScopeIds;
  8382. if (n1 == null) {
  8383. if (n2.shapeFlag & 512) {
  8384. parentComponent.ctx.activate(
  8385. n2,
  8386. container,
  8387. anchor,
  8388. namespace,
  8389. optimized
  8390. );
  8391. } else {
  8392. mountComponent(
  8393. n2,
  8394. container,
  8395. anchor,
  8396. parentComponent,
  8397. parentSuspense,
  8398. namespace,
  8399. optimized
  8400. );
  8401. }
  8402. } else {
  8403. updateComponent(n1, n2, optimized);
  8404. }
  8405. };
  8406. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  8407. const instance = (initialVNode.component = createComponentInstance(
  8408. initialVNode,
  8409. parentComponent,
  8410. parentSuspense
  8411. ));
  8412. if (instance.type.__hmrId) {
  8413. registerHMR(instance);
  8414. }
  8415. {
  8416. pushWarningContext(initialVNode);
  8417. startMeasure(instance, `mount`);
  8418. }
  8419. if (isKeepAlive(initialVNode)) {
  8420. instance.ctx.renderer = internals;
  8421. }
  8422. {
  8423. {
  8424. startMeasure(instance, `init`);
  8425. }
  8426. setupComponent(instance, false, optimized);
  8427. {
  8428. endMeasure(instance, `init`);
  8429. }
  8430. }
  8431. if (isHmrUpdating) initialVNode.el = null;
  8432. if (instance.asyncDep) {
  8433. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  8434. if (!initialVNode.el) {
  8435. const placeholder = instance.subTree = createVNode(Comment);
  8436. processCommentNode(null, placeholder, container, anchor);
  8437. initialVNode.placeholder = placeholder.el;
  8438. }
  8439. } else {
  8440. setupRenderEffect(
  8441. instance,
  8442. initialVNode,
  8443. container,
  8444. anchor,
  8445. parentSuspense,
  8446. namespace,
  8447. optimized
  8448. );
  8449. }
  8450. {
  8451. popWarningContext();
  8452. endMeasure(instance, `mount`);
  8453. }
  8454. };
  8455. const updateComponent = (n1, n2, optimized) => {
  8456. const instance = n2.component = n1.component;
  8457. if (shouldUpdateComponent(n1, n2, optimized)) {
  8458. if (instance.asyncDep && !instance.asyncResolved) {
  8459. {
  8460. pushWarningContext(n2);
  8461. }
  8462. n2.el = n1.el;
  8463. updateComponentPreRender(instance, n2, optimized);
  8464. {
  8465. popWarningContext();
  8466. }
  8467. return;
  8468. } else {
  8469. instance.next = n2;
  8470. instance.update();
  8471. }
  8472. } else {
  8473. n2.el = n1.el;
  8474. instance.vnode = n2;
  8475. }
  8476. };
  8477. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  8478. const componentUpdateFn = () => {
  8479. if (!instance.isMounted) {
  8480. let vnodeHook;
  8481. const { el, props } = initialVNode;
  8482. const { bm, m, parent, root, type } = instance;
  8483. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  8484. toggleRecurse(instance, false);
  8485. if (bm) {
  8486. invokeArrayFns(bm);
  8487. }
  8488. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  8489. invokeVNodeHook(vnodeHook, parent, initialVNode);
  8490. }
  8491. toggleRecurse(instance, true);
  8492. if (el && hydrateNode) {
  8493. const hydrateSubTree = () => {
  8494. {
  8495. startMeasure(instance, `render`);
  8496. }
  8497. instance.subTree = renderComponentRoot(instance);
  8498. {
  8499. endMeasure(instance, `render`);
  8500. }
  8501. {
  8502. startMeasure(instance, `hydrate`);
  8503. }
  8504. hydrateNode(
  8505. el,
  8506. instance.subTree,
  8507. instance,
  8508. parentSuspense,
  8509. null
  8510. );
  8511. {
  8512. endMeasure(instance, `hydrate`);
  8513. }
  8514. };
  8515. if (isAsyncWrapperVNode && type.__asyncHydrate) {
  8516. type.__asyncHydrate(
  8517. el,
  8518. instance,
  8519. hydrateSubTree
  8520. );
  8521. } else {
  8522. hydrateSubTree();
  8523. }
  8524. } else {
  8525. if (root.ce && root.ce._hasShadowRoot()) {
  8526. root.ce._injectChildStyle(
  8527. type,
  8528. instance.parent ? instance.parent.type : void 0
  8529. );
  8530. }
  8531. {
  8532. startMeasure(instance, `render`);
  8533. }
  8534. const subTree = instance.subTree = renderComponentRoot(instance);
  8535. {
  8536. endMeasure(instance, `render`);
  8537. }
  8538. {
  8539. startMeasure(instance, `patch`);
  8540. }
  8541. patch(
  8542. null,
  8543. subTree,
  8544. container,
  8545. anchor,
  8546. instance,
  8547. parentSuspense,
  8548. namespace
  8549. );
  8550. {
  8551. endMeasure(instance, `patch`);
  8552. }
  8553. initialVNode.el = subTree.el;
  8554. }
  8555. if (m) {
  8556. queuePostRenderEffect(m, parentSuspense);
  8557. }
  8558. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  8559. const scopedInitialVNode = initialVNode;
  8560. queuePostRenderEffect(
  8561. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  8562. parentSuspense
  8563. );
  8564. }
  8565. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  8566. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  8567. }
  8568. instance.isMounted = true;
  8569. {
  8570. devtoolsComponentAdded(instance);
  8571. }
  8572. initialVNode = container = anchor = null;
  8573. } else {
  8574. let { next, bu, u, parent, vnode } = instance;
  8575. {
  8576. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  8577. if (nonHydratedAsyncRoot) {
  8578. if (next) {
  8579. next.el = vnode.el;
  8580. updateComponentPreRender(instance, next, optimized);
  8581. }
  8582. nonHydratedAsyncRoot.asyncDep.then(() => {
  8583. queuePostRenderEffect(() => {
  8584. if (!instance.isUnmounted) update();
  8585. }, parentSuspense);
  8586. });
  8587. return;
  8588. }
  8589. }
  8590. let originNext = next;
  8591. let vnodeHook;
  8592. {
  8593. pushWarningContext(next || instance.vnode);
  8594. }
  8595. toggleRecurse(instance, false);
  8596. if (next) {
  8597. next.el = vnode.el;
  8598. updateComponentPreRender(instance, next, optimized);
  8599. } else {
  8600. next = vnode;
  8601. }
  8602. if (bu) {
  8603. invokeArrayFns(bu);
  8604. }
  8605. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  8606. invokeVNodeHook(vnodeHook, parent, next, vnode);
  8607. }
  8608. toggleRecurse(instance, true);
  8609. {
  8610. startMeasure(instance, `render`);
  8611. }
  8612. const nextTree = renderComponentRoot(instance);
  8613. {
  8614. endMeasure(instance, `render`);
  8615. }
  8616. const prevTree = instance.subTree;
  8617. instance.subTree = nextTree;
  8618. {
  8619. startMeasure(instance, `patch`);
  8620. }
  8621. patch(
  8622. prevTree,
  8623. nextTree,
  8624. // parent may have changed if it's in a teleport
  8625. hostParentNode(prevTree.el),
  8626. // anchor may have changed if it's in a fragment
  8627. getNextHostNode(prevTree),
  8628. instance,
  8629. parentSuspense,
  8630. namespace
  8631. );
  8632. {
  8633. endMeasure(instance, `patch`);
  8634. }
  8635. next.el = nextTree.el;
  8636. if (originNext === null) {
  8637. updateHOCHostEl(instance, nextTree.el);
  8638. }
  8639. if (u) {
  8640. queuePostRenderEffect(u, parentSuspense);
  8641. }
  8642. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  8643. queuePostRenderEffect(
  8644. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  8645. parentSuspense
  8646. );
  8647. }
  8648. {
  8649. devtoolsComponentUpdated(instance);
  8650. }
  8651. {
  8652. popWarningContext();
  8653. }
  8654. }
  8655. };
  8656. instance.scope.on();
  8657. const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
  8658. instance.scope.off();
  8659. const update = instance.update = effect.run.bind(effect);
  8660. const job = instance.job = effect.runIfDirty.bind(effect);
  8661. job.i = instance;
  8662. job.id = instance.uid;
  8663. effect.scheduler = () => queueJob(job);
  8664. toggleRecurse(instance, true);
  8665. {
  8666. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  8667. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  8668. }
  8669. update();
  8670. };
  8671. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  8672. nextVNode.component = instance;
  8673. const prevProps = instance.vnode.props;
  8674. instance.vnode = nextVNode;
  8675. instance.next = null;
  8676. updateProps(instance, nextVNode.props, prevProps, optimized);
  8677. updateSlots(instance, nextVNode.children, optimized);
  8678. pauseTracking();
  8679. flushPreFlushCbs(instance);
  8680. resetTracking();
  8681. };
  8682. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  8683. const c1 = n1 && n1.children;
  8684. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  8685. const c2 = n2.children;
  8686. const { patchFlag, shapeFlag } = n2;
  8687. if (patchFlag > 0) {
  8688. if (patchFlag & 128) {
  8689. patchKeyedChildren(
  8690. c1,
  8691. c2,
  8692. container,
  8693. anchor,
  8694. parentComponent,
  8695. parentSuspense,
  8696. namespace,
  8697. slotScopeIds,
  8698. optimized
  8699. );
  8700. return;
  8701. } else if (patchFlag & 256) {
  8702. patchUnkeyedChildren(
  8703. c1,
  8704. c2,
  8705. container,
  8706. anchor,
  8707. parentComponent,
  8708. parentSuspense,
  8709. namespace,
  8710. slotScopeIds,
  8711. optimized
  8712. );
  8713. return;
  8714. }
  8715. }
  8716. if (shapeFlag & 8) {
  8717. if (prevShapeFlag & 16) {
  8718. unmountChildren(c1, parentComponent, parentSuspense);
  8719. }
  8720. if (c2 !== c1) {
  8721. hostSetElementText(container, c2);
  8722. }
  8723. } else {
  8724. if (prevShapeFlag & 16) {
  8725. if (shapeFlag & 16) {
  8726. patchKeyedChildren(
  8727. c1,
  8728. c2,
  8729. container,
  8730. anchor,
  8731. parentComponent,
  8732. parentSuspense,
  8733. namespace,
  8734. slotScopeIds,
  8735. optimized
  8736. );
  8737. } else {
  8738. unmountChildren(c1, parentComponent, parentSuspense, true);
  8739. }
  8740. } else {
  8741. if (prevShapeFlag & 8) {
  8742. hostSetElementText(container, "");
  8743. }
  8744. if (shapeFlag & 16) {
  8745. mountChildren(
  8746. c2,
  8747. container,
  8748. anchor,
  8749. parentComponent,
  8750. parentSuspense,
  8751. namespace,
  8752. slotScopeIds,
  8753. optimized
  8754. );
  8755. }
  8756. }
  8757. }
  8758. };
  8759. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8760. c1 = c1 || EMPTY_ARR;
  8761. c2 = c2 || EMPTY_ARR;
  8762. const oldLength = c1.length;
  8763. const newLength = c2.length;
  8764. const commonLength = Math.min(oldLength, newLength);
  8765. let i;
  8766. for (i = 0; i < commonLength; i++) {
  8767. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  8768. patch(
  8769. c1[i],
  8770. nextChild,
  8771. container,
  8772. null,
  8773. parentComponent,
  8774. parentSuspense,
  8775. namespace,
  8776. slotScopeIds,
  8777. optimized
  8778. );
  8779. }
  8780. if (oldLength > newLength) {
  8781. unmountChildren(
  8782. c1,
  8783. parentComponent,
  8784. parentSuspense,
  8785. true,
  8786. false,
  8787. commonLength
  8788. );
  8789. } else {
  8790. mountChildren(
  8791. c2,
  8792. container,
  8793. anchor,
  8794. parentComponent,
  8795. parentSuspense,
  8796. namespace,
  8797. slotScopeIds,
  8798. optimized,
  8799. commonLength
  8800. );
  8801. }
  8802. };
  8803. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8804. let i = 0;
  8805. const l2 = c2.length;
  8806. let e1 = c1.length - 1;
  8807. let e2 = l2 - 1;
  8808. while (i <= e1 && i <= e2) {
  8809. const n1 = c1[i];
  8810. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  8811. if (isSameVNodeType(n1, n2)) {
  8812. patch(
  8813. n1,
  8814. n2,
  8815. container,
  8816. null,
  8817. parentComponent,
  8818. parentSuspense,
  8819. namespace,
  8820. slotScopeIds,
  8821. optimized
  8822. );
  8823. } else {
  8824. break;
  8825. }
  8826. i++;
  8827. }
  8828. while (i <= e1 && i <= e2) {
  8829. const n1 = c1[e1];
  8830. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  8831. if (isSameVNodeType(n1, n2)) {
  8832. patch(
  8833. n1,
  8834. n2,
  8835. container,
  8836. null,
  8837. parentComponent,
  8838. parentSuspense,
  8839. namespace,
  8840. slotScopeIds,
  8841. optimized
  8842. );
  8843. } else {
  8844. break;
  8845. }
  8846. e1--;
  8847. e2--;
  8848. }
  8849. if (i > e1) {
  8850. if (i <= e2) {
  8851. const nextPos = e2 + 1;
  8852. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  8853. while (i <= e2) {
  8854. patch(
  8855. null,
  8856. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  8857. container,
  8858. anchor,
  8859. parentComponent,
  8860. parentSuspense,
  8861. namespace,
  8862. slotScopeIds,
  8863. optimized
  8864. );
  8865. i++;
  8866. }
  8867. }
  8868. } else if (i > e2) {
  8869. while (i <= e1) {
  8870. unmount(c1[i], parentComponent, parentSuspense, true);
  8871. i++;
  8872. }
  8873. } else {
  8874. const s1 = i;
  8875. const s2 = i;
  8876. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  8877. for (i = s2; i <= e2; i++) {
  8878. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  8879. if (nextChild.key != null) {
  8880. if (keyToNewIndexMap.has(nextChild.key)) {
  8881. warn$1(
  8882. `Duplicate keys found during update:`,
  8883. JSON.stringify(nextChild.key),
  8884. `Make sure keys are unique.`
  8885. );
  8886. }
  8887. keyToNewIndexMap.set(nextChild.key, i);
  8888. }
  8889. }
  8890. let j;
  8891. let patched = 0;
  8892. const toBePatched = e2 - s2 + 1;
  8893. let moved = false;
  8894. let maxNewIndexSoFar = 0;
  8895. const newIndexToOldIndexMap = new Array(toBePatched);
  8896. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  8897. for (i = s1; i <= e1; i++) {
  8898. const prevChild = c1[i];
  8899. if (patched >= toBePatched) {
  8900. unmount(prevChild, parentComponent, parentSuspense, true);
  8901. continue;
  8902. }
  8903. let newIndex;
  8904. if (prevChild.key != null) {
  8905. newIndex = keyToNewIndexMap.get(prevChild.key);
  8906. } else {
  8907. for (j = s2; j <= e2; j++) {
  8908. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  8909. newIndex = j;
  8910. break;
  8911. }
  8912. }
  8913. }
  8914. if (newIndex === void 0) {
  8915. unmount(prevChild, parentComponent, parentSuspense, true);
  8916. } else {
  8917. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  8918. if (newIndex >= maxNewIndexSoFar) {
  8919. maxNewIndexSoFar = newIndex;
  8920. } else {
  8921. moved = true;
  8922. }
  8923. patch(
  8924. prevChild,
  8925. c2[newIndex],
  8926. container,
  8927. null,
  8928. parentComponent,
  8929. parentSuspense,
  8930. namespace,
  8931. slotScopeIds,
  8932. optimized
  8933. );
  8934. patched++;
  8935. }
  8936. }
  8937. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  8938. j = increasingNewIndexSequence.length - 1;
  8939. for (i = toBePatched - 1; i >= 0; i--) {
  8940. const nextIndex = s2 + i;
  8941. const nextChild = c2[nextIndex];
  8942. const anchorVNode = c2[nextIndex + 1];
  8943. const anchor = nextIndex + 1 < l2 ? (
  8944. // #13559, #14173 fallback to el placeholder for unresolved async component
  8945. anchorVNode.el || resolveAsyncComponentPlaceholder(anchorVNode)
  8946. ) : parentAnchor;
  8947. if (newIndexToOldIndexMap[i] === 0) {
  8948. patch(
  8949. null,
  8950. nextChild,
  8951. container,
  8952. anchor,
  8953. parentComponent,
  8954. parentSuspense,
  8955. namespace,
  8956. slotScopeIds,
  8957. optimized
  8958. );
  8959. } else if (moved) {
  8960. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  8961. move(nextChild, container, anchor, 2);
  8962. } else {
  8963. j--;
  8964. }
  8965. }
  8966. }
  8967. }
  8968. };
  8969. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  8970. const { el, type, transition, children, shapeFlag } = vnode;
  8971. if (shapeFlag & 6) {
  8972. move(vnode.component.subTree, container, anchor, moveType);
  8973. return;
  8974. }
  8975. if (shapeFlag & 128) {
  8976. vnode.suspense.move(container, anchor, moveType);
  8977. return;
  8978. }
  8979. if (shapeFlag & 64) {
  8980. type.move(vnode, container, anchor, internals);
  8981. return;
  8982. }
  8983. if (type === Fragment) {
  8984. hostInsert(el, container, anchor);
  8985. for (let i = 0; i < children.length; i++) {
  8986. move(children[i], container, anchor, moveType);
  8987. }
  8988. hostInsert(vnode.anchor, container, anchor);
  8989. return;
  8990. }
  8991. if (type === Static) {
  8992. moveStaticNode(vnode, container, anchor);
  8993. return;
  8994. }
  8995. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  8996. if (needTransition2) {
  8997. if (moveType === 0) {
  8998. if (transition.persisted && !el[leaveCbKey]) {
  8999. hostInsert(el, container, anchor);
  9000. } else {
  9001. transition.beforeEnter(el);
  9002. hostInsert(el, container, anchor);
  9003. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  9004. }
  9005. } else {
  9006. const { leave, delayLeave, afterLeave } = transition;
  9007. const remove2 = () => {
  9008. if (vnode.ctx.isUnmounted) {
  9009. hostRemove(el);
  9010. } else {
  9011. hostInsert(el, container, anchor);
  9012. }
  9013. };
  9014. const performLeave = () => {
  9015. const wasLeaving = el._isLeaving || !!el[leaveCbKey];
  9016. if (el._isLeaving) {
  9017. el[leaveCbKey](
  9018. true
  9019. /* cancelled */
  9020. );
  9021. }
  9022. if (transition.persisted && !wasLeaving) {
  9023. remove2();
  9024. } else {
  9025. leave(el, () => {
  9026. remove2();
  9027. afterLeave && afterLeave();
  9028. });
  9029. }
  9030. };
  9031. if (delayLeave) {
  9032. delayLeave(el, remove2, performLeave);
  9033. } else {
  9034. performLeave();
  9035. }
  9036. }
  9037. } else {
  9038. hostInsert(el, container, anchor);
  9039. }
  9040. };
  9041. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  9042. const {
  9043. type,
  9044. props,
  9045. ref,
  9046. children,
  9047. dynamicChildren,
  9048. shapeFlag,
  9049. patchFlag,
  9050. dirs,
  9051. cacheIndex,
  9052. memo
  9053. } = vnode;
  9054. if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
  9055. optimized = false;
  9056. }
  9057. if (ref != null) {
  9058. pauseTracking();
  9059. setRef(ref, null, parentSuspense, vnode, true);
  9060. resetTracking();
  9061. }
  9062. if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
  9063. parentComponent.renderCache[cacheIndex] = void 0;
  9064. }
  9065. if (shapeFlag & 256) {
  9066. parentComponent.ctx.deactivate(vnode);
  9067. return;
  9068. }
  9069. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  9070. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  9071. let vnodeHook;
  9072. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  9073. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  9074. }
  9075. if (shapeFlag & 6) {
  9076. unmountComponent(vnode.component, parentSuspense, doRemove);
  9077. } else {
  9078. if (shapeFlag & 128) {
  9079. vnode.suspense.unmount(parentSuspense, doRemove);
  9080. return;
  9081. }
  9082. if (shouldInvokeDirs) {
  9083. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  9084. }
  9085. if (shapeFlag & 64) {
  9086. vnode.type.remove(
  9087. vnode,
  9088. parentComponent,
  9089. parentSuspense,
  9090. internals,
  9091. doRemove
  9092. );
  9093. } else if (dynamicChildren && // #5154
  9094. // when v-once is used inside a block, setBlockTracking(-1) marks the
  9095. // parent block with hasOnce: true
  9096. // so that it doesn't take the fast path during unmount - otherwise
  9097. // components nested in v-once are never unmounted.
  9098. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  9099. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  9100. unmountChildren(
  9101. dynamicChildren,
  9102. parentComponent,
  9103. parentSuspense,
  9104. false,
  9105. true
  9106. );
  9107. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  9108. unmountChildren(children, parentComponent, parentSuspense);
  9109. }
  9110. if (doRemove) {
  9111. remove(vnode);
  9112. }
  9113. }
  9114. const shouldInvalidateMemo = memo != null && cacheIndex == null;
  9115. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) {
  9116. queuePostRenderEffect(() => {
  9117. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  9118. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  9119. if (shouldInvalidateMemo) {
  9120. vnode.el = null;
  9121. }
  9122. }, parentSuspense);
  9123. }
  9124. };
  9125. const remove = (vnode) => {
  9126. const { type, el, anchor, transition } = vnode;
  9127. if (type === Fragment) {
  9128. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  9129. vnode.children.forEach((child) => {
  9130. if (child.type === Comment) {
  9131. hostRemove(child.el);
  9132. } else {
  9133. remove(child);
  9134. }
  9135. });
  9136. } else {
  9137. removeFragment(el, anchor);
  9138. }
  9139. return;
  9140. }
  9141. if (type === Static) {
  9142. removeStaticNode(vnode);
  9143. if (transition && !transition.persisted && transition.afterLeave) {
  9144. transition.afterLeave();
  9145. }
  9146. return;
  9147. }
  9148. const performRemove = () => {
  9149. hostRemove(el);
  9150. if (transition && !transition.persisted && transition.afterLeave) {
  9151. transition.afterLeave();
  9152. }
  9153. };
  9154. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  9155. const { leave, delayLeave } = transition;
  9156. const performLeave = () => leave(el, performRemove);
  9157. if (delayLeave) {
  9158. delayLeave(vnode.el, performRemove, performLeave);
  9159. } else {
  9160. performLeave();
  9161. }
  9162. } else {
  9163. performRemove();
  9164. }
  9165. };
  9166. const removeFragment = (cur, end) => {
  9167. let next;
  9168. while (cur !== end) {
  9169. next = hostNextSibling(cur);
  9170. hostRemove(cur);
  9171. cur = next;
  9172. }
  9173. hostRemove(end);
  9174. };
  9175. const unmountComponent = (instance, parentSuspense, doRemove) => {
  9176. if (instance.type.__hmrId) {
  9177. unregisterHMR(instance);
  9178. }
  9179. const { bum, scope, job, subTree, um, m, a } = instance;
  9180. invalidateMount(m);
  9181. invalidateMount(a);
  9182. if (bum) {
  9183. invokeArrayFns(bum);
  9184. }
  9185. scope.stop();
  9186. if (job) {
  9187. job.flags |= 8;
  9188. unmount(subTree, instance, parentSuspense, doRemove);
  9189. } else if (instance.vnode.el && subTree) {
  9190. subTree.transition = instance.vnode.transition;
  9191. unmount(subTree, instance, parentSuspense, doRemove);
  9192. }
  9193. if (um) {
  9194. queuePostRenderEffect(um, parentSuspense);
  9195. }
  9196. queuePostRenderEffect(() => {
  9197. instance.isUnmounted = true;
  9198. }, parentSuspense);
  9199. {
  9200. devtoolsComponentRemoved(instance);
  9201. }
  9202. };
  9203. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  9204. for (let i = start; i < children.length; i++) {
  9205. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  9206. }
  9207. };
  9208. const getNextHostNode = (vnode) => {
  9209. if (vnode.shapeFlag & 6) {
  9210. return getNextHostNode(vnode.component.subTree);
  9211. }
  9212. if (vnode.shapeFlag & 128) {
  9213. return vnode.suspense.next();
  9214. }
  9215. const el = hostNextSibling(vnode.anchor || vnode.el);
  9216. const teleportEnd = el && el[TeleportEndKey];
  9217. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  9218. };
  9219. let isFlushing = false;
  9220. const render = (vnode, container, namespace) => {
  9221. let instance;
  9222. if (vnode == null) {
  9223. if (container._vnode) {
  9224. unmount(container._vnode, null, null, true);
  9225. instance = container._vnode.component;
  9226. }
  9227. } else {
  9228. patch(
  9229. container._vnode || null,
  9230. vnode,
  9231. container,
  9232. null,
  9233. null,
  9234. null,
  9235. namespace
  9236. );
  9237. }
  9238. container._vnode = vnode;
  9239. if (!isFlushing) {
  9240. isFlushing = true;
  9241. flushPreFlushCbs(instance);
  9242. flushPostFlushCbs();
  9243. isFlushing = false;
  9244. }
  9245. };
  9246. const internals = {
  9247. p: patch,
  9248. um: unmount,
  9249. m: move,
  9250. r: remove,
  9251. mt: mountComponent,
  9252. mc: mountChildren,
  9253. pc: patchChildren,
  9254. pbc: patchBlockChildren,
  9255. n: getNextHostNode,
  9256. o: options
  9257. };
  9258. let hydrate;
  9259. let hydrateNode;
  9260. if (createHydrationFns) {
  9261. [hydrate, hydrateNode] = createHydrationFns(
  9262. internals
  9263. );
  9264. }
  9265. return {
  9266. render,
  9267. hydrate,
  9268. createApp: createAppAPI(render, hydrate)
  9269. };
  9270. }
  9271. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  9272. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  9273. }
  9274. function toggleRecurse({ effect, job }, allowed) {
  9275. if (allowed) {
  9276. effect.flags |= 32;
  9277. job.flags |= 4;
  9278. } else {
  9279. effect.flags &= -33;
  9280. job.flags &= -5;
  9281. }
  9282. }
  9283. function needTransition(parentSuspense, transition) {
  9284. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  9285. }
  9286. function traverseStaticChildren(n1, n2, shallow = false) {
  9287. const ch1 = n1.children;
  9288. const ch2 = n2.children;
  9289. if (isArray(ch1) && isArray(ch2)) {
  9290. for (let i = 0; i < ch1.length; i++) {
  9291. const c1 = ch1[i];
  9292. let c2 = ch2[i];
  9293. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  9294. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  9295. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  9296. c2.el = c1.el;
  9297. }
  9298. if (!shallow && c2.patchFlag !== -2)
  9299. traverseStaticChildren(c1, c2);
  9300. }
  9301. if (c2.type === Text) {
  9302. if (c2.patchFlag === -1) {
  9303. c2 = ch2[i] = cloneIfMounted(c2);
  9304. }
  9305. c2.el = c1.el;
  9306. }
  9307. if (c2.type === Comment && !c2.el) {
  9308. c2.el = c1.el;
  9309. }
  9310. {
  9311. c2.el && (c2.el.__vnode = c2);
  9312. }
  9313. }
  9314. }
  9315. }
  9316. function getSequence(arr) {
  9317. const p = arr.slice();
  9318. const result = [0];
  9319. let i, j, u, v, c;
  9320. const len = arr.length;
  9321. for (i = 0; i < len; i++) {
  9322. const arrI = arr[i];
  9323. if (arrI !== 0) {
  9324. j = result[result.length - 1];
  9325. if (arr[j] < arrI) {
  9326. p[i] = j;
  9327. result.push(i);
  9328. continue;
  9329. }
  9330. u = 0;
  9331. v = result.length - 1;
  9332. while (u < v) {
  9333. c = u + v >> 1;
  9334. if (arr[result[c]] < arrI) {
  9335. u = c + 1;
  9336. } else {
  9337. v = c;
  9338. }
  9339. }
  9340. if (arrI < arr[result[u]]) {
  9341. if (u > 0) {
  9342. p[i] = result[u - 1];
  9343. }
  9344. result[u] = i;
  9345. }
  9346. }
  9347. }
  9348. u = result.length;
  9349. v = result[u - 1];
  9350. while (u-- > 0) {
  9351. result[u] = v;
  9352. v = p[v];
  9353. }
  9354. return result;
  9355. }
  9356. function locateNonHydratedAsyncRoot(instance) {
  9357. const subComponent = instance.subTree.component;
  9358. if (subComponent) {
  9359. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  9360. return subComponent;
  9361. } else {
  9362. return locateNonHydratedAsyncRoot(subComponent);
  9363. }
  9364. }
  9365. }
  9366. function invalidateMount(hooks) {
  9367. if (hooks) {
  9368. for (let i = 0; i < hooks.length; i++)
  9369. hooks[i].flags |= 8;
  9370. }
  9371. }
  9372. function resolveAsyncComponentPlaceholder(anchorVnode) {
  9373. if (anchorVnode.placeholder) {
  9374. return anchorVnode.placeholder;
  9375. }
  9376. const instance = anchorVnode.component;
  9377. if (instance) {
  9378. return resolveAsyncComponentPlaceholder(instance.subTree);
  9379. }
  9380. return null;
  9381. }
  9382. const isSuspense = (type) => type.__isSuspense;
  9383. let suspenseId = 0;
  9384. const SuspenseImpl = {
  9385. name: "Suspense",
  9386. // In order to make Suspense tree-shakable, we need to avoid importing it
  9387. // directly in the renderer. The renderer checks for the __isSuspense flag
  9388. // on a vnode's type and calls the `process` method, passing in renderer
  9389. // internals.
  9390. __isSuspense: true,
  9391. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  9392. if (n1 == null) {
  9393. mountSuspense(
  9394. n2,
  9395. container,
  9396. anchor,
  9397. parentComponent,
  9398. parentSuspense,
  9399. namespace,
  9400. slotScopeIds,
  9401. optimized,
  9402. rendererInternals
  9403. );
  9404. } else {
  9405. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
  9406. n2.suspense = n1.suspense;
  9407. n2.suspense.vnode = n2;
  9408. n2.el = n1.el;
  9409. return;
  9410. }
  9411. patchSuspense(
  9412. n1,
  9413. n2,
  9414. container,
  9415. anchor,
  9416. parentComponent,
  9417. namespace,
  9418. slotScopeIds,
  9419. optimized,
  9420. rendererInternals
  9421. );
  9422. }
  9423. },
  9424. hydrate: hydrateSuspense,
  9425. normalize: normalizeSuspenseChildren
  9426. };
  9427. const Suspense = SuspenseImpl ;
  9428. function triggerEvent(vnode, name) {
  9429. const eventListener = vnode.props && vnode.props[name];
  9430. if (isFunction(eventListener)) {
  9431. eventListener();
  9432. }
  9433. }
  9434. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  9435. const {
  9436. p: patch,
  9437. o: { createElement }
  9438. } = rendererInternals;
  9439. const hiddenContainer = createElement("div");
  9440. const suspense = vnode.suspense = createSuspenseBoundary(
  9441. vnode,
  9442. parentSuspense,
  9443. parentComponent,
  9444. container,
  9445. hiddenContainer,
  9446. anchor,
  9447. namespace,
  9448. slotScopeIds,
  9449. optimized,
  9450. rendererInternals
  9451. );
  9452. patch(
  9453. null,
  9454. suspense.pendingBranch = vnode.ssContent,
  9455. hiddenContainer,
  9456. null,
  9457. parentComponent,
  9458. suspense,
  9459. namespace,
  9460. slotScopeIds
  9461. );
  9462. if (suspense.deps > 0) {
  9463. triggerEvent(vnode, "onPending");
  9464. triggerEvent(vnode, "onFallback");
  9465. patch(
  9466. null,
  9467. vnode.ssFallback,
  9468. container,
  9469. anchor,
  9470. parentComponent,
  9471. null,
  9472. // fallback tree will not have suspense context
  9473. namespace,
  9474. slotScopeIds
  9475. );
  9476. setActiveBranch(suspense, vnode.ssFallback);
  9477. } else {
  9478. suspense.resolve(false, true);
  9479. }
  9480. }
  9481. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  9482. const suspense = n2.suspense = n1.suspense;
  9483. suspense.vnode = n2;
  9484. n2.el = n1.el;
  9485. const newBranch = n2.ssContent;
  9486. const newFallback = n2.ssFallback;
  9487. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  9488. if (pendingBranch) {
  9489. suspense.pendingBranch = newBranch;
  9490. if (isSameVNodeType(pendingBranch, newBranch)) {
  9491. suspense.deps++;
  9492. patch(
  9493. pendingBranch,
  9494. newBranch,
  9495. // a hydrating pending branch is adopted SSR DOM, already in place
  9496. isHydrating ? container : suspense.hiddenContainer,
  9497. null,
  9498. parentComponent,
  9499. suspense,
  9500. namespace,
  9501. slotScopeIds,
  9502. optimized
  9503. );
  9504. suspense.deps--;
  9505. if (suspense.deps <= 0) {
  9506. suspense.resolve();
  9507. } else if (isInFallback) {
  9508. if (!isHydrating && !suspense.isFallbackMountPending) {
  9509. patch(
  9510. activeBranch,
  9511. newFallback,
  9512. container,
  9513. anchor,
  9514. parentComponent,
  9515. null,
  9516. // fallback tree will not have suspense context
  9517. namespace,
  9518. slotScopeIds,
  9519. optimized
  9520. );
  9521. setActiveBranch(suspense, newFallback);
  9522. }
  9523. }
  9524. } else {
  9525. suspense.pendingId = suspenseId++;
  9526. if (isHydrating) {
  9527. suspense.isHydrating = false;
  9528. suspense.activeBranch = pendingBranch;
  9529. } else {
  9530. unmount(pendingBranch, parentComponent, suspense);
  9531. }
  9532. suspense.deps = 0;
  9533. suspense.effects.length = 0;
  9534. suspense.hiddenContainer = createElement("div");
  9535. if (isInFallback) {
  9536. patch(
  9537. null,
  9538. newBranch,
  9539. suspense.hiddenContainer,
  9540. null,
  9541. parentComponent,
  9542. suspense,
  9543. namespace,
  9544. slotScopeIds,
  9545. optimized
  9546. );
  9547. if (suspense.deps <= 0) {
  9548. suspense.resolve();
  9549. } else if (!suspense.isFallbackMountPending) {
  9550. patch(
  9551. activeBranch,
  9552. newFallback,
  9553. container,
  9554. anchor,
  9555. parentComponent,
  9556. null,
  9557. // fallback tree will not have suspense context
  9558. namespace,
  9559. slotScopeIds,
  9560. optimized
  9561. );
  9562. setActiveBranch(suspense, newFallback);
  9563. }
  9564. } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
  9565. patch(
  9566. activeBranch,
  9567. newBranch,
  9568. container,
  9569. anchor,
  9570. parentComponent,
  9571. suspense,
  9572. namespace,
  9573. slotScopeIds,
  9574. optimized
  9575. );
  9576. suspense.resolve(true);
  9577. } else {
  9578. patch(
  9579. null,
  9580. newBranch,
  9581. suspense.hiddenContainer,
  9582. null,
  9583. parentComponent,
  9584. suspense,
  9585. namespace,
  9586. slotScopeIds,
  9587. optimized
  9588. );
  9589. if (suspense.deps <= 0) {
  9590. suspense.resolve();
  9591. }
  9592. }
  9593. }
  9594. } else {
  9595. if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
  9596. patch(
  9597. activeBranch,
  9598. newBranch,
  9599. container,
  9600. anchor,
  9601. parentComponent,
  9602. suspense,
  9603. namespace,
  9604. slotScopeIds,
  9605. optimized
  9606. );
  9607. setActiveBranch(suspense, newBranch);
  9608. } else {
  9609. triggerEvent(n2, "onPending");
  9610. suspense.pendingBranch = newBranch;
  9611. if (newBranch.shapeFlag & 512) {
  9612. suspense.pendingId = newBranch.component.suspenseId;
  9613. } else {
  9614. suspense.pendingId = suspenseId++;
  9615. }
  9616. patch(
  9617. null,
  9618. newBranch,
  9619. suspense.hiddenContainer,
  9620. null,
  9621. parentComponent,
  9622. suspense,
  9623. namespace,
  9624. slotScopeIds,
  9625. optimized
  9626. );
  9627. if (suspense.deps <= 0) {
  9628. suspense.resolve();
  9629. } else {
  9630. const { timeout, pendingId } = suspense;
  9631. if (timeout > 0) {
  9632. setTimeout(() => {
  9633. if (suspense.pendingId === pendingId) {
  9634. suspense.fallback(newFallback);
  9635. }
  9636. }, timeout);
  9637. } else if (timeout === 0) {
  9638. suspense.fallback(newFallback);
  9639. }
  9640. }
  9641. }
  9642. }
  9643. }
  9644. let hasWarned = false;
  9645. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  9646. if (!hasWarned) {
  9647. hasWarned = true;
  9648. console[console.info ? "info" : "log"](
  9649. `<Suspense> is an experimental feature and its API will likely change.`
  9650. );
  9651. }
  9652. const {
  9653. p: patch,
  9654. m: move,
  9655. um: unmount,
  9656. n: next,
  9657. o: { parentNode, remove }
  9658. } = rendererInternals;
  9659. let parentSuspenseId;
  9660. const isSuspensible = isVNodeSuspensible(vnode);
  9661. if (isSuspensible) {
  9662. if (parentSuspense && parentSuspense.pendingBranch) {
  9663. parentSuspenseId = parentSuspense.pendingId;
  9664. parentSuspense.deps++;
  9665. }
  9666. }
  9667. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  9668. {
  9669. assertNumber(timeout, `Suspense timeout`);
  9670. }
  9671. const initialAnchor = anchor;
  9672. const suspense = {
  9673. vnode,
  9674. parent: parentSuspense,
  9675. parentComponent,
  9676. namespace,
  9677. container,
  9678. hiddenContainer,
  9679. deps: 0,
  9680. pendingId: suspenseId++,
  9681. timeout: typeof timeout === "number" ? timeout : -1,
  9682. activeBranch: null,
  9683. isFallbackMountPending: false,
  9684. pendingBranch: null,
  9685. isInFallback: !isHydrating,
  9686. isHydrating,
  9687. isUnmounted: false,
  9688. effects: [],
  9689. resolve(resume = false, sync = false) {
  9690. {
  9691. if (!resume && !suspense.pendingBranch) {
  9692. throw new Error(
  9693. `suspense.resolve() is called without a pending branch.`
  9694. );
  9695. }
  9696. if (suspense.isUnmounted) {
  9697. throw new Error(
  9698. `suspense.resolve() is called on an already unmounted suspense boundary.`
  9699. );
  9700. }
  9701. }
  9702. const {
  9703. vnode: vnode2,
  9704. activeBranch,
  9705. pendingBranch,
  9706. pendingId,
  9707. effects,
  9708. parentComponent: parentComponent2,
  9709. container: container2,
  9710. isInFallback
  9711. } = suspense;
  9712. let delayEnter = false;
  9713. if (suspense.isHydrating) {
  9714. suspense.isHydrating = false;
  9715. } else if (!resume) {
  9716. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  9717. let hasUpdatedAnchor = false;
  9718. if (delayEnter) {
  9719. activeBranch.transition.afterLeave = () => {
  9720. if (pendingId === suspense.pendingId) {
  9721. move(
  9722. pendingBranch,
  9723. container2,
  9724. anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor,
  9725. 0
  9726. );
  9727. queuePostFlushCb(effects);
  9728. if (isInFallback && vnode2.ssFallback) {
  9729. vnode2.ssFallback.el = null;
  9730. }
  9731. }
  9732. };
  9733. }
  9734. if (activeBranch && !suspense.isFallbackMountPending) {
  9735. if (parentNode(activeBranch.el) === container2) {
  9736. anchor = next(activeBranch);
  9737. hasUpdatedAnchor = true;
  9738. }
  9739. unmount(activeBranch, parentComponent2, suspense, true);
  9740. if (!delayEnter && isInFallback && vnode2.ssFallback) {
  9741. queuePostRenderEffect(() => vnode2.ssFallback.el = null, suspense);
  9742. }
  9743. }
  9744. if (!delayEnter) {
  9745. move(pendingBranch, container2, anchor, 0);
  9746. }
  9747. }
  9748. suspense.isFallbackMountPending = false;
  9749. setActiveBranch(suspense, pendingBranch);
  9750. suspense.pendingBranch = null;
  9751. suspense.isInFallback = false;
  9752. let parent = suspense.parent;
  9753. let hasUnresolvedAncestor = false;
  9754. while (parent) {
  9755. if (parent.pendingBranch) {
  9756. for (let i = 0; i < effects.length; i++) {
  9757. parent.effects.push(effects[i]);
  9758. }
  9759. hasUnresolvedAncestor = true;
  9760. break;
  9761. }
  9762. parent = parent.parent;
  9763. }
  9764. if (!hasUnresolvedAncestor && !delayEnter) {
  9765. queuePostFlushCb(effects);
  9766. }
  9767. suspense.effects = [];
  9768. if (isSuspensible) {
  9769. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  9770. parentSuspenseId = void 0;
  9771. parentSuspense.deps--;
  9772. if (parentSuspense.deps === 0 && !sync) {
  9773. parentSuspense.resolve();
  9774. }
  9775. }
  9776. }
  9777. triggerEvent(vnode2, "onResolve");
  9778. },
  9779. fallback(fallbackVNode) {
  9780. if (!suspense.pendingBranch) {
  9781. return;
  9782. }
  9783. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  9784. triggerEvent(vnode2, "onFallback");
  9785. const anchor2 = next(activeBranch);
  9786. const mountFallback = () => {
  9787. suspense.isFallbackMountPending = false;
  9788. if (!suspense.isInFallback) {
  9789. return;
  9790. }
  9791. const latestFallback = suspense.vnode.ssFallback;
  9792. patch(
  9793. null,
  9794. latestFallback,
  9795. container2,
  9796. anchor2,
  9797. parentComponent2,
  9798. null,
  9799. // fallback tree will not have suspense context
  9800. namespace2,
  9801. slotScopeIds,
  9802. optimized
  9803. );
  9804. setActiveBranch(suspense, latestFallback);
  9805. };
  9806. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  9807. if (delayEnter) {
  9808. suspense.isFallbackMountPending = true;
  9809. activeBranch.transition.afterLeave = mountFallback;
  9810. }
  9811. suspense.isInFallback = true;
  9812. unmount(
  9813. activeBranch,
  9814. parentComponent2,
  9815. null,
  9816. // no suspense so unmount hooks fire now
  9817. true
  9818. // shouldRemove
  9819. );
  9820. if (!delayEnter) {
  9821. mountFallback();
  9822. }
  9823. },
  9824. move(container2, anchor2, type) {
  9825. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  9826. suspense.container = container2;
  9827. },
  9828. next() {
  9829. return suspense.activeBranch && next(suspense.activeBranch);
  9830. },
  9831. registerDep(instance, setupRenderEffect, optimized2) {
  9832. const isInPendingSuspense = !!suspense.pendingBranch;
  9833. if (isInPendingSuspense) {
  9834. suspense.deps++;
  9835. }
  9836. const hydratedEl = instance.vnode.el;
  9837. instance.asyncDep.catch((err) => {
  9838. handleError(err, instance, 0);
  9839. }).then((asyncSetupResult) => {
  9840. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  9841. return;
  9842. }
  9843. unsetCurrentInstance();
  9844. if (hydratedEl && !instance.scope.active) {
  9845. if (isInPendingSuspense && --suspense.deps === 0) {
  9846. suspense.resolve();
  9847. }
  9848. return;
  9849. }
  9850. instance.asyncResolved = true;
  9851. const { vnode: vnode2 } = instance;
  9852. {
  9853. pushWarningContext(vnode2);
  9854. }
  9855. handleSetupResult(instance, asyncSetupResult, false);
  9856. if (hydratedEl) {
  9857. vnode2.el = hydratedEl;
  9858. }
  9859. const placeholder = !hydratedEl && instance.subTree.el;
  9860. setupRenderEffect(
  9861. instance,
  9862. vnode2,
  9863. // component may have been moved before resolve.
  9864. // if this is not a hydration, instance.subTree will be the comment
  9865. // placeholder.
  9866. parentNode(hydratedEl || instance.subTree.el),
  9867. // anchor will not be used if this is hydration, so only need to
  9868. // consider the comment placeholder case.
  9869. hydratedEl ? null : next(instance.subTree),
  9870. suspense,
  9871. namespace,
  9872. optimized2
  9873. );
  9874. if (placeholder) {
  9875. vnode2.placeholder = null;
  9876. remove(placeholder);
  9877. }
  9878. updateHOCHostEl(instance, vnode2.el);
  9879. {
  9880. popWarningContext();
  9881. }
  9882. if (isInPendingSuspense && --suspense.deps === 0) {
  9883. suspense.resolve();
  9884. }
  9885. });
  9886. },
  9887. unmount(parentSuspense2, doRemove) {
  9888. suspense.isUnmounted = true;
  9889. if (suspense.activeBranch) {
  9890. unmount(
  9891. suspense.activeBranch,
  9892. parentComponent,
  9893. parentSuspense2,
  9894. doRemove
  9895. );
  9896. }
  9897. if (suspense.pendingBranch) {
  9898. unmount(
  9899. suspense.pendingBranch,
  9900. parentComponent,
  9901. parentSuspense2,
  9902. doRemove
  9903. );
  9904. }
  9905. }
  9906. };
  9907. return suspense;
  9908. }
  9909. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  9910. const suspense = vnode.suspense = createSuspenseBoundary(
  9911. vnode,
  9912. parentSuspense,
  9913. parentComponent,
  9914. node.parentNode,
  9915. // eslint-disable-next-line no-restricted-globals
  9916. document.createElement("div"),
  9917. null,
  9918. namespace,
  9919. slotScopeIds,
  9920. optimized,
  9921. rendererInternals,
  9922. true
  9923. );
  9924. const result = hydrateNode(
  9925. node,
  9926. suspense.pendingBranch = vnode.ssContent,
  9927. parentComponent,
  9928. suspense,
  9929. slotScopeIds,
  9930. optimized
  9931. );
  9932. if (suspense.deps === 0) {
  9933. suspense.resolve(false, true);
  9934. }
  9935. return result;
  9936. }
  9937. function normalizeSuspenseChildren(vnode) {
  9938. const { shapeFlag, children } = vnode;
  9939. const isSlotChildren = shapeFlag & 32;
  9940. vnode.ssContent = normalizeSuspenseSlot(
  9941. isSlotChildren ? children.default : children
  9942. );
  9943. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  9944. }
  9945. function normalizeSuspenseSlot(s) {
  9946. let block;
  9947. if (isFunction(s)) {
  9948. const trackBlock = isBlockTreeEnabled && s._c;
  9949. if (trackBlock) {
  9950. s._d = false;
  9951. openBlock();
  9952. }
  9953. s = s();
  9954. if (trackBlock) {
  9955. s._d = true;
  9956. block = currentBlock;
  9957. closeBlock();
  9958. }
  9959. }
  9960. if (isArray(s)) {
  9961. const singleChild = filterSingleRoot(s);
  9962. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  9963. warn$1(`<Suspense> slots expect a single root node.`);
  9964. }
  9965. s = singleChild;
  9966. }
  9967. s = normalizeVNode(s);
  9968. if (block && !s.dynamicChildren) {
  9969. s.dynamicChildren = block.filter((c) => c !== s);
  9970. }
  9971. return s;
  9972. }
  9973. function queueEffectWithSuspense(fn, suspense) {
  9974. if (suspense && suspense.pendingBranch) {
  9975. if (isArray(fn)) {
  9976. suspense.effects.push(...fn);
  9977. } else {
  9978. suspense.effects.push(fn);
  9979. }
  9980. } else {
  9981. queuePostFlushCb(fn);
  9982. }
  9983. }
  9984. function setActiveBranch(suspense, branch) {
  9985. suspense.activeBranch = branch;
  9986. const { vnode, parentComponent } = suspense;
  9987. let el = branch.el;
  9988. while (!el && branch.component) {
  9989. branch = branch.component.subTree;
  9990. el = branch.el;
  9991. }
  9992. vnode.el = el;
  9993. if (parentComponent && parentComponent.subTree === vnode) {
  9994. parentComponent.vnode.el = el;
  9995. updateHOCHostEl(parentComponent, el);
  9996. }
  9997. }
  9998. function isVNodeSuspensible(vnode) {
  9999. const suspensible = vnode.props && vnode.props.suspensible;
  10000. return suspensible != null && suspensible !== false;
  10001. }
  10002. const Fragment = /* @__PURE__ */ Symbol.for("v-fgt");
  10003. const Text = /* @__PURE__ */ Symbol.for("v-txt");
  10004. const Comment = /* @__PURE__ */ Symbol.for("v-cmt");
  10005. const Static = /* @__PURE__ */ Symbol.for("v-stc");
  10006. const blockStack = [];
  10007. let currentBlock = null;
  10008. function openBlock(disableTracking = false) {
  10009. blockStack.push(currentBlock = disableTracking ? null : []);
  10010. }
  10011. function closeBlock() {
  10012. blockStack.pop();
  10013. currentBlock = blockStack[blockStack.length - 1] || null;
  10014. }
  10015. let isBlockTreeEnabled = 1;
  10016. function setBlockTracking(value, inVOnce = false) {
  10017. isBlockTreeEnabled += value;
  10018. if (value < 0 && currentBlock && inVOnce) {
  10019. currentBlock.hasOnce = true;
  10020. }
  10021. }
  10022. function setupBlock(vnode) {
  10023. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  10024. closeBlock();
  10025. if (isBlockTreeEnabled > 0 && currentBlock) {
  10026. currentBlock.push(vnode);
  10027. }
  10028. return vnode;
  10029. }
  10030. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  10031. return setupBlock(
  10032. createBaseVNode(
  10033. type,
  10034. props,
  10035. children,
  10036. patchFlag,
  10037. dynamicProps,
  10038. shapeFlag,
  10039. true
  10040. )
  10041. );
  10042. }
  10043. function createBlock(type, props, children, patchFlag, dynamicProps) {
  10044. return setupBlock(
  10045. createVNode(
  10046. type,
  10047. props,
  10048. children,
  10049. patchFlag,
  10050. dynamicProps,
  10051. true
  10052. )
  10053. );
  10054. }
  10055. function isVNode(value) {
  10056. return value ? value.__v_isVNode === true : false;
  10057. }
  10058. function isSameVNodeType(n1, n2) {
  10059. if (n2.shapeFlag & 6 && n1.component) {
  10060. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  10061. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  10062. n1.shapeFlag &= -257;
  10063. n2.shapeFlag &= -513;
  10064. return false;
  10065. }
  10066. }
  10067. return n1.type === n2.type && n1.key === n2.key;
  10068. }
  10069. let vnodeArgsTransformer;
  10070. function transformVNodeArgs(transformer) {
  10071. vnodeArgsTransformer = transformer;
  10072. }
  10073. const createVNodeWithArgsTransform = (...args) => {
  10074. return _createVNode(
  10075. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  10076. );
  10077. };
  10078. const normalizeKey = ({ key }) => key != null ? key : null;
  10079. const normalizeRef = ({
  10080. ref,
  10081. ref_key,
  10082. ref_for
  10083. }) => {
  10084. if (typeof ref === "number") {
  10085. ref = "" + ref;
  10086. }
  10087. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  10088. };
  10089. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  10090. const vnode = {
  10091. __v_isVNode: true,
  10092. __v_skip: true,
  10093. type,
  10094. props,
  10095. key: props && normalizeKey(props),
  10096. ref: props && normalizeRef(props),
  10097. scopeId: currentScopeId,
  10098. slotScopeIds: null,
  10099. children,
  10100. component: null,
  10101. suspense: null,
  10102. ssContent: null,
  10103. ssFallback: null,
  10104. dirs: null,
  10105. transition: null,
  10106. el: null,
  10107. anchor: null,
  10108. target: null,
  10109. targetStart: null,
  10110. targetAnchor: null,
  10111. staticCount: 0,
  10112. shapeFlag,
  10113. patchFlag,
  10114. dynamicProps,
  10115. dynamicChildren: null,
  10116. appContext: null,
  10117. ctx: currentRenderingInstance
  10118. };
  10119. if (needFullChildrenNormalization) {
  10120. normalizeChildren(vnode, children);
  10121. if (shapeFlag & 128) {
  10122. type.normalize(vnode);
  10123. }
  10124. } else if (children) {
  10125. vnode.shapeFlag |= isString(children) ? 8 : 16;
  10126. }
  10127. if (vnode.key !== vnode.key) {
  10128. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  10129. }
  10130. if (props && vnode.shapeFlag & 1) {
  10131. const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
  10132. if (overwritingProp && hasContentChildren(vnode.children)) {
  10133. warn$1(
  10134. `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
  10135. );
  10136. }
  10137. }
  10138. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  10139. !isBlockNode && // has current parent block
  10140. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  10141. // component nodes also should always be patched, because even if the
  10142. // component doesn't need to update, it needs to persist the instance on to
  10143. // the next vnode so that it can be properly unmounted later.
  10144. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  10145. // vnode should not be considered dynamic due to handler caching.
  10146. vnode.patchFlag !== 32) {
  10147. currentBlock.push(vnode);
  10148. }
  10149. return vnode;
  10150. }
  10151. function hasContentChildren(children) {
  10152. if (isString(children)) return children !== "";
  10153. if (isArray(children)) return children.length > 0;
  10154. return false;
  10155. }
  10156. const createVNode = createVNodeWithArgsTransform ;
  10157. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  10158. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  10159. if (!type) {
  10160. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  10161. }
  10162. type = Comment;
  10163. }
  10164. if (isVNode(type)) {
  10165. const cloned = cloneVNode(
  10166. type,
  10167. props,
  10168. true
  10169. /* mergeRef: true */
  10170. );
  10171. if (children) {
  10172. normalizeChildren(cloned, children);
  10173. }
  10174. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  10175. if (cloned.shapeFlag & 6) {
  10176. currentBlock[currentBlock.indexOf(type)] = cloned;
  10177. } else {
  10178. currentBlock.push(cloned);
  10179. }
  10180. }
  10181. cloned.patchFlag = -2;
  10182. return cloned;
  10183. }
  10184. if (isClassComponent(type)) {
  10185. type = type.__vccOpts;
  10186. }
  10187. if (props) {
  10188. props = guardReactiveProps(props);
  10189. let { class: klass, style } = props;
  10190. if (klass && !isString(klass)) {
  10191. props.class = normalizeClass(klass);
  10192. }
  10193. if (isObject(style)) {
  10194. if (isProxy(style) && !isArray(style)) {
  10195. style = extend({}, style);
  10196. }
  10197. props.style = normalizeStyle(style);
  10198. }
  10199. }
  10200. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  10201. if (shapeFlag & 4 && isProxy(type)) {
  10202. type = toRaw(type);
  10203. warn$1(
  10204. `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\`.`,
  10205. `
  10206. Component that was made reactive: `,
  10207. type
  10208. );
  10209. }
  10210. return createBaseVNode(
  10211. type,
  10212. props,
  10213. children,
  10214. patchFlag,
  10215. dynamicProps,
  10216. shapeFlag,
  10217. isBlockNode,
  10218. true
  10219. );
  10220. }
  10221. function guardReactiveProps(props) {
  10222. if (!props) return null;
  10223. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  10224. }
  10225. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  10226. const { props, ref, patchFlag, children, transition } = vnode;
  10227. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  10228. const cloned = {
  10229. __v_isVNode: true,
  10230. __v_skip: true,
  10231. type: vnode.type,
  10232. props: mergedProps,
  10233. key: mergedProps && normalizeKey(mergedProps),
  10234. ref: extraProps && extraProps.ref ? (
  10235. // #2078 in the case of <component :is="vnode" ref="extra"/>
  10236. // if the vnode itself already has a ref, cloneVNode will need to merge
  10237. // the refs so the single vnode can be set on multiple refs
  10238. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  10239. ) : ref,
  10240. scopeId: vnode.scopeId,
  10241. slotScopeIds: vnode.slotScopeIds,
  10242. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  10243. target: vnode.target,
  10244. targetStart: vnode.targetStart,
  10245. targetAnchor: vnode.targetAnchor,
  10246. staticCount: vnode.staticCount,
  10247. shapeFlag: vnode.shapeFlag,
  10248. // if the vnode is cloned with extra props, we can no longer assume its
  10249. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  10250. // note: preserve flag for fragments since they use the flag for children
  10251. // fast paths only.
  10252. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  10253. dynamicProps: vnode.dynamicProps,
  10254. dynamicChildren: vnode.dynamicChildren,
  10255. appContext: vnode.appContext,
  10256. dirs: vnode.dirs,
  10257. transition,
  10258. // These should technically only be non-null on mounted VNodes. However,
  10259. // they *should* be copied for kept-alive vnodes. So we just always copy
  10260. // them since them being non-null during a mount doesn't affect the logic as
  10261. // they will simply be overwritten.
  10262. component: vnode.component,
  10263. suspense: vnode.suspense,
  10264. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  10265. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  10266. placeholder: vnode.placeholder,
  10267. el: vnode.el,
  10268. anchor: vnode.anchor,
  10269. ctx: vnode.ctx,
  10270. ce: vnode.ce,
  10271. cacheIndex: vnode.cacheIndex
  10272. };
  10273. if (transition && cloneTransition) {
  10274. setTransitionHooks(
  10275. cloned,
  10276. transition.clone(cloned)
  10277. );
  10278. }
  10279. return cloned;
  10280. }
  10281. function deepCloneVNode(vnode) {
  10282. const cloned = cloneVNode(vnode);
  10283. if (isArray(vnode.children)) {
  10284. cloned.children = vnode.children.map(deepCloneVNode);
  10285. }
  10286. return cloned;
  10287. }
  10288. function createTextVNode(text = " ", flag = 0) {
  10289. return createVNode(Text, null, text, flag);
  10290. }
  10291. function createStaticVNode(content, numberOfNodes) {
  10292. const vnode = createVNode(Static, null, content);
  10293. vnode.staticCount = numberOfNodes;
  10294. return vnode;
  10295. }
  10296. function createCommentVNode(text = "", asBlock = false) {
  10297. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  10298. }
  10299. function normalizeVNode(child) {
  10300. if (child == null || typeof child === "boolean") {
  10301. return createVNode(Comment);
  10302. } else if (isArray(child)) {
  10303. return createVNode(
  10304. Fragment,
  10305. null,
  10306. // #3666, avoid reference pollution when reusing vnode
  10307. child.slice()
  10308. );
  10309. } else if (isVNode(child)) {
  10310. return cloneIfMounted(child);
  10311. } else {
  10312. return createVNode(Text, null, String(child));
  10313. }
  10314. }
  10315. function cloneIfMounted(child) {
  10316. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  10317. }
  10318. function normalizeChildren(vnode, children) {
  10319. let type = 0;
  10320. const { shapeFlag } = vnode;
  10321. if (children == null) {
  10322. children = null;
  10323. } else if (isArray(children)) {
  10324. type = 16;
  10325. } else if (typeof children === "object") {
  10326. if (shapeFlag & (1 | 64)) {
  10327. const slot = children.default;
  10328. if (slot) {
  10329. slot._c && (slot._d = false);
  10330. normalizeChildren(vnode, slot());
  10331. slot._c && (slot._d = true);
  10332. }
  10333. return;
  10334. } else {
  10335. type = 32;
  10336. const slotFlag = children._;
  10337. if (!slotFlag && !isInternalObject(children)) {
  10338. children._ctx = currentRenderingInstance;
  10339. } else if (slotFlag === 3 && currentRenderingInstance) {
  10340. if (currentRenderingInstance.slots._ === 1) {
  10341. children._ = 1;
  10342. } else {
  10343. children._ = 2;
  10344. vnode.patchFlag |= 1024;
  10345. }
  10346. }
  10347. }
  10348. } else if (isFunction(children)) {
  10349. if (shapeFlag & (1 | 64)) {
  10350. normalizeChildren(vnode, { default: children });
  10351. return;
  10352. }
  10353. children = { default: children, _ctx: currentRenderingInstance };
  10354. type = 32;
  10355. } else {
  10356. children = String(children);
  10357. if (shapeFlag & 64) {
  10358. type = 16;
  10359. children = [createTextVNode(children)];
  10360. } else {
  10361. type = 8;
  10362. }
  10363. }
  10364. vnode.children = children;
  10365. vnode.shapeFlag |= type;
  10366. }
  10367. function mergeProps(...args) {
  10368. const ret = {};
  10369. for (let i = 0; i < args.length; i++) {
  10370. const toMerge = args[i];
  10371. for (const key in toMerge) {
  10372. if (key === "class") {
  10373. if (ret.class !== toMerge.class) {
  10374. ret.class = normalizeClass([ret.class, toMerge.class]);
  10375. }
  10376. } else if (key === "style") {
  10377. ret.style = normalizeStyle([ret.style, toMerge.style]);
  10378. } else if (isOn(key)) {
  10379. const existing = ret[key];
  10380. const incoming = toMerge[key];
  10381. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  10382. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  10383. } else if (incoming == null && existing == null && // mergeProps({ 'onUpdate:modelValue': undefined }) should not retain
  10384. // the model listener.
  10385. !isModelListener(key)) {
  10386. ret[key] = incoming;
  10387. }
  10388. } else if (key !== "") {
  10389. ret[key] = toMerge[key];
  10390. }
  10391. }
  10392. }
  10393. return ret;
  10394. }
  10395. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  10396. callWithAsyncErrorHandling(hook, instance, 7, [
  10397. vnode,
  10398. prevVNode
  10399. ]);
  10400. }
  10401. const emptyAppContext = createAppContext();
  10402. let uid = 0;
  10403. function createComponentInstance(vnode, parent, suspense) {
  10404. const type = vnode.type;
  10405. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  10406. const instance = {
  10407. uid: uid++,
  10408. vnode,
  10409. type,
  10410. parent,
  10411. appContext,
  10412. root: null,
  10413. // to be immediately set
  10414. next: null,
  10415. subTree: null,
  10416. // will be set synchronously right after creation
  10417. effect: null,
  10418. update: null,
  10419. // will be set synchronously right after creation
  10420. job: null,
  10421. scope: new EffectScope(
  10422. true
  10423. /* detached */
  10424. ),
  10425. render: null,
  10426. proxy: null,
  10427. exposed: null,
  10428. exposeProxy: null,
  10429. withProxy: null,
  10430. provides: parent ? parent.provides : Object.create(appContext.provides),
  10431. ids: parent ? parent.ids : ["", 0, 0],
  10432. accessCache: null,
  10433. renderCache: [],
  10434. // local resolved assets
  10435. components: null,
  10436. directives: null,
  10437. // resolved props and emits options
  10438. propsOptions: normalizePropsOptions(type, appContext),
  10439. emitsOptions: normalizeEmitsOptions(type, appContext),
  10440. // emit
  10441. emit: null,
  10442. // to be set immediately
  10443. emitted: null,
  10444. // props default value
  10445. propsDefaults: EMPTY_OBJ,
  10446. // inheritAttrs
  10447. inheritAttrs: type.inheritAttrs,
  10448. // state
  10449. ctx: EMPTY_OBJ,
  10450. data: EMPTY_OBJ,
  10451. props: EMPTY_OBJ,
  10452. attrs: EMPTY_OBJ,
  10453. slots: EMPTY_OBJ,
  10454. refs: EMPTY_OBJ,
  10455. setupState: EMPTY_OBJ,
  10456. setupContext: null,
  10457. // suspense related
  10458. suspense,
  10459. suspenseId: suspense ? suspense.pendingId : 0,
  10460. asyncDep: null,
  10461. asyncResolved: false,
  10462. // lifecycle hooks
  10463. // not using enums here because it results in computed properties
  10464. isMounted: false,
  10465. isUnmounted: false,
  10466. isDeactivated: false,
  10467. bc: null,
  10468. c: null,
  10469. bm: null,
  10470. m: null,
  10471. bu: null,
  10472. u: null,
  10473. um: null,
  10474. bum: null,
  10475. da: null,
  10476. a: null,
  10477. rtg: null,
  10478. rtc: null,
  10479. ec: null,
  10480. sp: null
  10481. };
  10482. {
  10483. instance.ctx = createDevRenderContext(instance);
  10484. }
  10485. instance.root = parent ? parent.root : instance;
  10486. instance.emit = emit.bind(null, instance);
  10487. if (vnode.ce) {
  10488. vnode.ce(instance);
  10489. }
  10490. return instance;
  10491. }
  10492. let currentInstance = null;
  10493. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  10494. let internalSetCurrentInstance;
  10495. let setInSSRSetupState;
  10496. {
  10497. const g = getGlobalThis();
  10498. const registerGlobalSetter = (key, setter) => {
  10499. let setters;
  10500. if (!(setters = g[key])) setters = g[key] = [];
  10501. setters.push(setter);
  10502. return (v) => {
  10503. if (setters.length > 1) setters.forEach((set) => set(v));
  10504. else setters[0](v);
  10505. };
  10506. };
  10507. internalSetCurrentInstance = registerGlobalSetter(
  10508. `__VUE_INSTANCE_SETTERS__`,
  10509. (v) => currentInstance = v
  10510. );
  10511. setInSSRSetupState = registerGlobalSetter(
  10512. `__VUE_SSR_SETTERS__`,
  10513. (v) => isInSSRComponentSetup = v
  10514. );
  10515. }
  10516. const setCurrentInstance = (instance) => {
  10517. const prev = currentInstance;
  10518. internalSetCurrentInstance(instance);
  10519. instance.scope.on();
  10520. return () => {
  10521. instance.scope.off();
  10522. internalSetCurrentInstance(prev);
  10523. };
  10524. };
  10525. const unsetCurrentInstance = () => {
  10526. currentInstance && currentInstance.scope.off();
  10527. internalSetCurrentInstance(null);
  10528. };
  10529. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  10530. function validateComponentName(name, { isNativeTag }) {
  10531. if (isBuiltInTag(name) || isNativeTag(name)) {
  10532. warn$1(
  10533. "Do not use built-in or reserved HTML elements as component id: " + name
  10534. );
  10535. }
  10536. }
  10537. function isStatefulComponent(instance) {
  10538. return instance.vnode.shapeFlag & 4;
  10539. }
  10540. let isInSSRComponentSetup = false;
  10541. function setupComponent(instance, isSSR = false, optimized = false) {
  10542. isSSR && setInSSRSetupState(isSSR);
  10543. const { props, children } = instance.vnode;
  10544. const isStateful = isStatefulComponent(instance);
  10545. initProps(instance, props, isStateful, isSSR);
  10546. initSlots(instance, children, optimized || isSSR);
  10547. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  10548. isSSR && setInSSRSetupState(false);
  10549. return setupResult;
  10550. }
  10551. function setupStatefulComponent(instance, isSSR) {
  10552. const Component = instance.type;
  10553. {
  10554. if (Component.name) {
  10555. validateComponentName(Component.name, instance.appContext.config);
  10556. }
  10557. if (Component.components) {
  10558. const names = Object.keys(Component.components);
  10559. for (let i = 0; i < names.length; i++) {
  10560. validateComponentName(names[i], instance.appContext.config);
  10561. }
  10562. }
  10563. if (Component.directives) {
  10564. const names = Object.keys(Component.directives);
  10565. for (let i = 0; i < names.length; i++) {
  10566. validateDirectiveName(names[i]);
  10567. }
  10568. }
  10569. if (Component.compilerOptions && isRuntimeOnly()) {
  10570. warn$1(
  10571. `"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.`
  10572. );
  10573. }
  10574. }
  10575. instance.accessCache = /* @__PURE__ */ Object.create(null);
  10576. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  10577. {
  10578. exposePropsOnRenderContext(instance);
  10579. }
  10580. const { setup } = Component;
  10581. if (setup) {
  10582. pauseTracking();
  10583. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  10584. const reset = setCurrentInstance(instance);
  10585. const setupResult = callWithErrorHandling(
  10586. setup,
  10587. instance,
  10588. 0,
  10589. [
  10590. shallowReadonly(instance.props) ,
  10591. setupContext
  10592. ]
  10593. );
  10594. const isAsyncSetup = isPromise(setupResult);
  10595. resetTracking();
  10596. reset();
  10597. if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
  10598. markAsyncBoundary(instance);
  10599. }
  10600. if (isAsyncSetup) {
  10601. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  10602. if (isSSR) {
  10603. return setupResult.then((resolvedResult) => {
  10604. setInSSRSetupState(true);
  10605. try {
  10606. handleSetupResult(instance, resolvedResult, isSSR);
  10607. } finally {
  10608. setInSSRSetupState(false);
  10609. }
  10610. }).catch((e) => {
  10611. handleError(e, instance, 0);
  10612. });
  10613. } else {
  10614. instance.asyncDep = setupResult;
  10615. if (!instance.suspense) {
  10616. const name = formatComponentName(instance, Component);
  10617. warn$1(
  10618. `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.`
  10619. );
  10620. }
  10621. }
  10622. } else {
  10623. handleSetupResult(instance, setupResult, isSSR);
  10624. }
  10625. } else {
  10626. finishComponentSetup(instance, isSSR);
  10627. }
  10628. }
  10629. function handleSetupResult(instance, setupResult, isSSR) {
  10630. if (isFunction(setupResult)) {
  10631. if (instance.type.__ssrInlineRender) {
  10632. instance.ssrRender = setupResult;
  10633. } else {
  10634. instance.render = setupResult;
  10635. }
  10636. } else if (isObject(setupResult)) {
  10637. if (isVNode(setupResult)) {
  10638. warn$1(
  10639. `setup() should not return VNodes directly - return a render function instead.`
  10640. );
  10641. }
  10642. {
  10643. instance.devtoolsRawSetupState = setupResult;
  10644. }
  10645. instance.setupState = proxyRefs(setupResult);
  10646. {
  10647. exposeSetupStateOnRenderContext(instance);
  10648. }
  10649. } else if (setupResult !== void 0) {
  10650. warn$1(
  10651. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  10652. );
  10653. }
  10654. finishComponentSetup(instance, isSSR);
  10655. }
  10656. let compile$1;
  10657. let installWithProxy;
  10658. function registerRuntimeCompiler(_compile) {
  10659. compile$1 = _compile;
  10660. installWithProxy = (i) => {
  10661. if (i.render._rc) {
  10662. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  10663. }
  10664. };
  10665. }
  10666. const isRuntimeOnly = () => !compile$1;
  10667. function finishComponentSetup(instance, isSSR, skipOptions) {
  10668. const Component = instance.type;
  10669. if (!instance.render) {
  10670. if (!isSSR && compile$1 && !Component.render) {
  10671. const template = Component.template || resolveMergedOptions(instance).template;
  10672. if (template) {
  10673. {
  10674. startMeasure(instance, `compile`);
  10675. }
  10676. const { isCustomElement, compilerOptions } = instance.appContext.config;
  10677. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  10678. const finalCompilerOptions = extend(
  10679. extend(
  10680. {
  10681. isCustomElement,
  10682. delimiters
  10683. },
  10684. compilerOptions
  10685. ),
  10686. componentCompilerOptions
  10687. );
  10688. Component.render = compile$1(template, finalCompilerOptions);
  10689. {
  10690. endMeasure(instance, `compile`);
  10691. }
  10692. }
  10693. }
  10694. instance.render = Component.render || NOOP;
  10695. if (installWithProxy) {
  10696. installWithProxy(instance);
  10697. }
  10698. }
  10699. {
  10700. const reset = setCurrentInstance(instance);
  10701. pauseTracking();
  10702. try {
  10703. applyOptions(instance);
  10704. } finally {
  10705. resetTracking();
  10706. reset();
  10707. }
  10708. }
  10709. if (!Component.render && instance.render === NOOP && !isSSR) {
  10710. if (!compile$1 && Component.template) {
  10711. warn$1(
  10712. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
  10713. );
  10714. } else {
  10715. warn$1(`Component is missing template or render function: `, Component);
  10716. }
  10717. }
  10718. }
  10719. const attrsProxyHandlers = {
  10720. get(target, key) {
  10721. markAttrsAccessed();
  10722. track(target, "get", "");
  10723. return target[key];
  10724. },
  10725. set() {
  10726. warn$1(`setupContext.attrs is readonly.`);
  10727. return false;
  10728. },
  10729. deleteProperty() {
  10730. warn$1(`setupContext.attrs is readonly.`);
  10731. return false;
  10732. }
  10733. } ;
  10734. function getSlotsProxy(instance) {
  10735. return new Proxy(instance.slots, {
  10736. get(target, key) {
  10737. track(instance, "get", "$slots");
  10738. return target[key];
  10739. }
  10740. });
  10741. }
  10742. function createSetupContext(instance) {
  10743. const expose = (exposed) => {
  10744. {
  10745. if (instance.exposed) {
  10746. warn$1(`expose() should be called only once per setup().`);
  10747. }
  10748. if (exposed != null) {
  10749. let exposedType = typeof exposed;
  10750. if (exposedType === "object") {
  10751. if (isArray(exposed)) {
  10752. exposedType = "array";
  10753. } else if (isRef(exposed)) {
  10754. exposedType = "ref";
  10755. }
  10756. }
  10757. if (exposedType !== "object") {
  10758. warn$1(
  10759. `expose() should be passed a plain object, received ${exposedType}.`
  10760. );
  10761. }
  10762. }
  10763. }
  10764. instance.exposed = exposed || {};
  10765. };
  10766. {
  10767. let attrsProxy;
  10768. let slotsProxy;
  10769. return Object.freeze({
  10770. get attrs() {
  10771. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  10772. },
  10773. get slots() {
  10774. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  10775. },
  10776. get emit() {
  10777. return (event, ...args) => instance.emit(event, ...args);
  10778. },
  10779. expose
  10780. });
  10781. }
  10782. }
  10783. function getComponentPublicInstance(instance) {
  10784. if (instance.exposed) {
  10785. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  10786. get(target, key) {
  10787. if (key in target) {
  10788. return target[key];
  10789. } else if (key in publicPropertiesMap) {
  10790. return publicPropertiesMap[key](instance);
  10791. }
  10792. },
  10793. has(target, key) {
  10794. return key in target || key in publicPropertiesMap;
  10795. }
  10796. }));
  10797. } else {
  10798. return instance.proxy;
  10799. }
  10800. }
  10801. const classifyRE = /(?:^|[-_])\w/g;
  10802. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  10803. function getComponentName(Component, includeInferred = true) {
  10804. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  10805. }
  10806. function formatComponentName(instance, Component, isRoot = false) {
  10807. let name = getComponentName(Component);
  10808. if (!name && Component.__file) {
  10809. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  10810. if (match) {
  10811. name = match[1];
  10812. }
  10813. }
  10814. if (!name && instance) {
  10815. const inferFromRegistry = (registry) => {
  10816. for (const key in registry) {
  10817. if (registry[key] === Component) {
  10818. return key;
  10819. }
  10820. }
  10821. };
  10822. name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(
  10823. instance.parent.type.components
  10824. ) || inferFromRegistry(instance.appContext.components);
  10825. }
  10826. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  10827. }
  10828. function isClassComponent(value) {
  10829. return isFunction(value) && "__vccOpts" in value;
  10830. }
  10831. const computed = (getterOrOptions, debugOptions) => {
  10832. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  10833. {
  10834. const i = getCurrentInstance();
  10835. if (i && i.appContext.config.warnRecursiveComputed) {
  10836. c._warnRecursive = true;
  10837. }
  10838. }
  10839. return c;
  10840. };
  10841. function h(type, propsOrChildren, children) {
  10842. try {
  10843. setBlockTracking(-1);
  10844. const l = arguments.length;
  10845. if (l === 2) {
  10846. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  10847. if (isVNode(propsOrChildren)) {
  10848. return createVNode(type, null, [propsOrChildren]);
  10849. }
  10850. return createVNode(type, propsOrChildren);
  10851. } else {
  10852. return createVNode(type, null, propsOrChildren);
  10853. }
  10854. } else {
  10855. if (l > 3) {
  10856. children = Array.prototype.slice.call(arguments, 2);
  10857. } else if (l === 3 && isVNode(children)) {
  10858. children = [children];
  10859. }
  10860. return createVNode(type, propsOrChildren, children);
  10861. }
  10862. } finally {
  10863. setBlockTracking(1);
  10864. }
  10865. }
  10866. function initCustomFormatter() {
  10867. if (typeof window === "undefined") {
  10868. return;
  10869. }
  10870. const vueStyle = { style: "color:#3ba776" };
  10871. const numberStyle = { style: "color:#1677ff" };
  10872. const stringStyle = { style: "color:#f5222d" };
  10873. const keywordStyle = { style: "color:#eb2f96" };
  10874. const formatter = {
  10875. __vue_custom_formatter: true,
  10876. header(obj) {
  10877. if (!isObject(obj)) {
  10878. return null;
  10879. }
  10880. if (obj.__isVue) {
  10881. return ["div", vueStyle, `VueInstance`];
  10882. } else if (isRef(obj)) {
  10883. pauseTracking();
  10884. const value = obj.value;
  10885. resetTracking();
  10886. return [
  10887. "div",
  10888. {},
  10889. ["span", vueStyle, genRefFlag(obj)],
  10890. "<",
  10891. formatValue(value),
  10892. `>`
  10893. ];
  10894. } else if (isReactive(obj)) {
  10895. return [
  10896. "div",
  10897. {},
  10898. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  10899. "<",
  10900. formatValue(obj),
  10901. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  10902. ];
  10903. } else if (isReadonly(obj)) {
  10904. return [
  10905. "div",
  10906. {},
  10907. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  10908. "<",
  10909. formatValue(obj),
  10910. ">"
  10911. ];
  10912. }
  10913. return null;
  10914. },
  10915. hasBody(obj) {
  10916. return obj && obj.__isVue;
  10917. },
  10918. body(obj) {
  10919. if (obj && obj.__isVue) {
  10920. return [
  10921. "div",
  10922. {},
  10923. ...formatInstance(obj.$)
  10924. ];
  10925. }
  10926. }
  10927. };
  10928. function formatInstance(instance) {
  10929. const blocks = [];
  10930. if (instance.type.props && instance.props) {
  10931. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  10932. }
  10933. if (instance.setupState !== EMPTY_OBJ) {
  10934. blocks.push(createInstanceBlock("setup", instance.setupState));
  10935. }
  10936. if (instance.data !== EMPTY_OBJ) {
  10937. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  10938. }
  10939. const computed = extractKeys(instance, "computed");
  10940. if (computed) {
  10941. blocks.push(createInstanceBlock("computed", computed));
  10942. }
  10943. const injected = extractKeys(instance, "inject");
  10944. if (injected) {
  10945. blocks.push(createInstanceBlock("injected", injected));
  10946. }
  10947. blocks.push([
  10948. "div",
  10949. {},
  10950. [
  10951. "span",
  10952. {
  10953. style: keywordStyle.style + ";opacity:0.66"
  10954. },
  10955. "$ (internal): "
  10956. ],
  10957. ["object", { object: instance }]
  10958. ]);
  10959. return blocks;
  10960. }
  10961. function createInstanceBlock(type, target) {
  10962. target = extend({}, target);
  10963. if (!Object.keys(target).length) {
  10964. return ["span", {}];
  10965. }
  10966. return [
  10967. "div",
  10968. { style: "line-height:1.25em;margin-bottom:0.6em" },
  10969. [
  10970. "div",
  10971. {
  10972. style: "color:#476582"
  10973. },
  10974. type
  10975. ],
  10976. [
  10977. "div",
  10978. {
  10979. style: "padding-left:1.25em"
  10980. },
  10981. ...Object.keys(target).map((key) => {
  10982. return [
  10983. "div",
  10984. {},
  10985. ["span", keywordStyle, key + ": "],
  10986. formatValue(target[key], false)
  10987. ];
  10988. })
  10989. ]
  10990. ];
  10991. }
  10992. function formatValue(v, asRaw = true) {
  10993. if (typeof v === "number") {
  10994. return ["span", numberStyle, v];
  10995. } else if (typeof v === "string") {
  10996. return ["span", stringStyle, JSON.stringify(v)];
  10997. } else if (typeof v === "boolean") {
  10998. return ["span", keywordStyle, v];
  10999. } else if (isObject(v)) {
  11000. return ["object", { object: asRaw ? toRaw(v) : v }];
  11001. } else {
  11002. return ["span", stringStyle, String(v)];
  11003. }
  11004. }
  11005. function extractKeys(instance, type) {
  11006. const Comp = instance.type;
  11007. if (isFunction(Comp)) {
  11008. return;
  11009. }
  11010. const extracted = {};
  11011. for (const key in instance.ctx) {
  11012. if (isKeyOfType(Comp, key, type)) {
  11013. extracted[key] = instance.ctx[key];
  11014. }
  11015. }
  11016. return extracted;
  11017. }
  11018. function isKeyOfType(Comp, key, type) {
  11019. const opts = Comp[type];
  11020. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  11021. return true;
  11022. }
  11023. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  11024. return true;
  11025. }
  11026. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  11027. return true;
  11028. }
  11029. }
  11030. function genRefFlag(v) {
  11031. if (isShallow(v)) {
  11032. return `ShallowRef`;
  11033. }
  11034. if (v.effect) {
  11035. return `ComputedRef`;
  11036. }
  11037. return `Ref`;
  11038. }
  11039. if (window.devtoolsFormatters) {
  11040. window.devtoolsFormatters.push(formatter);
  11041. } else {
  11042. window.devtoolsFormatters = [formatter];
  11043. }
  11044. }
  11045. function withMemo(memo, render, cache, index) {
  11046. const cached = cache[index];
  11047. if (cached && isMemoSame(cached, memo)) {
  11048. return cached;
  11049. }
  11050. const ret = render();
  11051. ret.memo = memo.slice();
  11052. ret.cacheIndex = index;
  11053. return cache[index] = ret;
  11054. }
  11055. function isMemoSame(cached, memo) {
  11056. const prev = cached.memo;
  11057. if (prev.length != memo.length) {
  11058. return false;
  11059. }
  11060. for (let i = 0; i < prev.length; i++) {
  11061. if (hasChanged(prev[i], memo[i])) {
  11062. return false;
  11063. }
  11064. }
  11065. if (isBlockTreeEnabled > 0 && currentBlock) {
  11066. currentBlock.push(cached);
  11067. }
  11068. return true;
  11069. }
  11070. const version = "3.5.43";
  11071. const warn = warn$1 ;
  11072. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  11073. const devtools = devtools$1 ;
  11074. const setDevtoolsHook = setDevtoolsHook$1 ;
  11075. const _ssrUtils = {
  11076. createComponentInstance,
  11077. setupComponent,
  11078. renderComponentRoot,
  11079. setCurrentRenderingInstance,
  11080. isVNode: isVNode,
  11081. normalizeVNode,
  11082. getComponentPublicInstance,
  11083. ensureValidVNode,
  11084. pushWarningContext,
  11085. popWarningContext
  11086. };
  11087. const ssrUtils = _ssrUtils ;
  11088. const resolveFilter = null;
  11089. const compatUtils = null;
  11090. const DeprecationTypes = null;
  11091. let policy = void 0;
  11092. const tt = typeof window !== "undefined" && window.trustedTypes;
  11093. if (tt) {
  11094. try {
  11095. policy = /* @__PURE__ */ tt.createPolicy("vue", {
  11096. createHTML: (val) => val
  11097. });
  11098. } catch (e) {
  11099. warn(`Error creating trusted types policy: ${e}`);
  11100. }
  11101. }
  11102. const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
  11103. const svgNS = "http://www.w3.org/2000/svg";
  11104. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  11105. const doc = typeof document !== "undefined" ? document : null;
  11106. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  11107. const nodeOps = {
  11108. insert: (child, parent, anchor) => {
  11109. parent.insertBefore(child, anchor || null);
  11110. },
  11111. remove: (child) => {
  11112. const parent = child.parentNode;
  11113. if (parent) {
  11114. parent.removeChild(child);
  11115. }
  11116. },
  11117. createElement: (tag, namespace, is, props) => {
  11118. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  11119. if (tag === "select" && props && props.multiple != null) {
  11120. el.setAttribute("multiple", props.multiple);
  11121. }
  11122. return el;
  11123. },
  11124. createText: (text) => doc.createTextNode(text),
  11125. createComment: (text) => doc.createComment(text),
  11126. setText: (node, text) => {
  11127. node.nodeValue = text;
  11128. },
  11129. setElementText: (el, text) => {
  11130. el.textContent = text;
  11131. },
  11132. parentNode: (node) => node.parentNode,
  11133. nextSibling: (node) => node.nextSibling,
  11134. querySelector: (selector) => doc.querySelector(selector),
  11135. setScopeId(el, id) {
  11136. el.setAttribute(id, "");
  11137. },
  11138. // __UNSAFE__
  11139. // Reason: innerHTML.
  11140. // Static content here can only come from compiled templates.
  11141. // As long as the user only uses trusted templates, this is safe.
  11142. insertStaticContent(content, parent, anchor, namespace, start, end) {
  11143. const before = anchor ? anchor.previousSibling : parent.lastChild;
  11144. if (start && (start === end || start.nextSibling)) {
  11145. while (true) {
  11146. parent.insertBefore(start.cloneNode(true), anchor);
  11147. if (start === end || !(start = start.nextSibling)) break;
  11148. }
  11149. } else {
  11150. templateContainer.innerHTML = unsafeToTrustedHTML(
  11151. namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
  11152. );
  11153. const template = templateContainer.content;
  11154. if (namespace === "svg" || namespace === "mathml") {
  11155. const wrapper = template.firstChild;
  11156. while (wrapper.firstChild) {
  11157. template.appendChild(wrapper.firstChild);
  11158. }
  11159. template.removeChild(wrapper);
  11160. }
  11161. parent.insertBefore(template, anchor);
  11162. }
  11163. return [
  11164. // first
  11165. before ? before.nextSibling : parent.firstChild,
  11166. // last
  11167. anchor ? anchor.previousSibling : parent.lastChild
  11168. ];
  11169. }
  11170. };
  11171. const TRANSITION$1 = "transition";
  11172. const ANIMATION = "animation";
  11173. const vtcKey = /* @__PURE__ */ Symbol("_vtc");
  11174. const DOMTransitionPropsValidators = {
  11175. name: String,
  11176. type: String,
  11177. css: {
  11178. type: Boolean,
  11179. default: true
  11180. },
  11181. duration: [String, Number, Object],
  11182. enterFromClass: String,
  11183. enterActiveClass: String,
  11184. enterToClass: String,
  11185. appearFromClass: String,
  11186. appearActiveClass: String,
  11187. appearToClass: String,
  11188. leaveFromClass: String,
  11189. leaveActiveClass: String,
  11190. leaveToClass: String
  11191. };
  11192. const TransitionPropsValidators = /* @__PURE__ */ extend(
  11193. {},
  11194. BaseTransitionPropsValidators,
  11195. DOMTransitionPropsValidators
  11196. );
  11197. const decorate$1 = (t) => {
  11198. t.displayName = "Transition";
  11199. t.props = TransitionPropsValidators;
  11200. return t;
  11201. };
  11202. const Transition = /* @__PURE__ */ decorate$1(
  11203. (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
  11204. );
  11205. const callHook = (hook, args = []) => {
  11206. if (isArray(hook)) {
  11207. hook.forEach((h2) => h2(...args));
  11208. } else if (hook) {
  11209. hook(...args);
  11210. }
  11211. };
  11212. const hasExplicitCallback = (hook) => {
  11213. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  11214. };
  11215. function resolveTransitionProps(rawProps) {
  11216. const baseProps = {};
  11217. for (const key in rawProps) {
  11218. if (!(key in DOMTransitionPropsValidators)) {
  11219. baseProps[key] = rawProps[key];
  11220. }
  11221. }
  11222. if (rawProps.css === false) {
  11223. return baseProps;
  11224. }
  11225. const {
  11226. name = "v",
  11227. type,
  11228. duration,
  11229. enterFromClass = `${name}-enter-from`,
  11230. enterActiveClass = `${name}-enter-active`,
  11231. enterToClass = `${name}-enter-to`,
  11232. appearFromClass = enterFromClass,
  11233. appearActiveClass = enterActiveClass,
  11234. appearToClass = enterToClass,
  11235. leaveFromClass = `${name}-leave-from`,
  11236. leaveActiveClass = `${name}-leave-active`,
  11237. leaveToClass = `${name}-leave-to`
  11238. } = rawProps;
  11239. const durations = normalizeDuration(duration);
  11240. const enterDuration = durations && durations[0];
  11241. const leaveDuration = durations && durations[1];
  11242. const {
  11243. onBeforeEnter,
  11244. onEnter,
  11245. onEnterCancelled,
  11246. onLeave,
  11247. onLeaveCancelled,
  11248. onBeforeAppear = onBeforeEnter,
  11249. onAppear = onEnter,
  11250. onAppearCancelled = onEnterCancelled
  11251. } = baseProps;
  11252. const finishEnter = (el, isAppear, done, isCancelled) => {
  11253. el._enterCancelled = isCancelled;
  11254. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  11255. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  11256. done && done();
  11257. };
  11258. const finishLeave = (el, done) => {
  11259. el._isLeaving = false;
  11260. removeTransitionClass(el, leaveFromClass);
  11261. removeTransitionClass(el, leaveToClass);
  11262. removeTransitionClass(el, leaveActiveClass);
  11263. done && done();
  11264. };
  11265. const makeEnterHook = (isAppear) => {
  11266. return (el, done) => {
  11267. const hook = isAppear ? onAppear : onEnter;
  11268. const resolve = () => finishEnter(el, isAppear, done);
  11269. callHook(hook, [el, resolve]);
  11270. nextFrame(() => {
  11271. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  11272. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  11273. if (!hasExplicitCallback(hook)) {
  11274. whenTransitionEnds(el, type, enterDuration, resolve);
  11275. }
  11276. });
  11277. };
  11278. };
  11279. return extend(baseProps, {
  11280. onBeforeEnter(el) {
  11281. callHook(onBeforeEnter, [el]);
  11282. addTransitionClass(el, enterFromClass);
  11283. addTransitionClass(el, enterActiveClass);
  11284. },
  11285. onBeforeAppear(el) {
  11286. callHook(onBeforeAppear, [el]);
  11287. addTransitionClass(el, appearFromClass);
  11288. addTransitionClass(el, appearActiveClass);
  11289. },
  11290. onEnter: makeEnterHook(false),
  11291. onAppear: makeEnterHook(true),
  11292. onLeave(el, done) {
  11293. el._isLeaving = true;
  11294. const resolve = () => finishLeave(el, done);
  11295. addTransitionClass(el, leaveFromClass);
  11296. if (!el._enterCancelled) {
  11297. forceReflow(el);
  11298. addTransitionClass(el, leaveActiveClass);
  11299. } else {
  11300. addTransitionClass(el, leaveActiveClass);
  11301. forceReflow(el);
  11302. }
  11303. nextFrame(() => {
  11304. if (!el._isLeaving) {
  11305. return;
  11306. }
  11307. removeTransitionClass(el, leaveFromClass);
  11308. addTransitionClass(el, leaveToClass);
  11309. if (!hasExplicitCallback(onLeave)) {
  11310. whenTransitionEnds(el, type, leaveDuration, resolve);
  11311. }
  11312. });
  11313. callHook(onLeave, [el, resolve]);
  11314. },
  11315. onEnterCancelled(el) {
  11316. finishEnter(el, false, void 0, true);
  11317. callHook(onEnterCancelled, [el]);
  11318. },
  11319. onAppearCancelled(el) {
  11320. finishEnter(el, true, void 0, true);
  11321. callHook(onAppearCancelled, [el]);
  11322. },
  11323. onLeaveCancelled(el) {
  11324. finishLeave(el);
  11325. callHook(onLeaveCancelled, [el]);
  11326. }
  11327. });
  11328. }
  11329. function normalizeDuration(duration) {
  11330. if (duration == null) {
  11331. return null;
  11332. } else if (isObject(duration)) {
  11333. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  11334. } else {
  11335. const n = NumberOf(duration);
  11336. return [n, n];
  11337. }
  11338. }
  11339. function NumberOf(val) {
  11340. const res = toNumber(val);
  11341. {
  11342. assertNumber(res, "<transition> explicit duration");
  11343. }
  11344. return res;
  11345. }
  11346. function addTransitionClass(el, cls) {
  11347. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  11348. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  11349. }
  11350. function removeTransitionClass(el, cls) {
  11351. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  11352. const _vtc = el[vtcKey];
  11353. if (_vtc) {
  11354. _vtc.delete(cls);
  11355. if (!_vtc.size) {
  11356. el[vtcKey] = void 0;
  11357. }
  11358. }
  11359. }
  11360. function nextFrame(cb) {
  11361. requestAnimationFrame(() => {
  11362. requestAnimationFrame(cb);
  11363. });
  11364. }
  11365. let endId = 0;
  11366. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  11367. const id = el._endId = ++endId;
  11368. const resolveIfNotStale = () => {
  11369. if (id === el._endId) {
  11370. resolve();
  11371. }
  11372. };
  11373. if (explicitTimeout != null) {
  11374. return setTimeout(resolveIfNotStale, explicitTimeout);
  11375. }
  11376. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  11377. if (!type) {
  11378. return resolve();
  11379. }
  11380. const endEvent = type + "end";
  11381. let ended = 0;
  11382. const end = () => {
  11383. el.removeEventListener(endEvent, onEnd);
  11384. resolveIfNotStale();
  11385. };
  11386. const onEnd = (e) => {
  11387. if (e.target === el && ++ended >= propCount) {
  11388. end();
  11389. }
  11390. };
  11391. setTimeout(() => {
  11392. if (ended < propCount) {
  11393. end();
  11394. }
  11395. }, timeout + 1);
  11396. el.addEventListener(endEvent, onEnd);
  11397. }
  11398. function getTransitionInfo(el, expectedType) {
  11399. const styles = window.getComputedStyle(el);
  11400. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  11401. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  11402. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  11403. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  11404. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  11405. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  11406. const animationTimeout = getTimeout(animationDelays, animationDurations);
  11407. let type = null;
  11408. let timeout = 0;
  11409. let propCount = 0;
  11410. if (expectedType === TRANSITION$1) {
  11411. if (transitionTimeout > 0) {
  11412. type = TRANSITION$1;
  11413. timeout = transitionTimeout;
  11414. propCount = transitionDurations.length;
  11415. }
  11416. } else if (expectedType === ANIMATION) {
  11417. if (animationTimeout > 0) {
  11418. type = ANIMATION;
  11419. timeout = animationTimeout;
  11420. propCount = animationDurations.length;
  11421. }
  11422. } else {
  11423. timeout = Math.max(transitionTimeout, animationTimeout);
  11424. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  11425. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  11426. }
  11427. const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
  11428. getStyleProperties(`${TRANSITION$1}Property`).toString()
  11429. );
  11430. return {
  11431. type,
  11432. timeout,
  11433. propCount,
  11434. hasTransform
  11435. };
  11436. }
  11437. function getTimeout(delays, durations) {
  11438. while (delays.length < durations.length) {
  11439. delays = delays.concat(delays);
  11440. }
  11441. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  11442. }
  11443. function toMs(s) {
  11444. if (s === "auto") return 0;
  11445. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  11446. }
  11447. function forceReflow(el) {
  11448. const targetDocument = el ? el.ownerDocument : document;
  11449. return targetDocument.body.offsetHeight;
  11450. }
  11451. function patchClass(el, value, isSVG) {
  11452. const transitionClasses = el[vtcKey];
  11453. if (transitionClasses) {
  11454. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  11455. }
  11456. if (value == null) {
  11457. el.removeAttribute("class");
  11458. } else if (isSVG) {
  11459. el.setAttribute("class", value);
  11460. } else {
  11461. el.className = value;
  11462. }
  11463. }
  11464. const vShowOriginalDisplay = /* @__PURE__ */ Symbol("_vod");
  11465. const vShowHidden = /* @__PURE__ */ Symbol("_vsh");
  11466. const vShow = {
  11467. // used for prop mismatch check during hydration
  11468. name: "show",
  11469. beforeMount(el, { value }, { transition }) {
  11470. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  11471. if (transition && value) {
  11472. transition.beforeEnter(el);
  11473. } else {
  11474. setDisplay(el, value);
  11475. }
  11476. },
  11477. mounted(el, { value }, { transition }) {
  11478. if (transition && value) {
  11479. transition.enter(el);
  11480. }
  11481. },
  11482. updated(el, { value, oldValue }, { transition }) {
  11483. if (!value === !oldValue) return;
  11484. if (transition) {
  11485. if (value) {
  11486. transition.beforeEnter(el);
  11487. setDisplay(el, true);
  11488. transition.enter(el);
  11489. } else {
  11490. transition.leave(el, () => {
  11491. setDisplay(el, false);
  11492. });
  11493. }
  11494. } else {
  11495. setDisplay(el, value);
  11496. }
  11497. },
  11498. beforeUnmount(el, { value }) {
  11499. setDisplay(el, value);
  11500. }
  11501. };
  11502. function setDisplay(el, value) {
  11503. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  11504. el[vShowHidden] = !value;
  11505. }
  11506. function initVShowForSSR() {
  11507. vShow.getSSRProps = ({ value }) => {
  11508. if (!value) {
  11509. return { style: { display: "none" } };
  11510. }
  11511. };
  11512. }
  11513. const CSS_VAR_TEXT = /* @__PURE__ */ Symbol("CSS_VAR_TEXT" );
  11514. function useCssVars(getter) {
  11515. const instance = getCurrentInstance();
  11516. if (!instance) {
  11517. warn(`useCssVars is called without current active component instance.`);
  11518. return;
  11519. }
  11520. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  11521. Array.from(
  11522. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  11523. ).forEach((node) => setVarsOnNode(node, vars));
  11524. };
  11525. {
  11526. instance.getCssVars = () => getter(instance.proxy);
  11527. }
  11528. const setVars = () => {
  11529. const vars = getter(instance.proxy);
  11530. if (instance.ce) {
  11531. setVarsOnNode(instance.ce, vars);
  11532. } else {
  11533. setVarsOnVNode(instance.subTree, vars);
  11534. }
  11535. updateTeleports(vars);
  11536. };
  11537. onBeforeUpdate(() => {
  11538. queuePostFlushCb(setVars);
  11539. });
  11540. onMounted(() => {
  11541. watch(setVars, NOOP, { flush: "post" });
  11542. const ob = new MutationObserver(setVars);
  11543. ob.observe(instance.subTree.el.parentNode, { childList: true });
  11544. onUnmounted(() => ob.disconnect());
  11545. });
  11546. }
  11547. function setVarsOnVNode(vnode, vars) {
  11548. if (vnode.shapeFlag & 128) {
  11549. const suspense = vnode.suspense;
  11550. vnode = suspense.activeBranch;
  11551. if (suspense.pendingBranch && !suspense.isHydrating) {
  11552. suspense.effects.push(() => {
  11553. setVarsOnVNode(suspense.activeBranch, vars);
  11554. });
  11555. }
  11556. }
  11557. while (vnode.component) {
  11558. vnode = vnode.component.subTree;
  11559. }
  11560. if (vnode.shapeFlag & 1 && vnode.el) {
  11561. setVarsOnNode(vnode.el, vars);
  11562. } else if (vnode.type === Fragment) {
  11563. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  11564. } else if (vnode.type === Static) {
  11565. let { el, anchor } = vnode;
  11566. while (el) {
  11567. setVarsOnNode(el, vars);
  11568. if (el === anchor) break;
  11569. el = el.nextSibling;
  11570. }
  11571. }
  11572. }
  11573. function setVarsOnNode(el, vars) {
  11574. if (el.nodeType === 1) {
  11575. const style = el.style;
  11576. let cssText = "";
  11577. for (const key in vars) {
  11578. const value = normalizeCssVarValue(vars[key]);
  11579. style.setProperty(`--${key}`, value);
  11580. cssText += `--${key}: ${value};`;
  11581. }
  11582. style[CSS_VAR_TEXT] = cssText;
  11583. }
  11584. }
  11585. const displayRE = /(?:^|;)\s*display\s*:/;
  11586. function patchStyle(el, prev, next) {
  11587. const style = el.style;
  11588. const isCssString = isString(next);
  11589. let hasControlledDisplay = false;
  11590. if (next && !isCssString) {
  11591. if (prev) {
  11592. if (!isString(prev)) {
  11593. for (const key in prev) {
  11594. if (next[key] == null) {
  11595. setStyle(style, key, "");
  11596. }
  11597. }
  11598. } else {
  11599. for (const prevStyle of prev.split(";")) {
  11600. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  11601. if (next[key] == null) {
  11602. setStyle(style, key, "");
  11603. }
  11604. }
  11605. }
  11606. }
  11607. for (const key in next) {
  11608. if (key === "display") {
  11609. hasControlledDisplay = true;
  11610. }
  11611. const value = next[key];
  11612. if (value != null) {
  11613. if (!shouldPreserveTextareaResizeStyle(
  11614. el,
  11615. key,
  11616. !isString(prev) && prev ? prev[key] : void 0,
  11617. value
  11618. )) {
  11619. setStyle(style, key, value);
  11620. }
  11621. } else {
  11622. setStyle(style, key, "");
  11623. }
  11624. }
  11625. } else {
  11626. if (isCssString) {
  11627. if (prev !== next) {
  11628. const cssVarText = style[CSS_VAR_TEXT];
  11629. if (cssVarText) {
  11630. next += ";" + cssVarText;
  11631. }
  11632. style.cssText = next;
  11633. hasControlledDisplay = displayRE.test(next);
  11634. }
  11635. } else if (prev) {
  11636. el.removeAttribute("style");
  11637. }
  11638. }
  11639. if (vShowOriginalDisplay in el) {
  11640. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  11641. if (el[vShowHidden]) {
  11642. style.display = "none";
  11643. }
  11644. }
  11645. }
  11646. const semicolonRE = /[^\\];\s*$/;
  11647. const importantRE = /\s*!important$/;
  11648. function setStyle(style, name, val) {
  11649. if (isArray(val)) {
  11650. val.forEach((v) => setStyle(style, name, v));
  11651. } else {
  11652. if (val == null) val = "";
  11653. {
  11654. if (semicolonRE.test(val)) {
  11655. warn(
  11656. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  11657. );
  11658. }
  11659. }
  11660. if (name.startsWith("--")) {
  11661. if (importantRE.test(val)) {
  11662. style.setProperty(name, val.replace(importantRE, ""), "important");
  11663. } else {
  11664. style.setProperty(name, val);
  11665. }
  11666. } else {
  11667. const prefixed = autoPrefix(style, name);
  11668. if (importantRE.test(val)) {
  11669. style.setProperty(
  11670. hyphenate(prefixed),
  11671. val.replace(importantRE, ""),
  11672. "important"
  11673. );
  11674. } else {
  11675. style[prefixed] = val;
  11676. }
  11677. }
  11678. }
  11679. }
  11680. const prefixes = ["Webkit", "Moz", "ms"];
  11681. const prefixCache = {};
  11682. function autoPrefix(style, rawName) {
  11683. const cached = prefixCache[rawName];
  11684. if (cached) {
  11685. return cached;
  11686. }
  11687. let name = camelize(rawName);
  11688. if (name !== "filter" && name in style) {
  11689. return prefixCache[rawName] = name;
  11690. }
  11691. name = capitalize(name);
  11692. for (let i = 0; i < prefixes.length; i++) {
  11693. const prefixed = prefixes[i] + name;
  11694. if (prefixed in style) {
  11695. return prefixCache[rawName] = prefixed;
  11696. }
  11697. }
  11698. return rawName;
  11699. }
  11700. function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
  11701. return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
  11702. }
  11703. const xlinkNS = "http://www.w3.org/1999/xlink";
  11704. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  11705. if (isSVG && key.startsWith("xlink:")) {
  11706. if (value == null) {
  11707. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  11708. } else {
  11709. el.setAttributeNS(xlinkNS, key, value);
  11710. }
  11711. } else {
  11712. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  11713. el.removeAttribute(key);
  11714. } else {
  11715. el.setAttribute(
  11716. key,
  11717. isBoolean ? "" : isSymbol(value) ? String(value) : value
  11718. );
  11719. }
  11720. }
  11721. }
  11722. function patchDOMProp(el, key, value, parentComponent, attrName) {
  11723. if (key === "innerHTML" || key === "textContent") {
  11724. if (value != null) {
  11725. el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
  11726. }
  11727. return;
  11728. }
  11729. const tag = el.tagName;
  11730. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  11731. !tag.includes("-")) {
  11732. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  11733. const newValue = value == null ? (
  11734. // #11647: value should be set as empty string for null and undefined,
  11735. // but <input type="checkbox"> should be set as 'on'.
  11736. el.type === "checkbox" ? "on" : ""
  11737. ) : String(value);
  11738. if (oldValue !== newValue || !("_value" in el)) {
  11739. el.value = newValue;
  11740. }
  11741. if (value == null) {
  11742. el.removeAttribute(key);
  11743. }
  11744. el._value = value;
  11745. return;
  11746. }
  11747. let needRemove = false;
  11748. if (value === "" || value == null) {
  11749. const type = typeof el[key];
  11750. if (type === "boolean") {
  11751. value = includeBooleanAttr(value);
  11752. } else if (value == null && type === "string") {
  11753. value = "";
  11754. needRemove = true;
  11755. } else if (type === "number") {
  11756. value = 0;
  11757. needRemove = true;
  11758. }
  11759. }
  11760. try {
  11761. el[key] = value;
  11762. } catch (e) {
  11763. if (!needRemove) {
  11764. warn(
  11765. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  11766. e
  11767. );
  11768. }
  11769. }
  11770. needRemove && el.removeAttribute(attrName || key);
  11771. }
  11772. function addEventListener(el, event, handler, options) {
  11773. el.addEventListener(event, handler, options);
  11774. }
  11775. function removeEventListener(el, event, handler, options) {
  11776. el.removeEventListener(event, handler, options);
  11777. }
  11778. const veiKey = /* @__PURE__ */ Symbol("_vei");
  11779. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  11780. const invokers = el[veiKey] || (el[veiKey] = {});
  11781. const existingInvoker = invokers[rawName];
  11782. if (nextValue && existingInvoker) {
  11783. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  11784. } else {
  11785. const [name, options] = parseName(rawName);
  11786. if (nextValue) {
  11787. const invoker = invokers[rawName] = createInvoker(
  11788. sanitizeEventValue(nextValue, rawName) ,
  11789. instance
  11790. );
  11791. addEventListener(el, name, invoker, options);
  11792. } else if (existingInvoker) {
  11793. removeEventListener(el, name, existingInvoker, options);
  11794. invokers[rawName] = void 0;
  11795. }
  11796. }
  11797. }
  11798. const optionsModifierRE = /(Once|Passive|Capture)$/;
  11799. const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
  11800. function parseName(name) {
  11801. let options;
  11802. let m;
  11803. while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
  11804. if (!options) options = {};
  11805. name = name.slice(0, name.length - m[1].length);
  11806. options[m[1].toLowerCase()] = true;
  11807. }
  11808. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  11809. return [event, options];
  11810. }
  11811. let cachedNow = 0;
  11812. const p = /* @__PURE__ */ Promise.resolve();
  11813. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  11814. function createInvoker(initialValue, instance) {
  11815. const invoker = (e) => {
  11816. if (!e._vts) {
  11817. e._vts = Date.now();
  11818. } else if (e._vts <= invoker.attached) {
  11819. return;
  11820. }
  11821. const value = invoker.value;
  11822. if (isArray(value)) {
  11823. const originalStop = e.stopImmediatePropagation;
  11824. e.stopImmediatePropagation = () => {
  11825. originalStop.call(e);
  11826. e._stopped = true;
  11827. };
  11828. const handlers = value.slice();
  11829. const args = [e];
  11830. for (let i = 0; i < handlers.length; i++) {
  11831. if (e._stopped) {
  11832. break;
  11833. }
  11834. const handler = handlers[i];
  11835. if (handler) {
  11836. callWithAsyncErrorHandling(
  11837. handler,
  11838. instance,
  11839. 5,
  11840. args
  11841. );
  11842. }
  11843. }
  11844. } else {
  11845. callWithAsyncErrorHandling(
  11846. value,
  11847. instance,
  11848. 5,
  11849. [e]
  11850. );
  11851. }
  11852. };
  11853. invoker.value = initialValue;
  11854. invoker.attached = getNow();
  11855. return invoker;
  11856. }
  11857. function sanitizeEventValue(value, propName) {
  11858. if (isFunction(value) || isArray(value)) {
  11859. return value;
  11860. }
  11861. warn(
  11862. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  11863. Expected function or array of functions, received type ${typeof value}.`
  11864. );
  11865. return NOOP;
  11866. }
  11867. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  11868. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  11869. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  11870. const isSVG = namespace === "svg";
  11871. if (key === "class") {
  11872. patchClass(el, nextValue, isSVG);
  11873. } else if (key === "style") {
  11874. patchStyle(el, prevValue, nextValue);
  11875. } else if (isOn(key)) {
  11876. if (!isModelListener(key)) {
  11877. patchEvent(el, key, prevValue, nextValue, parentComponent);
  11878. }
  11879. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  11880. patchDOMProp(el, key, nextValue);
  11881. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  11882. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  11883. }
  11884. } else if (
  11885. // #11081 force set props for possible async custom element
  11886. el._isVueCE && // #12408 check if it's declared prop or it's async custom element
  11887. (shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
  11888. el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))
  11889. ) {
  11890. patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
  11891. } else {
  11892. if (key === "true-value") {
  11893. el._trueValue = nextValue;
  11894. } else if (key === "false-value") {
  11895. el._falseValue = nextValue;
  11896. }
  11897. patchAttr(el, key, nextValue, isSVG);
  11898. }
  11899. };
  11900. function shouldSetAsProp(el, key, value, isSVG) {
  11901. if (isSVG) {
  11902. if (key === "innerHTML" || key === "textContent") {
  11903. return true;
  11904. }
  11905. if (key in el && isNativeOn(key) && isFunction(value)) {
  11906. return true;
  11907. }
  11908. return false;
  11909. }
  11910. if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
  11911. return false;
  11912. }
  11913. if (key === "sandbox" && el.tagName === "IFRAME") {
  11914. return false;
  11915. }
  11916. if (key === "form") {
  11917. return false;
  11918. }
  11919. if (key === "list" && el.tagName === "INPUT") {
  11920. return false;
  11921. }
  11922. if (key === "type" && el.tagName === "TEXTAREA") {
  11923. return false;
  11924. }
  11925. if (key === "width" || key === "height") {
  11926. const tag = el.tagName;
  11927. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  11928. return false;
  11929. }
  11930. }
  11931. if (isNativeOn(key) && isString(value)) {
  11932. return false;
  11933. }
  11934. return key in el;
  11935. }
  11936. function shouldSetAsPropForVueCE(el, key) {
  11937. const props = (
  11938. // @ts-expect-error _def is private
  11939. el._def.props
  11940. );
  11941. if (!props) {
  11942. return false;
  11943. }
  11944. const camelKey = camelize(key);
  11945. return Array.isArray(props) ? props.some((prop) => camelize(prop) === camelKey) : Object.keys(props).some((prop) => camelize(prop) === camelKey);
  11946. }
  11947. const REMOVAL = {};
  11948. // @__NO_SIDE_EFFECTS__
  11949. function defineCustomElement(options, extraOptions, _createApp) {
  11950. let Comp = defineComponent(options, extraOptions);
  11951. if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
  11952. class VueCustomElement extends VueElement {
  11953. constructor(initialProps) {
  11954. super(Comp, initialProps, _createApp);
  11955. }
  11956. }
  11957. VueCustomElement.def = Comp;
  11958. return VueCustomElement;
  11959. }
  11960. const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  11961. return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
  11962. });
  11963. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  11964. };
  11965. class VueElement extends BaseClass {
  11966. constructor(_def, _props = {}, _createApp = createApp) {
  11967. super();
  11968. this._def = _def;
  11969. this._props = _props;
  11970. this._createApp = _createApp;
  11971. this._isVueCE = true;
  11972. /**
  11973. * @internal
  11974. */
  11975. this._instance = null;
  11976. /**
  11977. * @internal
  11978. */
  11979. this._app = null;
  11980. /**
  11981. * @internal
  11982. */
  11983. this._nonce = this._def.nonce;
  11984. this._connected = false;
  11985. this._resolved = false;
  11986. this._patching = false;
  11987. this._dirty = false;
  11988. this._numberProps = null;
  11989. this._styleChildren = /* @__PURE__ */ new WeakSet();
  11990. this._styleAnchors = /* @__PURE__ */ new WeakMap();
  11991. this._ob = null;
  11992. if (this.shadowRoot && _createApp !== createApp) {
  11993. this._root = this.shadowRoot;
  11994. } else {
  11995. if (this.shadowRoot) {
  11996. warn(
  11997. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  11998. );
  11999. }
  12000. if (_def.shadowRoot !== false) {
  12001. this.attachShadow(
  12002. extend({}, _def.shadowRootOptions, {
  12003. mode: "open"
  12004. })
  12005. );
  12006. this._root = this.shadowRoot;
  12007. } else {
  12008. this._root = this;
  12009. }
  12010. }
  12011. }
  12012. connectedCallback() {
  12013. if (!this.isConnected) return;
  12014. if (!this.shadowRoot && !this._resolved) {
  12015. this._parseSlots();
  12016. }
  12017. this._connected = true;
  12018. let parent = this;
  12019. while (parent = parent && // #12479 should check assignedSlot first to get correct parent
  12020. (parent.assignedSlot || parent.parentNode || parent.host)) {
  12021. if (parent instanceof VueElement) {
  12022. this._parent = parent;
  12023. break;
  12024. }
  12025. }
  12026. if (!this._instance) {
  12027. if (this._resolved) {
  12028. this._mount(this._def);
  12029. } else {
  12030. if (parent && parent._pendingResolve) {
  12031. this._pendingResolve = parent._pendingResolve.then(() => {
  12032. this._pendingResolve = void 0;
  12033. if (this.isConnected) {
  12034. return this._resolveDef();
  12035. }
  12036. });
  12037. } else {
  12038. this._resolveDef();
  12039. }
  12040. }
  12041. }
  12042. }
  12043. _setParent(parent = this._parent) {
  12044. if (parent) {
  12045. this._instance.parent = parent._instance;
  12046. this._inheritParentContext(parent);
  12047. }
  12048. }
  12049. _inheritParentContext(parent = this._parent) {
  12050. if (parent && this._app) {
  12051. Object.setPrototypeOf(
  12052. this._app._context.provides,
  12053. parent._instance.provides
  12054. );
  12055. }
  12056. }
  12057. disconnectedCallback() {
  12058. this._connected = false;
  12059. nextTick(() => {
  12060. if (!this._connected) {
  12061. if (this._ob) {
  12062. this._ob.disconnect();
  12063. this._ob = null;
  12064. }
  12065. this._app && this._app.unmount();
  12066. if (this._instance) this._instance.ce = void 0;
  12067. this._app = this._instance = null;
  12068. if (this._teleportTargets) {
  12069. this._teleportTargets.clear();
  12070. this._teleportTargets = void 0;
  12071. }
  12072. }
  12073. });
  12074. }
  12075. _processMutations(mutations) {
  12076. for (const m of mutations) {
  12077. this._setAttr(m.attributeName);
  12078. }
  12079. }
  12080. /**
  12081. * resolve inner component definition (handle possible async component)
  12082. */
  12083. _resolveDef() {
  12084. if (this._pendingResolve) {
  12085. return this._pendingResolve;
  12086. }
  12087. for (let i = 0; i < this.attributes.length; i++) {
  12088. this._setAttr(this.attributes[i].name);
  12089. }
  12090. this._ob = new MutationObserver(this._processMutations.bind(this));
  12091. this._ob.observe(this, { attributes: true });
  12092. const resolve = (def, isAsync = false) => {
  12093. this._resolved = true;
  12094. this._pendingResolve = void 0;
  12095. const { props, styles } = def;
  12096. let numberProps;
  12097. if (props && !isArray(props)) {
  12098. for (const key in props) {
  12099. const opt = props[key];
  12100. if (opt === Number || opt && opt.type === Number) {
  12101. if (key in this._props) {
  12102. this._props[key] = toNumber(this._props[key]);
  12103. }
  12104. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  12105. }
  12106. }
  12107. }
  12108. this._numberProps = numberProps;
  12109. this._resolveProps(def);
  12110. if (this.shadowRoot) {
  12111. this._applyStyles(styles);
  12112. } else if (styles) {
  12113. warn(
  12114. "Custom element style injection is not supported when using shadowRoot: false"
  12115. );
  12116. }
  12117. this._mount(def);
  12118. };
  12119. const asyncDef = this._def.__asyncLoader;
  12120. if (asyncDef) {
  12121. this._pendingResolve = asyncDef().then((def) => {
  12122. def.configureApp = this._def.configureApp;
  12123. resolve(this._def = def, true);
  12124. });
  12125. return this._pendingResolve;
  12126. } else {
  12127. resolve(this._def);
  12128. }
  12129. }
  12130. _mount(def) {
  12131. if (!def.name) {
  12132. def.name = "VueElement";
  12133. }
  12134. this._app = this._createApp(def);
  12135. this._inheritParentContext();
  12136. if (def.configureApp) {
  12137. def.configureApp(this._app);
  12138. }
  12139. this._app._ceVNode = this._createVNode();
  12140. this._app.mount(this._root);
  12141. const exposed = this._instance && this._instance.exposed;
  12142. if (!exposed) return;
  12143. for (const key in exposed) {
  12144. if (!hasOwn(this, key)) {
  12145. Object.defineProperty(this, key, {
  12146. // unwrap ref to be consistent with public instance behavior
  12147. get: () => unref(exposed[key])
  12148. });
  12149. } else {
  12150. warn(`Exposed property "${key}" already exists on custom element.`);
  12151. }
  12152. }
  12153. }
  12154. _resolveProps(def) {
  12155. const { props } = def;
  12156. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  12157. for (const key of Object.keys(this)) {
  12158. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  12159. this._setProp(key, this[key]);
  12160. }
  12161. }
  12162. for (const key of declaredPropKeys.map(camelize)) {
  12163. if (key in Object.getPrototypeOf(this)) {
  12164. warn(
  12165. `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
  12166. );
  12167. }
  12168. Object.defineProperty(this, key, {
  12169. get() {
  12170. return this._getProp(key);
  12171. },
  12172. set(val) {
  12173. this._setProp(key, val, true, !this._patching);
  12174. }
  12175. });
  12176. }
  12177. }
  12178. _setAttr(key) {
  12179. if (key.startsWith("data-v-")) return;
  12180. const has = this.hasAttribute(key);
  12181. let value = has ? this.getAttribute(key) : REMOVAL;
  12182. const camelKey = camelize(key);
  12183. if (has && this._numberProps && this._numberProps[camelKey]) {
  12184. value = toNumber(value);
  12185. }
  12186. this._setProp(camelKey, value, false, true);
  12187. }
  12188. /**
  12189. * @internal
  12190. */
  12191. _getProp(key) {
  12192. return this._props[key];
  12193. }
  12194. /**
  12195. * @internal
  12196. */
  12197. _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
  12198. if (val !== this._props[key]) {
  12199. this._dirty = true;
  12200. if (val === REMOVAL) {
  12201. delete this._props[key];
  12202. } else {
  12203. this._props[key] = val;
  12204. if (key === "key" && this._app) {
  12205. this._app._ceVNode.key = val;
  12206. }
  12207. }
  12208. if (shouldUpdate && this._instance) {
  12209. this._update();
  12210. }
  12211. if (shouldReflect) {
  12212. const ob = this._ob;
  12213. if (ob) {
  12214. this._processMutations(ob.takeRecords());
  12215. ob.disconnect();
  12216. }
  12217. if (val === true) {
  12218. this.setAttribute(hyphenate(key), "");
  12219. } else if (typeof val === "string" || typeof val === "number") {
  12220. this.setAttribute(hyphenate(key), val + "");
  12221. } else if (!val) {
  12222. this.removeAttribute(hyphenate(key));
  12223. }
  12224. ob && ob.observe(this, { attributes: true });
  12225. }
  12226. }
  12227. }
  12228. _update() {
  12229. const vnode = this._createVNode();
  12230. if (this._app) vnode.appContext = this._app._context;
  12231. render(vnode, this._root);
  12232. }
  12233. _createVNode() {
  12234. const baseProps = {};
  12235. if (!this.shadowRoot) {
  12236. baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
  12237. }
  12238. const vnode = createVNode(this._def, extend(baseProps, this._props));
  12239. if (!this._instance) {
  12240. vnode.ce = (instance) => {
  12241. this._instance = instance;
  12242. instance.ce = this;
  12243. instance.isCE = true;
  12244. {
  12245. instance.ceReload = (newStyles) => {
  12246. if (this._styles) {
  12247. this._styles.forEach((s) => this._root.removeChild(s));
  12248. this._styles.length = 0;
  12249. }
  12250. this._styleAnchors.delete(this._def);
  12251. this._applyStyles(newStyles);
  12252. this._instance = null;
  12253. this._update();
  12254. };
  12255. }
  12256. const dispatch = (event, args) => {
  12257. this.dispatchEvent(
  12258. new CustomEvent(
  12259. event,
  12260. isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
  12261. )
  12262. );
  12263. };
  12264. instance.emit = (event, ...args) => {
  12265. dispatch(event, args);
  12266. if (hyphenate(event) !== event) {
  12267. dispatch(hyphenate(event), args);
  12268. }
  12269. };
  12270. this._setParent();
  12271. };
  12272. }
  12273. return vnode;
  12274. }
  12275. _applyStyles(styles, owner, parentComp) {
  12276. if (!styles) return;
  12277. if (owner) {
  12278. if (owner === this._def || this._styleChildren.has(owner)) {
  12279. return;
  12280. }
  12281. this._styleChildren.add(owner);
  12282. }
  12283. const nonce = this._nonce;
  12284. const root = this.shadowRoot;
  12285. const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
  12286. let last = null;
  12287. for (let i = styles.length - 1; i >= 0; i--) {
  12288. const s = document.createElement("style");
  12289. if (nonce) s.setAttribute("nonce", nonce);
  12290. s.textContent = styles[i];
  12291. root.insertBefore(s, last || insertionAnchor);
  12292. last = s;
  12293. if (i === 0) {
  12294. if (!parentComp) this._styleAnchors.set(this._def, s);
  12295. if (owner) this._styleAnchors.set(owner, s);
  12296. }
  12297. {
  12298. if (owner) {
  12299. if (owner.__hmrId) {
  12300. if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
  12301. let entry = this._childStyles.get(owner.__hmrId);
  12302. if (!entry) {
  12303. this._childStyles.set(owner.__hmrId, entry = []);
  12304. }
  12305. entry.push(s);
  12306. }
  12307. } else {
  12308. (this._styles || (this._styles = [])).push(s);
  12309. }
  12310. }
  12311. }
  12312. }
  12313. _getStyleAnchor(comp) {
  12314. if (!comp) {
  12315. return null;
  12316. }
  12317. const anchor = this._styleAnchors.get(comp);
  12318. if (anchor && anchor.parentNode === this.shadowRoot) {
  12319. return anchor;
  12320. }
  12321. if (anchor) {
  12322. this._styleAnchors.delete(comp);
  12323. }
  12324. return null;
  12325. }
  12326. _getRootStyleInsertionAnchor(root) {
  12327. for (let i = 0; i < root.childNodes.length; i++) {
  12328. const node = root.childNodes[i];
  12329. if (!(node instanceof HTMLStyleElement)) {
  12330. return node;
  12331. }
  12332. }
  12333. return null;
  12334. }
  12335. /**
  12336. * Only called when shadowRoot is false
  12337. */
  12338. _parseSlots() {
  12339. const slots = this._slots = {};
  12340. let n;
  12341. while (n = this.firstChild) {
  12342. const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
  12343. (slots[slotName] || (slots[slotName] = [])).push(n);
  12344. this.removeChild(n);
  12345. }
  12346. }
  12347. /**
  12348. * Only called when shadowRoot is false
  12349. */
  12350. _renderSlots() {
  12351. const outlets = this._getSlots();
  12352. const scopeId = this._instance.type.__scopeId;
  12353. for (let i = 0; i < outlets.length; i++) {
  12354. const o = outlets[i];
  12355. const slotName = o.getAttribute("name") || "default";
  12356. const content = this._slots[slotName];
  12357. const parent = o.parentNode;
  12358. if (content) {
  12359. for (const n of content) {
  12360. if (scopeId && n.nodeType === 1) {
  12361. const id = scopeId + "-s";
  12362. const walker = document.createTreeWalker(n, 1);
  12363. n.setAttribute(id, "");
  12364. let child;
  12365. while (child = walker.nextNode()) {
  12366. child.setAttribute(id, "");
  12367. }
  12368. }
  12369. parent.insertBefore(n, o);
  12370. }
  12371. } else {
  12372. while (o.firstChild) parent.insertBefore(o.firstChild, o);
  12373. }
  12374. parent.removeChild(o);
  12375. }
  12376. }
  12377. /**
  12378. * @internal
  12379. */
  12380. _getSlots() {
  12381. const roots = [this];
  12382. if (this._teleportTargets) {
  12383. roots.push(...this._teleportTargets);
  12384. }
  12385. const slots = /* @__PURE__ */ new Set();
  12386. for (const root of roots) {
  12387. const found = root.querySelectorAll("slot");
  12388. for (let i = 0; i < found.length; i++) {
  12389. slots.add(found[i]);
  12390. }
  12391. }
  12392. return Array.from(slots);
  12393. }
  12394. /**
  12395. * @internal
  12396. */
  12397. _injectChildStyle(comp, parentComp) {
  12398. this._applyStyles(comp.styles, comp, parentComp);
  12399. }
  12400. /**
  12401. * @internal
  12402. */
  12403. _beginPatch() {
  12404. this._patching = true;
  12405. this._dirty = false;
  12406. }
  12407. /**
  12408. * @internal
  12409. */
  12410. _endPatch() {
  12411. this._patching = false;
  12412. if (this._dirty && this._instance) {
  12413. this._update();
  12414. }
  12415. }
  12416. /**
  12417. * @internal
  12418. */
  12419. _hasShadowRoot() {
  12420. return this._def.shadowRoot !== false;
  12421. }
  12422. /**
  12423. * @internal
  12424. */
  12425. _removeChildStyle(comp) {
  12426. {
  12427. this._styleChildren.delete(comp);
  12428. this._styleAnchors.delete(comp);
  12429. if (this._childStyles && comp.__hmrId) {
  12430. const oldStyles = this._childStyles.get(comp.__hmrId);
  12431. if (oldStyles) {
  12432. oldStyles.forEach((s) => this._root.removeChild(s));
  12433. oldStyles.length = 0;
  12434. }
  12435. }
  12436. }
  12437. }
  12438. }
  12439. function useHost(caller) {
  12440. const instance = getCurrentInstance();
  12441. const el = instance && instance.ce;
  12442. if (el) {
  12443. return el;
  12444. } else {
  12445. if (!instance) {
  12446. warn(
  12447. `${caller || "useHost"} called without an active component instance.`
  12448. );
  12449. } else {
  12450. warn(
  12451. `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
  12452. );
  12453. }
  12454. }
  12455. return null;
  12456. }
  12457. function useShadowRoot() {
  12458. const el = useHost("useShadowRoot") ;
  12459. return el && el.shadowRoot;
  12460. }
  12461. function useCssModule(name = "$style") {
  12462. {
  12463. const instance = getCurrentInstance();
  12464. if (!instance) {
  12465. warn(`useCssModule must be called inside setup()`);
  12466. return EMPTY_OBJ;
  12467. }
  12468. const modules = instance.type.__cssModules;
  12469. if (!modules) {
  12470. warn(`Current instance does not have CSS modules injected.`);
  12471. return EMPTY_OBJ;
  12472. }
  12473. const mod = modules[name];
  12474. if (!mod) {
  12475. warn(`Current instance does not have CSS module named "${name}".`);
  12476. return EMPTY_OBJ;
  12477. }
  12478. return mod;
  12479. }
  12480. }
  12481. const positionMap = /* @__PURE__ */ new WeakMap();
  12482. const newPositionMap = /* @__PURE__ */ new WeakMap();
  12483. const moveCbKey = /* @__PURE__ */ Symbol("_moveCb");
  12484. const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
  12485. const decorate = (t) => {
  12486. delete t.props.mode;
  12487. return t;
  12488. };
  12489. const TransitionGroupImpl = /* @__PURE__ */ decorate({
  12490. name: "TransitionGroup",
  12491. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  12492. tag: String,
  12493. moveClass: String
  12494. }),
  12495. setup(props, { slots }) {
  12496. const instance = getCurrentInstance();
  12497. const state = useTransitionState();
  12498. let prevChildren;
  12499. let children;
  12500. onUpdated(() => {
  12501. if (!prevChildren.length) {
  12502. return;
  12503. }
  12504. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  12505. if (!hasCSSTransform(
  12506. prevChildren[0].el,
  12507. instance.vnode.el,
  12508. moveClass
  12509. )) {
  12510. prevChildren = [];
  12511. return;
  12512. }
  12513. prevChildren.forEach(callPendingCbs);
  12514. prevChildren.forEach(recordPosition);
  12515. const movedChildren = prevChildren.filter(applyTranslation);
  12516. forceReflow(instance.vnode.el);
  12517. movedChildren.forEach((c) => {
  12518. const el = c.el;
  12519. const style = el.style;
  12520. addTransitionClass(el, moveClass);
  12521. style.transform = style.webkitTransform = style.transitionDuration = "";
  12522. const cb = el[moveCbKey] = (e) => {
  12523. if (e && e.target !== el) {
  12524. return;
  12525. }
  12526. if (!e || e.propertyName.endsWith("transform")) {
  12527. el.removeEventListener("transitionend", cb);
  12528. el[moveCbKey] = null;
  12529. removeTransitionClass(el, moveClass);
  12530. }
  12531. };
  12532. el.addEventListener("transitionend", cb);
  12533. });
  12534. prevChildren = [];
  12535. });
  12536. return () => {
  12537. const rawProps = toRaw(props);
  12538. const cssTransitionProps = resolveTransitionProps(rawProps);
  12539. let tag = rawProps.tag || Fragment;
  12540. prevChildren = [];
  12541. if (children) {
  12542. for (let i = 0; i < children.length; i++) {
  12543. const child = children[i];
  12544. if (child.el && child.el instanceof Element && // Hidden v-show nodes have no previous layout box to animate from.
  12545. !child.el[vShowHidden]) {
  12546. prevChildren.push(child);
  12547. setTransitionHooks(
  12548. child,
  12549. resolveTransitionHooks(
  12550. child,
  12551. cssTransitionProps,
  12552. state,
  12553. instance
  12554. )
  12555. );
  12556. positionMap.set(child, getPosition(child.el));
  12557. }
  12558. }
  12559. }
  12560. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  12561. for (let i = 0; i < children.length; i++) {
  12562. const child = children[i];
  12563. if (child.key != null) {
  12564. setTransitionHooks(
  12565. child,
  12566. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  12567. );
  12568. } else if (child.type !== Text) {
  12569. warn(`<TransitionGroup> children must be keyed.`);
  12570. }
  12571. }
  12572. return createVNode(tag, null, children);
  12573. };
  12574. }
  12575. });
  12576. const TransitionGroup = TransitionGroupImpl;
  12577. function callPendingCbs(c) {
  12578. const el = c.el;
  12579. if (el[moveCbKey]) {
  12580. el[moveCbKey]();
  12581. }
  12582. if (el[enterCbKey]) {
  12583. el[enterCbKey]();
  12584. }
  12585. }
  12586. function recordPosition(c) {
  12587. newPositionMap.set(c, getPosition(c.el));
  12588. }
  12589. function applyTranslation(c) {
  12590. const oldPos = positionMap.get(c);
  12591. const newPos = newPositionMap.get(c);
  12592. const dx = oldPos.left - newPos.left;
  12593. const dy = oldPos.top - newPos.top;
  12594. if (dx || dy) {
  12595. const el = c.el;
  12596. const s = el.style;
  12597. const rect = el.getBoundingClientRect();
  12598. let scaleX = 1;
  12599. let scaleY = 1;
  12600. if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
  12601. if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
  12602. if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
  12603. if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
  12604. if (Math.abs(scaleX - 1) < 0.01) scaleX = 1;
  12605. if (Math.abs(scaleY - 1) < 0.01) scaleY = 1;
  12606. s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
  12607. s.transitionDuration = "0s";
  12608. return c;
  12609. }
  12610. }
  12611. function getPosition(el) {
  12612. const rect = el.getBoundingClientRect();
  12613. return {
  12614. left: rect.left,
  12615. top: rect.top
  12616. };
  12617. }
  12618. function hasCSSTransform(el, root, moveClass) {
  12619. const clone = el.cloneNode();
  12620. const _vtc = el[vtcKey];
  12621. if (_vtc) {
  12622. _vtc.forEach((cls) => {
  12623. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  12624. });
  12625. }
  12626. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  12627. clone.style.display = "none";
  12628. const container = root.nodeType === 1 ? root : root.parentNode;
  12629. container.appendChild(clone);
  12630. const { hasTransform } = getTransitionInfo(clone);
  12631. container.removeChild(clone);
  12632. return hasTransform;
  12633. }
  12634. const getModelAssigner = (vnode) => {
  12635. const fn = vnode.props["onUpdate:modelValue"] || false;
  12636. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  12637. };
  12638. function onCompositionStart(e) {
  12639. e.target.composing = true;
  12640. }
  12641. function onCompositionEnd(e) {
  12642. const target = e.target;
  12643. if (target.composing) {
  12644. target.composing = false;
  12645. target.dispatchEvent(new Event("input"));
  12646. }
  12647. }
  12648. const assignKey = /* @__PURE__ */ Symbol("_assign");
  12649. const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
  12650. function castValue(value, trim, number) {
  12651. if (trim) value = value.trim();
  12652. if (number) value = looseToNumber(value);
  12653. return value;
  12654. }
  12655. const vModelText = {
  12656. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  12657. if (el.parentNode) {
  12658. if (el.type === "text") {
  12659. el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
  12660. } else if (el.type === "textarea") {
  12661. el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
  12662. }
  12663. }
  12664. el[assignKey] = getModelAssigner(vnode);
  12665. const castToNumber = number || vnode.props && vnode.props.type === "number";
  12666. addEventListener(el, lazy ? "change" : "input", (e) => {
  12667. if (e.target.composing) return;
  12668. el[assignKey](castValue(el.value, trim, castToNumber));
  12669. });
  12670. if (trim || castToNumber) {
  12671. addEventListener(el, "change", () => {
  12672. el.value = castValue(el.value, trim, castToNumber);
  12673. });
  12674. }
  12675. if (!lazy) {
  12676. addEventListener(el, "compositionstart", onCompositionStart);
  12677. addEventListener(el, "compositionend", onCompositionEnd);
  12678. addEventListener(el, "change", onCompositionEnd);
  12679. }
  12680. },
  12681. // set value on mounted so it's after min/max for type="range"
  12682. mounted(el, { value, modifiers: { trim, number } }) {
  12683. const newValue = value == null ? "" : value;
  12684. const initialValue = el[initialValueKey];
  12685. delete el[initialValueKey];
  12686. if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
  12687. el[assignKey](castValue(el.value, trim, number));
  12688. } else {
  12689. el.value = newValue;
  12690. }
  12691. },
  12692. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  12693. el[assignKey] = getModelAssigner(vnode);
  12694. if (el.composing) return;
  12695. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  12696. const newValue = value == null ? "" : value;
  12697. if (elValue === newValue) {
  12698. return;
  12699. }
  12700. const rootNode = el.getRootNode();
  12701. if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
  12702. if (lazy && value === oldValue) {
  12703. return;
  12704. }
  12705. if (trim && el.value.trim() === newValue) {
  12706. return;
  12707. }
  12708. }
  12709. el.value = newValue;
  12710. }
  12711. };
  12712. const vModelCheckbox = {
  12713. // #4096 array checkboxes need to be deep traversed
  12714. deep: true,
  12715. created(el, _, vnode) {
  12716. el[assignKey] = getModelAssigner(vnode);
  12717. addEventListener(el, "change", () => {
  12718. const modelValue = el._modelValue;
  12719. const elementValue = getValue(el);
  12720. const checked = el.checked;
  12721. const assign = el[assignKey];
  12722. if (isArray(modelValue)) {
  12723. const index = looseIndexOf(modelValue, elementValue);
  12724. const found = index !== -1;
  12725. if (checked && !found) {
  12726. assign(modelValue.concat(elementValue));
  12727. } else if (!checked && found) {
  12728. const filtered = [...modelValue];
  12729. filtered.splice(index, 1);
  12730. assign(filtered);
  12731. }
  12732. } else if (isSet(modelValue)) {
  12733. const cloned = new Set(modelValue);
  12734. if (checked) {
  12735. cloned.add(elementValue);
  12736. } else {
  12737. cloned.delete(elementValue);
  12738. }
  12739. assign(cloned);
  12740. } else {
  12741. assign(getCheckboxValue(el, checked));
  12742. }
  12743. });
  12744. },
  12745. // set initial checked on mount to wait for true-value/false-value
  12746. mounted: setChecked,
  12747. beforeUpdate(el, binding, vnode) {
  12748. el[assignKey] = getModelAssigner(vnode);
  12749. setChecked(el, binding, vnode);
  12750. }
  12751. };
  12752. function setChecked(el, { value, oldValue }, vnode) {
  12753. el._modelValue = value;
  12754. let checked;
  12755. if (isArray(value)) {
  12756. checked = looseIndexOf(value, vnode.props.value) > -1;
  12757. } else if (isSet(value)) {
  12758. checked = value.has(vnode.props.value);
  12759. } else {
  12760. if (value === oldValue) return;
  12761. checked = looseEqual(value, getCheckboxValue(el, true));
  12762. }
  12763. if (el.checked !== checked) {
  12764. el.checked = checked;
  12765. }
  12766. }
  12767. const vModelRadio = {
  12768. created(el, { value }, vnode) {
  12769. el.checked = looseEqual(value, vnode.props.value);
  12770. el[assignKey] = getModelAssigner(vnode);
  12771. addEventListener(el, "change", () => {
  12772. el[assignKey](getValue(el));
  12773. });
  12774. },
  12775. beforeUpdate(el, { value, oldValue }, vnode) {
  12776. el[assignKey] = getModelAssigner(vnode);
  12777. if (value !== oldValue) {
  12778. el.checked = looseEqual(value, vnode.props.value);
  12779. }
  12780. }
  12781. };
  12782. const vModelSelect = {
  12783. // <select multiple> value need to be deep traversed
  12784. deep: true,
  12785. created(el, { value, modifiers: { number } }, vnode) {
  12786. el._modelValue = value;
  12787. addEventListener(el, "change", () => {
  12788. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  12789. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  12790. );
  12791. const multiple = el.multiple;
  12792. const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
  12793. const pending = el._pendingValue = [
  12794. multiple,
  12795. multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
  12796. ];
  12797. try {
  12798. el[assignKey](assignedValue);
  12799. } finally {
  12800. nextTick(() => {
  12801. if (el._pendingValue === pending) {
  12802. el._pendingValue = void 0;
  12803. }
  12804. });
  12805. }
  12806. });
  12807. el[assignKey] = getModelAssigner(vnode);
  12808. },
  12809. // set value in mounted & updated because <select> relies on its children
  12810. // <option>s.
  12811. mounted(el, { value }) {
  12812. setSelected(el, value);
  12813. },
  12814. beforeUpdate(el, { value }, vnode) {
  12815. el._modelValue = value;
  12816. el[assignKey] = getModelAssigner(vnode);
  12817. },
  12818. updated(el, { value }) {
  12819. const pending = el._pendingValue;
  12820. el._pendingValue = void 0;
  12821. if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
  12822. setSelected(el, value);
  12823. }
  12824. }
  12825. };
  12826. function isSameSelectValue(value, assignedValue, multiple) {
  12827. if (!multiple) return looseEqual(value, assignedValue);
  12828. if (isArray(value)) return looseEqual(value, assignedValue);
  12829. if (isSet(value)) {
  12830. if (value.size !== assignedValue.length) return false;
  12831. for (const item of assignedValue) {
  12832. if (!value.has(item)) return false;
  12833. }
  12834. return true;
  12835. }
  12836. return false;
  12837. }
  12838. function setSelected(el, value) {
  12839. const isMultiple = el.multiple;
  12840. const isArrayValue = isArray(value);
  12841. if (isMultiple && !isArrayValue && !isSet(value)) {
  12842. warn(
  12843. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  12844. );
  12845. return;
  12846. }
  12847. for (let i = 0, l = el.options.length; i < l; i++) {
  12848. const option = el.options[i];
  12849. const optionValue = getValue(option);
  12850. if (isMultiple) {
  12851. if (isArrayValue) {
  12852. const optionType = typeof optionValue;
  12853. if (optionType === "string" || optionType === "number") {
  12854. option.selected = value.some((v) => String(v) === String(optionValue));
  12855. } else {
  12856. option.selected = looseIndexOf(value, optionValue) > -1;
  12857. }
  12858. } else {
  12859. option.selected = value.has(optionValue);
  12860. }
  12861. } else if (looseEqual(getValue(option), value)) {
  12862. if (el.selectedIndex !== i) el.selectedIndex = i;
  12863. return;
  12864. }
  12865. }
  12866. if (!isMultiple && el.selectedIndex !== -1) {
  12867. el.selectedIndex = -1;
  12868. }
  12869. }
  12870. function getValue(el) {
  12871. return "_value" in el ? el._value : el.value;
  12872. }
  12873. function getCheckboxValue(el, checked) {
  12874. const key = checked ? "_trueValue" : "_falseValue";
  12875. return key in el ? el[key] : checked;
  12876. }
  12877. const vModelDynamic = {
  12878. created(el, binding, vnode) {
  12879. callModelHook(el, binding, vnode, null, "created");
  12880. },
  12881. mounted(el, binding, vnode) {
  12882. callModelHook(el, binding, vnode, null, "mounted");
  12883. },
  12884. beforeUpdate(el, binding, vnode, prevVNode) {
  12885. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  12886. },
  12887. updated(el, binding, vnode, prevVNode) {
  12888. callModelHook(el, binding, vnode, prevVNode, "updated");
  12889. }
  12890. };
  12891. function resolveDynamicModel(tagName, type) {
  12892. switch (tagName) {
  12893. case "SELECT":
  12894. return vModelSelect;
  12895. case "TEXTAREA":
  12896. return vModelText;
  12897. default:
  12898. switch (type) {
  12899. case "checkbox":
  12900. return vModelCheckbox;
  12901. case "radio":
  12902. return vModelRadio;
  12903. default:
  12904. return vModelText;
  12905. }
  12906. }
  12907. }
  12908. function callModelHook(el, binding, vnode, prevVNode, hook) {
  12909. const modelToUse = resolveDynamicModel(
  12910. el.tagName,
  12911. vnode.props && vnode.props.type
  12912. );
  12913. const fn = modelToUse[hook];
  12914. fn && fn(el, binding, vnode, prevVNode);
  12915. }
  12916. function initVModelForSSR() {
  12917. vModelText.getSSRProps = ({ value }) => ({ value });
  12918. vModelRadio.getSSRProps = ({ value }, vnode) => {
  12919. if (vnode.props && looseEqual(vnode.props.value, value)) {
  12920. return { checked: true };
  12921. }
  12922. };
  12923. vModelCheckbox.getSSRProps = ({ value }, vnode) => {
  12924. if (isArray(value)) {
  12925. if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
  12926. return { checked: true };
  12927. }
  12928. } else if (isSet(value)) {
  12929. if (vnode.props && value.has(vnode.props.value)) {
  12930. return { checked: true };
  12931. }
  12932. } else if (value) {
  12933. return { checked: true };
  12934. }
  12935. };
  12936. vModelDynamic.getSSRProps = (binding, vnode) => {
  12937. if (typeof vnode.type !== "string") {
  12938. return;
  12939. }
  12940. const modelToUse = resolveDynamicModel(
  12941. // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
  12942. vnode.type.toUpperCase(),
  12943. vnode.props && vnode.props.type
  12944. );
  12945. if (modelToUse.getSSRProps) {
  12946. return modelToUse.getSSRProps(binding, vnode);
  12947. }
  12948. };
  12949. }
  12950. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  12951. const modifierGuards = {
  12952. stop: (e) => e.stopPropagation(),
  12953. prevent: (e) => e.preventDefault(),
  12954. self: (e) => e.target !== e.currentTarget,
  12955. ctrl: (e) => !e.ctrlKey,
  12956. shift: (e) => !e.shiftKey,
  12957. alt: (e) => !e.altKey,
  12958. meta: (e) => !e.metaKey,
  12959. left: (e) => "button" in e && e.button !== 0,
  12960. middle: (e) => "button" in e && e.button !== 1,
  12961. right: (e) => "button" in e && e.button !== 2,
  12962. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  12963. };
  12964. const withModifiers = (fn, modifiers) => {
  12965. if (!fn) return fn;
  12966. const cache = fn._withMods || (fn._withMods = {});
  12967. const cacheKey = modifiers.join(".");
  12968. return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
  12969. for (let i = 0; i < modifiers.length; i++) {
  12970. const guard = modifierGuards[modifiers[i]];
  12971. if (guard && guard(event, modifiers)) return;
  12972. }
  12973. return fn(event, ...args);
  12974. }));
  12975. };
  12976. const keyNames = {
  12977. esc: "escape",
  12978. space: " ",
  12979. up: "arrow-up",
  12980. left: "arrow-left",
  12981. right: "arrow-right",
  12982. down: "arrow-down",
  12983. delete: "backspace"
  12984. };
  12985. const withKeys = (fn, modifiers) => {
  12986. const cache = fn._withKeys || (fn._withKeys = {});
  12987. const cacheKey = modifiers.join(".");
  12988. return cache[cacheKey] || (cache[cacheKey] = ((event) => {
  12989. if (!("key" in event)) {
  12990. return;
  12991. }
  12992. const eventKey = hyphenate(event.key);
  12993. if (modifiers.some(
  12994. (k) => k === eventKey || keyNames[k] === eventKey
  12995. )) {
  12996. return fn(event);
  12997. }
  12998. }));
  12999. };
  13000. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  13001. let renderer;
  13002. let enabledHydration = false;
  13003. function ensureRenderer() {
  13004. return renderer || (renderer = createRenderer(rendererOptions));
  13005. }
  13006. function ensureHydrationRenderer() {
  13007. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  13008. enabledHydration = true;
  13009. return renderer;
  13010. }
  13011. const render = ((...args) => {
  13012. ensureRenderer().render(...args);
  13013. });
  13014. const hydrate = ((...args) => {
  13015. ensureHydrationRenderer().hydrate(...args);
  13016. });
  13017. const createApp = ((...args) => {
  13018. const app = ensureRenderer().createApp(...args);
  13019. {
  13020. injectNativeTagCheck(app);
  13021. injectCompilerOptionsCheck(app);
  13022. }
  13023. const { mount } = app;
  13024. app.mount = (containerOrSelector) => {
  13025. const container = normalizeContainer(containerOrSelector);
  13026. if (!container) return;
  13027. const component = app._component;
  13028. if (!isFunction(component) && !component.render && !component.template) {
  13029. component.template = container.innerHTML;
  13030. }
  13031. if (container.nodeType === 1) {
  13032. container.textContent = "";
  13033. }
  13034. const proxy = mount(container, false, resolveRootNamespace(container));
  13035. if (container instanceof Element) {
  13036. container.removeAttribute("v-cloak");
  13037. container.setAttribute("data-v-app", "");
  13038. }
  13039. return proxy;
  13040. };
  13041. return app;
  13042. });
  13043. const createSSRApp = ((...args) => {
  13044. const app = ensureHydrationRenderer().createApp(...args);
  13045. {
  13046. injectNativeTagCheck(app);
  13047. injectCompilerOptionsCheck(app);
  13048. }
  13049. const { mount } = app;
  13050. app.mount = (containerOrSelector) => {
  13051. const container = normalizeContainer(containerOrSelector);
  13052. if (container) {
  13053. return mount(container, true, resolveRootNamespace(container));
  13054. }
  13055. };
  13056. return app;
  13057. });
  13058. function resolveRootNamespace(container) {
  13059. if (container instanceof SVGElement) {
  13060. return "svg";
  13061. }
  13062. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  13063. return "mathml";
  13064. }
  13065. }
  13066. function injectNativeTagCheck(app) {
  13067. Object.defineProperty(app.config, "isNativeTag", {
  13068. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  13069. writable: false
  13070. });
  13071. }
  13072. function injectCompilerOptionsCheck(app) {
  13073. if (isRuntimeOnly()) {
  13074. const isCustomElement = app.config.isCustomElement;
  13075. Object.defineProperty(app.config, "isCustomElement", {
  13076. get() {
  13077. return isCustomElement;
  13078. },
  13079. set() {
  13080. warn(
  13081. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  13082. );
  13083. }
  13084. });
  13085. const compilerOptions = app.config.compilerOptions;
  13086. 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.
  13087. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  13088. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  13089. - 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`;
  13090. Object.defineProperty(app.config, "compilerOptions", {
  13091. get() {
  13092. warn(msg);
  13093. return compilerOptions;
  13094. },
  13095. set() {
  13096. warn(msg);
  13097. }
  13098. });
  13099. }
  13100. }
  13101. function normalizeContainer(container) {
  13102. if (isString(container)) {
  13103. const res = document.querySelector(container);
  13104. if (!res) {
  13105. warn(
  13106. `Failed to mount app: mount target selector "${container}" returned null.`
  13107. );
  13108. }
  13109. return res;
  13110. }
  13111. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  13112. warn(
  13113. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  13114. );
  13115. }
  13116. return container;
  13117. }
  13118. let ssrDirectiveInitialized = false;
  13119. const initDirectivesForSSR = () => {
  13120. if (!ssrDirectiveInitialized) {
  13121. ssrDirectiveInitialized = true;
  13122. initVModelForSSR();
  13123. initVShowForSSR();
  13124. }
  13125. } ;
  13126. var runtimeDom = /*#__PURE__*/Object.freeze({
  13127. __proto__: null,
  13128. BaseTransition: BaseTransition,
  13129. BaseTransitionPropsValidators: BaseTransitionPropsValidators,
  13130. Comment: Comment,
  13131. DeprecationTypes: DeprecationTypes,
  13132. EffectScope: EffectScope,
  13133. ErrorCodes: ErrorCodes,
  13134. ErrorTypeStrings: ErrorTypeStrings,
  13135. Fragment: Fragment,
  13136. KeepAlive: KeepAlive,
  13137. ReactiveEffect: ReactiveEffect,
  13138. Static: Static,
  13139. Suspense: Suspense,
  13140. Teleport: Teleport,
  13141. Text: Text,
  13142. TrackOpTypes: TrackOpTypes,
  13143. Transition: Transition,
  13144. TransitionGroup: TransitionGroup,
  13145. TriggerOpTypes: TriggerOpTypes,
  13146. VueElement: VueElement,
  13147. assertNumber: assertNumber,
  13148. callWithAsyncErrorHandling: callWithAsyncErrorHandling,
  13149. callWithErrorHandling: callWithErrorHandling,
  13150. camelize: camelize,
  13151. capitalize: capitalize,
  13152. cloneVNode: cloneVNode,
  13153. compatUtils: compatUtils,
  13154. computed: computed,
  13155. createApp: createApp,
  13156. createBlock: createBlock,
  13157. createCommentVNode: createCommentVNode,
  13158. createElementBlock: createElementBlock,
  13159. createElementVNode: createBaseVNode,
  13160. createHydrationRenderer: createHydrationRenderer,
  13161. createPropsRestProxy: createPropsRestProxy,
  13162. createRenderer: createRenderer,
  13163. createSSRApp: createSSRApp,
  13164. createSlots: createSlots,
  13165. createStaticVNode: createStaticVNode,
  13166. createTextVNode: createTextVNode,
  13167. createVNode: createVNode,
  13168. customRef: customRef,
  13169. defineAsyncComponent: defineAsyncComponent,
  13170. defineComponent: defineComponent,
  13171. defineCustomElement: defineCustomElement,
  13172. defineEmits: defineEmits,
  13173. defineExpose: defineExpose,
  13174. defineModel: defineModel,
  13175. defineOptions: defineOptions,
  13176. defineProps: defineProps,
  13177. defineSSRCustomElement: defineSSRCustomElement,
  13178. defineSlots: defineSlots,
  13179. devtools: devtools,
  13180. effect: effect,
  13181. effectScope: effectScope,
  13182. getCurrentInstance: getCurrentInstance,
  13183. getCurrentScope: getCurrentScope,
  13184. getCurrentWatcher: getCurrentWatcher,
  13185. getTransitionRawChildren: getTransitionRawChildren,
  13186. guardReactiveProps: guardReactiveProps,
  13187. h: h,
  13188. handleError: handleError,
  13189. hasInjectionContext: hasInjectionContext,
  13190. hydrate: hydrate,
  13191. hydrateOnIdle: hydrateOnIdle,
  13192. hydrateOnInteraction: hydrateOnInteraction,
  13193. hydrateOnMediaQuery: hydrateOnMediaQuery,
  13194. hydrateOnVisible: hydrateOnVisible,
  13195. initCustomFormatter: initCustomFormatter,
  13196. initDirectivesForSSR: initDirectivesForSSR,
  13197. inject: inject,
  13198. isMemoSame: isMemoSame,
  13199. isProxy: isProxy,
  13200. isReactive: isReactive,
  13201. isReadonly: isReadonly,
  13202. isRef: isRef,
  13203. isRuntimeOnly: isRuntimeOnly,
  13204. isShallow: isShallow,
  13205. isVNode: isVNode,
  13206. markRaw: markRaw,
  13207. mergeDefaults: mergeDefaults,
  13208. mergeModels: mergeModels,
  13209. mergeProps: mergeProps,
  13210. nextTick: nextTick,
  13211. nodeOps: nodeOps,
  13212. normalizeClass: normalizeClass,
  13213. normalizeProps: normalizeProps,
  13214. normalizeStyle: normalizeStyle,
  13215. onActivated: onActivated,
  13216. onBeforeMount: onBeforeMount,
  13217. onBeforeUnmount: onBeforeUnmount,
  13218. onBeforeUpdate: onBeforeUpdate,
  13219. onDeactivated: onDeactivated,
  13220. onErrorCaptured: onErrorCaptured,
  13221. onMounted: onMounted,
  13222. onRenderTracked: onRenderTracked,
  13223. onRenderTriggered: onRenderTriggered,
  13224. onScopeDispose: onScopeDispose,
  13225. onServerPrefetch: onServerPrefetch,
  13226. onUnmounted: onUnmounted,
  13227. onUpdated: onUpdated,
  13228. onWatcherCleanup: onWatcherCleanup,
  13229. openBlock: openBlock,
  13230. patchProp: patchProp,
  13231. popScopeId: popScopeId,
  13232. provide: provide,
  13233. proxyRefs: proxyRefs,
  13234. pushScopeId: pushScopeId,
  13235. queuePostFlushCb: queuePostFlushCb,
  13236. reactive: reactive,
  13237. readonly: readonly,
  13238. ref: ref,
  13239. registerRuntimeCompiler: registerRuntimeCompiler,
  13240. render: render,
  13241. renderList: renderList,
  13242. renderSlot: renderSlot,
  13243. resolveComponent: resolveComponent,
  13244. resolveDirective: resolveDirective,
  13245. resolveDynamicComponent: resolveDynamicComponent,
  13246. resolveFilter: resolveFilter,
  13247. resolveTransitionHooks: resolveTransitionHooks,
  13248. setBlockTracking: setBlockTracking,
  13249. setDevtoolsHook: setDevtoolsHook,
  13250. setTransitionHooks: setTransitionHooks,
  13251. shallowReactive: shallowReactive,
  13252. shallowReadonly: shallowReadonly,
  13253. shallowRef: shallowRef,
  13254. ssrContextKey: ssrContextKey,
  13255. ssrUtils: ssrUtils,
  13256. stop: stop,
  13257. toDisplayString: toDisplayString,
  13258. toHandlerKey: toHandlerKey,
  13259. toHandlers: toHandlers,
  13260. toRaw: toRaw,
  13261. toRef: toRef,
  13262. toRefs: toRefs,
  13263. toValue: toValue,
  13264. transformVNodeArgs: transformVNodeArgs,
  13265. triggerRef: triggerRef,
  13266. unref: unref,
  13267. useAttrs: useAttrs,
  13268. useCssModule: useCssModule,
  13269. useCssVars: useCssVars,
  13270. useHost: useHost,
  13271. useId: useId,
  13272. useModel: useModel,
  13273. useSSRContext: useSSRContext,
  13274. useShadowRoot: useShadowRoot,
  13275. useSlots: useSlots,
  13276. useTemplateRef: useTemplateRef,
  13277. useTransitionState: useTransitionState,
  13278. vModelCheckbox: vModelCheckbox,
  13279. vModelDynamic: vModelDynamic,
  13280. vModelRadio: vModelRadio,
  13281. vModelSelect: vModelSelect,
  13282. vModelText: vModelText,
  13283. vShow: vShow,
  13284. version: version,
  13285. warn: warn,
  13286. watch: watch,
  13287. watchEffect: watchEffect,
  13288. watchPostEffect: watchPostEffect,
  13289. watchSyncEffect: watchSyncEffect,
  13290. withAsyncContext: withAsyncContext,
  13291. withCtx: withCtx,
  13292. withDefaults: withDefaults,
  13293. withDirectives: withDirectives,
  13294. withKeys: withKeys,
  13295. withMemo: withMemo,
  13296. withModifiers: withModifiers,
  13297. withScopeId: withScopeId
  13298. });
  13299. function initDev() {
  13300. {
  13301. {
  13302. console.info(
  13303. `You are running a development build of Vue.
  13304. Make sure to use the production build (*.prod.js) when deploying for production.`
  13305. );
  13306. }
  13307. initCustomFormatter();
  13308. }
  13309. }
  13310. const FRAGMENT = /* @__PURE__ */ Symbol(`Fragment` );
  13311. const TELEPORT = /* @__PURE__ */ Symbol(`Teleport` );
  13312. const SUSPENSE = /* @__PURE__ */ Symbol(`Suspense` );
  13313. const KEEP_ALIVE = /* @__PURE__ */ Symbol(`KeepAlive` );
  13314. const BASE_TRANSITION = /* @__PURE__ */ Symbol(
  13315. `BaseTransition`
  13316. );
  13317. const OPEN_BLOCK = /* @__PURE__ */ Symbol(`openBlock` );
  13318. const CREATE_BLOCK = /* @__PURE__ */ Symbol(`createBlock` );
  13319. const CREATE_ELEMENT_BLOCK = /* @__PURE__ */ Symbol(
  13320. `createElementBlock`
  13321. );
  13322. const CREATE_VNODE = /* @__PURE__ */ Symbol(`createVNode` );
  13323. const CREATE_ELEMENT_VNODE = /* @__PURE__ */ Symbol(
  13324. `createElementVNode`
  13325. );
  13326. const CREATE_COMMENT = /* @__PURE__ */ Symbol(
  13327. `createCommentVNode`
  13328. );
  13329. const CREATE_TEXT = /* @__PURE__ */ Symbol(
  13330. `createTextVNode`
  13331. );
  13332. const CREATE_STATIC = /* @__PURE__ */ Symbol(
  13333. `createStaticVNode`
  13334. );
  13335. const RESOLVE_COMPONENT = /* @__PURE__ */ Symbol(
  13336. `resolveComponent`
  13337. );
  13338. const RESOLVE_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol(
  13339. `resolveDynamicComponent`
  13340. );
  13341. const RESOLVE_DIRECTIVE = /* @__PURE__ */ Symbol(
  13342. `resolveDirective`
  13343. );
  13344. const RESOLVE_FILTER = /* @__PURE__ */ Symbol(
  13345. `resolveFilter`
  13346. );
  13347. const WITH_DIRECTIVES = /* @__PURE__ */ Symbol(
  13348. `withDirectives`
  13349. );
  13350. const RENDER_LIST = /* @__PURE__ */ Symbol(`renderList` );
  13351. const RENDER_SLOT = /* @__PURE__ */ Symbol(`renderSlot` );
  13352. const CREATE_SLOTS = /* @__PURE__ */ Symbol(`createSlots` );
  13353. const TO_DISPLAY_STRING = /* @__PURE__ */ Symbol(
  13354. `toDisplayString`
  13355. );
  13356. const MERGE_PROPS = /* @__PURE__ */ Symbol(`mergeProps` );
  13357. const NORMALIZE_CLASS = /* @__PURE__ */ Symbol(
  13358. `normalizeClass`
  13359. );
  13360. const NORMALIZE_STYLE = /* @__PURE__ */ Symbol(
  13361. `normalizeStyle`
  13362. );
  13363. const NORMALIZE_PROPS = /* @__PURE__ */ Symbol(
  13364. `normalizeProps`
  13365. );
  13366. const GUARD_REACTIVE_PROPS = /* @__PURE__ */ Symbol(
  13367. `guardReactiveProps`
  13368. );
  13369. const TO_HANDLERS = /* @__PURE__ */ Symbol(`toHandlers` );
  13370. const CAMELIZE = /* @__PURE__ */ Symbol(`camelize` );
  13371. const CAPITALIZE = /* @__PURE__ */ Symbol(`capitalize` );
  13372. const TO_HANDLER_KEY = /* @__PURE__ */ Symbol(
  13373. `toHandlerKey`
  13374. );
  13375. const SET_BLOCK_TRACKING = /* @__PURE__ */ Symbol(
  13376. `setBlockTracking`
  13377. );
  13378. const PUSH_SCOPE_ID = /* @__PURE__ */ Symbol(`pushScopeId` );
  13379. const POP_SCOPE_ID = /* @__PURE__ */ Symbol(`popScopeId` );
  13380. const WITH_CTX = /* @__PURE__ */ Symbol(`withCtx` );
  13381. const UNREF = /* @__PURE__ */ Symbol(`unref` );
  13382. const IS_REF = /* @__PURE__ */ Symbol(`isRef` );
  13383. const WITH_MEMO = /* @__PURE__ */ Symbol(`withMemo` );
  13384. const IS_MEMO_SAME = /* @__PURE__ */ Symbol(`isMemoSame` );
  13385. const helperNameMap = {
  13386. [FRAGMENT]: `Fragment`,
  13387. [TELEPORT]: `Teleport`,
  13388. [SUSPENSE]: `Suspense`,
  13389. [KEEP_ALIVE]: `KeepAlive`,
  13390. [BASE_TRANSITION]: `BaseTransition`,
  13391. [OPEN_BLOCK]: `openBlock`,
  13392. [CREATE_BLOCK]: `createBlock`,
  13393. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  13394. [CREATE_VNODE]: `createVNode`,
  13395. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  13396. [CREATE_COMMENT]: `createCommentVNode`,
  13397. [CREATE_TEXT]: `createTextVNode`,
  13398. [CREATE_STATIC]: `createStaticVNode`,
  13399. [RESOLVE_COMPONENT]: `resolveComponent`,
  13400. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  13401. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  13402. [RESOLVE_FILTER]: `resolveFilter`,
  13403. [WITH_DIRECTIVES]: `withDirectives`,
  13404. [RENDER_LIST]: `renderList`,
  13405. [RENDER_SLOT]: `renderSlot`,
  13406. [CREATE_SLOTS]: `createSlots`,
  13407. [TO_DISPLAY_STRING]: `toDisplayString`,
  13408. [MERGE_PROPS]: `mergeProps`,
  13409. [NORMALIZE_CLASS]: `normalizeClass`,
  13410. [NORMALIZE_STYLE]: `normalizeStyle`,
  13411. [NORMALIZE_PROPS]: `normalizeProps`,
  13412. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  13413. [TO_HANDLERS]: `toHandlers`,
  13414. [CAMELIZE]: `camelize`,
  13415. [CAPITALIZE]: `capitalize`,
  13416. [TO_HANDLER_KEY]: `toHandlerKey`,
  13417. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  13418. [PUSH_SCOPE_ID]: `pushScopeId`,
  13419. [POP_SCOPE_ID]: `popScopeId`,
  13420. [WITH_CTX]: `withCtx`,
  13421. [UNREF]: `unref`,
  13422. [IS_REF]: `isRef`,
  13423. [WITH_MEMO]: `withMemo`,
  13424. [IS_MEMO_SAME]: `isMemoSame`
  13425. };
  13426. function registerRuntimeHelpers(helpers) {
  13427. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  13428. helperNameMap[s] = helpers[s];
  13429. });
  13430. }
  13431. const locStub = {
  13432. start: { line: 1, column: 1, offset: 0 },
  13433. end: { line: 1, column: 1, offset: 0 },
  13434. source: ""
  13435. };
  13436. function createRoot(children, source = "") {
  13437. return {
  13438. type: 0,
  13439. source,
  13440. children,
  13441. helpers: /* @__PURE__ */ new Set(),
  13442. components: [],
  13443. directives: [],
  13444. hoists: [],
  13445. imports: [],
  13446. cached: [],
  13447. temps: 0,
  13448. codegenNode: void 0,
  13449. loc: locStub
  13450. };
  13451. }
  13452. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  13453. if (context) {
  13454. if (isBlock) {
  13455. context.helper(OPEN_BLOCK);
  13456. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  13457. } else {
  13458. context.helper(getVNodeHelper(context.inSSR, isComponent));
  13459. }
  13460. if (directives) {
  13461. context.helper(WITH_DIRECTIVES);
  13462. }
  13463. }
  13464. return {
  13465. type: 13,
  13466. tag,
  13467. props,
  13468. children,
  13469. patchFlag,
  13470. dynamicProps,
  13471. directives,
  13472. isBlock,
  13473. disableTracking,
  13474. isComponent,
  13475. loc
  13476. };
  13477. }
  13478. function createArrayExpression(elements, loc = locStub) {
  13479. return {
  13480. type: 17,
  13481. loc,
  13482. elements
  13483. };
  13484. }
  13485. function createObjectExpression(properties, loc = locStub) {
  13486. return {
  13487. type: 15,
  13488. loc,
  13489. properties
  13490. };
  13491. }
  13492. function createObjectProperty(key, value) {
  13493. return {
  13494. type: 16,
  13495. loc: locStub,
  13496. key: isString(key) ? createSimpleExpression(key, true) : key,
  13497. value
  13498. };
  13499. }
  13500. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  13501. return {
  13502. type: 4,
  13503. loc,
  13504. content,
  13505. isStatic,
  13506. constType: isStatic ? 3 : constType
  13507. };
  13508. }
  13509. function createCompoundExpression(children, loc = locStub) {
  13510. return {
  13511. type: 8,
  13512. loc,
  13513. children
  13514. };
  13515. }
  13516. function createCallExpression(callee, args = [], loc = locStub) {
  13517. return {
  13518. type: 14,
  13519. loc,
  13520. callee,
  13521. arguments: args
  13522. };
  13523. }
  13524. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  13525. return {
  13526. type: 18,
  13527. params,
  13528. returns,
  13529. newline,
  13530. isSlot,
  13531. loc
  13532. };
  13533. }
  13534. function createConditionalExpression(test, consequent, alternate, newline = true) {
  13535. return {
  13536. type: 19,
  13537. test,
  13538. consequent,
  13539. alternate,
  13540. newline,
  13541. loc: locStub
  13542. };
  13543. }
  13544. function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
  13545. return {
  13546. type: 20,
  13547. index,
  13548. value,
  13549. needPauseTracking,
  13550. inVOnce,
  13551. needArraySpread: false,
  13552. loc: locStub
  13553. };
  13554. }
  13555. function createBlockStatement(body) {
  13556. return {
  13557. type: 21,
  13558. body,
  13559. loc: locStub
  13560. };
  13561. }
  13562. function getVNodeHelper(ssr, isComponent) {
  13563. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  13564. }
  13565. function getVNodeBlockHelper(ssr, isComponent) {
  13566. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  13567. }
  13568. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  13569. if (!node.isBlock) {
  13570. node.isBlock = true;
  13571. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  13572. helper(OPEN_BLOCK);
  13573. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  13574. }
  13575. }
  13576. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  13577. const defaultDelimitersClose = new Uint8Array([125, 125]);
  13578. function isTagStartChar(c) {
  13579. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  13580. }
  13581. function isWhitespace(c) {
  13582. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  13583. }
  13584. function isEndOfTagSection(c) {
  13585. return c === 47 || c === 62 || isWhitespace(c);
  13586. }
  13587. function toCharCodes(str) {
  13588. const ret = new Uint8Array(str.length);
  13589. for (let i = 0; i < str.length; i++) {
  13590. ret[i] = str.charCodeAt(i);
  13591. }
  13592. return ret;
  13593. }
  13594. const Sequences = {
  13595. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  13596. // CDATA[
  13597. CdataEnd: new Uint8Array([93, 93, 62]),
  13598. // ]]>
  13599. CommentEnd: new Uint8Array([45, 45, 62]),
  13600. // `-->`
  13601. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  13602. // `<\/script`
  13603. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  13604. // `</style`
  13605. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  13606. // `</title`
  13607. TextareaEnd: new Uint8Array([
  13608. 60,
  13609. 47,
  13610. 116,
  13611. 101,
  13612. 120,
  13613. 116,
  13614. 97,
  13615. 114,
  13616. 101,
  13617. 97
  13618. ])
  13619. // `</textarea
  13620. };
  13621. class Tokenizer {
  13622. constructor(stack, cbs) {
  13623. this.stack = stack;
  13624. this.cbs = cbs;
  13625. /** The current state the tokenizer is in. */
  13626. this.state = 1;
  13627. /** The read buffer. */
  13628. this.buffer = "";
  13629. /** The beginning of the section that is currently being read. */
  13630. this.sectionStart = 0;
  13631. /** The index within the buffer that we are currently looking at. */
  13632. this.index = 0;
  13633. /** The start of the last entity. */
  13634. this.entityStart = 0;
  13635. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  13636. this.baseState = 1;
  13637. /** For special parsing behavior inside of script and style tags. */
  13638. this.inRCDATA = false;
  13639. /** For disabling RCDATA tags handling */
  13640. this.inXML = false;
  13641. /** For disabling interpolation parsing in v-pre */
  13642. this.inVPre = false;
  13643. /** Record newline positions for fast line / column calculation */
  13644. this.newlines = [];
  13645. this.mode = 0;
  13646. this.delimiterOpen = defaultDelimitersOpen;
  13647. this.delimiterClose = defaultDelimitersClose;
  13648. this.delimiterIndex = -1;
  13649. this.currentSequence = void 0;
  13650. this.sequenceIndex = 0;
  13651. }
  13652. get inSFCRoot() {
  13653. return this.mode === 2 && this.stack.length === 0;
  13654. }
  13655. reset() {
  13656. this.state = 1;
  13657. this.mode = 0;
  13658. this.buffer = "";
  13659. this.sectionStart = 0;
  13660. this.index = 0;
  13661. this.baseState = 1;
  13662. this.inRCDATA = false;
  13663. this.currentSequence = void 0;
  13664. this.newlines.length = 0;
  13665. this.delimiterOpen = defaultDelimitersOpen;
  13666. this.delimiterClose = defaultDelimitersClose;
  13667. }
  13668. /**
  13669. * Generate Position object with line / column information using recorded
  13670. * newline positions. We know the index is always going to be an already
  13671. * processed index, so all the newlines up to this index should have been
  13672. * recorded.
  13673. */
  13674. getPos(index) {
  13675. let line = 1;
  13676. let column = index + 1;
  13677. const length = this.newlines.length;
  13678. let j = -1;
  13679. if (length > 100) {
  13680. let l = -1;
  13681. let r = length;
  13682. while (l + 1 < r) {
  13683. const m = l + r >>> 1;
  13684. this.newlines[m] < index ? l = m : r = m;
  13685. }
  13686. j = l;
  13687. } else {
  13688. for (let i = length - 1; i >= 0; i--) {
  13689. if (index > this.newlines[i]) {
  13690. j = i;
  13691. break;
  13692. }
  13693. }
  13694. }
  13695. if (j >= 0) {
  13696. line = j + 2;
  13697. column = index - this.newlines[j];
  13698. }
  13699. return {
  13700. column,
  13701. line,
  13702. offset: index
  13703. };
  13704. }
  13705. peek() {
  13706. return this.buffer.charCodeAt(this.index + 1);
  13707. }
  13708. stateText(c) {
  13709. if (c === 60) {
  13710. if (this.index > this.sectionStart) {
  13711. this.cbs.ontext(this.sectionStart, this.index);
  13712. }
  13713. this.state = 5;
  13714. this.sectionStart = this.index;
  13715. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  13716. this.state = 2;
  13717. this.delimiterIndex = 0;
  13718. this.stateInterpolationOpen(c);
  13719. }
  13720. }
  13721. stateInterpolationOpen(c) {
  13722. if (c === this.delimiterOpen[this.delimiterIndex]) {
  13723. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  13724. const start = this.index + 1 - this.delimiterOpen.length;
  13725. if (start > this.sectionStart) {
  13726. this.cbs.ontext(this.sectionStart, start);
  13727. }
  13728. this.state = 3;
  13729. this.sectionStart = start;
  13730. } else {
  13731. this.delimiterIndex++;
  13732. }
  13733. } else if (this.inRCDATA) {
  13734. this.state = 32;
  13735. this.stateInRCDATA(c);
  13736. } else {
  13737. this.state = 1;
  13738. this.stateText(c);
  13739. }
  13740. }
  13741. stateInterpolation(c) {
  13742. if (c === this.delimiterClose[0]) {
  13743. this.state = 4;
  13744. this.delimiterIndex = 0;
  13745. this.stateInterpolationClose(c);
  13746. }
  13747. }
  13748. stateInterpolationClose(c) {
  13749. if (c === this.delimiterClose[this.delimiterIndex]) {
  13750. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  13751. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  13752. if (this.inRCDATA) {
  13753. this.state = 32;
  13754. } else {
  13755. this.state = 1;
  13756. }
  13757. this.sectionStart = this.index + 1;
  13758. } else {
  13759. this.delimiterIndex++;
  13760. }
  13761. } else {
  13762. this.state = 3;
  13763. this.stateInterpolation(c);
  13764. }
  13765. }
  13766. stateSpecialStartSequence(c) {
  13767. const isEnd = this.sequenceIndex === this.currentSequence.length;
  13768. const isMatch = isEnd ? (
  13769. // If we are at the end of the sequence, make sure the tag name has ended
  13770. isEndOfTagSection(c)
  13771. ) : (
  13772. // Otherwise, do a case-insensitive comparison
  13773. (c | 32) === this.currentSequence[this.sequenceIndex]
  13774. );
  13775. if (!isMatch) {
  13776. this.inRCDATA = false;
  13777. } else if (!isEnd) {
  13778. this.sequenceIndex++;
  13779. return;
  13780. }
  13781. this.sequenceIndex = 0;
  13782. this.state = 6;
  13783. this.stateInTagName(c);
  13784. }
  13785. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  13786. stateInRCDATA(c) {
  13787. if (this.sequenceIndex === this.currentSequence.length) {
  13788. if (c === 62 || isWhitespace(c)) {
  13789. const endOfText = this.index - this.currentSequence.length;
  13790. if (this.sectionStart < endOfText) {
  13791. const actualIndex = this.index;
  13792. this.index = endOfText;
  13793. this.cbs.ontext(this.sectionStart, endOfText);
  13794. this.index = actualIndex;
  13795. }
  13796. this.sectionStart = endOfText + 2;
  13797. this.stateInClosingTagName(c);
  13798. this.inRCDATA = false;
  13799. return;
  13800. }
  13801. this.sequenceIndex = 0;
  13802. }
  13803. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  13804. this.sequenceIndex += 1;
  13805. } else if (this.sequenceIndex === 0) {
  13806. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  13807. if (!this.inVPre && c === this.delimiterOpen[0]) {
  13808. this.state = 2;
  13809. this.delimiterIndex = 0;
  13810. this.stateInterpolationOpen(c);
  13811. }
  13812. } else if (this.fastForwardTo(60)) {
  13813. this.sequenceIndex = 1;
  13814. }
  13815. } else {
  13816. this.sequenceIndex = Number(c === 60);
  13817. }
  13818. }
  13819. stateCDATASequence(c) {
  13820. if (c === Sequences.Cdata[this.sequenceIndex]) {
  13821. if (++this.sequenceIndex === Sequences.Cdata.length) {
  13822. this.state = 28;
  13823. this.currentSequence = Sequences.CdataEnd;
  13824. this.sequenceIndex = 0;
  13825. this.sectionStart = this.index + 1;
  13826. }
  13827. } else {
  13828. this.sequenceIndex = 0;
  13829. this.state = 23;
  13830. this.stateInDeclaration(c);
  13831. }
  13832. }
  13833. /**
  13834. * When we wait for one specific character, we can speed things up
  13835. * by skipping through the buffer until we find it.
  13836. *
  13837. * @returns Whether the character was found.
  13838. */
  13839. fastForwardTo(c) {
  13840. while (++this.index < this.buffer.length) {
  13841. const cc = this.buffer.charCodeAt(this.index);
  13842. if (cc === 10) {
  13843. this.newlines.push(this.index);
  13844. }
  13845. if (cc === c) {
  13846. return true;
  13847. }
  13848. }
  13849. this.index = this.buffer.length - 1;
  13850. return false;
  13851. }
  13852. /**
  13853. * Comments and CDATA end with `-->` and `]]>`.
  13854. *
  13855. * Their common qualities are:
  13856. * - Their end sequences have a distinct character they start with.
  13857. * - That character is then repeated, so we have to check multiple repeats.
  13858. * - All characters but the start character of the sequence can be skipped.
  13859. */
  13860. stateInCommentLike(c) {
  13861. if (c === this.currentSequence[this.sequenceIndex]) {
  13862. if (++this.sequenceIndex === this.currentSequence.length) {
  13863. if (this.currentSequence === Sequences.CdataEnd) {
  13864. this.cbs.oncdata(this.sectionStart, this.index - 2);
  13865. } else {
  13866. this.cbs.oncomment(this.sectionStart, this.index - 2);
  13867. }
  13868. this.sequenceIndex = 0;
  13869. this.sectionStart = this.index + 1;
  13870. this.state = 1;
  13871. }
  13872. } else if (this.sequenceIndex === 0) {
  13873. if (this.fastForwardTo(this.currentSequence[0])) {
  13874. this.sequenceIndex = 1;
  13875. }
  13876. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  13877. this.sequenceIndex = 0;
  13878. }
  13879. }
  13880. startSpecial(sequence, offset) {
  13881. this.enterRCDATA(sequence, offset);
  13882. this.state = 31;
  13883. }
  13884. enterRCDATA(sequence, offset) {
  13885. this.inRCDATA = true;
  13886. this.currentSequence = sequence;
  13887. this.sequenceIndex = offset;
  13888. }
  13889. stateBeforeTagName(c) {
  13890. if (c === 33) {
  13891. this.state = 22;
  13892. this.sectionStart = this.index + 1;
  13893. } else if (c === 63) {
  13894. this.state = 24;
  13895. this.sectionStart = this.index + 1;
  13896. } else if (isTagStartChar(c)) {
  13897. this.sectionStart = this.index;
  13898. if (this.mode === 0) {
  13899. this.state = 6;
  13900. } else if (this.inSFCRoot) {
  13901. this.state = 34;
  13902. } else if (!this.inXML) {
  13903. if (c === 116) {
  13904. this.state = 30;
  13905. } else {
  13906. this.state = c === 115 ? 29 : 6;
  13907. }
  13908. } else {
  13909. this.state = 6;
  13910. }
  13911. } else if (c === 47) {
  13912. this.state = 8;
  13913. } else {
  13914. this.state = 1;
  13915. this.stateText(c);
  13916. }
  13917. }
  13918. stateInTagName(c) {
  13919. if (isEndOfTagSection(c)) {
  13920. this.handleTagName(c);
  13921. }
  13922. }
  13923. stateInSFCRootTagName(c) {
  13924. if (isEndOfTagSection(c)) {
  13925. const tag = this.buffer.slice(this.sectionStart, this.index);
  13926. if (tag !== "template") {
  13927. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  13928. }
  13929. this.handleTagName(c);
  13930. }
  13931. }
  13932. handleTagName(c) {
  13933. this.cbs.onopentagname(this.sectionStart, this.index);
  13934. this.sectionStart = -1;
  13935. this.state = 11;
  13936. this.stateBeforeAttrName(c);
  13937. }
  13938. stateBeforeClosingTagName(c) {
  13939. if (isWhitespace(c)) ; else if (c === 62) {
  13940. {
  13941. this.cbs.onerr(14, this.index);
  13942. }
  13943. this.state = 1;
  13944. this.sectionStart = this.index + 1;
  13945. } else {
  13946. this.state = isTagStartChar(c) ? 9 : 27;
  13947. this.sectionStart = this.index;
  13948. }
  13949. }
  13950. stateInClosingTagName(c) {
  13951. if (c === 62 || isWhitespace(c)) {
  13952. this.cbs.onclosetag(this.sectionStart, this.index);
  13953. this.sectionStart = -1;
  13954. this.state = 10;
  13955. this.stateAfterClosingTagName(c);
  13956. }
  13957. }
  13958. stateAfterClosingTagName(c) {
  13959. if (c === 62) {
  13960. this.state = 1;
  13961. this.sectionStart = this.index + 1;
  13962. }
  13963. }
  13964. stateBeforeAttrName(c) {
  13965. if (c === 62) {
  13966. this.cbs.onopentagend(this.index);
  13967. if (this.inRCDATA) {
  13968. this.state = 32;
  13969. } else {
  13970. this.state = 1;
  13971. }
  13972. this.sectionStart = this.index + 1;
  13973. } else if (c === 47) {
  13974. this.state = 7;
  13975. if (this.peek() !== 62) {
  13976. this.cbs.onerr(22, this.index);
  13977. }
  13978. } else if (c === 60 && this.peek() === 47) {
  13979. this.cbs.onopentagend(this.index);
  13980. this.state = 5;
  13981. this.sectionStart = this.index;
  13982. } else if (!isWhitespace(c)) {
  13983. if (c === 61) {
  13984. this.cbs.onerr(
  13985. 19,
  13986. this.index
  13987. );
  13988. }
  13989. this.handleAttrStart(c);
  13990. }
  13991. }
  13992. handleAttrStart(c) {
  13993. if (c === 118 && this.peek() === 45) {
  13994. this.state = 13;
  13995. this.sectionStart = this.index;
  13996. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  13997. this.cbs.ondirname(this.index, this.index + 1);
  13998. this.state = 14;
  13999. this.sectionStart = this.index + 1;
  14000. } else {
  14001. this.state = 12;
  14002. this.sectionStart = this.index;
  14003. }
  14004. }
  14005. stateInSelfClosingTag(c) {
  14006. if (c === 62) {
  14007. this.cbs.onselfclosingtag(this.index);
  14008. this.state = 1;
  14009. this.sectionStart = this.index + 1;
  14010. this.inRCDATA = false;
  14011. } else if (!isWhitespace(c)) {
  14012. this.state = 11;
  14013. this.stateBeforeAttrName(c);
  14014. }
  14015. }
  14016. stateInAttrName(c) {
  14017. if (c === 61 || isEndOfTagSection(c)) {
  14018. this.cbs.onattribname(this.sectionStart, this.index);
  14019. this.handleAttrNameEnd(c);
  14020. } else if (c === 34 || c === 39 || c === 60) {
  14021. this.cbs.onerr(
  14022. 17,
  14023. this.index
  14024. );
  14025. }
  14026. }
  14027. stateInDirName(c) {
  14028. if (c === 61 || isEndOfTagSection(c)) {
  14029. this.cbs.ondirname(this.sectionStart, this.index);
  14030. this.handleAttrNameEnd(c);
  14031. } else if (c === 58) {
  14032. this.cbs.ondirname(this.sectionStart, this.index);
  14033. this.state = 14;
  14034. this.sectionStart = this.index + 1;
  14035. } else if (c === 46) {
  14036. this.cbs.ondirname(this.sectionStart, this.index);
  14037. this.state = 16;
  14038. this.sectionStart = this.index + 1;
  14039. }
  14040. }
  14041. stateInDirArg(c) {
  14042. if (c === 61 || isEndOfTagSection(c)) {
  14043. this.cbs.ondirarg(this.sectionStart, this.index);
  14044. this.handleAttrNameEnd(c);
  14045. } else if (c === 91) {
  14046. this.state = 15;
  14047. } else if (c === 46) {
  14048. this.cbs.ondirarg(this.sectionStart, this.index);
  14049. this.state = 16;
  14050. this.sectionStart = this.index + 1;
  14051. }
  14052. }
  14053. stateInDynamicDirArg(c) {
  14054. if (c === 93) {
  14055. this.state = 14;
  14056. } else if (c === 61 || isEndOfTagSection(c)) {
  14057. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  14058. this.handleAttrNameEnd(c);
  14059. {
  14060. this.cbs.onerr(
  14061. 27,
  14062. this.index
  14063. );
  14064. }
  14065. }
  14066. }
  14067. stateInDirModifier(c) {
  14068. if (c === 61 || isEndOfTagSection(c)) {
  14069. this.cbs.ondirmodifier(this.sectionStart, this.index);
  14070. this.handleAttrNameEnd(c);
  14071. } else if (c === 46) {
  14072. this.cbs.ondirmodifier(this.sectionStart, this.index);
  14073. this.sectionStart = this.index + 1;
  14074. }
  14075. }
  14076. handleAttrNameEnd(c) {
  14077. this.sectionStart = this.index;
  14078. this.state = 17;
  14079. this.cbs.onattribnameend(this.index);
  14080. this.stateAfterAttrName(c);
  14081. }
  14082. stateAfterAttrName(c) {
  14083. if (c === 61) {
  14084. this.state = 18;
  14085. } else if (c === 47 || c === 62) {
  14086. this.cbs.onattribend(0, this.sectionStart);
  14087. this.sectionStart = -1;
  14088. this.state = 11;
  14089. this.stateBeforeAttrName(c);
  14090. } else if (!isWhitespace(c)) {
  14091. this.cbs.onattribend(0, this.sectionStart);
  14092. this.handleAttrStart(c);
  14093. }
  14094. }
  14095. stateBeforeAttrValue(c) {
  14096. if (c === 34) {
  14097. this.state = 19;
  14098. this.sectionStart = this.index + 1;
  14099. } else if (c === 39) {
  14100. this.state = 20;
  14101. this.sectionStart = this.index + 1;
  14102. } else if (!isWhitespace(c)) {
  14103. this.sectionStart = this.index;
  14104. this.state = 21;
  14105. this.stateInAttrValueNoQuotes(c);
  14106. }
  14107. }
  14108. handleInAttrValue(c, quote) {
  14109. if (c === quote || this.fastForwardTo(quote)) {
  14110. this.cbs.onattribdata(this.sectionStart, this.index);
  14111. this.sectionStart = -1;
  14112. this.cbs.onattribend(
  14113. quote === 34 ? 3 : 2,
  14114. this.index + 1
  14115. );
  14116. this.state = 11;
  14117. }
  14118. }
  14119. stateInAttrValueDoubleQuotes(c) {
  14120. this.handleInAttrValue(c, 34);
  14121. }
  14122. stateInAttrValueSingleQuotes(c) {
  14123. this.handleInAttrValue(c, 39);
  14124. }
  14125. stateInAttrValueNoQuotes(c) {
  14126. if (isWhitespace(c) || c === 62) {
  14127. this.cbs.onattribdata(this.sectionStart, this.index);
  14128. this.sectionStart = -1;
  14129. this.cbs.onattribend(1, this.index);
  14130. this.state = 11;
  14131. this.stateBeforeAttrName(c);
  14132. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  14133. this.cbs.onerr(
  14134. 18,
  14135. this.index
  14136. );
  14137. } else ;
  14138. }
  14139. stateBeforeDeclaration(c) {
  14140. if (c === 91) {
  14141. this.state = 26;
  14142. this.sequenceIndex = 0;
  14143. } else {
  14144. this.state = c === 45 ? 25 : 23;
  14145. }
  14146. }
  14147. stateInDeclaration(c) {
  14148. if (c === 62 || this.fastForwardTo(62)) {
  14149. this.state = 1;
  14150. this.sectionStart = this.index + 1;
  14151. }
  14152. }
  14153. stateInProcessingInstruction(c) {
  14154. if (c === 62 || this.fastForwardTo(62)) {
  14155. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  14156. this.state = 1;
  14157. this.sectionStart = this.index + 1;
  14158. }
  14159. }
  14160. stateBeforeComment(c) {
  14161. if (c === 45) {
  14162. this.state = 28;
  14163. this.currentSequence = Sequences.CommentEnd;
  14164. this.sequenceIndex = 2;
  14165. this.sectionStart = this.index + 1;
  14166. } else {
  14167. this.state = 23;
  14168. }
  14169. }
  14170. stateInSpecialComment(c) {
  14171. if (c === 62 || this.fastForwardTo(62)) {
  14172. this.cbs.oncomment(this.sectionStart, this.index);
  14173. this.state = 1;
  14174. this.sectionStart = this.index + 1;
  14175. }
  14176. }
  14177. stateBeforeSpecialS(c) {
  14178. if (c === Sequences.ScriptEnd[3]) {
  14179. this.startSpecial(Sequences.ScriptEnd, 4);
  14180. } else if (c === Sequences.StyleEnd[3]) {
  14181. this.startSpecial(Sequences.StyleEnd, 4);
  14182. } else {
  14183. this.state = 6;
  14184. this.stateInTagName(c);
  14185. }
  14186. }
  14187. stateBeforeSpecialT(c) {
  14188. if (c === Sequences.TitleEnd[3]) {
  14189. this.startSpecial(Sequences.TitleEnd, 4);
  14190. } else if (c === Sequences.TextareaEnd[3]) {
  14191. this.startSpecial(Sequences.TextareaEnd, 4);
  14192. } else {
  14193. this.state = 6;
  14194. this.stateInTagName(c);
  14195. }
  14196. }
  14197. startEntity() {
  14198. }
  14199. stateInEntity() {
  14200. }
  14201. /**
  14202. * Iterates through the buffer, calling the function corresponding to the current state.
  14203. *
  14204. * States that are more likely to be hit are higher up, as a performance improvement.
  14205. */
  14206. parse(input) {
  14207. this.buffer = input;
  14208. while (this.index < this.buffer.length) {
  14209. const c = this.buffer.charCodeAt(this.index);
  14210. if (c === 10 && this.state !== 33) {
  14211. this.newlines.push(this.index);
  14212. }
  14213. switch (this.state) {
  14214. case 1: {
  14215. this.stateText(c);
  14216. break;
  14217. }
  14218. case 2: {
  14219. this.stateInterpolationOpen(c);
  14220. break;
  14221. }
  14222. case 3: {
  14223. this.stateInterpolation(c);
  14224. break;
  14225. }
  14226. case 4: {
  14227. this.stateInterpolationClose(c);
  14228. break;
  14229. }
  14230. case 31: {
  14231. this.stateSpecialStartSequence(c);
  14232. break;
  14233. }
  14234. case 32: {
  14235. this.stateInRCDATA(c);
  14236. break;
  14237. }
  14238. case 26: {
  14239. this.stateCDATASequence(c);
  14240. break;
  14241. }
  14242. case 19: {
  14243. this.stateInAttrValueDoubleQuotes(c);
  14244. break;
  14245. }
  14246. case 12: {
  14247. this.stateInAttrName(c);
  14248. break;
  14249. }
  14250. case 13: {
  14251. this.stateInDirName(c);
  14252. break;
  14253. }
  14254. case 14: {
  14255. this.stateInDirArg(c);
  14256. break;
  14257. }
  14258. case 15: {
  14259. this.stateInDynamicDirArg(c);
  14260. break;
  14261. }
  14262. case 16: {
  14263. this.stateInDirModifier(c);
  14264. break;
  14265. }
  14266. case 28: {
  14267. this.stateInCommentLike(c);
  14268. break;
  14269. }
  14270. case 27: {
  14271. this.stateInSpecialComment(c);
  14272. break;
  14273. }
  14274. case 11: {
  14275. this.stateBeforeAttrName(c);
  14276. break;
  14277. }
  14278. case 6: {
  14279. this.stateInTagName(c);
  14280. break;
  14281. }
  14282. case 34: {
  14283. this.stateInSFCRootTagName(c);
  14284. break;
  14285. }
  14286. case 9: {
  14287. this.stateInClosingTagName(c);
  14288. break;
  14289. }
  14290. case 5: {
  14291. this.stateBeforeTagName(c);
  14292. break;
  14293. }
  14294. case 17: {
  14295. this.stateAfterAttrName(c);
  14296. break;
  14297. }
  14298. case 20: {
  14299. this.stateInAttrValueSingleQuotes(c);
  14300. break;
  14301. }
  14302. case 18: {
  14303. this.stateBeforeAttrValue(c);
  14304. break;
  14305. }
  14306. case 8: {
  14307. this.stateBeforeClosingTagName(c);
  14308. break;
  14309. }
  14310. case 10: {
  14311. this.stateAfterClosingTagName(c);
  14312. break;
  14313. }
  14314. case 29: {
  14315. this.stateBeforeSpecialS(c);
  14316. break;
  14317. }
  14318. case 30: {
  14319. this.stateBeforeSpecialT(c);
  14320. break;
  14321. }
  14322. case 21: {
  14323. this.stateInAttrValueNoQuotes(c);
  14324. break;
  14325. }
  14326. case 7: {
  14327. this.stateInSelfClosingTag(c);
  14328. break;
  14329. }
  14330. case 23: {
  14331. this.stateInDeclaration(c);
  14332. break;
  14333. }
  14334. case 22: {
  14335. this.stateBeforeDeclaration(c);
  14336. break;
  14337. }
  14338. case 25: {
  14339. this.stateBeforeComment(c);
  14340. break;
  14341. }
  14342. case 24: {
  14343. this.stateInProcessingInstruction(c);
  14344. break;
  14345. }
  14346. case 33: {
  14347. this.stateInEntity();
  14348. break;
  14349. }
  14350. }
  14351. this.index++;
  14352. }
  14353. this.cleanup();
  14354. this.finish();
  14355. }
  14356. /**
  14357. * Remove data that has already been consumed from the buffer.
  14358. */
  14359. cleanup() {
  14360. if (this.sectionStart !== this.index) {
  14361. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  14362. this.cbs.ontext(this.sectionStart, this.index);
  14363. this.sectionStart = this.index;
  14364. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  14365. this.cbs.onattribdata(this.sectionStart, this.index);
  14366. this.sectionStart = this.index;
  14367. }
  14368. }
  14369. }
  14370. finish() {
  14371. this.handleTrailingData();
  14372. this.cbs.onend();
  14373. }
  14374. /** Handle any trailing data. */
  14375. handleTrailingData() {
  14376. const endIndex = this.buffer.length;
  14377. if (this.sectionStart >= endIndex) {
  14378. return;
  14379. }
  14380. if (this.state === 28) {
  14381. if (this.currentSequence === Sequences.CdataEnd) {
  14382. this.cbs.oncdata(this.sectionStart, endIndex);
  14383. } else {
  14384. this.cbs.oncomment(this.sectionStart, endIndex);
  14385. }
  14386. } 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 {
  14387. this.cbs.ontext(this.sectionStart, endIndex);
  14388. }
  14389. }
  14390. emitCodePoint(cp, consumed) {
  14391. }
  14392. }
  14393. function defaultOnError(error) {
  14394. throw error;
  14395. }
  14396. function defaultOnWarn(msg) {
  14397. console.warn(`[Vue warn] ${msg.message}`);
  14398. }
  14399. function createCompilerError(code, loc, messages, additionalMessage) {
  14400. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  14401. const error = new SyntaxError(String(msg));
  14402. error.code = code;
  14403. error.loc = loc;
  14404. return error;
  14405. }
  14406. const errorMessages = {
  14407. // parse errors
  14408. [0]: "Illegal comment.",
  14409. [1]: "CDATA section is allowed only in XML context.",
  14410. [2]: "Duplicate attribute.",
  14411. [3]: "End tag cannot have attributes.",
  14412. [4]: "Illegal '/' in tags.",
  14413. [5]: "Unexpected EOF in tag.",
  14414. [6]: "Unexpected EOF in CDATA section.",
  14415. [7]: "Unexpected EOF in comment.",
  14416. [8]: "Unexpected EOF in script.",
  14417. [9]: "Unexpected EOF in tag.",
  14418. [10]: "Incorrectly closed comment.",
  14419. [11]: "Incorrectly opened comment.",
  14420. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  14421. [13]: "Attribute value was expected.",
  14422. [14]: "End tag name was expected.",
  14423. [15]: "Whitespace was expected.",
  14424. [16]: "Unexpected '<!--' in comment.",
  14425. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  14426. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  14427. [19]: "Attribute name cannot start with '='.",
  14428. [21]: "'<?' is allowed only in XML context.",
  14429. [20]: `Unexpected null character.`,
  14430. [22]: "Illegal '/' in tags.",
  14431. // Vue-specific parse errors
  14432. [23]: "Invalid end tag.",
  14433. [24]: "Element is missing end tag.",
  14434. [25]: "Interpolation end sign was not found.",
  14435. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  14436. [26]: "Legal directive name was expected.",
  14437. // transform errors
  14438. [28]: `v-if/v-else-if is missing expression.`,
  14439. [29]: `v-if/else branches must use unique keys.`,
  14440. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  14441. [31]: `v-for is missing expression.`,
  14442. [32]: `v-for has invalid expression.`,
  14443. [33]: `<template v-for> key should be placed on the <template> tag.`,
  14444. [34]: `v-bind is missing expression.`,
  14445. [53]: `v-bind with same-name shorthand only allows static argument.`,
  14446. [35]: `v-on is missing expression.`,
  14447. [36]: `Unexpected custom directive on <slot> outlet.`,
  14448. [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.`,
  14449. [38]: `Duplicate slot names found. `,
  14450. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  14451. [40]: `v-slot can only be used on components or <template> tags.`,
  14452. [41]: `v-model is missing expression.`,
  14453. [42]: `v-model value must be a valid JavaScript member expression.`,
  14454. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  14455. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  14456. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  14457. [45]: `v-model cannot be used on a const binding because it is not writable.`,
  14458. [46]: `Error parsing JavaScript expression: `,
  14459. [47]: `<KeepAlive> expects exactly one child component.`,
  14460. [52]: `@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.`,
  14461. // generic errors
  14462. [48]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  14463. [49]: `ES module mode is not supported in this build of compiler.`,
  14464. [50]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  14465. [51]: `"scopeId" option is only supported in module mode.`,
  14466. // just to fulfill types
  14467. [54]: ``
  14468. };
  14469. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  14470. function isCoreComponent(tag) {
  14471. switch (tag) {
  14472. case "Teleport":
  14473. case "teleport":
  14474. return TELEPORT;
  14475. case "Suspense":
  14476. case "suspense":
  14477. return SUSPENSE;
  14478. case "KeepAlive":
  14479. case "keep-alive":
  14480. return KEEP_ALIVE;
  14481. case "BaseTransition":
  14482. case "base-transition":
  14483. return BASE_TRANSITION;
  14484. }
  14485. }
  14486. const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
  14487. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  14488. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  14489. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  14490. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  14491. const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
  14492. const isMemberExpressionBrowser = (exp) => {
  14493. const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
  14494. let state = 0 /* inMemberExp */;
  14495. let stateStack = [];
  14496. let currentOpenBracketCount = 0;
  14497. let currentOpenParensCount = 0;
  14498. let currentStringType = null;
  14499. for (let i = 0; i < path.length; i++) {
  14500. const char = path.charAt(i);
  14501. switch (state) {
  14502. case 0 /* inMemberExp */:
  14503. if (char === "[") {
  14504. stateStack.push(state);
  14505. state = 1 /* inBrackets */;
  14506. currentOpenBracketCount++;
  14507. } else if (char === "(") {
  14508. stateStack.push(state);
  14509. state = 2 /* inParens */;
  14510. currentOpenParensCount++;
  14511. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  14512. return false;
  14513. }
  14514. break;
  14515. case 1 /* inBrackets */:
  14516. if (char === `'` || char === `"` || char === "`") {
  14517. stateStack.push(state);
  14518. state = 3 /* inString */;
  14519. currentStringType = char;
  14520. } else if (char === `[`) {
  14521. currentOpenBracketCount++;
  14522. } else if (char === `]`) {
  14523. if (!--currentOpenBracketCount) {
  14524. state = stateStack.pop();
  14525. }
  14526. }
  14527. break;
  14528. case 2 /* inParens */:
  14529. if (char === `'` || char === `"` || char === "`") {
  14530. stateStack.push(state);
  14531. state = 3 /* inString */;
  14532. currentStringType = char;
  14533. } else if (char === `(`) {
  14534. currentOpenParensCount++;
  14535. } else if (char === `)`) {
  14536. if (i === path.length - 1) {
  14537. return false;
  14538. }
  14539. if (!--currentOpenParensCount) {
  14540. state = stateStack.pop();
  14541. }
  14542. }
  14543. break;
  14544. case 3 /* inString */:
  14545. if (char === currentStringType) {
  14546. state = stateStack.pop();
  14547. currentStringType = null;
  14548. }
  14549. break;
  14550. }
  14551. }
  14552. return !currentOpenBracketCount && !currentOpenParensCount;
  14553. };
  14554. const isMemberExpression = isMemberExpressionBrowser ;
  14555. const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  14556. const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
  14557. const isFnExpression = isFnExpressionBrowser ;
  14558. function assert(condition, msg) {
  14559. if (!condition) {
  14560. throw new Error(msg || `unexpected compiler condition`);
  14561. }
  14562. }
  14563. function findDir(node, name, allowEmpty = false) {
  14564. for (let i = 0; i < node.props.length; i++) {
  14565. const p = node.props[i];
  14566. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  14567. return p;
  14568. }
  14569. }
  14570. }
  14571. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  14572. for (let i = 0; i < node.props.length; i++) {
  14573. const p = node.props[i];
  14574. if (p.type === 6) {
  14575. if (dynamicOnly) continue;
  14576. if (p.name === name && (p.value || allowEmpty)) {
  14577. return p;
  14578. }
  14579. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  14580. return p;
  14581. }
  14582. }
  14583. }
  14584. function isStaticArgOf(arg, name) {
  14585. return !!(arg && isStaticExp(arg) && arg.content === name);
  14586. }
  14587. function hasDynamicKeyVBind(node) {
  14588. return node.props.some(
  14589. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  14590. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  14591. !p.arg.isStatic)
  14592. // v-bind:[foo]
  14593. );
  14594. }
  14595. function isText$1(node) {
  14596. return node.type === 5 || node.type === 2;
  14597. }
  14598. function isVPre(p) {
  14599. return p.type === 7 && p.name === "pre";
  14600. }
  14601. function isVSlot(p) {
  14602. return p.type === 7 && p.name === "slot";
  14603. }
  14604. function isTemplateNode(node) {
  14605. return node.type === 1 && node.tagType === 3;
  14606. }
  14607. function isSlotOutlet(node) {
  14608. return node.type === 1 && node.tagType === 2;
  14609. }
  14610. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  14611. function getUnnormalizedProps(props, callPath = []) {
  14612. if (props && !isString(props) && props.type === 14) {
  14613. const callee = props.callee;
  14614. if (!isString(callee) && propsHelperSet.has(callee)) {
  14615. return getUnnormalizedProps(
  14616. props.arguments[0],
  14617. callPath.concat(props)
  14618. );
  14619. }
  14620. }
  14621. return [props, callPath];
  14622. }
  14623. function injectProp(node, prop, context) {
  14624. if (node.type !== 13 && injectSlotKey(node, prop)) {
  14625. return;
  14626. }
  14627. let propsWithInjection;
  14628. let props = node.type === 13 ? node.props : node.arguments[2];
  14629. let callPath = [];
  14630. let parentCall;
  14631. if (props && !isString(props) && props.type === 14) {
  14632. const ret = getUnnormalizedProps(props);
  14633. props = ret[0];
  14634. callPath = ret[1];
  14635. parentCall = callPath[callPath.length - 1];
  14636. }
  14637. if (props == null || isString(props)) {
  14638. propsWithInjection = createObjectExpression([prop]);
  14639. } else if (props.type === 14) {
  14640. const first = props.arguments[0];
  14641. if (!isString(first) && first.type === 15) {
  14642. if (!hasProp(prop, first)) {
  14643. first.properties.unshift(prop);
  14644. }
  14645. } else {
  14646. if (props.callee === TO_HANDLERS) {
  14647. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  14648. createObjectExpression([prop]),
  14649. props
  14650. ]);
  14651. } else {
  14652. props.arguments.unshift(createObjectExpression([prop]));
  14653. }
  14654. }
  14655. !propsWithInjection && (propsWithInjection = props);
  14656. } else if (props.type === 15) {
  14657. if (!hasProp(prop, props)) {
  14658. props.properties.unshift(prop);
  14659. }
  14660. propsWithInjection = props;
  14661. } else {
  14662. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  14663. createObjectExpression([prop]),
  14664. props
  14665. ]);
  14666. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  14667. parentCall = callPath[callPath.length - 2];
  14668. }
  14669. }
  14670. if (node.type === 13) {
  14671. if (parentCall) {
  14672. parentCall.arguments[0] = propsWithInjection;
  14673. } else {
  14674. node.props = propsWithInjection;
  14675. }
  14676. } else {
  14677. if (parentCall) {
  14678. parentCall.arguments[0] = propsWithInjection;
  14679. } else {
  14680. node.arguments[2] = propsWithInjection;
  14681. }
  14682. }
  14683. }
  14684. function injectSlotKey(node, prop) {
  14685. var _a, _b, _c;
  14686. if (prop.key.type !== 4 || prop.key.content !== "key") {
  14687. return false;
  14688. }
  14689. const props = node.arguments[2];
  14690. if (props && !isString(props)) {
  14691. const [unnormalizedProps] = getUnnormalizedProps(props);
  14692. if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) {
  14693. return true;
  14694. }
  14695. }
  14696. (_a = node.arguments)[2] || (_a[2] = "{}");
  14697. (_b = node.arguments)[3] || (_b[3] = "undefined");
  14698. (_c = node.arguments)[4] || (_c[4] = "undefined");
  14699. node.arguments[5] = prop.value;
  14700. return true;
  14701. }
  14702. function hasProp(prop, props) {
  14703. let result = false;
  14704. if (prop.key.type === 4) {
  14705. const propKeyName = prop.key.content;
  14706. result = props.properties.some(
  14707. (p) => p.key.type === 4 && p.key.content === propKeyName
  14708. );
  14709. }
  14710. return result;
  14711. }
  14712. function toValidAssetId(name, type) {
  14713. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  14714. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  14715. })}`;
  14716. }
  14717. function getMemoedVNodeCall(node) {
  14718. if (node.type === 14 && node.callee === WITH_MEMO) {
  14719. return node.arguments[1].returns;
  14720. } else {
  14721. return node;
  14722. }
  14723. }
  14724. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
  14725. function isAllWhitespace(str) {
  14726. for (let i = 0; i < str.length; i++) {
  14727. if (!isWhitespace(str.charCodeAt(i))) {
  14728. return false;
  14729. }
  14730. }
  14731. return true;
  14732. }
  14733. function isWhitespaceText(node) {
  14734. return node.type === 2 && isAllWhitespace(node.content) || node.type === 12 && isWhitespaceText(node.content);
  14735. }
  14736. function isCommentOrWhitespace(node) {
  14737. return node.type === 3 || isWhitespaceText(node);
  14738. }
  14739. const defaultParserOptions = {
  14740. parseMode: "base",
  14741. ns: 0,
  14742. delimiters: [`{{`, `}}`],
  14743. getNamespace: () => 0,
  14744. isVoidTag: NO,
  14745. isPreTag: NO,
  14746. isIgnoreNewlineTag: NO,
  14747. isCustomElement: NO,
  14748. onError: defaultOnError,
  14749. onWarn: defaultOnWarn,
  14750. comments: true,
  14751. prefixIdentifiers: false
  14752. };
  14753. let currentOptions = defaultParserOptions;
  14754. let currentRoot = null;
  14755. let currentInput = "";
  14756. let currentOpenTag = null;
  14757. let currentProp = null;
  14758. let currentAttrValue = "";
  14759. let currentAttrStartIndex = -1;
  14760. let currentAttrEndIndex = -1;
  14761. let inPre = 0;
  14762. let inVPre = false;
  14763. let currentVPreBoundary = null;
  14764. const stack = [];
  14765. const tokenizer = new Tokenizer(stack, {
  14766. onerr: emitError,
  14767. ontext(start, end) {
  14768. onText(getSlice(start, end), start, end);
  14769. },
  14770. ontextentity(char, start, end) {
  14771. onText(char, start, end);
  14772. },
  14773. oninterpolation(start, end) {
  14774. if (inVPre) {
  14775. return onText(getSlice(start, end), start, end);
  14776. }
  14777. let innerStart = start + tokenizer.delimiterOpen.length;
  14778. let innerEnd = end - tokenizer.delimiterClose.length;
  14779. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  14780. innerStart++;
  14781. }
  14782. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  14783. innerEnd--;
  14784. }
  14785. let exp = getSlice(innerStart, innerEnd);
  14786. if (exp.includes("&")) {
  14787. {
  14788. exp = currentOptions.decodeEntities(exp, false);
  14789. }
  14790. }
  14791. addNode({
  14792. type: 5,
  14793. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  14794. loc: getLoc(start, end)
  14795. });
  14796. },
  14797. onopentagname(start, end) {
  14798. const name = getSlice(start, end);
  14799. currentOpenTag = {
  14800. type: 1,
  14801. tag: name,
  14802. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  14803. tagType: 0,
  14804. // will be refined on tag close
  14805. props: [],
  14806. children: [],
  14807. loc: getLoc(start - 1, end),
  14808. codegenNode: void 0
  14809. };
  14810. },
  14811. onopentagend(end) {
  14812. endOpenTag(end);
  14813. },
  14814. onclosetag(start, end) {
  14815. const name = getSlice(start, end);
  14816. if (!currentOptions.isVoidTag(name)) {
  14817. let found = false;
  14818. for (let i = 0; i < stack.length; i++) {
  14819. const e = stack[i];
  14820. if (e.tag.toLowerCase() === name.toLowerCase()) {
  14821. found = true;
  14822. if (i > 0) {
  14823. emitError(24, stack[0].loc.start.offset);
  14824. }
  14825. for (let j = 0; j <= i; j++) {
  14826. const el = stack.shift();
  14827. onCloseTag(el, end, j < i);
  14828. }
  14829. break;
  14830. }
  14831. }
  14832. if (!found) {
  14833. emitError(23, backTrack(start, 60));
  14834. }
  14835. }
  14836. },
  14837. onselfclosingtag(end) {
  14838. const name = currentOpenTag.tag;
  14839. currentOpenTag.isSelfClosing = true;
  14840. endOpenTag(end);
  14841. if (stack[0] && stack[0].tag === name) {
  14842. onCloseTag(stack.shift(), end);
  14843. }
  14844. },
  14845. onattribname(start, end) {
  14846. currentProp = {
  14847. type: 6,
  14848. name: getSlice(start, end),
  14849. nameLoc: getLoc(start, end),
  14850. value: void 0,
  14851. loc: getLoc(start)
  14852. };
  14853. },
  14854. ondirname(start, end) {
  14855. const raw = getSlice(start, end);
  14856. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  14857. if (!inVPre && name === "") {
  14858. emitError(26, start);
  14859. }
  14860. if (inVPre || name === "") {
  14861. currentProp = {
  14862. type: 6,
  14863. name: raw,
  14864. nameLoc: getLoc(start, end),
  14865. value: void 0,
  14866. loc: getLoc(start)
  14867. };
  14868. } else {
  14869. currentProp = {
  14870. type: 7,
  14871. name,
  14872. rawName: raw,
  14873. exp: void 0,
  14874. arg: void 0,
  14875. modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
  14876. loc: getLoc(start)
  14877. };
  14878. if (name === "pre") {
  14879. inVPre = tokenizer.inVPre = true;
  14880. currentVPreBoundary = currentOpenTag;
  14881. const props = currentOpenTag.props;
  14882. for (let i = 0; i < props.length; i++) {
  14883. if (props[i].type === 7) {
  14884. props[i] = dirToAttr(props[i]);
  14885. }
  14886. }
  14887. }
  14888. }
  14889. },
  14890. ondirarg(start, end) {
  14891. if (start === end) return;
  14892. const arg = getSlice(start, end);
  14893. if (inVPre && !isVPre(currentProp)) {
  14894. currentProp.name += arg;
  14895. setLocEnd(currentProp.nameLoc, end);
  14896. } else {
  14897. const isStatic = arg[0] !== `[`;
  14898. currentProp.arg = createExp(
  14899. isStatic ? arg : arg.slice(1, -1),
  14900. isStatic,
  14901. getLoc(start, end),
  14902. isStatic ? 3 : 0
  14903. );
  14904. }
  14905. },
  14906. ondirmodifier(start, end) {
  14907. const mod = getSlice(start, end);
  14908. if (inVPre && !isVPre(currentProp)) {
  14909. currentProp.name += "." + mod;
  14910. setLocEnd(currentProp.nameLoc, end);
  14911. } else if (currentProp.name === "slot") {
  14912. const arg = currentProp.arg;
  14913. if (arg) {
  14914. arg.content += "." + mod;
  14915. setLocEnd(arg.loc, end);
  14916. }
  14917. } else {
  14918. const exp = createSimpleExpression(mod, true, getLoc(start, end));
  14919. currentProp.modifiers.push(exp);
  14920. }
  14921. },
  14922. onattribdata(start, end) {
  14923. currentAttrValue += getSlice(start, end);
  14924. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  14925. currentAttrEndIndex = end;
  14926. },
  14927. onattribentity(char, start, end) {
  14928. currentAttrValue += char;
  14929. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  14930. currentAttrEndIndex = end;
  14931. },
  14932. onattribnameend(end) {
  14933. const start = currentProp.loc.start.offset;
  14934. const name = getSlice(start, end);
  14935. if (currentProp.type === 7) {
  14936. currentProp.rawName = name;
  14937. }
  14938. if (currentOpenTag.props.some(
  14939. (p) => (p.type === 7 ? p.rawName : p.name) === name
  14940. )) {
  14941. emitError(2, start);
  14942. }
  14943. },
  14944. onattribend(quote, end) {
  14945. if (currentOpenTag && currentProp) {
  14946. setLocEnd(currentProp.loc, end);
  14947. if (quote !== 0) {
  14948. if (currentAttrValue.includes("&")) {
  14949. currentAttrValue = currentOptions.decodeEntities(
  14950. currentAttrValue,
  14951. true
  14952. );
  14953. }
  14954. if (currentProp.type === 6) {
  14955. if (currentProp.name === "class") {
  14956. currentAttrValue = condense(currentAttrValue).trim();
  14957. }
  14958. if (quote === 1 && !currentAttrValue) {
  14959. emitError(13, end);
  14960. }
  14961. currentProp.value = {
  14962. type: 2,
  14963. content: currentAttrValue,
  14964. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  14965. };
  14966. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  14967. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  14968. }
  14969. } else {
  14970. let expParseMode = 0 /* Normal */;
  14971. currentProp.exp = createExp(
  14972. currentAttrValue,
  14973. false,
  14974. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  14975. 0,
  14976. expParseMode
  14977. );
  14978. if (currentProp.name === "for") {
  14979. currentProp.forParseResult = parseForExpression(currentProp.exp);
  14980. }
  14981. }
  14982. }
  14983. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  14984. currentOpenTag.props.push(currentProp);
  14985. }
  14986. }
  14987. currentAttrValue = "";
  14988. currentAttrStartIndex = currentAttrEndIndex = -1;
  14989. },
  14990. oncomment(start, end) {
  14991. if (currentOptions.comments) {
  14992. addNode({
  14993. type: 3,
  14994. content: getSlice(start, end),
  14995. loc: getLoc(start - 4, end + 3)
  14996. });
  14997. }
  14998. },
  14999. onend() {
  15000. const end = currentInput.length;
  15001. if (tokenizer.state !== 1) {
  15002. switch (tokenizer.state) {
  15003. case 5:
  15004. case 8:
  15005. emitError(5, end);
  15006. break;
  15007. case 3:
  15008. case 4:
  15009. emitError(
  15010. 25,
  15011. tokenizer.sectionStart
  15012. );
  15013. break;
  15014. case 28:
  15015. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  15016. emitError(6, end);
  15017. } else {
  15018. emitError(7, end);
  15019. }
  15020. break;
  15021. case 6:
  15022. case 7:
  15023. case 9:
  15024. case 11:
  15025. case 12:
  15026. case 13:
  15027. case 14:
  15028. case 15:
  15029. case 16:
  15030. case 17:
  15031. case 18:
  15032. case 19:
  15033. // "
  15034. case 20:
  15035. // '
  15036. case 21:
  15037. emitError(9, end);
  15038. break;
  15039. }
  15040. }
  15041. for (let index = 0; index < stack.length; index++) {
  15042. onCloseTag(stack[index], end - 1);
  15043. emitError(24, stack[index].loc.start.offset);
  15044. }
  15045. },
  15046. oncdata(start, end) {
  15047. if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) {
  15048. onText(getSlice(start, end), start, end);
  15049. } else {
  15050. emitError(1, start - 9);
  15051. }
  15052. },
  15053. onprocessinginstruction(start) {
  15054. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  15055. emitError(
  15056. 21,
  15057. start - 1
  15058. );
  15059. }
  15060. }
  15061. });
  15062. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  15063. const stripParensRE = /^\(|\)$/g;
  15064. function parseForExpression(input) {
  15065. const loc = input.loc;
  15066. const exp = input.content;
  15067. const inMatch = exp.match(forAliasRE);
  15068. if (!inMatch) return;
  15069. const [, LHS, RHS] = inMatch;
  15070. const createAliasExpression = (content, offset, asParam = false) => {
  15071. const start = loc.start.offset + offset;
  15072. const end = start + content.length;
  15073. return createExp(
  15074. content,
  15075. false,
  15076. getLoc(start, end),
  15077. 0,
  15078. asParam ? 1 /* Params */ : 0 /* Normal */
  15079. );
  15080. };
  15081. const result = {
  15082. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  15083. value: void 0,
  15084. key: void 0,
  15085. index: void 0,
  15086. finalized: false
  15087. };
  15088. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  15089. const trimmedOffset = LHS.indexOf(valueContent);
  15090. const iteratorMatch = valueContent.match(forIteratorRE);
  15091. if (iteratorMatch) {
  15092. valueContent = valueContent.replace(forIteratorRE, "").trim();
  15093. const keyContent = iteratorMatch[1].trim();
  15094. let keyOffset;
  15095. if (keyContent) {
  15096. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  15097. result.key = createAliasExpression(keyContent, keyOffset, true);
  15098. }
  15099. if (iteratorMatch[2]) {
  15100. const indexContent = iteratorMatch[2].trim();
  15101. if (indexContent) {
  15102. result.index = createAliasExpression(
  15103. indexContent,
  15104. exp.indexOf(
  15105. indexContent,
  15106. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  15107. ),
  15108. true
  15109. );
  15110. }
  15111. }
  15112. }
  15113. if (valueContent) {
  15114. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  15115. }
  15116. return result;
  15117. }
  15118. function getSlice(start, end) {
  15119. return currentInput.slice(start, end);
  15120. }
  15121. function endOpenTag(end) {
  15122. if (tokenizer.inSFCRoot) {
  15123. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  15124. }
  15125. addNode(currentOpenTag);
  15126. const { tag, ns } = currentOpenTag;
  15127. if (ns === 0 && currentOptions.isPreTag(tag)) {
  15128. inPre++;
  15129. }
  15130. if (currentOptions.isVoidTag(tag)) {
  15131. onCloseTag(currentOpenTag, end);
  15132. } else {
  15133. stack.unshift(currentOpenTag);
  15134. if (ns === 1 || ns === 2) {
  15135. tokenizer.inXML = true;
  15136. }
  15137. }
  15138. currentOpenTag = null;
  15139. }
  15140. function onText(content, start, end) {
  15141. {
  15142. const tag = stack[0] && stack[0].tag;
  15143. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  15144. content = currentOptions.decodeEntities(content, false);
  15145. }
  15146. }
  15147. const parent = stack[0] || currentRoot;
  15148. const lastNode = parent.children[parent.children.length - 1];
  15149. if (lastNode && lastNode.type === 2) {
  15150. lastNode.content += content;
  15151. setLocEnd(lastNode.loc, end);
  15152. } else {
  15153. parent.children.push({
  15154. type: 2,
  15155. content,
  15156. loc: getLoc(start, end)
  15157. });
  15158. }
  15159. }
  15160. function onCloseTag(el, end, isImplied = false) {
  15161. if (isImplied) {
  15162. setLocEnd(el.loc, backTrack(end, 60));
  15163. } else {
  15164. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  15165. }
  15166. if (tokenizer.inSFCRoot) {
  15167. if (el.children.length) {
  15168. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  15169. } else {
  15170. el.innerLoc.end = extend({}, el.innerLoc.start);
  15171. }
  15172. el.innerLoc.source = getSlice(
  15173. el.innerLoc.start.offset,
  15174. el.innerLoc.end.offset
  15175. );
  15176. }
  15177. const { tag, ns, children } = el;
  15178. if (!inVPre) {
  15179. if (tag === "slot") {
  15180. el.tagType = 2;
  15181. } else if (isFragmentTemplate(el)) {
  15182. el.tagType = 3;
  15183. } else if (isComponent(el)) {
  15184. el.tagType = 1;
  15185. }
  15186. }
  15187. if (!tokenizer.inRCDATA) {
  15188. el.children = condenseWhitespace(children);
  15189. }
  15190. if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
  15191. const first = children[0];
  15192. if (first && first.type === 2) {
  15193. first.content = first.content.replace(/^\r?\n/, "");
  15194. }
  15195. }
  15196. if (ns === 0 && currentOptions.isPreTag(tag)) {
  15197. inPre--;
  15198. }
  15199. if (currentVPreBoundary === el) {
  15200. inVPre = tokenizer.inVPre = false;
  15201. currentVPreBoundary = null;
  15202. }
  15203. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  15204. tokenizer.inXML = false;
  15205. }
  15206. }
  15207. function lookAhead(index, c) {
  15208. let i = index;
  15209. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
  15210. return i;
  15211. }
  15212. function backTrack(index, c) {
  15213. let i = index;
  15214. while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
  15215. return i;
  15216. }
  15217. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  15218. function isFragmentTemplate({ tag, props }) {
  15219. if (tag === "template") {
  15220. for (let i = 0; i < props.length; i++) {
  15221. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  15222. return true;
  15223. }
  15224. }
  15225. }
  15226. return false;
  15227. }
  15228. function isComponent({ tag, props }) {
  15229. if (currentOptions.isCustomElement(tag)) {
  15230. return false;
  15231. }
  15232. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  15233. return true;
  15234. }
  15235. for (let i = 0; i < props.length; i++) {
  15236. const p = props[i];
  15237. if (p.type === 6) {
  15238. if (p.name === "is" && p.value) {
  15239. if (p.value.content.startsWith("vue:")) {
  15240. return true;
  15241. }
  15242. }
  15243. }
  15244. }
  15245. return false;
  15246. }
  15247. function isUpperCase(c) {
  15248. return c > 64 && c < 91;
  15249. }
  15250. const windowsNewlineRE = /\r\n/g;
  15251. function condenseWhitespace(nodes) {
  15252. const shouldCondense = currentOptions.whitespace !== "preserve";
  15253. let removedWhitespace = false;
  15254. for (let i = 0; i < nodes.length; i++) {
  15255. const node = nodes[i];
  15256. if (node.type === 2) {
  15257. if (!inPre) {
  15258. if (isAllWhitespace(node.content)) {
  15259. const prev = nodes[i - 1] && nodes[i - 1].type;
  15260. const next = nodes[i + 1] && nodes[i + 1].type;
  15261. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  15262. removedWhitespace = true;
  15263. nodes[i] = null;
  15264. } else {
  15265. node.content = " ";
  15266. }
  15267. } else if (shouldCondense) {
  15268. node.content = condense(node.content);
  15269. }
  15270. } else {
  15271. node.content = node.content.replace(windowsNewlineRE, "\n");
  15272. }
  15273. }
  15274. }
  15275. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  15276. }
  15277. function hasNewlineChar(str) {
  15278. for (let i = 0; i < str.length; i++) {
  15279. const c = str.charCodeAt(i);
  15280. if (c === 10 || c === 13) {
  15281. return true;
  15282. }
  15283. }
  15284. return false;
  15285. }
  15286. function condense(str) {
  15287. let ret = "";
  15288. let prevCharIsWhitespace = false;
  15289. for (let i = 0; i < str.length; i++) {
  15290. if (isWhitespace(str.charCodeAt(i))) {
  15291. if (!prevCharIsWhitespace) {
  15292. ret += " ";
  15293. prevCharIsWhitespace = true;
  15294. }
  15295. } else {
  15296. ret += str[i];
  15297. prevCharIsWhitespace = false;
  15298. }
  15299. }
  15300. return ret;
  15301. }
  15302. function addNode(node) {
  15303. (stack[0] || currentRoot).children.push(node);
  15304. }
  15305. function getLoc(start, end) {
  15306. return {
  15307. start: tokenizer.getPos(start),
  15308. // @ts-expect-error allow late attachment
  15309. end: end == null ? end : tokenizer.getPos(end),
  15310. // @ts-expect-error allow late attachment
  15311. source: end == null ? end : getSlice(start, end)
  15312. };
  15313. }
  15314. function cloneLoc(loc) {
  15315. return getLoc(loc.start.offset, loc.end.offset);
  15316. }
  15317. function setLocEnd(loc, end) {
  15318. loc.end = tokenizer.getPos(end);
  15319. loc.source = getSlice(loc.start.offset, end);
  15320. }
  15321. function dirToAttr(dir) {
  15322. const attr = {
  15323. type: 6,
  15324. name: dir.rawName,
  15325. nameLoc: getLoc(
  15326. dir.loc.start.offset,
  15327. dir.loc.start.offset + dir.rawName.length
  15328. ),
  15329. value: void 0,
  15330. loc: dir.loc
  15331. };
  15332. if (dir.exp) {
  15333. const loc = dir.exp.loc;
  15334. if (loc.end.offset < dir.loc.end.offset) {
  15335. loc.start.offset--;
  15336. loc.start.column--;
  15337. loc.end.offset++;
  15338. loc.end.column++;
  15339. }
  15340. attr.value = {
  15341. type: 2,
  15342. content: dir.exp.content,
  15343. loc
  15344. };
  15345. }
  15346. return attr;
  15347. }
  15348. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  15349. const exp = createSimpleExpression(content, isStatic, loc, constType);
  15350. return exp;
  15351. }
  15352. function emitError(code, index, message) {
  15353. currentOptions.onError(
  15354. createCompilerError(code, getLoc(index, index), void 0, message)
  15355. );
  15356. }
  15357. function reset() {
  15358. tokenizer.reset();
  15359. currentOpenTag = null;
  15360. currentProp = null;
  15361. currentAttrValue = "";
  15362. currentAttrStartIndex = -1;
  15363. currentAttrEndIndex = -1;
  15364. stack.length = 0;
  15365. }
  15366. function baseParse(input, options) {
  15367. reset();
  15368. currentInput = input;
  15369. currentOptions = extend({}, defaultParserOptions);
  15370. if (options) {
  15371. let key;
  15372. for (key in options) {
  15373. if (options[key] != null) {
  15374. currentOptions[key] = options[key];
  15375. }
  15376. }
  15377. }
  15378. {
  15379. if (!currentOptions.decodeEntities) {
  15380. throw new Error(
  15381. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  15382. );
  15383. }
  15384. }
  15385. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  15386. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  15387. const delimiters = options && options.delimiters;
  15388. if (delimiters) {
  15389. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  15390. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  15391. }
  15392. const root = currentRoot = createRoot([], input);
  15393. tokenizer.parse(currentInput);
  15394. root.loc = getLoc(0, input.length);
  15395. root.children = condenseWhitespace(root.children);
  15396. currentRoot = null;
  15397. return root;
  15398. }
  15399. function cacheStatic(root, context) {
  15400. walk(
  15401. root,
  15402. void 0,
  15403. context,
  15404. // Root node is unfortunately non-hoistable due to potential parent
  15405. // fallthrough attributes.
  15406. !!getSingleElementRoot(root)
  15407. );
  15408. }
  15409. function getSingleElementRoot(root) {
  15410. const children = root.children.filter((x) => x.type !== 3);
  15411. return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
  15412. }
  15413. function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
  15414. const { children } = node;
  15415. const toCache = [];
  15416. for (let i = 0; i < children.length; i++) {
  15417. const child = children[i];
  15418. if (child.type === 1 && child.tagType === 0) {
  15419. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  15420. if (constantType > 0) {
  15421. if (constantType >= 2) {
  15422. child.codegenNode.patchFlag = -1;
  15423. toCache.push(child);
  15424. continue;
  15425. }
  15426. } else {
  15427. const codegenNode = child.codegenNode;
  15428. if (codegenNode.type === 13) {
  15429. const flag = codegenNode.patchFlag;
  15430. if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  15431. const props = getNodeProps(child);
  15432. if (props) {
  15433. codegenNode.props = context.hoist(props);
  15434. }
  15435. }
  15436. if (codegenNode.dynamicProps) {
  15437. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  15438. }
  15439. }
  15440. }
  15441. } else if (child.type === 12) {
  15442. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  15443. if (constantType >= 2) {
  15444. if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
  15445. child.codegenNode.arguments.push(
  15446. -1 + (` /* ${PatchFlagNames[-1]} */` )
  15447. );
  15448. }
  15449. toCache.push(child);
  15450. continue;
  15451. }
  15452. }
  15453. if (child.type === 1) {
  15454. const isComponent = child.tagType === 1;
  15455. if (isComponent) {
  15456. context.scopes.vSlot++;
  15457. }
  15458. walk(child, node, context, false, inFor);
  15459. if (isComponent) {
  15460. context.scopes.vSlot--;
  15461. }
  15462. } else if (child.type === 11) {
  15463. walk(child, node, context, child.children.length === 1, true);
  15464. } else if (child.type === 9) {
  15465. for (let i2 = 0; i2 < child.branches.length; i2++) {
  15466. walk(
  15467. child.branches[i2],
  15468. node,
  15469. context,
  15470. child.branches[i2].children.length === 1,
  15471. inFor
  15472. );
  15473. }
  15474. }
  15475. }
  15476. let cachedAsArray = false;
  15477. if (toCache.length === children.length && node.type === 1) {
  15478. if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  15479. node.codegenNode.children = getCacheExpression(
  15480. createArrayExpression(node.codegenNode.children)
  15481. );
  15482. cachedAsArray = true;
  15483. } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
  15484. const slot = getSlotNode(node.codegenNode, "default");
  15485. if (slot) {
  15486. slot.returns = getCacheExpression(
  15487. createArrayExpression(slot.returns)
  15488. );
  15489. cachedAsArray = true;
  15490. }
  15491. } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) {
  15492. const slotName = findDir(node, "slot", true);
  15493. const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
  15494. if (slot) {
  15495. slot.returns = getCacheExpression(
  15496. createArrayExpression(slot.returns)
  15497. );
  15498. cachedAsArray = true;
  15499. }
  15500. }
  15501. }
  15502. if (!cachedAsArray) {
  15503. for (const child of toCache) {
  15504. child.codegenNode = context.cache(child.codegenNode);
  15505. }
  15506. }
  15507. function getCacheExpression(value) {
  15508. const exp = context.cache(value);
  15509. exp.needArraySpread = true;
  15510. return exp;
  15511. }
  15512. function getSlotNode(node2, name) {
  15513. if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
  15514. const slot = node2.children.properties.find(
  15515. (p) => p.key === name || p.key.content === name
  15516. );
  15517. return slot && slot.value;
  15518. }
  15519. }
  15520. if (toCache.length && context.transformHoist) {
  15521. context.transformHoist(children, context, node);
  15522. }
  15523. }
  15524. function getConstantType(node, context) {
  15525. const { constantCache } = context;
  15526. switch (node.type) {
  15527. case 1:
  15528. if (node.tagType !== 0) {
  15529. return 0;
  15530. }
  15531. const cached = constantCache.get(node);
  15532. if (cached !== void 0) {
  15533. return cached;
  15534. }
  15535. const codegenNode = node.codegenNode;
  15536. if (codegenNode.type !== 13) {
  15537. return 0;
  15538. }
  15539. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
  15540. return 0;
  15541. }
  15542. if (codegenNode.patchFlag === void 0) {
  15543. let returnType2 = 3;
  15544. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  15545. if (generatedPropsType === 0) {
  15546. constantCache.set(node, 0);
  15547. return 0;
  15548. }
  15549. if (generatedPropsType < returnType2) {
  15550. returnType2 = generatedPropsType;
  15551. }
  15552. for (let i = 0; i < node.children.length; i++) {
  15553. const childType = getConstantType(node.children[i], context);
  15554. if (childType === 0) {
  15555. constantCache.set(node, 0);
  15556. return 0;
  15557. }
  15558. if (childType < returnType2) {
  15559. returnType2 = childType;
  15560. }
  15561. }
  15562. if (returnType2 > 1) {
  15563. for (let i = 0; i < node.props.length; i++) {
  15564. const p = node.props[i];
  15565. if (p.type === 7 && p.name === "bind" && p.exp) {
  15566. const expType = getConstantType(p.exp, context);
  15567. if (expType === 0) {
  15568. constantCache.set(node, 0);
  15569. return 0;
  15570. }
  15571. if (expType < returnType2) {
  15572. returnType2 = expType;
  15573. }
  15574. }
  15575. }
  15576. }
  15577. if (codegenNode.isBlock) {
  15578. for (let i = 0; i < node.props.length; i++) {
  15579. const p = node.props[i];
  15580. if (p.type === 7) {
  15581. constantCache.set(node, 0);
  15582. return 0;
  15583. }
  15584. }
  15585. context.removeHelper(OPEN_BLOCK);
  15586. context.removeHelper(
  15587. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  15588. );
  15589. codegenNode.isBlock = false;
  15590. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  15591. }
  15592. constantCache.set(node, returnType2);
  15593. return returnType2;
  15594. } else {
  15595. constantCache.set(node, 0);
  15596. return 0;
  15597. }
  15598. case 2:
  15599. case 3:
  15600. return 3;
  15601. case 9:
  15602. case 11:
  15603. case 10:
  15604. return 0;
  15605. case 5:
  15606. case 12:
  15607. return getConstantType(node.content, context);
  15608. case 4:
  15609. return node.constType;
  15610. case 8:
  15611. let returnType = 3;
  15612. for (let i = 0; i < node.children.length; i++) {
  15613. const child = node.children[i];
  15614. if (isString(child) || isSymbol(child)) {
  15615. continue;
  15616. }
  15617. const childType = getConstantType(child, context);
  15618. if (childType === 0) {
  15619. return 0;
  15620. } else if (childType < returnType) {
  15621. returnType = childType;
  15622. }
  15623. }
  15624. return returnType;
  15625. case 20:
  15626. return 2;
  15627. default:
  15628. return 0;
  15629. }
  15630. }
  15631. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  15632. NORMALIZE_CLASS,
  15633. NORMALIZE_STYLE,
  15634. NORMALIZE_PROPS,
  15635. GUARD_REACTIVE_PROPS
  15636. ]);
  15637. function getConstantTypeOfHelperCall(value, context) {
  15638. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  15639. const arg = value.arguments[0];
  15640. if (arg.type === 4) {
  15641. return getConstantType(arg, context);
  15642. } else if (arg.type === 14) {
  15643. return getConstantTypeOfHelperCall(arg, context);
  15644. }
  15645. }
  15646. return 0;
  15647. }
  15648. function getGeneratedPropsConstantType(node, context) {
  15649. let returnType = 3;
  15650. const props = getNodeProps(node);
  15651. if (props && props.type === 15) {
  15652. const { properties } = props;
  15653. for (let i = 0; i < properties.length; i++) {
  15654. const { key, value } = properties[i];
  15655. const keyType = getConstantType(key, context);
  15656. if (keyType === 0) {
  15657. return keyType;
  15658. }
  15659. if (keyType < returnType) {
  15660. returnType = keyType;
  15661. }
  15662. let valueType;
  15663. if (value.type === 4) {
  15664. valueType = getConstantType(value, context);
  15665. } else if (value.type === 14) {
  15666. valueType = getConstantTypeOfHelperCall(value, context);
  15667. } else {
  15668. valueType = 0;
  15669. }
  15670. if (valueType === 0) {
  15671. return valueType;
  15672. }
  15673. if (valueType < returnType) {
  15674. returnType = valueType;
  15675. }
  15676. }
  15677. }
  15678. return returnType;
  15679. }
  15680. function getNodeProps(node) {
  15681. const codegenNode = node.codegenNode;
  15682. if (codegenNode.type === 13) {
  15683. return codegenNode.props;
  15684. }
  15685. }
  15686. function createTransformContext(root, {
  15687. filename = "",
  15688. prefixIdentifiers = false,
  15689. hoistStatic = false,
  15690. hmr = false,
  15691. cacheHandlers = false,
  15692. nodeTransforms = [],
  15693. directiveTransforms = {},
  15694. transformHoist = null,
  15695. isBuiltInComponent = NOOP,
  15696. isCustomElement = NOOP,
  15697. expressionPlugins = [],
  15698. scopeId = null,
  15699. slotted = true,
  15700. ssr = false,
  15701. inSSR = false,
  15702. ssrCssVars = ``,
  15703. bindingMetadata = EMPTY_OBJ,
  15704. inline = false,
  15705. isTS = false,
  15706. onError = defaultOnError,
  15707. onWarn = defaultOnWarn,
  15708. compatConfig
  15709. }) {
  15710. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  15711. const context = {
  15712. // options
  15713. filename,
  15714. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  15715. prefixIdentifiers,
  15716. hoistStatic,
  15717. hmr,
  15718. cacheHandlers,
  15719. nodeTransforms,
  15720. directiveTransforms,
  15721. transformHoist,
  15722. isBuiltInComponent,
  15723. isCustomElement,
  15724. expressionPlugins,
  15725. scopeId,
  15726. slotted,
  15727. ssr,
  15728. inSSR,
  15729. ssrCssVars,
  15730. bindingMetadata,
  15731. inline,
  15732. isTS,
  15733. onError,
  15734. onWarn,
  15735. compatConfig,
  15736. // state
  15737. root,
  15738. helpers: /* @__PURE__ */ new Map(),
  15739. components: /* @__PURE__ */ new Set(),
  15740. directives: /* @__PURE__ */ new Set(),
  15741. hoists: [],
  15742. imports: [],
  15743. cached: [],
  15744. constantCache: /* @__PURE__ */ new WeakMap(),
  15745. vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
  15746. temps: 0,
  15747. identifiers: /* @__PURE__ */ Object.create(null),
  15748. scopes: {
  15749. vFor: 0,
  15750. vSlot: 0,
  15751. vPre: 0,
  15752. vOnce: 0
  15753. },
  15754. parent: null,
  15755. grandParent: null,
  15756. currentNode: root,
  15757. childIndex: 0,
  15758. inVOnce: false,
  15759. // methods
  15760. helper(name) {
  15761. const count = context.helpers.get(name) || 0;
  15762. context.helpers.set(name, count + 1);
  15763. return name;
  15764. },
  15765. removeHelper(name) {
  15766. const count = context.helpers.get(name);
  15767. if (count) {
  15768. const currentCount = count - 1;
  15769. if (!currentCount) {
  15770. context.helpers.delete(name);
  15771. } else {
  15772. context.helpers.set(name, currentCount);
  15773. }
  15774. }
  15775. },
  15776. helperString(name) {
  15777. return `_${helperNameMap[context.helper(name)]}`;
  15778. },
  15779. replaceNode(node) {
  15780. {
  15781. if (!context.currentNode) {
  15782. throw new Error(`Node being replaced is already removed.`);
  15783. }
  15784. if (!context.parent) {
  15785. throw new Error(`Cannot replace root node.`);
  15786. }
  15787. }
  15788. context.parent.children[context.childIndex] = context.currentNode = node;
  15789. },
  15790. removeNode(node) {
  15791. if (!context.parent) {
  15792. throw new Error(`Cannot remove root node.`);
  15793. }
  15794. const list = context.parent.children;
  15795. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  15796. if (removalIndex < 0) {
  15797. throw new Error(`node being removed is not a child of current parent`);
  15798. }
  15799. if (!node || node === context.currentNode) {
  15800. context.currentNode = null;
  15801. context.onNodeRemoved();
  15802. } else {
  15803. if (context.childIndex > removalIndex) {
  15804. context.childIndex--;
  15805. context.onNodeRemoved();
  15806. }
  15807. }
  15808. context.parent.children.splice(removalIndex, 1);
  15809. },
  15810. onNodeRemoved: NOOP,
  15811. addIdentifiers(exp) {
  15812. },
  15813. removeIdentifiers(exp) {
  15814. },
  15815. hoist(exp) {
  15816. if (isString(exp)) exp = createSimpleExpression(exp);
  15817. context.hoists.push(exp);
  15818. const identifier = createSimpleExpression(
  15819. `_hoisted_${context.hoists.length}`,
  15820. false,
  15821. exp.loc,
  15822. 2
  15823. );
  15824. identifier.hoisted = exp;
  15825. return identifier;
  15826. },
  15827. cache(exp, isVNode = false, inVOnce = false) {
  15828. const cacheExp = createCacheExpression(
  15829. context.cached.length,
  15830. exp,
  15831. isVNode,
  15832. inVOnce
  15833. );
  15834. context.cached.push(cacheExp);
  15835. return cacheExp;
  15836. }
  15837. };
  15838. return context;
  15839. }
  15840. function transform(root, options) {
  15841. const context = createTransformContext(root, options);
  15842. traverseNode(root, context);
  15843. if (options.hoistStatic) {
  15844. cacheStatic(root, context);
  15845. }
  15846. if (!options.ssr) {
  15847. createRootCodegen(root, context);
  15848. }
  15849. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  15850. root.components = [...context.components];
  15851. root.directives = [...context.directives];
  15852. root.imports = context.imports;
  15853. root.hoists = context.hoists;
  15854. root.temps = context.temps;
  15855. root.cached = context.cached;
  15856. root.transformed = true;
  15857. }
  15858. function createRootCodegen(root, context) {
  15859. const { helper } = context;
  15860. const { children } = root;
  15861. if (children.length === 1) {
  15862. const singleElementRootChild = getSingleElementRoot(root);
  15863. if (singleElementRootChild && singleElementRootChild.codegenNode) {
  15864. const codegenNode = singleElementRootChild.codegenNode;
  15865. if (codegenNode.type === 13) {
  15866. convertToBlock(codegenNode, context);
  15867. }
  15868. root.codegenNode = codegenNode;
  15869. } else {
  15870. root.codegenNode = children[0];
  15871. }
  15872. } else if (children.length > 1) {
  15873. let patchFlag = 64;
  15874. if (children.filter((c) => c.type !== 3).length === 1) {
  15875. patchFlag |= 2048;
  15876. }
  15877. root.codegenNode = createVNodeCall(
  15878. context,
  15879. helper(FRAGMENT),
  15880. void 0,
  15881. root.children,
  15882. patchFlag,
  15883. void 0,
  15884. void 0,
  15885. true,
  15886. void 0,
  15887. false
  15888. );
  15889. } else ;
  15890. }
  15891. function traverseChildren(parent, context) {
  15892. let i = 0;
  15893. const nodeRemoved = () => {
  15894. i--;
  15895. };
  15896. for (; i < parent.children.length; i++) {
  15897. const child = parent.children[i];
  15898. if (isString(child)) continue;
  15899. context.grandParent = context.parent;
  15900. context.parent = parent;
  15901. context.childIndex = i;
  15902. context.onNodeRemoved = nodeRemoved;
  15903. traverseNode(child, context);
  15904. }
  15905. }
  15906. function traverseNode(node, context) {
  15907. context.currentNode = node;
  15908. const { nodeTransforms } = context;
  15909. const exitFns = [];
  15910. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  15911. const onExit = nodeTransforms[i2](node, context);
  15912. if (onExit) {
  15913. if (isArray(onExit)) {
  15914. exitFns.push(...onExit);
  15915. } else {
  15916. exitFns.push(onExit);
  15917. }
  15918. }
  15919. if (!context.currentNode) {
  15920. return;
  15921. } else {
  15922. node = context.currentNode;
  15923. }
  15924. }
  15925. switch (node.type) {
  15926. case 3:
  15927. if (!context.ssr) {
  15928. context.helper(CREATE_COMMENT);
  15929. }
  15930. break;
  15931. case 5:
  15932. if (!context.ssr) {
  15933. context.helper(TO_DISPLAY_STRING);
  15934. }
  15935. break;
  15936. // for container types, further traverse downwards
  15937. case 9:
  15938. for (let i2 = 0; i2 < node.branches.length; i2++) {
  15939. traverseNode(node.branches[i2], context);
  15940. }
  15941. break;
  15942. case 10:
  15943. case 11:
  15944. case 1:
  15945. case 0:
  15946. traverseChildren(node, context);
  15947. break;
  15948. }
  15949. context.currentNode = node;
  15950. let i = exitFns.length;
  15951. while (i--) {
  15952. exitFns[i]();
  15953. }
  15954. }
  15955. function createStructuralDirectiveTransform(name, fn) {
  15956. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  15957. return (node, context) => {
  15958. if (node.type === 1) {
  15959. const { props } = node;
  15960. if (node.tagType === 3 && props.some(isVSlot)) {
  15961. return;
  15962. }
  15963. const exitFns = [];
  15964. for (let i = 0; i < props.length; i++) {
  15965. const prop = props[i];
  15966. if (prop.type === 7 && matches(prop.name)) {
  15967. props.splice(i, 1);
  15968. i--;
  15969. const onExit = fn(node, prop, context);
  15970. if (onExit) exitFns.push(onExit);
  15971. }
  15972. }
  15973. return exitFns;
  15974. }
  15975. };
  15976. }
  15977. const PURE_ANNOTATION = `/*@__PURE__*/`;
  15978. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  15979. function createCodegenContext(ast, {
  15980. mode = "function",
  15981. prefixIdentifiers = mode === "module",
  15982. sourceMap = false,
  15983. filename = `template.vue.html`,
  15984. scopeId = null,
  15985. optimizeImports = false,
  15986. runtimeGlobalName = `Vue`,
  15987. runtimeModuleName = `vue`,
  15988. ssrRuntimeModuleName = "vue/server-renderer",
  15989. ssr = false,
  15990. isTS = false,
  15991. inSSR = false
  15992. }) {
  15993. const context = {
  15994. mode,
  15995. prefixIdentifiers,
  15996. sourceMap,
  15997. filename,
  15998. scopeId,
  15999. optimizeImports,
  16000. runtimeGlobalName,
  16001. runtimeModuleName,
  16002. ssrRuntimeModuleName,
  16003. ssr,
  16004. isTS,
  16005. inSSR,
  16006. source: ast.source,
  16007. code: ``,
  16008. column: 1,
  16009. line: 1,
  16010. offset: 0,
  16011. indentLevel: 0,
  16012. pure: false,
  16013. map: void 0,
  16014. helper(key) {
  16015. return `_${helperNameMap[key]}`;
  16016. },
  16017. push(code, newlineIndex = -2 /* None */, node) {
  16018. context.code += code;
  16019. },
  16020. indent() {
  16021. newline(++context.indentLevel);
  16022. },
  16023. deindent(withoutNewLine = false) {
  16024. if (withoutNewLine) {
  16025. --context.indentLevel;
  16026. } else {
  16027. newline(--context.indentLevel);
  16028. }
  16029. },
  16030. newline() {
  16031. newline(context.indentLevel);
  16032. }
  16033. };
  16034. function newline(n) {
  16035. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  16036. }
  16037. return context;
  16038. }
  16039. function generate(ast, options = {}) {
  16040. const context = createCodegenContext(ast, options);
  16041. if (options.onContextCreated) options.onContextCreated(context);
  16042. const {
  16043. mode,
  16044. push,
  16045. prefixIdentifiers,
  16046. indent,
  16047. deindent,
  16048. newline,
  16049. scopeId,
  16050. ssr
  16051. } = context;
  16052. const helpers = Array.from(ast.helpers);
  16053. const hasHelpers = helpers.length > 0;
  16054. const useWithBlock = !prefixIdentifiers && mode !== "module";
  16055. const preambleContext = context;
  16056. {
  16057. genFunctionPreamble(ast, preambleContext);
  16058. }
  16059. const functionName = ssr ? `ssrRender` : `render`;
  16060. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  16061. const signature = args.join(", ");
  16062. {
  16063. push(`function ${functionName}(${signature}) {`);
  16064. }
  16065. indent();
  16066. if (useWithBlock) {
  16067. push(`with (_ctx) {`);
  16068. indent();
  16069. if (hasHelpers) {
  16070. push(
  16071. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  16072. `,
  16073. -1 /* End */
  16074. );
  16075. newline();
  16076. }
  16077. }
  16078. if (ast.components.length) {
  16079. genAssets(ast.components, "component", context);
  16080. if (ast.directives.length || ast.temps > 0) {
  16081. newline();
  16082. }
  16083. }
  16084. if (ast.directives.length) {
  16085. genAssets(ast.directives, "directive", context);
  16086. if (ast.temps > 0) {
  16087. newline();
  16088. }
  16089. }
  16090. if (ast.temps > 0) {
  16091. push(`let `);
  16092. for (let i = 0; i < ast.temps; i++) {
  16093. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  16094. }
  16095. }
  16096. if (ast.components.length || ast.directives.length || ast.temps) {
  16097. push(`
  16098. `, 0 /* Start */);
  16099. newline();
  16100. }
  16101. if (!ssr) {
  16102. push(`return `);
  16103. }
  16104. if (ast.codegenNode) {
  16105. genNode(ast.codegenNode, context);
  16106. } else {
  16107. push(`null`);
  16108. }
  16109. if (useWithBlock) {
  16110. deindent();
  16111. push(`}`);
  16112. }
  16113. deindent();
  16114. push(`}`);
  16115. return {
  16116. ast,
  16117. code: context.code,
  16118. preamble: ``,
  16119. map: context.map ? context.map.toJSON() : void 0
  16120. };
  16121. }
  16122. function genFunctionPreamble(ast, context) {
  16123. const {
  16124. ssr,
  16125. prefixIdentifiers,
  16126. push,
  16127. newline,
  16128. runtimeModuleName,
  16129. runtimeGlobalName,
  16130. ssrRuntimeModuleName
  16131. } = context;
  16132. const VueBinding = runtimeGlobalName;
  16133. const helpers = Array.from(ast.helpers);
  16134. if (helpers.length > 0) {
  16135. {
  16136. push(`const _Vue = ${VueBinding}
  16137. `, -1 /* End */);
  16138. if (ast.hoists.length) {
  16139. const staticHelpers = [
  16140. CREATE_VNODE,
  16141. CREATE_ELEMENT_VNODE,
  16142. CREATE_COMMENT,
  16143. CREATE_TEXT,
  16144. CREATE_STATIC
  16145. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  16146. push(`const { ${staticHelpers} } = _Vue
  16147. `, -1 /* End */);
  16148. }
  16149. }
  16150. }
  16151. genHoists(ast.hoists, context);
  16152. newline();
  16153. push(`return `);
  16154. }
  16155. function genAssets(assets, type, { helper, push, newline, isTS }) {
  16156. const resolver = helper(
  16157. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  16158. );
  16159. for (let i = 0; i < assets.length; i++) {
  16160. let id = assets[i];
  16161. const maybeSelfReference = id.endsWith("__self");
  16162. if (maybeSelfReference) {
  16163. id = id.slice(0, -6);
  16164. }
  16165. push(
  16166. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  16167. );
  16168. if (i < assets.length - 1) {
  16169. newline();
  16170. }
  16171. }
  16172. }
  16173. function genHoists(hoists, context) {
  16174. if (!hoists.length) {
  16175. return;
  16176. }
  16177. context.pure = true;
  16178. const { push, newline } = context;
  16179. newline();
  16180. for (let i = 0; i < hoists.length; i++) {
  16181. const exp = hoists[i];
  16182. if (exp) {
  16183. push(`const _hoisted_${i + 1} = `);
  16184. genNode(exp, context);
  16185. newline();
  16186. }
  16187. }
  16188. context.pure = false;
  16189. }
  16190. function isText(n) {
  16191. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  16192. }
  16193. function genNodeListAsArray(nodes, context) {
  16194. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  16195. context.push(`[`);
  16196. multilines && context.indent();
  16197. genNodeList(nodes, context, multilines);
  16198. multilines && context.deindent();
  16199. context.push(`]`);
  16200. }
  16201. function genNodeList(nodes, context, multilines = false, comma = true) {
  16202. const { push, newline } = context;
  16203. for (let i = 0; i < nodes.length; i++) {
  16204. const node = nodes[i];
  16205. if (isString(node)) {
  16206. push(node, -3 /* Unknown */);
  16207. } else if (isArray(node)) {
  16208. genNodeListAsArray(node, context);
  16209. } else {
  16210. genNode(node, context);
  16211. }
  16212. if (i < nodes.length - 1) {
  16213. if (multilines) {
  16214. comma && push(",");
  16215. newline();
  16216. } else {
  16217. comma && push(", ");
  16218. }
  16219. }
  16220. }
  16221. }
  16222. function genNode(node, context) {
  16223. if (isString(node)) {
  16224. context.push(node, -3 /* Unknown */);
  16225. return;
  16226. }
  16227. if (isSymbol(node)) {
  16228. context.push(context.helper(node));
  16229. return;
  16230. }
  16231. switch (node.type) {
  16232. case 1:
  16233. case 9:
  16234. case 11:
  16235. assert(
  16236. node.codegenNode != null,
  16237. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  16238. );
  16239. genNode(node.codegenNode, context);
  16240. break;
  16241. case 2:
  16242. genText(node, context);
  16243. break;
  16244. case 4:
  16245. genExpression(node, context);
  16246. break;
  16247. case 5:
  16248. genInterpolation(node, context);
  16249. break;
  16250. case 12:
  16251. genNode(node.codegenNode, context);
  16252. break;
  16253. case 8:
  16254. genCompoundExpression(node, context);
  16255. break;
  16256. case 3:
  16257. genComment(node, context);
  16258. break;
  16259. case 13:
  16260. genVNodeCall(node, context);
  16261. break;
  16262. case 14:
  16263. genCallExpression(node, context);
  16264. break;
  16265. case 15:
  16266. genObjectExpression(node, context);
  16267. break;
  16268. case 17:
  16269. genArrayExpression(node, context);
  16270. break;
  16271. case 18:
  16272. genFunctionExpression(node, context);
  16273. break;
  16274. case 19:
  16275. genConditionalExpression(node, context);
  16276. break;
  16277. case 20:
  16278. genCacheExpression(node, context);
  16279. break;
  16280. case 21:
  16281. genNodeList(node.body, context, true, false);
  16282. break;
  16283. // SSR only types
  16284. case 22:
  16285. break;
  16286. case 23:
  16287. break;
  16288. case 24:
  16289. break;
  16290. case 25:
  16291. break;
  16292. case 26:
  16293. break;
  16294. /* v8 ignore start */
  16295. case 10:
  16296. break;
  16297. default:
  16298. {
  16299. assert(false, `unhandled codegen node type: ${node.type}`);
  16300. const exhaustiveCheck = node;
  16301. return exhaustiveCheck;
  16302. }
  16303. }
  16304. }
  16305. function genText(node, context) {
  16306. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  16307. }
  16308. function genExpression(node, context) {
  16309. const { content, isStatic } = node;
  16310. context.push(
  16311. isStatic ? JSON.stringify(content) : content,
  16312. -3 /* Unknown */,
  16313. node
  16314. );
  16315. }
  16316. function genInterpolation(node, context) {
  16317. const { push, helper, pure } = context;
  16318. if (pure) push(PURE_ANNOTATION);
  16319. push(`${helper(TO_DISPLAY_STRING)}(`);
  16320. genNode(node.content, context);
  16321. push(`)`);
  16322. }
  16323. function genCompoundExpression(node, context) {
  16324. for (let i = 0; i < node.children.length; i++) {
  16325. const child = node.children[i];
  16326. if (isString(child)) {
  16327. context.push(child, -3 /* Unknown */);
  16328. } else {
  16329. genNode(child, context);
  16330. }
  16331. }
  16332. }
  16333. function genExpressionAsPropertyKey(node, context) {
  16334. const { push } = context;
  16335. if (node.type === 8) {
  16336. push(`[`);
  16337. genCompoundExpression(node, context);
  16338. push(`]`);
  16339. } else if (node.isStatic) {
  16340. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  16341. push(text, -2 /* None */, node);
  16342. } else {
  16343. push(`[${node.content}]`, -3 /* Unknown */, node);
  16344. }
  16345. }
  16346. function genComment(node, context) {
  16347. const { push, helper, pure } = context;
  16348. if (pure) {
  16349. push(PURE_ANNOTATION);
  16350. }
  16351. push(
  16352. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  16353. -3 /* Unknown */,
  16354. node
  16355. );
  16356. }
  16357. function genVNodeCall(node, context) {
  16358. const { push, helper, pure } = context;
  16359. const {
  16360. tag,
  16361. props,
  16362. children,
  16363. patchFlag,
  16364. dynamicProps,
  16365. directives,
  16366. isBlock,
  16367. disableTracking,
  16368. isComponent
  16369. } = node;
  16370. let patchFlagString;
  16371. if (patchFlag) {
  16372. {
  16373. if (patchFlag < 0) {
  16374. patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  16375. } else {
  16376. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  16377. patchFlagString = patchFlag + ` /* ${flagNames} */`;
  16378. }
  16379. }
  16380. }
  16381. if (directives) {
  16382. push(helper(WITH_DIRECTIVES) + `(`);
  16383. }
  16384. if (isBlock) {
  16385. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  16386. }
  16387. if (pure) {
  16388. push(PURE_ANNOTATION);
  16389. }
  16390. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  16391. push(helper(callHelper) + `(`, -2 /* None */, node);
  16392. genNodeList(
  16393. genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
  16394. context
  16395. );
  16396. push(`)`);
  16397. if (isBlock) {
  16398. push(`)`);
  16399. }
  16400. if (directives) {
  16401. push(`, `);
  16402. genNode(directives, context);
  16403. push(`)`);
  16404. }
  16405. }
  16406. function genNullableArgs(args) {
  16407. let i = args.length;
  16408. while (i--) {
  16409. if (args[i] != null) break;
  16410. }
  16411. return args.slice(0, i + 1).map((arg) => arg || `null`);
  16412. }
  16413. function genCallExpression(node, context) {
  16414. const { push, helper, pure } = context;
  16415. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  16416. if (pure) {
  16417. push(PURE_ANNOTATION);
  16418. }
  16419. push(callee + `(`, -2 /* None */, node);
  16420. genNodeList(node.arguments, context);
  16421. push(`)`);
  16422. }
  16423. function genObjectExpression(node, context) {
  16424. const { push, indent, deindent, newline } = context;
  16425. const { properties } = node;
  16426. if (!properties.length) {
  16427. push(`{}`, -2 /* None */, node);
  16428. return;
  16429. }
  16430. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  16431. push(multilines ? `{` : `{ `);
  16432. multilines && indent();
  16433. for (let i = 0; i < properties.length; i++) {
  16434. const { key, value } = properties[i];
  16435. genExpressionAsPropertyKey(key, context);
  16436. push(`: `);
  16437. genNode(value, context);
  16438. if (i < properties.length - 1) {
  16439. push(`,`);
  16440. newline();
  16441. }
  16442. }
  16443. multilines && deindent();
  16444. push(multilines ? `}` : ` }`);
  16445. }
  16446. function genArrayExpression(node, context) {
  16447. genNodeListAsArray(node.elements, context);
  16448. }
  16449. function genFunctionExpression(node, context) {
  16450. const { push, indent, deindent } = context;
  16451. const { params, returns, body, newline, isSlot } = node;
  16452. if (isSlot) {
  16453. push(`_${helperNameMap[WITH_CTX]}(`);
  16454. }
  16455. push(`(`, -2 /* None */, node);
  16456. if (isArray(params)) {
  16457. genNodeList(params, context);
  16458. } else if (params) {
  16459. genNode(params, context);
  16460. }
  16461. push(`) => `);
  16462. if (newline || body) {
  16463. push(`{`);
  16464. indent();
  16465. }
  16466. if (returns) {
  16467. if (newline) {
  16468. push(`return `);
  16469. }
  16470. if (isArray(returns)) {
  16471. genNodeListAsArray(returns, context);
  16472. } else {
  16473. genNode(returns, context);
  16474. }
  16475. } else if (body) {
  16476. genNode(body, context);
  16477. }
  16478. if (newline || body) {
  16479. deindent();
  16480. push(`}`);
  16481. }
  16482. if (isSlot) {
  16483. push(`)`);
  16484. }
  16485. }
  16486. function genConditionalExpression(node, context) {
  16487. const { test, consequent, alternate, newline: needNewline } = node;
  16488. const { push, indent, deindent, newline } = context;
  16489. if (test.type === 4) {
  16490. const needsParens = !isSimpleIdentifier(test.content);
  16491. needsParens && push(`(`);
  16492. genExpression(test, context);
  16493. needsParens && push(`)`);
  16494. } else {
  16495. push(`(`);
  16496. genNode(test, context);
  16497. push(`)`);
  16498. }
  16499. needNewline && indent();
  16500. context.indentLevel++;
  16501. needNewline || push(` `);
  16502. push(`? `);
  16503. genNode(consequent, context);
  16504. context.indentLevel--;
  16505. needNewline && newline();
  16506. needNewline || push(` `);
  16507. push(`: `);
  16508. const isNested = alternate.type === 19;
  16509. if (!isNested) {
  16510. context.indentLevel++;
  16511. }
  16512. genNode(alternate, context);
  16513. if (!isNested) {
  16514. context.indentLevel--;
  16515. }
  16516. needNewline && deindent(
  16517. true
  16518. /* without newline */
  16519. );
  16520. }
  16521. function genCacheExpression(node, context) {
  16522. const { push, helper, indent, deindent, newline } = context;
  16523. const { needPauseTracking, needArraySpread } = node;
  16524. if (needArraySpread) {
  16525. push(`[...(`);
  16526. }
  16527. push(`_cache[${node.index}] || (`);
  16528. if (needPauseTracking) {
  16529. indent();
  16530. push(`${helper(SET_BLOCK_TRACKING)}(-1`);
  16531. if (node.inVOnce) push(`, true`);
  16532. push(`),`);
  16533. newline();
  16534. push(`(`);
  16535. }
  16536. push(`_cache[${node.index}] = `);
  16537. genNode(node.value, context);
  16538. if (needPauseTracking) {
  16539. push(`).cacheIndex = ${node.index},`);
  16540. newline();
  16541. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  16542. newline();
  16543. push(`_cache[${node.index}]`);
  16544. deindent();
  16545. }
  16546. push(`)`);
  16547. if (needArraySpread) {
  16548. push(`)]`);
  16549. }
  16550. }
  16551. const prohibitedKeywordRE = new RegExp(
  16552. "\\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"
  16553. );
  16554. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  16555. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  16556. const exp = node.content;
  16557. if (!exp.trim()) {
  16558. return;
  16559. }
  16560. try {
  16561. new Function(
  16562. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  16563. );
  16564. } catch (e) {
  16565. let message = e.message;
  16566. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  16567. if (keywordMatch) {
  16568. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  16569. }
  16570. context.onError(
  16571. createCompilerError(
  16572. 46,
  16573. node.loc,
  16574. void 0,
  16575. message
  16576. )
  16577. );
  16578. }
  16579. }
  16580. const transformExpression = (node, context) => {
  16581. if (node.type === 5) {
  16582. node.content = processExpression(
  16583. node.content,
  16584. context
  16585. );
  16586. } else if (node.type === 1) {
  16587. const memo = findDir(node, "memo");
  16588. for (let i = 0; i < node.props.length; i++) {
  16589. const dir = node.props[i];
  16590. if (dir.type === 7 && dir.name !== "for") {
  16591. const exp = dir.exp;
  16592. const arg = dir.arg;
  16593. if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
  16594. !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) {
  16595. dir.exp = processExpression(
  16596. exp,
  16597. context,
  16598. // slot args must be processed as function params
  16599. dir.name === "slot"
  16600. );
  16601. }
  16602. if (arg && arg.type === 4 && !arg.isStatic) {
  16603. dir.arg = processExpression(arg, context);
  16604. }
  16605. }
  16606. }
  16607. }
  16608. };
  16609. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  16610. {
  16611. {
  16612. validateBrowserExpression(node, context, asParams, asRawStatements);
  16613. }
  16614. return node;
  16615. }
  16616. }
  16617. const transformIf = createStructuralDirectiveTransform(
  16618. /^(?:if|else|else-if)$/,
  16619. (node, dir, context) => {
  16620. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  16621. const siblings = context.parent.children;
  16622. let i = siblings.indexOf(ifNode);
  16623. let key = 0;
  16624. while (i-- >= 0) {
  16625. const sibling = siblings[i];
  16626. if (sibling && sibling.type === 9) {
  16627. key += sibling.branches.length;
  16628. }
  16629. }
  16630. return () => {
  16631. if (isRoot) {
  16632. ifNode.codegenNode = createCodegenNodeForBranch(
  16633. branch,
  16634. key,
  16635. context
  16636. );
  16637. } else {
  16638. const parentCondition = getParentCondition(ifNode.codegenNode);
  16639. parentCondition.alternate = createCodegenNodeForBranch(
  16640. branch,
  16641. key + ifNode.branches.length - 1,
  16642. context
  16643. );
  16644. }
  16645. };
  16646. });
  16647. }
  16648. );
  16649. function processIf(node, dir, context, processCodegen) {
  16650. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  16651. const loc = dir.exp ? dir.exp.loc : node.loc;
  16652. context.onError(
  16653. createCompilerError(28, dir.loc)
  16654. );
  16655. dir.exp = createSimpleExpression(`true`, false, loc);
  16656. }
  16657. if (dir.exp) {
  16658. validateBrowserExpression(dir.exp, context);
  16659. }
  16660. if (dir.name === "if") {
  16661. const branch = createIfBranch(node, dir);
  16662. const ifNode = {
  16663. type: 9,
  16664. loc: cloneLoc(node.loc),
  16665. branches: [branch]
  16666. };
  16667. context.replaceNode(ifNode);
  16668. if (processCodegen) {
  16669. return processCodegen(ifNode, branch, true);
  16670. }
  16671. } else {
  16672. const siblings = context.parent.children;
  16673. const comments = [];
  16674. let i = siblings.indexOf(node);
  16675. while (i-- >= -1) {
  16676. const sibling = siblings[i];
  16677. if (sibling && isCommentOrWhitespace(sibling)) {
  16678. context.removeNode(sibling);
  16679. if (sibling.type === 3) {
  16680. comments.unshift(sibling);
  16681. }
  16682. continue;
  16683. }
  16684. if (sibling && sibling.type === 9) {
  16685. if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  16686. context.onError(
  16687. createCompilerError(30, node.loc)
  16688. );
  16689. }
  16690. context.removeNode();
  16691. const branch = createIfBranch(node, dir);
  16692. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  16693. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  16694. branch.children = [...comments, ...branch.children];
  16695. }
  16696. {
  16697. const key = branch.userKey;
  16698. if (key) {
  16699. sibling.branches.forEach(({ userKey }) => {
  16700. if (isSameKey(userKey, key)) {
  16701. context.onError(
  16702. createCompilerError(
  16703. 29,
  16704. branch.userKey.loc
  16705. )
  16706. );
  16707. }
  16708. });
  16709. }
  16710. }
  16711. sibling.branches.push(branch);
  16712. const onExit = processCodegen && processCodegen(sibling, branch, false);
  16713. traverseNode(branch, context);
  16714. if (onExit) onExit();
  16715. context.currentNode = null;
  16716. } else {
  16717. context.onError(
  16718. createCompilerError(30, node.loc)
  16719. );
  16720. }
  16721. break;
  16722. }
  16723. }
  16724. }
  16725. function createIfBranch(node, dir) {
  16726. const isTemplateIf = node.tagType === 3;
  16727. return {
  16728. type: 10,
  16729. loc: node.loc,
  16730. condition: dir.name === "else" ? void 0 : dir.exp,
  16731. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  16732. userKey: findProp(node, `key`),
  16733. isTemplateIf
  16734. };
  16735. }
  16736. function createCodegenNodeForBranch(branch, keyIndex, context) {
  16737. if (branch.condition) {
  16738. return createConditionalExpression(
  16739. branch.condition,
  16740. createChildrenCodegenNode(branch, keyIndex, context),
  16741. // make sure to pass in asBlock: true so that the comment node call
  16742. // closes the current block.
  16743. createCallExpression(context.helper(CREATE_COMMENT), [
  16744. '"v-if"' ,
  16745. "true"
  16746. ])
  16747. );
  16748. } else {
  16749. return createChildrenCodegenNode(branch, keyIndex, context);
  16750. }
  16751. }
  16752. function createChildrenCodegenNode(branch, keyIndex, context) {
  16753. const { helper } = context;
  16754. const keyProperty = createObjectProperty(
  16755. `key`,
  16756. createSimpleExpression(
  16757. `${keyIndex}`,
  16758. false,
  16759. locStub,
  16760. 2
  16761. )
  16762. );
  16763. const { children } = branch;
  16764. const firstChild = children[0];
  16765. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  16766. if (needFragmentWrapper) {
  16767. if (children.length === 1 && firstChild.type === 11) {
  16768. const vnodeCall = firstChild.codegenNode;
  16769. injectProp(vnodeCall, keyProperty, context);
  16770. return vnodeCall;
  16771. } else {
  16772. let patchFlag = 64;
  16773. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  16774. patchFlag |= 2048;
  16775. }
  16776. return createVNodeCall(
  16777. context,
  16778. helper(FRAGMENT),
  16779. createObjectExpression([keyProperty]),
  16780. children,
  16781. patchFlag,
  16782. void 0,
  16783. void 0,
  16784. true,
  16785. false,
  16786. false,
  16787. branch.loc
  16788. );
  16789. }
  16790. } else {
  16791. const ret = firstChild.codegenNode;
  16792. const vnodeCall = getMemoedVNodeCall(ret);
  16793. if (vnodeCall.type === 13) {
  16794. convertToBlock(vnodeCall, context);
  16795. }
  16796. injectProp(vnodeCall, keyProperty, context);
  16797. return ret;
  16798. }
  16799. }
  16800. function isSameKey(a, b) {
  16801. if (!a || a.type !== b.type) {
  16802. return false;
  16803. }
  16804. if (a.type === 6) {
  16805. if (a.value.content !== b.value.content) {
  16806. return false;
  16807. }
  16808. } else {
  16809. const exp = a.exp;
  16810. const branchExp = b.exp;
  16811. if (exp.type !== branchExp.type) {
  16812. return false;
  16813. }
  16814. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  16815. return false;
  16816. }
  16817. }
  16818. return true;
  16819. }
  16820. function getParentCondition(node) {
  16821. while (true) {
  16822. if (node.type === 19) {
  16823. if (node.alternate.type === 19) {
  16824. node = node.alternate;
  16825. } else {
  16826. return node;
  16827. }
  16828. } else if (node.type === 20) {
  16829. node = node.value;
  16830. }
  16831. }
  16832. }
  16833. const transformFor = createStructuralDirectiveTransform(
  16834. "for",
  16835. (node, dir, context) => {
  16836. const { helper, removeHelper } = context;
  16837. return processFor(node, dir, context, (forNode) => {
  16838. const renderExp = createCallExpression(helper(RENDER_LIST), [
  16839. forNode.source
  16840. ]);
  16841. const isTemplate = isTemplateNode(node);
  16842. const memo = findDir(node, "memo");
  16843. const keyProp = findProp(node, `key`, false, true);
  16844. keyProp && keyProp.type === 7;
  16845. let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
  16846. const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
  16847. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  16848. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  16849. forNode.codegenNode = createVNodeCall(
  16850. context,
  16851. helper(FRAGMENT),
  16852. void 0,
  16853. renderExp,
  16854. fragmentFlag,
  16855. void 0,
  16856. void 0,
  16857. true,
  16858. !isStableFragment,
  16859. false,
  16860. node.loc
  16861. );
  16862. return () => {
  16863. var _a;
  16864. let childBlock;
  16865. const { children } = forNode;
  16866. if (isTemplate) {
  16867. node.children.some((c) => {
  16868. if (c.type === 1) {
  16869. const key = findProp(c, "key");
  16870. if (key) {
  16871. context.onError(
  16872. createCompilerError(
  16873. 33,
  16874. key.loc
  16875. )
  16876. );
  16877. return true;
  16878. }
  16879. }
  16880. });
  16881. }
  16882. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  16883. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  16884. if (slotOutlet) {
  16885. childBlock = slotOutlet.codegenNode;
  16886. if (isTemplate && keyProperty) {
  16887. injectProp(childBlock, keyProperty, context);
  16888. }
  16889. } else if (needFragmentWrapper) {
  16890. childBlock = createVNodeCall(
  16891. context,
  16892. helper(FRAGMENT),
  16893. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  16894. node.children,
  16895. 64,
  16896. void 0,
  16897. void 0,
  16898. true,
  16899. void 0,
  16900. false
  16901. );
  16902. } else {
  16903. childBlock = children[0].codegenNode;
  16904. if (isTemplate && keyProperty) {
  16905. injectProp(childBlock, keyProperty, context);
  16906. }
  16907. const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
  16908. if (childBlock.isBlock !== shouldUseBlock) {
  16909. if (childBlock.isBlock) {
  16910. removeHelper(OPEN_BLOCK);
  16911. removeHelper(
  16912. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  16913. );
  16914. } else {
  16915. removeHelper(
  16916. getVNodeHelper(context.inSSR, childBlock.isComponent)
  16917. );
  16918. }
  16919. }
  16920. childBlock.isBlock = shouldUseBlock;
  16921. if (childBlock.isBlock) {
  16922. helper(OPEN_BLOCK);
  16923. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  16924. } else {
  16925. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  16926. if (childBlock.needsPatch) {
  16927. childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
  16928. }
  16929. }
  16930. }
  16931. if (memo) {
  16932. const loop = createFunctionExpression(
  16933. createForLoopParams(forNode.parseResult, [
  16934. createSimpleExpression(`_cached`)
  16935. ])
  16936. );
  16937. loop.body = createBlockStatement([
  16938. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  16939. createCompoundExpression([
  16940. `if (_cached && _cached.el`,
  16941. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  16942. ` && ${context.helperString(
  16943. IS_MEMO_SAME
  16944. )}(_cached, _memo)) return _cached`
  16945. ]),
  16946. createCompoundExpression([`const _item = `, childBlock]),
  16947. createSimpleExpression(`_item.memo = _memo`),
  16948. createSimpleExpression(`return _item`)
  16949. ]);
  16950. renderExp.arguments.push(
  16951. loop,
  16952. createSimpleExpression(`_cache`),
  16953. createSimpleExpression(String(context.cached.length))
  16954. );
  16955. context.cached.push(null);
  16956. } else {
  16957. renderExp.arguments.push(
  16958. createFunctionExpression(
  16959. createForLoopParams(forNode.parseResult),
  16960. childBlock,
  16961. true
  16962. )
  16963. );
  16964. }
  16965. };
  16966. });
  16967. }
  16968. );
  16969. function processFor(node, dir, context, processCodegen) {
  16970. if (!dir.exp) {
  16971. context.onError(
  16972. createCompilerError(31, dir.loc)
  16973. );
  16974. return;
  16975. }
  16976. const parseResult = dir.forParseResult;
  16977. if (!parseResult) {
  16978. context.onError(
  16979. createCompilerError(32, dir.loc)
  16980. );
  16981. return;
  16982. }
  16983. finalizeForParseResult(parseResult, context);
  16984. const { addIdentifiers, removeIdentifiers, scopes } = context;
  16985. const { source, value, key, index } = parseResult;
  16986. const forNode = {
  16987. type: 11,
  16988. loc: dir.loc,
  16989. source,
  16990. valueAlias: value,
  16991. keyAlias: key,
  16992. objectIndexAlias: index,
  16993. parseResult,
  16994. children: isTemplateNode(node) ? node.children : [node]
  16995. };
  16996. context.replaceNode(forNode);
  16997. scopes.vFor++;
  16998. const onExit = processCodegen && processCodegen(forNode);
  16999. return () => {
  17000. scopes.vFor--;
  17001. if (onExit) onExit();
  17002. };
  17003. }
  17004. function finalizeForParseResult(result, context) {
  17005. if (result.finalized) return;
  17006. {
  17007. validateBrowserExpression(result.source, context);
  17008. if (result.key) {
  17009. validateBrowserExpression(
  17010. result.key,
  17011. context,
  17012. true
  17013. );
  17014. }
  17015. if (result.index) {
  17016. validateBrowserExpression(
  17017. result.index,
  17018. context,
  17019. true
  17020. );
  17021. }
  17022. if (result.value) {
  17023. validateBrowserExpression(
  17024. result.value,
  17025. context,
  17026. true
  17027. );
  17028. }
  17029. }
  17030. result.finalized = true;
  17031. }
  17032. function createForLoopParams({ value, key, index }, memoArgs = []) {
  17033. return createParamsList([value, key, index, ...memoArgs]);
  17034. }
  17035. function createParamsList(args) {
  17036. let i = args.length;
  17037. while (i--) {
  17038. if (args[i]) break;
  17039. }
  17040. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  17041. }
  17042. const defaultFallback = createSimpleExpression(`undefined`, false);
  17043. const trackSlotScopes = (node, context) => {
  17044. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  17045. const vSlot = findDir(node, "slot");
  17046. if (vSlot) {
  17047. vSlot.exp;
  17048. context.scopes.vSlot++;
  17049. return () => {
  17050. context.scopes.vSlot--;
  17051. };
  17052. }
  17053. }
  17054. };
  17055. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  17056. props,
  17057. children,
  17058. false,
  17059. true,
  17060. children.length ? children[0].loc : loc
  17061. );
  17062. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  17063. context.helper(WITH_CTX);
  17064. const { children, loc } = node;
  17065. const slotsProperties = [];
  17066. const dynamicSlots = [];
  17067. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  17068. const onComponentSlot = findDir(node, "slot", true);
  17069. if (onComponentSlot) {
  17070. const { arg, exp } = onComponentSlot;
  17071. if (arg && !isStaticExp(arg)) {
  17072. hasDynamicSlots = true;
  17073. }
  17074. slotsProperties.push(
  17075. createObjectProperty(
  17076. arg || createSimpleExpression("default", true),
  17077. buildSlotFn(exp, void 0, children, loc)
  17078. )
  17079. );
  17080. }
  17081. let hasTemplateSlots = false;
  17082. let hasNamedDefaultSlot = false;
  17083. const implicitDefaultChildren = [];
  17084. const seenSlotNames = /* @__PURE__ */ new Set();
  17085. let conditionalBranchIndex = 0;
  17086. for (let i = 0; i < children.length; i++) {
  17087. const slotElement = children[i];
  17088. let slotDir;
  17089. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  17090. if (slotElement.type !== 3) {
  17091. implicitDefaultChildren.push(slotElement);
  17092. }
  17093. continue;
  17094. }
  17095. if (onComponentSlot) {
  17096. context.onError(
  17097. createCompilerError(37, slotDir.loc)
  17098. );
  17099. break;
  17100. }
  17101. hasTemplateSlots = true;
  17102. const { children: slotChildren, loc: slotLoc } = slotElement;
  17103. const {
  17104. arg: slotName = createSimpleExpression(`default`, true),
  17105. exp: slotProps,
  17106. loc: dirLoc
  17107. } = slotDir;
  17108. let staticSlotName;
  17109. if (isStaticExp(slotName)) {
  17110. staticSlotName = slotName ? slotName.content : `default`;
  17111. } else {
  17112. hasDynamicSlots = true;
  17113. }
  17114. const vFor = findDir(slotElement, "for");
  17115. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  17116. let vIf;
  17117. let vElse;
  17118. if (vIf = findDir(slotElement, "if")) {
  17119. hasDynamicSlots = true;
  17120. dynamicSlots.push(
  17121. createConditionalExpression(
  17122. vIf.exp,
  17123. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  17124. defaultFallback
  17125. )
  17126. );
  17127. } else if (vElse = findDir(
  17128. slotElement,
  17129. /^else(?:-if)?$/,
  17130. true
  17131. /* allowEmpty */
  17132. )) {
  17133. let j = i;
  17134. let prev;
  17135. while (j--) {
  17136. prev = children[j];
  17137. if (!isCommentOrWhitespace(prev)) {
  17138. break;
  17139. }
  17140. }
  17141. if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
  17142. let conditional = dynamicSlots[dynamicSlots.length - 1];
  17143. while (conditional.alternate.type === 19) {
  17144. conditional = conditional.alternate;
  17145. }
  17146. conditional.alternate = vElse.exp ? createConditionalExpression(
  17147. vElse.exp,
  17148. buildDynamicSlot(
  17149. slotName,
  17150. slotFunction,
  17151. conditionalBranchIndex++
  17152. ),
  17153. defaultFallback
  17154. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  17155. } else {
  17156. context.onError(
  17157. createCompilerError(30, vElse.loc)
  17158. );
  17159. }
  17160. } else if (vFor) {
  17161. hasDynamicSlots = true;
  17162. const parseResult = vFor.forParseResult;
  17163. if (parseResult) {
  17164. finalizeForParseResult(parseResult, context);
  17165. dynamicSlots.push(
  17166. createCallExpression(context.helper(RENDER_LIST), [
  17167. parseResult.source,
  17168. createFunctionExpression(
  17169. createForLoopParams(parseResult),
  17170. buildDynamicSlot(slotName, slotFunction),
  17171. true
  17172. )
  17173. ])
  17174. );
  17175. } else {
  17176. context.onError(
  17177. createCompilerError(
  17178. 32,
  17179. vFor.loc
  17180. )
  17181. );
  17182. }
  17183. } else {
  17184. if (staticSlotName) {
  17185. if (seenSlotNames.has(staticSlotName)) {
  17186. context.onError(
  17187. createCompilerError(
  17188. 38,
  17189. dirLoc
  17190. )
  17191. );
  17192. continue;
  17193. }
  17194. seenSlotNames.add(staticSlotName);
  17195. if (staticSlotName === "default") {
  17196. hasNamedDefaultSlot = true;
  17197. }
  17198. }
  17199. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  17200. }
  17201. }
  17202. if (!onComponentSlot) {
  17203. const buildDefaultSlotProperty = (props, children2) => {
  17204. const fn = buildSlotFn(props, void 0, children2, loc);
  17205. return createObjectProperty(`default`, fn);
  17206. };
  17207. if (!hasTemplateSlots) {
  17208. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  17209. } else if (implicitDefaultChildren.length && // #3766
  17210. // with whitespace: 'preserve', whitespaces between slots will end up in
  17211. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  17212. !implicitDefaultChildren.every(isWhitespaceText)) {
  17213. if (hasNamedDefaultSlot) {
  17214. context.onError(
  17215. createCompilerError(
  17216. 39,
  17217. implicitDefaultChildren[0].loc
  17218. )
  17219. );
  17220. } else {
  17221. slotsProperties.push(
  17222. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  17223. );
  17224. }
  17225. }
  17226. }
  17227. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  17228. let slots = createObjectExpression(
  17229. slotsProperties.concat(
  17230. createObjectProperty(
  17231. `_`,
  17232. // 2 = compiled but dynamic = can skip normalization, but must run diff
  17233. // 1 = compiled and static = can skip normalization AND diff as optimized
  17234. createSimpleExpression(
  17235. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  17236. false
  17237. )
  17238. )
  17239. ),
  17240. loc
  17241. );
  17242. if (dynamicSlots.length) {
  17243. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  17244. slots,
  17245. createArrayExpression(dynamicSlots)
  17246. ]);
  17247. }
  17248. return {
  17249. slots,
  17250. hasDynamicSlots
  17251. };
  17252. }
  17253. function buildDynamicSlot(name, fn, index) {
  17254. const props = [
  17255. createObjectProperty(`name`, name),
  17256. createObjectProperty(`fn`, fn)
  17257. ];
  17258. if (index != null) {
  17259. props.push(
  17260. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  17261. );
  17262. }
  17263. return createObjectExpression(props);
  17264. }
  17265. function hasForwardedSlots(children) {
  17266. for (let i = 0; i < children.length; i++) {
  17267. const child = children[i];
  17268. switch (child.type) {
  17269. case 1:
  17270. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  17271. return true;
  17272. }
  17273. break;
  17274. case 9:
  17275. if (hasForwardedSlots(child.branches)) return true;
  17276. break;
  17277. case 10:
  17278. case 11:
  17279. if (hasForwardedSlots(child.children)) return true;
  17280. break;
  17281. }
  17282. }
  17283. return false;
  17284. }
  17285. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  17286. const transformElement = (node, context) => {
  17287. return function postTransformElement() {
  17288. node = context.currentNode;
  17289. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  17290. return;
  17291. }
  17292. const { tag, props } = node;
  17293. const isComponent = node.tagType === 1;
  17294. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  17295. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  17296. let vnodeProps;
  17297. let vnodeChildren;
  17298. let patchFlag = 0;
  17299. let vnodeDynamicProps;
  17300. let dynamicPropNames;
  17301. let vnodeDirectives;
  17302. let needsPatch = false;
  17303. let isBlockRequired = false;
  17304. let shouldUseBlock = (
  17305. // dynamic component may resolve to plain elements
  17306. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  17307. // updates inside get proper isSVG flag at runtime. (#639, #643)
  17308. // This is technically web-specific, but splitting the logic out of core
  17309. // leads to too much unnecessary complexity.
  17310. (tag === "svg" || tag === "foreignObject" || tag === "math")
  17311. );
  17312. if (props.length > 0) {
  17313. const propsBuildResult = buildProps(
  17314. node,
  17315. context,
  17316. void 0,
  17317. isComponent,
  17318. isDynamicComponent
  17319. );
  17320. vnodeProps = propsBuildResult.props;
  17321. patchFlag = propsBuildResult.patchFlag;
  17322. dynamicPropNames = propsBuildResult.dynamicPropNames;
  17323. needsPatch = propsBuildResult.needsPatch;
  17324. isBlockRequired = propsBuildResult.isBlockRequired;
  17325. const directives = propsBuildResult.directives;
  17326. vnodeDirectives = directives && directives.length ? createArrayExpression(
  17327. directives.map((dir) => buildDirectiveArgs(dir, context))
  17328. ) : void 0;
  17329. if (propsBuildResult.shouldUseBlock) {
  17330. shouldUseBlock = true;
  17331. }
  17332. }
  17333. if (node.children.length > 0) {
  17334. if (vnodeTag === KEEP_ALIVE) {
  17335. shouldUseBlock = true;
  17336. patchFlag |= 1024;
  17337. if (node.children.length > 1) {
  17338. context.onError(
  17339. createCompilerError(47, {
  17340. start: node.children[0].loc.start,
  17341. end: node.children[node.children.length - 1].loc.end,
  17342. source: ""
  17343. })
  17344. );
  17345. }
  17346. }
  17347. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  17348. vnodeTag !== TELEPORT && // explained above.
  17349. vnodeTag !== KEEP_ALIVE;
  17350. if (shouldBuildAsSlots) {
  17351. const { slots, hasDynamicSlots } = buildSlots(node, context);
  17352. vnodeChildren = slots;
  17353. if (hasDynamicSlots) {
  17354. patchFlag |= 1024;
  17355. }
  17356. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  17357. const child = node.children[0];
  17358. const type = child.type;
  17359. const hasDynamicTextChild = type === 5 || type === 8;
  17360. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  17361. patchFlag |= 1;
  17362. }
  17363. if (hasDynamicTextChild || type === 2) {
  17364. vnodeChildren = child;
  17365. } else {
  17366. vnodeChildren = node.children;
  17367. }
  17368. } else {
  17369. vnodeChildren = node.children;
  17370. }
  17371. }
  17372. if (dynamicPropNames && dynamicPropNames.length) {
  17373. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  17374. }
  17375. const vnodeCall = node.codegenNode = createVNodeCall(
  17376. context,
  17377. vnodeTag,
  17378. vnodeProps,
  17379. vnodeChildren,
  17380. patchFlag === 0 ? void 0 : patchFlag,
  17381. vnodeDynamicProps,
  17382. vnodeDirectives,
  17383. !!shouldUseBlock,
  17384. false,
  17385. isComponent,
  17386. node.loc
  17387. );
  17388. needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
  17389. if (needsPatch) {
  17390. vnodeCall.needsPatch = true;
  17391. }
  17392. if (isBlockRequired) {
  17393. vnodeCall.isBlockRequired = true;
  17394. }
  17395. };
  17396. };
  17397. function resolveComponentType(node, context, ssr = false) {
  17398. let { tag } = node;
  17399. const isExplicitDynamic = isComponentTag(tag);
  17400. const isProp = findProp(
  17401. node,
  17402. "is",
  17403. false,
  17404. true
  17405. /* allow empty */
  17406. );
  17407. if (isProp) {
  17408. if (isExplicitDynamic || false) {
  17409. let exp;
  17410. if (isProp.type === 6) {
  17411. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  17412. } else {
  17413. exp = isProp.exp;
  17414. if (!exp) {
  17415. exp = createSimpleExpression(`is`, false, isProp.arg.loc);
  17416. }
  17417. }
  17418. if (exp) {
  17419. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  17420. exp
  17421. ]);
  17422. }
  17423. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  17424. tag = isProp.value.content.slice(4);
  17425. }
  17426. }
  17427. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  17428. if (builtIn) {
  17429. if (!ssr) context.helper(builtIn);
  17430. return builtIn;
  17431. }
  17432. context.helper(RESOLVE_COMPONENT);
  17433. context.components.add(tag);
  17434. return toValidAssetId(tag, `component`);
  17435. }
  17436. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  17437. const { tag, loc: elementLoc, children } = node;
  17438. let properties = [];
  17439. const mergeArgs = [];
  17440. const runtimeDirectives = [];
  17441. const hasChildren = children.length > 0;
  17442. let shouldUseBlock = false;
  17443. let isBlockRequired = false;
  17444. let patchFlag = 0;
  17445. let hasRef = false;
  17446. let hasClassBinding = false;
  17447. let hasStyleBinding = false;
  17448. let hasHydrationEventBinding = false;
  17449. let hasDynamicKeys = false;
  17450. let hasVnodeHook = false;
  17451. const dynamicPropNames = [];
  17452. const pushMergeArg = (arg) => {
  17453. if (properties.length) {
  17454. mergeArgs.push(
  17455. createObjectExpression(dedupeProperties(properties), elementLoc)
  17456. );
  17457. properties = [];
  17458. }
  17459. if (arg) mergeArgs.push(arg);
  17460. };
  17461. const pushRefVForMarker = () => {
  17462. if (context.scopes.vFor > 0) {
  17463. properties.push(
  17464. createObjectProperty(
  17465. createSimpleExpression("ref_for", true),
  17466. createSimpleExpression("true")
  17467. )
  17468. );
  17469. }
  17470. };
  17471. const analyzePatchFlag = ({ key, value }) => {
  17472. if (isStaticExp(key)) {
  17473. const name = key.content;
  17474. const isEventHandler = isOn(name);
  17475. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  17476. // dedicated fast path.
  17477. name.toLowerCase() !== "onclick" && // omit v-model handlers
  17478. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  17479. !isReservedProp(name)) {
  17480. hasHydrationEventBinding = true;
  17481. }
  17482. if (isEventHandler && isReservedProp(name)) {
  17483. hasVnodeHook = true;
  17484. }
  17485. if (name === "ref") {
  17486. hasRef = true;
  17487. }
  17488. if (isEventHandler && value.type === 14) {
  17489. value = value.arguments[0];
  17490. }
  17491. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  17492. return;
  17493. }
  17494. if (name === "class") {
  17495. hasClassBinding = true;
  17496. } else if (name === "style") {
  17497. hasStyleBinding = true;
  17498. } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
  17499. dynamicPropNames.push(name);
  17500. }
  17501. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  17502. dynamicPropNames.push(name);
  17503. }
  17504. } else {
  17505. hasDynamicKeys = true;
  17506. }
  17507. };
  17508. for (let i = 0; i < props.length; i++) {
  17509. const prop = props[i];
  17510. if (prop.type === 6) {
  17511. const { loc, name, nameLoc, value } = prop;
  17512. let isStatic = true;
  17513. if (name === "ref") {
  17514. hasRef = true;
  17515. pushRefVForMarker();
  17516. }
  17517. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  17518. continue;
  17519. }
  17520. properties.push(
  17521. createObjectProperty(
  17522. createSimpleExpression(name, true, nameLoc),
  17523. createSimpleExpression(
  17524. value ? value.content : "",
  17525. isStatic,
  17526. value ? value.loc : loc
  17527. )
  17528. )
  17529. );
  17530. } else {
  17531. const { name, arg, exp, loc, modifiers } = prop;
  17532. const isVBind = name === "bind";
  17533. const isVOn = name === "on";
  17534. if (name === "slot") {
  17535. if (!isComponent) {
  17536. context.onError(
  17537. createCompilerError(40, loc)
  17538. );
  17539. }
  17540. continue;
  17541. }
  17542. if (name === "once" || name === "memo") {
  17543. continue;
  17544. }
  17545. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  17546. continue;
  17547. }
  17548. if (isVOn && ssr) {
  17549. continue;
  17550. }
  17551. if (isVBind && isStaticArgOf(arg, "key")) {
  17552. shouldUseBlock = true;
  17553. }
  17554. if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
  17555. shouldUseBlock = true;
  17556. isBlockRequired = true;
  17557. }
  17558. if (isVBind && isStaticArgOf(arg, "ref")) {
  17559. pushRefVForMarker();
  17560. }
  17561. if (!arg && (isVBind || isVOn)) {
  17562. hasDynamicKeys = true;
  17563. if (exp) {
  17564. if (isVBind) {
  17565. pushRefVForMarker();
  17566. pushMergeArg();
  17567. mergeArgs.push(exp);
  17568. } else {
  17569. pushMergeArg({
  17570. type: 14,
  17571. loc,
  17572. callee: context.helper(TO_HANDLERS),
  17573. arguments: isComponent ? [exp] : [exp, `true`]
  17574. });
  17575. }
  17576. } else {
  17577. context.onError(
  17578. createCompilerError(
  17579. isVBind ? 34 : 35,
  17580. loc
  17581. )
  17582. );
  17583. }
  17584. continue;
  17585. }
  17586. if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
  17587. patchFlag |= 32;
  17588. }
  17589. const directiveTransform = context.directiveTransforms[name];
  17590. if (directiveTransform) {
  17591. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  17592. !ssr && props2.forEach(analyzePatchFlag);
  17593. if (isVOn && arg && !isStaticExp(arg)) {
  17594. pushMergeArg(createObjectExpression(props2, elementLoc));
  17595. } else {
  17596. properties.push(...props2);
  17597. }
  17598. if (needRuntime) {
  17599. runtimeDirectives.push(prop);
  17600. if (isSymbol(needRuntime)) {
  17601. directiveImportMap.set(prop, needRuntime);
  17602. }
  17603. }
  17604. } else if (!isBuiltInDirective(name)) {
  17605. runtimeDirectives.push(prop);
  17606. if (hasChildren) {
  17607. shouldUseBlock = true;
  17608. isBlockRequired = true;
  17609. }
  17610. }
  17611. }
  17612. }
  17613. let propsExpression = void 0;
  17614. if (mergeArgs.length) {
  17615. pushMergeArg();
  17616. if (mergeArgs.length > 1) {
  17617. propsExpression = createCallExpression(
  17618. context.helper(MERGE_PROPS),
  17619. mergeArgs,
  17620. elementLoc
  17621. );
  17622. } else {
  17623. propsExpression = mergeArgs[0];
  17624. }
  17625. } else if (properties.length) {
  17626. propsExpression = createObjectExpression(
  17627. dedupeProperties(properties),
  17628. elementLoc
  17629. );
  17630. }
  17631. if (hasDynamicKeys) {
  17632. patchFlag |= 16;
  17633. } else {
  17634. if (hasClassBinding && !isComponent) {
  17635. patchFlag |= 2;
  17636. }
  17637. if (hasStyleBinding && !isComponent) {
  17638. patchFlag |= 4;
  17639. }
  17640. if (dynamicPropNames.length) {
  17641. patchFlag |= 8;
  17642. }
  17643. if (hasHydrationEventBinding) {
  17644. patchFlag |= 32;
  17645. }
  17646. }
  17647. const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
  17648. if (!shouldUseBlock && needsPatch) {
  17649. patchFlag |= 512;
  17650. }
  17651. if (!context.inSSR && propsExpression) {
  17652. switch (propsExpression.type) {
  17653. case 15:
  17654. let classKeyIndex = -1;
  17655. let styleKeyIndex = -1;
  17656. let hasDynamicKey = false;
  17657. for (let i = 0; i < propsExpression.properties.length; i++) {
  17658. const key = propsExpression.properties[i].key;
  17659. if (isStaticExp(key)) {
  17660. if (key.content === "class") {
  17661. classKeyIndex = i;
  17662. } else if (key.content === "style") {
  17663. styleKeyIndex = i;
  17664. }
  17665. } else if (!key.isHandlerKey) {
  17666. hasDynamicKey = true;
  17667. }
  17668. }
  17669. const classProp = propsExpression.properties[classKeyIndex];
  17670. const styleProp = propsExpression.properties[styleKeyIndex];
  17671. if (!hasDynamicKey) {
  17672. if (classProp && !isStaticExp(classProp.value)) {
  17673. classProp.value = createCallExpression(
  17674. context.helper(NORMALIZE_CLASS),
  17675. [classProp.value]
  17676. );
  17677. }
  17678. if (styleProp && // the static style is compiled into an object,
  17679. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  17680. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  17681. // v-bind:style with static literal object
  17682. styleProp.value.type === 17)) {
  17683. styleProp.value = createCallExpression(
  17684. context.helper(NORMALIZE_STYLE),
  17685. [styleProp.value]
  17686. );
  17687. }
  17688. } else {
  17689. propsExpression = createCallExpression(
  17690. context.helper(NORMALIZE_PROPS),
  17691. [propsExpression]
  17692. );
  17693. }
  17694. break;
  17695. case 14:
  17696. break;
  17697. default:
  17698. propsExpression = createCallExpression(
  17699. context.helper(NORMALIZE_PROPS),
  17700. [
  17701. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  17702. propsExpression
  17703. ])
  17704. ]
  17705. );
  17706. break;
  17707. }
  17708. }
  17709. return {
  17710. props: propsExpression,
  17711. directives: runtimeDirectives,
  17712. patchFlag,
  17713. dynamicPropNames,
  17714. shouldUseBlock,
  17715. needsPatch,
  17716. isBlockRequired
  17717. };
  17718. }
  17719. function dedupeProperties(properties) {
  17720. const knownProps = /* @__PURE__ */ new Map();
  17721. const deduped = [];
  17722. for (let i = 0; i < properties.length; i++) {
  17723. const prop = properties[i];
  17724. if (prop.key.type === 8 || !prop.key.isStatic) {
  17725. deduped.push(prop);
  17726. continue;
  17727. }
  17728. const name = prop.key.content;
  17729. const existing = knownProps.get(name);
  17730. if (existing) {
  17731. if (name === "style" || name === "class" || isOn(name)) {
  17732. mergeAsArray(existing, prop);
  17733. }
  17734. } else {
  17735. knownProps.set(name, prop);
  17736. deduped.push(prop);
  17737. }
  17738. }
  17739. return deduped;
  17740. }
  17741. function mergeAsArray(existing, incoming) {
  17742. if (existing.value.type === 17) {
  17743. existing.value.elements.push(incoming.value);
  17744. } else {
  17745. existing.value = createArrayExpression(
  17746. [existing.value, incoming.value],
  17747. existing.loc
  17748. );
  17749. }
  17750. }
  17751. function buildDirectiveArgs(dir, context) {
  17752. const dirArgs = [];
  17753. const runtime = directiveImportMap.get(dir);
  17754. if (runtime) {
  17755. dirArgs.push(context.helperString(runtime));
  17756. } else {
  17757. {
  17758. context.helper(RESOLVE_DIRECTIVE);
  17759. context.directives.add(dir.name);
  17760. dirArgs.push(toValidAssetId(dir.name, `directive`));
  17761. }
  17762. }
  17763. const { loc } = dir;
  17764. if (dir.exp) dirArgs.push(dir.exp);
  17765. if (dir.arg) {
  17766. if (!dir.exp) {
  17767. dirArgs.push(`void 0`);
  17768. }
  17769. dirArgs.push(dir.arg);
  17770. }
  17771. if (Object.keys(dir.modifiers).length) {
  17772. if (!dir.arg) {
  17773. if (!dir.exp) {
  17774. dirArgs.push(`void 0`);
  17775. }
  17776. dirArgs.push(`void 0`);
  17777. }
  17778. const trueExpression = createSimpleExpression(`true`, false, loc);
  17779. dirArgs.push(
  17780. createObjectExpression(
  17781. dir.modifiers.map(
  17782. (modifier) => createObjectProperty(modifier, trueExpression)
  17783. ),
  17784. loc
  17785. )
  17786. );
  17787. }
  17788. return createArrayExpression(dirArgs, dir.loc);
  17789. }
  17790. function stringifyDynamicPropNames(props) {
  17791. let propsNamesString = `[`;
  17792. for (let i = 0, l = props.length; i < l; i++) {
  17793. propsNamesString += JSON.stringify(props[i]);
  17794. if (i < l - 1) propsNamesString += ", ";
  17795. }
  17796. return propsNamesString + `]`;
  17797. }
  17798. function isComponentTag(tag) {
  17799. return tag === "component" || tag === "Component";
  17800. }
  17801. const transformSlotOutlet = (node, context) => {
  17802. if (isSlotOutlet(node)) {
  17803. const { children, loc } = node;
  17804. const { slotName, slotProps } = processSlotOutlet(node, context);
  17805. const slotArgs = [
  17806. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  17807. slotName,
  17808. "{}",
  17809. "undefined",
  17810. "true"
  17811. ];
  17812. let expectedLen = 2;
  17813. if (slotProps) {
  17814. slotArgs[2] = slotProps;
  17815. expectedLen = 3;
  17816. }
  17817. if (children.length) {
  17818. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  17819. expectedLen = 4;
  17820. }
  17821. if (context.scopeId && !context.slotted) {
  17822. expectedLen = 5;
  17823. }
  17824. slotArgs.splice(expectedLen);
  17825. node.codegenNode = createCallExpression(
  17826. context.helper(RENDER_SLOT),
  17827. slotArgs,
  17828. loc
  17829. );
  17830. }
  17831. };
  17832. function processSlotOutlet(node, context) {
  17833. let slotName = `"default"`;
  17834. let slotProps = void 0;
  17835. const nonNameProps = [];
  17836. for (let i = 0; i < node.props.length; i++) {
  17837. const p = node.props[i];
  17838. if (p.type === 6) {
  17839. if (p.value) {
  17840. if (p.name === "name") {
  17841. slotName = JSON.stringify(p.value.content);
  17842. } else {
  17843. p.name = camelize(p.name);
  17844. nonNameProps.push(p);
  17845. }
  17846. }
  17847. } else {
  17848. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  17849. if (p.exp) {
  17850. slotName = p.exp;
  17851. } else if (p.arg && p.arg.type === 4) {
  17852. const name = camelize(p.arg.content);
  17853. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  17854. }
  17855. } else {
  17856. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  17857. p.arg.content = camelize(p.arg.content);
  17858. }
  17859. nonNameProps.push(p);
  17860. }
  17861. }
  17862. }
  17863. if (nonNameProps.length > 0) {
  17864. const { props, directives } = buildProps(
  17865. node,
  17866. context,
  17867. nonNameProps,
  17868. false,
  17869. false
  17870. );
  17871. slotProps = props;
  17872. if (directives.length) {
  17873. context.onError(
  17874. createCompilerError(
  17875. 36,
  17876. directives[0].loc
  17877. )
  17878. );
  17879. }
  17880. }
  17881. return {
  17882. slotName,
  17883. slotProps
  17884. };
  17885. }
  17886. const transformOn$1 = (dir, node, context, augmentor) => {
  17887. const { loc, modifiers, arg } = dir;
  17888. if (!dir.exp && !modifiers.length) {
  17889. context.onError(createCompilerError(35, loc));
  17890. }
  17891. let eventName;
  17892. if (arg.type === 4) {
  17893. if (arg.isStatic) {
  17894. let rawName = arg.content;
  17895. if (rawName.startsWith("vnode")) {
  17896. context.onError(createCompilerError(52, arg.loc));
  17897. }
  17898. if (rawName.startsWith("vue:")) {
  17899. rawName = `vnode-${rawName.slice(4)}`;
  17900. }
  17901. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  17902. // for non-element and vnode lifecycle event listeners, auto convert
  17903. // it to camelCase. See issue #2249
  17904. toHandlerKey(camelize(rawName))
  17905. ) : (
  17906. // preserve case for plain element listeners that have uppercase
  17907. // letters, as these may be custom elements' custom events
  17908. `on:${rawName}`
  17909. );
  17910. eventName = createSimpleExpression(eventString, true, arg.loc);
  17911. } else {
  17912. eventName = createCompoundExpression([
  17913. `${context.helperString(TO_HANDLER_KEY)}(`,
  17914. arg,
  17915. `)`
  17916. ]);
  17917. }
  17918. } else {
  17919. eventName = arg;
  17920. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  17921. eventName.children.push(`)`);
  17922. }
  17923. let exp = dir.exp;
  17924. if (exp && !exp.content.trim()) {
  17925. exp = void 0;
  17926. }
  17927. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  17928. if (exp) {
  17929. const isMemberExp = isMemberExpression(exp);
  17930. const isInlineStatement = !(isMemberExp || isFnExpression(exp));
  17931. const hasMultipleStatements = exp.content.includes(`;`);
  17932. {
  17933. validateBrowserExpression(
  17934. exp,
  17935. context,
  17936. false,
  17937. hasMultipleStatements
  17938. );
  17939. }
  17940. if (isInlineStatement || shouldCache && isMemberExp) {
  17941. exp = createCompoundExpression([
  17942. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  17943. exp,
  17944. hasMultipleStatements ? `}` : `)`
  17945. ]);
  17946. }
  17947. }
  17948. let ret = {
  17949. props: [
  17950. createObjectProperty(
  17951. eventName,
  17952. exp || createSimpleExpression(`() => {}`, false, loc)
  17953. )
  17954. ]
  17955. };
  17956. if (augmentor) {
  17957. ret = augmentor(ret);
  17958. }
  17959. if (shouldCache) {
  17960. ret.props[0].value = context.cache(ret.props[0].value);
  17961. }
  17962. ret.props.forEach((p) => p.key.isHandlerKey = true);
  17963. return ret;
  17964. };
  17965. const transformBind = (dir, _node, context) => {
  17966. const { modifiers, loc } = dir;
  17967. const arg = dir.arg;
  17968. let { exp } = dir;
  17969. if (exp && exp.type === 4 && !exp.content.trim()) {
  17970. {
  17971. exp = void 0;
  17972. }
  17973. }
  17974. if (arg.type !== 4) {
  17975. arg.children.unshift(`(`);
  17976. arg.children.push(`) || ""`);
  17977. } else if (!arg.isStatic) {
  17978. arg.content = arg.content ? `${arg.content} || ""` : `""`;
  17979. }
  17980. if (modifiers.some((mod) => mod.content === "camel")) {
  17981. if (arg.type === 4) {
  17982. if (arg.isStatic) {
  17983. arg.content = camelize(arg.content);
  17984. } else {
  17985. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  17986. }
  17987. } else {
  17988. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  17989. arg.children.push(`)`);
  17990. }
  17991. }
  17992. if (!context.inSSR) {
  17993. if (modifiers.some((mod) => mod.content === "prop")) {
  17994. injectPrefix(arg, ".");
  17995. }
  17996. if (modifiers.some((mod) => mod.content === "attr")) {
  17997. injectPrefix(arg, "^");
  17998. }
  17999. }
  18000. return {
  18001. props: [createObjectProperty(arg, exp)]
  18002. };
  18003. };
  18004. const injectPrefix = (arg, prefix) => {
  18005. if (arg.type === 4) {
  18006. if (arg.isStatic) {
  18007. arg.content = prefix + arg.content;
  18008. } else {
  18009. arg.content = `\`${prefix}\${${arg.content}}\``;
  18010. }
  18011. } else {
  18012. arg.children.unshift(`'${prefix}' + (`);
  18013. arg.children.push(`)`);
  18014. }
  18015. };
  18016. const transformText = (node, context) => {
  18017. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  18018. return () => {
  18019. const children = node.children;
  18020. let currentContainer = void 0;
  18021. let hasText = false;
  18022. for (let i = 0; i < children.length; i++) {
  18023. const child = children[i];
  18024. if (isText$1(child)) {
  18025. hasText = true;
  18026. for (let j = i + 1; j < children.length; j++) {
  18027. const next = children[j];
  18028. if (isText$1(next)) {
  18029. if (!currentContainer) {
  18030. currentContainer = children[i] = createCompoundExpression(
  18031. [child],
  18032. child.loc
  18033. );
  18034. }
  18035. currentContainer.children.push(` + `, next);
  18036. children.splice(j, 1);
  18037. j--;
  18038. } else {
  18039. currentContainer = void 0;
  18040. break;
  18041. }
  18042. }
  18043. }
  18044. }
  18045. if (!hasText || // if this is a plain element with a single text child, leave it
  18046. // as-is since the runtime has dedicated fast path for this by directly
  18047. // setting textContent of the element.
  18048. // for component root it's always normalized anyway.
  18049. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  18050. // custom directives can potentially add DOM elements arbitrarily,
  18051. // we need to avoid setting textContent of the element at runtime
  18052. // to avoid accidentally overwriting the DOM elements added
  18053. // by the user through custom directives.
  18054. !node.props.find(
  18055. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  18056. ) && // in compat mode, <template> tags with no special directives
  18057. // will be rendered as a fragment so its children must be
  18058. // converted into vnodes.
  18059. true)) {
  18060. return;
  18061. }
  18062. for (let i = 0; i < children.length; i++) {
  18063. const child = children[i];
  18064. if (isText$1(child) || child.type === 8) {
  18065. const callArgs = [];
  18066. if (child.type !== 2 || child.content !== " ") {
  18067. callArgs.push(child);
  18068. }
  18069. if (!context.ssr && getConstantType(child, context) === 0) {
  18070. callArgs.push(
  18071. 1 + (` /* ${PatchFlagNames[1]} */` )
  18072. );
  18073. }
  18074. children[i] = {
  18075. type: 12,
  18076. content: child,
  18077. loc: child.loc,
  18078. codegenNode: createCallExpression(
  18079. context.helper(CREATE_TEXT),
  18080. callArgs
  18081. )
  18082. };
  18083. }
  18084. }
  18085. };
  18086. }
  18087. };
  18088. const seen$1 = /* @__PURE__ */ new WeakSet();
  18089. const transformOnce = (node, context) => {
  18090. if (node.type === 1 && findDir(node, "once", true)) {
  18091. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  18092. return;
  18093. }
  18094. seen$1.add(node);
  18095. context.inVOnce = true;
  18096. context.helper(SET_BLOCK_TRACKING);
  18097. return () => {
  18098. context.inVOnce = false;
  18099. const cur = context.currentNode;
  18100. if (cur.codegenNode) {
  18101. cur.codegenNode = context.cache(
  18102. cur.codegenNode,
  18103. true,
  18104. true
  18105. );
  18106. }
  18107. };
  18108. }
  18109. };
  18110. const transformModel$1 = (dir, node, context) => {
  18111. const { exp, arg } = dir;
  18112. if (!exp) {
  18113. context.onError(
  18114. createCompilerError(41, dir.loc)
  18115. );
  18116. return createTransformProps();
  18117. }
  18118. const rawExp = exp.loc.source.trim();
  18119. const expString = exp.type === 4 ? exp.content : rawExp;
  18120. const bindingType = context.bindingMetadata[rawExp];
  18121. if (bindingType === "props" || bindingType === "props-aliased") {
  18122. context.onError(createCompilerError(44, exp.loc));
  18123. return createTransformProps();
  18124. }
  18125. if (bindingType === "literal-const" || bindingType === "setup-const") {
  18126. context.onError(createCompilerError(45, exp.loc));
  18127. return createTransformProps();
  18128. }
  18129. if (!expString.trim() || !isMemberExpression(exp) && true) {
  18130. context.onError(
  18131. createCompilerError(42, exp.loc)
  18132. );
  18133. return createTransformProps();
  18134. }
  18135. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  18136. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  18137. let assignmentExp;
  18138. const eventArg = context.isTS ? `($event: any)` : `$event`;
  18139. {
  18140. assignmentExp = createCompoundExpression([
  18141. `${eventArg} => ((`,
  18142. exp,
  18143. `) = $event)`
  18144. ]);
  18145. }
  18146. const props = [
  18147. // modelValue: foo
  18148. createObjectProperty(propName, dir.exp),
  18149. // "onUpdate:modelValue": $event => (foo = $event)
  18150. createObjectProperty(eventName, assignmentExp)
  18151. ];
  18152. if (dir.modifiers.length && node.tagType === 1) {
  18153. const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  18154. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  18155. props.push(
  18156. createObjectProperty(
  18157. modifiersKey,
  18158. createSimpleExpression(
  18159. `{ ${modifiers} }`,
  18160. false,
  18161. dir.loc,
  18162. 2
  18163. )
  18164. )
  18165. );
  18166. }
  18167. return createTransformProps(props);
  18168. };
  18169. function createTransformProps(props = []) {
  18170. return { props };
  18171. }
  18172. const seen = /* @__PURE__ */ new WeakSet();
  18173. const transformMemo = (node, context) => {
  18174. if (node.type === 1) {
  18175. const dir = findDir(node, "memo");
  18176. if (!dir || seen.has(node) || context.inSSR) {
  18177. return;
  18178. }
  18179. seen.add(node);
  18180. return () => {
  18181. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  18182. if (codegenNode && codegenNode.type === 13) {
  18183. if (node.tagType !== 1) {
  18184. convertToBlock(codegenNode, context);
  18185. }
  18186. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  18187. dir.exp,
  18188. createFunctionExpression(void 0, codegenNode),
  18189. `_cache`,
  18190. String(context.cached.length)
  18191. ]);
  18192. context.cached.push(null);
  18193. }
  18194. };
  18195. }
  18196. };
  18197. const transformVBindShorthand = (node, context) => {
  18198. if (node.type === 1) {
  18199. for (const prop of node.props) {
  18200. if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
  18201. prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
  18202. const arg = prop.arg;
  18203. if (arg.type !== 4 || !arg.isStatic) {
  18204. context.onError(
  18205. createCompilerError(
  18206. 53,
  18207. arg.loc
  18208. )
  18209. );
  18210. prop.exp = createSimpleExpression("", true, arg.loc);
  18211. } else {
  18212. const propName = camelize(arg.content);
  18213. if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
  18214. propName[0] === "-") {
  18215. prop.exp = createSimpleExpression(propName, false, arg.loc);
  18216. }
  18217. }
  18218. }
  18219. }
  18220. }
  18221. };
  18222. function getBaseTransformPreset(prefixIdentifiers) {
  18223. return [
  18224. [
  18225. transformVBindShorthand,
  18226. transformOnce,
  18227. transformIf,
  18228. transformMemo,
  18229. transformFor,
  18230. ...[],
  18231. ...[transformExpression] ,
  18232. transformSlotOutlet,
  18233. transformElement,
  18234. trackSlotScopes,
  18235. transformText
  18236. ],
  18237. {
  18238. on: transformOn$1,
  18239. bind: transformBind,
  18240. model: transformModel$1
  18241. }
  18242. ];
  18243. }
  18244. function baseCompile(source, options = {}) {
  18245. const onError = options.onError || defaultOnError;
  18246. const isModuleMode = options.mode === "module";
  18247. {
  18248. if (options.prefixIdentifiers === true) {
  18249. onError(createCompilerError(48));
  18250. } else if (isModuleMode) {
  18251. onError(createCompilerError(49));
  18252. }
  18253. }
  18254. const prefixIdentifiers = false;
  18255. if (options.cacheHandlers) {
  18256. onError(createCompilerError(50));
  18257. }
  18258. if (options.scopeId && !isModuleMode) {
  18259. onError(createCompilerError(51));
  18260. }
  18261. const resolvedOptions = extend({}, options, {
  18262. prefixIdentifiers
  18263. });
  18264. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  18265. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  18266. transform(
  18267. ast,
  18268. extend({}, resolvedOptions, {
  18269. nodeTransforms: [
  18270. ...nodeTransforms,
  18271. ...options.nodeTransforms || []
  18272. // user transforms
  18273. ],
  18274. directiveTransforms: extend(
  18275. {},
  18276. directiveTransforms,
  18277. options.directiveTransforms || {}
  18278. // user transforms
  18279. )
  18280. })
  18281. );
  18282. return generate(ast, resolvedOptions);
  18283. }
  18284. const noopDirectiveTransform = () => ({ props: [] });
  18285. const V_MODEL_RADIO = /* @__PURE__ */ Symbol(`vModelRadio` );
  18286. const V_MODEL_CHECKBOX = /* @__PURE__ */ Symbol(
  18287. `vModelCheckbox`
  18288. );
  18289. const V_MODEL_TEXT = /* @__PURE__ */ Symbol(`vModelText` );
  18290. const V_MODEL_SELECT = /* @__PURE__ */ Symbol(
  18291. `vModelSelect`
  18292. );
  18293. const V_MODEL_DYNAMIC = /* @__PURE__ */ Symbol(
  18294. `vModelDynamic`
  18295. );
  18296. const V_ON_WITH_MODIFIERS = /* @__PURE__ */ Symbol(
  18297. `vOnModifiersGuard`
  18298. );
  18299. const V_ON_WITH_KEYS = /* @__PURE__ */ Symbol(
  18300. `vOnKeysGuard`
  18301. );
  18302. const V_SHOW = /* @__PURE__ */ Symbol(`vShow` );
  18303. const TRANSITION = /* @__PURE__ */ Symbol(`Transition` );
  18304. const TRANSITION_GROUP = /* @__PURE__ */ Symbol(
  18305. `TransitionGroup`
  18306. );
  18307. registerRuntimeHelpers({
  18308. [V_MODEL_RADIO]: `vModelRadio`,
  18309. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  18310. [V_MODEL_TEXT]: `vModelText`,
  18311. [V_MODEL_SELECT]: `vModelSelect`,
  18312. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  18313. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  18314. [V_ON_WITH_KEYS]: `withKeys`,
  18315. [V_SHOW]: `vShow`,
  18316. [TRANSITION]: `Transition`,
  18317. [TRANSITION_GROUP]: `TransitionGroup`
  18318. });
  18319. let decoder;
  18320. function decodeHtmlBrowser(raw, asAttr = false) {
  18321. if (!decoder) {
  18322. decoder = document.createElement("div");
  18323. }
  18324. if (asAttr) {
  18325. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  18326. return decoder.children[0].getAttribute("foo");
  18327. } else {
  18328. decoder.innerHTML = raw;
  18329. return decoder.textContent;
  18330. }
  18331. }
  18332. const parserOptions = {
  18333. parseMode: "html",
  18334. isVoidTag,
  18335. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  18336. isPreTag: (tag) => tag === "pre",
  18337. isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
  18338. decodeEntities: decodeHtmlBrowser ,
  18339. isBuiltInComponent: (tag) => {
  18340. if (tag === "Transition" || tag === "transition") {
  18341. return TRANSITION;
  18342. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  18343. return TRANSITION_GROUP;
  18344. }
  18345. },
  18346. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  18347. getNamespace(tag, parent, rootNamespace) {
  18348. let ns = parent ? parent.ns : rootNamespace;
  18349. if (parent && ns === 2) {
  18350. if (parent.tag === "annotation-xml") {
  18351. if (tag === "svg") {
  18352. return 1;
  18353. }
  18354. if (parent.props.some(
  18355. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  18356. )) {
  18357. ns = 0;
  18358. }
  18359. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  18360. ns = 0;
  18361. }
  18362. } else if (parent && ns === 1) {
  18363. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  18364. ns = 0;
  18365. }
  18366. }
  18367. if (ns === 0) {
  18368. if (tag === "svg") {
  18369. return 1;
  18370. }
  18371. if (tag === "math") {
  18372. return 2;
  18373. }
  18374. }
  18375. return ns;
  18376. }
  18377. };
  18378. const transformStyle = (node) => {
  18379. if (node.type === 1) {
  18380. node.props.forEach((p, i) => {
  18381. if (p.type === 6 && p.name === "style" && p.value) {
  18382. node.props[i] = {
  18383. type: 7,
  18384. name: `bind`,
  18385. arg: createSimpleExpression(`style`, true, p.loc),
  18386. exp: parseInlineCSS(p.value.content, p.loc),
  18387. modifiers: [],
  18388. loc: p.loc
  18389. };
  18390. }
  18391. });
  18392. }
  18393. };
  18394. const parseInlineCSS = (cssText, loc) => {
  18395. const normalized = parseStringStyle(cssText);
  18396. return createSimpleExpression(
  18397. JSON.stringify(normalized),
  18398. false,
  18399. loc,
  18400. 3
  18401. );
  18402. };
  18403. function createDOMCompilerError(code, loc) {
  18404. return createCompilerError(
  18405. code,
  18406. loc,
  18407. DOMErrorMessages
  18408. );
  18409. }
  18410. const DOMErrorMessages = {
  18411. [54]: `v-html is missing expression.`,
  18412. [55]: `v-html will override element children.`,
  18413. [56]: `v-text is missing expression.`,
  18414. [57]: `v-text will override element children.`,
  18415. [58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  18416. [59]: `v-model argument is not supported on plain elements.`,
  18417. [60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  18418. [61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  18419. [62]: `v-show is missing expression.`,
  18420. [63]: `<Transition> expects exactly one child element or component.`,
  18421. [64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  18422. };
  18423. const transformVHtml = (dir, node, context) => {
  18424. const { exp, loc } = dir;
  18425. if (!exp) {
  18426. context.onError(
  18427. createDOMCompilerError(54, loc)
  18428. );
  18429. }
  18430. if (node.children.length) {
  18431. context.onError(
  18432. createDOMCompilerError(55, loc)
  18433. );
  18434. node.children.length = 0;
  18435. }
  18436. return {
  18437. props: [
  18438. createObjectProperty(
  18439. createSimpleExpression(`innerHTML`, true, loc),
  18440. exp || createSimpleExpression("", true)
  18441. )
  18442. ]
  18443. };
  18444. };
  18445. const transformVText = (dir, node, context) => {
  18446. const { exp, loc } = dir;
  18447. if (!exp) {
  18448. context.onError(
  18449. createDOMCompilerError(56, loc)
  18450. );
  18451. }
  18452. if (node.children.length) {
  18453. context.onError(
  18454. createDOMCompilerError(57, loc)
  18455. );
  18456. node.children.length = 0;
  18457. }
  18458. return {
  18459. props: [
  18460. createObjectProperty(
  18461. createSimpleExpression(`textContent`, true),
  18462. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  18463. context.helperString(TO_DISPLAY_STRING),
  18464. [exp],
  18465. loc
  18466. ) : createSimpleExpression("", true)
  18467. )
  18468. ]
  18469. };
  18470. };
  18471. const transformModel = (dir, node, context) => {
  18472. const baseResult = transformModel$1(dir, node, context);
  18473. if (!baseResult.props.length || node.tagType === 1) {
  18474. return baseResult;
  18475. }
  18476. if (dir.arg) {
  18477. context.onError(
  18478. createDOMCompilerError(
  18479. 59,
  18480. dir.arg.loc
  18481. )
  18482. );
  18483. }
  18484. function checkDuplicatedValue() {
  18485. const value = findDir(node, "bind");
  18486. if (value && isStaticArgOf(value.arg, "value")) {
  18487. context.onError(
  18488. createDOMCompilerError(
  18489. 61,
  18490. value.loc
  18491. )
  18492. );
  18493. }
  18494. }
  18495. const { tag } = node;
  18496. const isCustomElement = context.isCustomElement(tag);
  18497. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  18498. let directiveToUse = V_MODEL_TEXT;
  18499. let isInvalidType = false;
  18500. if (tag === "input" || isCustomElement) {
  18501. const type = findProp(node, `type`);
  18502. if (type) {
  18503. if (type.type === 7) {
  18504. directiveToUse = V_MODEL_DYNAMIC;
  18505. } else if (type.value) {
  18506. switch (type.value.content) {
  18507. case "radio":
  18508. directiveToUse = V_MODEL_RADIO;
  18509. break;
  18510. case "checkbox":
  18511. directiveToUse = V_MODEL_CHECKBOX;
  18512. break;
  18513. case "file":
  18514. isInvalidType = true;
  18515. context.onError(
  18516. createDOMCompilerError(
  18517. 60,
  18518. dir.loc
  18519. )
  18520. );
  18521. break;
  18522. default:
  18523. checkDuplicatedValue();
  18524. break;
  18525. }
  18526. }
  18527. } else if (hasDynamicKeyVBind(node)) {
  18528. directiveToUse = V_MODEL_DYNAMIC;
  18529. } else {
  18530. checkDuplicatedValue();
  18531. }
  18532. } else if (tag === "select") {
  18533. directiveToUse = V_MODEL_SELECT;
  18534. } else {
  18535. checkDuplicatedValue();
  18536. }
  18537. if (!isInvalidType) {
  18538. baseResult.needRuntime = context.helper(directiveToUse);
  18539. }
  18540. } else {
  18541. context.onError(
  18542. createDOMCompilerError(
  18543. 58,
  18544. dir.loc
  18545. )
  18546. );
  18547. }
  18548. baseResult.props = baseResult.props.filter(
  18549. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  18550. );
  18551. return baseResult;
  18552. };
  18553. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  18554. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  18555. // event propagation management
  18556. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  18557. );
  18558. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  18559. const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
  18560. const resolveModifiers = (key, modifiers, context, loc) => {
  18561. const keyModifiers = [];
  18562. const nonKeyModifiers = [];
  18563. const eventOptionModifiers = [];
  18564. for (let i = 0; i < modifiers.length; i++) {
  18565. const modifier = modifiers[i].content;
  18566. if (isEventOptionModifier(modifier)) {
  18567. eventOptionModifiers.push(modifier);
  18568. } else {
  18569. if (maybeKeyModifier(modifier)) {
  18570. if (isStaticExp(key)) {
  18571. if (isKeyboardEvent(key.content.toLowerCase())) {
  18572. keyModifiers.push(modifier);
  18573. } else {
  18574. nonKeyModifiers.push(modifier);
  18575. }
  18576. } else {
  18577. keyModifiers.push(modifier);
  18578. nonKeyModifiers.push(modifier);
  18579. }
  18580. } else {
  18581. if (isNonKeyModifier(modifier)) {
  18582. nonKeyModifiers.push(modifier);
  18583. } else {
  18584. keyModifiers.push(modifier);
  18585. }
  18586. }
  18587. }
  18588. }
  18589. return {
  18590. keyModifiers,
  18591. nonKeyModifiers,
  18592. eventOptionModifiers
  18593. };
  18594. };
  18595. const transformClick = (key, event) => {
  18596. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  18597. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  18598. `(`,
  18599. key,
  18600. `) === "onClick" ? "${event}" : (`,
  18601. key,
  18602. `)`
  18603. ]) : key;
  18604. };
  18605. const transformOn = (dir, node, context) => {
  18606. return transformOn$1(dir, node, context, (baseResult) => {
  18607. const { modifiers } = dir;
  18608. if (!modifiers.length) return baseResult;
  18609. let { key, value: handlerExp } = baseResult.props[0];
  18610. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  18611. if (nonKeyModifiers.includes("right")) {
  18612. key = transformClick(key, `onContextmenu`);
  18613. }
  18614. if (nonKeyModifiers.includes("middle")) {
  18615. key = transformClick(key, `onMouseup`);
  18616. }
  18617. if (nonKeyModifiers.length) {
  18618. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  18619. handlerExp,
  18620. JSON.stringify(nonKeyModifiers)
  18621. ]);
  18622. }
  18623. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  18624. (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
  18625. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  18626. handlerExp,
  18627. JSON.stringify(keyModifiers)
  18628. ]);
  18629. }
  18630. if (eventOptionModifiers.length) {
  18631. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  18632. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  18633. }
  18634. return {
  18635. props: [createObjectProperty(key, handlerExp)]
  18636. };
  18637. });
  18638. };
  18639. const transformShow = (dir, node, context) => {
  18640. const { exp, loc } = dir;
  18641. if (!exp) {
  18642. context.onError(
  18643. createDOMCompilerError(62, loc)
  18644. );
  18645. }
  18646. return {
  18647. props: [],
  18648. needRuntime: context.helper(V_SHOW)
  18649. };
  18650. };
  18651. const transformTransition = (node, context) => {
  18652. if (node.type === 1 && node.tagType === 1) {
  18653. const component = context.isBuiltInComponent(node.tag);
  18654. if (component === TRANSITION) {
  18655. return () => {
  18656. if (!node.children.length) {
  18657. return;
  18658. }
  18659. if (hasMultipleChildren(node)) {
  18660. context.onError(
  18661. createDOMCompilerError(
  18662. 63,
  18663. {
  18664. start: node.children[0].loc.start,
  18665. end: node.children[node.children.length - 1].loc.end,
  18666. source: ""
  18667. }
  18668. )
  18669. );
  18670. }
  18671. const child = node.children[0];
  18672. if (child.type === 1) {
  18673. for (const p of child.props) {
  18674. if (p.type === 7 && p.name === "show") {
  18675. node.props.push({
  18676. type: 6,
  18677. name: "persisted",
  18678. nameLoc: node.loc,
  18679. value: void 0,
  18680. loc: node.loc
  18681. });
  18682. }
  18683. }
  18684. }
  18685. };
  18686. }
  18687. }
  18688. };
  18689. function hasMultipleChildren(node) {
  18690. const children = node.children = node.children.filter(
  18691. (c) => !isCommentOrWhitespace(c)
  18692. );
  18693. const child = children[0];
  18694. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  18695. }
  18696. const ignoreSideEffectTags = (node, context) => {
  18697. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  18698. context.onError(
  18699. createDOMCompilerError(
  18700. 64,
  18701. node.loc
  18702. )
  18703. );
  18704. context.removeNode();
  18705. }
  18706. };
  18707. function isValidHTMLNesting(parent, child) {
  18708. if (parent === "template") {
  18709. return true;
  18710. }
  18711. if (parent in onlyValidChildren) {
  18712. return onlyValidChildren[parent].has(child);
  18713. }
  18714. if (child in onlyValidParents) {
  18715. return onlyValidParents[child].has(parent);
  18716. }
  18717. if (parent in knownInvalidChildren) {
  18718. if (knownInvalidChildren[parent].has(child)) return false;
  18719. }
  18720. if (child in knownInvalidParents) {
  18721. if (knownInvalidParents[child].has(parent)) return false;
  18722. }
  18723. return true;
  18724. }
  18725. const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
  18726. const emptySet = /* @__PURE__ */ new Set([]);
  18727. const onlyValidChildren = {
  18728. head: /* @__PURE__ */ new Set([
  18729. "base",
  18730. "basefront",
  18731. "bgsound",
  18732. "link",
  18733. "meta",
  18734. "title",
  18735. "noscript",
  18736. "noframes",
  18737. "style",
  18738. "script",
  18739. "template"
  18740. ]),
  18741. optgroup: /* @__PURE__ */ new Set(["option"]),
  18742. select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
  18743. // table
  18744. table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
  18745. tr: /* @__PURE__ */ new Set(["td", "th"]),
  18746. colgroup: /* @__PURE__ */ new Set(["col"]),
  18747. tbody: /* @__PURE__ */ new Set(["tr"]),
  18748. thead: /* @__PURE__ */ new Set(["tr"]),
  18749. tfoot: /* @__PURE__ */ new Set(["tr"]),
  18750. // these elements can not have any children elements
  18751. script: emptySet,
  18752. iframe: emptySet,
  18753. option: emptySet,
  18754. textarea: emptySet,
  18755. style: emptySet,
  18756. title: emptySet
  18757. };
  18758. const onlyValidParents = {
  18759. // sections
  18760. html: emptySet,
  18761. body: /* @__PURE__ */ new Set(["html"]),
  18762. head: /* @__PURE__ */ new Set(["html"]),
  18763. // table
  18764. td: /* @__PURE__ */ new Set(["tr"]),
  18765. colgroup: /* @__PURE__ */ new Set(["table"]),
  18766. caption: /* @__PURE__ */ new Set(["table"]),
  18767. tbody: /* @__PURE__ */ new Set(["table"]),
  18768. tfoot: /* @__PURE__ */ new Set(["table"]),
  18769. col: /* @__PURE__ */ new Set(["colgroup"]),
  18770. th: /* @__PURE__ */ new Set(["tr"]),
  18771. thead: /* @__PURE__ */ new Set(["table"]),
  18772. tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
  18773. // data list
  18774. dd: /* @__PURE__ */ new Set(["dl", "div"]),
  18775. dt: /* @__PURE__ */ new Set(["dl", "div"]),
  18776. // other
  18777. figcaption: /* @__PURE__ */ new Set(["figure"]),
  18778. // li: new Set(["ul", "ol"]),
  18779. summary: /* @__PURE__ */ new Set(["details"]),
  18780. area: /* @__PURE__ */ new Set(["map"])
  18781. };
  18782. const knownInvalidChildren = {
  18783. p: /* @__PURE__ */ new Set([
  18784. "address",
  18785. "article",
  18786. "aside",
  18787. "blockquote",
  18788. "center",
  18789. "details",
  18790. "dialog",
  18791. "dir",
  18792. "div",
  18793. "dl",
  18794. "fieldset",
  18795. "figure",
  18796. "footer",
  18797. "form",
  18798. "h1",
  18799. "h2",
  18800. "h3",
  18801. "h4",
  18802. "h5",
  18803. "h6",
  18804. "header",
  18805. "hgroup",
  18806. "hr",
  18807. "li",
  18808. "main",
  18809. "nav",
  18810. "menu",
  18811. "ol",
  18812. "p",
  18813. "pre",
  18814. "section",
  18815. "table",
  18816. "ul"
  18817. ]),
  18818. svg: /* @__PURE__ */ new Set([
  18819. "b",
  18820. "blockquote",
  18821. "br",
  18822. "code",
  18823. "dd",
  18824. "div",
  18825. "dl",
  18826. "dt",
  18827. "em",
  18828. "embed",
  18829. "h1",
  18830. "h2",
  18831. "h3",
  18832. "h4",
  18833. "h5",
  18834. "h6",
  18835. "hr",
  18836. "i",
  18837. "img",
  18838. "li",
  18839. "menu",
  18840. "meta",
  18841. "ol",
  18842. "p",
  18843. "pre",
  18844. "ruby",
  18845. "s",
  18846. "small",
  18847. "span",
  18848. "strong",
  18849. "sub",
  18850. "sup",
  18851. "table",
  18852. "u",
  18853. "ul",
  18854. "var"
  18855. ])
  18856. };
  18857. const knownInvalidParents = {
  18858. a: /* @__PURE__ */ new Set(["a"]),
  18859. button: /* @__PURE__ */ new Set(["button"]),
  18860. dd: /* @__PURE__ */ new Set(["dd", "dt"]),
  18861. dt: /* @__PURE__ */ new Set(["dd", "dt"]),
  18862. form: /* @__PURE__ */ new Set(["form"]),
  18863. li: /* @__PURE__ */ new Set(["li"]),
  18864. h1: headings,
  18865. h2: headings,
  18866. h3: headings,
  18867. h4: headings,
  18868. h5: headings,
  18869. h6: headings
  18870. };
  18871. const validateHtmlNesting = (node, context) => {
  18872. if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
  18873. const error = new SyntaxError(
  18874. `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
  18875. );
  18876. error.loc = node.loc;
  18877. context.onWarn(error);
  18878. }
  18879. };
  18880. const DOMNodeTransforms = [
  18881. transformStyle,
  18882. ...[transformTransition, validateHtmlNesting]
  18883. ];
  18884. const DOMDirectiveTransforms = {
  18885. cloak: noopDirectiveTransform,
  18886. html: transformVHtml,
  18887. text: transformVText,
  18888. model: transformModel,
  18889. // override compiler-core
  18890. on: transformOn,
  18891. // override compiler-core
  18892. show: transformShow
  18893. };
  18894. function compile(src, options = {}) {
  18895. return baseCompile(
  18896. src,
  18897. extend({}, parserOptions, options, {
  18898. nodeTransforms: [
  18899. // ignore <script> and <tag>
  18900. // this is not put inside DOMNodeTransforms because that list is used
  18901. // by compiler-ssr to generate vnode fallback branches
  18902. ignoreSideEffectTags,
  18903. ...DOMNodeTransforms,
  18904. ...options.nodeTransforms || []
  18905. ],
  18906. directiveTransforms: extend(
  18907. {},
  18908. DOMDirectiveTransforms,
  18909. options.directiveTransforms || {}
  18910. ),
  18911. transformHoist: null
  18912. })
  18913. );
  18914. }
  18915. {
  18916. initDev();
  18917. }
  18918. const compileCache = /* @__PURE__ */ Object.create(null);
  18919. function compileToFunction(template, options) {
  18920. if (!isString(template)) {
  18921. if (template.nodeType) {
  18922. template = template.innerHTML;
  18923. } else {
  18924. warn(`invalid template option: `, template);
  18925. return NOOP;
  18926. }
  18927. }
  18928. const key = genCacheKey(template, options);
  18929. const cached = compileCache[key];
  18930. if (cached) {
  18931. return cached;
  18932. }
  18933. if (template[0] === "#") {
  18934. const el = document.querySelector(template);
  18935. if (!el) {
  18936. warn(`Template element not found or is empty: ${template}`);
  18937. }
  18938. template = el ? el.innerHTML : ``;
  18939. }
  18940. const opts = extend(
  18941. {
  18942. hoistStatic: true,
  18943. onError: onError ,
  18944. onWarn: (e) => onError(e, true)
  18945. },
  18946. options
  18947. );
  18948. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  18949. opts.isCustomElement = (tag) => !!customElements.get(tag);
  18950. }
  18951. const { code } = compile(template, opts);
  18952. function onError(err, asWarning = false) {
  18953. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  18954. const codeFrame = err.loc && generateCodeFrame(
  18955. template,
  18956. err.loc.start.offset,
  18957. err.loc.end.offset
  18958. );
  18959. warn(codeFrame ? `${message}
  18960. ${codeFrame}` : message);
  18961. }
  18962. const render = new Function("Vue", code)(runtimeDom);
  18963. render._rc = true;
  18964. return compileCache[key] = render;
  18965. }
  18966. registerRuntimeCompiler(compileToFunction);
  18967. 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, getCurrentWatcher, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, nodeOps, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, patchProp, 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, useHost, useId, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };