vue.esm-browser.js 517 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159
  1. /**
  2. * vue v3.5.12
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. /*! #__NO_SIDE_EFFECTS__ */
  7. // @__NO_SIDE_EFFECTS__
  8. function makeMap(str) {
  9. const map = /* @__PURE__ */ Object.create(null);
  10. for (const key of str.split(",")) map[key] = 1;
  11. return (val) => val in map;
  12. }
  13. const EMPTY_OBJ = Object.freeze({}) ;
  14. const EMPTY_ARR = Object.freeze([]) ;
  15. const NOOP = () => {
  16. };
  17. const NO = () => false;
  18. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  19. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  20. const isModelListener = (key) => key.startsWith("onUpdate:");
  21. const extend = Object.assign;
  22. const remove = (arr, el) => {
  23. const i = arr.indexOf(el);
  24. if (i > -1) {
  25. arr.splice(i, 1);
  26. }
  27. };
  28. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  29. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  30. const isArray = Array.isArray;
  31. const isMap = (val) => toTypeString(val) === "[object Map]";
  32. const isSet = (val) => toTypeString(val) === "[object Set]";
  33. const isDate = (val) => toTypeString(val) === "[object Date]";
  34. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  35. const isFunction = (val) => typeof val === "function";
  36. const isString = (val) => typeof val === "string";
  37. const isSymbol = (val) => typeof val === "symbol";
  38. const isObject = (val) => val !== null && typeof val === "object";
  39. const isPromise = (val) => {
  40. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  41. };
  42. const objectToString = Object.prototype.toString;
  43. const toTypeString = (value) => objectToString.call(value);
  44. const toRawType = (value) => {
  45. return toTypeString(value).slice(8, -1);
  46. };
  47. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  48. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  49. const isReservedProp = /* @__PURE__ */ makeMap(
  50. // the leading comma is intentional so empty string "" is also included
  51. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  52. );
  53. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  54. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  55. );
  56. const cacheStringFunction = (fn) => {
  57. const cache = /* @__PURE__ */ Object.create(null);
  58. return (str) => {
  59. const hit = cache[str];
  60. return hit || (cache[str] = fn(str));
  61. };
  62. };
  63. const camelizeRE = /-(\w)/g;
  64. const camelize = cacheStringFunction(
  65. (str) => {
  66. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  67. }
  68. );
  69. const hyphenateRE = /\B([A-Z])/g;
  70. const hyphenate = cacheStringFunction(
  71. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  72. );
  73. const capitalize = cacheStringFunction((str) => {
  74. return str.charAt(0).toUpperCase() + str.slice(1);
  75. });
  76. const toHandlerKey = cacheStringFunction(
  77. (str) => {
  78. const s = str ? `on${capitalize(str)}` : ``;
  79. return s;
  80. }
  81. );
  82. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  83. const invokeArrayFns = (fns, ...arg) => {
  84. for (let i = 0; i < fns.length; i++) {
  85. fns[i](...arg);
  86. }
  87. };
  88. const def = (obj, key, value, writable = false) => {
  89. Object.defineProperty(obj, key, {
  90. configurable: true,
  91. enumerable: false,
  92. writable,
  93. value
  94. });
  95. };
  96. const looseToNumber = (val) => {
  97. const n = parseFloat(val);
  98. return isNaN(n) ? val : n;
  99. };
  100. const toNumber = (val) => {
  101. const n = isString(val) ? Number(val) : NaN;
  102. return isNaN(n) ? val : n;
  103. };
  104. let _globalThis;
  105. const getGlobalThis = () => {
  106. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  107. };
  108. function genCacheKey(source, options) {
  109. return source + JSON.stringify(
  110. options,
  111. (_, val) => typeof val === "function" ? val.toString() : val
  112. );
  113. }
  114. const PatchFlagNames = {
  115. [1]: `TEXT`,
  116. [2]: `CLASS`,
  117. [4]: `STYLE`,
  118. [8]: `PROPS`,
  119. [16]: `FULL_PROPS`,
  120. [32]: `NEED_HYDRATION`,
  121. [64]: `STABLE_FRAGMENT`,
  122. [128]: `KEYED_FRAGMENT`,
  123. [256]: `UNKEYED_FRAGMENT`,
  124. [512]: `NEED_PATCH`,
  125. [1024]: `DYNAMIC_SLOTS`,
  126. [2048]: `DEV_ROOT_FRAGMENT`,
  127. [-1]: `HOISTED`,
  128. [-2]: `BAIL`
  129. };
  130. const slotFlagsText = {
  131. [1]: "STABLE",
  132. [2]: "DYNAMIC",
  133. [3]: "FORWARDED"
  134. };
  135. 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";
  136. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  137. const range = 2;
  138. function generateCodeFrame(source, start = 0, end = source.length) {
  139. start = Math.max(0, Math.min(start, source.length));
  140. end = Math.max(0, Math.min(end, source.length));
  141. if (start > end) return "";
  142. let lines = source.split(/(\r?\n)/);
  143. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  144. lines = lines.filter((_, idx) => idx % 2 === 0);
  145. let count = 0;
  146. const res = [];
  147. for (let i = 0; i < lines.length; i++) {
  148. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  149. if (count >= start) {
  150. for (let j = i - range; j <= i + range || end > count; j++) {
  151. if (j < 0 || j >= lines.length) continue;
  152. const line = j + 1;
  153. res.push(
  154. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  155. );
  156. const lineLength = lines[j].length;
  157. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  158. if (j === i) {
  159. const pad = start - (count - (lineLength + newLineSeqLength));
  160. const length = Math.max(
  161. 1,
  162. end > count ? lineLength - pad : end - start
  163. );
  164. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  165. } else if (j > i) {
  166. if (end > count) {
  167. const length = Math.max(Math.min(end - count, lineLength), 1);
  168. res.push(` | ` + "^".repeat(length));
  169. }
  170. count += lineLength + newLineSeqLength;
  171. }
  172. }
  173. break;
  174. }
  175. }
  176. return res.join("\n");
  177. }
  178. function normalizeStyle(value) {
  179. if (isArray(value)) {
  180. const res = {};
  181. for (let i = 0; i < value.length; i++) {
  182. const item = value[i];
  183. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  184. if (normalized) {
  185. for (const key in normalized) {
  186. res[key] = normalized[key];
  187. }
  188. }
  189. }
  190. return res;
  191. } else if (isString(value) || isObject(value)) {
  192. return value;
  193. }
  194. }
  195. const listDelimiterRE = /;(?![^(]*\))/g;
  196. const propertyDelimiterRE = /:([^]+)/;
  197. const styleCommentRE = /\/\*[^]*?\*\//g;
  198. function parseStringStyle(cssText) {
  199. const ret = {};
  200. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  201. if (item) {
  202. const tmp = item.split(propertyDelimiterRE);
  203. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  204. }
  205. });
  206. return ret;
  207. }
  208. function stringifyStyle(styles) {
  209. let ret = "";
  210. if (!styles || isString(styles)) {
  211. return ret;
  212. }
  213. for (const key in styles) {
  214. const value = styles[key];
  215. if (isString(value) || typeof value === "number") {
  216. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  217. ret += `${normalizedKey}:${value};`;
  218. }
  219. }
  220. return ret;
  221. }
  222. function normalizeClass(value) {
  223. let res = "";
  224. if (isString(value)) {
  225. res = value;
  226. } else if (isArray(value)) {
  227. for (let i = 0; i < value.length; i++) {
  228. const normalized = normalizeClass(value[i]);
  229. if (normalized) {
  230. res += normalized + " ";
  231. }
  232. }
  233. } else if (isObject(value)) {
  234. for (const name in value) {
  235. if (value[name]) {
  236. res += name + " ";
  237. }
  238. }
  239. }
  240. return res.trim();
  241. }
  242. function normalizeProps(props) {
  243. if (!props) return null;
  244. let { class: klass, style } = props;
  245. if (klass && !isString(klass)) {
  246. props.class = normalizeClass(klass);
  247. }
  248. if (style) {
  249. props.style = normalizeStyle(style);
  250. }
  251. return props;
  252. }
  253. 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";
  254. 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";
  255. 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";
  256. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  257. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  258. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  259. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  260. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  261. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  262. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  263. const isBooleanAttr = /* @__PURE__ */ makeMap(
  264. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  265. );
  266. function includeBooleanAttr(value) {
  267. return !!value || value === "";
  268. }
  269. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  270. `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`
  271. );
  272. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  273. `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`
  274. );
  275. function isRenderableAttrValue(value) {
  276. if (value == null) {
  277. return false;
  278. }
  279. const type = typeof value;
  280. return type === "string" || type === "number" || type === "boolean";
  281. }
  282. const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
  283. function getEscapedCssVarName(key, doubleEscape) {
  284. return key.replace(
  285. cssVarNameEscapeSymbolsRE,
  286. (s) => `\\${s}`
  287. );
  288. }
  289. function looseCompareArrays(a, b) {
  290. if (a.length !== b.length) return false;
  291. let equal = true;
  292. for (let i = 0; equal && i < a.length; i++) {
  293. equal = looseEqual(a[i], b[i]);
  294. }
  295. return equal;
  296. }
  297. function looseEqual(a, b) {
  298. if (a === b) return true;
  299. let aValidType = isDate(a);
  300. let bValidType = isDate(b);
  301. if (aValidType || bValidType) {
  302. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  303. }
  304. aValidType = isSymbol(a);
  305. bValidType = isSymbol(b);
  306. if (aValidType || bValidType) {
  307. return a === b;
  308. }
  309. aValidType = isArray(a);
  310. bValidType = isArray(b);
  311. if (aValidType || bValidType) {
  312. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  313. }
  314. aValidType = isObject(a);
  315. bValidType = isObject(b);
  316. if (aValidType || bValidType) {
  317. if (!aValidType || !bValidType) {
  318. return false;
  319. }
  320. const aKeysCount = Object.keys(a).length;
  321. const bKeysCount = Object.keys(b).length;
  322. if (aKeysCount !== bKeysCount) {
  323. return false;
  324. }
  325. for (const key in a) {
  326. const aHasKey = a.hasOwnProperty(key);
  327. const bHasKey = b.hasOwnProperty(key);
  328. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  329. return false;
  330. }
  331. }
  332. }
  333. return String(a) === String(b);
  334. }
  335. function looseIndexOf(arr, val) {
  336. return arr.findIndex((item) => looseEqual(item, val));
  337. }
  338. const isRef$1 = (val) => {
  339. return !!(val && val["__v_isRef"] === true);
  340. };
  341. const toDisplayString = (val) => {
  342. 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);
  343. };
  344. const replacer = (_key, val) => {
  345. if (isRef$1(val)) {
  346. return replacer(_key, val.value);
  347. } else if (isMap(val)) {
  348. return {
  349. [`Map(${val.size})`]: [...val.entries()].reduce(
  350. (entries, [key, val2], i) => {
  351. entries[stringifySymbol(key, i) + " =>"] = val2;
  352. return entries;
  353. },
  354. {}
  355. )
  356. };
  357. } else if (isSet(val)) {
  358. return {
  359. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  360. };
  361. } else if (isSymbol(val)) {
  362. return stringifySymbol(val);
  363. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  364. return String(val);
  365. }
  366. return val;
  367. };
  368. const stringifySymbol = (v, i = "") => {
  369. var _a;
  370. return (
  371. // Symbol.description in es2019+ so we need to cast here to pass
  372. // the lib: es2016 check
  373. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  374. );
  375. };
  376. function warn$2(msg, ...args) {
  377. console.warn(`[Vue warn] ${msg}`, ...args);
  378. }
  379. let activeEffectScope;
  380. class EffectScope {
  381. constructor(detached = false) {
  382. this.detached = detached;
  383. /**
  384. * @internal
  385. */
  386. this._active = true;
  387. /**
  388. * @internal
  389. */
  390. this.effects = [];
  391. /**
  392. * @internal
  393. */
  394. this.cleanups = [];
  395. this._isPaused = false;
  396. this.parent = activeEffectScope;
  397. if (!detached && activeEffectScope) {
  398. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  399. this
  400. ) - 1;
  401. }
  402. }
  403. get active() {
  404. return this._active;
  405. }
  406. pause() {
  407. if (this._active) {
  408. this._isPaused = true;
  409. let i, l;
  410. if (this.scopes) {
  411. for (i = 0, l = this.scopes.length; i < l; i++) {
  412. this.scopes[i].pause();
  413. }
  414. }
  415. for (i = 0, l = this.effects.length; i < l; i++) {
  416. this.effects[i].pause();
  417. }
  418. }
  419. }
  420. /**
  421. * Resumes the effect scope, including all child scopes and effects.
  422. */
  423. resume() {
  424. if (this._active) {
  425. if (this._isPaused) {
  426. this._isPaused = false;
  427. let i, l;
  428. if (this.scopes) {
  429. for (i = 0, l = this.scopes.length; i < l; i++) {
  430. this.scopes[i].resume();
  431. }
  432. }
  433. for (i = 0, l = this.effects.length; i < l; i++) {
  434. this.effects[i].resume();
  435. }
  436. }
  437. }
  438. }
  439. run(fn) {
  440. if (this._active) {
  441. const currentEffectScope = activeEffectScope;
  442. try {
  443. activeEffectScope = this;
  444. return fn();
  445. } finally {
  446. activeEffectScope = currentEffectScope;
  447. }
  448. } else {
  449. warn$2(`cannot run an inactive effect scope.`);
  450. }
  451. }
  452. /**
  453. * This should only be called on non-detached scopes
  454. * @internal
  455. */
  456. on() {
  457. activeEffectScope = this;
  458. }
  459. /**
  460. * This should only be called on non-detached scopes
  461. * @internal
  462. */
  463. off() {
  464. activeEffectScope = this.parent;
  465. }
  466. stop(fromParent) {
  467. if (this._active) {
  468. let i, l;
  469. for (i = 0, l = this.effects.length; i < l; i++) {
  470. this.effects[i].stop();
  471. }
  472. for (i = 0, l = this.cleanups.length; i < l; i++) {
  473. this.cleanups[i]();
  474. }
  475. if (this.scopes) {
  476. for (i = 0, l = this.scopes.length; i < l; i++) {
  477. this.scopes[i].stop(true);
  478. }
  479. }
  480. if (!this.detached && this.parent && !fromParent) {
  481. const last = this.parent.scopes.pop();
  482. if (last && last !== this) {
  483. this.parent.scopes[this.index] = last;
  484. last.index = this.index;
  485. }
  486. }
  487. this.parent = void 0;
  488. this._active = false;
  489. }
  490. }
  491. }
  492. function effectScope(detached) {
  493. return new EffectScope(detached);
  494. }
  495. function getCurrentScope() {
  496. return activeEffectScope;
  497. }
  498. function onScopeDispose(fn, failSilently = false) {
  499. if (activeEffectScope) {
  500. activeEffectScope.cleanups.push(fn);
  501. } else if (!failSilently) {
  502. warn$2(
  503. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  504. );
  505. }
  506. }
  507. let activeSub;
  508. const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
  509. class ReactiveEffect {
  510. constructor(fn) {
  511. this.fn = fn;
  512. /**
  513. * @internal
  514. */
  515. this.deps = void 0;
  516. /**
  517. * @internal
  518. */
  519. this.depsTail = void 0;
  520. /**
  521. * @internal
  522. */
  523. this.flags = 1 | 4;
  524. /**
  525. * @internal
  526. */
  527. this.next = void 0;
  528. /**
  529. * @internal
  530. */
  531. this.cleanup = void 0;
  532. this.scheduler = void 0;
  533. if (activeEffectScope && activeEffectScope.active) {
  534. activeEffectScope.effects.push(this);
  535. }
  536. }
  537. pause() {
  538. this.flags |= 64;
  539. }
  540. resume() {
  541. if (this.flags & 64) {
  542. this.flags &= ~64;
  543. if (pausedQueueEffects.has(this)) {
  544. pausedQueueEffects.delete(this);
  545. this.trigger();
  546. }
  547. }
  548. }
  549. /**
  550. * @internal
  551. */
  552. notify() {
  553. if (this.flags & 2 && !(this.flags & 32)) {
  554. return;
  555. }
  556. if (!(this.flags & 8)) {
  557. batch(this);
  558. }
  559. }
  560. run() {
  561. if (!(this.flags & 1)) {
  562. return this.fn();
  563. }
  564. this.flags |= 2;
  565. cleanupEffect(this);
  566. prepareDeps(this);
  567. const prevEffect = activeSub;
  568. const prevShouldTrack = shouldTrack;
  569. activeSub = this;
  570. shouldTrack = true;
  571. try {
  572. return this.fn();
  573. } finally {
  574. if (activeSub !== this) {
  575. warn$2(
  576. "Active effect was not restored correctly - this is likely a Vue internal bug."
  577. );
  578. }
  579. cleanupDeps(this);
  580. activeSub = prevEffect;
  581. shouldTrack = prevShouldTrack;
  582. this.flags &= ~2;
  583. }
  584. }
  585. stop() {
  586. if (this.flags & 1) {
  587. for (let link = this.deps; link; link = link.nextDep) {
  588. removeSub(link);
  589. }
  590. this.deps = this.depsTail = void 0;
  591. cleanupEffect(this);
  592. this.onStop && this.onStop();
  593. this.flags &= ~1;
  594. }
  595. }
  596. trigger() {
  597. if (this.flags & 64) {
  598. pausedQueueEffects.add(this);
  599. } else if (this.scheduler) {
  600. this.scheduler();
  601. } else {
  602. this.runIfDirty();
  603. }
  604. }
  605. /**
  606. * @internal
  607. */
  608. runIfDirty() {
  609. if (isDirty(this)) {
  610. this.run();
  611. }
  612. }
  613. get dirty() {
  614. return isDirty(this);
  615. }
  616. }
  617. let batchDepth = 0;
  618. let batchedSub;
  619. let batchedComputed;
  620. function batch(sub, isComputed = false) {
  621. sub.flags |= 8;
  622. if (isComputed) {
  623. sub.next = batchedComputed;
  624. batchedComputed = sub;
  625. return;
  626. }
  627. sub.next = batchedSub;
  628. batchedSub = sub;
  629. }
  630. function startBatch() {
  631. batchDepth++;
  632. }
  633. function endBatch() {
  634. if (--batchDepth > 0) {
  635. return;
  636. }
  637. if (batchedComputed) {
  638. let e = batchedComputed;
  639. batchedComputed = void 0;
  640. while (e) {
  641. const next = e.next;
  642. e.next = void 0;
  643. e.flags &= ~8;
  644. e = next;
  645. }
  646. }
  647. let error;
  648. while (batchedSub) {
  649. let e = batchedSub;
  650. batchedSub = void 0;
  651. while (e) {
  652. const next = e.next;
  653. e.next = void 0;
  654. e.flags &= ~8;
  655. if (e.flags & 1) {
  656. try {
  657. ;
  658. e.trigger();
  659. } catch (err) {
  660. if (!error) error = err;
  661. }
  662. }
  663. e = next;
  664. }
  665. }
  666. if (error) throw error;
  667. }
  668. function prepareDeps(sub) {
  669. for (let link = sub.deps; link; link = link.nextDep) {
  670. link.version = -1;
  671. link.prevActiveLink = link.dep.activeLink;
  672. link.dep.activeLink = link;
  673. }
  674. }
  675. function cleanupDeps(sub) {
  676. let head;
  677. let tail = sub.depsTail;
  678. let link = tail;
  679. while (link) {
  680. const prev = link.prevDep;
  681. if (link.version === -1) {
  682. if (link === tail) tail = prev;
  683. removeSub(link);
  684. removeDep(link);
  685. } else {
  686. head = link;
  687. }
  688. link.dep.activeLink = link.prevActiveLink;
  689. link.prevActiveLink = void 0;
  690. link = prev;
  691. }
  692. sub.deps = head;
  693. sub.depsTail = tail;
  694. }
  695. function isDirty(sub) {
  696. for (let link = sub.deps; link; link = link.nextDep) {
  697. if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
  698. return true;
  699. }
  700. }
  701. if (sub._dirty) {
  702. return true;
  703. }
  704. return false;
  705. }
  706. function refreshComputed(computed) {
  707. if (computed.flags & 4 && !(computed.flags & 16)) {
  708. return;
  709. }
  710. computed.flags &= ~16;
  711. if (computed.globalVersion === globalVersion) {
  712. return;
  713. }
  714. computed.globalVersion = globalVersion;
  715. const dep = computed.dep;
  716. computed.flags |= 2;
  717. if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
  718. computed.flags &= ~2;
  719. return;
  720. }
  721. const prevSub = activeSub;
  722. const prevShouldTrack = shouldTrack;
  723. activeSub = computed;
  724. shouldTrack = true;
  725. try {
  726. prepareDeps(computed);
  727. const value = computed.fn(computed._value);
  728. if (dep.version === 0 || hasChanged(value, computed._value)) {
  729. computed._value = value;
  730. dep.version++;
  731. }
  732. } catch (err) {
  733. dep.version++;
  734. throw err;
  735. } finally {
  736. activeSub = prevSub;
  737. shouldTrack = prevShouldTrack;
  738. cleanupDeps(computed);
  739. computed.flags &= ~2;
  740. }
  741. }
  742. function removeSub(link, soft = false) {
  743. const { dep, prevSub, nextSub } = link;
  744. if (prevSub) {
  745. prevSub.nextSub = nextSub;
  746. link.prevSub = void 0;
  747. }
  748. if (nextSub) {
  749. nextSub.prevSub = prevSub;
  750. link.nextSub = void 0;
  751. }
  752. if (dep.subsHead === link) {
  753. dep.subsHead = nextSub;
  754. }
  755. if (dep.subs === link) {
  756. dep.subs = prevSub;
  757. if (!prevSub && dep.computed) {
  758. dep.computed.flags &= ~4;
  759. for (let l = dep.computed.deps; l; l = l.nextDep) {
  760. removeSub(l, true);
  761. }
  762. }
  763. }
  764. if (!soft && !--dep.sc && dep.map) {
  765. dep.map.delete(dep.key);
  766. }
  767. }
  768. function removeDep(link) {
  769. const { prevDep, nextDep } = link;
  770. if (prevDep) {
  771. prevDep.nextDep = nextDep;
  772. link.prevDep = void 0;
  773. }
  774. if (nextDep) {
  775. nextDep.prevDep = prevDep;
  776. link.nextDep = void 0;
  777. }
  778. }
  779. function effect(fn, options) {
  780. if (fn.effect instanceof ReactiveEffect) {
  781. fn = fn.effect.fn;
  782. }
  783. const e = new ReactiveEffect(fn);
  784. if (options) {
  785. extend(e, options);
  786. }
  787. try {
  788. e.run();
  789. } catch (err) {
  790. e.stop();
  791. throw err;
  792. }
  793. const runner = e.run.bind(e);
  794. runner.effect = e;
  795. return runner;
  796. }
  797. function stop(runner) {
  798. runner.effect.stop();
  799. }
  800. let shouldTrack = true;
  801. const trackStack = [];
  802. function pauseTracking() {
  803. trackStack.push(shouldTrack);
  804. shouldTrack = false;
  805. }
  806. function resetTracking() {
  807. const last = trackStack.pop();
  808. shouldTrack = last === void 0 ? true : last;
  809. }
  810. function cleanupEffect(e) {
  811. const { cleanup } = e;
  812. e.cleanup = void 0;
  813. if (cleanup) {
  814. const prevSub = activeSub;
  815. activeSub = void 0;
  816. try {
  817. cleanup();
  818. } finally {
  819. activeSub = prevSub;
  820. }
  821. }
  822. }
  823. let globalVersion = 0;
  824. class Link {
  825. constructor(sub, dep) {
  826. this.sub = sub;
  827. this.dep = dep;
  828. this.version = dep.version;
  829. this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
  830. }
  831. }
  832. class Dep {
  833. constructor(computed) {
  834. this.computed = computed;
  835. this.version = 0;
  836. /**
  837. * Link between this dep and the current active effect
  838. */
  839. this.activeLink = void 0;
  840. /**
  841. * Doubly linked list representing the subscribing effects (tail)
  842. */
  843. this.subs = void 0;
  844. /**
  845. * For object property deps cleanup
  846. */
  847. this.map = void 0;
  848. this.key = void 0;
  849. /**
  850. * Subscriber counter
  851. */
  852. this.sc = 0;
  853. {
  854. this.subsHead = void 0;
  855. }
  856. }
  857. track(debugInfo) {
  858. if (!activeSub || !shouldTrack || activeSub === this.computed) {
  859. return;
  860. }
  861. let link = this.activeLink;
  862. if (link === void 0 || link.sub !== activeSub) {
  863. link = this.activeLink = new Link(activeSub, this);
  864. if (!activeSub.deps) {
  865. activeSub.deps = activeSub.depsTail = link;
  866. } else {
  867. link.prevDep = activeSub.depsTail;
  868. activeSub.depsTail.nextDep = link;
  869. activeSub.depsTail = link;
  870. }
  871. addSub(link);
  872. } else if (link.version === -1) {
  873. link.version = this.version;
  874. if (link.nextDep) {
  875. const next = link.nextDep;
  876. next.prevDep = link.prevDep;
  877. if (link.prevDep) {
  878. link.prevDep.nextDep = next;
  879. }
  880. link.prevDep = activeSub.depsTail;
  881. link.nextDep = void 0;
  882. activeSub.depsTail.nextDep = link;
  883. activeSub.depsTail = link;
  884. if (activeSub.deps === link) {
  885. activeSub.deps = next;
  886. }
  887. }
  888. }
  889. if (activeSub.onTrack) {
  890. activeSub.onTrack(
  891. extend(
  892. {
  893. effect: activeSub
  894. },
  895. debugInfo
  896. )
  897. );
  898. }
  899. return link;
  900. }
  901. trigger(debugInfo) {
  902. this.version++;
  903. globalVersion++;
  904. this.notify(debugInfo);
  905. }
  906. notify(debugInfo) {
  907. startBatch();
  908. try {
  909. if (true) {
  910. for (let head = this.subsHead; head; head = head.nextSub) {
  911. if (head.sub.onTrigger && !(head.sub.flags & 8)) {
  912. head.sub.onTrigger(
  913. extend(
  914. {
  915. effect: head.sub
  916. },
  917. debugInfo
  918. )
  919. );
  920. }
  921. }
  922. }
  923. for (let link = this.subs; link; link = link.prevSub) {
  924. if (link.sub.notify()) {
  925. ;
  926. link.sub.dep.notify();
  927. }
  928. }
  929. } finally {
  930. endBatch();
  931. }
  932. }
  933. }
  934. function addSub(link) {
  935. link.dep.sc++;
  936. if (link.sub.flags & 4) {
  937. const computed = link.dep.computed;
  938. if (computed && !link.dep.subs) {
  939. computed.flags |= 4 | 16;
  940. for (let l = computed.deps; l; l = l.nextDep) {
  941. addSub(l);
  942. }
  943. }
  944. const currentTail = link.dep.subs;
  945. if (currentTail !== link) {
  946. link.prevSub = currentTail;
  947. if (currentTail) currentTail.nextSub = link;
  948. }
  949. if (link.dep.subsHead === void 0) {
  950. link.dep.subsHead = link;
  951. }
  952. link.dep.subs = link;
  953. }
  954. }
  955. const targetMap = /* @__PURE__ */ new WeakMap();
  956. const ITERATE_KEY = Symbol(
  957. "Object iterate"
  958. );
  959. const MAP_KEY_ITERATE_KEY = Symbol(
  960. "Map keys iterate"
  961. );
  962. const ARRAY_ITERATE_KEY = Symbol(
  963. "Array iterate"
  964. );
  965. function track(target, type, key) {
  966. if (shouldTrack && activeSub) {
  967. let depsMap = targetMap.get(target);
  968. if (!depsMap) {
  969. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  970. }
  971. let dep = depsMap.get(key);
  972. if (!dep) {
  973. depsMap.set(key, dep = new Dep());
  974. dep.map = depsMap;
  975. dep.key = key;
  976. }
  977. {
  978. dep.track({
  979. target,
  980. type,
  981. key
  982. });
  983. }
  984. }
  985. }
  986. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  987. const depsMap = targetMap.get(target);
  988. if (!depsMap) {
  989. globalVersion++;
  990. return;
  991. }
  992. const run = (dep) => {
  993. if (dep) {
  994. {
  995. dep.trigger({
  996. target,
  997. type,
  998. key,
  999. newValue,
  1000. oldValue,
  1001. oldTarget
  1002. });
  1003. }
  1004. }
  1005. };
  1006. startBatch();
  1007. if (type === "clear") {
  1008. depsMap.forEach(run);
  1009. } else {
  1010. const targetIsArray = isArray(target);
  1011. const isArrayIndex = targetIsArray && isIntegerKey(key);
  1012. if (targetIsArray && key === "length") {
  1013. const newLength = Number(newValue);
  1014. depsMap.forEach((dep, key2) => {
  1015. if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
  1016. run(dep);
  1017. }
  1018. });
  1019. } else {
  1020. if (key !== void 0 || depsMap.has(void 0)) {
  1021. run(depsMap.get(key));
  1022. }
  1023. if (isArrayIndex) {
  1024. run(depsMap.get(ARRAY_ITERATE_KEY));
  1025. }
  1026. switch (type) {
  1027. case "add":
  1028. if (!targetIsArray) {
  1029. run(depsMap.get(ITERATE_KEY));
  1030. if (isMap(target)) {
  1031. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1032. }
  1033. } else if (isArrayIndex) {
  1034. run(depsMap.get("length"));
  1035. }
  1036. break;
  1037. case "delete":
  1038. if (!targetIsArray) {
  1039. run(depsMap.get(ITERATE_KEY));
  1040. if (isMap(target)) {
  1041. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1042. }
  1043. }
  1044. break;
  1045. case "set":
  1046. if (isMap(target)) {
  1047. run(depsMap.get(ITERATE_KEY));
  1048. }
  1049. break;
  1050. }
  1051. }
  1052. }
  1053. endBatch();
  1054. }
  1055. function getDepFromReactive(object, key) {
  1056. const depMap = targetMap.get(object);
  1057. return depMap && depMap.get(key);
  1058. }
  1059. function reactiveReadArray(array) {
  1060. const raw = toRaw(array);
  1061. if (raw === array) return raw;
  1062. track(raw, "iterate", ARRAY_ITERATE_KEY);
  1063. return isShallow(array) ? raw : raw.map(toReactive);
  1064. }
  1065. function shallowReadArray(arr) {
  1066. track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
  1067. return arr;
  1068. }
  1069. const arrayInstrumentations = {
  1070. __proto__: null,
  1071. [Symbol.iterator]() {
  1072. return iterator(this, Symbol.iterator, toReactive);
  1073. },
  1074. concat(...args) {
  1075. return reactiveReadArray(this).concat(
  1076. ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
  1077. );
  1078. },
  1079. entries() {
  1080. return iterator(this, "entries", (value) => {
  1081. value[1] = toReactive(value[1]);
  1082. return value;
  1083. });
  1084. },
  1085. every(fn, thisArg) {
  1086. return apply(this, "every", fn, thisArg, void 0, arguments);
  1087. },
  1088. filter(fn, thisArg) {
  1089. return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
  1090. },
  1091. find(fn, thisArg) {
  1092. return apply(this, "find", fn, thisArg, toReactive, arguments);
  1093. },
  1094. findIndex(fn, thisArg) {
  1095. return apply(this, "findIndex", fn, thisArg, void 0, arguments);
  1096. },
  1097. findLast(fn, thisArg) {
  1098. return apply(this, "findLast", fn, thisArg, toReactive, arguments);
  1099. },
  1100. findLastIndex(fn, thisArg) {
  1101. return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
  1102. },
  1103. // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
  1104. forEach(fn, thisArg) {
  1105. return apply(this, "forEach", fn, thisArg, void 0, arguments);
  1106. },
  1107. includes(...args) {
  1108. return searchProxy(this, "includes", args);
  1109. },
  1110. indexOf(...args) {
  1111. return searchProxy(this, "indexOf", args);
  1112. },
  1113. join(separator) {
  1114. return reactiveReadArray(this).join(separator);
  1115. },
  1116. // keys() iterator only reads `length`, no optimisation required
  1117. lastIndexOf(...args) {
  1118. return searchProxy(this, "lastIndexOf", args);
  1119. },
  1120. map(fn, thisArg) {
  1121. return apply(this, "map", fn, thisArg, void 0, arguments);
  1122. },
  1123. pop() {
  1124. return noTracking(this, "pop");
  1125. },
  1126. push(...args) {
  1127. return noTracking(this, "push", args);
  1128. },
  1129. reduce(fn, ...args) {
  1130. return reduce(this, "reduce", fn, args);
  1131. },
  1132. reduceRight(fn, ...args) {
  1133. return reduce(this, "reduceRight", fn, args);
  1134. },
  1135. shift() {
  1136. return noTracking(this, "shift");
  1137. },
  1138. // slice could use ARRAY_ITERATE but also seems to beg for range tracking
  1139. some(fn, thisArg) {
  1140. return apply(this, "some", fn, thisArg, void 0, arguments);
  1141. },
  1142. splice(...args) {
  1143. return noTracking(this, "splice", args);
  1144. },
  1145. toReversed() {
  1146. return reactiveReadArray(this).toReversed();
  1147. },
  1148. toSorted(comparer) {
  1149. return reactiveReadArray(this).toSorted(comparer);
  1150. },
  1151. toSpliced(...args) {
  1152. return reactiveReadArray(this).toSpliced(...args);
  1153. },
  1154. unshift(...args) {
  1155. return noTracking(this, "unshift", args);
  1156. },
  1157. values() {
  1158. return iterator(this, "values", toReactive);
  1159. }
  1160. };
  1161. function iterator(self, method, wrapValue) {
  1162. const arr = shallowReadArray(self);
  1163. const iter = arr[method]();
  1164. if (arr !== self && !isShallow(self)) {
  1165. iter._next = iter.next;
  1166. iter.next = () => {
  1167. const result = iter._next();
  1168. if (result.value) {
  1169. result.value = wrapValue(result.value);
  1170. }
  1171. return result;
  1172. };
  1173. }
  1174. return iter;
  1175. }
  1176. const arrayProto = Array.prototype;
  1177. function apply(self, method, fn, thisArg, wrappedRetFn, args) {
  1178. const arr = shallowReadArray(self);
  1179. const needsWrap = arr !== self && !isShallow(self);
  1180. const methodFn = arr[method];
  1181. if (methodFn !== arrayProto[method]) {
  1182. const result2 = methodFn.apply(self, args);
  1183. return needsWrap ? toReactive(result2) : result2;
  1184. }
  1185. let wrappedFn = fn;
  1186. if (arr !== self) {
  1187. if (needsWrap) {
  1188. wrappedFn = function(item, index) {
  1189. return fn.call(this, toReactive(item), index, self);
  1190. };
  1191. } else if (fn.length > 2) {
  1192. wrappedFn = function(item, index) {
  1193. return fn.call(this, item, index, self);
  1194. };
  1195. }
  1196. }
  1197. const result = methodFn.call(arr, wrappedFn, thisArg);
  1198. return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
  1199. }
  1200. function reduce(self, method, fn, args) {
  1201. const arr = shallowReadArray(self);
  1202. let wrappedFn = fn;
  1203. if (arr !== self) {
  1204. if (!isShallow(self)) {
  1205. wrappedFn = function(acc, item, index) {
  1206. return fn.call(this, acc, toReactive(item), index, self);
  1207. };
  1208. } else if (fn.length > 3) {
  1209. wrappedFn = function(acc, item, index) {
  1210. return fn.call(this, acc, item, index, self);
  1211. };
  1212. }
  1213. }
  1214. return arr[method](wrappedFn, ...args);
  1215. }
  1216. function searchProxy(self, method, args) {
  1217. const arr = toRaw(self);
  1218. track(arr, "iterate", ARRAY_ITERATE_KEY);
  1219. const res = arr[method](...args);
  1220. if ((res === -1 || res === false) && isProxy(args[0])) {
  1221. args[0] = toRaw(args[0]);
  1222. return arr[method](...args);
  1223. }
  1224. return res;
  1225. }
  1226. function noTracking(self, method, args = []) {
  1227. pauseTracking();
  1228. startBatch();
  1229. const res = toRaw(self)[method].apply(self, args);
  1230. endBatch();
  1231. resetTracking();
  1232. return res;
  1233. }
  1234. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  1235. const builtInSymbols = new Set(
  1236. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1237. );
  1238. function hasOwnProperty(key) {
  1239. if (!isSymbol(key)) key = String(key);
  1240. const obj = toRaw(this);
  1241. track(obj, "has", key);
  1242. return obj.hasOwnProperty(key);
  1243. }
  1244. class BaseReactiveHandler {
  1245. constructor(_isReadonly = false, _isShallow = false) {
  1246. this._isReadonly = _isReadonly;
  1247. this._isShallow = _isShallow;
  1248. }
  1249. get(target, key, receiver) {
  1250. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  1251. if (key === "__v_isReactive") {
  1252. return !isReadonly2;
  1253. } else if (key === "__v_isReadonly") {
  1254. return isReadonly2;
  1255. } else if (key === "__v_isShallow") {
  1256. return isShallow2;
  1257. } else if (key === "__v_raw") {
  1258. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  1259. // this means the receiver is a user proxy of the reactive proxy
  1260. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  1261. return target;
  1262. }
  1263. return;
  1264. }
  1265. const targetIsArray = isArray(target);
  1266. if (!isReadonly2) {
  1267. let fn;
  1268. if (targetIsArray && (fn = arrayInstrumentations[key])) {
  1269. return fn;
  1270. }
  1271. if (key === "hasOwnProperty") {
  1272. return hasOwnProperty;
  1273. }
  1274. }
  1275. const res = Reflect.get(
  1276. target,
  1277. key,
  1278. // if this is a proxy wrapping a ref, return methods using the raw ref
  1279. // as receiver so that we don't have to call `toRaw` on the ref in all
  1280. // its class methods
  1281. isRef(target) ? target : receiver
  1282. );
  1283. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1284. return res;
  1285. }
  1286. if (!isReadonly2) {
  1287. track(target, "get", key);
  1288. }
  1289. if (isShallow2) {
  1290. return res;
  1291. }
  1292. if (isRef(res)) {
  1293. return targetIsArray && isIntegerKey(key) ? res : res.value;
  1294. }
  1295. if (isObject(res)) {
  1296. return isReadonly2 ? readonly(res) : reactive(res);
  1297. }
  1298. return res;
  1299. }
  1300. }
  1301. class MutableReactiveHandler extends BaseReactiveHandler {
  1302. constructor(isShallow2 = false) {
  1303. super(false, isShallow2);
  1304. }
  1305. set(target, key, value, receiver) {
  1306. let oldValue = target[key];
  1307. if (!this._isShallow) {
  1308. const isOldValueReadonly = isReadonly(oldValue);
  1309. if (!isShallow(value) && !isReadonly(value)) {
  1310. oldValue = toRaw(oldValue);
  1311. value = toRaw(value);
  1312. }
  1313. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  1314. if (isOldValueReadonly) {
  1315. return false;
  1316. } else {
  1317. oldValue.value = value;
  1318. return true;
  1319. }
  1320. }
  1321. }
  1322. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  1323. const result = Reflect.set(
  1324. target,
  1325. key,
  1326. value,
  1327. isRef(target) ? target : receiver
  1328. );
  1329. if (target === toRaw(receiver)) {
  1330. if (!hadKey) {
  1331. trigger(target, "add", key, value);
  1332. } else if (hasChanged(value, oldValue)) {
  1333. trigger(target, "set", key, value, oldValue);
  1334. }
  1335. }
  1336. return result;
  1337. }
  1338. deleteProperty(target, key) {
  1339. const hadKey = hasOwn(target, key);
  1340. const oldValue = target[key];
  1341. const result = Reflect.deleteProperty(target, key);
  1342. if (result && hadKey) {
  1343. trigger(target, "delete", key, void 0, oldValue);
  1344. }
  1345. return result;
  1346. }
  1347. has(target, key) {
  1348. const result = Reflect.has(target, key);
  1349. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  1350. track(target, "has", key);
  1351. }
  1352. return result;
  1353. }
  1354. ownKeys(target) {
  1355. track(
  1356. target,
  1357. "iterate",
  1358. isArray(target) ? "length" : ITERATE_KEY
  1359. );
  1360. return Reflect.ownKeys(target);
  1361. }
  1362. }
  1363. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  1364. constructor(isShallow2 = false) {
  1365. super(true, isShallow2);
  1366. }
  1367. set(target, key) {
  1368. {
  1369. warn$2(
  1370. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1371. target
  1372. );
  1373. }
  1374. return true;
  1375. }
  1376. deleteProperty(target, key) {
  1377. {
  1378. warn$2(
  1379. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  1380. target
  1381. );
  1382. }
  1383. return true;
  1384. }
  1385. }
  1386. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  1387. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  1388. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
  1389. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  1390. const toShallow = (value) => value;
  1391. const getProto = (v) => Reflect.getPrototypeOf(v);
  1392. function createIterableMethod(method, isReadonly2, isShallow2) {
  1393. return function(...args) {
  1394. const target = this["__v_raw"];
  1395. const rawTarget = toRaw(target);
  1396. const targetIsMap = isMap(rawTarget);
  1397. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1398. const isKeyOnly = method === "keys" && targetIsMap;
  1399. const innerIterator = target[method](...args);
  1400. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1401. !isReadonly2 && track(
  1402. rawTarget,
  1403. "iterate",
  1404. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1405. );
  1406. return {
  1407. // iterator protocol
  1408. next() {
  1409. const { value, done } = innerIterator.next();
  1410. return done ? { value, done } : {
  1411. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1412. done
  1413. };
  1414. },
  1415. // iterable protocol
  1416. [Symbol.iterator]() {
  1417. return this;
  1418. }
  1419. };
  1420. };
  1421. }
  1422. function createReadonlyMethod(type) {
  1423. return function(...args) {
  1424. {
  1425. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1426. warn$2(
  1427. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1428. toRaw(this)
  1429. );
  1430. }
  1431. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1432. };
  1433. }
  1434. function createInstrumentations(readonly, shallow) {
  1435. const instrumentations = {
  1436. get(key) {
  1437. const target = this["__v_raw"];
  1438. const rawTarget = toRaw(target);
  1439. const rawKey = toRaw(key);
  1440. if (!readonly) {
  1441. if (hasChanged(key, rawKey)) {
  1442. track(rawTarget, "get", key);
  1443. }
  1444. track(rawTarget, "get", rawKey);
  1445. }
  1446. const { has } = getProto(rawTarget);
  1447. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1448. if (has.call(rawTarget, key)) {
  1449. return wrap(target.get(key));
  1450. } else if (has.call(rawTarget, rawKey)) {
  1451. return wrap(target.get(rawKey));
  1452. } else if (target !== rawTarget) {
  1453. target.get(key);
  1454. }
  1455. },
  1456. get size() {
  1457. const target = this["__v_raw"];
  1458. !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
  1459. return Reflect.get(target, "size", target);
  1460. },
  1461. has(key) {
  1462. const target = this["__v_raw"];
  1463. const rawTarget = toRaw(target);
  1464. const rawKey = toRaw(key);
  1465. if (!readonly) {
  1466. if (hasChanged(key, rawKey)) {
  1467. track(rawTarget, "has", key);
  1468. }
  1469. track(rawTarget, "has", rawKey);
  1470. }
  1471. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  1472. },
  1473. forEach(callback, thisArg) {
  1474. const observed = this;
  1475. const target = observed["__v_raw"];
  1476. const rawTarget = toRaw(target);
  1477. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1478. !readonly && track(rawTarget, "iterate", ITERATE_KEY);
  1479. return target.forEach((value, key) => {
  1480. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1481. });
  1482. }
  1483. };
  1484. extend(
  1485. instrumentations,
  1486. readonly ? {
  1487. add: createReadonlyMethod("add"),
  1488. set: createReadonlyMethod("set"),
  1489. delete: createReadonlyMethod("delete"),
  1490. clear: createReadonlyMethod("clear")
  1491. } : {
  1492. add(value) {
  1493. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1494. value = toRaw(value);
  1495. }
  1496. const target = toRaw(this);
  1497. const proto = getProto(target);
  1498. const hadKey = proto.has.call(target, value);
  1499. if (!hadKey) {
  1500. target.add(value);
  1501. trigger(target, "add", value, value);
  1502. }
  1503. return this;
  1504. },
  1505. set(key, value) {
  1506. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1507. value = toRaw(value);
  1508. }
  1509. const target = toRaw(this);
  1510. const { has, get } = getProto(target);
  1511. let hadKey = has.call(target, key);
  1512. if (!hadKey) {
  1513. key = toRaw(key);
  1514. hadKey = has.call(target, key);
  1515. } else {
  1516. checkIdentityKeys(target, has, key);
  1517. }
  1518. const oldValue = get.call(target, key);
  1519. target.set(key, value);
  1520. if (!hadKey) {
  1521. trigger(target, "add", key, value);
  1522. } else if (hasChanged(value, oldValue)) {
  1523. trigger(target, "set", key, value, oldValue);
  1524. }
  1525. return this;
  1526. },
  1527. delete(key) {
  1528. const target = toRaw(this);
  1529. const { has, get } = getProto(target);
  1530. let hadKey = has.call(target, key);
  1531. if (!hadKey) {
  1532. key = toRaw(key);
  1533. hadKey = has.call(target, key);
  1534. } else {
  1535. checkIdentityKeys(target, has, key);
  1536. }
  1537. const oldValue = get ? get.call(target, key) : void 0;
  1538. const result = target.delete(key);
  1539. if (hadKey) {
  1540. trigger(target, "delete", key, void 0, oldValue);
  1541. }
  1542. return result;
  1543. },
  1544. clear() {
  1545. const target = toRaw(this);
  1546. const hadItems = target.size !== 0;
  1547. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1548. const result = target.clear();
  1549. if (hadItems) {
  1550. trigger(
  1551. target,
  1552. "clear",
  1553. void 0,
  1554. void 0,
  1555. oldTarget
  1556. );
  1557. }
  1558. return result;
  1559. }
  1560. }
  1561. );
  1562. const iteratorMethods = [
  1563. "keys",
  1564. "values",
  1565. "entries",
  1566. Symbol.iterator
  1567. ];
  1568. iteratorMethods.forEach((method) => {
  1569. instrumentations[method] = createIterableMethod(method, readonly, shallow);
  1570. });
  1571. return instrumentations;
  1572. }
  1573. function createInstrumentationGetter(isReadonly2, shallow) {
  1574. const instrumentations = createInstrumentations(isReadonly2, shallow);
  1575. return (target, key, receiver) => {
  1576. if (key === "__v_isReactive") {
  1577. return !isReadonly2;
  1578. } else if (key === "__v_isReadonly") {
  1579. return isReadonly2;
  1580. } else if (key === "__v_raw") {
  1581. return target;
  1582. }
  1583. return Reflect.get(
  1584. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1585. key,
  1586. receiver
  1587. );
  1588. };
  1589. }
  1590. const mutableCollectionHandlers = {
  1591. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1592. };
  1593. const shallowCollectionHandlers = {
  1594. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1595. };
  1596. const readonlyCollectionHandlers = {
  1597. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1598. };
  1599. const shallowReadonlyCollectionHandlers = {
  1600. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1601. };
  1602. function checkIdentityKeys(target, has, key) {
  1603. const rawKey = toRaw(key);
  1604. if (rawKey !== key && has.call(target, rawKey)) {
  1605. const type = toRawType(target);
  1606. warn$2(
  1607. `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.`
  1608. );
  1609. }
  1610. }
  1611. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1612. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1613. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1614. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1615. function targetTypeMap(rawType) {
  1616. switch (rawType) {
  1617. case "Object":
  1618. case "Array":
  1619. return 1 /* COMMON */;
  1620. case "Map":
  1621. case "Set":
  1622. case "WeakMap":
  1623. case "WeakSet":
  1624. return 2 /* COLLECTION */;
  1625. default:
  1626. return 0 /* INVALID */;
  1627. }
  1628. }
  1629. function getTargetType(value) {
  1630. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1631. }
  1632. function reactive(target) {
  1633. if (isReadonly(target)) {
  1634. return target;
  1635. }
  1636. return createReactiveObject(
  1637. target,
  1638. false,
  1639. mutableHandlers,
  1640. mutableCollectionHandlers,
  1641. reactiveMap
  1642. );
  1643. }
  1644. function shallowReactive(target) {
  1645. return createReactiveObject(
  1646. target,
  1647. false,
  1648. shallowReactiveHandlers,
  1649. shallowCollectionHandlers,
  1650. shallowReactiveMap
  1651. );
  1652. }
  1653. function readonly(target) {
  1654. return createReactiveObject(
  1655. target,
  1656. true,
  1657. readonlyHandlers,
  1658. readonlyCollectionHandlers,
  1659. readonlyMap
  1660. );
  1661. }
  1662. function shallowReadonly(target) {
  1663. return createReactiveObject(
  1664. target,
  1665. true,
  1666. shallowReadonlyHandlers,
  1667. shallowReadonlyCollectionHandlers,
  1668. shallowReadonlyMap
  1669. );
  1670. }
  1671. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1672. if (!isObject(target)) {
  1673. {
  1674. warn$2(
  1675. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1676. target
  1677. )}`
  1678. );
  1679. }
  1680. return target;
  1681. }
  1682. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1683. return target;
  1684. }
  1685. const existingProxy = proxyMap.get(target);
  1686. if (existingProxy) {
  1687. return existingProxy;
  1688. }
  1689. const targetType = getTargetType(target);
  1690. if (targetType === 0 /* INVALID */) {
  1691. return target;
  1692. }
  1693. const proxy = new Proxy(
  1694. target,
  1695. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1696. );
  1697. proxyMap.set(target, proxy);
  1698. return proxy;
  1699. }
  1700. function isReactive(value) {
  1701. if (isReadonly(value)) {
  1702. return isReactive(value["__v_raw"]);
  1703. }
  1704. return !!(value && value["__v_isReactive"]);
  1705. }
  1706. function isReadonly(value) {
  1707. return !!(value && value["__v_isReadonly"]);
  1708. }
  1709. function isShallow(value) {
  1710. return !!(value && value["__v_isShallow"]);
  1711. }
  1712. function isProxy(value) {
  1713. return value ? !!value["__v_raw"] : false;
  1714. }
  1715. function toRaw(observed) {
  1716. const raw = observed && observed["__v_raw"];
  1717. return raw ? toRaw(raw) : observed;
  1718. }
  1719. function markRaw(value) {
  1720. if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
  1721. def(value, "__v_skip", true);
  1722. }
  1723. return value;
  1724. }
  1725. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1726. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1727. function isRef(r) {
  1728. return r ? r["__v_isRef"] === true : false;
  1729. }
  1730. function ref(value) {
  1731. return createRef(value, false);
  1732. }
  1733. function shallowRef(value) {
  1734. return createRef(value, true);
  1735. }
  1736. function createRef(rawValue, shallow) {
  1737. if (isRef(rawValue)) {
  1738. return rawValue;
  1739. }
  1740. return new RefImpl(rawValue, shallow);
  1741. }
  1742. class RefImpl {
  1743. constructor(value, isShallow2) {
  1744. this.dep = new Dep();
  1745. this["__v_isRef"] = true;
  1746. this["__v_isShallow"] = false;
  1747. this._rawValue = isShallow2 ? value : toRaw(value);
  1748. this._value = isShallow2 ? value : toReactive(value);
  1749. this["__v_isShallow"] = isShallow2;
  1750. }
  1751. get value() {
  1752. {
  1753. this.dep.track({
  1754. target: this,
  1755. type: "get",
  1756. key: "value"
  1757. });
  1758. }
  1759. return this._value;
  1760. }
  1761. set value(newValue) {
  1762. const oldValue = this._rawValue;
  1763. const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
  1764. newValue = useDirectValue ? newValue : toRaw(newValue);
  1765. if (hasChanged(newValue, oldValue)) {
  1766. this._rawValue = newValue;
  1767. this._value = useDirectValue ? newValue : toReactive(newValue);
  1768. {
  1769. this.dep.trigger({
  1770. target: this,
  1771. type: "set",
  1772. key: "value",
  1773. newValue,
  1774. oldValue
  1775. });
  1776. }
  1777. }
  1778. }
  1779. }
  1780. function triggerRef(ref2) {
  1781. if (ref2.dep) {
  1782. {
  1783. ref2.dep.trigger({
  1784. target: ref2,
  1785. type: "set",
  1786. key: "value",
  1787. newValue: ref2._value
  1788. });
  1789. }
  1790. }
  1791. }
  1792. function unref(ref2) {
  1793. return isRef(ref2) ? ref2.value : ref2;
  1794. }
  1795. function toValue(source) {
  1796. return isFunction(source) ? source() : unref(source);
  1797. }
  1798. const shallowUnwrapHandlers = {
  1799. get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
  1800. set: (target, key, value, receiver) => {
  1801. const oldValue = target[key];
  1802. if (isRef(oldValue) && !isRef(value)) {
  1803. oldValue.value = value;
  1804. return true;
  1805. } else {
  1806. return Reflect.set(target, key, value, receiver);
  1807. }
  1808. }
  1809. };
  1810. function proxyRefs(objectWithRefs) {
  1811. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1812. }
  1813. class CustomRefImpl {
  1814. constructor(factory) {
  1815. this["__v_isRef"] = true;
  1816. this._value = void 0;
  1817. const dep = this.dep = new Dep();
  1818. const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
  1819. this._get = get;
  1820. this._set = set;
  1821. }
  1822. get value() {
  1823. return this._value = this._get();
  1824. }
  1825. set value(newVal) {
  1826. this._set(newVal);
  1827. }
  1828. }
  1829. function customRef(factory) {
  1830. return new CustomRefImpl(factory);
  1831. }
  1832. function toRefs(object) {
  1833. if (!isProxy(object)) {
  1834. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1835. }
  1836. const ret = isArray(object) ? new Array(object.length) : {};
  1837. for (const key in object) {
  1838. ret[key] = propertyToRef(object, key);
  1839. }
  1840. return ret;
  1841. }
  1842. class ObjectRefImpl {
  1843. constructor(_object, _key, _defaultValue) {
  1844. this._object = _object;
  1845. this._key = _key;
  1846. this._defaultValue = _defaultValue;
  1847. this["__v_isRef"] = true;
  1848. this._value = void 0;
  1849. }
  1850. get value() {
  1851. const val = this._object[this._key];
  1852. return this._value = val === void 0 ? this._defaultValue : val;
  1853. }
  1854. set value(newVal) {
  1855. this._object[this._key] = newVal;
  1856. }
  1857. get dep() {
  1858. return getDepFromReactive(toRaw(this._object), this._key);
  1859. }
  1860. }
  1861. class GetterRefImpl {
  1862. constructor(_getter) {
  1863. this._getter = _getter;
  1864. this["__v_isRef"] = true;
  1865. this["__v_isReadonly"] = true;
  1866. this._value = void 0;
  1867. }
  1868. get value() {
  1869. return this._value = this._getter();
  1870. }
  1871. }
  1872. function toRef(source, key, defaultValue) {
  1873. if (isRef(source)) {
  1874. return source;
  1875. } else if (isFunction(source)) {
  1876. return new GetterRefImpl(source);
  1877. } else if (isObject(source) && arguments.length > 1) {
  1878. return propertyToRef(source, key, defaultValue);
  1879. } else {
  1880. return ref(source);
  1881. }
  1882. }
  1883. function propertyToRef(source, key, defaultValue) {
  1884. const val = source[key];
  1885. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1886. }
  1887. class ComputedRefImpl {
  1888. constructor(fn, setter, isSSR) {
  1889. this.fn = fn;
  1890. this.setter = setter;
  1891. /**
  1892. * @internal
  1893. */
  1894. this._value = void 0;
  1895. /**
  1896. * @internal
  1897. */
  1898. this.dep = new Dep(this);
  1899. /**
  1900. * @internal
  1901. */
  1902. this.__v_isRef = true;
  1903. // TODO isolatedDeclarations "__v_isReadonly"
  1904. // A computed is also a subscriber that tracks other deps
  1905. /**
  1906. * @internal
  1907. */
  1908. this.deps = void 0;
  1909. /**
  1910. * @internal
  1911. */
  1912. this.depsTail = void 0;
  1913. /**
  1914. * @internal
  1915. */
  1916. this.flags = 16;
  1917. /**
  1918. * @internal
  1919. */
  1920. this.globalVersion = globalVersion - 1;
  1921. /**
  1922. * @internal
  1923. */
  1924. this.next = void 0;
  1925. // for backwards compat
  1926. this.effect = this;
  1927. this["__v_isReadonly"] = !setter;
  1928. this.isSSR = isSSR;
  1929. }
  1930. /**
  1931. * @internal
  1932. */
  1933. notify() {
  1934. this.flags |= 16;
  1935. if (!(this.flags & 8) && // avoid infinite self recursion
  1936. activeSub !== this) {
  1937. batch(this, true);
  1938. return true;
  1939. }
  1940. }
  1941. get value() {
  1942. const link = this.dep.track({
  1943. target: this,
  1944. type: "get",
  1945. key: "value"
  1946. }) ;
  1947. refreshComputed(this);
  1948. if (link) {
  1949. link.version = this.dep.version;
  1950. }
  1951. return this._value;
  1952. }
  1953. set value(newValue) {
  1954. if (this.setter) {
  1955. this.setter(newValue);
  1956. } else {
  1957. warn$2("Write operation failed: computed value is readonly");
  1958. }
  1959. }
  1960. }
  1961. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1962. let getter;
  1963. let setter;
  1964. if (isFunction(getterOrOptions)) {
  1965. getter = getterOrOptions;
  1966. } else {
  1967. getter = getterOrOptions.get;
  1968. setter = getterOrOptions.set;
  1969. }
  1970. const cRef = new ComputedRefImpl(getter, setter, isSSR);
  1971. if (debugOptions && !isSSR) {
  1972. cRef.onTrack = debugOptions.onTrack;
  1973. cRef.onTrigger = debugOptions.onTrigger;
  1974. }
  1975. return cRef;
  1976. }
  1977. const TrackOpTypes = {
  1978. "GET": "get",
  1979. "HAS": "has",
  1980. "ITERATE": "iterate"
  1981. };
  1982. const TriggerOpTypes = {
  1983. "SET": "set",
  1984. "ADD": "add",
  1985. "DELETE": "delete",
  1986. "CLEAR": "clear"
  1987. };
  1988. const INITIAL_WATCHER_VALUE = {};
  1989. const cleanupMap = /* @__PURE__ */ new WeakMap();
  1990. let activeWatcher = void 0;
  1991. function getCurrentWatcher() {
  1992. return activeWatcher;
  1993. }
  1994. function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
  1995. if (owner) {
  1996. let cleanups = cleanupMap.get(owner);
  1997. if (!cleanups) cleanupMap.set(owner, cleanups = []);
  1998. cleanups.push(cleanupFn);
  1999. } else if (!failSilently) {
  2000. warn$2(
  2001. `onWatcherCleanup() was called when there was no active watcher to associate with.`
  2002. );
  2003. }
  2004. }
  2005. function watch$1(source, cb, options = EMPTY_OBJ) {
  2006. const { immediate, deep, once, scheduler, augmentJob, call } = options;
  2007. const warnInvalidSource = (s) => {
  2008. (options.onWarn || warn$2)(
  2009. `Invalid watch source: `,
  2010. s,
  2011. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  2012. );
  2013. };
  2014. const reactiveGetter = (source2) => {
  2015. if (deep) return source2;
  2016. if (isShallow(source2) || deep === false || deep === 0)
  2017. return traverse(source2, 1);
  2018. return traverse(source2);
  2019. };
  2020. let effect;
  2021. let getter;
  2022. let cleanup;
  2023. let boundCleanup;
  2024. let forceTrigger = false;
  2025. let isMultiSource = false;
  2026. if (isRef(source)) {
  2027. getter = () => source.value;
  2028. forceTrigger = isShallow(source);
  2029. } else if (isReactive(source)) {
  2030. getter = () => reactiveGetter(source);
  2031. forceTrigger = true;
  2032. } else if (isArray(source)) {
  2033. isMultiSource = true;
  2034. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  2035. getter = () => source.map((s) => {
  2036. if (isRef(s)) {
  2037. return s.value;
  2038. } else if (isReactive(s)) {
  2039. return reactiveGetter(s);
  2040. } else if (isFunction(s)) {
  2041. return call ? call(s, 2) : s();
  2042. } else {
  2043. warnInvalidSource(s);
  2044. }
  2045. });
  2046. } else if (isFunction(source)) {
  2047. if (cb) {
  2048. getter = call ? () => call(source, 2) : source;
  2049. } else {
  2050. getter = () => {
  2051. if (cleanup) {
  2052. pauseTracking();
  2053. try {
  2054. cleanup();
  2055. } finally {
  2056. resetTracking();
  2057. }
  2058. }
  2059. const currentEffect = activeWatcher;
  2060. activeWatcher = effect;
  2061. try {
  2062. return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
  2063. } finally {
  2064. activeWatcher = currentEffect;
  2065. }
  2066. };
  2067. }
  2068. } else {
  2069. getter = NOOP;
  2070. warnInvalidSource(source);
  2071. }
  2072. if (cb && deep) {
  2073. const baseGetter = getter;
  2074. const depth = deep === true ? Infinity : deep;
  2075. getter = () => traverse(baseGetter(), depth);
  2076. }
  2077. const scope = getCurrentScope();
  2078. const watchHandle = () => {
  2079. effect.stop();
  2080. if (scope) {
  2081. remove(scope.effects, effect);
  2082. }
  2083. };
  2084. if (once && cb) {
  2085. const _cb = cb;
  2086. cb = (...args) => {
  2087. _cb(...args);
  2088. watchHandle();
  2089. };
  2090. }
  2091. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2092. const job = (immediateFirstRun) => {
  2093. if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
  2094. return;
  2095. }
  2096. if (cb) {
  2097. const newValue = effect.run();
  2098. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
  2099. if (cleanup) {
  2100. cleanup();
  2101. }
  2102. const currentWatcher = activeWatcher;
  2103. activeWatcher = effect;
  2104. try {
  2105. const args = [
  2106. newValue,
  2107. // pass undefined as the old value when it's changed for the first time
  2108. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  2109. boundCleanup
  2110. ];
  2111. call ? call(cb, 3, args) : (
  2112. // @ts-expect-error
  2113. cb(...args)
  2114. );
  2115. oldValue = newValue;
  2116. } finally {
  2117. activeWatcher = currentWatcher;
  2118. }
  2119. }
  2120. } else {
  2121. effect.run();
  2122. }
  2123. };
  2124. if (augmentJob) {
  2125. augmentJob(job);
  2126. }
  2127. effect = new ReactiveEffect(getter);
  2128. effect.scheduler = scheduler ? () => scheduler(job, false) : job;
  2129. boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
  2130. cleanup = effect.onStop = () => {
  2131. const cleanups = cleanupMap.get(effect);
  2132. if (cleanups) {
  2133. if (call) {
  2134. call(cleanups, 4);
  2135. } else {
  2136. for (const cleanup2 of cleanups) cleanup2();
  2137. }
  2138. cleanupMap.delete(effect);
  2139. }
  2140. };
  2141. {
  2142. effect.onTrack = options.onTrack;
  2143. effect.onTrigger = options.onTrigger;
  2144. }
  2145. if (cb) {
  2146. if (immediate) {
  2147. job(true);
  2148. } else {
  2149. oldValue = effect.run();
  2150. }
  2151. } else if (scheduler) {
  2152. scheduler(job.bind(null, true), true);
  2153. } else {
  2154. effect.run();
  2155. }
  2156. watchHandle.pause = effect.pause.bind(effect);
  2157. watchHandle.resume = effect.resume.bind(effect);
  2158. watchHandle.stop = watchHandle;
  2159. return watchHandle;
  2160. }
  2161. function traverse(value, depth = Infinity, seen) {
  2162. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  2163. return value;
  2164. }
  2165. seen = seen || /* @__PURE__ */ new Set();
  2166. if (seen.has(value)) {
  2167. return value;
  2168. }
  2169. seen.add(value);
  2170. depth--;
  2171. if (isRef(value)) {
  2172. traverse(value.value, depth, seen);
  2173. } else if (isArray(value)) {
  2174. for (let i = 0; i < value.length; i++) {
  2175. traverse(value[i], depth, seen);
  2176. }
  2177. } else if (isSet(value) || isMap(value)) {
  2178. value.forEach((v) => {
  2179. traverse(v, depth, seen);
  2180. });
  2181. } else if (isPlainObject(value)) {
  2182. for (const key in value) {
  2183. traverse(value[key], depth, seen);
  2184. }
  2185. for (const key of Object.getOwnPropertySymbols(value)) {
  2186. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  2187. traverse(value[key], depth, seen);
  2188. }
  2189. }
  2190. }
  2191. return value;
  2192. }
  2193. const stack$1 = [];
  2194. function pushWarningContext(vnode) {
  2195. stack$1.push(vnode);
  2196. }
  2197. function popWarningContext() {
  2198. stack$1.pop();
  2199. }
  2200. let isWarning = false;
  2201. function warn$1(msg, ...args) {
  2202. if (isWarning) return;
  2203. isWarning = true;
  2204. pauseTracking();
  2205. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  2206. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  2207. const trace = getComponentTrace();
  2208. if (appWarnHandler) {
  2209. callWithErrorHandling(
  2210. appWarnHandler,
  2211. instance,
  2212. 11,
  2213. [
  2214. // eslint-disable-next-line no-restricted-syntax
  2215. msg + args.map((a) => {
  2216. var _a, _b;
  2217. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  2218. }).join(""),
  2219. instance && instance.proxy,
  2220. trace.map(
  2221. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  2222. ).join("\n"),
  2223. trace
  2224. ]
  2225. );
  2226. } else {
  2227. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  2228. if (trace.length && // avoid spamming console during tests
  2229. true) {
  2230. warnArgs.push(`
  2231. `, ...formatTrace(trace));
  2232. }
  2233. console.warn(...warnArgs);
  2234. }
  2235. resetTracking();
  2236. isWarning = false;
  2237. }
  2238. function getComponentTrace() {
  2239. let currentVNode = stack$1[stack$1.length - 1];
  2240. if (!currentVNode) {
  2241. return [];
  2242. }
  2243. const normalizedStack = [];
  2244. while (currentVNode) {
  2245. const last = normalizedStack[0];
  2246. if (last && last.vnode === currentVNode) {
  2247. last.recurseCount++;
  2248. } else {
  2249. normalizedStack.push({
  2250. vnode: currentVNode,
  2251. recurseCount: 0
  2252. });
  2253. }
  2254. const parentInstance = currentVNode.component && currentVNode.component.parent;
  2255. currentVNode = parentInstance && parentInstance.vnode;
  2256. }
  2257. return normalizedStack;
  2258. }
  2259. function formatTrace(trace) {
  2260. const logs = [];
  2261. trace.forEach((entry, i) => {
  2262. logs.push(...i === 0 ? [] : [`
  2263. `], ...formatTraceEntry(entry));
  2264. });
  2265. return logs;
  2266. }
  2267. function formatTraceEntry({ vnode, recurseCount }) {
  2268. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  2269. const isRoot = vnode.component ? vnode.component.parent == null : false;
  2270. const open = ` at <${formatComponentName(
  2271. vnode.component,
  2272. vnode.type,
  2273. isRoot
  2274. )}`;
  2275. const close = `>` + postfix;
  2276. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  2277. }
  2278. function formatProps(props) {
  2279. const res = [];
  2280. const keys = Object.keys(props);
  2281. keys.slice(0, 3).forEach((key) => {
  2282. res.push(...formatProp(key, props[key]));
  2283. });
  2284. if (keys.length > 3) {
  2285. res.push(` ...`);
  2286. }
  2287. return res;
  2288. }
  2289. function formatProp(key, value, raw) {
  2290. if (isString(value)) {
  2291. value = JSON.stringify(value);
  2292. return raw ? value : [`${key}=${value}`];
  2293. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  2294. return raw ? value : [`${key}=${value}`];
  2295. } else if (isRef(value)) {
  2296. value = formatProp(key, toRaw(value.value), true);
  2297. return raw ? value : [`${key}=Ref<`, value, `>`];
  2298. } else if (isFunction(value)) {
  2299. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  2300. } else {
  2301. value = toRaw(value);
  2302. return raw ? value : [`${key}=`, value];
  2303. }
  2304. }
  2305. function assertNumber(val, type) {
  2306. if (val === void 0) {
  2307. return;
  2308. } else if (typeof val !== "number") {
  2309. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  2310. } else if (isNaN(val)) {
  2311. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  2312. }
  2313. }
  2314. const ErrorCodes = {
  2315. "SETUP_FUNCTION": 0,
  2316. "0": "SETUP_FUNCTION",
  2317. "RENDER_FUNCTION": 1,
  2318. "1": "RENDER_FUNCTION",
  2319. "NATIVE_EVENT_HANDLER": 5,
  2320. "5": "NATIVE_EVENT_HANDLER",
  2321. "COMPONENT_EVENT_HANDLER": 6,
  2322. "6": "COMPONENT_EVENT_HANDLER",
  2323. "VNODE_HOOK": 7,
  2324. "7": "VNODE_HOOK",
  2325. "DIRECTIVE_HOOK": 8,
  2326. "8": "DIRECTIVE_HOOK",
  2327. "TRANSITION_HOOK": 9,
  2328. "9": "TRANSITION_HOOK",
  2329. "APP_ERROR_HANDLER": 10,
  2330. "10": "APP_ERROR_HANDLER",
  2331. "APP_WARN_HANDLER": 11,
  2332. "11": "APP_WARN_HANDLER",
  2333. "FUNCTION_REF": 12,
  2334. "12": "FUNCTION_REF",
  2335. "ASYNC_COMPONENT_LOADER": 13,
  2336. "13": "ASYNC_COMPONENT_LOADER",
  2337. "SCHEDULER": 14,
  2338. "14": "SCHEDULER",
  2339. "COMPONENT_UPDATE": 15,
  2340. "15": "COMPONENT_UPDATE",
  2341. "APP_UNMOUNT_CLEANUP": 16,
  2342. "16": "APP_UNMOUNT_CLEANUP"
  2343. };
  2344. const ErrorTypeStrings$1 = {
  2345. ["sp"]: "serverPrefetch hook",
  2346. ["bc"]: "beforeCreate hook",
  2347. ["c"]: "created hook",
  2348. ["bm"]: "beforeMount hook",
  2349. ["m"]: "mounted hook",
  2350. ["bu"]: "beforeUpdate hook",
  2351. ["u"]: "updated",
  2352. ["bum"]: "beforeUnmount hook",
  2353. ["um"]: "unmounted hook",
  2354. ["a"]: "activated hook",
  2355. ["da"]: "deactivated hook",
  2356. ["ec"]: "errorCaptured hook",
  2357. ["rtc"]: "renderTracked hook",
  2358. ["rtg"]: "renderTriggered hook",
  2359. [0]: "setup function",
  2360. [1]: "render function",
  2361. [2]: "watcher getter",
  2362. [3]: "watcher callback",
  2363. [4]: "watcher cleanup function",
  2364. [5]: "native event handler",
  2365. [6]: "component event handler",
  2366. [7]: "vnode hook",
  2367. [8]: "directive hook",
  2368. [9]: "transition hook",
  2369. [10]: "app errorHandler",
  2370. [11]: "app warnHandler",
  2371. [12]: "ref function",
  2372. [13]: "async component loader",
  2373. [14]: "scheduler flush",
  2374. [15]: "component update",
  2375. [16]: "app unmount cleanup function"
  2376. };
  2377. function callWithErrorHandling(fn, instance, type, args) {
  2378. try {
  2379. return args ? fn(...args) : fn();
  2380. } catch (err) {
  2381. handleError(err, instance, type);
  2382. }
  2383. }
  2384. function callWithAsyncErrorHandling(fn, instance, type, args) {
  2385. if (isFunction(fn)) {
  2386. const res = callWithErrorHandling(fn, instance, type, args);
  2387. if (res && isPromise(res)) {
  2388. res.catch((err) => {
  2389. handleError(err, instance, type);
  2390. });
  2391. }
  2392. return res;
  2393. }
  2394. if (isArray(fn)) {
  2395. const values = [];
  2396. for (let i = 0; i < fn.length; i++) {
  2397. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  2398. }
  2399. return values;
  2400. } else {
  2401. warn$1(
  2402. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  2403. );
  2404. }
  2405. }
  2406. function handleError(err, instance, type, throwInDev = true) {
  2407. const contextVNode = instance ? instance.vnode : null;
  2408. const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
  2409. if (instance) {
  2410. let cur = instance.parent;
  2411. const exposedInstance = instance.proxy;
  2412. const errorInfo = ErrorTypeStrings$1[type] ;
  2413. while (cur) {
  2414. const errorCapturedHooks = cur.ec;
  2415. if (errorCapturedHooks) {
  2416. for (let i = 0; i < errorCapturedHooks.length; i++) {
  2417. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  2418. return;
  2419. }
  2420. }
  2421. }
  2422. cur = cur.parent;
  2423. }
  2424. if (errorHandler) {
  2425. pauseTracking();
  2426. callWithErrorHandling(errorHandler, null, 10, [
  2427. err,
  2428. exposedInstance,
  2429. errorInfo
  2430. ]);
  2431. resetTracking();
  2432. return;
  2433. }
  2434. }
  2435. logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
  2436. }
  2437. function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
  2438. {
  2439. const info = ErrorTypeStrings$1[type];
  2440. if (contextVNode) {
  2441. pushWarningContext(contextVNode);
  2442. }
  2443. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  2444. if (contextVNode) {
  2445. popWarningContext();
  2446. }
  2447. if (throwInDev) {
  2448. throw err;
  2449. } else {
  2450. console.error(err);
  2451. }
  2452. }
  2453. }
  2454. const queue = [];
  2455. let flushIndex = -1;
  2456. const pendingPostFlushCbs = [];
  2457. let activePostFlushCbs = null;
  2458. let postFlushIndex = 0;
  2459. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  2460. let currentFlushPromise = null;
  2461. const RECURSION_LIMIT = 100;
  2462. function nextTick(fn) {
  2463. const p = currentFlushPromise || resolvedPromise;
  2464. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  2465. }
  2466. function findInsertionIndex(id) {
  2467. let start = flushIndex + 1;
  2468. let end = queue.length;
  2469. while (start < end) {
  2470. const middle = start + end >>> 1;
  2471. const middleJob = queue[middle];
  2472. const middleJobId = getId(middleJob);
  2473. if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
  2474. start = middle + 1;
  2475. } else {
  2476. end = middle;
  2477. }
  2478. }
  2479. return start;
  2480. }
  2481. function queueJob(job) {
  2482. if (!(job.flags & 1)) {
  2483. const jobId = getId(job);
  2484. const lastJob = queue[queue.length - 1];
  2485. if (!lastJob || // fast path when the job id is larger than the tail
  2486. !(job.flags & 2) && jobId >= getId(lastJob)) {
  2487. queue.push(job);
  2488. } else {
  2489. queue.splice(findInsertionIndex(jobId), 0, job);
  2490. }
  2491. job.flags |= 1;
  2492. queueFlush();
  2493. }
  2494. }
  2495. function queueFlush() {
  2496. if (!currentFlushPromise) {
  2497. currentFlushPromise = resolvedPromise.then(flushJobs);
  2498. }
  2499. }
  2500. function queuePostFlushCb(cb) {
  2501. if (!isArray(cb)) {
  2502. if (activePostFlushCbs && cb.id === -1) {
  2503. activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
  2504. } else if (!(cb.flags & 1)) {
  2505. pendingPostFlushCbs.push(cb);
  2506. cb.flags |= 1;
  2507. }
  2508. } else {
  2509. pendingPostFlushCbs.push(...cb);
  2510. }
  2511. queueFlush();
  2512. }
  2513. function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
  2514. {
  2515. seen = seen || /* @__PURE__ */ new Map();
  2516. }
  2517. for (; i < queue.length; i++) {
  2518. const cb = queue[i];
  2519. if (cb && cb.flags & 2) {
  2520. if (instance && cb.id !== instance.uid) {
  2521. continue;
  2522. }
  2523. if (checkRecursiveUpdates(seen, cb)) {
  2524. continue;
  2525. }
  2526. queue.splice(i, 1);
  2527. i--;
  2528. if (cb.flags & 4) {
  2529. cb.flags &= ~1;
  2530. }
  2531. cb();
  2532. if (!(cb.flags & 4)) {
  2533. cb.flags &= ~1;
  2534. }
  2535. }
  2536. }
  2537. }
  2538. function flushPostFlushCbs(seen) {
  2539. if (pendingPostFlushCbs.length) {
  2540. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  2541. (a, b) => getId(a) - getId(b)
  2542. );
  2543. pendingPostFlushCbs.length = 0;
  2544. if (activePostFlushCbs) {
  2545. activePostFlushCbs.push(...deduped);
  2546. return;
  2547. }
  2548. activePostFlushCbs = deduped;
  2549. {
  2550. seen = seen || /* @__PURE__ */ new Map();
  2551. }
  2552. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  2553. const cb = activePostFlushCbs[postFlushIndex];
  2554. if (checkRecursiveUpdates(seen, cb)) {
  2555. continue;
  2556. }
  2557. if (cb.flags & 4) {
  2558. cb.flags &= ~1;
  2559. }
  2560. if (!(cb.flags & 8)) cb();
  2561. cb.flags &= ~1;
  2562. }
  2563. activePostFlushCbs = null;
  2564. postFlushIndex = 0;
  2565. }
  2566. }
  2567. const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
  2568. function flushJobs(seen) {
  2569. {
  2570. seen = seen || /* @__PURE__ */ new Map();
  2571. }
  2572. const check = (job) => checkRecursiveUpdates(seen, job) ;
  2573. try {
  2574. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  2575. const job = queue[flushIndex];
  2576. if (job && !(job.flags & 8)) {
  2577. if (check(job)) {
  2578. continue;
  2579. }
  2580. if (job.flags & 4) {
  2581. job.flags &= ~1;
  2582. }
  2583. callWithErrorHandling(
  2584. job,
  2585. job.i,
  2586. job.i ? 15 : 14
  2587. );
  2588. if (!(job.flags & 4)) {
  2589. job.flags &= ~1;
  2590. }
  2591. }
  2592. }
  2593. } finally {
  2594. for (; flushIndex < queue.length; flushIndex++) {
  2595. const job = queue[flushIndex];
  2596. if (job) {
  2597. job.flags &= ~1;
  2598. }
  2599. }
  2600. flushIndex = -1;
  2601. queue.length = 0;
  2602. flushPostFlushCbs(seen);
  2603. currentFlushPromise = null;
  2604. if (queue.length || pendingPostFlushCbs.length) {
  2605. flushJobs(seen);
  2606. }
  2607. }
  2608. }
  2609. function checkRecursiveUpdates(seen, fn) {
  2610. const count = seen.get(fn) || 0;
  2611. if (count > RECURSION_LIMIT) {
  2612. const instance = fn.i;
  2613. const componentName = instance && getComponentName(instance.type);
  2614. handleError(
  2615. `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.`,
  2616. null,
  2617. 10
  2618. );
  2619. return true;
  2620. }
  2621. seen.set(fn, count + 1);
  2622. return false;
  2623. }
  2624. let isHmrUpdating = false;
  2625. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2626. {
  2627. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2628. createRecord: tryWrap(createRecord),
  2629. rerender: tryWrap(rerender),
  2630. reload: tryWrap(reload)
  2631. };
  2632. }
  2633. const map = /* @__PURE__ */ new Map();
  2634. function registerHMR(instance) {
  2635. const id = instance.type.__hmrId;
  2636. let record = map.get(id);
  2637. if (!record) {
  2638. createRecord(id, instance.type);
  2639. record = map.get(id);
  2640. }
  2641. record.instances.add(instance);
  2642. }
  2643. function unregisterHMR(instance) {
  2644. map.get(instance.type.__hmrId).instances.delete(instance);
  2645. }
  2646. function createRecord(id, initialDef) {
  2647. if (map.has(id)) {
  2648. return false;
  2649. }
  2650. map.set(id, {
  2651. initialDef: normalizeClassComponent(initialDef),
  2652. instances: /* @__PURE__ */ new Set()
  2653. });
  2654. return true;
  2655. }
  2656. function normalizeClassComponent(component) {
  2657. return isClassComponent(component) ? component.__vccOpts : component;
  2658. }
  2659. function rerender(id, newRender) {
  2660. const record = map.get(id);
  2661. if (!record) {
  2662. return;
  2663. }
  2664. record.initialDef.render = newRender;
  2665. [...record.instances].forEach((instance) => {
  2666. if (newRender) {
  2667. instance.render = newRender;
  2668. normalizeClassComponent(instance.type).render = newRender;
  2669. }
  2670. instance.renderCache = [];
  2671. isHmrUpdating = true;
  2672. instance.update();
  2673. isHmrUpdating = false;
  2674. });
  2675. }
  2676. function reload(id, newComp) {
  2677. const record = map.get(id);
  2678. if (!record) return;
  2679. newComp = normalizeClassComponent(newComp);
  2680. updateComponentDef(record.initialDef, newComp);
  2681. const instances = [...record.instances];
  2682. for (let i = 0; i < instances.length; i++) {
  2683. const instance = instances[i];
  2684. const oldComp = normalizeClassComponent(instance.type);
  2685. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2686. if (!dirtyInstances) {
  2687. if (oldComp !== record.initialDef) {
  2688. updateComponentDef(oldComp, newComp);
  2689. }
  2690. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2691. }
  2692. dirtyInstances.add(instance);
  2693. instance.appContext.propsCache.delete(instance.type);
  2694. instance.appContext.emitsCache.delete(instance.type);
  2695. instance.appContext.optionsCache.delete(instance.type);
  2696. if (instance.ceReload) {
  2697. dirtyInstances.add(instance);
  2698. instance.ceReload(newComp.styles);
  2699. dirtyInstances.delete(instance);
  2700. } else if (instance.parent) {
  2701. queueJob(() => {
  2702. isHmrUpdating = true;
  2703. instance.parent.update();
  2704. isHmrUpdating = false;
  2705. dirtyInstances.delete(instance);
  2706. });
  2707. } else if (instance.appContext.reload) {
  2708. instance.appContext.reload();
  2709. } else if (typeof window !== "undefined") {
  2710. window.location.reload();
  2711. } else {
  2712. console.warn(
  2713. "[HMR] Root or manually mounted instance modified. Full reload required."
  2714. );
  2715. }
  2716. if (instance.root.ce && instance !== instance.root) {
  2717. instance.root.ce._removeChildStyle(oldComp);
  2718. }
  2719. }
  2720. queuePostFlushCb(() => {
  2721. hmrDirtyComponents.clear();
  2722. });
  2723. }
  2724. function updateComponentDef(oldComp, newComp) {
  2725. extend(oldComp, newComp);
  2726. for (const key in oldComp) {
  2727. if (key !== "__file" && !(key in newComp)) {
  2728. delete oldComp[key];
  2729. }
  2730. }
  2731. }
  2732. function tryWrap(fn) {
  2733. return (id, arg) => {
  2734. try {
  2735. return fn(id, arg);
  2736. } catch (e) {
  2737. console.error(e);
  2738. console.warn(
  2739. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2740. );
  2741. }
  2742. };
  2743. }
  2744. let devtools$1;
  2745. let buffer = [];
  2746. let devtoolsNotInstalled = false;
  2747. function emit$1(event, ...args) {
  2748. if (devtools$1) {
  2749. devtools$1.emit(event, ...args);
  2750. } else if (!devtoolsNotInstalled) {
  2751. buffer.push({ event, args });
  2752. }
  2753. }
  2754. function setDevtoolsHook$1(hook, target) {
  2755. var _a, _b;
  2756. devtools$1 = hook;
  2757. if (devtools$1) {
  2758. devtools$1.enabled = true;
  2759. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2760. buffer = [];
  2761. } else if (
  2762. // handle late devtools injection - only do this if we are in an actual
  2763. // browser environment to avoid the timer handle stalling test runner exit
  2764. // (#4815)
  2765. typeof window !== "undefined" && // some envs mock window but not fully
  2766. window.HTMLElement && // also exclude jsdom
  2767. // eslint-disable-next-line no-restricted-syntax
  2768. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2769. ) {
  2770. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2771. replay.push((newHook) => {
  2772. setDevtoolsHook$1(newHook, target);
  2773. });
  2774. setTimeout(() => {
  2775. if (!devtools$1) {
  2776. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2777. devtoolsNotInstalled = true;
  2778. buffer = [];
  2779. }
  2780. }, 3e3);
  2781. } else {
  2782. devtoolsNotInstalled = true;
  2783. buffer = [];
  2784. }
  2785. }
  2786. function devtoolsInitApp(app, version) {
  2787. emit$1("app:init" /* APP_INIT */, app, version, {
  2788. Fragment,
  2789. Text,
  2790. Comment,
  2791. Static
  2792. });
  2793. }
  2794. function devtoolsUnmountApp(app) {
  2795. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2796. }
  2797. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
  2798. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2799. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2800. "component:removed" /* COMPONENT_REMOVED */
  2801. );
  2802. const devtoolsComponentRemoved = (component) => {
  2803. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2804. !devtools$1.cleanupBuffer(component)) {
  2805. _devtoolsComponentRemoved(component);
  2806. }
  2807. };
  2808. /*! #__NO_SIDE_EFFECTS__ */
  2809. // @__NO_SIDE_EFFECTS__
  2810. function createDevtoolsComponentHook(hook) {
  2811. return (component) => {
  2812. emit$1(
  2813. hook,
  2814. component.appContext.app,
  2815. component.uid,
  2816. component.parent ? component.parent.uid : void 0,
  2817. component
  2818. );
  2819. };
  2820. }
  2821. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
  2822. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
  2823. function createDevtoolsPerformanceHook(hook) {
  2824. return (component, type, time) => {
  2825. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2826. };
  2827. }
  2828. function devtoolsComponentEmit(component, event, params) {
  2829. emit$1(
  2830. "component:emit" /* COMPONENT_EMIT */,
  2831. component.appContext.app,
  2832. component,
  2833. event,
  2834. params
  2835. );
  2836. }
  2837. let currentRenderingInstance = null;
  2838. let currentScopeId = null;
  2839. function setCurrentRenderingInstance(instance) {
  2840. const prev = currentRenderingInstance;
  2841. currentRenderingInstance = instance;
  2842. currentScopeId = instance && instance.type.__scopeId || null;
  2843. return prev;
  2844. }
  2845. function pushScopeId(id) {
  2846. currentScopeId = id;
  2847. }
  2848. function popScopeId() {
  2849. currentScopeId = null;
  2850. }
  2851. const withScopeId = (_id) => withCtx;
  2852. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2853. if (!ctx) return fn;
  2854. if (fn._n) {
  2855. return fn;
  2856. }
  2857. const renderFnWithContext = (...args) => {
  2858. if (renderFnWithContext._d) {
  2859. setBlockTracking(-1);
  2860. }
  2861. const prevInstance = setCurrentRenderingInstance(ctx);
  2862. let res;
  2863. try {
  2864. res = fn(...args);
  2865. } finally {
  2866. setCurrentRenderingInstance(prevInstance);
  2867. if (renderFnWithContext._d) {
  2868. setBlockTracking(1);
  2869. }
  2870. }
  2871. {
  2872. devtoolsComponentUpdated(ctx);
  2873. }
  2874. return res;
  2875. };
  2876. renderFnWithContext._n = true;
  2877. renderFnWithContext._c = true;
  2878. renderFnWithContext._d = true;
  2879. return renderFnWithContext;
  2880. }
  2881. function validateDirectiveName(name) {
  2882. if (isBuiltInDirective(name)) {
  2883. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2884. }
  2885. }
  2886. function withDirectives(vnode, directives) {
  2887. if (currentRenderingInstance === null) {
  2888. warn$1(`withDirectives can only be used inside render functions.`);
  2889. return vnode;
  2890. }
  2891. const instance = getComponentPublicInstance(currentRenderingInstance);
  2892. const bindings = vnode.dirs || (vnode.dirs = []);
  2893. for (let i = 0; i < directives.length; i++) {
  2894. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  2895. if (dir) {
  2896. if (isFunction(dir)) {
  2897. dir = {
  2898. mounted: dir,
  2899. updated: dir
  2900. };
  2901. }
  2902. if (dir.deep) {
  2903. traverse(value);
  2904. }
  2905. bindings.push({
  2906. dir,
  2907. instance,
  2908. value,
  2909. oldValue: void 0,
  2910. arg,
  2911. modifiers
  2912. });
  2913. }
  2914. }
  2915. return vnode;
  2916. }
  2917. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  2918. const bindings = vnode.dirs;
  2919. const oldBindings = prevVNode && prevVNode.dirs;
  2920. for (let i = 0; i < bindings.length; i++) {
  2921. const binding = bindings[i];
  2922. if (oldBindings) {
  2923. binding.oldValue = oldBindings[i].value;
  2924. }
  2925. let hook = binding.dir[name];
  2926. if (hook) {
  2927. pauseTracking();
  2928. callWithAsyncErrorHandling(hook, instance, 8, [
  2929. vnode.el,
  2930. binding,
  2931. vnode,
  2932. prevVNode
  2933. ]);
  2934. resetTracking();
  2935. }
  2936. }
  2937. }
  2938. const TeleportEndKey = Symbol("_vte");
  2939. const isTeleport = (type) => type.__isTeleport;
  2940. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  2941. const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
  2942. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  2943. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  2944. const resolveTarget = (props, select) => {
  2945. const targetSelector = props && props.to;
  2946. if (isString(targetSelector)) {
  2947. if (!select) {
  2948. warn$1(
  2949. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  2950. );
  2951. return null;
  2952. } else {
  2953. const target = select(targetSelector);
  2954. if (!target && !isTeleportDisabled(props)) {
  2955. warn$1(
  2956. `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.`
  2957. );
  2958. }
  2959. return target;
  2960. }
  2961. } else {
  2962. if (!targetSelector && !isTeleportDisabled(props)) {
  2963. warn$1(`Invalid Teleport target: ${targetSelector}`);
  2964. }
  2965. return targetSelector;
  2966. }
  2967. };
  2968. const TeleportImpl = {
  2969. name: "Teleport",
  2970. __isTeleport: true,
  2971. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  2972. const {
  2973. mc: mountChildren,
  2974. pc: patchChildren,
  2975. pbc: patchBlockChildren,
  2976. o: { insert, querySelector, createText, createComment }
  2977. } = internals;
  2978. const disabled = isTeleportDisabled(n2.props);
  2979. let { shapeFlag, children, dynamicChildren } = n2;
  2980. if (isHmrUpdating) {
  2981. optimized = false;
  2982. dynamicChildren = null;
  2983. }
  2984. if (n1 == null) {
  2985. const placeholder = n2.el = createComment("teleport start") ;
  2986. const mainAnchor = n2.anchor = createComment("teleport end") ;
  2987. insert(placeholder, container, anchor);
  2988. insert(mainAnchor, container, anchor);
  2989. const mount = (container2, anchor2) => {
  2990. if (shapeFlag & 16) {
  2991. if (parentComponent && parentComponent.isCE) {
  2992. parentComponent.ce._teleportTarget = container2;
  2993. }
  2994. mountChildren(
  2995. children,
  2996. container2,
  2997. anchor2,
  2998. parentComponent,
  2999. parentSuspense,
  3000. namespace,
  3001. slotScopeIds,
  3002. optimized
  3003. );
  3004. }
  3005. };
  3006. const mountToTarget = () => {
  3007. const target = n2.target = resolveTarget(n2.props, querySelector);
  3008. const targetAnchor = prepareAnchor(target, n2, createText, insert);
  3009. if (target) {
  3010. if (namespace !== "svg" && isTargetSVG(target)) {
  3011. namespace = "svg";
  3012. } else if (namespace !== "mathml" && isTargetMathML(target)) {
  3013. namespace = "mathml";
  3014. }
  3015. if (!disabled) {
  3016. mount(target, targetAnchor);
  3017. updateCssVars(n2, false);
  3018. }
  3019. } else if (!disabled) {
  3020. warn$1(
  3021. "Invalid Teleport target on mount:",
  3022. target,
  3023. `(${typeof target})`
  3024. );
  3025. }
  3026. };
  3027. if (disabled) {
  3028. mount(container, mainAnchor);
  3029. updateCssVars(n2, true);
  3030. }
  3031. if (isTeleportDeferred(n2.props)) {
  3032. queuePostRenderEffect(mountToTarget, parentSuspense);
  3033. } else {
  3034. mountToTarget();
  3035. }
  3036. } else {
  3037. n2.el = n1.el;
  3038. n2.targetStart = n1.targetStart;
  3039. const mainAnchor = n2.anchor = n1.anchor;
  3040. const target = n2.target = n1.target;
  3041. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  3042. const wasDisabled = isTeleportDisabled(n1.props);
  3043. const currentContainer = wasDisabled ? container : target;
  3044. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  3045. if (namespace === "svg" || isTargetSVG(target)) {
  3046. namespace = "svg";
  3047. } else if (namespace === "mathml" || isTargetMathML(target)) {
  3048. namespace = "mathml";
  3049. }
  3050. if (dynamicChildren) {
  3051. patchBlockChildren(
  3052. n1.dynamicChildren,
  3053. dynamicChildren,
  3054. currentContainer,
  3055. parentComponent,
  3056. parentSuspense,
  3057. namespace,
  3058. slotScopeIds
  3059. );
  3060. traverseStaticChildren(n1, n2, true);
  3061. } else if (!optimized) {
  3062. patchChildren(
  3063. n1,
  3064. n2,
  3065. currentContainer,
  3066. currentAnchor,
  3067. parentComponent,
  3068. parentSuspense,
  3069. namespace,
  3070. slotScopeIds,
  3071. false
  3072. );
  3073. }
  3074. if (disabled) {
  3075. if (!wasDisabled) {
  3076. moveTeleport(
  3077. n2,
  3078. container,
  3079. mainAnchor,
  3080. internals,
  3081. 1
  3082. );
  3083. } else {
  3084. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  3085. n2.props.to = n1.props.to;
  3086. }
  3087. }
  3088. } else {
  3089. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  3090. const nextTarget = n2.target = resolveTarget(
  3091. n2.props,
  3092. querySelector
  3093. );
  3094. if (nextTarget) {
  3095. moveTeleport(
  3096. n2,
  3097. nextTarget,
  3098. null,
  3099. internals,
  3100. 0
  3101. );
  3102. } else {
  3103. warn$1(
  3104. "Invalid Teleport target on update:",
  3105. target,
  3106. `(${typeof target})`
  3107. );
  3108. }
  3109. } else if (wasDisabled) {
  3110. moveTeleport(
  3111. n2,
  3112. target,
  3113. targetAnchor,
  3114. internals,
  3115. 1
  3116. );
  3117. }
  3118. }
  3119. updateCssVars(n2, disabled);
  3120. }
  3121. },
  3122. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  3123. const {
  3124. shapeFlag,
  3125. children,
  3126. anchor,
  3127. targetStart,
  3128. targetAnchor,
  3129. target,
  3130. props
  3131. } = vnode;
  3132. if (target) {
  3133. hostRemove(targetStart);
  3134. hostRemove(targetAnchor);
  3135. }
  3136. doRemove && hostRemove(anchor);
  3137. if (shapeFlag & 16) {
  3138. const shouldRemove = doRemove || !isTeleportDisabled(props);
  3139. for (let i = 0; i < children.length; i++) {
  3140. const child = children[i];
  3141. unmount(
  3142. child,
  3143. parentComponent,
  3144. parentSuspense,
  3145. shouldRemove,
  3146. !!child.dynamicChildren
  3147. );
  3148. }
  3149. }
  3150. },
  3151. move: moveTeleport,
  3152. hydrate: hydrateTeleport
  3153. };
  3154. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  3155. if (moveType === 0) {
  3156. insert(vnode.targetAnchor, container, parentAnchor);
  3157. }
  3158. const { el, anchor, shapeFlag, children, props } = vnode;
  3159. const isReorder = moveType === 2;
  3160. if (isReorder) {
  3161. insert(el, container, parentAnchor);
  3162. }
  3163. if (!isReorder || isTeleportDisabled(props)) {
  3164. if (shapeFlag & 16) {
  3165. for (let i = 0; i < children.length; i++) {
  3166. move(
  3167. children[i],
  3168. container,
  3169. parentAnchor,
  3170. 2
  3171. );
  3172. }
  3173. }
  3174. }
  3175. if (isReorder) {
  3176. insert(anchor, container, parentAnchor);
  3177. }
  3178. }
  3179. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  3180. o: { nextSibling, parentNode, querySelector, insert, createText }
  3181. }, hydrateChildren) {
  3182. const target = vnode.target = resolveTarget(
  3183. vnode.props,
  3184. querySelector
  3185. );
  3186. if (target) {
  3187. const disabled = isTeleportDisabled(vnode.props);
  3188. const targetNode = target._lpa || target.firstChild;
  3189. if (vnode.shapeFlag & 16) {
  3190. if (disabled) {
  3191. vnode.anchor = hydrateChildren(
  3192. nextSibling(node),
  3193. vnode,
  3194. parentNode(node),
  3195. parentComponent,
  3196. parentSuspense,
  3197. slotScopeIds,
  3198. optimized
  3199. );
  3200. vnode.targetStart = targetNode;
  3201. vnode.targetAnchor = targetNode && nextSibling(targetNode);
  3202. } else {
  3203. vnode.anchor = nextSibling(node);
  3204. let targetAnchor = targetNode;
  3205. while (targetAnchor) {
  3206. if (targetAnchor && targetAnchor.nodeType === 8) {
  3207. if (targetAnchor.data === "teleport start anchor") {
  3208. vnode.targetStart = targetAnchor;
  3209. } else if (targetAnchor.data === "teleport anchor") {
  3210. vnode.targetAnchor = targetAnchor;
  3211. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  3212. break;
  3213. }
  3214. }
  3215. targetAnchor = nextSibling(targetAnchor);
  3216. }
  3217. if (!vnode.targetAnchor) {
  3218. prepareAnchor(target, vnode, createText, insert);
  3219. }
  3220. hydrateChildren(
  3221. targetNode && nextSibling(targetNode),
  3222. vnode,
  3223. target,
  3224. parentComponent,
  3225. parentSuspense,
  3226. slotScopeIds,
  3227. optimized
  3228. );
  3229. }
  3230. }
  3231. updateCssVars(vnode, disabled);
  3232. }
  3233. return vnode.anchor && nextSibling(vnode.anchor);
  3234. }
  3235. const Teleport = TeleportImpl;
  3236. function updateCssVars(vnode, isDisabled) {
  3237. const ctx = vnode.ctx;
  3238. if (ctx && ctx.ut) {
  3239. let node, anchor;
  3240. if (isDisabled) {
  3241. node = vnode.el;
  3242. anchor = vnode.anchor;
  3243. } else {
  3244. node = vnode.targetStart;
  3245. anchor = vnode.targetAnchor;
  3246. }
  3247. while (node && node !== anchor) {
  3248. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  3249. node = node.nextSibling;
  3250. }
  3251. ctx.ut();
  3252. }
  3253. }
  3254. function prepareAnchor(target, vnode, createText, insert) {
  3255. const targetStart = vnode.targetStart = createText("");
  3256. const targetAnchor = vnode.targetAnchor = createText("");
  3257. targetStart[TeleportEndKey] = targetAnchor;
  3258. if (target) {
  3259. insert(targetStart, target);
  3260. insert(targetAnchor, target);
  3261. }
  3262. return targetAnchor;
  3263. }
  3264. const leaveCbKey = Symbol("_leaveCb");
  3265. const enterCbKey$1 = Symbol("_enterCb");
  3266. function useTransitionState() {
  3267. const state = {
  3268. isMounted: false,
  3269. isLeaving: false,
  3270. isUnmounting: false,
  3271. leavingVNodes: /* @__PURE__ */ new Map()
  3272. };
  3273. onMounted(() => {
  3274. state.isMounted = true;
  3275. });
  3276. onBeforeUnmount(() => {
  3277. state.isUnmounting = true;
  3278. });
  3279. return state;
  3280. }
  3281. const TransitionHookValidator = [Function, Array];
  3282. const BaseTransitionPropsValidators = {
  3283. mode: String,
  3284. appear: Boolean,
  3285. persisted: Boolean,
  3286. // enter
  3287. onBeforeEnter: TransitionHookValidator,
  3288. onEnter: TransitionHookValidator,
  3289. onAfterEnter: TransitionHookValidator,
  3290. onEnterCancelled: TransitionHookValidator,
  3291. // leave
  3292. onBeforeLeave: TransitionHookValidator,
  3293. onLeave: TransitionHookValidator,
  3294. onAfterLeave: TransitionHookValidator,
  3295. onLeaveCancelled: TransitionHookValidator,
  3296. // appear
  3297. onBeforeAppear: TransitionHookValidator,
  3298. onAppear: TransitionHookValidator,
  3299. onAfterAppear: TransitionHookValidator,
  3300. onAppearCancelled: TransitionHookValidator
  3301. };
  3302. const recursiveGetSubtree = (instance) => {
  3303. const subTree = instance.subTree;
  3304. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  3305. };
  3306. const BaseTransitionImpl = {
  3307. name: `BaseTransition`,
  3308. props: BaseTransitionPropsValidators,
  3309. setup(props, { slots }) {
  3310. const instance = getCurrentInstance();
  3311. const state = useTransitionState();
  3312. return () => {
  3313. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3314. if (!children || !children.length) {
  3315. return;
  3316. }
  3317. const child = findNonCommentChild(children);
  3318. const rawProps = toRaw(props);
  3319. const { mode } = rawProps;
  3320. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3321. warn$1(`invalid <transition> mode: ${mode}`);
  3322. }
  3323. if (state.isLeaving) {
  3324. return emptyPlaceholder(child);
  3325. }
  3326. const innerChild = getInnerChild$1(child);
  3327. if (!innerChild) {
  3328. return emptyPlaceholder(child);
  3329. }
  3330. let enterHooks = resolveTransitionHooks(
  3331. innerChild,
  3332. rawProps,
  3333. state,
  3334. instance,
  3335. // #11061, ensure enterHooks is fresh after clone
  3336. (hooks) => enterHooks = hooks
  3337. );
  3338. if (innerChild.type !== Comment) {
  3339. setTransitionHooks(innerChild, enterHooks);
  3340. }
  3341. const oldChild = instance.subTree;
  3342. const oldInnerChild = oldChild && getInnerChild$1(oldChild);
  3343. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
  3344. const leavingHooks = resolveTransitionHooks(
  3345. oldInnerChild,
  3346. rawProps,
  3347. state,
  3348. instance
  3349. );
  3350. setTransitionHooks(oldInnerChild, leavingHooks);
  3351. if (mode === "out-in" && innerChild.type !== Comment) {
  3352. state.isLeaving = true;
  3353. leavingHooks.afterLeave = () => {
  3354. state.isLeaving = false;
  3355. if (!(instance.job.flags & 8)) {
  3356. instance.update();
  3357. }
  3358. delete leavingHooks.afterLeave;
  3359. };
  3360. return emptyPlaceholder(child);
  3361. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3362. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3363. const leavingVNodesCache = getLeavingNodesForType(
  3364. state,
  3365. oldInnerChild
  3366. );
  3367. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3368. el[leaveCbKey] = () => {
  3369. earlyRemove();
  3370. el[leaveCbKey] = void 0;
  3371. delete enterHooks.delayedLeave;
  3372. };
  3373. enterHooks.delayedLeave = delayedLeave;
  3374. };
  3375. }
  3376. }
  3377. return child;
  3378. };
  3379. }
  3380. };
  3381. function findNonCommentChild(children) {
  3382. let child = children[0];
  3383. if (children.length > 1) {
  3384. let hasFound = false;
  3385. for (const c of children) {
  3386. if (c.type !== Comment) {
  3387. if (hasFound) {
  3388. warn$1(
  3389. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3390. );
  3391. break;
  3392. }
  3393. child = c;
  3394. hasFound = true;
  3395. }
  3396. }
  3397. }
  3398. return child;
  3399. }
  3400. const BaseTransition = BaseTransitionImpl;
  3401. function getLeavingNodesForType(state, vnode) {
  3402. const { leavingVNodes } = state;
  3403. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3404. if (!leavingVNodesCache) {
  3405. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3406. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3407. }
  3408. return leavingVNodesCache;
  3409. }
  3410. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  3411. const {
  3412. appear,
  3413. mode,
  3414. persisted = false,
  3415. onBeforeEnter,
  3416. onEnter,
  3417. onAfterEnter,
  3418. onEnterCancelled,
  3419. onBeforeLeave,
  3420. onLeave,
  3421. onAfterLeave,
  3422. onLeaveCancelled,
  3423. onBeforeAppear,
  3424. onAppear,
  3425. onAfterAppear,
  3426. onAppearCancelled
  3427. } = props;
  3428. const key = String(vnode.key);
  3429. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3430. const callHook = (hook, args) => {
  3431. hook && callWithAsyncErrorHandling(
  3432. hook,
  3433. instance,
  3434. 9,
  3435. args
  3436. );
  3437. };
  3438. const callAsyncHook = (hook, args) => {
  3439. const done = args[1];
  3440. callHook(hook, args);
  3441. if (isArray(hook)) {
  3442. if (hook.every((hook2) => hook2.length <= 1)) done();
  3443. } else if (hook.length <= 1) {
  3444. done();
  3445. }
  3446. };
  3447. const hooks = {
  3448. mode,
  3449. persisted,
  3450. beforeEnter(el) {
  3451. let hook = onBeforeEnter;
  3452. if (!state.isMounted) {
  3453. if (appear) {
  3454. hook = onBeforeAppear || onBeforeEnter;
  3455. } else {
  3456. return;
  3457. }
  3458. }
  3459. if (el[leaveCbKey]) {
  3460. el[leaveCbKey](
  3461. true
  3462. /* cancelled */
  3463. );
  3464. }
  3465. const leavingVNode = leavingVNodesCache[key];
  3466. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3467. leavingVNode.el[leaveCbKey]();
  3468. }
  3469. callHook(hook, [el]);
  3470. },
  3471. enter(el) {
  3472. let hook = onEnter;
  3473. let afterHook = onAfterEnter;
  3474. let cancelHook = onEnterCancelled;
  3475. if (!state.isMounted) {
  3476. if (appear) {
  3477. hook = onAppear || onEnter;
  3478. afterHook = onAfterAppear || onAfterEnter;
  3479. cancelHook = onAppearCancelled || onEnterCancelled;
  3480. } else {
  3481. return;
  3482. }
  3483. }
  3484. let called = false;
  3485. const done = el[enterCbKey$1] = (cancelled) => {
  3486. if (called) return;
  3487. called = true;
  3488. if (cancelled) {
  3489. callHook(cancelHook, [el]);
  3490. } else {
  3491. callHook(afterHook, [el]);
  3492. }
  3493. if (hooks.delayedLeave) {
  3494. hooks.delayedLeave();
  3495. }
  3496. el[enterCbKey$1] = void 0;
  3497. };
  3498. if (hook) {
  3499. callAsyncHook(hook, [el, done]);
  3500. } else {
  3501. done();
  3502. }
  3503. },
  3504. leave(el, remove) {
  3505. const key2 = String(vnode.key);
  3506. if (el[enterCbKey$1]) {
  3507. el[enterCbKey$1](
  3508. true
  3509. /* cancelled */
  3510. );
  3511. }
  3512. if (state.isUnmounting) {
  3513. return remove();
  3514. }
  3515. callHook(onBeforeLeave, [el]);
  3516. let called = false;
  3517. const done = el[leaveCbKey] = (cancelled) => {
  3518. if (called) return;
  3519. called = true;
  3520. remove();
  3521. if (cancelled) {
  3522. callHook(onLeaveCancelled, [el]);
  3523. } else {
  3524. callHook(onAfterLeave, [el]);
  3525. }
  3526. el[leaveCbKey] = void 0;
  3527. if (leavingVNodesCache[key2] === vnode) {
  3528. delete leavingVNodesCache[key2];
  3529. }
  3530. };
  3531. leavingVNodesCache[key2] = vnode;
  3532. if (onLeave) {
  3533. callAsyncHook(onLeave, [el, done]);
  3534. } else {
  3535. done();
  3536. }
  3537. },
  3538. clone(vnode2) {
  3539. const hooks2 = resolveTransitionHooks(
  3540. vnode2,
  3541. props,
  3542. state,
  3543. instance,
  3544. postClone
  3545. );
  3546. if (postClone) postClone(hooks2);
  3547. return hooks2;
  3548. }
  3549. };
  3550. return hooks;
  3551. }
  3552. function emptyPlaceholder(vnode) {
  3553. if (isKeepAlive(vnode)) {
  3554. vnode = cloneVNode(vnode);
  3555. vnode.children = null;
  3556. return vnode;
  3557. }
  3558. }
  3559. function getInnerChild$1(vnode) {
  3560. if (!isKeepAlive(vnode)) {
  3561. if (isTeleport(vnode.type) && vnode.children) {
  3562. return findNonCommentChild(vnode.children);
  3563. }
  3564. return vnode;
  3565. }
  3566. if (vnode.component) {
  3567. return vnode.component.subTree;
  3568. }
  3569. const { shapeFlag, children } = vnode;
  3570. if (children) {
  3571. if (shapeFlag & 16) {
  3572. return children[0];
  3573. }
  3574. if (shapeFlag & 32 && isFunction(children.default)) {
  3575. return children.default();
  3576. }
  3577. }
  3578. }
  3579. function setTransitionHooks(vnode, hooks) {
  3580. if (vnode.shapeFlag & 6 && vnode.component) {
  3581. vnode.transition = hooks;
  3582. setTransitionHooks(vnode.component.subTree, hooks);
  3583. } else if (vnode.shapeFlag & 128) {
  3584. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3585. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3586. } else {
  3587. vnode.transition = hooks;
  3588. }
  3589. }
  3590. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3591. let ret = [];
  3592. let keyedFragmentCount = 0;
  3593. for (let i = 0; i < children.length; i++) {
  3594. let child = children[i];
  3595. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3596. if (child.type === Fragment) {
  3597. if (child.patchFlag & 128) keyedFragmentCount++;
  3598. ret = ret.concat(
  3599. getTransitionRawChildren(child.children, keepComment, key)
  3600. );
  3601. } else if (keepComment || child.type !== Comment) {
  3602. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3603. }
  3604. }
  3605. if (keyedFragmentCount > 1) {
  3606. for (let i = 0; i < ret.length; i++) {
  3607. ret[i].patchFlag = -2;
  3608. }
  3609. }
  3610. return ret;
  3611. }
  3612. /*! #__NO_SIDE_EFFECTS__ */
  3613. // @__NO_SIDE_EFFECTS__
  3614. function defineComponent(options, extraOptions) {
  3615. return isFunction(options) ? (
  3616. // #8236: extend call and options.name access are considered side-effects
  3617. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3618. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3619. ) : options;
  3620. }
  3621. function useId() {
  3622. const i = getCurrentInstance();
  3623. if (i) {
  3624. return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
  3625. } else {
  3626. warn$1(
  3627. `useId() is called when there is no active component instance to be associated with.`
  3628. );
  3629. }
  3630. return "";
  3631. }
  3632. function markAsyncBoundary(instance) {
  3633. instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
  3634. }
  3635. const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
  3636. function useTemplateRef(key) {
  3637. const i = getCurrentInstance();
  3638. const r = shallowRef(null);
  3639. if (i) {
  3640. const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
  3641. let desc;
  3642. if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
  3643. warn$1(`useTemplateRef('${key}') already exists.`);
  3644. } else {
  3645. Object.defineProperty(refs, key, {
  3646. enumerable: true,
  3647. get: () => r.value,
  3648. set: (val) => r.value = val
  3649. });
  3650. }
  3651. } else {
  3652. warn$1(
  3653. `useTemplateRef() is called when there is no active component instance to be associated with.`
  3654. );
  3655. }
  3656. const ret = readonly(r) ;
  3657. {
  3658. knownTemplateRefs.add(ret);
  3659. }
  3660. return ret;
  3661. }
  3662. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  3663. if (isArray(rawRef)) {
  3664. rawRef.forEach(
  3665. (r, i) => setRef(
  3666. r,
  3667. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  3668. parentSuspense,
  3669. vnode,
  3670. isUnmount
  3671. )
  3672. );
  3673. return;
  3674. }
  3675. if (isAsyncWrapper(vnode) && !isUnmount) {
  3676. return;
  3677. }
  3678. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  3679. const value = isUnmount ? null : refValue;
  3680. const { i: owner, r: ref } = rawRef;
  3681. if (!owner) {
  3682. warn$1(
  3683. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  3684. );
  3685. return;
  3686. }
  3687. const oldRef = oldRawRef && oldRawRef.r;
  3688. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  3689. const setupState = owner.setupState;
  3690. const rawSetupState = toRaw(setupState);
  3691. const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
  3692. {
  3693. if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
  3694. warn$1(
  3695. `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
  3696. );
  3697. }
  3698. if (knownTemplateRefs.has(rawSetupState[key])) {
  3699. return false;
  3700. }
  3701. }
  3702. return hasOwn(rawSetupState, key);
  3703. };
  3704. if (oldRef != null && oldRef !== ref) {
  3705. if (isString(oldRef)) {
  3706. refs[oldRef] = null;
  3707. if (canSetSetupRef(oldRef)) {
  3708. setupState[oldRef] = null;
  3709. }
  3710. } else if (isRef(oldRef)) {
  3711. oldRef.value = null;
  3712. }
  3713. }
  3714. if (isFunction(ref)) {
  3715. callWithErrorHandling(ref, owner, 12, [value, refs]);
  3716. } else {
  3717. const _isString = isString(ref);
  3718. const _isRef = isRef(ref);
  3719. if (_isString || _isRef) {
  3720. const doSet = () => {
  3721. if (rawRef.f) {
  3722. const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
  3723. if (isUnmount) {
  3724. isArray(existing) && remove(existing, refValue);
  3725. } else {
  3726. if (!isArray(existing)) {
  3727. if (_isString) {
  3728. refs[ref] = [refValue];
  3729. if (canSetSetupRef(ref)) {
  3730. setupState[ref] = refs[ref];
  3731. }
  3732. } else {
  3733. ref.value = [refValue];
  3734. if (rawRef.k) refs[rawRef.k] = ref.value;
  3735. }
  3736. } else if (!existing.includes(refValue)) {
  3737. existing.push(refValue);
  3738. }
  3739. }
  3740. } else if (_isString) {
  3741. refs[ref] = value;
  3742. if (canSetSetupRef(ref)) {
  3743. setupState[ref] = value;
  3744. }
  3745. } else if (_isRef) {
  3746. ref.value = value;
  3747. if (rawRef.k) refs[rawRef.k] = value;
  3748. } else {
  3749. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  3750. }
  3751. };
  3752. if (value) {
  3753. doSet.id = -1;
  3754. queuePostRenderEffect(doSet, parentSuspense);
  3755. } else {
  3756. doSet();
  3757. }
  3758. } else {
  3759. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  3760. }
  3761. }
  3762. }
  3763. let hasLoggedMismatchError = false;
  3764. const logMismatchError = () => {
  3765. if (hasLoggedMismatchError) {
  3766. return;
  3767. }
  3768. console.error("Hydration completed but contains mismatches.");
  3769. hasLoggedMismatchError = true;
  3770. };
  3771. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  3772. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  3773. const getContainerType = (container) => {
  3774. if (container.nodeType !== 1) return void 0;
  3775. if (isSVGContainer(container)) return "svg";
  3776. if (isMathMLContainer(container)) return "mathml";
  3777. return void 0;
  3778. };
  3779. const isComment = (node) => node.nodeType === 8;
  3780. function createHydrationFunctions(rendererInternals) {
  3781. const {
  3782. mt: mountComponent,
  3783. p: patch,
  3784. o: {
  3785. patchProp,
  3786. createText,
  3787. nextSibling,
  3788. parentNode,
  3789. remove,
  3790. insert,
  3791. createComment
  3792. }
  3793. } = rendererInternals;
  3794. const hydrate = (vnode, container) => {
  3795. if (!container.hasChildNodes()) {
  3796. warn$1(
  3797. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  3798. );
  3799. patch(null, vnode, container);
  3800. flushPostFlushCbs();
  3801. container._vnode = vnode;
  3802. return;
  3803. }
  3804. hydrateNode(container.firstChild, vnode, null, null, null);
  3805. flushPostFlushCbs();
  3806. container._vnode = vnode;
  3807. };
  3808. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  3809. optimized = optimized || !!vnode.dynamicChildren;
  3810. const isFragmentStart = isComment(node) && node.data === "[";
  3811. const onMismatch = () => handleMismatch(
  3812. node,
  3813. vnode,
  3814. parentComponent,
  3815. parentSuspense,
  3816. slotScopeIds,
  3817. isFragmentStart
  3818. );
  3819. const { type, ref, shapeFlag, patchFlag } = vnode;
  3820. let domType = node.nodeType;
  3821. vnode.el = node;
  3822. {
  3823. def(node, "__vnode", vnode, true);
  3824. def(node, "__vueParentComponent", parentComponent, true);
  3825. }
  3826. if (patchFlag === -2) {
  3827. optimized = false;
  3828. vnode.dynamicChildren = null;
  3829. }
  3830. let nextNode = null;
  3831. switch (type) {
  3832. case Text:
  3833. if (domType !== 3) {
  3834. if (vnode.children === "") {
  3835. insert(vnode.el = createText(""), parentNode(node), node);
  3836. nextNode = node;
  3837. } else {
  3838. nextNode = onMismatch();
  3839. }
  3840. } else {
  3841. if (node.data !== vnode.children) {
  3842. warn$1(
  3843. `Hydration text mismatch in`,
  3844. node.parentNode,
  3845. `
  3846. - rendered on server: ${JSON.stringify(
  3847. node.data
  3848. )}
  3849. - expected on client: ${JSON.stringify(vnode.children)}`
  3850. );
  3851. logMismatchError();
  3852. node.data = vnode.children;
  3853. }
  3854. nextNode = nextSibling(node);
  3855. }
  3856. break;
  3857. case Comment:
  3858. if (isTemplateNode(node)) {
  3859. nextNode = nextSibling(node);
  3860. replaceNode(
  3861. vnode.el = node.content.firstChild,
  3862. node,
  3863. parentComponent
  3864. );
  3865. } else if (domType !== 8 || isFragmentStart) {
  3866. nextNode = onMismatch();
  3867. } else {
  3868. nextNode = nextSibling(node);
  3869. }
  3870. break;
  3871. case Static:
  3872. if (isFragmentStart) {
  3873. node = nextSibling(node);
  3874. domType = node.nodeType;
  3875. }
  3876. if (domType === 1 || domType === 3) {
  3877. nextNode = node;
  3878. const needToAdoptContent = !vnode.children.length;
  3879. for (let i = 0; i < vnode.staticCount; i++) {
  3880. if (needToAdoptContent)
  3881. vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
  3882. if (i === vnode.staticCount - 1) {
  3883. vnode.anchor = nextNode;
  3884. }
  3885. nextNode = nextSibling(nextNode);
  3886. }
  3887. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  3888. } else {
  3889. onMismatch();
  3890. }
  3891. break;
  3892. case Fragment:
  3893. if (!isFragmentStart) {
  3894. nextNode = onMismatch();
  3895. } else {
  3896. nextNode = hydrateFragment(
  3897. node,
  3898. vnode,
  3899. parentComponent,
  3900. parentSuspense,
  3901. slotScopeIds,
  3902. optimized
  3903. );
  3904. }
  3905. break;
  3906. default:
  3907. if (shapeFlag & 1) {
  3908. if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  3909. nextNode = onMismatch();
  3910. } else {
  3911. nextNode = hydrateElement(
  3912. node,
  3913. vnode,
  3914. parentComponent,
  3915. parentSuspense,
  3916. slotScopeIds,
  3917. optimized
  3918. );
  3919. }
  3920. } else if (shapeFlag & 6) {
  3921. vnode.slotScopeIds = slotScopeIds;
  3922. const container = parentNode(node);
  3923. if (isFragmentStart) {
  3924. nextNode = locateClosingAnchor(node);
  3925. } else if (isComment(node) && node.data === "teleport start") {
  3926. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  3927. } else {
  3928. nextNode = nextSibling(node);
  3929. }
  3930. mountComponent(
  3931. vnode,
  3932. container,
  3933. null,
  3934. parentComponent,
  3935. parentSuspense,
  3936. getContainerType(container),
  3937. optimized
  3938. );
  3939. if (isAsyncWrapper(vnode)) {
  3940. let subTree;
  3941. if (isFragmentStart) {
  3942. subTree = createVNode(Fragment);
  3943. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  3944. } else {
  3945. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  3946. }
  3947. subTree.el = node;
  3948. vnode.component.subTree = subTree;
  3949. }
  3950. } else if (shapeFlag & 64) {
  3951. if (domType !== 8) {
  3952. nextNode = onMismatch();
  3953. } else {
  3954. nextNode = vnode.type.hydrate(
  3955. node,
  3956. vnode,
  3957. parentComponent,
  3958. parentSuspense,
  3959. slotScopeIds,
  3960. optimized,
  3961. rendererInternals,
  3962. hydrateChildren
  3963. );
  3964. }
  3965. } else if (shapeFlag & 128) {
  3966. nextNode = vnode.type.hydrate(
  3967. node,
  3968. vnode,
  3969. parentComponent,
  3970. parentSuspense,
  3971. getContainerType(parentNode(node)),
  3972. slotScopeIds,
  3973. optimized,
  3974. rendererInternals,
  3975. hydrateNode
  3976. );
  3977. } else {
  3978. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  3979. }
  3980. }
  3981. if (ref != null) {
  3982. setRef(ref, null, parentSuspense, vnode);
  3983. }
  3984. return nextNode;
  3985. };
  3986. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  3987. optimized = optimized || !!vnode.dynamicChildren;
  3988. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  3989. const forcePatch = type === "input" || type === "option";
  3990. {
  3991. if (dirs) {
  3992. invokeDirectiveHook(vnode, null, parentComponent, "created");
  3993. }
  3994. let needCallTransitionHooks = false;
  3995. if (isTemplateNode(el)) {
  3996. needCallTransitionHooks = needTransition(
  3997. null,
  3998. // no need check parentSuspense in hydration
  3999. transition
  4000. ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  4001. const content = el.content.firstChild;
  4002. if (needCallTransitionHooks) {
  4003. transition.beforeEnter(content);
  4004. }
  4005. replaceNode(content, el, parentComponent);
  4006. vnode.el = el = content;
  4007. }
  4008. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  4009. !(props && (props.innerHTML || props.textContent))) {
  4010. let next = hydrateChildren(
  4011. el.firstChild,
  4012. vnode,
  4013. el,
  4014. parentComponent,
  4015. parentSuspense,
  4016. slotScopeIds,
  4017. optimized
  4018. );
  4019. let hasWarned = false;
  4020. while (next) {
  4021. if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
  4022. if (!hasWarned) {
  4023. warn$1(
  4024. `Hydration children mismatch on`,
  4025. el,
  4026. `
  4027. Server rendered element contains more child nodes than client vdom.`
  4028. );
  4029. hasWarned = true;
  4030. }
  4031. logMismatchError();
  4032. }
  4033. const cur = next;
  4034. next = next.nextSibling;
  4035. remove(cur);
  4036. }
  4037. } else if (shapeFlag & 8) {
  4038. let clientText = vnode.children;
  4039. if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
  4040. clientText = clientText.slice(1);
  4041. }
  4042. if (el.textContent !== clientText) {
  4043. if (!isMismatchAllowed(el, 0 /* TEXT */)) {
  4044. warn$1(
  4045. `Hydration text content mismatch on`,
  4046. el,
  4047. `
  4048. - rendered on server: ${el.textContent}
  4049. - expected on client: ${vnode.children}`
  4050. );
  4051. logMismatchError();
  4052. }
  4053. el.textContent = vnode.children;
  4054. }
  4055. }
  4056. if (props) {
  4057. {
  4058. const isCustomElement = el.tagName.includes("-");
  4059. for (const key in props) {
  4060. if (// #11189 skip if this node has directives that have created hooks
  4061. // as it could have mutated the DOM in any possible way
  4062. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  4063. logMismatchError();
  4064. }
  4065. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  4066. key[0] === "." || isCustomElement) {
  4067. patchProp(el, key, null, props[key], void 0, parentComponent);
  4068. }
  4069. }
  4070. }
  4071. }
  4072. let vnodeHooks;
  4073. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  4074. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4075. }
  4076. if (dirs) {
  4077. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4078. }
  4079. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  4080. queueEffectWithSuspense(() => {
  4081. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4082. needCallTransitionHooks && transition.enter(el);
  4083. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4084. }, parentSuspense);
  4085. }
  4086. }
  4087. return el.nextSibling;
  4088. };
  4089. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4090. optimized = optimized || !!parentVNode.dynamicChildren;
  4091. const children = parentVNode.children;
  4092. const l = children.length;
  4093. let hasWarned = false;
  4094. for (let i = 0; i < l; i++) {
  4095. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  4096. const isText = vnode.type === Text;
  4097. if (node) {
  4098. if (isText && !optimized) {
  4099. if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
  4100. insert(
  4101. createText(
  4102. node.data.slice(vnode.children.length)
  4103. ),
  4104. container,
  4105. nextSibling(node)
  4106. );
  4107. node.data = vnode.children;
  4108. }
  4109. }
  4110. node = hydrateNode(
  4111. node,
  4112. vnode,
  4113. parentComponent,
  4114. parentSuspense,
  4115. slotScopeIds,
  4116. optimized
  4117. );
  4118. } else if (isText && !vnode.children) {
  4119. insert(vnode.el = createText(""), container);
  4120. } else {
  4121. if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
  4122. if (!hasWarned) {
  4123. warn$1(
  4124. `Hydration children mismatch on`,
  4125. container,
  4126. `
  4127. Server rendered element contains fewer child nodes than client vdom.`
  4128. );
  4129. hasWarned = true;
  4130. }
  4131. logMismatchError();
  4132. }
  4133. patch(
  4134. null,
  4135. vnode,
  4136. container,
  4137. null,
  4138. parentComponent,
  4139. parentSuspense,
  4140. getContainerType(container),
  4141. slotScopeIds
  4142. );
  4143. }
  4144. }
  4145. return node;
  4146. };
  4147. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4148. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  4149. if (fragmentSlotScopeIds) {
  4150. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4151. }
  4152. const container = parentNode(node);
  4153. const next = hydrateChildren(
  4154. nextSibling(node),
  4155. vnode,
  4156. container,
  4157. parentComponent,
  4158. parentSuspense,
  4159. slotScopeIds,
  4160. optimized
  4161. );
  4162. if (next && isComment(next) && next.data === "]") {
  4163. return nextSibling(vnode.anchor = next);
  4164. } else {
  4165. logMismatchError();
  4166. insert(vnode.anchor = createComment(`]`), container, next);
  4167. return next;
  4168. }
  4169. };
  4170. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  4171. if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
  4172. warn$1(
  4173. `Hydration node mismatch:
  4174. - rendered on server:`,
  4175. node,
  4176. node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  4177. `
  4178. - expected on client:`,
  4179. vnode.type
  4180. );
  4181. logMismatchError();
  4182. }
  4183. vnode.el = null;
  4184. if (isFragment) {
  4185. const end = locateClosingAnchor(node);
  4186. while (true) {
  4187. const next2 = nextSibling(node);
  4188. if (next2 && next2 !== end) {
  4189. remove(next2);
  4190. } else {
  4191. break;
  4192. }
  4193. }
  4194. }
  4195. const next = nextSibling(node);
  4196. const container = parentNode(node);
  4197. remove(node);
  4198. patch(
  4199. null,
  4200. vnode,
  4201. container,
  4202. next,
  4203. parentComponent,
  4204. parentSuspense,
  4205. getContainerType(container),
  4206. slotScopeIds
  4207. );
  4208. return next;
  4209. };
  4210. const locateClosingAnchor = (node, open = "[", close = "]") => {
  4211. let match = 0;
  4212. while (node) {
  4213. node = nextSibling(node);
  4214. if (node && isComment(node)) {
  4215. if (node.data === open) match++;
  4216. if (node.data === close) {
  4217. if (match === 0) {
  4218. return nextSibling(node);
  4219. } else {
  4220. match--;
  4221. }
  4222. }
  4223. }
  4224. }
  4225. return node;
  4226. };
  4227. const replaceNode = (newNode, oldNode, parentComponent) => {
  4228. const parentNode2 = oldNode.parentNode;
  4229. if (parentNode2) {
  4230. parentNode2.replaceChild(newNode, oldNode);
  4231. }
  4232. let parent = parentComponent;
  4233. while (parent) {
  4234. if (parent.vnode.el === oldNode) {
  4235. parent.vnode.el = parent.subTree.el = newNode;
  4236. }
  4237. parent = parent.parent;
  4238. }
  4239. };
  4240. const isTemplateNode = (node) => {
  4241. return node.nodeType === 1 && node.tagName === "TEMPLATE";
  4242. };
  4243. return [hydrate, hydrateNode];
  4244. }
  4245. function propHasMismatch(el, key, clientValue, vnode, instance) {
  4246. let mismatchType;
  4247. let mismatchKey;
  4248. let actual;
  4249. let expected;
  4250. if (key === "class") {
  4251. actual = el.getAttribute("class");
  4252. expected = normalizeClass(clientValue);
  4253. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  4254. mismatchType = 2 /* CLASS */;
  4255. mismatchKey = `class`;
  4256. }
  4257. } else if (key === "style") {
  4258. actual = el.getAttribute("style") || "";
  4259. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  4260. const actualMap = toStyleMap(actual);
  4261. const expectedMap = toStyleMap(expected);
  4262. if (vnode.dirs) {
  4263. for (const { dir, value } of vnode.dirs) {
  4264. if (dir.name === "show" && !value) {
  4265. expectedMap.set("display", "none");
  4266. }
  4267. }
  4268. }
  4269. if (instance) {
  4270. resolveCssVars(instance, vnode, expectedMap);
  4271. }
  4272. if (!isMapEqual(actualMap, expectedMap)) {
  4273. mismatchType = 3 /* STYLE */;
  4274. mismatchKey = "style";
  4275. }
  4276. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  4277. if (isBooleanAttr(key)) {
  4278. actual = el.hasAttribute(key);
  4279. expected = includeBooleanAttr(clientValue);
  4280. } else if (clientValue == null) {
  4281. actual = el.hasAttribute(key);
  4282. expected = false;
  4283. } else {
  4284. if (el.hasAttribute(key)) {
  4285. actual = el.getAttribute(key);
  4286. } else if (key === "value" && el.tagName === "TEXTAREA") {
  4287. actual = el.value;
  4288. } else {
  4289. actual = false;
  4290. }
  4291. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  4292. }
  4293. if (actual !== expected) {
  4294. mismatchType = 4 /* ATTRIBUTE */;
  4295. mismatchKey = key;
  4296. }
  4297. }
  4298. if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
  4299. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  4300. const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
  4301. const postSegment = `
  4302. - rendered on server: ${format(actual)}
  4303. - expected on client: ${format(expected)}
  4304. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  4305. You should fix the source of the mismatch.`;
  4306. {
  4307. warn$1(preSegment, el, postSegment);
  4308. }
  4309. return true;
  4310. }
  4311. return false;
  4312. }
  4313. function toClassSet(str) {
  4314. return new Set(str.trim().split(/\s+/));
  4315. }
  4316. function isSetEqual(a, b) {
  4317. if (a.size !== b.size) {
  4318. return false;
  4319. }
  4320. for (const s of a) {
  4321. if (!b.has(s)) {
  4322. return false;
  4323. }
  4324. }
  4325. return true;
  4326. }
  4327. function toStyleMap(str) {
  4328. const styleMap = /* @__PURE__ */ new Map();
  4329. for (const item of str.split(";")) {
  4330. let [key, value] = item.split(":");
  4331. key = key.trim();
  4332. value = value && value.trim();
  4333. if (key && value) {
  4334. styleMap.set(key, value);
  4335. }
  4336. }
  4337. return styleMap;
  4338. }
  4339. function isMapEqual(a, b) {
  4340. if (a.size !== b.size) {
  4341. return false;
  4342. }
  4343. for (const [key, value] of a) {
  4344. if (value !== b.get(key)) {
  4345. return false;
  4346. }
  4347. }
  4348. return true;
  4349. }
  4350. function resolveCssVars(instance, vnode, expectedMap) {
  4351. const root = instance.subTree;
  4352. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  4353. const cssVars = instance.getCssVars();
  4354. for (const key in cssVars) {
  4355. expectedMap.set(
  4356. `--${getEscapedCssVarName(key)}`,
  4357. String(cssVars[key])
  4358. );
  4359. }
  4360. }
  4361. if (vnode === root && instance.parent) {
  4362. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  4363. }
  4364. }
  4365. const allowMismatchAttr = "data-allow-mismatch";
  4366. const MismatchTypeString = {
  4367. [0 /* TEXT */]: "text",
  4368. [1 /* CHILDREN */]: "children",
  4369. [2 /* CLASS */]: "class",
  4370. [3 /* STYLE */]: "style",
  4371. [4 /* ATTRIBUTE */]: "attribute"
  4372. };
  4373. function isMismatchAllowed(el, allowedType) {
  4374. if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
  4375. while (el && !el.hasAttribute(allowMismatchAttr)) {
  4376. el = el.parentElement;
  4377. }
  4378. }
  4379. const allowedAttr = el && el.getAttribute(allowMismatchAttr);
  4380. if (allowedAttr == null) {
  4381. return false;
  4382. } else if (allowedAttr === "") {
  4383. return true;
  4384. } else {
  4385. const list = allowedAttr.split(",");
  4386. if (allowedType === 0 /* TEXT */ && list.includes("children")) {
  4387. return true;
  4388. }
  4389. return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
  4390. }
  4391. }
  4392. const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
  4393. const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
  4394. const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
  4395. const id = requestIdleCallback(hydrate, { timeout });
  4396. return () => cancelIdleCallback(id);
  4397. };
  4398. function elementIsVisibleInViewport(el) {
  4399. const { top, left, bottom, right } = el.getBoundingClientRect();
  4400. const { innerHeight, innerWidth } = window;
  4401. return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
  4402. }
  4403. const hydrateOnVisible = (opts) => (hydrate, forEach) => {
  4404. const ob = new IntersectionObserver((entries) => {
  4405. for (const e of entries) {
  4406. if (!e.isIntersecting) continue;
  4407. ob.disconnect();
  4408. hydrate();
  4409. break;
  4410. }
  4411. }, opts);
  4412. forEach((el) => {
  4413. if (!(el instanceof Element)) return;
  4414. if (elementIsVisibleInViewport(el)) {
  4415. hydrate();
  4416. ob.disconnect();
  4417. return false;
  4418. }
  4419. ob.observe(el);
  4420. });
  4421. return () => ob.disconnect();
  4422. };
  4423. const hydrateOnMediaQuery = (query) => (hydrate) => {
  4424. if (query) {
  4425. const mql = matchMedia(query);
  4426. if (mql.matches) {
  4427. hydrate();
  4428. } else {
  4429. mql.addEventListener("change", hydrate, { once: true });
  4430. return () => mql.removeEventListener("change", hydrate);
  4431. }
  4432. }
  4433. };
  4434. const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
  4435. if (isString(interactions)) interactions = [interactions];
  4436. let hasHydrated = false;
  4437. const doHydrate = (e) => {
  4438. if (!hasHydrated) {
  4439. hasHydrated = true;
  4440. teardown();
  4441. hydrate();
  4442. e.target.dispatchEvent(new e.constructor(e.type, e));
  4443. }
  4444. };
  4445. const teardown = () => {
  4446. forEach((el) => {
  4447. for (const i of interactions) {
  4448. el.removeEventListener(i, doHydrate);
  4449. }
  4450. });
  4451. };
  4452. forEach((el) => {
  4453. for (const i of interactions) {
  4454. el.addEventListener(i, doHydrate, { once: true });
  4455. }
  4456. });
  4457. return teardown;
  4458. };
  4459. function forEachElement(node, cb) {
  4460. if (isComment(node) && node.data === "[") {
  4461. let depth = 1;
  4462. let next = node.nextSibling;
  4463. while (next) {
  4464. if (next.nodeType === 1) {
  4465. const result = cb(next);
  4466. if (result === false) {
  4467. break;
  4468. }
  4469. } else if (isComment(next)) {
  4470. if (next.data === "]") {
  4471. if (--depth === 0) break;
  4472. } else if (next.data === "[") {
  4473. depth++;
  4474. }
  4475. }
  4476. next = next.nextSibling;
  4477. }
  4478. } else {
  4479. cb(node);
  4480. }
  4481. }
  4482. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  4483. /*! #__NO_SIDE_EFFECTS__ */
  4484. // @__NO_SIDE_EFFECTS__
  4485. function defineAsyncComponent(source) {
  4486. if (isFunction(source)) {
  4487. source = { loader: source };
  4488. }
  4489. const {
  4490. loader,
  4491. loadingComponent,
  4492. errorComponent,
  4493. delay = 200,
  4494. hydrate: hydrateStrategy,
  4495. timeout,
  4496. // undefined = never times out
  4497. suspensible = true,
  4498. onError: userOnError
  4499. } = source;
  4500. let pendingRequest = null;
  4501. let resolvedComp;
  4502. let retries = 0;
  4503. const retry = () => {
  4504. retries++;
  4505. pendingRequest = null;
  4506. return load();
  4507. };
  4508. const load = () => {
  4509. let thisRequest;
  4510. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  4511. err = err instanceof Error ? err : new Error(String(err));
  4512. if (userOnError) {
  4513. return new Promise((resolve, reject) => {
  4514. const userRetry = () => resolve(retry());
  4515. const userFail = () => reject(err);
  4516. userOnError(err, userRetry, userFail, retries + 1);
  4517. });
  4518. } else {
  4519. throw err;
  4520. }
  4521. }).then((comp) => {
  4522. if (thisRequest !== pendingRequest && pendingRequest) {
  4523. return pendingRequest;
  4524. }
  4525. if (!comp) {
  4526. warn$1(
  4527. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  4528. );
  4529. }
  4530. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  4531. comp = comp.default;
  4532. }
  4533. if (comp && !isObject(comp) && !isFunction(comp)) {
  4534. throw new Error(`Invalid async component load result: ${comp}`);
  4535. }
  4536. resolvedComp = comp;
  4537. return comp;
  4538. }));
  4539. };
  4540. return defineComponent({
  4541. name: "AsyncComponentWrapper",
  4542. __asyncLoader: load,
  4543. __asyncHydrate(el, instance, hydrate) {
  4544. const doHydrate = hydrateStrategy ? () => {
  4545. const teardown = hydrateStrategy(
  4546. hydrate,
  4547. (cb) => forEachElement(el, cb)
  4548. );
  4549. if (teardown) {
  4550. (instance.bum || (instance.bum = [])).push(teardown);
  4551. }
  4552. } : hydrate;
  4553. if (resolvedComp) {
  4554. doHydrate();
  4555. } else {
  4556. load().then(() => !instance.isUnmounted && doHydrate());
  4557. }
  4558. },
  4559. get __asyncResolved() {
  4560. return resolvedComp;
  4561. },
  4562. setup() {
  4563. const instance = currentInstance;
  4564. markAsyncBoundary(instance);
  4565. if (resolvedComp) {
  4566. return () => createInnerComp(resolvedComp, instance);
  4567. }
  4568. const onError = (err) => {
  4569. pendingRequest = null;
  4570. handleError(
  4571. err,
  4572. instance,
  4573. 13,
  4574. !errorComponent
  4575. );
  4576. };
  4577. if (suspensible && instance.suspense || isInSSRComponentSetup) {
  4578. return load().then((comp) => {
  4579. return () => createInnerComp(comp, instance);
  4580. }).catch((err) => {
  4581. onError(err);
  4582. return () => errorComponent ? createVNode(errorComponent, {
  4583. error: err
  4584. }) : null;
  4585. });
  4586. }
  4587. const loaded = ref(false);
  4588. const error = ref();
  4589. const delayed = ref(!!delay);
  4590. if (delay) {
  4591. setTimeout(() => {
  4592. delayed.value = false;
  4593. }, delay);
  4594. }
  4595. if (timeout != null) {
  4596. setTimeout(() => {
  4597. if (!loaded.value && !error.value) {
  4598. const err = new Error(
  4599. `Async component timed out after ${timeout}ms.`
  4600. );
  4601. onError(err);
  4602. error.value = err;
  4603. }
  4604. }, timeout);
  4605. }
  4606. load().then(() => {
  4607. loaded.value = true;
  4608. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  4609. instance.parent.update();
  4610. }
  4611. }).catch((err) => {
  4612. onError(err);
  4613. error.value = err;
  4614. });
  4615. return () => {
  4616. if (loaded.value && resolvedComp) {
  4617. return createInnerComp(resolvedComp, instance);
  4618. } else if (error.value && errorComponent) {
  4619. return createVNode(errorComponent, {
  4620. error: error.value
  4621. });
  4622. } else if (loadingComponent && !delayed.value) {
  4623. return createVNode(loadingComponent);
  4624. }
  4625. };
  4626. }
  4627. });
  4628. }
  4629. function createInnerComp(comp, parent) {
  4630. const { ref: ref2, props, children, ce } = parent.vnode;
  4631. const vnode = createVNode(comp, props, children);
  4632. vnode.ref = ref2;
  4633. vnode.ce = ce;
  4634. delete parent.vnode.ce;
  4635. return vnode;
  4636. }
  4637. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  4638. const KeepAliveImpl = {
  4639. name: `KeepAlive`,
  4640. // Marker for special handling inside the renderer. We are not using a ===
  4641. // check directly on KeepAlive in the renderer, because importing it directly
  4642. // would prevent it from being tree-shaken.
  4643. __isKeepAlive: true,
  4644. props: {
  4645. include: [String, RegExp, Array],
  4646. exclude: [String, RegExp, Array],
  4647. max: [String, Number]
  4648. },
  4649. setup(props, { slots }) {
  4650. const instance = getCurrentInstance();
  4651. const sharedContext = instance.ctx;
  4652. if (!sharedContext.renderer) {
  4653. return () => {
  4654. const children = slots.default && slots.default();
  4655. return children && children.length === 1 ? children[0] : children;
  4656. };
  4657. }
  4658. const cache = /* @__PURE__ */ new Map();
  4659. const keys = /* @__PURE__ */ new Set();
  4660. let current = null;
  4661. {
  4662. instance.__v_cache = cache;
  4663. }
  4664. const parentSuspense = instance.suspense;
  4665. const {
  4666. renderer: {
  4667. p: patch,
  4668. m: move,
  4669. um: _unmount,
  4670. o: { createElement }
  4671. }
  4672. } = sharedContext;
  4673. const storageContainer = createElement("div");
  4674. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  4675. const instance2 = vnode.component;
  4676. move(vnode, container, anchor, 0, parentSuspense);
  4677. patch(
  4678. instance2.vnode,
  4679. vnode,
  4680. container,
  4681. anchor,
  4682. instance2,
  4683. parentSuspense,
  4684. namespace,
  4685. vnode.slotScopeIds,
  4686. optimized
  4687. );
  4688. queuePostRenderEffect(() => {
  4689. instance2.isDeactivated = false;
  4690. if (instance2.a) {
  4691. invokeArrayFns(instance2.a);
  4692. }
  4693. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  4694. if (vnodeHook) {
  4695. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4696. }
  4697. }, parentSuspense);
  4698. {
  4699. devtoolsComponentAdded(instance2);
  4700. }
  4701. };
  4702. sharedContext.deactivate = (vnode) => {
  4703. const instance2 = vnode.component;
  4704. invalidateMount(instance2.m);
  4705. invalidateMount(instance2.a);
  4706. move(vnode, storageContainer, null, 1, parentSuspense);
  4707. queuePostRenderEffect(() => {
  4708. if (instance2.da) {
  4709. invokeArrayFns(instance2.da);
  4710. }
  4711. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  4712. if (vnodeHook) {
  4713. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4714. }
  4715. instance2.isDeactivated = true;
  4716. }, parentSuspense);
  4717. {
  4718. devtoolsComponentAdded(instance2);
  4719. }
  4720. };
  4721. function unmount(vnode) {
  4722. resetShapeFlag(vnode);
  4723. _unmount(vnode, instance, parentSuspense, true);
  4724. }
  4725. function pruneCache(filter) {
  4726. cache.forEach((vnode, key) => {
  4727. const name = getComponentName(vnode.type);
  4728. if (name && !filter(name)) {
  4729. pruneCacheEntry(key);
  4730. }
  4731. });
  4732. }
  4733. function pruneCacheEntry(key) {
  4734. const cached = cache.get(key);
  4735. if (cached && (!current || !isSameVNodeType(cached, current))) {
  4736. unmount(cached);
  4737. } else if (current) {
  4738. resetShapeFlag(current);
  4739. }
  4740. cache.delete(key);
  4741. keys.delete(key);
  4742. }
  4743. watch(
  4744. () => [props.include, props.exclude],
  4745. ([include, exclude]) => {
  4746. include && pruneCache((name) => matches(include, name));
  4747. exclude && pruneCache((name) => !matches(exclude, name));
  4748. },
  4749. // prune post-render after `current` has been updated
  4750. { flush: "post", deep: true }
  4751. );
  4752. let pendingCacheKey = null;
  4753. const cacheSubtree = () => {
  4754. if (pendingCacheKey != null) {
  4755. if (isSuspense(instance.subTree.type)) {
  4756. queuePostRenderEffect(() => {
  4757. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4758. }, instance.subTree.suspense);
  4759. } else {
  4760. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4761. }
  4762. }
  4763. };
  4764. onMounted(cacheSubtree);
  4765. onUpdated(cacheSubtree);
  4766. onBeforeUnmount(() => {
  4767. cache.forEach((cached) => {
  4768. const { subTree, suspense } = instance;
  4769. const vnode = getInnerChild(subTree);
  4770. if (cached.type === vnode.type && cached.key === vnode.key) {
  4771. resetShapeFlag(vnode);
  4772. const da = vnode.component.da;
  4773. da && queuePostRenderEffect(da, suspense);
  4774. return;
  4775. }
  4776. unmount(cached);
  4777. });
  4778. });
  4779. return () => {
  4780. pendingCacheKey = null;
  4781. if (!slots.default) {
  4782. return current = null;
  4783. }
  4784. const children = slots.default();
  4785. const rawVNode = children[0];
  4786. if (children.length > 1) {
  4787. {
  4788. warn$1(`KeepAlive should contain exactly one component child.`);
  4789. }
  4790. current = null;
  4791. return children;
  4792. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  4793. current = null;
  4794. return rawVNode;
  4795. }
  4796. let vnode = getInnerChild(rawVNode);
  4797. if (vnode.type === Comment) {
  4798. current = null;
  4799. return vnode;
  4800. }
  4801. const comp = vnode.type;
  4802. const name = getComponentName(
  4803. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  4804. );
  4805. const { include, exclude, max } = props;
  4806. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  4807. vnode.shapeFlag &= ~256;
  4808. current = vnode;
  4809. return rawVNode;
  4810. }
  4811. const key = vnode.key == null ? comp : vnode.key;
  4812. const cachedVNode = cache.get(key);
  4813. if (vnode.el) {
  4814. vnode = cloneVNode(vnode);
  4815. if (rawVNode.shapeFlag & 128) {
  4816. rawVNode.ssContent = vnode;
  4817. }
  4818. }
  4819. pendingCacheKey = key;
  4820. if (cachedVNode) {
  4821. vnode.el = cachedVNode.el;
  4822. vnode.component = cachedVNode.component;
  4823. if (vnode.transition) {
  4824. setTransitionHooks(vnode, vnode.transition);
  4825. }
  4826. vnode.shapeFlag |= 512;
  4827. keys.delete(key);
  4828. keys.add(key);
  4829. } else {
  4830. keys.add(key);
  4831. if (max && keys.size > parseInt(max, 10)) {
  4832. pruneCacheEntry(keys.values().next().value);
  4833. }
  4834. }
  4835. vnode.shapeFlag |= 256;
  4836. current = vnode;
  4837. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  4838. };
  4839. }
  4840. };
  4841. const KeepAlive = KeepAliveImpl;
  4842. function matches(pattern, name) {
  4843. if (isArray(pattern)) {
  4844. return pattern.some((p) => matches(p, name));
  4845. } else if (isString(pattern)) {
  4846. return pattern.split(",").includes(name);
  4847. } else if (isRegExp(pattern)) {
  4848. pattern.lastIndex = 0;
  4849. return pattern.test(name);
  4850. }
  4851. return false;
  4852. }
  4853. function onActivated(hook, target) {
  4854. registerKeepAliveHook(hook, "a", target);
  4855. }
  4856. function onDeactivated(hook, target) {
  4857. registerKeepAliveHook(hook, "da", target);
  4858. }
  4859. function registerKeepAliveHook(hook, type, target = currentInstance) {
  4860. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  4861. let current = target;
  4862. while (current) {
  4863. if (current.isDeactivated) {
  4864. return;
  4865. }
  4866. current = current.parent;
  4867. }
  4868. return hook();
  4869. });
  4870. injectHook(type, wrappedHook, target);
  4871. if (target) {
  4872. let current = target.parent;
  4873. while (current && current.parent) {
  4874. if (isKeepAlive(current.parent.vnode)) {
  4875. injectToKeepAliveRoot(wrappedHook, type, target, current);
  4876. }
  4877. current = current.parent;
  4878. }
  4879. }
  4880. }
  4881. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  4882. const injected = injectHook(
  4883. type,
  4884. hook,
  4885. keepAliveRoot,
  4886. true
  4887. /* prepend */
  4888. );
  4889. onUnmounted(() => {
  4890. remove(keepAliveRoot[type], injected);
  4891. }, target);
  4892. }
  4893. function resetShapeFlag(vnode) {
  4894. vnode.shapeFlag &= ~256;
  4895. vnode.shapeFlag &= ~512;
  4896. }
  4897. function getInnerChild(vnode) {
  4898. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  4899. }
  4900. function injectHook(type, hook, target = currentInstance, prepend = false) {
  4901. if (target) {
  4902. const hooks = target[type] || (target[type] = []);
  4903. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  4904. pauseTracking();
  4905. const reset = setCurrentInstance(target);
  4906. const res = callWithAsyncErrorHandling(hook, target, type, args);
  4907. reset();
  4908. resetTracking();
  4909. return res;
  4910. });
  4911. if (prepend) {
  4912. hooks.unshift(wrappedHook);
  4913. } else {
  4914. hooks.push(wrappedHook);
  4915. }
  4916. return wrappedHook;
  4917. } else {
  4918. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  4919. warn$1(
  4920. `${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.` )
  4921. );
  4922. }
  4923. }
  4924. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  4925. if (!isInSSRComponentSetup || lifecycle === "sp") {
  4926. injectHook(lifecycle, (...args) => hook(...args), target);
  4927. }
  4928. };
  4929. const onBeforeMount = createHook("bm");
  4930. const onMounted = createHook("m");
  4931. const onBeforeUpdate = createHook(
  4932. "bu"
  4933. );
  4934. const onUpdated = createHook("u");
  4935. const onBeforeUnmount = createHook(
  4936. "bum"
  4937. );
  4938. const onUnmounted = createHook("um");
  4939. const onServerPrefetch = createHook(
  4940. "sp"
  4941. );
  4942. const onRenderTriggered = createHook("rtg");
  4943. const onRenderTracked = createHook("rtc");
  4944. function onErrorCaptured(hook, target = currentInstance) {
  4945. injectHook("ec", hook, target);
  4946. }
  4947. const COMPONENTS = "components";
  4948. const DIRECTIVES = "directives";
  4949. function resolveComponent(name, maybeSelfReference) {
  4950. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  4951. }
  4952. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  4953. function resolveDynamicComponent(component) {
  4954. if (isString(component)) {
  4955. return resolveAsset(COMPONENTS, component, false) || component;
  4956. } else {
  4957. return component || NULL_DYNAMIC_COMPONENT;
  4958. }
  4959. }
  4960. function resolveDirective(name) {
  4961. return resolveAsset(DIRECTIVES, name);
  4962. }
  4963. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  4964. const instance = currentRenderingInstance || currentInstance;
  4965. if (instance) {
  4966. const Component = instance.type;
  4967. if (type === COMPONENTS) {
  4968. const selfName = getComponentName(
  4969. Component,
  4970. false
  4971. );
  4972. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  4973. return Component;
  4974. }
  4975. }
  4976. const res = (
  4977. // local registration
  4978. // check instance[type] first which is resolved for options API
  4979. resolve(instance[type] || Component[type], name) || // global registration
  4980. resolve(instance.appContext[type], name)
  4981. );
  4982. if (!res && maybeSelfReference) {
  4983. return Component;
  4984. }
  4985. if (warnMissing && !res) {
  4986. const extra = type === COMPONENTS ? `
  4987. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  4988. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  4989. }
  4990. return res;
  4991. } else {
  4992. warn$1(
  4993. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  4994. );
  4995. }
  4996. }
  4997. function resolve(registry, name) {
  4998. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  4999. }
  5000. function renderList(source, renderItem, cache, index) {
  5001. let ret;
  5002. const cached = cache && cache[index];
  5003. const sourceIsArray = isArray(source);
  5004. if (sourceIsArray || isString(source)) {
  5005. const sourceIsReactiveArray = sourceIsArray && isReactive(source);
  5006. let needsWrap = false;
  5007. if (sourceIsReactiveArray) {
  5008. needsWrap = !isShallow(source);
  5009. source = shallowReadArray(source);
  5010. }
  5011. ret = new Array(source.length);
  5012. for (let i = 0, l = source.length; i < l; i++) {
  5013. ret[i] = renderItem(
  5014. needsWrap ? toReactive(source[i]) : source[i],
  5015. i,
  5016. void 0,
  5017. cached && cached[i]
  5018. );
  5019. }
  5020. } else if (typeof source === "number") {
  5021. if (!Number.isInteger(source)) {
  5022. warn$1(`The v-for range expect an integer value but got ${source}.`);
  5023. }
  5024. ret = new Array(source);
  5025. for (let i = 0; i < source; i++) {
  5026. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  5027. }
  5028. } else if (isObject(source)) {
  5029. if (source[Symbol.iterator]) {
  5030. ret = Array.from(
  5031. source,
  5032. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  5033. );
  5034. } else {
  5035. const keys = Object.keys(source);
  5036. ret = new Array(keys.length);
  5037. for (let i = 0, l = keys.length; i < l; i++) {
  5038. const key = keys[i];
  5039. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  5040. }
  5041. }
  5042. } else {
  5043. ret = [];
  5044. }
  5045. if (cache) {
  5046. cache[index] = ret;
  5047. }
  5048. return ret;
  5049. }
  5050. function createSlots(slots, dynamicSlots) {
  5051. for (let i = 0; i < dynamicSlots.length; i++) {
  5052. const slot = dynamicSlots[i];
  5053. if (isArray(slot)) {
  5054. for (let j = 0; j < slot.length; j++) {
  5055. slots[slot[j].name] = slot[j].fn;
  5056. }
  5057. } else if (slot) {
  5058. slots[slot.name] = slot.key ? (...args) => {
  5059. const res = slot.fn(...args);
  5060. if (res) res.key = slot.key;
  5061. return res;
  5062. } : slot.fn;
  5063. }
  5064. }
  5065. return slots;
  5066. }
  5067. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  5068. if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
  5069. if (name !== "default") props.name = name;
  5070. return openBlock(), createBlock(
  5071. Fragment,
  5072. null,
  5073. [createVNode("slot", props, fallback && fallback())],
  5074. 64
  5075. );
  5076. }
  5077. let slot = slots[name];
  5078. if (slot && slot.length > 1) {
  5079. warn$1(
  5080. `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.`
  5081. );
  5082. slot = () => [];
  5083. }
  5084. if (slot && slot._c) {
  5085. slot._d = false;
  5086. }
  5087. openBlock();
  5088. const validSlotContent = slot && ensureValidVNode(slot(props));
  5089. const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
  5090. // key attached in the `createSlots` helper, respect that
  5091. validSlotContent && validSlotContent.key;
  5092. const rendered = createBlock(
  5093. Fragment,
  5094. {
  5095. key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
  5096. (!validSlotContent && fallback ? "_fb" : "")
  5097. },
  5098. validSlotContent || (fallback ? fallback() : []),
  5099. validSlotContent && slots._ === 1 ? 64 : -2
  5100. );
  5101. if (!noSlotted && rendered.scopeId) {
  5102. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  5103. }
  5104. if (slot && slot._c) {
  5105. slot._d = true;
  5106. }
  5107. return rendered;
  5108. }
  5109. function ensureValidVNode(vnodes) {
  5110. return vnodes.some((child) => {
  5111. if (!isVNode(child)) return true;
  5112. if (child.type === Comment) return false;
  5113. if (child.type === Fragment && !ensureValidVNode(child.children))
  5114. return false;
  5115. return true;
  5116. }) ? vnodes : null;
  5117. }
  5118. function toHandlers(obj, preserveCaseIfNecessary) {
  5119. const ret = {};
  5120. if (!isObject(obj)) {
  5121. warn$1(`v-on with no argument expects an object value.`);
  5122. return ret;
  5123. }
  5124. for (const key in obj) {
  5125. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  5126. }
  5127. return ret;
  5128. }
  5129. const getPublicInstance = (i) => {
  5130. if (!i) return null;
  5131. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  5132. return getPublicInstance(i.parent);
  5133. };
  5134. const publicPropertiesMap = (
  5135. // Move PURE marker to new line to workaround compiler discarding it
  5136. // due to type annotation
  5137. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  5138. $: (i) => i,
  5139. $el: (i) => i.vnode.el,
  5140. $data: (i) => i.data,
  5141. $props: (i) => shallowReadonly(i.props) ,
  5142. $attrs: (i) => shallowReadonly(i.attrs) ,
  5143. $slots: (i) => shallowReadonly(i.slots) ,
  5144. $refs: (i) => shallowReadonly(i.refs) ,
  5145. $parent: (i) => getPublicInstance(i.parent),
  5146. $root: (i) => getPublicInstance(i.root),
  5147. $host: (i) => i.ce,
  5148. $emit: (i) => i.emit,
  5149. $options: (i) => resolveMergedOptions(i) ,
  5150. $forceUpdate: (i) => i.f || (i.f = () => {
  5151. queueJob(i.update);
  5152. }),
  5153. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  5154. $watch: (i) => instanceWatch.bind(i)
  5155. })
  5156. );
  5157. const isReservedPrefix = (key) => key === "_" || key === "$";
  5158. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  5159. const PublicInstanceProxyHandlers = {
  5160. get({ _: instance }, key) {
  5161. if (key === "__v_skip") {
  5162. return true;
  5163. }
  5164. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  5165. if (key === "__isVue") {
  5166. return true;
  5167. }
  5168. let normalizedProps;
  5169. if (key[0] !== "$") {
  5170. const n = accessCache[key];
  5171. if (n !== void 0) {
  5172. switch (n) {
  5173. case 1 /* SETUP */:
  5174. return setupState[key];
  5175. case 2 /* DATA */:
  5176. return data[key];
  5177. case 4 /* CONTEXT */:
  5178. return ctx[key];
  5179. case 3 /* PROPS */:
  5180. return props[key];
  5181. }
  5182. } else if (hasSetupBinding(setupState, key)) {
  5183. accessCache[key] = 1 /* SETUP */;
  5184. return setupState[key];
  5185. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5186. accessCache[key] = 2 /* DATA */;
  5187. return data[key];
  5188. } else if (
  5189. // only cache other properties when instance has declared (thus stable)
  5190. // props
  5191. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  5192. ) {
  5193. accessCache[key] = 3 /* PROPS */;
  5194. return props[key];
  5195. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5196. accessCache[key] = 4 /* CONTEXT */;
  5197. return ctx[key];
  5198. } else if (shouldCacheAccess) {
  5199. accessCache[key] = 0 /* OTHER */;
  5200. }
  5201. }
  5202. const publicGetter = publicPropertiesMap[key];
  5203. let cssModule, globalProperties;
  5204. if (publicGetter) {
  5205. if (key === "$attrs") {
  5206. track(instance.attrs, "get", "");
  5207. markAttrsAccessed();
  5208. } else if (key === "$slots") {
  5209. track(instance, "get", key);
  5210. }
  5211. return publicGetter(instance);
  5212. } else if (
  5213. // css module (injected by vue-loader)
  5214. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  5215. ) {
  5216. return cssModule;
  5217. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5218. accessCache[key] = 4 /* CONTEXT */;
  5219. return ctx[key];
  5220. } else if (
  5221. // global properties
  5222. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  5223. ) {
  5224. {
  5225. return globalProperties[key];
  5226. }
  5227. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  5228. // to infinite warning loop
  5229. key.indexOf("__v") !== 0)) {
  5230. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  5231. warn$1(
  5232. `Property ${JSON.stringify(
  5233. key
  5234. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  5235. );
  5236. } else if (instance === currentRenderingInstance) {
  5237. warn$1(
  5238. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  5239. );
  5240. }
  5241. }
  5242. },
  5243. set({ _: instance }, key, value) {
  5244. const { data, setupState, ctx } = instance;
  5245. if (hasSetupBinding(setupState, key)) {
  5246. setupState[key] = value;
  5247. return true;
  5248. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  5249. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  5250. return false;
  5251. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5252. data[key] = value;
  5253. return true;
  5254. } else if (hasOwn(instance.props, key)) {
  5255. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  5256. return false;
  5257. }
  5258. if (key[0] === "$" && key.slice(1) in instance) {
  5259. warn$1(
  5260. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  5261. );
  5262. return false;
  5263. } else {
  5264. if (key in instance.appContext.config.globalProperties) {
  5265. Object.defineProperty(ctx, key, {
  5266. enumerable: true,
  5267. configurable: true,
  5268. value
  5269. });
  5270. } else {
  5271. ctx[key] = value;
  5272. }
  5273. }
  5274. return true;
  5275. },
  5276. has({
  5277. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  5278. }, key) {
  5279. let normalizedProps;
  5280. return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
  5281. },
  5282. defineProperty(target, key, descriptor) {
  5283. if (descriptor.get != null) {
  5284. target._.accessCache[key] = 0;
  5285. } else if (hasOwn(descriptor, "value")) {
  5286. this.set(target, key, descriptor.value, null);
  5287. }
  5288. return Reflect.defineProperty(target, key, descriptor);
  5289. }
  5290. };
  5291. {
  5292. PublicInstanceProxyHandlers.ownKeys = (target) => {
  5293. warn$1(
  5294. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  5295. );
  5296. return Reflect.ownKeys(target);
  5297. };
  5298. }
  5299. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
  5300. get(target, key) {
  5301. if (key === Symbol.unscopables) {
  5302. return;
  5303. }
  5304. return PublicInstanceProxyHandlers.get(target, key, target);
  5305. },
  5306. has(_, key) {
  5307. const has = key[0] !== "_" && !isGloballyAllowed(key);
  5308. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  5309. warn$1(
  5310. `Property ${JSON.stringify(
  5311. key
  5312. )} should not start with _ which is a reserved prefix for Vue internals.`
  5313. );
  5314. }
  5315. return has;
  5316. }
  5317. });
  5318. function createDevRenderContext(instance) {
  5319. const target = {};
  5320. Object.defineProperty(target, `_`, {
  5321. configurable: true,
  5322. enumerable: false,
  5323. get: () => instance
  5324. });
  5325. Object.keys(publicPropertiesMap).forEach((key) => {
  5326. Object.defineProperty(target, key, {
  5327. configurable: true,
  5328. enumerable: false,
  5329. get: () => publicPropertiesMap[key](instance),
  5330. // intercepted by the proxy so no need for implementation,
  5331. // but needed to prevent set errors
  5332. set: NOOP
  5333. });
  5334. });
  5335. return target;
  5336. }
  5337. function exposePropsOnRenderContext(instance) {
  5338. const {
  5339. ctx,
  5340. propsOptions: [propsOptions]
  5341. } = instance;
  5342. if (propsOptions) {
  5343. Object.keys(propsOptions).forEach((key) => {
  5344. Object.defineProperty(ctx, key, {
  5345. enumerable: true,
  5346. configurable: true,
  5347. get: () => instance.props[key],
  5348. set: NOOP
  5349. });
  5350. });
  5351. }
  5352. }
  5353. function exposeSetupStateOnRenderContext(instance) {
  5354. const { ctx, setupState } = instance;
  5355. Object.keys(toRaw(setupState)).forEach((key) => {
  5356. if (!setupState.__isScriptSetup) {
  5357. if (isReservedPrefix(key[0])) {
  5358. warn$1(
  5359. `setup() return property ${JSON.stringify(
  5360. key
  5361. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  5362. );
  5363. return;
  5364. }
  5365. Object.defineProperty(ctx, key, {
  5366. enumerable: true,
  5367. configurable: true,
  5368. get: () => setupState[key],
  5369. set: NOOP
  5370. });
  5371. }
  5372. });
  5373. }
  5374. const warnRuntimeUsage = (method) => warn$1(
  5375. `${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.`
  5376. );
  5377. function defineProps() {
  5378. {
  5379. warnRuntimeUsage(`defineProps`);
  5380. }
  5381. return null;
  5382. }
  5383. function defineEmits() {
  5384. {
  5385. warnRuntimeUsage(`defineEmits`);
  5386. }
  5387. return null;
  5388. }
  5389. function defineExpose(exposed) {
  5390. {
  5391. warnRuntimeUsage(`defineExpose`);
  5392. }
  5393. }
  5394. function defineOptions(options) {
  5395. {
  5396. warnRuntimeUsage(`defineOptions`);
  5397. }
  5398. }
  5399. function defineSlots() {
  5400. {
  5401. warnRuntimeUsage(`defineSlots`);
  5402. }
  5403. return null;
  5404. }
  5405. function defineModel() {
  5406. {
  5407. warnRuntimeUsage("defineModel");
  5408. }
  5409. }
  5410. function withDefaults(props, defaults) {
  5411. {
  5412. warnRuntimeUsage(`withDefaults`);
  5413. }
  5414. return null;
  5415. }
  5416. function useSlots() {
  5417. return getContext().slots;
  5418. }
  5419. function useAttrs() {
  5420. return getContext().attrs;
  5421. }
  5422. function getContext() {
  5423. const i = getCurrentInstance();
  5424. if (!i) {
  5425. warn$1(`useContext() called without active instance.`);
  5426. }
  5427. return i.setupContext || (i.setupContext = createSetupContext(i));
  5428. }
  5429. function normalizePropsOrEmits(props) {
  5430. return isArray(props) ? props.reduce(
  5431. (normalized, p) => (normalized[p] = null, normalized),
  5432. {}
  5433. ) : props;
  5434. }
  5435. function mergeDefaults(raw, defaults) {
  5436. const props = normalizePropsOrEmits(raw);
  5437. for (const key in defaults) {
  5438. if (key.startsWith("__skip")) continue;
  5439. let opt = props[key];
  5440. if (opt) {
  5441. if (isArray(opt) || isFunction(opt)) {
  5442. opt = props[key] = { type: opt, default: defaults[key] };
  5443. } else {
  5444. opt.default = defaults[key];
  5445. }
  5446. } else if (opt === null) {
  5447. opt = props[key] = { default: defaults[key] };
  5448. } else {
  5449. warn$1(`props default key "${key}" has no corresponding declaration.`);
  5450. }
  5451. if (opt && defaults[`__skip_${key}`]) {
  5452. opt.skipFactory = true;
  5453. }
  5454. }
  5455. return props;
  5456. }
  5457. function mergeModels(a, b) {
  5458. if (!a || !b) return a || b;
  5459. if (isArray(a) && isArray(b)) return a.concat(b);
  5460. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  5461. }
  5462. function createPropsRestProxy(props, excludedKeys) {
  5463. const ret = {};
  5464. for (const key in props) {
  5465. if (!excludedKeys.includes(key)) {
  5466. Object.defineProperty(ret, key, {
  5467. enumerable: true,
  5468. get: () => props[key]
  5469. });
  5470. }
  5471. }
  5472. return ret;
  5473. }
  5474. function withAsyncContext(getAwaitable) {
  5475. const ctx = getCurrentInstance();
  5476. if (!ctx) {
  5477. warn$1(
  5478. `withAsyncContext called without active current instance. This is likely a bug.`
  5479. );
  5480. }
  5481. let awaitable = getAwaitable();
  5482. unsetCurrentInstance();
  5483. if (isPromise(awaitable)) {
  5484. awaitable = awaitable.catch((e) => {
  5485. setCurrentInstance(ctx);
  5486. throw e;
  5487. });
  5488. }
  5489. return [awaitable, () => setCurrentInstance(ctx)];
  5490. }
  5491. function createDuplicateChecker() {
  5492. const cache = /* @__PURE__ */ Object.create(null);
  5493. return (type, key) => {
  5494. if (cache[key]) {
  5495. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  5496. } else {
  5497. cache[key] = type;
  5498. }
  5499. };
  5500. }
  5501. let shouldCacheAccess = true;
  5502. function applyOptions(instance) {
  5503. const options = resolveMergedOptions(instance);
  5504. const publicThis = instance.proxy;
  5505. const ctx = instance.ctx;
  5506. shouldCacheAccess = false;
  5507. if (options.beforeCreate) {
  5508. callHook$1(options.beforeCreate, instance, "bc");
  5509. }
  5510. const {
  5511. // state
  5512. data: dataOptions,
  5513. computed: computedOptions,
  5514. methods,
  5515. watch: watchOptions,
  5516. provide: provideOptions,
  5517. inject: injectOptions,
  5518. // lifecycle
  5519. created,
  5520. beforeMount,
  5521. mounted,
  5522. beforeUpdate,
  5523. updated,
  5524. activated,
  5525. deactivated,
  5526. beforeDestroy,
  5527. beforeUnmount,
  5528. destroyed,
  5529. unmounted,
  5530. render,
  5531. renderTracked,
  5532. renderTriggered,
  5533. errorCaptured,
  5534. serverPrefetch,
  5535. // public API
  5536. expose,
  5537. inheritAttrs,
  5538. // assets
  5539. components,
  5540. directives,
  5541. filters
  5542. } = options;
  5543. const checkDuplicateProperties = createDuplicateChecker() ;
  5544. {
  5545. const [propsOptions] = instance.propsOptions;
  5546. if (propsOptions) {
  5547. for (const key in propsOptions) {
  5548. checkDuplicateProperties("Props" /* PROPS */, key);
  5549. }
  5550. }
  5551. }
  5552. if (injectOptions) {
  5553. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  5554. }
  5555. if (methods) {
  5556. for (const key in methods) {
  5557. const methodHandler = methods[key];
  5558. if (isFunction(methodHandler)) {
  5559. {
  5560. Object.defineProperty(ctx, key, {
  5561. value: methodHandler.bind(publicThis),
  5562. configurable: true,
  5563. enumerable: true,
  5564. writable: true
  5565. });
  5566. }
  5567. {
  5568. checkDuplicateProperties("Methods" /* METHODS */, key);
  5569. }
  5570. } else {
  5571. warn$1(
  5572. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  5573. );
  5574. }
  5575. }
  5576. }
  5577. if (dataOptions) {
  5578. if (!isFunction(dataOptions)) {
  5579. warn$1(
  5580. `The data option must be a function. Plain object usage is no longer supported.`
  5581. );
  5582. }
  5583. const data = dataOptions.call(publicThis, publicThis);
  5584. if (isPromise(data)) {
  5585. warn$1(
  5586. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  5587. );
  5588. }
  5589. if (!isObject(data)) {
  5590. warn$1(`data() should return an object.`);
  5591. } else {
  5592. instance.data = reactive(data);
  5593. {
  5594. for (const key in data) {
  5595. checkDuplicateProperties("Data" /* DATA */, key);
  5596. if (!isReservedPrefix(key[0])) {
  5597. Object.defineProperty(ctx, key, {
  5598. configurable: true,
  5599. enumerable: true,
  5600. get: () => data[key],
  5601. set: NOOP
  5602. });
  5603. }
  5604. }
  5605. }
  5606. }
  5607. }
  5608. shouldCacheAccess = true;
  5609. if (computedOptions) {
  5610. for (const key in computedOptions) {
  5611. const opt = computedOptions[key];
  5612. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  5613. if (get === NOOP) {
  5614. warn$1(`Computed property "${key}" has no getter.`);
  5615. }
  5616. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  5617. warn$1(
  5618. `Write operation failed: computed property "${key}" is readonly.`
  5619. );
  5620. } ;
  5621. const c = computed({
  5622. get,
  5623. set
  5624. });
  5625. Object.defineProperty(ctx, key, {
  5626. enumerable: true,
  5627. configurable: true,
  5628. get: () => c.value,
  5629. set: (v) => c.value = v
  5630. });
  5631. {
  5632. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  5633. }
  5634. }
  5635. }
  5636. if (watchOptions) {
  5637. for (const key in watchOptions) {
  5638. createWatcher(watchOptions[key], ctx, publicThis, key);
  5639. }
  5640. }
  5641. if (provideOptions) {
  5642. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  5643. Reflect.ownKeys(provides).forEach((key) => {
  5644. provide(key, provides[key]);
  5645. });
  5646. }
  5647. if (created) {
  5648. callHook$1(created, instance, "c");
  5649. }
  5650. function registerLifecycleHook(register, hook) {
  5651. if (isArray(hook)) {
  5652. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  5653. } else if (hook) {
  5654. register(hook.bind(publicThis));
  5655. }
  5656. }
  5657. registerLifecycleHook(onBeforeMount, beforeMount);
  5658. registerLifecycleHook(onMounted, mounted);
  5659. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  5660. registerLifecycleHook(onUpdated, updated);
  5661. registerLifecycleHook(onActivated, activated);
  5662. registerLifecycleHook(onDeactivated, deactivated);
  5663. registerLifecycleHook(onErrorCaptured, errorCaptured);
  5664. registerLifecycleHook(onRenderTracked, renderTracked);
  5665. registerLifecycleHook(onRenderTriggered, renderTriggered);
  5666. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  5667. registerLifecycleHook(onUnmounted, unmounted);
  5668. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  5669. if (isArray(expose)) {
  5670. if (expose.length) {
  5671. const exposed = instance.exposed || (instance.exposed = {});
  5672. expose.forEach((key) => {
  5673. Object.defineProperty(exposed, key, {
  5674. get: () => publicThis[key],
  5675. set: (val) => publicThis[key] = val
  5676. });
  5677. });
  5678. } else if (!instance.exposed) {
  5679. instance.exposed = {};
  5680. }
  5681. }
  5682. if (render && instance.render === NOOP) {
  5683. instance.render = render;
  5684. }
  5685. if (inheritAttrs != null) {
  5686. instance.inheritAttrs = inheritAttrs;
  5687. }
  5688. if (components) instance.components = components;
  5689. if (directives) instance.directives = directives;
  5690. if (serverPrefetch) {
  5691. markAsyncBoundary(instance);
  5692. }
  5693. }
  5694. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  5695. if (isArray(injectOptions)) {
  5696. injectOptions = normalizeInject(injectOptions);
  5697. }
  5698. for (const key in injectOptions) {
  5699. const opt = injectOptions[key];
  5700. let injected;
  5701. if (isObject(opt)) {
  5702. if ("default" in opt) {
  5703. injected = inject(
  5704. opt.from || key,
  5705. opt.default,
  5706. true
  5707. );
  5708. } else {
  5709. injected = inject(opt.from || key);
  5710. }
  5711. } else {
  5712. injected = inject(opt);
  5713. }
  5714. if (isRef(injected)) {
  5715. Object.defineProperty(ctx, key, {
  5716. enumerable: true,
  5717. configurable: true,
  5718. get: () => injected.value,
  5719. set: (v) => injected.value = v
  5720. });
  5721. } else {
  5722. ctx[key] = injected;
  5723. }
  5724. {
  5725. checkDuplicateProperties("Inject" /* INJECT */, key);
  5726. }
  5727. }
  5728. }
  5729. function callHook$1(hook, instance, type) {
  5730. callWithAsyncErrorHandling(
  5731. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  5732. instance,
  5733. type
  5734. );
  5735. }
  5736. function createWatcher(raw, ctx, publicThis, key) {
  5737. let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  5738. if (isString(raw)) {
  5739. const handler = ctx[raw];
  5740. if (isFunction(handler)) {
  5741. {
  5742. watch(getter, handler);
  5743. }
  5744. } else {
  5745. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  5746. }
  5747. } else if (isFunction(raw)) {
  5748. {
  5749. watch(getter, raw.bind(publicThis));
  5750. }
  5751. } else if (isObject(raw)) {
  5752. if (isArray(raw)) {
  5753. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  5754. } else {
  5755. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  5756. if (isFunction(handler)) {
  5757. watch(getter, handler, raw);
  5758. } else {
  5759. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  5760. }
  5761. }
  5762. } else {
  5763. warn$1(`Invalid watch option: "${key}"`, raw);
  5764. }
  5765. }
  5766. function resolveMergedOptions(instance) {
  5767. const base = instance.type;
  5768. const { mixins, extends: extendsOptions } = base;
  5769. const {
  5770. mixins: globalMixins,
  5771. optionsCache: cache,
  5772. config: { optionMergeStrategies }
  5773. } = instance.appContext;
  5774. const cached = cache.get(base);
  5775. let resolved;
  5776. if (cached) {
  5777. resolved = cached;
  5778. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  5779. {
  5780. resolved = base;
  5781. }
  5782. } else {
  5783. resolved = {};
  5784. if (globalMixins.length) {
  5785. globalMixins.forEach(
  5786. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  5787. );
  5788. }
  5789. mergeOptions(resolved, base, optionMergeStrategies);
  5790. }
  5791. if (isObject(base)) {
  5792. cache.set(base, resolved);
  5793. }
  5794. return resolved;
  5795. }
  5796. function mergeOptions(to, from, strats, asMixin = false) {
  5797. const { mixins, extends: extendsOptions } = from;
  5798. if (extendsOptions) {
  5799. mergeOptions(to, extendsOptions, strats, true);
  5800. }
  5801. if (mixins) {
  5802. mixins.forEach(
  5803. (m) => mergeOptions(to, m, strats, true)
  5804. );
  5805. }
  5806. for (const key in from) {
  5807. if (asMixin && key === "expose") {
  5808. warn$1(
  5809. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  5810. );
  5811. } else {
  5812. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  5813. to[key] = strat ? strat(to[key], from[key]) : from[key];
  5814. }
  5815. }
  5816. return to;
  5817. }
  5818. const internalOptionMergeStrats = {
  5819. data: mergeDataFn,
  5820. props: mergeEmitsOrPropsOptions,
  5821. emits: mergeEmitsOrPropsOptions,
  5822. // objects
  5823. methods: mergeObjectOptions,
  5824. computed: mergeObjectOptions,
  5825. // lifecycle
  5826. beforeCreate: mergeAsArray$1,
  5827. created: mergeAsArray$1,
  5828. beforeMount: mergeAsArray$1,
  5829. mounted: mergeAsArray$1,
  5830. beforeUpdate: mergeAsArray$1,
  5831. updated: mergeAsArray$1,
  5832. beforeDestroy: mergeAsArray$1,
  5833. beforeUnmount: mergeAsArray$1,
  5834. destroyed: mergeAsArray$1,
  5835. unmounted: mergeAsArray$1,
  5836. activated: mergeAsArray$1,
  5837. deactivated: mergeAsArray$1,
  5838. errorCaptured: mergeAsArray$1,
  5839. serverPrefetch: mergeAsArray$1,
  5840. // assets
  5841. components: mergeObjectOptions,
  5842. directives: mergeObjectOptions,
  5843. // watch
  5844. watch: mergeWatchOptions,
  5845. // provide / inject
  5846. provide: mergeDataFn,
  5847. inject: mergeInject
  5848. };
  5849. function mergeDataFn(to, from) {
  5850. if (!from) {
  5851. return to;
  5852. }
  5853. if (!to) {
  5854. return from;
  5855. }
  5856. return function mergedDataFn() {
  5857. return (extend)(
  5858. isFunction(to) ? to.call(this, this) : to,
  5859. isFunction(from) ? from.call(this, this) : from
  5860. );
  5861. };
  5862. }
  5863. function mergeInject(to, from) {
  5864. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  5865. }
  5866. function normalizeInject(raw) {
  5867. if (isArray(raw)) {
  5868. const res = {};
  5869. for (let i = 0; i < raw.length; i++) {
  5870. res[raw[i]] = raw[i];
  5871. }
  5872. return res;
  5873. }
  5874. return raw;
  5875. }
  5876. function mergeAsArray$1(to, from) {
  5877. return to ? [...new Set([].concat(to, from))] : from;
  5878. }
  5879. function mergeObjectOptions(to, from) {
  5880. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  5881. }
  5882. function mergeEmitsOrPropsOptions(to, from) {
  5883. if (to) {
  5884. if (isArray(to) && isArray(from)) {
  5885. return [.../* @__PURE__ */ new Set([...to, ...from])];
  5886. }
  5887. return extend(
  5888. /* @__PURE__ */ Object.create(null),
  5889. normalizePropsOrEmits(to),
  5890. normalizePropsOrEmits(from != null ? from : {})
  5891. );
  5892. } else {
  5893. return from;
  5894. }
  5895. }
  5896. function mergeWatchOptions(to, from) {
  5897. if (!to) return from;
  5898. if (!from) return to;
  5899. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  5900. for (const key in from) {
  5901. merged[key] = mergeAsArray$1(to[key], from[key]);
  5902. }
  5903. return merged;
  5904. }
  5905. function createAppContext() {
  5906. return {
  5907. app: null,
  5908. config: {
  5909. isNativeTag: NO,
  5910. performance: false,
  5911. globalProperties: {},
  5912. optionMergeStrategies: {},
  5913. errorHandler: void 0,
  5914. warnHandler: void 0,
  5915. compilerOptions: {}
  5916. },
  5917. mixins: [],
  5918. components: {},
  5919. directives: {},
  5920. provides: /* @__PURE__ */ Object.create(null),
  5921. optionsCache: /* @__PURE__ */ new WeakMap(),
  5922. propsCache: /* @__PURE__ */ new WeakMap(),
  5923. emitsCache: /* @__PURE__ */ new WeakMap()
  5924. };
  5925. }
  5926. let uid$1 = 0;
  5927. function createAppAPI(render, hydrate) {
  5928. return function createApp(rootComponent, rootProps = null) {
  5929. if (!isFunction(rootComponent)) {
  5930. rootComponent = extend({}, rootComponent);
  5931. }
  5932. if (rootProps != null && !isObject(rootProps)) {
  5933. warn$1(`root props passed to app.mount() must be an object.`);
  5934. rootProps = null;
  5935. }
  5936. const context = createAppContext();
  5937. const installedPlugins = /* @__PURE__ */ new WeakSet();
  5938. const pluginCleanupFns = [];
  5939. let isMounted = false;
  5940. const app = context.app = {
  5941. _uid: uid$1++,
  5942. _component: rootComponent,
  5943. _props: rootProps,
  5944. _container: null,
  5945. _context: context,
  5946. _instance: null,
  5947. version,
  5948. get config() {
  5949. return context.config;
  5950. },
  5951. set config(v) {
  5952. {
  5953. warn$1(
  5954. `app.config cannot be replaced. Modify individual options instead.`
  5955. );
  5956. }
  5957. },
  5958. use(plugin, ...options) {
  5959. if (installedPlugins.has(plugin)) {
  5960. warn$1(`Plugin has already been applied to target app.`);
  5961. } else if (plugin && isFunction(plugin.install)) {
  5962. installedPlugins.add(plugin);
  5963. plugin.install(app, ...options);
  5964. } else if (isFunction(plugin)) {
  5965. installedPlugins.add(plugin);
  5966. plugin(app, ...options);
  5967. } else {
  5968. warn$1(
  5969. `A plugin must either be a function or an object with an "install" function.`
  5970. );
  5971. }
  5972. return app;
  5973. },
  5974. mixin(mixin) {
  5975. {
  5976. if (!context.mixins.includes(mixin)) {
  5977. context.mixins.push(mixin);
  5978. } else {
  5979. warn$1(
  5980. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  5981. );
  5982. }
  5983. }
  5984. return app;
  5985. },
  5986. component(name, component) {
  5987. {
  5988. validateComponentName(name, context.config);
  5989. }
  5990. if (!component) {
  5991. return context.components[name];
  5992. }
  5993. if (context.components[name]) {
  5994. warn$1(`Component "${name}" has already been registered in target app.`);
  5995. }
  5996. context.components[name] = component;
  5997. return app;
  5998. },
  5999. directive(name, directive) {
  6000. {
  6001. validateDirectiveName(name);
  6002. }
  6003. if (!directive) {
  6004. return context.directives[name];
  6005. }
  6006. if (context.directives[name]) {
  6007. warn$1(`Directive "${name}" has already been registered in target app.`);
  6008. }
  6009. context.directives[name] = directive;
  6010. return app;
  6011. },
  6012. mount(rootContainer, isHydrate, namespace) {
  6013. if (!isMounted) {
  6014. if (rootContainer.__vue_app__) {
  6015. warn$1(
  6016. `There is already an app instance mounted on the host container.
  6017. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  6018. );
  6019. }
  6020. const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
  6021. vnode.appContext = context;
  6022. if (namespace === true) {
  6023. namespace = "svg";
  6024. } else if (namespace === false) {
  6025. namespace = void 0;
  6026. }
  6027. {
  6028. context.reload = () => {
  6029. render(
  6030. cloneVNode(vnode),
  6031. rootContainer,
  6032. namespace
  6033. );
  6034. };
  6035. }
  6036. if (isHydrate && hydrate) {
  6037. hydrate(vnode, rootContainer);
  6038. } else {
  6039. render(vnode, rootContainer, namespace);
  6040. }
  6041. isMounted = true;
  6042. app._container = rootContainer;
  6043. rootContainer.__vue_app__ = app;
  6044. {
  6045. app._instance = vnode.component;
  6046. devtoolsInitApp(app, version);
  6047. }
  6048. return getComponentPublicInstance(vnode.component);
  6049. } else {
  6050. warn$1(
  6051. `App has already been mounted.
  6052. 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)\``
  6053. );
  6054. }
  6055. },
  6056. onUnmount(cleanupFn) {
  6057. if (typeof cleanupFn !== "function") {
  6058. warn$1(
  6059. `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
  6060. );
  6061. }
  6062. pluginCleanupFns.push(cleanupFn);
  6063. },
  6064. unmount() {
  6065. if (isMounted) {
  6066. callWithAsyncErrorHandling(
  6067. pluginCleanupFns,
  6068. app._instance,
  6069. 16
  6070. );
  6071. render(null, app._container);
  6072. {
  6073. app._instance = null;
  6074. devtoolsUnmountApp(app);
  6075. }
  6076. delete app._container.__vue_app__;
  6077. } else {
  6078. warn$1(`Cannot unmount an app that is not mounted.`);
  6079. }
  6080. },
  6081. provide(key, value) {
  6082. if (key in context.provides) {
  6083. warn$1(
  6084. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  6085. );
  6086. }
  6087. context.provides[key] = value;
  6088. return app;
  6089. },
  6090. runWithContext(fn) {
  6091. const lastApp = currentApp;
  6092. currentApp = app;
  6093. try {
  6094. return fn();
  6095. } finally {
  6096. currentApp = lastApp;
  6097. }
  6098. }
  6099. };
  6100. return app;
  6101. };
  6102. }
  6103. let currentApp = null;
  6104. function provide(key, value) {
  6105. if (!currentInstance) {
  6106. {
  6107. warn$1(`provide() can only be used inside setup().`);
  6108. }
  6109. } else {
  6110. let provides = currentInstance.provides;
  6111. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  6112. if (parentProvides === provides) {
  6113. provides = currentInstance.provides = Object.create(parentProvides);
  6114. }
  6115. provides[key] = value;
  6116. }
  6117. }
  6118. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  6119. const instance = currentInstance || currentRenderingInstance;
  6120. if (instance || currentApp) {
  6121. const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  6122. if (provides && key in provides) {
  6123. return provides[key];
  6124. } else if (arguments.length > 1) {
  6125. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  6126. } else {
  6127. warn$1(`injection "${String(key)}" not found.`);
  6128. }
  6129. } else {
  6130. warn$1(`inject() can only be used inside setup() or functional components.`);
  6131. }
  6132. }
  6133. function hasInjectionContext() {
  6134. return !!(currentInstance || currentRenderingInstance || currentApp);
  6135. }
  6136. const internalObjectProto = {};
  6137. const createInternalObject = () => Object.create(internalObjectProto);
  6138. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  6139. function initProps(instance, rawProps, isStateful, isSSR = false) {
  6140. const props = {};
  6141. const attrs = createInternalObject();
  6142. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  6143. setFullProps(instance, rawProps, props, attrs);
  6144. for (const key in instance.propsOptions[0]) {
  6145. if (!(key in props)) {
  6146. props[key] = void 0;
  6147. }
  6148. }
  6149. {
  6150. validateProps(rawProps || {}, props, instance);
  6151. }
  6152. if (isStateful) {
  6153. instance.props = isSSR ? props : shallowReactive(props);
  6154. } else {
  6155. if (!instance.type.props) {
  6156. instance.props = attrs;
  6157. } else {
  6158. instance.props = props;
  6159. }
  6160. }
  6161. instance.attrs = attrs;
  6162. }
  6163. function isInHmrContext(instance) {
  6164. while (instance) {
  6165. if (instance.type.__hmrId) return true;
  6166. instance = instance.parent;
  6167. }
  6168. }
  6169. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  6170. const {
  6171. props,
  6172. attrs,
  6173. vnode: { patchFlag }
  6174. } = instance;
  6175. const rawCurrentProps = toRaw(props);
  6176. const [options] = instance.propsOptions;
  6177. let hasAttrsChanged = false;
  6178. if (
  6179. // always force full diff in dev
  6180. // - #1942 if hmr is enabled with sfc component
  6181. // - vite#872 non-sfc component used by sfc component
  6182. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  6183. ) {
  6184. if (patchFlag & 8) {
  6185. const propsToUpdate = instance.vnode.dynamicProps;
  6186. for (let i = 0; i < propsToUpdate.length; i++) {
  6187. let key = propsToUpdate[i];
  6188. if (isEmitListener(instance.emitsOptions, key)) {
  6189. continue;
  6190. }
  6191. const value = rawProps[key];
  6192. if (options) {
  6193. if (hasOwn(attrs, key)) {
  6194. if (value !== attrs[key]) {
  6195. attrs[key] = value;
  6196. hasAttrsChanged = true;
  6197. }
  6198. } else {
  6199. const camelizedKey = camelize(key);
  6200. props[camelizedKey] = resolvePropValue(
  6201. options,
  6202. rawCurrentProps,
  6203. camelizedKey,
  6204. value,
  6205. instance,
  6206. false
  6207. );
  6208. }
  6209. } else {
  6210. if (value !== attrs[key]) {
  6211. attrs[key] = value;
  6212. hasAttrsChanged = true;
  6213. }
  6214. }
  6215. }
  6216. }
  6217. } else {
  6218. if (setFullProps(instance, rawProps, props, attrs)) {
  6219. hasAttrsChanged = true;
  6220. }
  6221. let kebabKey;
  6222. for (const key in rawCurrentProps) {
  6223. if (!rawProps || // for camelCase
  6224. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  6225. // and converted to camelCase (#955)
  6226. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  6227. if (options) {
  6228. if (rawPrevProps && // for camelCase
  6229. (rawPrevProps[key] !== void 0 || // for kebab-case
  6230. rawPrevProps[kebabKey] !== void 0)) {
  6231. props[key] = resolvePropValue(
  6232. options,
  6233. rawCurrentProps,
  6234. key,
  6235. void 0,
  6236. instance,
  6237. true
  6238. );
  6239. }
  6240. } else {
  6241. delete props[key];
  6242. }
  6243. }
  6244. }
  6245. if (attrs !== rawCurrentProps) {
  6246. for (const key in attrs) {
  6247. if (!rawProps || !hasOwn(rawProps, key) && true) {
  6248. delete attrs[key];
  6249. hasAttrsChanged = true;
  6250. }
  6251. }
  6252. }
  6253. }
  6254. if (hasAttrsChanged) {
  6255. trigger(instance.attrs, "set", "");
  6256. }
  6257. {
  6258. validateProps(rawProps || {}, props, instance);
  6259. }
  6260. }
  6261. function setFullProps(instance, rawProps, props, attrs) {
  6262. const [options, needCastKeys] = instance.propsOptions;
  6263. let hasAttrsChanged = false;
  6264. let rawCastValues;
  6265. if (rawProps) {
  6266. for (let key in rawProps) {
  6267. if (isReservedProp(key)) {
  6268. continue;
  6269. }
  6270. const value = rawProps[key];
  6271. let camelKey;
  6272. if (options && hasOwn(options, camelKey = camelize(key))) {
  6273. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  6274. props[camelKey] = value;
  6275. } else {
  6276. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  6277. }
  6278. } else if (!isEmitListener(instance.emitsOptions, key)) {
  6279. if (!(key in attrs) || value !== attrs[key]) {
  6280. attrs[key] = value;
  6281. hasAttrsChanged = true;
  6282. }
  6283. }
  6284. }
  6285. }
  6286. if (needCastKeys) {
  6287. const rawCurrentProps = toRaw(props);
  6288. const castValues = rawCastValues || EMPTY_OBJ;
  6289. for (let i = 0; i < needCastKeys.length; i++) {
  6290. const key = needCastKeys[i];
  6291. props[key] = resolvePropValue(
  6292. options,
  6293. rawCurrentProps,
  6294. key,
  6295. castValues[key],
  6296. instance,
  6297. !hasOwn(castValues, key)
  6298. );
  6299. }
  6300. }
  6301. return hasAttrsChanged;
  6302. }
  6303. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  6304. const opt = options[key];
  6305. if (opt != null) {
  6306. const hasDefault = hasOwn(opt, "default");
  6307. if (hasDefault && value === void 0) {
  6308. const defaultValue = opt.default;
  6309. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  6310. const { propsDefaults } = instance;
  6311. if (key in propsDefaults) {
  6312. value = propsDefaults[key];
  6313. } else {
  6314. const reset = setCurrentInstance(instance);
  6315. value = propsDefaults[key] = defaultValue.call(
  6316. null,
  6317. props
  6318. );
  6319. reset();
  6320. }
  6321. } else {
  6322. value = defaultValue;
  6323. }
  6324. if (instance.ce) {
  6325. instance.ce._setProp(key, value);
  6326. }
  6327. }
  6328. if (opt[0 /* shouldCast */]) {
  6329. if (isAbsent && !hasDefault) {
  6330. value = false;
  6331. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  6332. value = true;
  6333. }
  6334. }
  6335. }
  6336. return value;
  6337. }
  6338. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  6339. function normalizePropsOptions(comp, appContext, asMixin = false) {
  6340. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  6341. const cached = cache.get(comp);
  6342. if (cached) {
  6343. return cached;
  6344. }
  6345. const raw = comp.props;
  6346. const normalized = {};
  6347. const needCastKeys = [];
  6348. let hasExtends = false;
  6349. if (!isFunction(comp)) {
  6350. const extendProps = (raw2) => {
  6351. hasExtends = true;
  6352. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  6353. extend(normalized, props);
  6354. if (keys) needCastKeys.push(...keys);
  6355. };
  6356. if (!asMixin && appContext.mixins.length) {
  6357. appContext.mixins.forEach(extendProps);
  6358. }
  6359. if (comp.extends) {
  6360. extendProps(comp.extends);
  6361. }
  6362. if (comp.mixins) {
  6363. comp.mixins.forEach(extendProps);
  6364. }
  6365. }
  6366. if (!raw && !hasExtends) {
  6367. if (isObject(comp)) {
  6368. cache.set(comp, EMPTY_ARR);
  6369. }
  6370. return EMPTY_ARR;
  6371. }
  6372. if (isArray(raw)) {
  6373. for (let i = 0; i < raw.length; i++) {
  6374. if (!isString(raw[i])) {
  6375. warn$1(`props must be strings when using array syntax.`, raw[i]);
  6376. }
  6377. const normalizedKey = camelize(raw[i]);
  6378. if (validatePropName(normalizedKey)) {
  6379. normalized[normalizedKey] = EMPTY_OBJ;
  6380. }
  6381. }
  6382. } else if (raw) {
  6383. if (!isObject(raw)) {
  6384. warn$1(`invalid props options`, raw);
  6385. }
  6386. for (const key in raw) {
  6387. const normalizedKey = camelize(key);
  6388. if (validatePropName(normalizedKey)) {
  6389. const opt = raw[key];
  6390. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  6391. const propType = prop.type;
  6392. let shouldCast = false;
  6393. let shouldCastTrue = true;
  6394. if (isArray(propType)) {
  6395. for (let index = 0; index < propType.length; ++index) {
  6396. const type = propType[index];
  6397. const typeName = isFunction(type) && type.name;
  6398. if (typeName === "Boolean") {
  6399. shouldCast = true;
  6400. break;
  6401. } else if (typeName === "String") {
  6402. shouldCastTrue = false;
  6403. }
  6404. }
  6405. } else {
  6406. shouldCast = isFunction(propType) && propType.name === "Boolean";
  6407. }
  6408. prop[0 /* shouldCast */] = shouldCast;
  6409. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  6410. if (shouldCast || hasOwn(prop, "default")) {
  6411. needCastKeys.push(normalizedKey);
  6412. }
  6413. }
  6414. }
  6415. }
  6416. const res = [normalized, needCastKeys];
  6417. if (isObject(comp)) {
  6418. cache.set(comp, res);
  6419. }
  6420. return res;
  6421. }
  6422. function validatePropName(key) {
  6423. if (key[0] !== "$" && !isReservedProp(key)) {
  6424. return true;
  6425. } else {
  6426. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  6427. }
  6428. return false;
  6429. }
  6430. function getType(ctor) {
  6431. if (ctor === null) {
  6432. return "null";
  6433. }
  6434. if (typeof ctor === "function") {
  6435. return ctor.name || "";
  6436. } else if (typeof ctor === "object") {
  6437. const name = ctor.constructor && ctor.constructor.name;
  6438. return name || "";
  6439. }
  6440. return "";
  6441. }
  6442. function validateProps(rawProps, props, instance) {
  6443. const resolvedValues = toRaw(props);
  6444. const options = instance.propsOptions[0];
  6445. const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
  6446. for (const key in options) {
  6447. let opt = options[key];
  6448. if (opt == null) continue;
  6449. validateProp(
  6450. key,
  6451. resolvedValues[key],
  6452. opt,
  6453. shallowReadonly(resolvedValues) ,
  6454. !camelizePropsKey.includes(key)
  6455. );
  6456. }
  6457. }
  6458. function validateProp(name, value, prop, props, isAbsent) {
  6459. const { type, required, validator, skipCheck } = prop;
  6460. if (required && isAbsent) {
  6461. warn$1('Missing required prop: "' + name + '"');
  6462. return;
  6463. }
  6464. if (value == null && !required) {
  6465. return;
  6466. }
  6467. if (type != null && type !== true && !skipCheck) {
  6468. let isValid = false;
  6469. const types = isArray(type) ? type : [type];
  6470. const expectedTypes = [];
  6471. for (let i = 0; i < types.length && !isValid; i++) {
  6472. const { valid, expectedType } = assertType(value, types[i]);
  6473. expectedTypes.push(expectedType || "");
  6474. isValid = valid;
  6475. }
  6476. if (!isValid) {
  6477. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  6478. return;
  6479. }
  6480. }
  6481. if (validator && !validator(value, props)) {
  6482. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  6483. }
  6484. }
  6485. const isSimpleType = /* @__PURE__ */ makeMap(
  6486. "String,Number,Boolean,Function,Symbol,BigInt"
  6487. );
  6488. function assertType(value, type) {
  6489. let valid;
  6490. const expectedType = getType(type);
  6491. if (expectedType === "null") {
  6492. valid = value === null;
  6493. } else if (isSimpleType(expectedType)) {
  6494. const t = typeof value;
  6495. valid = t === expectedType.toLowerCase();
  6496. if (!valid && t === "object") {
  6497. valid = value instanceof type;
  6498. }
  6499. } else if (expectedType === "Object") {
  6500. valid = isObject(value);
  6501. } else if (expectedType === "Array") {
  6502. valid = isArray(value);
  6503. } else {
  6504. valid = value instanceof type;
  6505. }
  6506. return {
  6507. valid,
  6508. expectedType
  6509. };
  6510. }
  6511. function getInvalidTypeMessage(name, value, expectedTypes) {
  6512. if (expectedTypes.length === 0) {
  6513. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  6514. }
  6515. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  6516. const expectedType = expectedTypes[0];
  6517. const receivedType = toRawType(value);
  6518. const expectedValue = styleValue(value, expectedType);
  6519. const receivedValue = styleValue(value, receivedType);
  6520. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  6521. message += ` with value ${expectedValue}`;
  6522. }
  6523. message += `, got ${receivedType} `;
  6524. if (isExplicable(receivedType)) {
  6525. message += `with value ${receivedValue}.`;
  6526. }
  6527. return message;
  6528. }
  6529. function styleValue(value, type) {
  6530. if (type === "String") {
  6531. return `"${value}"`;
  6532. } else if (type === "Number") {
  6533. return `${Number(value)}`;
  6534. } else {
  6535. return `${value}`;
  6536. }
  6537. }
  6538. function isExplicable(type) {
  6539. const explicitTypes = ["string", "number", "boolean"];
  6540. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  6541. }
  6542. function isBoolean(...args) {
  6543. return args.some((elem) => elem.toLowerCase() === "boolean");
  6544. }
  6545. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  6546. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  6547. const normalizeSlot = (key, rawSlot, ctx) => {
  6548. if (rawSlot._n) {
  6549. return rawSlot;
  6550. }
  6551. const normalized = withCtx((...args) => {
  6552. if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
  6553. warn$1(
  6554. `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.`
  6555. );
  6556. }
  6557. return normalizeSlotValue(rawSlot(...args));
  6558. }, ctx);
  6559. normalized._c = false;
  6560. return normalized;
  6561. };
  6562. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  6563. const ctx = rawSlots._ctx;
  6564. for (const key in rawSlots) {
  6565. if (isInternalKey(key)) continue;
  6566. const value = rawSlots[key];
  6567. if (isFunction(value)) {
  6568. slots[key] = normalizeSlot(key, value, ctx);
  6569. } else if (value != null) {
  6570. {
  6571. warn$1(
  6572. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  6573. );
  6574. }
  6575. const normalized = normalizeSlotValue(value);
  6576. slots[key] = () => normalized;
  6577. }
  6578. }
  6579. };
  6580. const normalizeVNodeSlots = (instance, children) => {
  6581. if (!isKeepAlive(instance.vnode) && true) {
  6582. warn$1(
  6583. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  6584. );
  6585. }
  6586. const normalized = normalizeSlotValue(children);
  6587. instance.slots.default = () => normalized;
  6588. };
  6589. const assignSlots = (slots, children, optimized) => {
  6590. for (const key in children) {
  6591. if (optimized || key !== "_") {
  6592. slots[key] = children[key];
  6593. }
  6594. }
  6595. };
  6596. const initSlots = (instance, children, optimized) => {
  6597. const slots = instance.slots = createInternalObject();
  6598. if (instance.vnode.shapeFlag & 32) {
  6599. const type = children._;
  6600. if (type) {
  6601. assignSlots(slots, children, optimized);
  6602. if (optimized) {
  6603. def(slots, "_", type, true);
  6604. }
  6605. } else {
  6606. normalizeObjectSlots(children, slots);
  6607. }
  6608. } else if (children) {
  6609. normalizeVNodeSlots(instance, children);
  6610. }
  6611. };
  6612. const updateSlots = (instance, children, optimized) => {
  6613. const { vnode, slots } = instance;
  6614. let needDeletionCheck = true;
  6615. let deletionComparisonTarget = EMPTY_OBJ;
  6616. if (vnode.shapeFlag & 32) {
  6617. const type = children._;
  6618. if (type) {
  6619. if (isHmrUpdating) {
  6620. assignSlots(slots, children, optimized);
  6621. trigger(instance, "set", "$slots");
  6622. } else if (optimized && type === 1) {
  6623. needDeletionCheck = false;
  6624. } else {
  6625. assignSlots(slots, children, optimized);
  6626. }
  6627. } else {
  6628. needDeletionCheck = !children.$stable;
  6629. normalizeObjectSlots(children, slots);
  6630. }
  6631. deletionComparisonTarget = children;
  6632. } else if (children) {
  6633. normalizeVNodeSlots(instance, children);
  6634. deletionComparisonTarget = { default: 1 };
  6635. }
  6636. if (needDeletionCheck) {
  6637. for (const key in slots) {
  6638. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  6639. delete slots[key];
  6640. }
  6641. }
  6642. }
  6643. };
  6644. let supported;
  6645. let perf;
  6646. function startMeasure(instance, type) {
  6647. if (instance.appContext.config.performance && isSupported()) {
  6648. perf.mark(`vue-${type}-${instance.uid}`);
  6649. }
  6650. {
  6651. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6652. }
  6653. }
  6654. function endMeasure(instance, type) {
  6655. if (instance.appContext.config.performance && isSupported()) {
  6656. const startTag = `vue-${type}-${instance.uid}`;
  6657. const endTag = startTag + `:end`;
  6658. perf.mark(endTag);
  6659. perf.measure(
  6660. `<${formatComponentName(instance, instance.type)}> ${type}`,
  6661. startTag,
  6662. endTag
  6663. );
  6664. perf.clearMarks(startTag);
  6665. perf.clearMarks(endTag);
  6666. }
  6667. {
  6668. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6669. }
  6670. }
  6671. function isSupported() {
  6672. if (supported !== void 0) {
  6673. return supported;
  6674. }
  6675. if (typeof window !== "undefined" && window.performance) {
  6676. supported = true;
  6677. perf = window.performance;
  6678. } else {
  6679. supported = false;
  6680. }
  6681. return supported;
  6682. }
  6683. const queuePostRenderEffect = queueEffectWithSuspense ;
  6684. function createRenderer(options) {
  6685. return baseCreateRenderer(options);
  6686. }
  6687. function createHydrationRenderer(options) {
  6688. return baseCreateRenderer(options, createHydrationFunctions);
  6689. }
  6690. function baseCreateRenderer(options, createHydrationFns) {
  6691. const target = getGlobalThis();
  6692. target.__VUE__ = true;
  6693. {
  6694. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6695. }
  6696. const {
  6697. insert: hostInsert,
  6698. remove: hostRemove,
  6699. patchProp: hostPatchProp,
  6700. createElement: hostCreateElement,
  6701. createText: hostCreateText,
  6702. createComment: hostCreateComment,
  6703. setText: hostSetText,
  6704. setElementText: hostSetElementText,
  6705. parentNode: hostParentNode,
  6706. nextSibling: hostNextSibling,
  6707. setScopeId: hostSetScopeId = NOOP,
  6708. insertStaticContent: hostInsertStaticContent
  6709. } = options;
  6710. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6711. if (n1 === n2) {
  6712. return;
  6713. }
  6714. if (n1 && !isSameVNodeType(n1, n2)) {
  6715. anchor = getNextHostNode(n1);
  6716. unmount(n1, parentComponent, parentSuspense, true);
  6717. n1 = null;
  6718. }
  6719. if (n2.patchFlag === -2) {
  6720. optimized = false;
  6721. n2.dynamicChildren = null;
  6722. }
  6723. const { type, ref, shapeFlag } = n2;
  6724. switch (type) {
  6725. case Text:
  6726. processText(n1, n2, container, anchor);
  6727. break;
  6728. case Comment:
  6729. processCommentNode(n1, n2, container, anchor);
  6730. break;
  6731. case Static:
  6732. if (n1 == null) {
  6733. mountStaticNode(n2, container, anchor, namespace);
  6734. } else {
  6735. patchStaticNode(n1, n2, container, namespace);
  6736. }
  6737. break;
  6738. case Fragment:
  6739. processFragment(
  6740. n1,
  6741. n2,
  6742. container,
  6743. anchor,
  6744. parentComponent,
  6745. parentSuspense,
  6746. namespace,
  6747. slotScopeIds,
  6748. optimized
  6749. );
  6750. break;
  6751. default:
  6752. if (shapeFlag & 1) {
  6753. processElement(
  6754. n1,
  6755. n2,
  6756. container,
  6757. anchor,
  6758. parentComponent,
  6759. parentSuspense,
  6760. namespace,
  6761. slotScopeIds,
  6762. optimized
  6763. );
  6764. } else if (shapeFlag & 6) {
  6765. processComponent(
  6766. n1,
  6767. n2,
  6768. container,
  6769. anchor,
  6770. parentComponent,
  6771. parentSuspense,
  6772. namespace,
  6773. slotScopeIds,
  6774. optimized
  6775. );
  6776. } else if (shapeFlag & 64) {
  6777. type.process(
  6778. n1,
  6779. n2,
  6780. container,
  6781. anchor,
  6782. parentComponent,
  6783. parentSuspense,
  6784. namespace,
  6785. slotScopeIds,
  6786. optimized,
  6787. internals
  6788. );
  6789. } else if (shapeFlag & 128) {
  6790. type.process(
  6791. n1,
  6792. n2,
  6793. container,
  6794. anchor,
  6795. parentComponent,
  6796. parentSuspense,
  6797. namespace,
  6798. slotScopeIds,
  6799. optimized,
  6800. internals
  6801. );
  6802. } else {
  6803. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  6804. }
  6805. }
  6806. if (ref != null && parentComponent) {
  6807. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6808. }
  6809. };
  6810. const processText = (n1, n2, container, anchor) => {
  6811. if (n1 == null) {
  6812. hostInsert(
  6813. n2.el = hostCreateText(n2.children),
  6814. container,
  6815. anchor
  6816. );
  6817. } else {
  6818. const el = n2.el = n1.el;
  6819. if (n2.children !== n1.children) {
  6820. hostSetText(el, n2.children);
  6821. }
  6822. }
  6823. };
  6824. const processCommentNode = (n1, n2, container, anchor) => {
  6825. if (n1 == null) {
  6826. hostInsert(
  6827. n2.el = hostCreateComment(n2.children || ""),
  6828. container,
  6829. anchor
  6830. );
  6831. } else {
  6832. n2.el = n1.el;
  6833. }
  6834. };
  6835. const mountStaticNode = (n2, container, anchor, namespace) => {
  6836. [n2.el, n2.anchor] = hostInsertStaticContent(
  6837. n2.children,
  6838. container,
  6839. anchor,
  6840. namespace,
  6841. n2.el,
  6842. n2.anchor
  6843. );
  6844. };
  6845. const patchStaticNode = (n1, n2, container, namespace) => {
  6846. if (n2.children !== n1.children) {
  6847. const anchor = hostNextSibling(n1.anchor);
  6848. removeStaticNode(n1);
  6849. [n2.el, n2.anchor] = hostInsertStaticContent(
  6850. n2.children,
  6851. container,
  6852. anchor,
  6853. namespace
  6854. );
  6855. } else {
  6856. n2.el = n1.el;
  6857. n2.anchor = n1.anchor;
  6858. }
  6859. };
  6860. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  6861. let next;
  6862. while (el && el !== anchor) {
  6863. next = hostNextSibling(el);
  6864. hostInsert(el, container, nextSibling);
  6865. el = next;
  6866. }
  6867. hostInsert(anchor, container, nextSibling);
  6868. };
  6869. const removeStaticNode = ({ el, anchor }) => {
  6870. let next;
  6871. while (el && el !== anchor) {
  6872. next = hostNextSibling(el);
  6873. hostRemove(el);
  6874. el = next;
  6875. }
  6876. hostRemove(anchor);
  6877. };
  6878. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6879. if (n2.type === "svg") {
  6880. namespace = "svg";
  6881. } else if (n2.type === "math") {
  6882. namespace = "mathml";
  6883. }
  6884. if (n1 == null) {
  6885. mountElement(
  6886. n2,
  6887. container,
  6888. anchor,
  6889. parentComponent,
  6890. parentSuspense,
  6891. namespace,
  6892. slotScopeIds,
  6893. optimized
  6894. );
  6895. } else {
  6896. patchElement(
  6897. n1,
  6898. n2,
  6899. parentComponent,
  6900. parentSuspense,
  6901. namespace,
  6902. slotScopeIds,
  6903. optimized
  6904. );
  6905. }
  6906. };
  6907. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6908. let el;
  6909. let vnodeHook;
  6910. const { props, shapeFlag, transition, dirs } = vnode;
  6911. el = vnode.el = hostCreateElement(
  6912. vnode.type,
  6913. namespace,
  6914. props && props.is,
  6915. props
  6916. );
  6917. if (shapeFlag & 8) {
  6918. hostSetElementText(el, vnode.children);
  6919. } else if (shapeFlag & 16) {
  6920. mountChildren(
  6921. vnode.children,
  6922. el,
  6923. null,
  6924. parentComponent,
  6925. parentSuspense,
  6926. resolveChildrenNamespace(vnode, namespace),
  6927. slotScopeIds,
  6928. optimized
  6929. );
  6930. }
  6931. if (dirs) {
  6932. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6933. }
  6934. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6935. if (props) {
  6936. for (const key in props) {
  6937. if (key !== "value" && !isReservedProp(key)) {
  6938. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  6939. }
  6940. }
  6941. if ("value" in props) {
  6942. hostPatchProp(el, "value", null, props.value, namespace);
  6943. }
  6944. if (vnodeHook = props.onVnodeBeforeMount) {
  6945. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6946. }
  6947. }
  6948. {
  6949. def(el, "__vnode", vnode, true);
  6950. def(el, "__vueParentComponent", parentComponent, true);
  6951. }
  6952. if (dirs) {
  6953. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6954. }
  6955. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  6956. if (needCallTransitionHooks) {
  6957. transition.beforeEnter(el);
  6958. }
  6959. hostInsert(el, container, anchor);
  6960. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6961. queuePostRenderEffect(() => {
  6962. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6963. needCallTransitionHooks && transition.enter(el);
  6964. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6965. }, parentSuspense);
  6966. }
  6967. };
  6968. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6969. if (scopeId) {
  6970. hostSetScopeId(el, scopeId);
  6971. }
  6972. if (slotScopeIds) {
  6973. for (let i = 0; i < slotScopeIds.length; i++) {
  6974. hostSetScopeId(el, slotScopeIds[i]);
  6975. }
  6976. }
  6977. if (parentComponent) {
  6978. let subTree = parentComponent.subTree;
  6979. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  6980. subTree = filterSingleRoot(subTree.children) || subTree;
  6981. }
  6982. if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
  6983. const parentVNode = parentComponent.vnode;
  6984. setScopeId(
  6985. el,
  6986. parentVNode,
  6987. parentVNode.scopeId,
  6988. parentVNode.slotScopeIds,
  6989. parentComponent.parent
  6990. );
  6991. }
  6992. }
  6993. };
  6994. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  6995. for (let i = start; i < children.length; i++) {
  6996. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  6997. patch(
  6998. null,
  6999. child,
  7000. container,
  7001. anchor,
  7002. parentComponent,
  7003. parentSuspense,
  7004. namespace,
  7005. slotScopeIds,
  7006. optimized
  7007. );
  7008. }
  7009. };
  7010. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7011. const el = n2.el = n1.el;
  7012. {
  7013. el.__vnode = n2;
  7014. }
  7015. let { patchFlag, dynamicChildren, dirs } = n2;
  7016. patchFlag |= n1.patchFlag & 16;
  7017. const oldProps = n1.props || EMPTY_OBJ;
  7018. const newProps = n2.props || EMPTY_OBJ;
  7019. let vnodeHook;
  7020. parentComponent && toggleRecurse(parentComponent, false);
  7021. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  7022. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7023. }
  7024. if (dirs) {
  7025. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  7026. }
  7027. parentComponent && toggleRecurse(parentComponent, true);
  7028. if (isHmrUpdating) {
  7029. patchFlag = 0;
  7030. optimized = false;
  7031. dynamicChildren = null;
  7032. }
  7033. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  7034. hostSetElementText(el, "");
  7035. }
  7036. if (dynamicChildren) {
  7037. patchBlockChildren(
  7038. n1.dynamicChildren,
  7039. dynamicChildren,
  7040. el,
  7041. parentComponent,
  7042. parentSuspense,
  7043. resolveChildrenNamespace(n2, namespace),
  7044. slotScopeIds
  7045. );
  7046. {
  7047. traverseStaticChildren(n1, n2);
  7048. }
  7049. } else if (!optimized) {
  7050. patchChildren(
  7051. n1,
  7052. n2,
  7053. el,
  7054. null,
  7055. parentComponent,
  7056. parentSuspense,
  7057. resolveChildrenNamespace(n2, namespace),
  7058. slotScopeIds,
  7059. false
  7060. );
  7061. }
  7062. if (patchFlag > 0) {
  7063. if (patchFlag & 16) {
  7064. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7065. } else {
  7066. if (patchFlag & 2) {
  7067. if (oldProps.class !== newProps.class) {
  7068. hostPatchProp(el, "class", null, newProps.class, namespace);
  7069. }
  7070. }
  7071. if (patchFlag & 4) {
  7072. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  7073. }
  7074. if (patchFlag & 8) {
  7075. const propsToUpdate = n2.dynamicProps;
  7076. for (let i = 0; i < propsToUpdate.length; i++) {
  7077. const key = propsToUpdate[i];
  7078. const prev = oldProps[key];
  7079. const next = newProps[key];
  7080. if (next !== prev || key === "value") {
  7081. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7082. }
  7083. }
  7084. }
  7085. }
  7086. if (patchFlag & 1) {
  7087. if (n1.children !== n2.children) {
  7088. hostSetElementText(el, n2.children);
  7089. }
  7090. }
  7091. } else if (!optimized && dynamicChildren == null) {
  7092. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7093. }
  7094. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  7095. queuePostRenderEffect(() => {
  7096. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7097. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  7098. }, parentSuspense);
  7099. }
  7100. };
  7101. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  7102. for (let i = 0; i < newChildren.length; i++) {
  7103. const oldVNode = oldChildren[i];
  7104. const newVNode = newChildren[i];
  7105. const container = (
  7106. // oldVNode may be an errored async setup() component inside Suspense
  7107. // which will not have a mounted element
  7108. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  7109. // of the Fragment itself so it can move its children.
  7110. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  7111. // which also requires the correct parent container
  7112. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  7113. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  7114. // In other cases, the parent container is not actually used so we
  7115. // just pass the block element here to avoid a DOM parentNode call.
  7116. fallbackContainer
  7117. )
  7118. );
  7119. patch(
  7120. oldVNode,
  7121. newVNode,
  7122. container,
  7123. null,
  7124. parentComponent,
  7125. parentSuspense,
  7126. namespace,
  7127. slotScopeIds,
  7128. true
  7129. );
  7130. }
  7131. };
  7132. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  7133. if (oldProps !== newProps) {
  7134. if (oldProps !== EMPTY_OBJ) {
  7135. for (const key in oldProps) {
  7136. if (!isReservedProp(key) && !(key in newProps)) {
  7137. hostPatchProp(
  7138. el,
  7139. key,
  7140. oldProps[key],
  7141. null,
  7142. namespace,
  7143. parentComponent
  7144. );
  7145. }
  7146. }
  7147. }
  7148. for (const key in newProps) {
  7149. if (isReservedProp(key)) continue;
  7150. const next = newProps[key];
  7151. const prev = oldProps[key];
  7152. if (next !== prev && key !== "value") {
  7153. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7154. }
  7155. }
  7156. if ("value" in newProps) {
  7157. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  7158. }
  7159. }
  7160. };
  7161. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7162. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  7163. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  7164. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  7165. if (
  7166. // #5523 dev root fragment may inherit directives
  7167. isHmrUpdating || patchFlag & 2048
  7168. ) {
  7169. patchFlag = 0;
  7170. optimized = false;
  7171. dynamicChildren = null;
  7172. }
  7173. if (fragmentSlotScopeIds) {
  7174. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  7175. }
  7176. if (n1 == null) {
  7177. hostInsert(fragmentStartAnchor, container, anchor);
  7178. hostInsert(fragmentEndAnchor, container, anchor);
  7179. mountChildren(
  7180. // #10007
  7181. // such fragment like `<></>` will be compiled into
  7182. // a fragment which doesn't have a children.
  7183. // In this case fallback to an empty array
  7184. n2.children || [],
  7185. container,
  7186. fragmentEndAnchor,
  7187. parentComponent,
  7188. parentSuspense,
  7189. namespace,
  7190. slotScopeIds,
  7191. optimized
  7192. );
  7193. } else {
  7194. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  7195. // of renderSlot() with no valid children
  7196. n1.dynamicChildren) {
  7197. patchBlockChildren(
  7198. n1.dynamicChildren,
  7199. dynamicChildren,
  7200. container,
  7201. parentComponent,
  7202. parentSuspense,
  7203. namespace,
  7204. slotScopeIds
  7205. );
  7206. {
  7207. traverseStaticChildren(n1, n2);
  7208. }
  7209. } else {
  7210. patchChildren(
  7211. n1,
  7212. n2,
  7213. container,
  7214. fragmentEndAnchor,
  7215. parentComponent,
  7216. parentSuspense,
  7217. namespace,
  7218. slotScopeIds,
  7219. optimized
  7220. );
  7221. }
  7222. }
  7223. };
  7224. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7225. n2.slotScopeIds = slotScopeIds;
  7226. if (n1 == null) {
  7227. if (n2.shapeFlag & 512) {
  7228. parentComponent.ctx.activate(
  7229. n2,
  7230. container,
  7231. anchor,
  7232. namespace,
  7233. optimized
  7234. );
  7235. } else {
  7236. mountComponent(
  7237. n2,
  7238. container,
  7239. anchor,
  7240. parentComponent,
  7241. parentSuspense,
  7242. namespace,
  7243. optimized
  7244. );
  7245. }
  7246. } else {
  7247. updateComponent(n1, n2, optimized);
  7248. }
  7249. };
  7250. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  7251. const instance = (initialVNode.component = createComponentInstance(
  7252. initialVNode,
  7253. parentComponent,
  7254. parentSuspense
  7255. ));
  7256. if (instance.type.__hmrId) {
  7257. registerHMR(instance);
  7258. }
  7259. {
  7260. pushWarningContext(initialVNode);
  7261. startMeasure(instance, `mount`);
  7262. }
  7263. if (isKeepAlive(initialVNode)) {
  7264. instance.ctx.renderer = internals;
  7265. }
  7266. {
  7267. {
  7268. startMeasure(instance, `init`);
  7269. }
  7270. setupComponent(instance, false, optimized);
  7271. {
  7272. endMeasure(instance, `init`);
  7273. }
  7274. }
  7275. if (instance.asyncDep) {
  7276. if (isHmrUpdating) initialVNode.el = null;
  7277. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  7278. if (!initialVNode.el) {
  7279. const placeholder = instance.subTree = createVNode(Comment);
  7280. processCommentNode(null, placeholder, container, anchor);
  7281. }
  7282. } else {
  7283. setupRenderEffect(
  7284. instance,
  7285. initialVNode,
  7286. container,
  7287. anchor,
  7288. parentSuspense,
  7289. namespace,
  7290. optimized
  7291. );
  7292. }
  7293. {
  7294. popWarningContext();
  7295. endMeasure(instance, `mount`);
  7296. }
  7297. };
  7298. const updateComponent = (n1, n2, optimized) => {
  7299. const instance = n2.component = n1.component;
  7300. if (shouldUpdateComponent(n1, n2, optimized)) {
  7301. if (instance.asyncDep && !instance.asyncResolved) {
  7302. {
  7303. pushWarningContext(n2);
  7304. }
  7305. updateComponentPreRender(instance, n2, optimized);
  7306. {
  7307. popWarningContext();
  7308. }
  7309. return;
  7310. } else {
  7311. instance.next = n2;
  7312. instance.update();
  7313. }
  7314. } else {
  7315. n2.el = n1.el;
  7316. instance.vnode = n2;
  7317. }
  7318. };
  7319. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  7320. const componentUpdateFn = () => {
  7321. if (!instance.isMounted) {
  7322. let vnodeHook;
  7323. const { el, props } = initialVNode;
  7324. const { bm, m, parent, root, type } = instance;
  7325. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  7326. toggleRecurse(instance, false);
  7327. if (bm) {
  7328. invokeArrayFns(bm);
  7329. }
  7330. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  7331. invokeVNodeHook(vnodeHook, parent, initialVNode);
  7332. }
  7333. toggleRecurse(instance, true);
  7334. if (el && hydrateNode) {
  7335. const hydrateSubTree = () => {
  7336. {
  7337. startMeasure(instance, `render`);
  7338. }
  7339. instance.subTree = renderComponentRoot(instance);
  7340. {
  7341. endMeasure(instance, `render`);
  7342. }
  7343. {
  7344. startMeasure(instance, `hydrate`);
  7345. }
  7346. hydrateNode(
  7347. el,
  7348. instance.subTree,
  7349. instance,
  7350. parentSuspense,
  7351. null
  7352. );
  7353. {
  7354. endMeasure(instance, `hydrate`);
  7355. }
  7356. };
  7357. if (isAsyncWrapperVNode && type.__asyncHydrate) {
  7358. type.__asyncHydrate(
  7359. el,
  7360. instance,
  7361. hydrateSubTree
  7362. );
  7363. } else {
  7364. hydrateSubTree();
  7365. }
  7366. } else {
  7367. if (root.ce) {
  7368. root.ce._injectChildStyle(type);
  7369. }
  7370. {
  7371. startMeasure(instance, `render`);
  7372. }
  7373. const subTree = instance.subTree = renderComponentRoot(instance);
  7374. {
  7375. endMeasure(instance, `render`);
  7376. }
  7377. {
  7378. startMeasure(instance, `patch`);
  7379. }
  7380. patch(
  7381. null,
  7382. subTree,
  7383. container,
  7384. anchor,
  7385. instance,
  7386. parentSuspense,
  7387. namespace
  7388. );
  7389. {
  7390. endMeasure(instance, `patch`);
  7391. }
  7392. initialVNode.el = subTree.el;
  7393. }
  7394. if (m) {
  7395. queuePostRenderEffect(m, parentSuspense);
  7396. }
  7397. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  7398. const scopedInitialVNode = initialVNode;
  7399. queuePostRenderEffect(
  7400. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  7401. parentSuspense
  7402. );
  7403. }
  7404. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  7405. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  7406. }
  7407. instance.isMounted = true;
  7408. {
  7409. devtoolsComponentAdded(instance);
  7410. }
  7411. initialVNode = container = anchor = null;
  7412. } else {
  7413. let { next, bu, u, parent, vnode } = instance;
  7414. {
  7415. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  7416. if (nonHydratedAsyncRoot) {
  7417. if (next) {
  7418. next.el = vnode.el;
  7419. updateComponentPreRender(instance, next, optimized);
  7420. }
  7421. nonHydratedAsyncRoot.asyncDep.then(() => {
  7422. if (!instance.isUnmounted) {
  7423. componentUpdateFn();
  7424. }
  7425. });
  7426. return;
  7427. }
  7428. }
  7429. let originNext = next;
  7430. let vnodeHook;
  7431. {
  7432. pushWarningContext(next || instance.vnode);
  7433. }
  7434. toggleRecurse(instance, false);
  7435. if (next) {
  7436. next.el = vnode.el;
  7437. updateComponentPreRender(instance, next, optimized);
  7438. } else {
  7439. next = vnode;
  7440. }
  7441. if (bu) {
  7442. invokeArrayFns(bu);
  7443. }
  7444. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  7445. invokeVNodeHook(vnodeHook, parent, next, vnode);
  7446. }
  7447. toggleRecurse(instance, true);
  7448. {
  7449. startMeasure(instance, `render`);
  7450. }
  7451. const nextTree = renderComponentRoot(instance);
  7452. {
  7453. endMeasure(instance, `render`);
  7454. }
  7455. const prevTree = instance.subTree;
  7456. instance.subTree = nextTree;
  7457. {
  7458. startMeasure(instance, `patch`);
  7459. }
  7460. patch(
  7461. prevTree,
  7462. nextTree,
  7463. // parent may have changed if it's in a teleport
  7464. hostParentNode(prevTree.el),
  7465. // anchor may have changed if it's in a fragment
  7466. getNextHostNode(prevTree),
  7467. instance,
  7468. parentSuspense,
  7469. namespace
  7470. );
  7471. {
  7472. endMeasure(instance, `patch`);
  7473. }
  7474. next.el = nextTree.el;
  7475. if (originNext === null) {
  7476. updateHOCHostEl(instance, nextTree.el);
  7477. }
  7478. if (u) {
  7479. queuePostRenderEffect(u, parentSuspense);
  7480. }
  7481. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  7482. queuePostRenderEffect(
  7483. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  7484. parentSuspense
  7485. );
  7486. }
  7487. {
  7488. devtoolsComponentUpdated(instance);
  7489. }
  7490. {
  7491. popWarningContext();
  7492. }
  7493. }
  7494. };
  7495. instance.scope.on();
  7496. const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
  7497. instance.scope.off();
  7498. const update = instance.update = effect.run.bind(effect);
  7499. const job = instance.job = effect.runIfDirty.bind(effect);
  7500. job.i = instance;
  7501. job.id = instance.uid;
  7502. effect.scheduler = () => queueJob(job);
  7503. toggleRecurse(instance, true);
  7504. {
  7505. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  7506. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  7507. }
  7508. update();
  7509. };
  7510. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  7511. nextVNode.component = instance;
  7512. const prevProps = instance.vnode.props;
  7513. instance.vnode = nextVNode;
  7514. instance.next = null;
  7515. updateProps(instance, nextVNode.props, prevProps, optimized);
  7516. updateSlots(instance, nextVNode.children, optimized);
  7517. pauseTracking();
  7518. flushPreFlushCbs(instance);
  7519. resetTracking();
  7520. };
  7521. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  7522. const c1 = n1 && n1.children;
  7523. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  7524. const c2 = n2.children;
  7525. const { patchFlag, shapeFlag } = n2;
  7526. if (patchFlag > 0) {
  7527. if (patchFlag & 128) {
  7528. patchKeyedChildren(
  7529. c1,
  7530. c2,
  7531. container,
  7532. anchor,
  7533. parentComponent,
  7534. parentSuspense,
  7535. namespace,
  7536. slotScopeIds,
  7537. optimized
  7538. );
  7539. return;
  7540. } else if (patchFlag & 256) {
  7541. patchUnkeyedChildren(
  7542. c1,
  7543. c2,
  7544. container,
  7545. anchor,
  7546. parentComponent,
  7547. parentSuspense,
  7548. namespace,
  7549. slotScopeIds,
  7550. optimized
  7551. );
  7552. return;
  7553. }
  7554. }
  7555. if (shapeFlag & 8) {
  7556. if (prevShapeFlag & 16) {
  7557. unmountChildren(c1, parentComponent, parentSuspense);
  7558. }
  7559. if (c2 !== c1) {
  7560. hostSetElementText(container, c2);
  7561. }
  7562. } else {
  7563. if (prevShapeFlag & 16) {
  7564. if (shapeFlag & 16) {
  7565. patchKeyedChildren(
  7566. c1,
  7567. c2,
  7568. container,
  7569. anchor,
  7570. parentComponent,
  7571. parentSuspense,
  7572. namespace,
  7573. slotScopeIds,
  7574. optimized
  7575. );
  7576. } else {
  7577. unmountChildren(c1, parentComponent, parentSuspense, true);
  7578. }
  7579. } else {
  7580. if (prevShapeFlag & 8) {
  7581. hostSetElementText(container, "");
  7582. }
  7583. if (shapeFlag & 16) {
  7584. mountChildren(
  7585. c2,
  7586. container,
  7587. anchor,
  7588. parentComponent,
  7589. parentSuspense,
  7590. namespace,
  7591. slotScopeIds,
  7592. optimized
  7593. );
  7594. }
  7595. }
  7596. }
  7597. };
  7598. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7599. c1 = c1 || EMPTY_ARR;
  7600. c2 = c2 || EMPTY_ARR;
  7601. const oldLength = c1.length;
  7602. const newLength = c2.length;
  7603. const commonLength = Math.min(oldLength, newLength);
  7604. let i;
  7605. for (i = 0; i < commonLength; i++) {
  7606. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7607. patch(
  7608. c1[i],
  7609. nextChild,
  7610. container,
  7611. null,
  7612. parentComponent,
  7613. parentSuspense,
  7614. namespace,
  7615. slotScopeIds,
  7616. optimized
  7617. );
  7618. }
  7619. if (oldLength > newLength) {
  7620. unmountChildren(
  7621. c1,
  7622. parentComponent,
  7623. parentSuspense,
  7624. true,
  7625. false,
  7626. commonLength
  7627. );
  7628. } else {
  7629. mountChildren(
  7630. c2,
  7631. container,
  7632. anchor,
  7633. parentComponent,
  7634. parentSuspense,
  7635. namespace,
  7636. slotScopeIds,
  7637. optimized,
  7638. commonLength
  7639. );
  7640. }
  7641. };
  7642. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7643. let i = 0;
  7644. const l2 = c2.length;
  7645. let e1 = c1.length - 1;
  7646. let e2 = l2 - 1;
  7647. while (i <= e1 && i <= e2) {
  7648. const n1 = c1[i];
  7649. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7650. if (isSameVNodeType(n1, n2)) {
  7651. patch(
  7652. n1,
  7653. n2,
  7654. container,
  7655. null,
  7656. parentComponent,
  7657. parentSuspense,
  7658. namespace,
  7659. slotScopeIds,
  7660. optimized
  7661. );
  7662. } else {
  7663. break;
  7664. }
  7665. i++;
  7666. }
  7667. while (i <= e1 && i <= e2) {
  7668. const n1 = c1[e1];
  7669. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7670. if (isSameVNodeType(n1, n2)) {
  7671. patch(
  7672. n1,
  7673. n2,
  7674. container,
  7675. null,
  7676. parentComponent,
  7677. parentSuspense,
  7678. namespace,
  7679. slotScopeIds,
  7680. optimized
  7681. );
  7682. } else {
  7683. break;
  7684. }
  7685. e1--;
  7686. e2--;
  7687. }
  7688. if (i > e1) {
  7689. if (i <= e2) {
  7690. const nextPos = e2 + 1;
  7691. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7692. while (i <= e2) {
  7693. patch(
  7694. null,
  7695. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  7696. container,
  7697. anchor,
  7698. parentComponent,
  7699. parentSuspense,
  7700. namespace,
  7701. slotScopeIds,
  7702. optimized
  7703. );
  7704. i++;
  7705. }
  7706. }
  7707. } else if (i > e2) {
  7708. while (i <= e1) {
  7709. unmount(c1[i], parentComponent, parentSuspense, true);
  7710. i++;
  7711. }
  7712. } else {
  7713. const s1 = i;
  7714. const s2 = i;
  7715. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  7716. for (i = s2; i <= e2; i++) {
  7717. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7718. if (nextChild.key != null) {
  7719. if (keyToNewIndexMap.has(nextChild.key)) {
  7720. warn$1(
  7721. `Duplicate keys found during update:`,
  7722. JSON.stringify(nextChild.key),
  7723. `Make sure keys are unique.`
  7724. );
  7725. }
  7726. keyToNewIndexMap.set(nextChild.key, i);
  7727. }
  7728. }
  7729. let j;
  7730. let patched = 0;
  7731. const toBePatched = e2 - s2 + 1;
  7732. let moved = false;
  7733. let maxNewIndexSoFar = 0;
  7734. const newIndexToOldIndexMap = new Array(toBePatched);
  7735. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  7736. for (i = s1; i <= e1; i++) {
  7737. const prevChild = c1[i];
  7738. if (patched >= toBePatched) {
  7739. unmount(prevChild, parentComponent, parentSuspense, true);
  7740. continue;
  7741. }
  7742. let newIndex;
  7743. if (prevChild.key != null) {
  7744. newIndex = keyToNewIndexMap.get(prevChild.key);
  7745. } else {
  7746. for (j = s2; j <= e2; j++) {
  7747. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7748. newIndex = j;
  7749. break;
  7750. }
  7751. }
  7752. }
  7753. if (newIndex === void 0) {
  7754. unmount(prevChild, parentComponent, parentSuspense, true);
  7755. } else {
  7756. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7757. if (newIndex >= maxNewIndexSoFar) {
  7758. maxNewIndexSoFar = newIndex;
  7759. } else {
  7760. moved = true;
  7761. }
  7762. patch(
  7763. prevChild,
  7764. c2[newIndex],
  7765. container,
  7766. null,
  7767. parentComponent,
  7768. parentSuspense,
  7769. namespace,
  7770. slotScopeIds,
  7771. optimized
  7772. );
  7773. patched++;
  7774. }
  7775. }
  7776. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7777. j = increasingNewIndexSequence.length - 1;
  7778. for (i = toBePatched - 1; i >= 0; i--) {
  7779. const nextIndex = s2 + i;
  7780. const nextChild = c2[nextIndex];
  7781. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  7782. if (newIndexToOldIndexMap[i] === 0) {
  7783. patch(
  7784. null,
  7785. nextChild,
  7786. container,
  7787. anchor,
  7788. parentComponent,
  7789. parentSuspense,
  7790. namespace,
  7791. slotScopeIds,
  7792. optimized
  7793. );
  7794. } else if (moved) {
  7795. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7796. move(nextChild, container, anchor, 2);
  7797. } else {
  7798. j--;
  7799. }
  7800. }
  7801. }
  7802. }
  7803. };
  7804. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  7805. const { el, type, transition, children, shapeFlag } = vnode;
  7806. if (shapeFlag & 6) {
  7807. move(vnode.component.subTree, container, anchor, moveType);
  7808. return;
  7809. }
  7810. if (shapeFlag & 128) {
  7811. vnode.suspense.move(container, anchor, moveType);
  7812. return;
  7813. }
  7814. if (shapeFlag & 64) {
  7815. type.move(vnode, container, anchor, internals);
  7816. return;
  7817. }
  7818. if (type === Fragment) {
  7819. hostInsert(el, container, anchor);
  7820. for (let i = 0; i < children.length; i++) {
  7821. move(children[i], container, anchor, moveType);
  7822. }
  7823. hostInsert(vnode.anchor, container, anchor);
  7824. return;
  7825. }
  7826. if (type === Static) {
  7827. moveStaticNode(vnode, container, anchor);
  7828. return;
  7829. }
  7830. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  7831. if (needTransition2) {
  7832. if (moveType === 0) {
  7833. transition.beforeEnter(el);
  7834. hostInsert(el, container, anchor);
  7835. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7836. } else {
  7837. const { leave, delayLeave, afterLeave } = transition;
  7838. const remove2 = () => hostInsert(el, container, anchor);
  7839. const performLeave = () => {
  7840. leave(el, () => {
  7841. remove2();
  7842. afterLeave && afterLeave();
  7843. });
  7844. };
  7845. if (delayLeave) {
  7846. delayLeave(el, remove2, performLeave);
  7847. } else {
  7848. performLeave();
  7849. }
  7850. }
  7851. } else {
  7852. hostInsert(el, container, anchor);
  7853. }
  7854. };
  7855. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  7856. const {
  7857. type,
  7858. props,
  7859. ref,
  7860. children,
  7861. dynamicChildren,
  7862. shapeFlag,
  7863. patchFlag,
  7864. dirs,
  7865. cacheIndex
  7866. } = vnode;
  7867. if (patchFlag === -2) {
  7868. optimized = false;
  7869. }
  7870. if (ref != null) {
  7871. setRef(ref, null, parentSuspense, vnode, true);
  7872. }
  7873. if (cacheIndex != null) {
  7874. parentComponent.renderCache[cacheIndex] = void 0;
  7875. }
  7876. if (shapeFlag & 256) {
  7877. parentComponent.ctx.deactivate(vnode);
  7878. return;
  7879. }
  7880. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  7881. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  7882. let vnodeHook;
  7883. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  7884. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7885. }
  7886. if (shapeFlag & 6) {
  7887. unmountComponent(vnode.component, parentSuspense, doRemove);
  7888. } else {
  7889. if (shapeFlag & 128) {
  7890. vnode.suspense.unmount(parentSuspense, doRemove);
  7891. return;
  7892. }
  7893. if (shouldInvokeDirs) {
  7894. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  7895. }
  7896. if (shapeFlag & 64) {
  7897. vnode.type.remove(
  7898. vnode,
  7899. parentComponent,
  7900. parentSuspense,
  7901. internals,
  7902. doRemove
  7903. );
  7904. } else if (dynamicChildren && // #5154
  7905. // when v-once is used inside a block, setBlockTracking(-1) marks the
  7906. // parent block with hasOnce: true
  7907. // so that it doesn't take the fast path during unmount - otherwise
  7908. // components nested in v-once are never unmounted.
  7909. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7910. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7911. unmountChildren(
  7912. dynamicChildren,
  7913. parentComponent,
  7914. parentSuspense,
  7915. false,
  7916. true
  7917. );
  7918. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7919. unmountChildren(children, parentComponent, parentSuspense);
  7920. }
  7921. if (doRemove) {
  7922. remove(vnode);
  7923. }
  7924. }
  7925. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7926. queuePostRenderEffect(() => {
  7927. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7928. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  7929. }, parentSuspense);
  7930. }
  7931. };
  7932. const remove = (vnode) => {
  7933. const { type, el, anchor, transition } = vnode;
  7934. if (type === Fragment) {
  7935. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  7936. vnode.children.forEach((child) => {
  7937. if (child.type === Comment) {
  7938. hostRemove(child.el);
  7939. } else {
  7940. remove(child);
  7941. }
  7942. });
  7943. } else {
  7944. removeFragment(el, anchor);
  7945. }
  7946. return;
  7947. }
  7948. if (type === Static) {
  7949. removeStaticNode(vnode);
  7950. return;
  7951. }
  7952. const performRemove = () => {
  7953. hostRemove(el);
  7954. if (transition && !transition.persisted && transition.afterLeave) {
  7955. transition.afterLeave();
  7956. }
  7957. };
  7958. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  7959. const { leave, delayLeave } = transition;
  7960. const performLeave = () => leave(el, performRemove);
  7961. if (delayLeave) {
  7962. delayLeave(vnode.el, performRemove, performLeave);
  7963. } else {
  7964. performLeave();
  7965. }
  7966. } else {
  7967. performRemove();
  7968. }
  7969. };
  7970. const removeFragment = (cur, end) => {
  7971. let next;
  7972. while (cur !== end) {
  7973. next = hostNextSibling(cur);
  7974. hostRemove(cur);
  7975. cur = next;
  7976. }
  7977. hostRemove(end);
  7978. };
  7979. const unmountComponent = (instance, parentSuspense, doRemove) => {
  7980. if (instance.type.__hmrId) {
  7981. unregisterHMR(instance);
  7982. }
  7983. const { bum, scope, job, subTree, um, m, a } = instance;
  7984. invalidateMount(m);
  7985. invalidateMount(a);
  7986. if (bum) {
  7987. invokeArrayFns(bum);
  7988. }
  7989. scope.stop();
  7990. if (job) {
  7991. job.flags |= 8;
  7992. unmount(subTree, instance, parentSuspense, doRemove);
  7993. }
  7994. if (um) {
  7995. queuePostRenderEffect(um, parentSuspense);
  7996. }
  7997. queuePostRenderEffect(() => {
  7998. instance.isUnmounted = true;
  7999. }, parentSuspense);
  8000. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  8001. parentSuspense.deps--;
  8002. if (parentSuspense.deps === 0) {
  8003. parentSuspense.resolve();
  8004. }
  8005. }
  8006. {
  8007. devtoolsComponentRemoved(instance);
  8008. }
  8009. };
  8010. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  8011. for (let i = start; i < children.length; i++) {
  8012. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  8013. }
  8014. };
  8015. const getNextHostNode = (vnode) => {
  8016. if (vnode.shapeFlag & 6) {
  8017. return getNextHostNode(vnode.component.subTree);
  8018. }
  8019. if (vnode.shapeFlag & 128) {
  8020. return vnode.suspense.next();
  8021. }
  8022. const el = hostNextSibling(vnode.anchor || vnode.el);
  8023. const teleportEnd = el && el[TeleportEndKey];
  8024. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  8025. };
  8026. let isFlushing = false;
  8027. const render = (vnode, container, namespace) => {
  8028. if (vnode == null) {
  8029. if (container._vnode) {
  8030. unmount(container._vnode, null, null, true);
  8031. }
  8032. } else {
  8033. patch(
  8034. container._vnode || null,
  8035. vnode,
  8036. container,
  8037. null,
  8038. null,
  8039. null,
  8040. namespace
  8041. );
  8042. }
  8043. container._vnode = vnode;
  8044. if (!isFlushing) {
  8045. isFlushing = true;
  8046. flushPreFlushCbs();
  8047. flushPostFlushCbs();
  8048. isFlushing = false;
  8049. }
  8050. };
  8051. const internals = {
  8052. p: patch,
  8053. um: unmount,
  8054. m: move,
  8055. r: remove,
  8056. mt: mountComponent,
  8057. mc: mountChildren,
  8058. pc: patchChildren,
  8059. pbc: patchBlockChildren,
  8060. n: getNextHostNode,
  8061. o: options
  8062. };
  8063. let hydrate;
  8064. let hydrateNode;
  8065. if (createHydrationFns) {
  8066. [hydrate, hydrateNode] = createHydrationFns(
  8067. internals
  8068. );
  8069. }
  8070. return {
  8071. render,
  8072. hydrate,
  8073. createApp: createAppAPI(render, hydrate)
  8074. };
  8075. }
  8076. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  8077. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  8078. }
  8079. function toggleRecurse({ effect, job }, allowed) {
  8080. if (allowed) {
  8081. effect.flags |= 32;
  8082. job.flags |= 4;
  8083. } else {
  8084. effect.flags &= ~32;
  8085. job.flags &= ~4;
  8086. }
  8087. }
  8088. function needTransition(parentSuspense, transition) {
  8089. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  8090. }
  8091. function traverseStaticChildren(n1, n2, shallow = false) {
  8092. const ch1 = n1.children;
  8093. const ch2 = n2.children;
  8094. if (isArray(ch1) && isArray(ch2)) {
  8095. for (let i = 0; i < ch1.length; i++) {
  8096. const c1 = ch1[i];
  8097. let c2 = ch2[i];
  8098. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  8099. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  8100. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  8101. c2.el = c1.el;
  8102. }
  8103. if (!shallow && c2.patchFlag !== -2)
  8104. traverseStaticChildren(c1, c2);
  8105. }
  8106. if (c2.type === Text) {
  8107. c2.el = c1.el;
  8108. }
  8109. if (c2.type === Comment && !c2.el) {
  8110. c2.el = c1.el;
  8111. }
  8112. }
  8113. }
  8114. }
  8115. function getSequence(arr) {
  8116. const p = arr.slice();
  8117. const result = [0];
  8118. let i, j, u, v, c;
  8119. const len = arr.length;
  8120. for (i = 0; i < len; i++) {
  8121. const arrI = arr[i];
  8122. if (arrI !== 0) {
  8123. j = result[result.length - 1];
  8124. if (arr[j] < arrI) {
  8125. p[i] = j;
  8126. result.push(i);
  8127. continue;
  8128. }
  8129. u = 0;
  8130. v = result.length - 1;
  8131. while (u < v) {
  8132. c = u + v >> 1;
  8133. if (arr[result[c]] < arrI) {
  8134. u = c + 1;
  8135. } else {
  8136. v = c;
  8137. }
  8138. }
  8139. if (arrI < arr[result[u]]) {
  8140. if (u > 0) {
  8141. p[i] = result[u - 1];
  8142. }
  8143. result[u] = i;
  8144. }
  8145. }
  8146. }
  8147. u = result.length;
  8148. v = result[u - 1];
  8149. while (u-- > 0) {
  8150. result[u] = v;
  8151. v = p[v];
  8152. }
  8153. return result;
  8154. }
  8155. function locateNonHydratedAsyncRoot(instance) {
  8156. const subComponent = instance.subTree.component;
  8157. if (subComponent) {
  8158. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  8159. return subComponent;
  8160. } else {
  8161. return locateNonHydratedAsyncRoot(subComponent);
  8162. }
  8163. }
  8164. }
  8165. function invalidateMount(hooks) {
  8166. if (hooks) {
  8167. for (let i = 0; i < hooks.length; i++)
  8168. hooks[i].flags |= 8;
  8169. }
  8170. }
  8171. const ssrContextKey = Symbol.for("v-scx");
  8172. const useSSRContext = () => {
  8173. {
  8174. const ctx = inject(ssrContextKey);
  8175. if (!ctx) {
  8176. warn$1(
  8177. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  8178. );
  8179. }
  8180. return ctx;
  8181. }
  8182. };
  8183. function watchEffect(effect, options) {
  8184. return doWatch(effect, null, options);
  8185. }
  8186. function watchPostEffect(effect, options) {
  8187. return doWatch(
  8188. effect,
  8189. null,
  8190. extend({}, options, { flush: "post" })
  8191. );
  8192. }
  8193. function watchSyncEffect(effect, options) {
  8194. return doWatch(
  8195. effect,
  8196. null,
  8197. extend({}, options, { flush: "sync" })
  8198. );
  8199. }
  8200. function watch(source, cb, options) {
  8201. if (!isFunction(cb)) {
  8202. warn$1(
  8203. `\`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.`
  8204. );
  8205. }
  8206. return doWatch(source, cb, options);
  8207. }
  8208. function doWatch(source, cb, options = EMPTY_OBJ) {
  8209. const { immediate, deep, flush, once } = options;
  8210. if (!cb) {
  8211. if (immediate !== void 0) {
  8212. warn$1(
  8213. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  8214. );
  8215. }
  8216. if (deep !== void 0) {
  8217. warn$1(
  8218. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  8219. );
  8220. }
  8221. if (once !== void 0) {
  8222. warn$1(
  8223. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  8224. );
  8225. }
  8226. }
  8227. const baseWatchOptions = extend({}, options);
  8228. baseWatchOptions.onWarn = warn$1;
  8229. const runsImmediately = cb && immediate || !cb && flush !== "post";
  8230. let ssrCleanup;
  8231. if (isInSSRComponentSetup) {
  8232. if (flush === "sync") {
  8233. const ctx = useSSRContext();
  8234. ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
  8235. } else if (!runsImmediately) {
  8236. const watchStopHandle = () => {
  8237. };
  8238. watchStopHandle.stop = NOOP;
  8239. watchStopHandle.resume = NOOP;
  8240. watchStopHandle.pause = NOOP;
  8241. return watchStopHandle;
  8242. }
  8243. }
  8244. const instance = currentInstance;
  8245. baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
  8246. let isPre = false;
  8247. if (flush === "post") {
  8248. baseWatchOptions.scheduler = (job) => {
  8249. queuePostRenderEffect(job, instance && instance.suspense);
  8250. };
  8251. } else if (flush !== "sync") {
  8252. isPre = true;
  8253. baseWatchOptions.scheduler = (job, isFirstRun) => {
  8254. if (isFirstRun) {
  8255. job();
  8256. } else {
  8257. queueJob(job);
  8258. }
  8259. };
  8260. }
  8261. baseWatchOptions.augmentJob = (job) => {
  8262. if (cb) {
  8263. job.flags |= 4;
  8264. }
  8265. if (isPre) {
  8266. job.flags |= 2;
  8267. if (instance) {
  8268. job.id = instance.uid;
  8269. job.i = instance;
  8270. }
  8271. }
  8272. };
  8273. const watchHandle = watch$1(source, cb, baseWatchOptions);
  8274. if (isInSSRComponentSetup) {
  8275. if (ssrCleanup) {
  8276. ssrCleanup.push(watchHandle);
  8277. } else if (runsImmediately) {
  8278. watchHandle();
  8279. }
  8280. }
  8281. return watchHandle;
  8282. }
  8283. function instanceWatch(source, value, options) {
  8284. const publicThis = this.proxy;
  8285. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  8286. let cb;
  8287. if (isFunction(value)) {
  8288. cb = value;
  8289. } else {
  8290. cb = value.handler;
  8291. options = value;
  8292. }
  8293. const reset = setCurrentInstance(this);
  8294. const res = doWatch(getter, cb.bind(publicThis), options);
  8295. reset();
  8296. return res;
  8297. }
  8298. function createPathGetter(ctx, path) {
  8299. const segments = path.split(".");
  8300. return () => {
  8301. let cur = ctx;
  8302. for (let i = 0; i < segments.length && cur; i++) {
  8303. cur = cur[segments[i]];
  8304. }
  8305. return cur;
  8306. };
  8307. }
  8308. function useModel(props, name, options = EMPTY_OBJ) {
  8309. const i = getCurrentInstance();
  8310. if (!i) {
  8311. warn$1(`useModel() called without active instance.`);
  8312. return ref();
  8313. }
  8314. const camelizedName = camelize(name);
  8315. if (!i.propsOptions[0][camelizedName]) {
  8316. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  8317. return ref();
  8318. }
  8319. const hyphenatedName = hyphenate(name);
  8320. const modifiers = getModelModifiers(props, camelizedName);
  8321. const res = customRef((track, trigger) => {
  8322. let localValue;
  8323. let prevSetValue = EMPTY_OBJ;
  8324. let prevEmittedValue;
  8325. watchSyncEffect(() => {
  8326. const propValue = props[camelizedName];
  8327. if (hasChanged(localValue, propValue)) {
  8328. localValue = propValue;
  8329. trigger();
  8330. }
  8331. });
  8332. return {
  8333. get() {
  8334. track();
  8335. return options.get ? options.get(localValue) : localValue;
  8336. },
  8337. set(value) {
  8338. const emittedValue = options.set ? options.set(value) : value;
  8339. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  8340. return;
  8341. }
  8342. const rawProps = i.vnode.props;
  8343. if (!(rawProps && // check if parent has passed v-model
  8344. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
  8345. localValue = value;
  8346. trigger();
  8347. }
  8348. i.emit(`update:${name}`, emittedValue);
  8349. if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
  8350. trigger();
  8351. }
  8352. prevSetValue = value;
  8353. prevEmittedValue = emittedValue;
  8354. }
  8355. };
  8356. });
  8357. res[Symbol.iterator] = () => {
  8358. let i2 = 0;
  8359. return {
  8360. next() {
  8361. if (i2 < 2) {
  8362. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  8363. } else {
  8364. return { done: true };
  8365. }
  8366. }
  8367. };
  8368. };
  8369. return res;
  8370. }
  8371. const getModelModifiers = (props, modelName) => {
  8372. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  8373. };
  8374. function emit(instance, event, ...rawArgs) {
  8375. if (instance.isUnmounted) return;
  8376. const props = instance.vnode.props || EMPTY_OBJ;
  8377. {
  8378. const {
  8379. emitsOptions,
  8380. propsOptions: [propsOptions]
  8381. } = instance;
  8382. if (emitsOptions) {
  8383. if (!(event in emitsOptions) && true) {
  8384. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  8385. warn$1(
  8386. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  8387. );
  8388. }
  8389. } else {
  8390. const validator = emitsOptions[event];
  8391. if (isFunction(validator)) {
  8392. const isValid = validator(...rawArgs);
  8393. if (!isValid) {
  8394. warn$1(
  8395. `Invalid event arguments: event validation failed for event "${event}".`
  8396. );
  8397. }
  8398. }
  8399. }
  8400. }
  8401. }
  8402. let args = rawArgs;
  8403. const isModelListener = event.startsWith("update:");
  8404. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  8405. if (modifiers) {
  8406. if (modifiers.trim) {
  8407. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  8408. }
  8409. if (modifiers.number) {
  8410. args = rawArgs.map(looseToNumber);
  8411. }
  8412. }
  8413. {
  8414. devtoolsComponentEmit(instance, event, args);
  8415. }
  8416. {
  8417. const lowerCaseEvent = event.toLowerCase();
  8418. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  8419. warn$1(
  8420. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  8421. instance,
  8422. instance.type
  8423. )} 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(
  8424. event
  8425. )}" instead of "${event}".`
  8426. );
  8427. }
  8428. }
  8429. let handlerName;
  8430. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  8431. props[handlerName = toHandlerKey(camelize(event))];
  8432. if (!handler && isModelListener) {
  8433. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  8434. }
  8435. if (handler) {
  8436. callWithAsyncErrorHandling(
  8437. handler,
  8438. instance,
  8439. 6,
  8440. args
  8441. );
  8442. }
  8443. const onceHandler = props[handlerName + `Once`];
  8444. if (onceHandler) {
  8445. if (!instance.emitted) {
  8446. instance.emitted = {};
  8447. } else if (instance.emitted[handlerName]) {
  8448. return;
  8449. }
  8450. instance.emitted[handlerName] = true;
  8451. callWithAsyncErrorHandling(
  8452. onceHandler,
  8453. instance,
  8454. 6,
  8455. args
  8456. );
  8457. }
  8458. }
  8459. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  8460. const cache = appContext.emitsCache;
  8461. const cached = cache.get(comp);
  8462. if (cached !== void 0) {
  8463. return cached;
  8464. }
  8465. const raw = comp.emits;
  8466. let normalized = {};
  8467. let hasExtends = false;
  8468. if (!isFunction(comp)) {
  8469. const extendEmits = (raw2) => {
  8470. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  8471. if (normalizedFromExtend) {
  8472. hasExtends = true;
  8473. extend(normalized, normalizedFromExtend);
  8474. }
  8475. };
  8476. if (!asMixin && appContext.mixins.length) {
  8477. appContext.mixins.forEach(extendEmits);
  8478. }
  8479. if (comp.extends) {
  8480. extendEmits(comp.extends);
  8481. }
  8482. if (comp.mixins) {
  8483. comp.mixins.forEach(extendEmits);
  8484. }
  8485. }
  8486. if (!raw && !hasExtends) {
  8487. if (isObject(comp)) {
  8488. cache.set(comp, null);
  8489. }
  8490. return null;
  8491. }
  8492. if (isArray(raw)) {
  8493. raw.forEach((key) => normalized[key] = null);
  8494. } else {
  8495. extend(normalized, raw);
  8496. }
  8497. if (isObject(comp)) {
  8498. cache.set(comp, normalized);
  8499. }
  8500. return normalized;
  8501. }
  8502. function isEmitListener(options, key) {
  8503. if (!options || !isOn(key)) {
  8504. return false;
  8505. }
  8506. key = key.slice(2).replace(/Once$/, "");
  8507. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  8508. }
  8509. let accessedAttrs = false;
  8510. function markAttrsAccessed() {
  8511. accessedAttrs = true;
  8512. }
  8513. function renderComponentRoot(instance) {
  8514. const {
  8515. type: Component,
  8516. vnode,
  8517. proxy,
  8518. withProxy,
  8519. propsOptions: [propsOptions],
  8520. slots,
  8521. attrs,
  8522. emit,
  8523. render,
  8524. renderCache,
  8525. props,
  8526. data,
  8527. setupState,
  8528. ctx,
  8529. inheritAttrs
  8530. } = instance;
  8531. const prev = setCurrentRenderingInstance(instance);
  8532. let result;
  8533. let fallthroughAttrs;
  8534. {
  8535. accessedAttrs = false;
  8536. }
  8537. try {
  8538. if (vnode.shapeFlag & 4) {
  8539. const proxyToUse = withProxy || proxy;
  8540. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  8541. get(target, key, receiver) {
  8542. warn$1(
  8543. `Property '${String(
  8544. key
  8545. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  8546. );
  8547. return Reflect.get(target, key, receiver);
  8548. }
  8549. }) : proxyToUse;
  8550. result = normalizeVNode(
  8551. render.call(
  8552. thisProxy,
  8553. proxyToUse,
  8554. renderCache,
  8555. true ? shallowReadonly(props) : props,
  8556. setupState,
  8557. data,
  8558. ctx
  8559. )
  8560. );
  8561. fallthroughAttrs = attrs;
  8562. } else {
  8563. const render2 = Component;
  8564. if (attrs === props) {
  8565. markAttrsAccessed();
  8566. }
  8567. result = normalizeVNode(
  8568. render2.length > 1 ? render2(
  8569. true ? shallowReadonly(props) : props,
  8570. true ? {
  8571. get attrs() {
  8572. markAttrsAccessed();
  8573. return shallowReadonly(attrs);
  8574. },
  8575. slots,
  8576. emit
  8577. } : { attrs, slots, emit }
  8578. ) : render2(
  8579. true ? shallowReadonly(props) : props,
  8580. null
  8581. )
  8582. );
  8583. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  8584. }
  8585. } catch (err) {
  8586. blockStack.length = 0;
  8587. handleError(err, instance, 1);
  8588. result = createVNode(Comment);
  8589. }
  8590. let root = result;
  8591. let setRoot = void 0;
  8592. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  8593. [root, setRoot] = getChildRoot(result);
  8594. }
  8595. if (fallthroughAttrs && inheritAttrs !== false) {
  8596. const keys = Object.keys(fallthroughAttrs);
  8597. const { shapeFlag } = root;
  8598. if (keys.length) {
  8599. if (shapeFlag & (1 | 6)) {
  8600. if (propsOptions && keys.some(isModelListener)) {
  8601. fallthroughAttrs = filterModelListeners(
  8602. fallthroughAttrs,
  8603. propsOptions
  8604. );
  8605. }
  8606. root = cloneVNode(root, fallthroughAttrs, false, true);
  8607. } else if (!accessedAttrs && root.type !== Comment) {
  8608. const allAttrs = Object.keys(attrs);
  8609. const eventAttrs = [];
  8610. const extraAttrs = [];
  8611. for (let i = 0, l = allAttrs.length; i < l; i++) {
  8612. const key = allAttrs[i];
  8613. if (isOn(key)) {
  8614. if (!isModelListener(key)) {
  8615. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  8616. }
  8617. } else {
  8618. extraAttrs.push(key);
  8619. }
  8620. }
  8621. if (extraAttrs.length) {
  8622. warn$1(
  8623. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  8624. );
  8625. }
  8626. if (eventAttrs.length) {
  8627. warn$1(
  8628. `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.`
  8629. );
  8630. }
  8631. }
  8632. }
  8633. }
  8634. if (vnode.dirs) {
  8635. if (!isElementRoot(root)) {
  8636. warn$1(
  8637. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  8638. );
  8639. }
  8640. root = cloneVNode(root, null, false, true);
  8641. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  8642. }
  8643. if (vnode.transition) {
  8644. if (!isElementRoot(root)) {
  8645. warn$1(
  8646. `Component inside <Transition> renders non-element root node that cannot be animated.`
  8647. );
  8648. }
  8649. setTransitionHooks(root, vnode.transition);
  8650. }
  8651. if (setRoot) {
  8652. setRoot(root);
  8653. } else {
  8654. result = root;
  8655. }
  8656. setCurrentRenderingInstance(prev);
  8657. return result;
  8658. }
  8659. const getChildRoot = (vnode) => {
  8660. const rawChildren = vnode.children;
  8661. const dynamicChildren = vnode.dynamicChildren;
  8662. const childRoot = filterSingleRoot(rawChildren, false);
  8663. if (!childRoot) {
  8664. return [vnode, void 0];
  8665. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  8666. return getChildRoot(childRoot);
  8667. }
  8668. const index = rawChildren.indexOf(childRoot);
  8669. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  8670. const setRoot = (updatedRoot) => {
  8671. rawChildren[index] = updatedRoot;
  8672. if (dynamicChildren) {
  8673. if (dynamicIndex > -1) {
  8674. dynamicChildren[dynamicIndex] = updatedRoot;
  8675. } else if (updatedRoot.patchFlag > 0) {
  8676. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  8677. }
  8678. }
  8679. };
  8680. return [normalizeVNode(childRoot), setRoot];
  8681. };
  8682. function filterSingleRoot(children, recurse = true) {
  8683. let singleRoot;
  8684. for (let i = 0; i < children.length; i++) {
  8685. const child = children[i];
  8686. if (isVNode(child)) {
  8687. if (child.type !== Comment || child.children === "v-if") {
  8688. if (singleRoot) {
  8689. return;
  8690. } else {
  8691. singleRoot = child;
  8692. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  8693. return filterSingleRoot(singleRoot.children);
  8694. }
  8695. }
  8696. }
  8697. } else {
  8698. return;
  8699. }
  8700. }
  8701. return singleRoot;
  8702. }
  8703. const getFunctionalFallthrough = (attrs) => {
  8704. let res;
  8705. for (const key in attrs) {
  8706. if (key === "class" || key === "style" || isOn(key)) {
  8707. (res || (res = {}))[key] = attrs[key];
  8708. }
  8709. }
  8710. return res;
  8711. };
  8712. const filterModelListeners = (attrs, props) => {
  8713. const res = {};
  8714. for (const key in attrs) {
  8715. if (!isModelListener(key) || !(key.slice(9) in props)) {
  8716. res[key] = attrs[key];
  8717. }
  8718. }
  8719. return res;
  8720. };
  8721. const isElementRoot = (vnode) => {
  8722. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  8723. };
  8724. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  8725. const { props: prevProps, children: prevChildren, component } = prevVNode;
  8726. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  8727. const emits = component.emitsOptions;
  8728. if ((prevChildren || nextChildren) && isHmrUpdating) {
  8729. return true;
  8730. }
  8731. if (nextVNode.dirs || nextVNode.transition) {
  8732. return true;
  8733. }
  8734. if (optimized && patchFlag >= 0) {
  8735. if (patchFlag & 1024) {
  8736. return true;
  8737. }
  8738. if (patchFlag & 16) {
  8739. if (!prevProps) {
  8740. return !!nextProps;
  8741. }
  8742. return hasPropsChanged(prevProps, nextProps, emits);
  8743. } else if (patchFlag & 8) {
  8744. const dynamicProps = nextVNode.dynamicProps;
  8745. for (let i = 0; i < dynamicProps.length; i++) {
  8746. const key = dynamicProps[i];
  8747. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  8748. return true;
  8749. }
  8750. }
  8751. }
  8752. } else {
  8753. if (prevChildren || nextChildren) {
  8754. if (!nextChildren || !nextChildren.$stable) {
  8755. return true;
  8756. }
  8757. }
  8758. if (prevProps === nextProps) {
  8759. return false;
  8760. }
  8761. if (!prevProps) {
  8762. return !!nextProps;
  8763. }
  8764. if (!nextProps) {
  8765. return true;
  8766. }
  8767. return hasPropsChanged(prevProps, nextProps, emits);
  8768. }
  8769. return false;
  8770. }
  8771. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  8772. const nextKeys = Object.keys(nextProps);
  8773. if (nextKeys.length !== Object.keys(prevProps).length) {
  8774. return true;
  8775. }
  8776. for (let i = 0; i < nextKeys.length; i++) {
  8777. const key = nextKeys[i];
  8778. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  8779. return true;
  8780. }
  8781. }
  8782. return false;
  8783. }
  8784. function updateHOCHostEl({ vnode, parent }, el) {
  8785. while (parent) {
  8786. const root = parent.subTree;
  8787. if (root.suspense && root.suspense.activeBranch === vnode) {
  8788. root.el = vnode.el;
  8789. }
  8790. if (root === vnode) {
  8791. (vnode = parent.vnode).el = el;
  8792. parent = parent.parent;
  8793. } else {
  8794. break;
  8795. }
  8796. }
  8797. }
  8798. const isSuspense = (type) => type.__isSuspense;
  8799. let suspenseId = 0;
  8800. const SuspenseImpl = {
  8801. name: "Suspense",
  8802. // In order to make Suspense tree-shakable, we need to avoid importing it
  8803. // directly in the renderer. The renderer checks for the __isSuspense flag
  8804. // on a vnode's type and calls the `process` method, passing in renderer
  8805. // internals.
  8806. __isSuspense: true,
  8807. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8808. if (n1 == null) {
  8809. mountSuspense(
  8810. n2,
  8811. container,
  8812. anchor,
  8813. parentComponent,
  8814. parentSuspense,
  8815. namespace,
  8816. slotScopeIds,
  8817. optimized,
  8818. rendererInternals
  8819. );
  8820. } else {
  8821. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  8822. n2.suspense = n1.suspense;
  8823. n2.suspense.vnode = n2;
  8824. n2.el = n1.el;
  8825. return;
  8826. }
  8827. patchSuspense(
  8828. n1,
  8829. n2,
  8830. container,
  8831. anchor,
  8832. parentComponent,
  8833. namespace,
  8834. slotScopeIds,
  8835. optimized,
  8836. rendererInternals
  8837. );
  8838. }
  8839. },
  8840. hydrate: hydrateSuspense,
  8841. normalize: normalizeSuspenseChildren
  8842. };
  8843. const Suspense = SuspenseImpl ;
  8844. function triggerEvent(vnode, name) {
  8845. const eventListener = vnode.props && vnode.props[name];
  8846. if (isFunction(eventListener)) {
  8847. eventListener();
  8848. }
  8849. }
  8850. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  8851. const {
  8852. p: patch,
  8853. o: { createElement }
  8854. } = rendererInternals;
  8855. const hiddenContainer = createElement("div");
  8856. const suspense = vnode.suspense = createSuspenseBoundary(
  8857. vnode,
  8858. parentSuspense,
  8859. parentComponent,
  8860. container,
  8861. hiddenContainer,
  8862. anchor,
  8863. namespace,
  8864. slotScopeIds,
  8865. optimized,
  8866. rendererInternals
  8867. );
  8868. patch(
  8869. null,
  8870. suspense.pendingBranch = vnode.ssContent,
  8871. hiddenContainer,
  8872. null,
  8873. parentComponent,
  8874. suspense,
  8875. namespace,
  8876. slotScopeIds
  8877. );
  8878. if (suspense.deps > 0) {
  8879. triggerEvent(vnode, "onPending");
  8880. triggerEvent(vnode, "onFallback");
  8881. patch(
  8882. null,
  8883. vnode.ssFallback,
  8884. container,
  8885. anchor,
  8886. parentComponent,
  8887. null,
  8888. // fallback tree will not have suspense context
  8889. namespace,
  8890. slotScopeIds
  8891. );
  8892. setActiveBranch(suspense, vnode.ssFallback);
  8893. } else {
  8894. suspense.resolve(false, true);
  8895. }
  8896. }
  8897. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  8898. const suspense = n2.suspense = n1.suspense;
  8899. suspense.vnode = n2;
  8900. n2.el = n1.el;
  8901. const newBranch = n2.ssContent;
  8902. const newFallback = n2.ssFallback;
  8903. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  8904. if (pendingBranch) {
  8905. suspense.pendingBranch = newBranch;
  8906. if (isSameVNodeType(newBranch, pendingBranch)) {
  8907. patch(
  8908. pendingBranch,
  8909. newBranch,
  8910. suspense.hiddenContainer,
  8911. null,
  8912. parentComponent,
  8913. suspense,
  8914. namespace,
  8915. slotScopeIds,
  8916. optimized
  8917. );
  8918. if (suspense.deps <= 0) {
  8919. suspense.resolve();
  8920. } else if (isInFallback) {
  8921. if (!isHydrating) {
  8922. patch(
  8923. activeBranch,
  8924. newFallback,
  8925. container,
  8926. anchor,
  8927. parentComponent,
  8928. null,
  8929. // fallback tree will not have suspense context
  8930. namespace,
  8931. slotScopeIds,
  8932. optimized
  8933. );
  8934. setActiveBranch(suspense, newFallback);
  8935. }
  8936. }
  8937. } else {
  8938. suspense.pendingId = suspenseId++;
  8939. if (isHydrating) {
  8940. suspense.isHydrating = false;
  8941. suspense.activeBranch = pendingBranch;
  8942. } else {
  8943. unmount(pendingBranch, parentComponent, suspense);
  8944. }
  8945. suspense.deps = 0;
  8946. suspense.effects.length = 0;
  8947. suspense.hiddenContainer = createElement("div");
  8948. if (isInFallback) {
  8949. patch(
  8950. null,
  8951. newBranch,
  8952. suspense.hiddenContainer,
  8953. null,
  8954. parentComponent,
  8955. suspense,
  8956. namespace,
  8957. slotScopeIds,
  8958. optimized
  8959. );
  8960. if (suspense.deps <= 0) {
  8961. suspense.resolve();
  8962. } else {
  8963. patch(
  8964. activeBranch,
  8965. newFallback,
  8966. container,
  8967. anchor,
  8968. parentComponent,
  8969. null,
  8970. // fallback tree will not have suspense context
  8971. namespace,
  8972. slotScopeIds,
  8973. optimized
  8974. );
  8975. setActiveBranch(suspense, newFallback);
  8976. }
  8977. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  8978. patch(
  8979. activeBranch,
  8980. newBranch,
  8981. container,
  8982. anchor,
  8983. parentComponent,
  8984. suspense,
  8985. namespace,
  8986. slotScopeIds,
  8987. optimized
  8988. );
  8989. suspense.resolve(true);
  8990. } else {
  8991. patch(
  8992. null,
  8993. newBranch,
  8994. suspense.hiddenContainer,
  8995. null,
  8996. parentComponent,
  8997. suspense,
  8998. namespace,
  8999. slotScopeIds,
  9000. optimized
  9001. );
  9002. if (suspense.deps <= 0) {
  9003. suspense.resolve();
  9004. }
  9005. }
  9006. }
  9007. } else {
  9008. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  9009. patch(
  9010. activeBranch,
  9011. newBranch,
  9012. container,
  9013. anchor,
  9014. parentComponent,
  9015. suspense,
  9016. namespace,
  9017. slotScopeIds,
  9018. optimized
  9019. );
  9020. setActiveBranch(suspense, newBranch);
  9021. } else {
  9022. triggerEvent(n2, "onPending");
  9023. suspense.pendingBranch = newBranch;
  9024. if (newBranch.shapeFlag & 512) {
  9025. suspense.pendingId = newBranch.component.suspenseId;
  9026. } else {
  9027. suspense.pendingId = suspenseId++;
  9028. }
  9029. patch(
  9030. null,
  9031. newBranch,
  9032. suspense.hiddenContainer,
  9033. null,
  9034. parentComponent,
  9035. suspense,
  9036. namespace,
  9037. slotScopeIds,
  9038. optimized
  9039. );
  9040. if (suspense.deps <= 0) {
  9041. suspense.resolve();
  9042. } else {
  9043. const { timeout, pendingId } = suspense;
  9044. if (timeout > 0) {
  9045. setTimeout(() => {
  9046. if (suspense.pendingId === pendingId) {
  9047. suspense.fallback(newFallback);
  9048. }
  9049. }, timeout);
  9050. } else if (timeout === 0) {
  9051. suspense.fallback(newFallback);
  9052. }
  9053. }
  9054. }
  9055. }
  9056. }
  9057. let hasWarned = false;
  9058. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  9059. if (!hasWarned) {
  9060. hasWarned = true;
  9061. console[console.info ? "info" : "log"](
  9062. `<Suspense> is an experimental feature and its API will likely change.`
  9063. );
  9064. }
  9065. const {
  9066. p: patch,
  9067. m: move,
  9068. um: unmount,
  9069. n: next,
  9070. o: { parentNode, remove }
  9071. } = rendererInternals;
  9072. let parentSuspenseId;
  9073. const isSuspensible = isVNodeSuspensible(vnode);
  9074. if (isSuspensible) {
  9075. if (parentSuspense && parentSuspense.pendingBranch) {
  9076. parentSuspenseId = parentSuspense.pendingId;
  9077. parentSuspense.deps++;
  9078. }
  9079. }
  9080. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  9081. {
  9082. assertNumber(timeout, `Suspense timeout`);
  9083. }
  9084. const initialAnchor = anchor;
  9085. const suspense = {
  9086. vnode,
  9087. parent: parentSuspense,
  9088. parentComponent,
  9089. namespace,
  9090. container,
  9091. hiddenContainer,
  9092. deps: 0,
  9093. pendingId: suspenseId++,
  9094. timeout: typeof timeout === "number" ? timeout : -1,
  9095. activeBranch: null,
  9096. pendingBranch: null,
  9097. isInFallback: !isHydrating,
  9098. isHydrating,
  9099. isUnmounted: false,
  9100. effects: [],
  9101. resolve(resume = false, sync = false) {
  9102. {
  9103. if (!resume && !suspense.pendingBranch) {
  9104. throw new Error(
  9105. `suspense.resolve() is called without a pending branch.`
  9106. );
  9107. }
  9108. if (suspense.isUnmounted) {
  9109. throw new Error(
  9110. `suspense.resolve() is called on an already unmounted suspense boundary.`
  9111. );
  9112. }
  9113. }
  9114. const {
  9115. vnode: vnode2,
  9116. activeBranch,
  9117. pendingBranch,
  9118. pendingId,
  9119. effects,
  9120. parentComponent: parentComponent2,
  9121. container: container2
  9122. } = suspense;
  9123. let delayEnter = false;
  9124. if (suspense.isHydrating) {
  9125. suspense.isHydrating = false;
  9126. } else if (!resume) {
  9127. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  9128. if (delayEnter) {
  9129. activeBranch.transition.afterLeave = () => {
  9130. if (pendingId === suspense.pendingId) {
  9131. move(
  9132. pendingBranch,
  9133. container2,
  9134. anchor === initialAnchor ? next(activeBranch) : anchor,
  9135. 0
  9136. );
  9137. queuePostFlushCb(effects);
  9138. }
  9139. };
  9140. }
  9141. if (activeBranch) {
  9142. if (parentNode(activeBranch.el) === container2) {
  9143. anchor = next(activeBranch);
  9144. }
  9145. unmount(activeBranch, parentComponent2, suspense, true);
  9146. }
  9147. if (!delayEnter) {
  9148. move(pendingBranch, container2, anchor, 0);
  9149. }
  9150. }
  9151. setActiveBranch(suspense, pendingBranch);
  9152. suspense.pendingBranch = null;
  9153. suspense.isInFallback = false;
  9154. let parent = suspense.parent;
  9155. let hasUnresolvedAncestor = false;
  9156. while (parent) {
  9157. if (parent.pendingBranch) {
  9158. parent.effects.push(...effects);
  9159. hasUnresolvedAncestor = true;
  9160. break;
  9161. }
  9162. parent = parent.parent;
  9163. }
  9164. if (!hasUnresolvedAncestor && !delayEnter) {
  9165. queuePostFlushCb(effects);
  9166. }
  9167. suspense.effects = [];
  9168. if (isSuspensible) {
  9169. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  9170. parentSuspense.deps--;
  9171. if (parentSuspense.deps === 0 && !sync) {
  9172. parentSuspense.resolve();
  9173. }
  9174. }
  9175. }
  9176. triggerEvent(vnode2, "onResolve");
  9177. },
  9178. fallback(fallbackVNode) {
  9179. if (!suspense.pendingBranch) {
  9180. return;
  9181. }
  9182. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  9183. triggerEvent(vnode2, "onFallback");
  9184. const anchor2 = next(activeBranch);
  9185. const mountFallback = () => {
  9186. if (!suspense.isInFallback) {
  9187. return;
  9188. }
  9189. patch(
  9190. null,
  9191. fallbackVNode,
  9192. container2,
  9193. anchor2,
  9194. parentComponent2,
  9195. null,
  9196. // fallback tree will not have suspense context
  9197. namespace2,
  9198. slotScopeIds,
  9199. optimized
  9200. );
  9201. setActiveBranch(suspense, fallbackVNode);
  9202. };
  9203. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  9204. if (delayEnter) {
  9205. activeBranch.transition.afterLeave = mountFallback;
  9206. }
  9207. suspense.isInFallback = true;
  9208. unmount(
  9209. activeBranch,
  9210. parentComponent2,
  9211. null,
  9212. // no suspense so unmount hooks fire now
  9213. true
  9214. // shouldRemove
  9215. );
  9216. if (!delayEnter) {
  9217. mountFallback();
  9218. }
  9219. },
  9220. move(container2, anchor2, type) {
  9221. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  9222. suspense.container = container2;
  9223. },
  9224. next() {
  9225. return suspense.activeBranch && next(suspense.activeBranch);
  9226. },
  9227. registerDep(instance, setupRenderEffect, optimized2) {
  9228. const isInPendingSuspense = !!suspense.pendingBranch;
  9229. if (isInPendingSuspense) {
  9230. suspense.deps++;
  9231. }
  9232. const hydratedEl = instance.vnode.el;
  9233. instance.asyncDep.catch((err) => {
  9234. handleError(err, instance, 0);
  9235. }).then((asyncSetupResult) => {
  9236. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  9237. return;
  9238. }
  9239. instance.asyncResolved = true;
  9240. const { vnode: vnode2 } = instance;
  9241. {
  9242. pushWarningContext(vnode2);
  9243. }
  9244. handleSetupResult(instance, asyncSetupResult, false);
  9245. if (hydratedEl) {
  9246. vnode2.el = hydratedEl;
  9247. }
  9248. const placeholder = !hydratedEl && instance.subTree.el;
  9249. setupRenderEffect(
  9250. instance,
  9251. vnode2,
  9252. // component may have been moved before resolve.
  9253. // if this is not a hydration, instance.subTree will be the comment
  9254. // placeholder.
  9255. parentNode(hydratedEl || instance.subTree.el),
  9256. // anchor will not be used if this is hydration, so only need to
  9257. // consider the comment placeholder case.
  9258. hydratedEl ? null : next(instance.subTree),
  9259. suspense,
  9260. namespace,
  9261. optimized2
  9262. );
  9263. if (placeholder) {
  9264. remove(placeholder);
  9265. }
  9266. updateHOCHostEl(instance, vnode2.el);
  9267. {
  9268. popWarningContext();
  9269. }
  9270. if (isInPendingSuspense && --suspense.deps === 0) {
  9271. suspense.resolve();
  9272. }
  9273. });
  9274. },
  9275. unmount(parentSuspense2, doRemove) {
  9276. suspense.isUnmounted = true;
  9277. if (suspense.activeBranch) {
  9278. unmount(
  9279. suspense.activeBranch,
  9280. parentComponent,
  9281. parentSuspense2,
  9282. doRemove
  9283. );
  9284. }
  9285. if (suspense.pendingBranch) {
  9286. unmount(
  9287. suspense.pendingBranch,
  9288. parentComponent,
  9289. parentSuspense2,
  9290. doRemove
  9291. );
  9292. }
  9293. }
  9294. };
  9295. return suspense;
  9296. }
  9297. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  9298. const suspense = vnode.suspense = createSuspenseBoundary(
  9299. vnode,
  9300. parentSuspense,
  9301. parentComponent,
  9302. node.parentNode,
  9303. // eslint-disable-next-line no-restricted-globals
  9304. document.createElement("div"),
  9305. null,
  9306. namespace,
  9307. slotScopeIds,
  9308. optimized,
  9309. rendererInternals,
  9310. true
  9311. );
  9312. const result = hydrateNode(
  9313. node,
  9314. suspense.pendingBranch = vnode.ssContent,
  9315. parentComponent,
  9316. suspense,
  9317. slotScopeIds,
  9318. optimized
  9319. );
  9320. if (suspense.deps === 0) {
  9321. suspense.resolve(false, true);
  9322. }
  9323. return result;
  9324. }
  9325. function normalizeSuspenseChildren(vnode) {
  9326. const { shapeFlag, children } = vnode;
  9327. const isSlotChildren = shapeFlag & 32;
  9328. vnode.ssContent = normalizeSuspenseSlot(
  9329. isSlotChildren ? children.default : children
  9330. );
  9331. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  9332. }
  9333. function normalizeSuspenseSlot(s) {
  9334. let block;
  9335. if (isFunction(s)) {
  9336. const trackBlock = isBlockTreeEnabled && s._c;
  9337. if (trackBlock) {
  9338. s._d = false;
  9339. openBlock();
  9340. }
  9341. s = s();
  9342. if (trackBlock) {
  9343. s._d = true;
  9344. block = currentBlock;
  9345. closeBlock();
  9346. }
  9347. }
  9348. if (isArray(s)) {
  9349. const singleChild = filterSingleRoot(s);
  9350. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  9351. warn$1(`<Suspense> slots expect a single root node.`);
  9352. }
  9353. s = singleChild;
  9354. }
  9355. s = normalizeVNode(s);
  9356. if (block && !s.dynamicChildren) {
  9357. s.dynamicChildren = block.filter((c) => c !== s);
  9358. }
  9359. return s;
  9360. }
  9361. function queueEffectWithSuspense(fn, suspense) {
  9362. if (suspense && suspense.pendingBranch) {
  9363. if (isArray(fn)) {
  9364. suspense.effects.push(...fn);
  9365. } else {
  9366. suspense.effects.push(fn);
  9367. }
  9368. } else {
  9369. queuePostFlushCb(fn);
  9370. }
  9371. }
  9372. function setActiveBranch(suspense, branch) {
  9373. suspense.activeBranch = branch;
  9374. const { vnode, parentComponent } = suspense;
  9375. let el = branch.el;
  9376. while (!el && branch.component) {
  9377. branch = branch.component.subTree;
  9378. el = branch.el;
  9379. }
  9380. vnode.el = el;
  9381. if (parentComponent && parentComponent.subTree === vnode) {
  9382. parentComponent.vnode.el = el;
  9383. updateHOCHostEl(parentComponent, el);
  9384. }
  9385. }
  9386. function isVNodeSuspensible(vnode) {
  9387. const suspensible = vnode.props && vnode.props.suspensible;
  9388. return suspensible != null && suspensible !== false;
  9389. }
  9390. const Fragment = Symbol.for("v-fgt");
  9391. const Text = Symbol.for("v-txt");
  9392. const Comment = Symbol.for("v-cmt");
  9393. const Static = Symbol.for("v-stc");
  9394. const blockStack = [];
  9395. let currentBlock = null;
  9396. function openBlock(disableTracking = false) {
  9397. blockStack.push(currentBlock = disableTracking ? null : []);
  9398. }
  9399. function closeBlock() {
  9400. blockStack.pop();
  9401. currentBlock = blockStack[blockStack.length - 1] || null;
  9402. }
  9403. let isBlockTreeEnabled = 1;
  9404. function setBlockTracking(value) {
  9405. isBlockTreeEnabled += value;
  9406. if (value < 0 && currentBlock) {
  9407. currentBlock.hasOnce = true;
  9408. }
  9409. }
  9410. function setupBlock(vnode) {
  9411. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  9412. closeBlock();
  9413. if (isBlockTreeEnabled > 0 && currentBlock) {
  9414. currentBlock.push(vnode);
  9415. }
  9416. return vnode;
  9417. }
  9418. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  9419. return setupBlock(
  9420. createBaseVNode(
  9421. type,
  9422. props,
  9423. children,
  9424. patchFlag,
  9425. dynamicProps,
  9426. shapeFlag,
  9427. true
  9428. )
  9429. );
  9430. }
  9431. function createBlock(type, props, children, patchFlag, dynamicProps) {
  9432. return setupBlock(
  9433. createVNode(
  9434. type,
  9435. props,
  9436. children,
  9437. patchFlag,
  9438. dynamicProps,
  9439. true
  9440. )
  9441. );
  9442. }
  9443. function isVNode(value) {
  9444. return value ? value.__v_isVNode === true : false;
  9445. }
  9446. function isSameVNodeType(n1, n2) {
  9447. if (n2.shapeFlag & 6 && n1.component) {
  9448. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  9449. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  9450. n1.shapeFlag &= ~256;
  9451. n2.shapeFlag &= ~512;
  9452. return false;
  9453. }
  9454. }
  9455. return n1.type === n2.type && n1.key === n2.key;
  9456. }
  9457. let vnodeArgsTransformer;
  9458. function transformVNodeArgs(transformer) {
  9459. vnodeArgsTransformer = transformer;
  9460. }
  9461. const createVNodeWithArgsTransform = (...args) => {
  9462. return _createVNode(
  9463. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  9464. );
  9465. };
  9466. const normalizeKey = ({ key }) => key != null ? key : null;
  9467. const normalizeRef = ({
  9468. ref,
  9469. ref_key,
  9470. ref_for
  9471. }) => {
  9472. if (typeof ref === "number") {
  9473. ref = "" + ref;
  9474. }
  9475. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  9476. };
  9477. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  9478. const vnode = {
  9479. __v_isVNode: true,
  9480. __v_skip: true,
  9481. type,
  9482. props,
  9483. key: props && normalizeKey(props),
  9484. ref: props && normalizeRef(props),
  9485. scopeId: currentScopeId,
  9486. slotScopeIds: null,
  9487. children,
  9488. component: null,
  9489. suspense: null,
  9490. ssContent: null,
  9491. ssFallback: null,
  9492. dirs: null,
  9493. transition: null,
  9494. el: null,
  9495. anchor: null,
  9496. target: null,
  9497. targetStart: null,
  9498. targetAnchor: null,
  9499. staticCount: 0,
  9500. shapeFlag,
  9501. patchFlag,
  9502. dynamicProps,
  9503. dynamicChildren: null,
  9504. appContext: null,
  9505. ctx: currentRenderingInstance
  9506. };
  9507. if (needFullChildrenNormalization) {
  9508. normalizeChildren(vnode, children);
  9509. if (shapeFlag & 128) {
  9510. type.normalize(vnode);
  9511. }
  9512. } else if (children) {
  9513. vnode.shapeFlag |= isString(children) ? 8 : 16;
  9514. }
  9515. if (vnode.key !== vnode.key) {
  9516. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  9517. }
  9518. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  9519. !isBlockNode && // has current parent block
  9520. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  9521. // component nodes also should always be patched, because even if the
  9522. // component doesn't need to update, it needs to persist the instance on to
  9523. // the next vnode so that it can be properly unmounted later.
  9524. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  9525. // vnode should not be considered dynamic due to handler caching.
  9526. vnode.patchFlag !== 32) {
  9527. currentBlock.push(vnode);
  9528. }
  9529. return vnode;
  9530. }
  9531. const createVNode = createVNodeWithArgsTransform ;
  9532. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  9533. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  9534. if (!type) {
  9535. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  9536. }
  9537. type = Comment;
  9538. }
  9539. if (isVNode(type)) {
  9540. const cloned = cloneVNode(
  9541. type,
  9542. props,
  9543. true
  9544. /* mergeRef: true */
  9545. );
  9546. if (children) {
  9547. normalizeChildren(cloned, children);
  9548. }
  9549. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  9550. if (cloned.shapeFlag & 6) {
  9551. currentBlock[currentBlock.indexOf(type)] = cloned;
  9552. } else {
  9553. currentBlock.push(cloned);
  9554. }
  9555. }
  9556. cloned.patchFlag = -2;
  9557. return cloned;
  9558. }
  9559. if (isClassComponent(type)) {
  9560. type = type.__vccOpts;
  9561. }
  9562. if (props) {
  9563. props = guardReactiveProps(props);
  9564. let { class: klass, style } = props;
  9565. if (klass && !isString(klass)) {
  9566. props.class = normalizeClass(klass);
  9567. }
  9568. if (isObject(style)) {
  9569. if (isProxy(style) && !isArray(style)) {
  9570. style = extend({}, style);
  9571. }
  9572. props.style = normalizeStyle(style);
  9573. }
  9574. }
  9575. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  9576. if (shapeFlag & 4 && isProxy(type)) {
  9577. type = toRaw(type);
  9578. warn$1(
  9579. `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\`.`,
  9580. `
  9581. Component that was made reactive: `,
  9582. type
  9583. );
  9584. }
  9585. return createBaseVNode(
  9586. type,
  9587. props,
  9588. children,
  9589. patchFlag,
  9590. dynamicProps,
  9591. shapeFlag,
  9592. isBlockNode,
  9593. true
  9594. );
  9595. }
  9596. function guardReactiveProps(props) {
  9597. if (!props) return null;
  9598. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  9599. }
  9600. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  9601. const { props, ref, patchFlag, children, transition } = vnode;
  9602. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  9603. const cloned = {
  9604. __v_isVNode: true,
  9605. __v_skip: true,
  9606. type: vnode.type,
  9607. props: mergedProps,
  9608. key: mergedProps && normalizeKey(mergedProps),
  9609. ref: extraProps && extraProps.ref ? (
  9610. // #2078 in the case of <component :is="vnode" ref="extra"/>
  9611. // if the vnode itself already has a ref, cloneVNode will need to merge
  9612. // the refs so the single vnode can be set on multiple refs
  9613. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  9614. ) : ref,
  9615. scopeId: vnode.scopeId,
  9616. slotScopeIds: vnode.slotScopeIds,
  9617. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  9618. target: vnode.target,
  9619. targetStart: vnode.targetStart,
  9620. targetAnchor: vnode.targetAnchor,
  9621. staticCount: vnode.staticCount,
  9622. shapeFlag: vnode.shapeFlag,
  9623. // if the vnode is cloned with extra props, we can no longer assume its
  9624. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  9625. // note: preserve flag for fragments since they use the flag for children
  9626. // fast paths only.
  9627. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  9628. dynamicProps: vnode.dynamicProps,
  9629. dynamicChildren: vnode.dynamicChildren,
  9630. appContext: vnode.appContext,
  9631. dirs: vnode.dirs,
  9632. transition,
  9633. // These should technically only be non-null on mounted VNodes. However,
  9634. // they *should* be copied for kept-alive vnodes. So we just always copy
  9635. // them since them being non-null during a mount doesn't affect the logic as
  9636. // they will simply be overwritten.
  9637. component: vnode.component,
  9638. suspense: vnode.suspense,
  9639. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  9640. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  9641. el: vnode.el,
  9642. anchor: vnode.anchor,
  9643. ctx: vnode.ctx,
  9644. ce: vnode.ce
  9645. };
  9646. if (transition && cloneTransition) {
  9647. setTransitionHooks(
  9648. cloned,
  9649. transition.clone(cloned)
  9650. );
  9651. }
  9652. return cloned;
  9653. }
  9654. function deepCloneVNode(vnode) {
  9655. const cloned = cloneVNode(vnode);
  9656. if (isArray(vnode.children)) {
  9657. cloned.children = vnode.children.map(deepCloneVNode);
  9658. }
  9659. return cloned;
  9660. }
  9661. function createTextVNode(text = " ", flag = 0) {
  9662. return createVNode(Text, null, text, flag);
  9663. }
  9664. function createStaticVNode(content, numberOfNodes) {
  9665. const vnode = createVNode(Static, null, content);
  9666. vnode.staticCount = numberOfNodes;
  9667. return vnode;
  9668. }
  9669. function createCommentVNode(text = "", asBlock = false) {
  9670. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  9671. }
  9672. function normalizeVNode(child) {
  9673. if (child == null || typeof child === "boolean") {
  9674. return createVNode(Comment);
  9675. } else if (isArray(child)) {
  9676. return createVNode(
  9677. Fragment,
  9678. null,
  9679. // #3666, avoid reference pollution when reusing vnode
  9680. child.slice()
  9681. );
  9682. } else if (isVNode(child)) {
  9683. return cloneIfMounted(child);
  9684. } else {
  9685. return createVNode(Text, null, String(child));
  9686. }
  9687. }
  9688. function cloneIfMounted(child) {
  9689. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  9690. }
  9691. function normalizeChildren(vnode, children) {
  9692. let type = 0;
  9693. const { shapeFlag } = vnode;
  9694. if (children == null) {
  9695. children = null;
  9696. } else if (isArray(children)) {
  9697. type = 16;
  9698. } else if (typeof children === "object") {
  9699. if (shapeFlag & (1 | 64)) {
  9700. const slot = children.default;
  9701. if (slot) {
  9702. slot._c && (slot._d = false);
  9703. normalizeChildren(vnode, slot());
  9704. slot._c && (slot._d = true);
  9705. }
  9706. return;
  9707. } else {
  9708. type = 32;
  9709. const slotFlag = children._;
  9710. if (!slotFlag && !isInternalObject(children)) {
  9711. children._ctx = currentRenderingInstance;
  9712. } else if (slotFlag === 3 && currentRenderingInstance) {
  9713. if (currentRenderingInstance.slots._ === 1) {
  9714. children._ = 1;
  9715. } else {
  9716. children._ = 2;
  9717. vnode.patchFlag |= 1024;
  9718. }
  9719. }
  9720. }
  9721. } else if (isFunction(children)) {
  9722. children = { default: children, _ctx: currentRenderingInstance };
  9723. type = 32;
  9724. } else {
  9725. children = String(children);
  9726. if (shapeFlag & 64) {
  9727. type = 16;
  9728. children = [createTextVNode(children)];
  9729. } else {
  9730. type = 8;
  9731. }
  9732. }
  9733. vnode.children = children;
  9734. vnode.shapeFlag |= type;
  9735. }
  9736. function mergeProps(...args) {
  9737. const ret = {};
  9738. for (let i = 0; i < args.length; i++) {
  9739. const toMerge = args[i];
  9740. for (const key in toMerge) {
  9741. if (key === "class") {
  9742. if (ret.class !== toMerge.class) {
  9743. ret.class = normalizeClass([ret.class, toMerge.class]);
  9744. }
  9745. } else if (key === "style") {
  9746. ret.style = normalizeStyle([ret.style, toMerge.style]);
  9747. } else if (isOn(key)) {
  9748. const existing = ret[key];
  9749. const incoming = toMerge[key];
  9750. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  9751. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  9752. }
  9753. } else if (key !== "") {
  9754. ret[key] = toMerge[key];
  9755. }
  9756. }
  9757. }
  9758. return ret;
  9759. }
  9760. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  9761. callWithAsyncErrorHandling(hook, instance, 7, [
  9762. vnode,
  9763. prevVNode
  9764. ]);
  9765. }
  9766. const emptyAppContext = createAppContext();
  9767. let uid = 0;
  9768. function createComponentInstance(vnode, parent, suspense) {
  9769. const type = vnode.type;
  9770. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  9771. const instance = {
  9772. uid: uid++,
  9773. vnode,
  9774. type,
  9775. parent,
  9776. appContext,
  9777. root: null,
  9778. // to be immediately set
  9779. next: null,
  9780. subTree: null,
  9781. // will be set synchronously right after creation
  9782. effect: null,
  9783. update: null,
  9784. // will be set synchronously right after creation
  9785. job: null,
  9786. scope: new EffectScope(
  9787. true
  9788. /* detached */
  9789. ),
  9790. render: null,
  9791. proxy: null,
  9792. exposed: null,
  9793. exposeProxy: null,
  9794. withProxy: null,
  9795. provides: parent ? parent.provides : Object.create(appContext.provides),
  9796. ids: parent ? parent.ids : ["", 0, 0],
  9797. accessCache: null,
  9798. renderCache: [],
  9799. // local resolved assets
  9800. components: null,
  9801. directives: null,
  9802. // resolved props and emits options
  9803. propsOptions: normalizePropsOptions(type, appContext),
  9804. emitsOptions: normalizeEmitsOptions(type, appContext),
  9805. // emit
  9806. emit: null,
  9807. // to be set immediately
  9808. emitted: null,
  9809. // props default value
  9810. propsDefaults: EMPTY_OBJ,
  9811. // inheritAttrs
  9812. inheritAttrs: type.inheritAttrs,
  9813. // state
  9814. ctx: EMPTY_OBJ,
  9815. data: EMPTY_OBJ,
  9816. props: EMPTY_OBJ,
  9817. attrs: EMPTY_OBJ,
  9818. slots: EMPTY_OBJ,
  9819. refs: EMPTY_OBJ,
  9820. setupState: EMPTY_OBJ,
  9821. setupContext: null,
  9822. // suspense related
  9823. suspense,
  9824. suspenseId: suspense ? suspense.pendingId : 0,
  9825. asyncDep: null,
  9826. asyncResolved: false,
  9827. // lifecycle hooks
  9828. // not using enums here because it results in computed properties
  9829. isMounted: false,
  9830. isUnmounted: false,
  9831. isDeactivated: false,
  9832. bc: null,
  9833. c: null,
  9834. bm: null,
  9835. m: null,
  9836. bu: null,
  9837. u: null,
  9838. um: null,
  9839. bum: null,
  9840. da: null,
  9841. a: null,
  9842. rtg: null,
  9843. rtc: null,
  9844. ec: null,
  9845. sp: null
  9846. };
  9847. {
  9848. instance.ctx = createDevRenderContext(instance);
  9849. }
  9850. instance.root = parent ? parent.root : instance;
  9851. instance.emit = emit.bind(null, instance);
  9852. if (vnode.ce) {
  9853. vnode.ce(instance);
  9854. }
  9855. return instance;
  9856. }
  9857. let currentInstance = null;
  9858. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  9859. let internalSetCurrentInstance;
  9860. let setInSSRSetupState;
  9861. {
  9862. const g = getGlobalThis();
  9863. const registerGlobalSetter = (key, setter) => {
  9864. let setters;
  9865. if (!(setters = g[key])) setters = g[key] = [];
  9866. setters.push(setter);
  9867. return (v) => {
  9868. if (setters.length > 1) setters.forEach((set) => set(v));
  9869. else setters[0](v);
  9870. };
  9871. };
  9872. internalSetCurrentInstance = registerGlobalSetter(
  9873. `__VUE_INSTANCE_SETTERS__`,
  9874. (v) => currentInstance = v
  9875. );
  9876. setInSSRSetupState = registerGlobalSetter(
  9877. `__VUE_SSR_SETTERS__`,
  9878. (v) => isInSSRComponentSetup = v
  9879. );
  9880. }
  9881. const setCurrentInstance = (instance) => {
  9882. const prev = currentInstance;
  9883. internalSetCurrentInstance(instance);
  9884. instance.scope.on();
  9885. return () => {
  9886. instance.scope.off();
  9887. internalSetCurrentInstance(prev);
  9888. };
  9889. };
  9890. const unsetCurrentInstance = () => {
  9891. currentInstance && currentInstance.scope.off();
  9892. internalSetCurrentInstance(null);
  9893. };
  9894. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  9895. function validateComponentName(name, { isNativeTag }) {
  9896. if (isBuiltInTag(name) || isNativeTag(name)) {
  9897. warn$1(
  9898. "Do not use built-in or reserved HTML elements as component id: " + name
  9899. );
  9900. }
  9901. }
  9902. function isStatefulComponent(instance) {
  9903. return instance.vnode.shapeFlag & 4;
  9904. }
  9905. let isInSSRComponentSetup = false;
  9906. function setupComponent(instance, isSSR = false, optimized = false) {
  9907. isSSR && setInSSRSetupState(isSSR);
  9908. const { props, children } = instance.vnode;
  9909. const isStateful = isStatefulComponent(instance);
  9910. initProps(instance, props, isStateful, isSSR);
  9911. initSlots(instance, children, optimized);
  9912. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  9913. isSSR && setInSSRSetupState(false);
  9914. return setupResult;
  9915. }
  9916. function setupStatefulComponent(instance, isSSR) {
  9917. var _a;
  9918. const Component = instance.type;
  9919. {
  9920. if (Component.name) {
  9921. validateComponentName(Component.name, instance.appContext.config);
  9922. }
  9923. if (Component.components) {
  9924. const names = Object.keys(Component.components);
  9925. for (let i = 0; i < names.length; i++) {
  9926. validateComponentName(names[i], instance.appContext.config);
  9927. }
  9928. }
  9929. if (Component.directives) {
  9930. const names = Object.keys(Component.directives);
  9931. for (let i = 0; i < names.length; i++) {
  9932. validateDirectiveName(names[i]);
  9933. }
  9934. }
  9935. if (Component.compilerOptions && isRuntimeOnly()) {
  9936. warn$1(
  9937. `"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.`
  9938. );
  9939. }
  9940. }
  9941. instance.accessCache = /* @__PURE__ */ Object.create(null);
  9942. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  9943. {
  9944. exposePropsOnRenderContext(instance);
  9945. }
  9946. const { setup } = Component;
  9947. if (setup) {
  9948. pauseTracking();
  9949. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  9950. const reset = setCurrentInstance(instance);
  9951. const setupResult = callWithErrorHandling(
  9952. setup,
  9953. instance,
  9954. 0,
  9955. [
  9956. shallowReadonly(instance.props) ,
  9957. setupContext
  9958. ]
  9959. );
  9960. const isAsyncSetup = isPromise(setupResult);
  9961. resetTracking();
  9962. reset();
  9963. if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
  9964. markAsyncBoundary(instance);
  9965. }
  9966. if (isAsyncSetup) {
  9967. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  9968. if (isSSR) {
  9969. return setupResult.then((resolvedResult) => {
  9970. handleSetupResult(instance, resolvedResult, isSSR);
  9971. }).catch((e) => {
  9972. handleError(e, instance, 0);
  9973. });
  9974. } else {
  9975. instance.asyncDep = setupResult;
  9976. if (!instance.suspense) {
  9977. const name = (_a = Component.name) != null ? _a : "Anonymous";
  9978. warn$1(
  9979. `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.`
  9980. );
  9981. }
  9982. }
  9983. } else {
  9984. handleSetupResult(instance, setupResult, isSSR);
  9985. }
  9986. } else {
  9987. finishComponentSetup(instance, isSSR);
  9988. }
  9989. }
  9990. function handleSetupResult(instance, setupResult, isSSR) {
  9991. if (isFunction(setupResult)) {
  9992. if (instance.type.__ssrInlineRender) {
  9993. instance.ssrRender = setupResult;
  9994. } else {
  9995. instance.render = setupResult;
  9996. }
  9997. } else if (isObject(setupResult)) {
  9998. if (isVNode(setupResult)) {
  9999. warn$1(
  10000. `setup() should not return VNodes directly - return a render function instead.`
  10001. );
  10002. }
  10003. {
  10004. instance.devtoolsRawSetupState = setupResult;
  10005. }
  10006. instance.setupState = proxyRefs(setupResult);
  10007. {
  10008. exposeSetupStateOnRenderContext(instance);
  10009. }
  10010. } else if (setupResult !== void 0) {
  10011. warn$1(
  10012. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  10013. );
  10014. }
  10015. finishComponentSetup(instance, isSSR);
  10016. }
  10017. let compile$1;
  10018. let installWithProxy;
  10019. function registerRuntimeCompiler(_compile) {
  10020. compile$1 = _compile;
  10021. installWithProxy = (i) => {
  10022. if (i.render._rc) {
  10023. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  10024. }
  10025. };
  10026. }
  10027. const isRuntimeOnly = () => !compile$1;
  10028. function finishComponentSetup(instance, isSSR, skipOptions) {
  10029. const Component = instance.type;
  10030. if (!instance.render) {
  10031. if (!isSSR && compile$1 && !Component.render) {
  10032. const template = Component.template || resolveMergedOptions(instance).template;
  10033. if (template) {
  10034. {
  10035. startMeasure(instance, `compile`);
  10036. }
  10037. const { isCustomElement, compilerOptions } = instance.appContext.config;
  10038. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  10039. const finalCompilerOptions = extend(
  10040. extend(
  10041. {
  10042. isCustomElement,
  10043. delimiters
  10044. },
  10045. compilerOptions
  10046. ),
  10047. componentCompilerOptions
  10048. );
  10049. Component.render = compile$1(template, finalCompilerOptions);
  10050. {
  10051. endMeasure(instance, `compile`);
  10052. }
  10053. }
  10054. }
  10055. instance.render = Component.render || NOOP;
  10056. if (installWithProxy) {
  10057. installWithProxy(instance);
  10058. }
  10059. }
  10060. {
  10061. const reset = setCurrentInstance(instance);
  10062. pauseTracking();
  10063. try {
  10064. applyOptions(instance);
  10065. } finally {
  10066. resetTracking();
  10067. reset();
  10068. }
  10069. }
  10070. if (!Component.render && instance.render === NOOP && !isSSR) {
  10071. if (!compile$1 && Component.template) {
  10072. warn$1(
  10073. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
  10074. );
  10075. } else {
  10076. warn$1(`Component is missing template or render function: `, Component);
  10077. }
  10078. }
  10079. }
  10080. const attrsProxyHandlers = {
  10081. get(target, key) {
  10082. markAttrsAccessed();
  10083. track(target, "get", "");
  10084. return target[key];
  10085. },
  10086. set() {
  10087. warn$1(`setupContext.attrs is readonly.`);
  10088. return false;
  10089. },
  10090. deleteProperty() {
  10091. warn$1(`setupContext.attrs is readonly.`);
  10092. return false;
  10093. }
  10094. } ;
  10095. function getSlotsProxy(instance) {
  10096. return new Proxy(instance.slots, {
  10097. get(target, key) {
  10098. track(instance, "get", "$slots");
  10099. return target[key];
  10100. }
  10101. });
  10102. }
  10103. function createSetupContext(instance) {
  10104. const expose = (exposed) => {
  10105. {
  10106. if (instance.exposed) {
  10107. warn$1(`expose() should be called only once per setup().`);
  10108. }
  10109. if (exposed != null) {
  10110. let exposedType = typeof exposed;
  10111. if (exposedType === "object") {
  10112. if (isArray(exposed)) {
  10113. exposedType = "array";
  10114. } else if (isRef(exposed)) {
  10115. exposedType = "ref";
  10116. }
  10117. }
  10118. if (exposedType !== "object") {
  10119. warn$1(
  10120. `expose() should be passed a plain object, received ${exposedType}.`
  10121. );
  10122. }
  10123. }
  10124. }
  10125. instance.exposed = exposed || {};
  10126. };
  10127. {
  10128. let attrsProxy;
  10129. let slotsProxy;
  10130. return Object.freeze({
  10131. get attrs() {
  10132. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  10133. },
  10134. get slots() {
  10135. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  10136. },
  10137. get emit() {
  10138. return (event, ...args) => instance.emit(event, ...args);
  10139. },
  10140. expose
  10141. });
  10142. }
  10143. }
  10144. function getComponentPublicInstance(instance) {
  10145. if (instance.exposed) {
  10146. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  10147. get(target, key) {
  10148. if (key in target) {
  10149. return target[key];
  10150. } else if (key in publicPropertiesMap) {
  10151. return publicPropertiesMap[key](instance);
  10152. }
  10153. },
  10154. has(target, key) {
  10155. return key in target || key in publicPropertiesMap;
  10156. }
  10157. }));
  10158. } else {
  10159. return instance.proxy;
  10160. }
  10161. }
  10162. const classifyRE = /(?:^|[-_])(\w)/g;
  10163. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  10164. function getComponentName(Component, includeInferred = true) {
  10165. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  10166. }
  10167. function formatComponentName(instance, Component, isRoot = false) {
  10168. let name = getComponentName(Component);
  10169. if (!name && Component.__file) {
  10170. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  10171. if (match) {
  10172. name = match[1];
  10173. }
  10174. }
  10175. if (!name && instance && instance.parent) {
  10176. const inferFromRegistry = (registry) => {
  10177. for (const key in registry) {
  10178. if (registry[key] === Component) {
  10179. return key;
  10180. }
  10181. }
  10182. };
  10183. name = inferFromRegistry(
  10184. instance.components || instance.parent.type.components
  10185. ) || inferFromRegistry(instance.appContext.components);
  10186. }
  10187. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  10188. }
  10189. function isClassComponent(value) {
  10190. return isFunction(value) && "__vccOpts" in value;
  10191. }
  10192. const computed = (getterOrOptions, debugOptions) => {
  10193. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  10194. {
  10195. const i = getCurrentInstance();
  10196. if (i && i.appContext.config.warnRecursiveComputed) {
  10197. c._warnRecursive = true;
  10198. }
  10199. }
  10200. return c;
  10201. };
  10202. function h(type, propsOrChildren, children) {
  10203. const l = arguments.length;
  10204. if (l === 2) {
  10205. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  10206. if (isVNode(propsOrChildren)) {
  10207. return createVNode(type, null, [propsOrChildren]);
  10208. }
  10209. return createVNode(type, propsOrChildren);
  10210. } else {
  10211. return createVNode(type, null, propsOrChildren);
  10212. }
  10213. } else {
  10214. if (l > 3) {
  10215. children = Array.prototype.slice.call(arguments, 2);
  10216. } else if (l === 3 && isVNode(children)) {
  10217. children = [children];
  10218. }
  10219. return createVNode(type, propsOrChildren, children);
  10220. }
  10221. }
  10222. function initCustomFormatter() {
  10223. if (typeof window === "undefined") {
  10224. return;
  10225. }
  10226. const vueStyle = { style: "color:#3ba776" };
  10227. const numberStyle = { style: "color:#1677ff" };
  10228. const stringStyle = { style: "color:#f5222d" };
  10229. const keywordStyle = { style: "color:#eb2f96" };
  10230. const formatter = {
  10231. __vue_custom_formatter: true,
  10232. header(obj) {
  10233. if (!isObject(obj)) {
  10234. return null;
  10235. }
  10236. if (obj.__isVue) {
  10237. return ["div", vueStyle, `VueInstance`];
  10238. } else if (isRef(obj)) {
  10239. return [
  10240. "div",
  10241. {},
  10242. ["span", vueStyle, genRefFlag(obj)],
  10243. "<",
  10244. // avoid debugger accessing value affecting behavior
  10245. formatValue("_value" in obj ? obj._value : obj),
  10246. `>`
  10247. ];
  10248. } else if (isReactive(obj)) {
  10249. return [
  10250. "div",
  10251. {},
  10252. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  10253. "<",
  10254. formatValue(obj),
  10255. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  10256. ];
  10257. } else if (isReadonly(obj)) {
  10258. return [
  10259. "div",
  10260. {},
  10261. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  10262. "<",
  10263. formatValue(obj),
  10264. ">"
  10265. ];
  10266. }
  10267. return null;
  10268. },
  10269. hasBody(obj) {
  10270. return obj && obj.__isVue;
  10271. },
  10272. body(obj) {
  10273. if (obj && obj.__isVue) {
  10274. return [
  10275. "div",
  10276. {},
  10277. ...formatInstance(obj.$)
  10278. ];
  10279. }
  10280. }
  10281. };
  10282. function formatInstance(instance) {
  10283. const blocks = [];
  10284. if (instance.type.props && instance.props) {
  10285. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  10286. }
  10287. if (instance.setupState !== EMPTY_OBJ) {
  10288. blocks.push(createInstanceBlock("setup", instance.setupState));
  10289. }
  10290. if (instance.data !== EMPTY_OBJ) {
  10291. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  10292. }
  10293. const computed = extractKeys(instance, "computed");
  10294. if (computed) {
  10295. blocks.push(createInstanceBlock("computed", computed));
  10296. }
  10297. const injected = extractKeys(instance, "inject");
  10298. if (injected) {
  10299. blocks.push(createInstanceBlock("injected", injected));
  10300. }
  10301. blocks.push([
  10302. "div",
  10303. {},
  10304. [
  10305. "span",
  10306. {
  10307. style: keywordStyle.style + ";opacity:0.66"
  10308. },
  10309. "$ (internal): "
  10310. ],
  10311. ["object", { object: instance }]
  10312. ]);
  10313. return blocks;
  10314. }
  10315. function createInstanceBlock(type, target) {
  10316. target = extend({}, target);
  10317. if (!Object.keys(target).length) {
  10318. return ["span", {}];
  10319. }
  10320. return [
  10321. "div",
  10322. { style: "line-height:1.25em;margin-bottom:0.6em" },
  10323. [
  10324. "div",
  10325. {
  10326. style: "color:#476582"
  10327. },
  10328. type
  10329. ],
  10330. [
  10331. "div",
  10332. {
  10333. style: "padding-left:1.25em"
  10334. },
  10335. ...Object.keys(target).map((key) => {
  10336. return [
  10337. "div",
  10338. {},
  10339. ["span", keywordStyle, key + ": "],
  10340. formatValue(target[key], false)
  10341. ];
  10342. })
  10343. ]
  10344. ];
  10345. }
  10346. function formatValue(v, asRaw = true) {
  10347. if (typeof v === "number") {
  10348. return ["span", numberStyle, v];
  10349. } else if (typeof v === "string") {
  10350. return ["span", stringStyle, JSON.stringify(v)];
  10351. } else if (typeof v === "boolean") {
  10352. return ["span", keywordStyle, v];
  10353. } else if (isObject(v)) {
  10354. return ["object", { object: asRaw ? toRaw(v) : v }];
  10355. } else {
  10356. return ["span", stringStyle, String(v)];
  10357. }
  10358. }
  10359. function extractKeys(instance, type) {
  10360. const Comp = instance.type;
  10361. if (isFunction(Comp)) {
  10362. return;
  10363. }
  10364. const extracted = {};
  10365. for (const key in instance.ctx) {
  10366. if (isKeyOfType(Comp, key, type)) {
  10367. extracted[key] = instance.ctx[key];
  10368. }
  10369. }
  10370. return extracted;
  10371. }
  10372. function isKeyOfType(Comp, key, type) {
  10373. const opts = Comp[type];
  10374. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  10375. return true;
  10376. }
  10377. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  10378. return true;
  10379. }
  10380. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  10381. return true;
  10382. }
  10383. }
  10384. function genRefFlag(v) {
  10385. if (isShallow(v)) {
  10386. return `ShallowRef`;
  10387. }
  10388. if (v.effect) {
  10389. return `ComputedRef`;
  10390. }
  10391. return `Ref`;
  10392. }
  10393. if (window.devtoolsFormatters) {
  10394. window.devtoolsFormatters.push(formatter);
  10395. } else {
  10396. window.devtoolsFormatters = [formatter];
  10397. }
  10398. }
  10399. function withMemo(memo, render, cache, index) {
  10400. const cached = cache[index];
  10401. if (cached && isMemoSame(cached, memo)) {
  10402. return cached;
  10403. }
  10404. const ret = render();
  10405. ret.memo = memo.slice();
  10406. ret.cacheIndex = index;
  10407. return cache[index] = ret;
  10408. }
  10409. function isMemoSame(cached, memo) {
  10410. const prev = cached.memo;
  10411. if (prev.length != memo.length) {
  10412. return false;
  10413. }
  10414. for (let i = 0; i < prev.length; i++) {
  10415. if (hasChanged(prev[i], memo[i])) {
  10416. return false;
  10417. }
  10418. }
  10419. if (isBlockTreeEnabled > 0 && currentBlock) {
  10420. currentBlock.push(cached);
  10421. }
  10422. return true;
  10423. }
  10424. const version = "3.5.12";
  10425. const warn = warn$1 ;
  10426. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  10427. const devtools = devtools$1 ;
  10428. const setDevtoolsHook = setDevtoolsHook$1 ;
  10429. const _ssrUtils = {
  10430. createComponentInstance,
  10431. setupComponent,
  10432. renderComponentRoot,
  10433. setCurrentRenderingInstance,
  10434. isVNode: isVNode,
  10435. normalizeVNode,
  10436. getComponentPublicInstance,
  10437. ensureValidVNode,
  10438. pushWarningContext,
  10439. popWarningContext
  10440. };
  10441. const ssrUtils = _ssrUtils ;
  10442. const resolveFilter = null;
  10443. const compatUtils = null;
  10444. const DeprecationTypes = null;
  10445. let policy = void 0;
  10446. const tt = typeof window !== "undefined" && window.trustedTypes;
  10447. if (tt) {
  10448. try {
  10449. policy = /* @__PURE__ */ tt.createPolicy("vue", {
  10450. createHTML: (val) => val
  10451. });
  10452. } catch (e) {
  10453. warn(`Error creating trusted types policy: ${e}`);
  10454. }
  10455. }
  10456. const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
  10457. const svgNS = "http://www.w3.org/2000/svg";
  10458. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  10459. const doc = typeof document !== "undefined" ? document : null;
  10460. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  10461. const nodeOps = {
  10462. insert: (child, parent, anchor) => {
  10463. parent.insertBefore(child, anchor || null);
  10464. },
  10465. remove: (child) => {
  10466. const parent = child.parentNode;
  10467. if (parent) {
  10468. parent.removeChild(child);
  10469. }
  10470. },
  10471. createElement: (tag, namespace, is, props) => {
  10472. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  10473. if (tag === "select" && props && props.multiple != null) {
  10474. el.setAttribute("multiple", props.multiple);
  10475. }
  10476. return el;
  10477. },
  10478. createText: (text) => doc.createTextNode(text),
  10479. createComment: (text) => doc.createComment(text),
  10480. setText: (node, text) => {
  10481. node.nodeValue = text;
  10482. },
  10483. setElementText: (el, text) => {
  10484. el.textContent = text;
  10485. },
  10486. parentNode: (node) => node.parentNode,
  10487. nextSibling: (node) => node.nextSibling,
  10488. querySelector: (selector) => doc.querySelector(selector),
  10489. setScopeId(el, id) {
  10490. el.setAttribute(id, "");
  10491. },
  10492. // __UNSAFE__
  10493. // Reason: innerHTML.
  10494. // Static content here can only come from compiled templates.
  10495. // As long as the user only uses trusted templates, this is safe.
  10496. insertStaticContent(content, parent, anchor, namespace, start, end) {
  10497. const before = anchor ? anchor.previousSibling : parent.lastChild;
  10498. if (start && (start === end || start.nextSibling)) {
  10499. while (true) {
  10500. parent.insertBefore(start.cloneNode(true), anchor);
  10501. if (start === end || !(start = start.nextSibling)) break;
  10502. }
  10503. } else {
  10504. templateContainer.innerHTML = unsafeToTrustedHTML(
  10505. namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
  10506. );
  10507. const template = templateContainer.content;
  10508. if (namespace === "svg" || namespace === "mathml") {
  10509. const wrapper = template.firstChild;
  10510. while (wrapper.firstChild) {
  10511. template.appendChild(wrapper.firstChild);
  10512. }
  10513. template.removeChild(wrapper);
  10514. }
  10515. parent.insertBefore(template, anchor);
  10516. }
  10517. return [
  10518. // first
  10519. before ? before.nextSibling : parent.firstChild,
  10520. // last
  10521. anchor ? anchor.previousSibling : parent.lastChild
  10522. ];
  10523. }
  10524. };
  10525. const TRANSITION$1 = "transition";
  10526. const ANIMATION = "animation";
  10527. const vtcKey = Symbol("_vtc");
  10528. const DOMTransitionPropsValidators = {
  10529. name: String,
  10530. type: String,
  10531. css: {
  10532. type: Boolean,
  10533. default: true
  10534. },
  10535. duration: [String, Number, Object],
  10536. enterFromClass: String,
  10537. enterActiveClass: String,
  10538. enterToClass: String,
  10539. appearFromClass: String,
  10540. appearActiveClass: String,
  10541. appearToClass: String,
  10542. leaveFromClass: String,
  10543. leaveActiveClass: String,
  10544. leaveToClass: String
  10545. };
  10546. const TransitionPropsValidators = /* @__PURE__ */ extend(
  10547. {},
  10548. BaseTransitionPropsValidators,
  10549. DOMTransitionPropsValidators
  10550. );
  10551. const decorate$1 = (t) => {
  10552. t.displayName = "Transition";
  10553. t.props = TransitionPropsValidators;
  10554. return t;
  10555. };
  10556. const Transition = /* @__PURE__ */ decorate$1(
  10557. (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
  10558. );
  10559. const callHook = (hook, args = []) => {
  10560. if (isArray(hook)) {
  10561. hook.forEach((h2) => h2(...args));
  10562. } else if (hook) {
  10563. hook(...args);
  10564. }
  10565. };
  10566. const hasExplicitCallback = (hook) => {
  10567. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  10568. };
  10569. function resolveTransitionProps(rawProps) {
  10570. const baseProps = {};
  10571. for (const key in rawProps) {
  10572. if (!(key in DOMTransitionPropsValidators)) {
  10573. baseProps[key] = rawProps[key];
  10574. }
  10575. }
  10576. if (rawProps.css === false) {
  10577. return baseProps;
  10578. }
  10579. const {
  10580. name = "v",
  10581. type,
  10582. duration,
  10583. enterFromClass = `${name}-enter-from`,
  10584. enterActiveClass = `${name}-enter-active`,
  10585. enterToClass = `${name}-enter-to`,
  10586. appearFromClass = enterFromClass,
  10587. appearActiveClass = enterActiveClass,
  10588. appearToClass = enterToClass,
  10589. leaveFromClass = `${name}-leave-from`,
  10590. leaveActiveClass = `${name}-leave-active`,
  10591. leaveToClass = `${name}-leave-to`
  10592. } = rawProps;
  10593. const durations = normalizeDuration(duration);
  10594. const enterDuration = durations && durations[0];
  10595. const leaveDuration = durations && durations[1];
  10596. const {
  10597. onBeforeEnter,
  10598. onEnter,
  10599. onEnterCancelled,
  10600. onLeave,
  10601. onLeaveCancelled,
  10602. onBeforeAppear = onBeforeEnter,
  10603. onAppear = onEnter,
  10604. onAppearCancelled = onEnterCancelled
  10605. } = baseProps;
  10606. const finishEnter = (el, isAppear, done) => {
  10607. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10608. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  10609. done && done();
  10610. };
  10611. const finishLeave = (el, done) => {
  10612. el._isLeaving = false;
  10613. removeTransitionClass(el, leaveFromClass);
  10614. removeTransitionClass(el, leaveToClass);
  10615. removeTransitionClass(el, leaveActiveClass);
  10616. done && done();
  10617. };
  10618. const makeEnterHook = (isAppear) => {
  10619. return (el, done) => {
  10620. const hook = isAppear ? onAppear : onEnter;
  10621. const resolve = () => finishEnter(el, isAppear, done);
  10622. callHook(hook, [el, resolve]);
  10623. nextFrame(() => {
  10624. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  10625. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10626. if (!hasExplicitCallback(hook)) {
  10627. whenTransitionEnds(el, type, enterDuration, resolve);
  10628. }
  10629. });
  10630. };
  10631. };
  10632. return extend(baseProps, {
  10633. onBeforeEnter(el) {
  10634. callHook(onBeforeEnter, [el]);
  10635. addTransitionClass(el, enterFromClass);
  10636. addTransitionClass(el, enterActiveClass);
  10637. },
  10638. onBeforeAppear(el) {
  10639. callHook(onBeforeAppear, [el]);
  10640. addTransitionClass(el, appearFromClass);
  10641. addTransitionClass(el, appearActiveClass);
  10642. },
  10643. onEnter: makeEnterHook(false),
  10644. onAppear: makeEnterHook(true),
  10645. onLeave(el, done) {
  10646. el._isLeaving = true;
  10647. const resolve = () => finishLeave(el, done);
  10648. addTransitionClass(el, leaveFromClass);
  10649. addTransitionClass(el, leaveActiveClass);
  10650. forceReflow();
  10651. nextFrame(() => {
  10652. if (!el._isLeaving) {
  10653. return;
  10654. }
  10655. removeTransitionClass(el, leaveFromClass);
  10656. addTransitionClass(el, leaveToClass);
  10657. if (!hasExplicitCallback(onLeave)) {
  10658. whenTransitionEnds(el, type, leaveDuration, resolve);
  10659. }
  10660. });
  10661. callHook(onLeave, [el, resolve]);
  10662. },
  10663. onEnterCancelled(el) {
  10664. finishEnter(el, false);
  10665. callHook(onEnterCancelled, [el]);
  10666. },
  10667. onAppearCancelled(el) {
  10668. finishEnter(el, true);
  10669. callHook(onAppearCancelled, [el]);
  10670. },
  10671. onLeaveCancelled(el) {
  10672. finishLeave(el);
  10673. callHook(onLeaveCancelled, [el]);
  10674. }
  10675. });
  10676. }
  10677. function normalizeDuration(duration) {
  10678. if (duration == null) {
  10679. return null;
  10680. } else if (isObject(duration)) {
  10681. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  10682. } else {
  10683. const n = NumberOf(duration);
  10684. return [n, n];
  10685. }
  10686. }
  10687. function NumberOf(val) {
  10688. const res = toNumber(val);
  10689. {
  10690. assertNumber(res, "<transition> explicit duration");
  10691. }
  10692. return res;
  10693. }
  10694. function addTransitionClass(el, cls) {
  10695. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  10696. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  10697. }
  10698. function removeTransitionClass(el, cls) {
  10699. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  10700. const _vtc = el[vtcKey];
  10701. if (_vtc) {
  10702. _vtc.delete(cls);
  10703. if (!_vtc.size) {
  10704. el[vtcKey] = void 0;
  10705. }
  10706. }
  10707. }
  10708. function nextFrame(cb) {
  10709. requestAnimationFrame(() => {
  10710. requestAnimationFrame(cb);
  10711. });
  10712. }
  10713. let endId = 0;
  10714. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  10715. const id = el._endId = ++endId;
  10716. const resolveIfNotStale = () => {
  10717. if (id === el._endId) {
  10718. resolve();
  10719. }
  10720. };
  10721. if (explicitTimeout != null) {
  10722. return setTimeout(resolveIfNotStale, explicitTimeout);
  10723. }
  10724. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  10725. if (!type) {
  10726. return resolve();
  10727. }
  10728. const endEvent = type + "end";
  10729. let ended = 0;
  10730. const end = () => {
  10731. el.removeEventListener(endEvent, onEnd);
  10732. resolveIfNotStale();
  10733. };
  10734. const onEnd = (e) => {
  10735. if (e.target === el && ++ended >= propCount) {
  10736. end();
  10737. }
  10738. };
  10739. setTimeout(() => {
  10740. if (ended < propCount) {
  10741. end();
  10742. }
  10743. }, timeout + 1);
  10744. el.addEventListener(endEvent, onEnd);
  10745. }
  10746. function getTransitionInfo(el, expectedType) {
  10747. const styles = window.getComputedStyle(el);
  10748. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  10749. const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
  10750. const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
  10751. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  10752. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  10753. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  10754. const animationTimeout = getTimeout(animationDelays, animationDurations);
  10755. let type = null;
  10756. let timeout = 0;
  10757. let propCount = 0;
  10758. if (expectedType === TRANSITION$1) {
  10759. if (transitionTimeout > 0) {
  10760. type = TRANSITION$1;
  10761. timeout = transitionTimeout;
  10762. propCount = transitionDurations.length;
  10763. }
  10764. } else if (expectedType === ANIMATION) {
  10765. if (animationTimeout > 0) {
  10766. type = ANIMATION;
  10767. timeout = animationTimeout;
  10768. propCount = animationDurations.length;
  10769. }
  10770. } else {
  10771. timeout = Math.max(transitionTimeout, animationTimeout);
  10772. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
  10773. propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
  10774. }
  10775. const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
  10776. getStyleProperties(`${TRANSITION$1}Property`).toString()
  10777. );
  10778. return {
  10779. type,
  10780. timeout,
  10781. propCount,
  10782. hasTransform
  10783. };
  10784. }
  10785. function getTimeout(delays, durations) {
  10786. while (delays.length < durations.length) {
  10787. delays = delays.concat(delays);
  10788. }
  10789. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  10790. }
  10791. function toMs(s) {
  10792. if (s === "auto") return 0;
  10793. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  10794. }
  10795. function forceReflow() {
  10796. return document.body.offsetHeight;
  10797. }
  10798. function patchClass(el, value, isSVG) {
  10799. const transitionClasses = el[vtcKey];
  10800. if (transitionClasses) {
  10801. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  10802. }
  10803. if (value == null) {
  10804. el.removeAttribute("class");
  10805. } else if (isSVG) {
  10806. el.setAttribute("class", value);
  10807. } else {
  10808. el.className = value;
  10809. }
  10810. }
  10811. const vShowOriginalDisplay = Symbol("_vod");
  10812. const vShowHidden = Symbol("_vsh");
  10813. const vShow = {
  10814. beforeMount(el, { value }, { transition }) {
  10815. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  10816. if (transition && value) {
  10817. transition.beforeEnter(el);
  10818. } else {
  10819. setDisplay(el, value);
  10820. }
  10821. },
  10822. mounted(el, { value }, { transition }) {
  10823. if (transition && value) {
  10824. transition.enter(el);
  10825. }
  10826. },
  10827. updated(el, { value, oldValue }, { transition }) {
  10828. if (!value === !oldValue) return;
  10829. if (transition) {
  10830. if (value) {
  10831. transition.beforeEnter(el);
  10832. setDisplay(el, true);
  10833. transition.enter(el);
  10834. } else {
  10835. transition.leave(el, () => {
  10836. setDisplay(el, false);
  10837. });
  10838. }
  10839. } else {
  10840. setDisplay(el, value);
  10841. }
  10842. },
  10843. beforeUnmount(el, { value }) {
  10844. setDisplay(el, value);
  10845. }
  10846. };
  10847. {
  10848. vShow.name = "show";
  10849. }
  10850. function setDisplay(el, value) {
  10851. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  10852. el[vShowHidden] = !value;
  10853. }
  10854. function initVShowForSSR() {
  10855. vShow.getSSRProps = ({ value }) => {
  10856. if (!value) {
  10857. return { style: { display: "none" } };
  10858. }
  10859. };
  10860. }
  10861. const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
  10862. function useCssVars(getter) {
  10863. const instance = getCurrentInstance();
  10864. if (!instance) {
  10865. warn(`useCssVars is called without current active component instance.`);
  10866. return;
  10867. }
  10868. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  10869. Array.from(
  10870. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  10871. ).forEach((node) => setVarsOnNode(node, vars));
  10872. };
  10873. {
  10874. instance.getCssVars = () => getter(instance.proxy);
  10875. }
  10876. const setVars = () => {
  10877. const vars = getter(instance.proxy);
  10878. if (instance.ce) {
  10879. setVarsOnNode(instance.ce, vars);
  10880. } else {
  10881. setVarsOnVNode(instance.subTree, vars);
  10882. }
  10883. updateTeleports(vars);
  10884. };
  10885. onBeforeMount(() => {
  10886. watchPostEffect(setVars);
  10887. });
  10888. onMounted(() => {
  10889. const ob = new MutationObserver(setVars);
  10890. ob.observe(instance.subTree.el.parentNode, { childList: true });
  10891. onUnmounted(() => ob.disconnect());
  10892. });
  10893. }
  10894. function setVarsOnVNode(vnode, vars) {
  10895. if (vnode.shapeFlag & 128) {
  10896. const suspense = vnode.suspense;
  10897. vnode = suspense.activeBranch;
  10898. if (suspense.pendingBranch && !suspense.isHydrating) {
  10899. suspense.effects.push(() => {
  10900. setVarsOnVNode(suspense.activeBranch, vars);
  10901. });
  10902. }
  10903. }
  10904. while (vnode.component) {
  10905. vnode = vnode.component.subTree;
  10906. }
  10907. if (vnode.shapeFlag & 1 && vnode.el) {
  10908. setVarsOnNode(vnode.el, vars);
  10909. } else if (vnode.type === Fragment) {
  10910. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  10911. } else if (vnode.type === Static) {
  10912. let { el, anchor } = vnode;
  10913. while (el) {
  10914. setVarsOnNode(el, vars);
  10915. if (el === anchor) break;
  10916. el = el.nextSibling;
  10917. }
  10918. }
  10919. }
  10920. function setVarsOnNode(el, vars) {
  10921. if (el.nodeType === 1) {
  10922. const style = el.style;
  10923. let cssText = "";
  10924. for (const key in vars) {
  10925. style.setProperty(`--${key}`, vars[key]);
  10926. cssText += `--${key}: ${vars[key]};`;
  10927. }
  10928. style[CSS_VAR_TEXT] = cssText;
  10929. }
  10930. }
  10931. const displayRE = /(^|;)\s*display\s*:/;
  10932. function patchStyle(el, prev, next) {
  10933. const style = el.style;
  10934. const isCssString = isString(next);
  10935. let hasControlledDisplay = false;
  10936. if (next && !isCssString) {
  10937. if (prev) {
  10938. if (!isString(prev)) {
  10939. for (const key in prev) {
  10940. if (next[key] == null) {
  10941. setStyle(style, key, "");
  10942. }
  10943. }
  10944. } else {
  10945. for (const prevStyle of prev.split(";")) {
  10946. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  10947. if (next[key] == null) {
  10948. setStyle(style, key, "");
  10949. }
  10950. }
  10951. }
  10952. }
  10953. for (const key in next) {
  10954. if (key === "display") {
  10955. hasControlledDisplay = true;
  10956. }
  10957. setStyle(style, key, next[key]);
  10958. }
  10959. } else {
  10960. if (isCssString) {
  10961. if (prev !== next) {
  10962. const cssVarText = style[CSS_VAR_TEXT];
  10963. if (cssVarText) {
  10964. next += ";" + cssVarText;
  10965. }
  10966. style.cssText = next;
  10967. hasControlledDisplay = displayRE.test(next);
  10968. }
  10969. } else if (prev) {
  10970. el.removeAttribute("style");
  10971. }
  10972. }
  10973. if (vShowOriginalDisplay in el) {
  10974. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  10975. if (el[vShowHidden]) {
  10976. style.display = "none";
  10977. }
  10978. }
  10979. }
  10980. const semicolonRE = /[^\\];\s*$/;
  10981. const importantRE = /\s*!important$/;
  10982. function setStyle(style, name, val) {
  10983. if (isArray(val)) {
  10984. val.forEach((v) => setStyle(style, name, v));
  10985. } else {
  10986. if (val == null) val = "";
  10987. {
  10988. if (semicolonRE.test(val)) {
  10989. warn(
  10990. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  10991. );
  10992. }
  10993. }
  10994. if (name.startsWith("--")) {
  10995. style.setProperty(name, val);
  10996. } else {
  10997. const prefixed = autoPrefix(style, name);
  10998. if (importantRE.test(val)) {
  10999. style.setProperty(
  11000. hyphenate(prefixed),
  11001. val.replace(importantRE, ""),
  11002. "important"
  11003. );
  11004. } else {
  11005. style[prefixed] = val;
  11006. }
  11007. }
  11008. }
  11009. }
  11010. const prefixes = ["Webkit", "Moz", "ms"];
  11011. const prefixCache = {};
  11012. function autoPrefix(style, rawName) {
  11013. const cached = prefixCache[rawName];
  11014. if (cached) {
  11015. return cached;
  11016. }
  11017. let name = camelize(rawName);
  11018. if (name !== "filter" && name in style) {
  11019. return prefixCache[rawName] = name;
  11020. }
  11021. name = capitalize(name);
  11022. for (let i = 0; i < prefixes.length; i++) {
  11023. const prefixed = prefixes[i] + name;
  11024. if (prefixed in style) {
  11025. return prefixCache[rawName] = prefixed;
  11026. }
  11027. }
  11028. return rawName;
  11029. }
  11030. const xlinkNS = "http://www.w3.org/1999/xlink";
  11031. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  11032. if (isSVG && key.startsWith("xlink:")) {
  11033. if (value == null) {
  11034. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  11035. } else {
  11036. el.setAttributeNS(xlinkNS, key, value);
  11037. }
  11038. } else {
  11039. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  11040. el.removeAttribute(key);
  11041. } else {
  11042. el.setAttribute(
  11043. key,
  11044. isBoolean ? "" : isSymbol(value) ? String(value) : value
  11045. );
  11046. }
  11047. }
  11048. }
  11049. function patchDOMProp(el, key, value, parentComponent, attrName) {
  11050. if (key === "innerHTML" || key === "textContent") {
  11051. if (value != null) {
  11052. el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
  11053. }
  11054. return;
  11055. }
  11056. const tag = el.tagName;
  11057. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  11058. !tag.includes("-")) {
  11059. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  11060. const newValue = value == null ? (
  11061. // #11647: value should be set as empty string for null and undefined,
  11062. // but <input type="checkbox"> should be set as 'on'.
  11063. el.type === "checkbox" ? "on" : ""
  11064. ) : String(value);
  11065. if (oldValue !== newValue || !("_value" in el)) {
  11066. el.value = newValue;
  11067. }
  11068. if (value == null) {
  11069. el.removeAttribute(key);
  11070. }
  11071. el._value = value;
  11072. return;
  11073. }
  11074. let needRemove = false;
  11075. if (value === "" || value == null) {
  11076. const type = typeof el[key];
  11077. if (type === "boolean") {
  11078. value = includeBooleanAttr(value);
  11079. } else if (value == null && type === "string") {
  11080. value = "";
  11081. needRemove = true;
  11082. } else if (type === "number") {
  11083. value = 0;
  11084. needRemove = true;
  11085. }
  11086. }
  11087. try {
  11088. el[key] = value;
  11089. } catch (e) {
  11090. if (!needRemove) {
  11091. warn(
  11092. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  11093. e
  11094. );
  11095. }
  11096. }
  11097. needRemove && el.removeAttribute(attrName || key);
  11098. }
  11099. function addEventListener(el, event, handler, options) {
  11100. el.addEventListener(event, handler, options);
  11101. }
  11102. function removeEventListener(el, event, handler, options) {
  11103. el.removeEventListener(event, handler, options);
  11104. }
  11105. const veiKey = Symbol("_vei");
  11106. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  11107. const invokers = el[veiKey] || (el[veiKey] = {});
  11108. const existingInvoker = invokers[rawName];
  11109. if (nextValue && existingInvoker) {
  11110. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  11111. } else {
  11112. const [name, options] = parseName(rawName);
  11113. if (nextValue) {
  11114. const invoker = invokers[rawName] = createInvoker(
  11115. sanitizeEventValue(nextValue, rawName) ,
  11116. instance
  11117. );
  11118. addEventListener(el, name, invoker, options);
  11119. } else if (existingInvoker) {
  11120. removeEventListener(el, name, existingInvoker, options);
  11121. invokers[rawName] = void 0;
  11122. }
  11123. }
  11124. }
  11125. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  11126. function parseName(name) {
  11127. let options;
  11128. if (optionsModifierRE.test(name)) {
  11129. options = {};
  11130. let m;
  11131. while (m = name.match(optionsModifierRE)) {
  11132. name = name.slice(0, name.length - m[0].length);
  11133. options[m[0].toLowerCase()] = true;
  11134. }
  11135. }
  11136. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  11137. return [event, options];
  11138. }
  11139. let cachedNow = 0;
  11140. const p = /* @__PURE__ */ Promise.resolve();
  11141. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  11142. function createInvoker(initialValue, instance) {
  11143. const invoker = (e) => {
  11144. if (!e._vts) {
  11145. e._vts = Date.now();
  11146. } else if (e._vts <= invoker.attached) {
  11147. return;
  11148. }
  11149. callWithAsyncErrorHandling(
  11150. patchStopImmediatePropagation(e, invoker.value),
  11151. instance,
  11152. 5,
  11153. [e]
  11154. );
  11155. };
  11156. invoker.value = initialValue;
  11157. invoker.attached = getNow();
  11158. return invoker;
  11159. }
  11160. function sanitizeEventValue(value, propName) {
  11161. if (isFunction(value) || isArray(value)) {
  11162. return value;
  11163. }
  11164. warn(
  11165. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  11166. Expected function or array of functions, received type ${typeof value}.`
  11167. );
  11168. return NOOP;
  11169. }
  11170. function patchStopImmediatePropagation(e, value) {
  11171. if (isArray(value)) {
  11172. const originalStop = e.stopImmediatePropagation;
  11173. e.stopImmediatePropagation = () => {
  11174. originalStop.call(e);
  11175. e._stopped = true;
  11176. };
  11177. return value.map(
  11178. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  11179. );
  11180. } else {
  11181. return value;
  11182. }
  11183. }
  11184. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  11185. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  11186. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  11187. const isSVG = namespace === "svg";
  11188. if (key === "class") {
  11189. patchClass(el, nextValue, isSVG);
  11190. } else if (key === "style") {
  11191. patchStyle(el, prevValue, nextValue);
  11192. } else if (isOn(key)) {
  11193. if (!isModelListener(key)) {
  11194. patchEvent(el, key, prevValue, nextValue, parentComponent);
  11195. }
  11196. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  11197. patchDOMProp(el, key, nextValue);
  11198. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  11199. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  11200. }
  11201. } else if (
  11202. // #11081 force set props for possible async custom element
  11203. el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
  11204. ) {
  11205. patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
  11206. } else {
  11207. if (key === "true-value") {
  11208. el._trueValue = nextValue;
  11209. } else if (key === "false-value") {
  11210. el._falseValue = nextValue;
  11211. }
  11212. patchAttr(el, key, nextValue, isSVG);
  11213. }
  11214. };
  11215. function shouldSetAsProp(el, key, value, isSVG) {
  11216. if (isSVG) {
  11217. if (key === "innerHTML" || key === "textContent") {
  11218. return true;
  11219. }
  11220. if (key in el && isNativeOn(key) && isFunction(value)) {
  11221. return true;
  11222. }
  11223. return false;
  11224. }
  11225. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  11226. return false;
  11227. }
  11228. if (key === "form") {
  11229. return false;
  11230. }
  11231. if (key === "list" && el.tagName === "INPUT") {
  11232. return false;
  11233. }
  11234. if (key === "type" && el.tagName === "TEXTAREA") {
  11235. return false;
  11236. }
  11237. if (key === "width" || key === "height") {
  11238. const tag = el.tagName;
  11239. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  11240. return false;
  11241. }
  11242. }
  11243. if (isNativeOn(key) && isString(value)) {
  11244. return false;
  11245. }
  11246. return key in el;
  11247. }
  11248. const REMOVAL = {};
  11249. /*! #__NO_SIDE_EFFECTS__ */
  11250. // @__NO_SIDE_EFFECTS__
  11251. function defineCustomElement(options, extraOptions, _createApp) {
  11252. const Comp = defineComponent(options, extraOptions);
  11253. if (isPlainObject(Comp)) extend(Comp, extraOptions);
  11254. class VueCustomElement extends VueElement {
  11255. constructor(initialProps) {
  11256. super(Comp, initialProps, _createApp);
  11257. }
  11258. }
  11259. VueCustomElement.def = Comp;
  11260. return VueCustomElement;
  11261. }
  11262. /*! #__NO_SIDE_EFFECTS__ */
  11263. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  11264. return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
  11265. };
  11266. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  11267. };
  11268. class VueElement extends BaseClass {
  11269. constructor(_def, _props = {}, _createApp = createApp) {
  11270. super();
  11271. this._def = _def;
  11272. this._props = _props;
  11273. this._createApp = _createApp;
  11274. this._isVueCE = true;
  11275. /**
  11276. * @internal
  11277. */
  11278. this._instance = null;
  11279. /**
  11280. * @internal
  11281. */
  11282. this._app = null;
  11283. /**
  11284. * @internal
  11285. */
  11286. this._nonce = this._def.nonce;
  11287. this._connected = false;
  11288. this._resolved = false;
  11289. this._numberProps = null;
  11290. this._styleChildren = /* @__PURE__ */ new WeakSet();
  11291. this._ob = null;
  11292. if (this.shadowRoot && _createApp !== createApp) {
  11293. this._root = this.shadowRoot;
  11294. } else {
  11295. if (this.shadowRoot) {
  11296. warn(
  11297. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  11298. );
  11299. }
  11300. if (_def.shadowRoot !== false) {
  11301. this.attachShadow({ mode: "open" });
  11302. this._root = this.shadowRoot;
  11303. } else {
  11304. this._root = this;
  11305. }
  11306. }
  11307. if (!this._def.__asyncLoader) {
  11308. this._resolveProps(this._def);
  11309. }
  11310. }
  11311. connectedCallback() {
  11312. if (!this.isConnected) return;
  11313. if (!this.shadowRoot) {
  11314. this._parseSlots();
  11315. }
  11316. this._connected = true;
  11317. let parent = this;
  11318. while (parent = parent && (parent.parentNode || parent.host)) {
  11319. if (parent instanceof VueElement) {
  11320. this._parent = parent;
  11321. break;
  11322. }
  11323. }
  11324. if (!this._instance) {
  11325. if (this._resolved) {
  11326. this._setParent();
  11327. this._update();
  11328. } else {
  11329. if (parent && parent._pendingResolve) {
  11330. this._pendingResolve = parent._pendingResolve.then(() => {
  11331. this._pendingResolve = void 0;
  11332. this._resolveDef();
  11333. });
  11334. } else {
  11335. this._resolveDef();
  11336. }
  11337. }
  11338. }
  11339. }
  11340. _setParent(parent = this._parent) {
  11341. if (parent) {
  11342. this._instance.parent = parent._instance;
  11343. this._instance.provides = parent._instance.provides;
  11344. }
  11345. }
  11346. disconnectedCallback() {
  11347. this._connected = false;
  11348. nextTick(() => {
  11349. if (!this._connected) {
  11350. if (this._ob) {
  11351. this._ob.disconnect();
  11352. this._ob = null;
  11353. }
  11354. this._app && this._app.unmount();
  11355. if (this._instance) this._instance.ce = void 0;
  11356. this._app = this._instance = null;
  11357. }
  11358. });
  11359. }
  11360. /**
  11361. * resolve inner component definition (handle possible async component)
  11362. */
  11363. _resolveDef() {
  11364. if (this._pendingResolve) {
  11365. return;
  11366. }
  11367. for (let i = 0; i < this.attributes.length; i++) {
  11368. this._setAttr(this.attributes[i].name);
  11369. }
  11370. this._ob = new MutationObserver((mutations) => {
  11371. for (const m of mutations) {
  11372. this._setAttr(m.attributeName);
  11373. }
  11374. });
  11375. this._ob.observe(this, { attributes: true });
  11376. const resolve = (def, isAsync = false) => {
  11377. this._resolved = true;
  11378. this._pendingResolve = void 0;
  11379. const { props, styles } = def;
  11380. let numberProps;
  11381. if (props && !isArray(props)) {
  11382. for (const key in props) {
  11383. const opt = props[key];
  11384. if (opt === Number || opt && opt.type === Number) {
  11385. if (key in this._props) {
  11386. this._props[key] = toNumber(this._props[key]);
  11387. }
  11388. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  11389. }
  11390. }
  11391. }
  11392. this._numberProps = numberProps;
  11393. if (isAsync) {
  11394. this._resolveProps(def);
  11395. }
  11396. if (this.shadowRoot) {
  11397. this._applyStyles(styles);
  11398. } else if (styles) {
  11399. warn(
  11400. "Custom element style injection is not supported when using shadowRoot: false"
  11401. );
  11402. }
  11403. this._mount(def);
  11404. };
  11405. const asyncDef = this._def.__asyncLoader;
  11406. if (asyncDef) {
  11407. this._pendingResolve = asyncDef().then(
  11408. (def) => resolve(this._def = def, true)
  11409. );
  11410. } else {
  11411. resolve(this._def);
  11412. }
  11413. }
  11414. _mount(def) {
  11415. if (!def.name) {
  11416. def.name = "VueElement";
  11417. }
  11418. this._app = this._createApp(def);
  11419. if (def.configureApp) {
  11420. def.configureApp(this._app);
  11421. }
  11422. this._app._ceVNode = this._createVNode();
  11423. this._app.mount(this._root);
  11424. const exposed = this._instance && this._instance.exposed;
  11425. if (!exposed) return;
  11426. for (const key in exposed) {
  11427. if (!hasOwn(this, key)) {
  11428. Object.defineProperty(this, key, {
  11429. // unwrap ref to be consistent with public instance behavior
  11430. get: () => unref(exposed[key])
  11431. });
  11432. } else {
  11433. warn(`Exposed property "${key}" already exists on custom element.`);
  11434. }
  11435. }
  11436. }
  11437. _resolveProps(def) {
  11438. const { props } = def;
  11439. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  11440. for (const key of Object.keys(this)) {
  11441. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  11442. this._setProp(key, this[key]);
  11443. }
  11444. }
  11445. for (const key of declaredPropKeys.map(camelize)) {
  11446. Object.defineProperty(this, key, {
  11447. get() {
  11448. return this._getProp(key);
  11449. },
  11450. set(val) {
  11451. this._setProp(key, val, true, true);
  11452. }
  11453. });
  11454. }
  11455. }
  11456. _setAttr(key) {
  11457. if (key.startsWith("data-v-")) return;
  11458. const has = this.hasAttribute(key);
  11459. let value = has ? this.getAttribute(key) : REMOVAL;
  11460. const camelKey = camelize(key);
  11461. if (has && this._numberProps && this._numberProps[camelKey]) {
  11462. value = toNumber(value);
  11463. }
  11464. this._setProp(camelKey, value, false, true);
  11465. }
  11466. /**
  11467. * @internal
  11468. */
  11469. _getProp(key) {
  11470. return this._props[key];
  11471. }
  11472. /**
  11473. * @internal
  11474. */
  11475. _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
  11476. if (val !== this._props[key]) {
  11477. if (val === REMOVAL) {
  11478. delete this._props[key];
  11479. } else {
  11480. this._props[key] = val;
  11481. if (key === "key" && this._app) {
  11482. this._app._ceVNode.key = val;
  11483. }
  11484. }
  11485. if (shouldUpdate && this._instance) {
  11486. this._update();
  11487. }
  11488. if (shouldReflect) {
  11489. if (val === true) {
  11490. this.setAttribute(hyphenate(key), "");
  11491. } else if (typeof val === "string" || typeof val === "number") {
  11492. this.setAttribute(hyphenate(key), val + "");
  11493. } else if (!val) {
  11494. this.removeAttribute(hyphenate(key));
  11495. }
  11496. }
  11497. }
  11498. }
  11499. _update() {
  11500. render(this._createVNode(), this._root);
  11501. }
  11502. _createVNode() {
  11503. const baseProps = {};
  11504. if (!this.shadowRoot) {
  11505. baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
  11506. }
  11507. const vnode = createVNode(this._def, extend(baseProps, this._props));
  11508. if (!this._instance) {
  11509. vnode.ce = (instance) => {
  11510. this._instance = instance;
  11511. instance.ce = this;
  11512. instance.isCE = true;
  11513. {
  11514. instance.ceReload = (newStyles) => {
  11515. if (this._styles) {
  11516. this._styles.forEach((s) => this._root.removeChild(s));
  11517. this._styles.length = 0;
  11518. }
  11519. this._applyStyles(newStyles);
  11520. this._instance = null;
  11521. this._update();
  11522. };
  11523. }
  11524. const dispatch = (event, args) => {
  11525. this.dispatchEvent(
  11526. new CustomEvent(
  11527. event,
  11528. isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
  11529. )
  11530. );
  11531. };
  11532. instance.emit = (event, ...args) => {
  11533. dispatch(event, args);
  11534. if (hyphenate(event) !== event) {
  11535. dispatch(hyphenate(event), args);
  11536. }
  11537. };
  11538. this._setParent();
  11539. };
  11540. }
  11541. return vnode;
  11542. }
  11543. _applyStyles(styles, owner) {
  11544. if (!styles) return;
  11545. if (owner) {
  11546. if (owner === this._def || this._styleChildren.has(owner)) {
  11547. return;
  11548. }
  11549. this._styleChildren.add(owner);
  11550. }
  11551. const nonce = this._nonce;
  11552. for (let i = styles.length - 1; i >= 0; i--) {
  11553. const s = document.createElement("style");
  11554. if (nonce) s.setAttribute("nonce", nonce);
  11555. s.textContent = styles[i];
  11556. this.shadowRoot.prepend(s);
  11557. {
  11558. if (owner) {
  11559. if (owner.__hmrId) {
  11560. if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
  11561. let entry = this._childStyles.get(owner.__hmrId);
  11562. if (!entry) {
  11563. this._childStyles.set(owner.__hmrId, entry = []);
  11564. }
  11565. entry.push(s);
  11566. }
  11567. } else {
  11568. (this._styles || (this._styles = [])).push(s);
  11569. }
  11570. }
  11571. }
  11572. }
  11573. /**
  11574. * Only called when shadowRoot is false
  11575. */
  11576. _parseSlots() {
  11577. const slots = this._slots = {};
  11578. let n;
  11579. while (n = this.firstChild) {
  11580. const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
  11581. (slots[slotName] || (slots[slotName] = [])).push(n);
  11582. this.removeChild(n);
  11583. }
  11584. }
  11585. /**
  11586. * Only called when shadowRoot is false
  11587. */
  11588. _renderSlots() {
  11589. const outlets = (this._teleportTarget || this).querySelectorAll("slot");
  11590. const scopeId = this._instance.type.__scopeId;
  11591. for (let i = 0; i < outlets.length; i++) {
  11592. const o = outlets[i];
  11593. const slotName = o.getAttribute("name") || "default";
  11594. const content = this._slots[slotName];
  11595. const parent = o.parentNode;
  11596. if (content) {
  11597. for (const n of content) {
  11598. if (scopeId && n.nodeType === 1) {
  11599. const id = scopeId + "-s";
  11600. const walker = document.createTreeWalker(n, 1);
  11601. n.setAttribute(id, "");
  11602. let child;
  11603. while (child = walker.nextNode()) {
  11604. child.setAttribute(id, "");
  11605. }
  11606. }
  11607. parent.insertBefore(n, o);
  11608. }
  11609. } else {
  11610. while (o.firstChild) parent.insertBefore(o.firstChild, o);
  11611. }
  11612. parent.removeChild(o);
  11613. }
  11614. }
  11615. /**
  11616. * @internal
  11617. */
  11618. _injectChildStyle(comp) {
  11619. this._applyStyles(comp.styles, comp);
  11620. }
  11621. /**
  11622. * @internal
  11623. */
  11624. _removeChildStyle(comp) {
  11625. {
  11626. this._styleChildren.delete(comp);
  11627. if (this._childStyles && comp.__hmrId) {
  11628. const oldStyles = this._childStyles.get(comp.__hmrId);
  11629. if (oldStyles) {
  11630. oldStyles.forEach((s) => this._root.removeChild(s));
  11631. oldStyles.length = 0;
  11632. }
  11633. }
  11634. }
  11635. }
  11636. }
  11637. function useHost(caller) {
  11638. const instance = getCurrentInstance();
  11639. const el = instance && instance.ce;
  11640. if (el) {
  11641. return el;
  11642. } else {
  11643. if (!instance) {
  11644. warn(
  11645. `${caller || "useHost"} called without an active component instance.`
  11646. );
  11647. } else {
  11648. warn(
  11649. `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
  11650. );
  11651. }
  11652. }
  11653. return null;
  11654. }
  11655. function useShadowRoot() {
  11656. const el = useHost("useShadowRoot") ;
  11657. return el && el.shadowRoot;
  11658. }
  11659. function useCssModule(name = "$style") {
  11660. {
  11661. const instance = getCurrentInstance();
  11662. if (!instance) {
  11663. warn(`useCssModule must be called inside setup()`);
  11664. return EMPTY_OBJ;
  11665. }
  11666. const modules = instance.type.__cssModules;
  11667. if (!modules) {
  11668. warn(`Current instance does not have CSS modules injected.`);
  11669. return EMPTY_OBJ;
  11670. }
  11671. const mod = modules[name];
  11672. if (!mod) {
  11673. warn(`Current instance does not have CSS module named "${name}".`);
  11674. return EMPTY_OBJ;
  11675. }
  11676. return mod;
  11677. }
  11678. }
  11679. const positionMap = /* @__PURE__ */ new WeakMap();
  11680. const newPositionMap = /* @__PURE__ */ new WeakMap();
  11681. const moveCbKey = Symbol("_moveCb");
  11682. const enterCbKey = Symbol("_enterCb");
  11683. const decorate = (t) => {
  11684. delete t.props.mode;
  11685. return t;
  11686. };
  11687. const TransitionGroupImpl = /* @__PURE__ */ decorate({
  11688. name: "TransitionGroup",
  11689. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  11690. tag: String,
  11691. moveClass: String
  11692. }),
  11693. setup(props, { slots }) {
  11694. const instance = getCurrentInstance();
  11695. const state = useTransitionState();
  11696. let prevChildren;
  11697. let children;
  11698. onUpdated(() => {
  11699. if (!prevChildren.length) {
  11700. return;
  11701. }
  11702. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  11703. if (!hasCSSTransform(
  11704. prevChildren[0].el,
  11705. instance.vnode.el,
  11706. moveClass
  11707. )) {
  11708. return;
  11709. }
  11710. prevChildren.forEach(callPendingCbs);
  11711. prevChildren.forEach(recordPosition);
  11712. const movedChildren = prevChildren.filter(applyTranslation);
  11713. forceReflow();
  11714. movedChildren.forEach((c) => {
  11715. const el = c.el;
  11716. const style = el.style;
  11717. addTransitionClass(el, moveClass);
  11718. style.transform = style.webkitTransform = style.transitionDuration = "";
  11719. const cb = el[moveCbKey] = (e) => {
  11720. if (e && e.target !== el) {
  11721. return;
  11722. }
  11723. if (!e || /transform$/.test(e.propertyName)) {
  11724. el.removeEventListener("transitionend", cb);
  11725. el[moveCbKey] = null;
  11726. removeTransitionClass(el, moveClass);
  11727. }
  11728. };
  11729. el.addEventListener("transitionend", cb);
  11730. });
  11731. });
  11732. return () => {
  11733. const rawProps = toRaw(props);
  11734. const cssTransitionProps = resolveTransitionProps(rawProps);
  11735. let tag = rawProps.tag || Fragment;
  11736. prevChildren = [];
  11737. if (children) {
  11738. for (let i = 0; i < children.length; i++) {
  11739. const child = children[i];
  11740. if (child.el && child.el instanceof Element) {
  11741. prevChildren.push(child);
  11742. setTransitionHooks(
  11743. child,
  11744. resolveTransitionHooks(
  11745. child,
  11746. cssTransitionProps,
  11747. state,
  11748. instance
  11749. )
  11750. );
  11751. positionMap.set(
  11752. child,
  11753. child.el.getBoundingClientRect()
  11754. );
  11755. }
  11756. }
  11757. }
  11758. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  11759. for (let i = 0; i < children.length; i++) {
  11760. const child = children[i];
  11761. if (child.key != null) {
  11762. setTransitionHooks(
  11763. child,
  11764. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  11765. );
  11766. } else if (child.type !== Text) {
  11767. warn(`<TransitionGroup> children must be keyed.`);
  11768. }
  11769. }
  11770. return createVNode(tag, null, children);
  11771. };
  11772. }
  11773. });
  11774. const TransitionGroup = TransitionGroupImpl;
  11775. function callPendingCbs(c) {
  11776. const el = c.el;
  11777. if (el[moveCbKey]) {
  11778. el[moveCbKey]();
  11779. }
  11780. if (el[enterCbKey]) {
  11781. el[enterCbKey]();
  11782. }
  11783. }
  11784. function recordPosition(c) {
  11785. newPositionMap.set(c, c.el.getBoundingClientRect());
  11786. }
  11787. function applyTranslation(c) {
  11788. const oldPos = positionMap.get(c);
  11789. const newPos = newPositionMap.get(c);
  11790. const dx = oldPos.left - newPos.left;
  11791. const dy = oldPos.top - newPos.top;
  11792. if (dx || dy) {
  11793. const s = c.el.style;
  11794. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  11795. s.transitionDuration = "0s";
  11796. return c;
  11797. }
  11798. }
  11799. function hasCSSTransform(el, root, moveClass) {
  11800. const clone = el.cloneNode();
  11801. const _vtc = el[vtcKey];
  11802. if (_vtc) {
  11803. _vtc.forEach((cls) => {
  11804. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  11805. });
  11806. }
  11807. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  11808. clone.style.display = "none";
  11809. const container = root.nodeType === 1 ? root : root.parentNode;
  11810. container.appendChild(clone);
  11811. const { hasTransform } = getTransitionInfo(clone);
  11812. container.removeChild(clone);
  11813. return hasTransform;
  11814. }
  11815. const getModelAssigner = (vnode) => {
  11816. const fn = vnode.props["onUpdate:modelValue"] || false;
  11817. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  11818. };
  11819. function onCompositionStart(e) {
  11820. e.target.composing = true;
  11821. }
  11822. function onCompositionEnd(e) {
  11823. const target = e.target;
  11824. if (target.composing) {
  11825. target.composing = false;
  11826. target.dispatchEvent(new Event("input"));
  11827. }
  11828. }
  11829. const assignKey = Symbol("_assign");
  11830. const vModelText = {
  11831. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  11832. el[assignKey] = getModelAssigner(vnode);
  11833. const castToNumber = number || vnode.props && vnode.props.type === "number";
  11834. addEventListener(el, lazy ? "change" : "input", (e) => {
  11835. if (e.target.composing) return;
  11836. let domValue = el.value;
  11837. if (trim) {
  11838. domValue = domValue.trim();
  11839. }
  11840. if (castToNumber) {
  11841. domValue = looseToNumber(domValue);
  11842. }
  11843. el[assignKey](domValue);
  11844. });
  11845. if (trim) {
  11846. addEventListener(el, "change", () => {
  11847. el.value = el.value.trim();
  11848. });
  11849. }
  11850. if (!lazy) {
  11851. addEventListener(el, "compositionstart", onCompositionStart);
  11852. addEventListener(el, "compositionend", onCompositionEnd);
  11853. addEventListener(el, "change", onCompositionEnd);
  11854. }
  11855. },
  11856. // set value on mounted so it's after min/max for type="range"
  11857. mounted(el, { value }) {
  11858. el.value = value == null ? "" : value;
  11859. },
  11860. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  11861. el[assignKey] = getModelAssigner(vnode);
  11862. if (el.composing) return;
  11863. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  11864. const newValue = value == null ? "" : value;
  11865. if (elValue === newValue) {
  11866. return;
  11867. }
  11868. if (document.activeElement === el && el.type !== "range") {
  11869. if (lazy && value === oldValue) {
  11870. return;
  11871. }
  11872. if (trim && el.value.trim() === newValue) {
  11873. return;
  11874. }
  11875. }
  11876. el.value = newValue;
  11877. }
  11878. };
  11879. const vModelCheckbox = {
  11880. // #4096 array checkboxes need to be deep traversed
  11881. deep: true,
  11882. created(el, _, vnode) {
  11883. el[assignKey] = getModelAssigner(vnode);
  11884. addEventListener(el, "change", () => {
  11885. const modelValue = el._modelValue;
  11886. const elementValue = getValue(el);
  11887. const checked = el.checked;
  11888. const assign = el[assignKey];
  11889. if (isArray(modelValue)) {
  11890. const index = looseIndexOf(modelValue, elementValue);
  11891. const found = index !== -1;
  11892. if (checked && !found) {
  11893. assign(modelValue.concat(elementValue));
  11894. } else if (!checked && found) {
  11895. const filtered = [...modelValue];
  11896. filtered.splice(index, 1);
  11897. assign(filtered);
  11898. }
  11899. } else if (isSet(modelValue)) {
  11900. const cloned = new Set(modelValue);
  11901. if (checked) {
  11902. cloned.add(elementValue);
  11903. } else {
  11904. cloned.delete(elementValue);
  11905. }
  11906. assign(cloned);
  11907. } else {
  11908. assign(getCheckboxValue(el, checked));
  11909. }
  11910. });
  11911. },
  11912. // set initial checked on mount to wait for true-value/false-value
  11913. mounted: setChecked,
  11914. beforeUpdate(el, binding, vnode) {
  11915. el[assignKey] = getModelAssigner(vnode);
  11916. setChecked(el, binding, vnode);
  11917. }
  11918. };
  11919. function setChecked(el, { value, oldValue }, vnode) {
  11920. el._modelValue = value;
  11921. let checked;
  11922. if (isArray(value)) {
  11923. checked = looseIndexOf(value, vnode.props.value) > -1;
  11924. } else if (isSet(value)) {
  11925. checked = value.has(vnode.props.value);
  11926. } else {
  11927. if (value === oldValue) return;
  11928. checked = looseEqual(value, getCheckboxValue(el, true));
  11929. }
  11930. if (el.checked !== checked) {
  11931. el.checked = checked;
  11932. }
  11933. }
  11934. const vModelRadio = {
  11935. created(el, { value }, vnode) {
  11936. el.checked = looseEqual(value, vnode.props.value);
  11937. el[assignKey] = getModelAssigner(vnode);
  11938. addEventListener(el, "change", () => {
  11939. el[assignKey](getValue(el));
  11940. });
  11941. },
  11942. beforeUpdate(el, { value, oldValue }, vnode) {
  11943. el[assignKey] = getModelAssigner(vnode);
  11944. if (value !== oldValue) {
  11945. el.checked = looseEqual(value, vnode.props.value);
  11946. }
  11947. }
  11948. };
  11949. const vModelSelect = {
  11950. // <select multiple> value need to be deep traversed
  11951. deep: true,
  11952. created(el, { value, modifiers: { number } }, vnode) {
  11953. const isSetModel = isSet(value);
  11954. addEventListener(el, "change", () => {
  11955. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  11956. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  11957. );
  11958. el[assignKey](
  11959. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  11960. );
  11961. el._assigning = true;
  11962. nextTick(() => {
  11963. el._assigning = false;
  11964. });
  11965. });
  11966. el[assignKey] = getModelAssigner(vnode);
  11967. },
  11968. // set value in mounted & updated because <select> relies on its children
  11969. // <option>s.
  11970. mounted(el, { value }) {
  11971. setSelected(el, value);
  11972. },
  11973. beforeUpdate(el, _binding, vnode) {
  11974. el[assignKey] = getModelAssigner(vnode);
  11975. },
  11976. updated(el, { value }) {
  11977. if (!el._assigning) {
  11978. setSelected(el, value);
  11979. }
  11980. }
  11981. };
  11982. function setSelected(el, value) {
  11983. const isMultiple = el.multiple;
  11984. const isArrayValue = isArray(value);
  11985. if (isMultiple && !isArrayValue && !isSet(value)) {
  11986. warn(
  11987. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  11988. );
  11989. return;
  11990. }
  11991. for (let i = 0, l = el.options.length; i < l; i++) {
  11992. const option = el.options[i];
  11993. const optionValue = getValue(option);
  11994. if (isMultiple) {
  11995. if (isArrayValue) {
  11996. const optionType = typeof optionValue;
  11997. if (optionType === "string" || optionType === "number") {
  11998. option.selected = value.some((v) => String(v) === String(optionValue));
  11999. } else {
  12000. option.selected = looseIndexOf(value, optionValue) > -1;
  12001. }
  12002. } else {
  12003. option.selected = value.has(optionValue);
  12004. }
  12005. } else if (looseEqual(getValue(option), value)) {
  12006. if (el.selectedIndex !== i) el.selectedIndex = i;
  12007. return;
  12008. }
  12009. }
  12010. if (!isMultiple && el.selectedIndex !== -1) {
  12011. el.selectedIndex = -1;
  12012. }
  12013. }
  12014. function getValue(el) {
  12015. return "_value" in el ? el._value : el.value;
  12016. }
  12017. function getCheckboxValue(el, checked) {
  12018. const key = checked ? "_trueValue" : "_falseValue";
  12019. return key in el ? el[key] : checked;
  12020. }
  12021. const vModelDynamic = {
  12022. created(el, binding, vnode) {
  12023. callModelHook(el, binding, vnode, null, "created");
  12024. },
  12025. mounted(el, binding, vnode) {
  12026. callModelHook(el, binding, vnode, null, "mounted");
  12027. },
  12028. beforeUpdate(el, binding, vnode, prevVNode) {
  12029. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  12030. },
  12031. updated(el, binding, vnode, prevVNode) {
  12032. callModelHook(el, binding, vnode, prevVNode, "updated");
  12033. }
  12034. };
  12035. function resolveDynamicModel(tagName, type) {
  12036. switch (tagName) {
  12037. case "SELECT":
  12038. return vModelSelect;
  12039. case "TEXTAREA":
  12040. return vModelText;
  12041. default:
  12042. switch (type) {
  12043. case "checkbox":
  12044. return vModelCheckbox;
  12045. case "radio":
  12046. return vModelRadio;
  12047. default:
  12048. return vModelText;
  12049. }
  12050. }
  12051. }
  12052. function callModelHook(el, binding, vnode, prevVNode, hook) {
  12053. const modelToUse = resolveDynamicModel(
  12054. el.tagName,
  12055. vnode.props && vnode.props.type
  12056. );
  12057. const fn = modelToUse[hook];
  12058. fn && fn(el, binding, vnode, prevVNode);
  12059. }
  12060. function initVModelForSSR() {
  12061. vModelText.getSSRProps = ({ value }) => ({ value });
  12062. vModelRadio.getSSRProps = ({ value }, vnode) => {
  12063. if (vnode.props && looseEqual(vnode.props.value, value)) {
  12064. return { checked: true };
  12065. }
  12066. };
  12067. vModelCheckbox.getSSRProps = ({ value }, vnode) => {
  12068. if (isArray(value)) {
  12069. if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
  12070. return { checked: true };
  12071. }
  12072. } else if (isSet(value)) {
  12073. if (vnode.props && value.has(vnode.props.value)) {
  12074. return { checked: true };
  12075. }
  12076. } else if (value) {
  12077. return { checked: true };
  12078. }
  12079. };
  12080. vModelDynamic.getSSRProps = (binding, vnode) => {
  12081. if (typeof vnode.type !== "string") {
  12082. return;
  12083. }
  12084. const modelToUse = resolveDynamicModel(
  12085. // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
  12086. vnode.type.toUpperCase(),
  12087. vnode.props && vnode.props.type
  12088. );
  12089. if (modelToUse.getSSRProps) {
  12090. return modelToUse.getSSRProps(binding, vnode);
  12091. }
  12092. };
  12093. }
  12094. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  12095. const modifierGuards = {
  12096. stop: (e) => e.stopPropagation(),
  12097. prevent: (e) => e.preventDefault(),
  12098. self: (e) => e.target !== e.currentTarget,
  12099. ctrl: (e) => !e.ctrlKey,
  12100. shift: (e) => !e.shiftKey,
  12101. alt: (e) => !e.altKey,
  12102. meta: (e) => !e.metaKey,
  12103. left: (e) => "button" in e && e.button !== 0,
  12104. middle: (e) => "button" in e && e.button !== 1,
  12105. right: (e) => "button" in e && e.button !== 2,
  12106. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  12107. };
  12108. const withModifiers = (fn, modifiers) => {
  12109. const cache = fn._withMods || (fn._withMods = {});
  12110. const cacheKey = modifiers.join(".");
  12111. return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
  12112. for (let i = 0; i < modifiers.length; i++) {
  12113. const guard = modifierGuards[modifiers[i]];
  12114. if (guard && guard(event, modifiers)) return;
  12115. }
  12116. return fn(event, ...args);
  12117. });
  12118. };
  12119. const keyNames = {
  12120. esc: "escape",
  12121. space: " ",
  12122. up: "arrow-up",
  12123. left: "arrow-left",
  12124. right: "arrow-right",
  12125. down: "arrow-down",
  12126. delete: "backspace"
  12127. };
  12128. const withKeys = (fn, modifiers) => {
  12129. const cache = fn._withKeys || (fn._withKeys = {});
  12130. const cacheKey = modifiers.join(".");
  12131. return cache[cacheKey] || (cache[cacheKey] = (event) => {
  12132. if (!("key" in event)) {
  12133. return;
  12134. }
  12135. const eventKey = hyphenate(event.key);
  12136. if (modifiers.some(
  12137. (k) => k === eventKey || keyNames[k] === eventKey
  12138. )) {
  12139. return fn(event);
  12140. }
  12141. });
  12142. };
  12143. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  12144. let renderer;
  12145. let enabledHydration = false;
  12146. function ensureRenderer() {
  12147. return renderer || (renderer = createRenderer(rendererOptions));
  12148. }
  12149. function ensureHydrationRenderer() {
  12150. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  12151. enabledHydration = true;
  12152. return renderer;
  12153. }
  12154. const render = (...args) => {
  12155. ensureRenderer().render(...args);
  12156. };
  12157. const hydrate = (...args) => {
  12158. ensureHydrationRenderer().hydrate(...args);
  12159. };
  12160. const createApp = (...args) => {
  12161. const app = ensureRenderer().createApp(...args);
  12162. {
  12163. injectNativeTagCheck(app);
  12164. injectCompilerOptionsCheck(app);
  12165. }
  12166. const { mount } = app;
  12167. app.mount = (containerOrSelector) => {
  12168. const container = normalizeContainer(containerOrSelector);
  12169. if (!container) return;
  12170. const component = app._component;
  12171. if (!isFunction(component) && !component.render && !component.template) {
  12172. component.template = container.innerHTML;
  12173. }
  12174. if (container.nodeType === 1) {
  12175. container.textContent = "";
  12176. }
  12177. const proxy = mount(container, false, resolveRootNamespace(container));
  12178. if (container instanceof Element) {
  12179. container.removeAttribute("v-cloak");
  12180. container.setAttribute("data-v-app", "");
  12181. }
  12182. return proxy;
  12183. };
  12184. return app;
  12185. };
  12186. const createSSRApp = (...args) => {
  12187. const app = ensureHydrationRenderer().createApp(...args);
  12188. {
  12189. injectNativeTagCheck(app);
  12190. injectCompilerOptionsCheck(app);
  12191. }
  12192. const { mount } = app;
  12193. app.mount = (containerOrSelector) => {
  12194. const container = normalizeContainer(containerOrSelector);
  12195. if (container) {
  12196. return mount(container, true, resolveRootNamespace(container));
  12197. }
  12198. };
  12199. return app;
  12200. };
  12201. function resolveRootNamespace(container) {
  12202. if (container instanceof SVGElement) {
  12203. return "svg";
  12204. }
  12205. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  12206. return "mathml";
  12207. }
  12208. }
  12209. function injectNativeTagCheck(app) {
  12210. Object.defineProperty(app.config, "isNativeTag", {
  12211. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  12212. writable: false
  12213. });
  12214. }
  12215. function injectCompilerOptionsCheck(app) {
  12216. if (isRuntimeOnly()) {
  12217. const isCustomElement = app.config.isCustomElement;
  12218. Object.defineProperty(app.config, "isCustomElement", {
  12219. get() {
  12220. return isCustomElement;
  12221. },
  12222. set() {
  12223. warn(
  12224. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  12225. );
  12226. }
  12227. });
  12228. const compilerOptions = app.config.compilerOptions;
  12229. 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.
  12230. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  12231. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  12232. - 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`;
  12233. Object.defineProperty(app.config, "compilerOptions", {
  12234. get() {
  12235. warn(msg);
  12236. return compilerOptions;
  12237. },
  12238. set() {
  12239. warn(msg);
  12240. }
  12241. });
  12242. }
  12243. }
  12244. function normalizeContainer(container) {
  12245. if (isString(container)) {
  12246. const res = document.querySelector(container);
  12247. if (!res) {
  12248. warn(
  12249. `Failed to mount app: mount target selector "${container}" returned null.`
  12250. );
  12251. }
  12252. return res;
  12253. }
  12254. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  12255. warn(
  12256. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  12257. );
  12258. }
  12259. return container;
  12260. }
  12261. let ssrDirectiveInitialized = false;
  12262. const initDirectivesForSSR = () => {
  12263. if (!ssrDirectiveInitialized) {
  12264. ssrDirectiveInitialized = true;
  12265. initVModelForSSR();
  12266. initVShowForSSR();
  12267. }
  12268. } ;
  12269. var runtimeDom = /*#__PURE__*/Object.freeze({
  12270. __proto__: null,
  12271. BaseTransition: BaseTransition,
  12272. BaseTransitionPropsValidators: BaseTransitionPropsValidators,
  12273. Comment: Comment,
  12274. DeprecationTypes: DeprecationTypes,
  12275. EffectScope: EffectScope,
  12276. ErrorCodes: ErrorCodes,
  12277. ErrorTypeStrings: ErrorTypeStrings,
  12278. Fragment: Fragment,
  12279. KeepAlive: KeepAlive,
  12280. ReactiveEffect: ReactiveEffect,
  12281. Static: Static,
  12282. Suspense: Suspense,
  12283. Teleport: Teleport,
  12284. Text: Text,
  12285. TrackOpTypes: TrackOpTypes,
  12286. Transition: Transition,
  12287. TransitionGroup: TransitionGroup,
  12288. TriggerOpTypes: TriggerOpTypes,
  12289. VueElement: VueElement,
  12290. assertNumber: assertNumber,
  12291. callWithAsyncErrorHandling: callWithAsyncErrorHandling,
  12292. callWithErrorHandling: callWithErrorHandling,
  12293. camelize: camelize,
  12294. capitalize: capitalize,
  12295. cloneVNode: cloneVNode,
  12296. compatUtils: compatUtils,
  12297. computed: computed,
  12298. createApp: createApp,
  12299. createBlock: createBlock,
  12300. createCommentVNode: createCommentVNode,
  12301. createElementBlock: createElementBlock,
  12302. createElementVNode: createBaseVNode,
  12303. createHydrationRenderer: createHydrationRenderer,
  12304. createPropsRestProxy: createPropsRestProxy,
  12305. createRenderer: createRenderer,
  12306. createSSRApp: createSSRApp,
  12307. createSlots: createSlots,
  12308. createStaticVNode: createStaticVNode,
  12309. createTextVNode: createTextVNode,
  12310. createVNode: createVNode,
  12311. customRef: customRef,
  12312. defineAsyncComponent: defineAsyncComponent,
  12313. defineComponent: defineComponent,
  12314. defineCustomElement: defineCustomElement,
  12315. defineEmits: defineEmits,
  12316. defineExpose: defineExpose,
  12317. defineModel: defineModel,
  12318. defineOptions: defineOptions,
  12319. defineProps: defineProps,
  12320. defineSSRCustomElement: defineSSRCustomElement,
  12321. defineSlots: defineSlots,
  12322. devtools: devtools,
  12323. effect: effect,
  12324. effectScope: effectScope,
  12325. getCurrentInstance: getCurrentInstance,
  12326. getCurrentScope: getCurrentScope,
  12327. getCurrentWatcher: getCurrentWatcher,
  12328. getTransitionRawChildren: getTransitionRawChildren,
  12329. guardReactiveProps: guardReactiveProps,
  12330. h: h,
  12331. handleError: handleError,
  12332. hasInjectionContext: hasInjectionContext,
  12333. hydrate: hydrate,
  12334. hydrateOnIdle: hydrateOnIdle,
  12335. hydrateOnInteraction: hydrateOnInteraction,
  12336. hydrateOnMediaQuery: hydrateOnMediaQuery,
  12337. hydrateOnVisible: hydrateOnVisible,
  12338. initCustomFormatter: initCustomFormatter,
  12339. initDirectivesForSSR: initDirectivesForSSR,
  12340. inject: inject,
  12341. isMemoSame: isMemoSame,
  12342. isProxy: isProxy,
  12343. isReactive: isReactive,
  12344. isReadonly: isReadonly,
  12345. isRef: isRef,
  12346. isRuntimeOnly: isRuntimeOnly,
  12347. isShallow: isShallow,
  12348. isVNode: isVNode,
  12349. markRaw: markRaw,
  12350. mergeDefaults: mergeDefaults,
  12351. mergeModels: mergeModels,
  12352. mergeProps: mergeProps,
  12353. nextTick: nextTick,
  12354. normalizeClass: normalizeClass,
  12355. normalizeProps: normalizeProps,
  12356. normalizeStyle: normalizeStyle,
  12357. onActivated: onActivated,
  12358. onBeforeMount: onBeforeMount,
  12359. onBeforeUnmount: onBeforeUnmount,
  12360. onBeforeUpdate: onBeforeUpdate,
  12361. onDeactivated: onDeactivated,
  12362. onErrorCaptured: onErrorCaptured,
  12363. onMounted: onMounted,
  12364. onRenderTracked: onRenderTracked,
  12365. onRenderTriggered: onRenderTriggered,
  12366. onScopeDispose: onScopeDispose,
  12367. onServerPrefetch: onServerPrefetch,
  12368. onUnmounted: onUnmounted,
  12369. onUpdated: onUpdated,
  12370. onWatcherCleanup: onWatcherCleanup,
  12371. openBlock: openBlock,
  12372. popScopeId: popScopeId,
  12373. provide: provide,
  12374. proxyRefs: proxyRefs,
  12375. pushScopeId: pushScopeId,
  12376. queuePostFlushCb: queuePostFlushCb,
  12377. reactive: reactive,
  12378. readonly: readonly,
  12379. ref: ref,
  12380. registerRuntimeCompiler: registerRuntimeCompiler,
  12381. render: render,
  12382. renderList: renderList,
  12383. renderSlot: renderSlot,
  12384. resolveComponent: resolveComponent,
  12385. resolveDirective: resolveDirective,
  12386. resolveDynamicComponent: resolveDynamicComponent,
  12387. resolveFilter: resolveFilter,
  12388. resolveTransitionHooks: resolveTransitionHooks,
  12389. setBlockTracking: setBlockTracking,
  12390. setDevtoolsHook: setDevtoolsHook,
  12391. setTransitionHooks: setTransitionHooks,
  12392. shallowReactive: shallowReactive,
  12393. shallowReadonly: shallowReadonly,
  12394. shallowRef: shallowRef,
  12395. ssrContextKey: ssrContextKey,
  12396. ssrUtils: ssrUtils,
  12397. stop: stop,
  12398. toDisplayString: toDisplayString,
  12399. toHandlerKey: toHandlerKey,
  12400. toHandlers: toHandlers,
  12401. toRaw: toRaw,
  12402. toRef: toRef,
  12403. toRefs: toRefs,
  12404. toValue: toValue,
  12405. transformVNodeArgs: transformVNodeArgs,
  12406. triggerRef: triggerRef,
  12407. unref: unref,
  12408. useAttrs: useAttrs,
  12409. useCssModule: useCssModule,
  12410. useCssVars: useCssVars,
  12411. useHost: useHost,
  12412. useId: useId,
  12413. useModel: useModel,
  12414. useSSRContext: useSSRContext,
  12415. useShadowRoot: useShadowRoot,
  12416. useSlots: useSlots,
  12417. useTemplateRef: useTemplateRef,
  12418. useTransitionState: useTransitionState,
  12419. vModelCheckbox: vModelCheckbox,
  12420. vModelDynamic: vModelDynamic,
  12421. vModelRadio: vModelRadio,
  12422. vModelSelect: vModelSelect,
  12423. vModelText: vModelText,
  12424. vShow: vShow,
  12425. version: version,
  12426. warn: warn,
  12427. watch: watch,
  12428. watchEffect: watchEffect,
  12429. watchPostEffect: watchPostEffect,
  12430. watchSyncEffect: watchSyncEffect,
  12431. withAsyncContext: withAsyncContext,
  12432. withCtx: withCtx,
  12433. withDefaults: withDefaults,
  12434. withDirectives: withDirectives,
  12435. withKeys: withKeys,
  12436. withMemo: withMemo,
  12437. withModifiers: withModifiers,
  12438. withScopeId: withScopeId
  12439. });
  12440. function initDev() {
  12441. {
  12442. {
  12443. console.info(
  12444. `You are running a development build of Vue.
  12445. Make sure to use the production build (*.prod.js) when deploying for production.`
  12446. );
  12447. }
  12448. initCustomFormatter();
  12449. }
  12450. }
  12451. const FRAGMENT = Symbol(`Fragment` );
  12452. const TELEPORT = Symbol(`Teleport` );
  12453. const SUSPENSE = Symbol(`Suspense` );
  12454. const KEEP_ALIVE = Symbol(`KeepAlive` );
  12455. const BASE_TRANSITION = Symbol(
  12456. `BaseTransition`
  12457. );
  12458. const OPEN_BLOCK = Symbol(`openBlock` );
  12459. const CREATE_BLOCK = Symbol(`createBlock` );
  12460. const CREATE_ELEMENT_BLOCK = Symbol(
  12461. `createElementBlock`
  12462. );
  12463. const CREATE_VNODE = Symbol(`createVNode` );
  12464. const CREATE_ELEMENT_VNODE = Symbol(
  12465. `createElementVNode`
  12466. );
  12467. const CREATE_COMMENT = Symbol(
  12468. `createCommentVNode`
  12469. );
  12470. const CREATE_TEXT = Symbol(
  12471. `createTextVNode`
  12472. );
  12473. const CREATE_STATIC = Symbol(
  12474. `createStaticVNode`
  12475. );
  12476. const RESOLVE_COMPONENT = Symbol(
  12477. `resolveComponent`
  12478. );
  12479. const RESOLVE_DYNAMIC_COMPONENT = Symbol(
  12480. `resolveDynamicComponent`
  12481. );
  12482. const RESOLVE_DIRECTIVE = Symbol(
  12483. `resolveDirective`
  12484. );
  12485. const RESOLVE_FILTER = Symbol(
  12486. `resolveFilter`
  12487. );
  12488. const WITH_DIRECTIVES = Symbol(
  12489. `withDirectives`
  12490. );
  12491. const RENDER_LIST = Symbol(`renderList` );
  12492. const RENDER_SLOT = Symbol(`renderSlot` );
  12493. const CREATE_SLOTS = Symbol(`createSlots` );
  12494. const TO_DISPLAY_STRING = Symbol(
  12495. `toDisplayString`
  12496. );
  12497. const MERGE_PROPS = Symbol(`mergeProps` );
  12498. const NORMALIZE_CLASS = Symbol(
  12499. `normalizeClass`
  12500. );
  12501. const NORMALIZE_STYLE = Symbol(
  12502. `normalizeStyle`
  12503. );
  12504. const NORMALIZE_PROPS = Symbol(
  12505. `normalizeProps`
  12506. );
  12507. const GUARD_REACTIVE_PROPS = Symbol(
  12508. `guardReactiveProps`
  12509. );
  12510. const TO_HANDLERS = Symbol(`toHandlers` );
  12511. const CAMELIZE = Symbol(`camelize` );
  12512. const CAPITALIZE = Symbol(`capitalize` );
  12513. const TO_HANDLER_KEY = Symbol(
  12514. `toHandlerKey`
  12515. );
  12516. const SET_BLOCK_TRACKING = Symbol(
  12517. `setBlockTracking`
  12518. );
  12519. const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
  12520. const POP_SCOPE_ID = Symbol(`popScopeId` );
  12521. const WITH_CTX = Symbol(`withCtx` );
  12522. const UNREF = Symbol(`unref` );
  12523. const IS_REF = Symbol(`isRef` );
  12524. const WITH_MEMO = Symbol(`withMemo` );
  12525. const IS_MEMO_SAME = Symbol(`isMemoSame` );
  12526. const helperNameMap = {
  12527. [FRAGMENT]: `Fragment`,
  12528. [TELEPORT]: `Teleport`,
  12529. [SUSPENSE]: `Suspense`,
  12530. [KEEP_ALIVE]: `KeepAlive`,
  12531. [BASE_TRANSITION]: `BaseTransition`,
  12532. [OPEN_BLOCK]: `openBlock`,
  12533. [CREATE_BLOCK]: `createBlock`,
  12534. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  12535. [CREATE_VNODE]: `createVNode`,
  12536. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  12537. [CREATE_COMMENT]: `createCommentVNode`,
  12538. [CREATE_TEXT]: `createTextVNode`,
  12539. [CREATE_STATIC]: `createStaticVNode`,
  12540. [RESOLVE_COMPONENT]: `resolveComponent`,
  12541. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  12542. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  12543. [RESOLVE_FILTER]: `resolveFilter`,
  12544. [WITH_DIRECTIVES]: `withDirectives`,
  12545. [RENDER_LIST]: `renderList`,
  12546. [RENDER_SLOT]: `renderSlot`,
  12547. [CREATE_SLOTS]: `createSlots`,
  12548. [TO_DISPLAY_STRING]: `toDisplayString`,
  12549. [MERGE_PROPS]: `mergeProps`,
  12550. [NORMALIZE_CLASS]: `normalizeClass`,
  12551. [NORMALIZE_STYLE]: `normalizeStyle`,
  12552. [NORMALIZE_PROPS]: `normalizeProps`,
  12553. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  12554. [TO_HANDLERS]: `toHandlers`,
  12555. [CAMELIZE]: `camelize`,
  12556. [CAPITALIZE]: `capitalize`,
  12557. [TO_HANDLER_KEY]: `toHandlerKey`,
  12558. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  12559. [PUSH_SCOPE_ID]: `pushScopeId`,
  12560. [POP_SCOPE_ID]: `popScopeId`,
  12561. [WITH_CTX]: `withCtx`,
  12562. [UNREF]: `unref`,
  12563. [IS_REF]: `isRef`,
  12564. [WITH_MEMO]: `withMemo`,
  12565. [IS_MEMO_SAME]: `isMemoSame`
  12566. };
  12567. function registerRuntimeHelpers(helpers) {
  12568. Object.getOwnPropertySymbols(helpers).forEach((s) => {
  12569. helperNameMap[s] = helpers[s];
  12570. });
  12571. }
  12572. const locStub = {
  12573. start: { line: 1, column: 1, offset: 0 },
  12574. end: { line: 1, column: 1, offset: 0 },
  12575. source: ""
  12576. };
  12577. function createRoot(children, source = "") {
  12578. return {
  12579. type: 0,
  12580. source,
  12581. children,
  12582. helpers: /* @__PURE__ */ new Set(),
  12583. components: [],
  12584. directives: [],
  12585. hoists: [],
  12586. imports: [],
  12587. cached: [],
  12588. temps: 0,
  12589. codegenNode: void 0,
  12590. loc: locStub
  12591. };
  12592. }
  12593. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  12594. if (context) {
  12595. if (isBlock) {
  12596. context.helper(OPEN_BLOCK);
  12597. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  12598. } else {
  12599. context.helper(getVNodeHelper(context.inSSR, isComponent));
  12600. }
  12601. if (directives) {
  12602. context.helper(WITH_DIRECTIVES);
  12603. }
  12604. }
  12605. return {
  12606. type: 13,
  12607. tag,
  12608. props,
  12609. children,
  12610. patchFlag,
  12611. dynamicProps,
  12612. directives,
  12613. isBlock,
  12614. disableTracking,
  12615. isComponent,
  12616. loc
  12617. };
  12618. }
  12619. function createArrayExpression(elements, loc = locStub) {
  12620. return {
  12621. type: 17,
  12622. loc,
  12623. elements
  12624. };
  12625. }
  12626. function createObjectExpression(properties, loc = locStub) {
  12627. return {
  12628. type: 15,
  12629. loc,
  12630. properties
  12631. };
  12632. }
  12633. function createObjectProperty(key, value) {
  12634. return {
  12635. type: 16,
  12636. loc: locStub,
  12637. key: isString(key) ? createSimpleExpression(key, true) : key,
  12638. value
  12639. };
  12640. }
  12641. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
  12642. return {
  12643. type: 4,
  12644. loc,
  12645. content,
  12646. isStatic,
  12647. constType: isStatic ? 3 : constType
  12648. };
  12649. }
  12650. function createCompoundExpression(children, loc = locStub) {
  12651. return {
  12652. type: 8,
  12653. loc,
  12654. children
  12655. };
  12656. }
  12657. function createCallExpression(callee, args = [], loc = locStub) {
  12658. return {
  12659. type: 14,
  12660. loc,
  12661. callee,
  12662. arguments: args
  12663. };
  12664. }
  12665. function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
  12666. return {
  12667. type: 18,
  12668. params,
  12669. returns,
  12670. newline,
  12671. isSlot,
  12672. loc
  12673. };
  12674. }
  12675. function createConditionalExpression(test, consequent, alternate, newline = true) {
  12676. return {
  12677. type: 19,
  12678. test,
  12679. consequent,
  12680. alternate,
  12681. newline,
  12682. loc: locStub
  12683. };
  12684. }
  12685. function createCacheExpression(index, value, needPauseTracking = false) {
  12686. return {
  12687. type: 20,
  12688. index,
  12689. value,
  12690. needPauseTracking,
  12691. needArraySpread: false,
  12692. loc: locStub
  12693. };
  12694. }
  12695. function createBlockStatement(body) {
  12696. return {
  12697. type: 21,
  12698. body,
  12699. loc: locStub
  12700. };
  12701. }
  12702. function getVNodeHelper(ssr, isComponent) {
  12703. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  12704. }
  12705. function getVNodeBlockHelper(ssr, isComponent) {
  12706. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  12707. }
  12708. function convertToBlock(node, { helper, removeHelper, inSSR }) {
  12709. if (!node.isBlock) {
  12710. node.isBlock = true;
  12711. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  12712. helper(OPEN_BLOCK);
  12713. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  12714. }
  12715. }
  12716. const defaultDelimitersOpen = new Uint8Array([123, 123]);
  12717. const defaultDelimitersClose = new Uint8Array([125, 125]);
  12718. function isTagStartChar(c) {
  12719. return c >= 97 && c <= 122 || c >= 65 && c <= 90;
  12720. }
  12721. function isWhitespace(c) {
  12722. return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
  12723. }
  12724. function isEndOfTagSection(c) {
  12725. return c === 47 || c === 62 || isWhitespace(c);
  12726. }
  12727. function toCharCodes(str) {
  12728. const ret = new Uint8Array(str.length);
  12729. for (let i = 0; i < str.length; i++) {
  12730. ret[i] = str.charCodeAt(i);
  12731. }
  12732. return ret;
  12733. }
  12734. const Sequences = {
  12735. Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  12736. // CDATA[
  12737. CdataEnd: new Uint8Array([93, 93, 62]),
  12738. // ]]>
  12739. CommentEnd: new Uint8Array([45, 45, 62]),
  12740. // `-->`
  12741. ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  12742. // `<\/script`
  12743. StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  12744. // `</style`
  12745. TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  12746. // `</title`
  12747. TextareaEnd: new Uint8Array([
  12748. 60,
  12749. 47,
  12750. 116,
  12751. 101,
  12752. 120,
  12753. 116,
  12754. 97,
  12755. 114,
  12756. 101,
  12757. 97
  12758. ])
  12759. // `</textarea
  12760. };
  12761. class Tokenizer {
  12762. constructor(stack, cbs) {
  12763. this.stack = stack;
  12764. this.cbs = cbs;
  12765. /** The current state the tokenizer is in. */
  12766. this.state = 1;
  12767. /** The read buffer. */
  12768. this.buffer = "";
  12769. /** The beginning of the section that is currently being read. */
  12770. this.sectionStart = 0;
  12771. /** The index within the buffer that we are currently looking at. */
  12772. this.index = 0;
  12773. /** The start of the last entity. */
  12774. this.entityStart = 0;
  12775. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  12776. this.baseState = 1;
  12777. /** For special parsing behavior inside of script and style tags. */
  12778. this.inRCDATA = false;
  12779. /** For disabling RCDATA tags handling */
  12780. this.inXML = false;
  12781. /** For disabling interpolation parsing in v-pre */
  12782. this.inVPre = false;
  12783. /** Record newline positions for fast line / column calculation */
  12784. this.newlines = [];
  12785. this.mode = 0;
  12786. this.delimiterOpen = defaultDelimitersOpen;
  12787. this.delimiterClose = defaultDelimitersClose;
  12788. this.delimiterIndex = -1;
  12789. this.currentSequence = void 0;
  12790. this.sequenceIndex = 0;
  12791. }
  12792. get inSFCRoot() {
  12793. return this.mode === 2 && this.stack.length === 0;
  12794. }
  12795. reset() {
  12796. this.state = 1;
  12797. this.mode = 0;
  12798. this.buffer = "";
  12799. this.sectionStart = 0;
  12800. this.index = 0;
  12801. this.baseState = 1;
  12802. this.inRCDATA = false;
  12803. this.currentSequence = void 0;
  12804. this.newlines.length = 0;
  12805. this.delimiterOpen = defaultDelimitersOpen;
  12806. this.delimiterClose = defaultDelimitersClose;
  12807. }
  12808. /**
  12809. * Generate Position object with line / column information using recorded
  12810. * newline positions. We know the index is always going to be an already
  12811. * processed index, so all the newlines up to this index should have been
  12812. * recorded.
  12813. */
  12814. getPos(index) {
  12815. let line = 1;
  12816. let column = index + 1;
  12817. for (let i = this.newlines.length - 1; i >= 0; i--) {
  12818. const newlineIndex = this.newlines[i];
  12819. if (index > newlineIndex) {
  12820. line = i + 2;
  12821. column = index - newlineIndex;
  12822. break;
  12823. }
  12824. }
  12825. return {
  12826. column,
  12827. line,
  12828. offset: index
  12829. };
  12830. }
  12831. peek() {
  12832. return this.buffer.charCodeAt(this.index + 1);
  12833. }
  12834. stateText(c) {
  12835. if (c === 60) {
  12836. if (this.index > this.sectionStart) {
  12837. this.cbs.ontext(this.sectionStart, this.index);
  12838. }
  12839. this.state = 5;
  12840. this.sectionStart = this.index;
  12841. } else if (!this.inVPre && c === this.delimiterOpen[0]) {
  12842. this.state = 2;
  12843. this.delimiterIndex = 0;
  12844. this.stateInterpolationOpen(c);
  12845. }
  12846. }
  12847. stateInterpolationOpen(c) {
  12848. if (c === this.delimiterOpen[this.delimiterIndex]) {
  12849. if (this.delimiterIndex === this.delimiterOpen.length - 1) {
  12850. const start = this.index + 1 - this.delimiterOpen.length;
  12851. if (start > this.sectionStart) {
  12852. this.cbs.ontext(this.sectionStart, start);
  12853. }
  12854. this.state = 3;
  12855. this.sectionStart = start;
  12856. } else {
  12857. this.delimiterIndex++;
  12858. }
  12859. } else if (this.inRCDATA) {
  12860. this.state = 32;
  12861. this.stateInRCDATA(c);
  12862. } else {
  12863. this.state = 1;
  12864. this.stateText(c);
  12865. }
  12866. }
  12867. stateInterpolation(c) {
  12868. if (c === this.delimiterClose[0]) {
  12869. this.state = 4;
  12870. this.delimiterIndex = 0;
  12871. this.stateInterpolationClose(c);
  12872. }
  12873. }
  12874. stateInterpolationClose(c) {
  12875. if (c === this.delimiterClose[this.delimiterIndex]) {
  12876. if (this.delimiterIndex === this.delimiterClose.length - 1) {
  12877. this.cbs.oninterpolation(this.sectionStart, this.index + 1);
  12878. if (this.inRCDATA) {
  12879. this.state = 32;
  12880. } else {
  12881. this.state = 1;
  12882. }
  12883. this.sectionStart = this.index + 1;
  12884. } else {
  12885. this.delimiterIndex++;
  12886. }
  12887. } else {
  12888. this.state = 3;
  12889. this.stateInterpolation(c);
  12890. }
  12891. }
  12892. stateSpecialStartSequence(c) {
  12893. const isEnd = this.sequenceIndex === this.currentSequence.length;
  12894. const isMatch = isEnd ? (
  12895. // If we are at the end of the sequence, make sure the tag name has ended
  12896. isEndOfTagSection(c)
  12897. ) : (
  12898. // Otherwise, do a case-insensitive comparison
  12899. (c | 32) === this.currentSequence[this.sequenceIndex]
  12900. );
  12901. if (!isMatch) {
  12902. this.inRCDATA = false;
  12903. } else if (!isEnd) {
  12904. this.sequenceIndex++;
  12905. return;
  12906. }
  12907. this.sequenceIndex = 0;
  12908. this.state = 6;
  12909. this.stateInTagName(c);
  12910. }
  12911. /** Look for an end tag. For <title> and <textarea>, also decode entities. */
  12912. stateInRCDATA(c) {
  12913. if (this.sequenceIndex === this.currentSequence.length) {
  12914. if (c === 62 || isWhitespace(c)) {
  12915. const endOfText = this.index - this.currentSequence.length;
  12916. if (this.sectionStart < endOfText) {
  12917. const actualIndex = this.index;
  12918. this.index = endOfText;
  12919. this.cbs.ontext(this.sectionStart, endOfText);
  12920. this.index = actualIndex;
  12921. }
  12922. this.sectionStart = endOfText + 2;
  12923. this.stateInClosingTagName(c);
  12924. this.inRCDATA = false;
  12925. return;
  12926. }
  12927. this.sequenceIndex = 0;
  12928. }
  12929. if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
  12930. this.sequenceIndex += 1;
  12931. } else if (this.sequenceIndex === 0) {
  12932. if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
  12933. if (!this.inVPre && c === this.delimiterOpen[0]) {
  12934. this.state = 2;
  12935. this.delimiterIndex = 0;
  12936. this.stateInterpolationOpen(c);
  12937. }
  12938. } else if (this.fastForwardTo(60)) {
  12939. this.sequenceIndex = 1;
  12940. }
  12941. } else {
  12942. this.sequenceIndex = Number(c === 60);
  12943. }
  12944. }
  12945. stateCDATASequence(c) {
  12946. if (c === Sequences.Cdata[this.sequenceIndex]) {
  12947. if (++this.sequenceIndex === Sequences.Cdata.length) {
  12948. this.state = 28;
  12949. this.currentSequence = Sequences.CdataEnd;
  12950. this.sequenceIndex = 0;
  12951. this.sectionStart = this.index + 1;
  12952. }
  12953. } else {
  12954. this.sequenceIndex = 0;
  12955. this.state = 23;
  12956. this.stateInDeclaration(c);
  12957. }
  12958. }
  12959. /**
  12960. * When we wait for one specific character, we can speed things up
  12961. * by skipping through the buffer until we find it.
  12962. *
  12963. * @returns Whether the character was found.
  12964. */
  12965. fastForwardTo(c) {
  12966. while (++this.index < this.buffer.length) {
  12967. const cc = this.buffer.charCodeAt(this.index);
  12968. if (cc === 10) {
  12969. this.newlines.push(this.index);
  12970. }
  12971. if (cc === c) {
  12972. return true;
  12973. }
  12974. }
  12975. this.index = this.buffer.length - 1;
  12976. return false;
  12977. }
  12978. /**
  12979. * Comments and CDATA end with `-->` and `]]>`.
  12980. *
  12981. * Their common qualities are:
  12982. * - Their end sequences have a distinct character they start with.
  12983. * - That character is then repeated, so we have to check multiple repeats.
  12984. * - All characters but the start character of the sequence can be skipped.
  12985. */
  12986. stateInCommentLike(c) {
  12987. if (c === this.currentSequence[this.sequenceIndex]) {
  12988. if (++this.sequenceIndex === this.currentSequence.length) {
  12989. if (this.currentSequence === Sequences.CdataEnd) {
  12990. this.cbs.oncdata(this.sectionStart, this.index - 2);
  12991. } else {
  12992. this.cbs.oncomment(this.sectionStart, this.index - 2);
  12993. }
  12994. this.sequenceIndex = 0;
  12995. this.sectionStart = this.index + 1;
  12996. this.state = 1;
  12997. }
  12998. } else if (this.sequenceIndex === 0) {
  12999. if (this.fastForwardTo(this.currentSequence[0])) {
  13000. this.sequenceIndex = 1;
  13001. }
  13002. } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
  13003. this.sequenceIndex = 0;
  13004. }
  13005. }
  13006. startSpecial(sequence, offset) {
  13007. this.enterRCDATA(sequence, offset);
  13008. this.state = 31;
  13009. }
  13010. enterRCDATA(sequence, offset) {
  13011. this.inRCDATA = true;
  13012. this.currentSequence = sequence;
  13013. this.sequenceIndex = offset;
  13014. }
  13015. stateBeforeTagName(c) {
  13016. if (c === 33) {
  13017. this.state = 22;
  13018. this.sectionStart = this.index + 1;
  13019. } else if (c === 63) {
  13020. this.state = 24;
  13021. this.sectionStart = this.index + 1;
  13022. } else if (isTagStartChar(c)) {
  13023. this.sectionStart = this.index;
  13024. if (this.mode === 0) {
  13025. this.state = 6;
  13026. } else if (this.inSFCRoot) {
  13027. this.state = 34;
  13028. } else if (!this.inXML) {
  13029. if (c === 116) {
  13030. this.state = 30;
  13031. } else {
  13032. this.state = c === 115 ? 29 : 6;
  13033. }
  13034. } else {
  13035. this.state = 6;
  13036. }
  13037. } else if (c === 47) {
  13038. this.state = 8;
  13039. } else {
  13040. this.state = 1;
  13041. this.stateText(c);
  13042. }
  13043. }
  13044. stateInTagName(c) {
  13045. if (isEndOfTagSection(c)) {
  13046. this.handleTagName(c);
  13047. }
  13048. }
  13049. stateInSFCRootTagName(c) {
  13050. if (isEndOfTagSection(c)) {
  13051. const tag = this.buffer.slice(this.sectionStart, this.index);
  13052. if (tag !== "template") {
  13053. this.enterRCDATA(toCharCodes(`</` + tag), 0);
  13054. }
  13055. this.handleTagName(c);
  13056. }
  13057. }
  13058. handleTagName(c) {
  13059. this.cbs.onopentagname(this.sectionStart, this.index);
  13060. this.sectionStart = -1;
  13061. this.state = 11;
  13062. this.stateBeforeAttrName(c);
  13063. }
  13064. stateBeforeClosingTagName(c) {
  13065. if (isWhitespace(c)) ; else if (c === 62) {
  13066. {
  13067. this.cbs.onerr(14, this.index);
  13068. }
  13069. this.state = 1;
  13070. this.sectionStart = this.index + 1;
  13071. } else {
  13072. this.state = isTagStartChar(c) ? 9 : 27;
  13073. this.sectionStart = this.index;
  13074. }
  13075. }
  13076. stateInClosingTagName(c) {
  13077. if (c === 62 || isWhitespace(c)) {
  13078. this.cbs.onclosetag(this.sectionStart, this.index);
  13079. this.sectionStart = -1;
  13080. this.state = 10;
  13081. this.stateAfterClosingTagName(c);
  13082. }
  13083. }
  13084. stateAfterClosingTagName(c) {
  13085. if (c === 62) {
  13086. this.state = 1;
  13087. this.sectionStart = this.index + 1;
  13088. }
  13089. }
  13090. stateBeforeAttrName(c) {
  13091. if (c === 62) {
  13092. this.cbs.onopentagend(this.index);
  13093. if (this.inRCDATA) {
  13094. this.state = 32;
  13095. } else {
  13096. this.state = 1;
  13097. }
  13098. this.sectionStart = this.index + 1;
  13099. } else if (c === 47) {
  13100. this.state = 7;
  13101. if (this.peek() !== 62) {
  13102. this.cbs.onerr(22, this.index);
  13103. }
  13104. } else if (c === 60 && this.peek() === 47) {
  13105. this.cbs.onopentagend(this.index);
  13106. this.state = 5;
  13107. this.sectionStart = this.index;
  13108. } else if (!isWhitespace(c)) {
  13109. if (c === 61) {
  13110. this.cbs.onerr(
  13111. 19,
  13112. this.index
  13113. );
  13114. }
  13115. this.handleAttrStart(c);
  13116. }
  13117. }
  13118. handleAttrStart(c) {
  13119. if (c === 118 && this.peek() === 45) {
  13120. this.state = 13;
  13121. this.sectionStart = this.index;
  13122. } else if (c === 46 || c === 58 || c === 64 || c === 35) {
  13123. this.cbs.ondirname(this.index, this.index + 1);
  13124. this.state = 14;
  13125. this.sectionStart = this.index + 1;
  13126. } else {
  13127. this.state = 12;
  13128. this.sectionStart = this.index;
  13129. }
  13130. }
  13131. stateInSelfClosingTag(c) {
  13132. if (c === 62) {
  13133. this.cbs.onselfclosingtag(this.index);
  13134. this.state = 1;
  13135. this.sectionStart = this.index + 1;
  13136. this.inRCDATA = false;
  13137. } else if (!isWhitespace(c)) {
  13138. this.state = 11;
  13139. this.stateBeforeAttrName(c);
  13140. }
  13141. }
  13142. stateInAttrName(c) {
  13143. if (c === 61 || isEndOfTagSection(c)) {
  13144. this.cbs.onattribname(this.sectionStart, this.index);
  13145. this.handleAttrNameEnd(c);
  13146. } else if (c === 34 || c === 39 || c === 60) {
  13147. this.cbs.onerr(
  13148. 17,
  13149. this.index
  13150. );
  13151. }
  13152. }
  13153. stateInDirName(c) {
  13154. if (c === 61 || isEndOfTagSection(c)) {
  13155. this.cbs.ondirname(this.sectionStart, this.index);
  13156. this.handleAttrNameEnd(c);
  13157. } else if (c === 58) {
  13158. this.cbs.ondirname(this.sectionStart, this.index);
  13159. this.state = 14;
  13160. this.sectionStart = this.index + 1;
  13161. } else if (c === 46) {
  13162. this.cbs.ondirname(this.sectionStart, this.index);
  13163. this.state = 16;
  13164. this.sectionStart = this.index + 1;
  13165. }
  13166. }
  13167. stateInDirArg(c) {
  13168. if (c === 61 || isEndOfTagSection(c)) {
  13169. this.cbs.ondirarg(this.sectionStart, this.index);
  13170. this.handleAttrNameEnd(c);
  13171. } else if (c === 91) {
  13172. this.state = 15;
  13173. } else if (c === 46) {
  13174. this.cbs.ondirarg(this.sectionStart, this.index);
  13175. this.state = 16;
  13176. this.sectionStart = this.index + 1;
  13177. }
  13178. }
  13179. stateInDynamicDirArg(c) {
  13180. if (c === 93) {
  13181. this.state = 14;
  13182. } else if (c === 61 || isEndOfTagSection(c)) {
  13183. this.cbs.ondirarg(this.sectionStart, this.index + 1);
  13184. this.handleAttrNameEnd(c);
  13185. {
  13186. this.cbs.onerr(
  13187. 27,
  13188. this.index
  13189. );
  13190. }
  13191. }
  13192. }
  13193. stateInDirModifier(c) {
  13194. if (c === 61 || isEndOfTagSection(c)) {
  13195. this.cbs.ondirmodifier(this.sectionStart, this.index);
  13196. this.handleAttrNameEnd(c);
  13197. } else if (c === 46) {
  13198. this.cbs.ondirmodifier(this.sectionStart, this.index);
  13199. this.sectionStart = this.index + 1;
  13200. }
  13201. }
  13202. handleAttrNameEnd(c) {
  13203. this.sectionStart = this.index;
  13204. this.state = 17;
  13205. this.cbs.onattribnameend(this.index);
  13206. this.stateAfterAttrName(c);
  13207. }
  13208. stateAfterAttrName(c) {
  13209. if (c === 61) {
  13210. this.state = 18;
  13211. } else if (c === 47 || c === 62) {
  13212. this.cbs.onattribend(0, this.sectionStart);
  13213. this.sectionStart = -1;
  13214. this.state = 11;
  13215. this.stateBeforeAttrName(c);
  13216. } else if (!isWhitespace(c)) {
  13217. this.cbs.onattribend(0, this.sectionStart);
  13218. this.handleAttrStart(c);
  13219. }
  13220. }
  13221. stateBeforeAttrValue(c) {
  13222. if (c === 34) {
  13223. this.state = 19;
  13224. this.sectionStart = this.index + 1;
  13225. } else if (c === 39) {
  13226. this.state = 20;
  13227. this.sectionStart = this.index + 1;
  13228. } else if (!isWhitespace(c)) {
  13229. this.sectionStart = this.index;
  13230. this.state = 21;
  13231. this.stateInAttrValueNoQuotes(c);
  13232. }
  13233. }
  13234. handleInAttrValue(c, quote) {
  13235. if (c === quote || this.fastForwardTo(quote)) {
  13236. this.cbs.onattribdata(this.sectionStart, this.index);
  13237. this.sectionStart = -1;
  13238. this.cbs.onattribend(
  13239. quote === 34 ? 3 : 2,
  13240. this.index + 1
  13241. );
  13242. this.state = 11;
  13243. }
  13244. }
  13245. stateInAttrValueDoubleQuotes(c) {
  13246. this.handleInAttrValue(c, 34);
  13247. }
  13248. stateInAttrValueSingleQuotes(c) {
  13249. this.handleInAttrValue(c, 39);
  13250. }
  13251. stateInAttrValueNoQuotes(c) {
  13252. if (isWhitespace(c) || c === 62) {
  13253. this.cbs.onattribdata(this.sectionStart, this.index);
  13254. this.sectionStart = -1;
  13255. this.cbs.onattribend(1, this.index);
  13256. this.state = 11;
  13257. this.stateBeforeAttrName(c);
  13258. } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
  13259. this.cbs.onerr(
  13260. 18,
  13261. this.index
  13262. );
  13263. } else ;
  13264. }
  13265. stateBeforeDeclaration(c) {
  13266. if (c === 91) {
  13267. this.state = 26;
  13268. this.sequenceIndex = 0;
  13269. } else {
  13270. this.state = c === 45 ? 25 : 23;
  13271. }
  13272. }
  13273. stateInDeclaration(c) {
  13274. if (c === 62 || this.fastForwardTo(62)) {
  13275. this.state = 1;
  13276. this.sectionStart = this.index + 1;
  13277. }
  13278. }
  13279. stateInProcessingInstruction(c) {
  13280. if (c === 62 || this.fastForwardTo(62)) {
  13281. this.cbs.onprocessinginstruction(this.sectionStart, this.index);
  13282. this.state = 1;
  13283. this.sectionStart = this.index + 1;
  13284. }
  13285. }
  13286. stateBeforeComment(c) {
  13287. if (c === 45) {
  13288. this.state = 28;
  13289. this.currentSequence = Sequences.CommentEnd;
  13290. this.sequenceIndex = 2;
  13291. this.sectionStart = this.index + 1;
  13292. } else {
  13293. this.state = 23;
  13294. }
  13295. }
  13296. stateInSpecialComment(c) {
  13297. if (c === 62 || this.fastForwardTo(62)) {
  13298. this.cbs.oncomment(this.sectionStart, this.index);
  13299. this.state = 1;
  13300. this.sectionStart = this.index + 1;
  13301. }
  13302. }
  13303. stateBeforeSpecialS(c) {
  13304. if (c === Sequences.ScriptEnd[3]) {
  13305. this.startSpecial(Sequences.ScriptEnd, 4);
  13306. } else if (c === Sequences.StyleEnd[3]) {
  13307. this.startSpecial(Sequences.StyleEnd, 4);
  13308. } else {
  13309. this.state = 6;
  13310. this.stateInTagName(c);
  13311. }
  13312. }
  13313. stateBeforeSpecialT(c) {
  13314. if (c === Sequences.TitleEnd[3]) {
  13315. this.startSpecial(Sequences.TitleEnd, 4);
  13316. } else if (c === Sequences.TextareaEnd[3]) {
  13317. this.startSpecial(Sequences.TextareaEnd, 4);
  13318. } else {
  13319. this.state = 6;
  13320. this.stateInTagName(c);
  13321. }
  13322. }
  13323. startEntity() {
  13324. }
  13325. stateInEntity() {
  13326. }
  13327. /**
  13328. * Iterates through the buffer, calling the function corresponding to the current state.
  13329. *
  13330. * States that are more likely to be hit are higher up, as a performance improvement.
  13331. */
  13332. parse(input) {
  13333. this.buffer = input;
  13334. while (this.index < this.buffer.length) {
  13335. const c = this.buffer.charCodeAt(this.index);
  13336. if (c === 10) {
  13337. this.newlines.push(this.index);
  13338. }
  13339. switch (this.state) {
  13340. case 1: {
  13341. this.stateText(c);
  13342. break;
  13343. }
  13344. case 2: {
  13345. this.stateInterpolationOpen(c);
  13346. break;
  13347. }
  13348. case 3: {
  13349. this.stateInterpolation(c);
  13350. break;
  13351. }
  13352. case 4: {
  13353. this.stateInterpolationClose(c);
  13354. break;
  13355. }
  13356. case 31: {
  13357. this.stateSpecialStartSequence(c);
  13358. break;
  13359. }
  13360. case 32: {
  13361. this.stateInRCDATA(c);
  13362. break;
  13363. }
  13364. case 26: {
  13365. this.stateCDATASequence(c);
  13366. break;
  13367. }
  13368. case 19: {
  13369. this.stateInAttrValueDoubleQuotes(c);
  13370. break;
  13371. }
  13372. case 12: {
  13373. this.stateInAttrName(c);
  13374. break;
  13375. }
  13376. case 13: {
  13377. this.stateInDirName(c);
  13378. break;
  13379. }
  13380. case 14: {
  13381. this.stateInDirArg(c);
  13382. break;
  13383. }
  13384. case 15: {
  13385. this.stateInDynamicDirArg(c);
  13386. break;
  13387. }
  13388. case 16: {
  13389. this.stateInDirModifier(c);
  13390. break;
  13391. }
  13392. case 28: {
  13393. this.stateInCommentLike(c);
  13394. break;
  13395. }
  13396. case 27: {
  13397. this.stateInSpecialComment(c);
  13398. break;
  13399. }
  13400. case 11: {
  13401. this.stateBeforeAttrName(c);
  13402. break;
  13403. }
  13404. case 6: {
  13405. this.stateInTagName(c);
  13406. break;
  13407. }
  13408. case 34: {
  13409. this.stateInSFCRootTagName(c);
  13410. break;
  13411. }
  13412. case 9: {
  13413. this.stateInClosingTagName(c);
  13414. break;
  13415. }
  13416. case 5: {
  13417. this.stateBeforeTagName(c);
  13418. break;
  13419. }
  13420. case 17: {
  13421. this.stateAfterAttrName(c);
  13422. break;
  13423. }
  13424. case 20: {
  13425. this.stateInAttrValueSingleQuotes(c);
  13426. break;
  13427. }
  13428. case 18: {
  13429. this.stateBeforeAttrValue(c);
  13430. break;
  13431. }
  13432. case 8: {
  13433. this.stateBeforeClosingTagName(c);
  13434. break;
  13435. }
  13436. case 10: {
  13437. this.stateAfterClosingTagName(c);
  13438. break;
  13439. }
  13440. case 29: {
  13441. this.stateBeforeSpecialS(c);
  13442. break;
  13443. }
  13444. case 30: {
  13445. this.stateBeforeSpecialT(c);
  13446. break;
  13447. }
  13448. case 21: {
  13449. this.stateInAttrValueNoQuotes(c);
  13450. break;
  13451. }
  13452. case 7: {
  13453. this.stateInSelfClosingTag(c);
  13454. break;
  13455. }
  13456. case 23: {
  13457. this.stateInDeclaration(c);
  13458. break;
  13459. }
  13460. case 22: {
  13461. this.stateBeforeDeclaration(c);
  13462. break;
  13463. }
  13464. case 25: {
  13465. this.stateBeforeComment(c);
  13466. break;
  13467. }
  13468. case 24: {
  13469. this.stateInProcessingInstruction(c);
  13470. break;
  13471. }
  13472. case 33: {
  13473. this.stateInEntity();
  13474. break;
  13475. }
  13476. }
  13477. this.index++;
  13478. }
  13479. this.cleanup();
  13480. this.finish();
  13481. }
  13482. /**
  13483. * Remove data that has already been consumed from the buffer.
  13484. */
  13485. cleanup() {
  13486. if (this.sectionStart !== this.index) {
  13487. if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
  13488. this.cbs.ontext(this.sectionStart, this.index);
  13489. this.sectionStart = this.index;
  13490. } else if (this.state === 19 || this.state === 20 || this.state === 21) {
  13491. this.cbs.onattribdata(this.sectionStart, this.index);
  13492. this.sectionStart = this.index;
  13493. }
  13494. }
  13495. }
  13496. finish() {
  13497. this.handleTrailingData();
  13498. this.cbs.onend();
  13499. }
  13500. /** Handle any trailing data. */
  13501. handleTrailingData() {
  13502. const endIndex = this.buffer.length;
  13503. if (this.sectionStart >= endIndex) {
  13504. return;
  13505. }
  13506. if (this.state === 28) {
  13507. if (this.currentSequence === Sequences.CdataEnd) {
  13508. this.cbs.oncdata(this.sectionStart, endIndex);
  13509. } else {
  13510. this.cbs.oncomment(this.sectionStart, endIndex);
  13511. }
  13512. } 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 {
  13513. this.cbs.ontext(this.sectionStart, endIndex);
  13514. }
  13515. }
  13516. emitCodePoint(cp, consumed) {
  13517. }
  13518. }
  13519. function defaultOnError(error) {
  13520. throw error;
  13521. }
  13522. function defaultOnWarn(msg) {
  13523. console.warn(`[Vue warn] ${msg.message}`);
  13524. }
  13525. function createCompilerError(code, loc, messages, additionalMessage) {
  13526. const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
  13527. const error = new SyntaxError(String(msg));
  13528. error.code = code;
  13529. error.loc = loc;
  13530. return error;
  13531. }
  13532. const errorMessages = {
  13533. // parse errors
  13534. [0]: "Illegal comment.",
  13535. [1]: "CDATA section is allowed only in XML context.",
  13536. [2]: "Duplicate attribute.",
  13537. [3]: "End tag cannot have attributes.",
  13538. [4]: "Illegal '/' in tags.",
  13539. [5]: "Unexpected EOF in tag.",
  13540. [6]: "Unexpected EOF in CDATA section.",
  13541. [7]: "Unexpected EOF in comment.",
  13542. [8]: "Unexpected EOF in script.",
  13543. [9]: "Unexpected EOF in tag.",
  13544. [10]: "Incorrectly closed comment.",
  13545. [11]: "Incorrectly opened comment.",
  13546. [12]: "Illegal tag name. Use '&lt;' to print '<'.",
  13547. [13]: "Attribute value was expected.",
  13548. [14]: "End tag name was expected.",
  13549. [15]: "Whitespace was expected.",
  13550. [16]: "Unexpected '<!--' in comment.",
  13551. [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
  13552. [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
  13553. [19]: "Attribute name cannot start with '='.",
  13554. [21]: "'<?' is allowed only in XML context.",
  13555. [20]: `Unexpected null character.`,
  13556. [22]: "Illegal '/' in tags.",
  13557. // Vue-specific parse errors
  13558. [23]: "Invalid end tag.",
  13559. [24]: "Element is missing end tag.",
  13560. [25]: "Interpolation end sign was not found.",
  13561. [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
  13562. [26]: "Legal directive name was expected.",
  13563. // transform errors
  13564. [28]: `v-if/v-else-if is missing expression.`,
  13565. [29]: `v-if/else branches must use unique keys.`,
  13566. [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  13567. [31]: `v-for is missing expression.`,
  13568. [32]: `v-for has invalid expression.`,
  13569. [33]: `<template v-for> key should be placed on the <template> tag.`,
  13570. [34]: `v-bind is missing expression.`,
  13571. [52]: `v-bind with same-name shorthand only allows static argument.`,
  13572. [35]: `v-on is missing expression.`,
  13573. [36]: `Unexpected custom directive on <slot> outlet.`,
  13574. [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.`,
  13575. [38]: `Duplicate slot names found. `,
  13576. [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
  13577. [40]: `v-slot can only be used on components or <template> tags.`,
  13578. [41]: `v-model is missing expression.`,
  13579. [42]: `v-model value must be a valid JavaScript member expression.`,
  13580. [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  13581. [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
  13582. Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
  13583. [45]: `Error parsing JavaScript expression: `,
  13584. [46]: `<KeepAlive> expects exactly one child component.`,
  13585. [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`,
  13586. // generic errors
  13587. [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  13588. [48]: `ES module mode is not supported in this build of compiler.`,
  13589. [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  13590. [50]: `"scopeId" option is only supported in module mode.`,
  13591. // just to fulfill types
  13592. [53]: ``
  13593. };
  13594. const isStaticExp = (p) => p.type === 4 && p.isStatic;
  13595. function isCoreComponent(tag) {
  13596. switch (tag) {
  13597. case "Teleport":
  13598. case "teleport":
  13599. return TELEPORT;
  13600. case "Suspense":
  13601. case "suspense":
  13602. return SUSPENSE;
  13603. case "KeepAlive":
  13604. case "keep-alive":
  13605. return KEEP_ALIVE;
  13606. case "BaseTransition":
  13607. case "base-transition":
  13608. return BASE_TRANSITION;
  13609. }
  13610. }
  13611. const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
  13612. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  13613. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  13614. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  13615. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  13616. const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
  13617. const isMemberExpressionBrowser = (exp) => {
  13618. const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
  13619. let state = 0 /* inMemberExp */;
  13620. let stateStack = [];
  13621. let currentOpenBracketCount = 0;
  13622. let currentOpenParensCount = 0;
  13623. let currentStringType = null;
  13624. for (let i = 0; i < path.length; i++) {
  13625. const char = path.charAt(i);
  13626. switch (state) {
  13627. case 0 /* inMemberExp */:
  13628. if (char === "[") {
  13629. stateStack.push(state);
  13630. state = 1 /* inBrackets */;
  13631. currentOpenBracketCount++;
  13632. } else if (char === "(") {
  13633. stateStack.push(state);
  13634. state = 2 /* inParens */;
  13635. currentOpenParensCount++;
  13636. } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  13637. return false;
  13638. }
  13639. break;
  13640. case 1 /* inBrackets */:
  13641. if (char === `'` || char === `"` || char === "`") {
  13642. stateStack.push(state);
  13643. state = 3 /* inString */;
  13644. currentStringType = char;
  13645. } else if (char === `[`) {
  13646. currentOpenBracketCount++;
  13647. } else if (char === `]`) {
  13648. if (!--currentOpenBracketCount) {
  13649. state = stateStack.pop();
  13650. }
  13651. }
  13652. break;
  13653. case 2 /* inParens */:
  13654. if (char === `'` || char === `"` || char === "`") {
  13655. stateStack.push(state);
  13656. state = 3 /* inString */;
  13657. currentStringType = char;
  13658. } else if (char === `(`) {
  13659. currentOpenParensCount++;
  13660. } else if (char === `)`) {
  13661. if (i === path.length - 1) {
  13662. return false;
  13663. }
  13664. if (!--currentOpenParensCount) {
  13665. state = stateStack.pop();
  13666. }
  13667. }
  13668. break;
  13669. case 3 /* inString */:
  13670. if (char === currentStringType) {
  13671. state = stateStack.pop();
  13672. currentStringType = null;
  13673. }
  13674. break;
  13675. }
  13676. }
  13677. return !currentOpenBracketCount && !currentOpenParensCount;
  13678. };
  13679. const isMemberExpression = isMemberExpressionBrowser ;
  13680. const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  13681. const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
  13682. const isFnExpression = isFnExpressionBrowser ;
  13683. function assert(condition, msg) {
  13684. if (!condition) {
  13685. throw new Error(msg || `unexpected compiler condition`);
  13686. }
  13687. }
  13688. function findDir(node, name, allowEmpty = false) {
  13689. for (let i = 0; i < node.props.length; i++) {
  13690. const p = node.props[i];
  13691. if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
  13692. return p;
  13693. }
  13694. }
  13695. }
  13696. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  13697. for (let i = 0; i < node.props.length; i++) {
  13698. const p = node.props[i];
  13699. if (p.type === 6) {
  13700. if (dynamicOnly) continue;
  13701. if (p.name === name && (p.value || allowEmpty)) {
  13702. return p;
  13703. }
  13704. } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
  13705. return p;
  13706. }
  13707. }
  13708. }
  13709. function isStaticArgOf(arg, name) {
  13710. return !!(arg && isStaticExp(arg) && arg.content === name);
  13711. }
  13712. function hasDynamicKeyVBind(node) {
  13713. return node.props.some(
  13714. (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
  13715. p.arg.type !== 4 || // v-bind:[_ctx.foo]
  13716. !p.arg.isStatic)
  13717. // v-bind:[foo]
  13718. );
  13719. }
  13720. function isText$1(node) {
  13721. return node.type === 5 || node.type === 2;
  13722. }
  13723. function isVSlot(p) {
  13724. return p.type === 7 && p.name === "slot";
  13725. }
  13726. function isTemplateNode(node) {
  13727. return node.type === 1 && node.tagType === 3;
  13728. }
  13729. function isSlotOutlet(node) {
  13730. return node.type === 1 && node.tagType === 2;
  13731. }
  13732. const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  13733. function getUnnormalizedProps(props, callPath = []) {
  13734. if (props && !isString(props) && props.type === 14) {
  13735. const callee = props.callee;
  13736. if (!isString(callee) && propsHelperSet.has(callee)) {
  13737. return getUnnormalizedProps(
  13738. props.arguments[0],
  13739. callPath.concat(props)
  13740. );
  13741. }
  13742. }
  13743. return [props, callPath];
  13744. }
  13745. function injectProp(node, prop, context) {
  13746. let propsWithInjection;
  13747. let props = node.type === 13 ? node.props : node.arguments[2];
  13748. let callPath = [];
  13749. let parentCall;
  13750. if (props && !isString(props) && props.type === 14) {
  13751. const ret = getUnnormalizedProps(props);
  13752. props = ret[0];
  13753. callPath = ret[1];
  13754. parentCall = callPath[callPath.length - 1];
  13755. }
  13756. if (props == null || isString(props)) {
  13757. propsWithInjection = createObjectExpression([prop]);
  13758. } else if (props.type === 14) {
  13759. const first = props.arguments[0];
  13760. if (!isString(first) && first.type === 15) {
  13761. if (!hasProp(prop, first)) {
  13762. first.properties.unshift(prop);
  13763. }
  13764. } else {
  13765. if (props.callee === TO_HANDLERS) {
  13766. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  13767. createObjectExpression([prop]),
  13768. props
  13769. ]);
  13770. } else {
  13771. props.arguments.unshift(createObjectExpression([prop]));
  13772. }
  13773. }
  13774. !propsWithInjection && (propsWithInjection = props);
  13775. } else if (props.type === 15) {
  13776. if (!hasProp(prop, props)) {
  13777. props.properties.unshift(prop);
  13778. }
  13779. propsWithInjection = props;
  13780. } else {
  13781. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  13782. createObjectExpression([prop]),
  13783. props
  13784. ]);
  13785. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  13786. parentCall = callPath[callPath.length - 2];
  13787. }
  13788. }
  13789. if (node.type === 13) {
  13790. if (parentCall) {
  13791. parentCall.arguments[0] = propsWithInjection;
  13792. } else {
  13793. node.props = propsWithInjection;
  13794. }
  13795. } else {
  13796. if (parentCall) {
  13797. parentCall.arguments[0] = propsWithInjection;
  13798. } else {
  13799. node.arguments[2] = propsWithInjection;
  13800. }
  13801. }
  13802. }
  13803. function hasProp(prop, props) {
  13804. let result = false;
  13805. if (prop.key.type === 4) {
  13806. const propKeyName = prop.key.content;
  13807. result = props.properties.some(
  13808. (p) => p.key.type === 4 && p.key.content === propKeyName
  13809. );
  13810. }
  13811. return result;
  13812. }
  13813. function toValidAssetId(name, type) {
  13814. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  13815. return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
  13816. })}`;
  13817. }
  13818. function getMemoedVNodeCall(node) {
  13819. if (node.type === 14 && node.callee === WITH_MEMO) {
  13820. return node.arguments[1].returns;
  13821. } else {
  13822. return node;
  13823. }
  13824. }
  13825. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
  13826. const defaultParserOptions = {
  13827. parseMode: "base",
  13828. ns: 0,
  13829. delimiters: [`{{`, `}}`],
  13830. getNamespace: () => 0,
  13831. isVoidTag: NO,
  13832. isPreTag: NO,
  13833. isIgnoreNewlineTag: NO,
  13834. isCustomElement: NO,
  13835. onError: defaultOnError,
  13836. onWarn: defaultOnWarn,
  13837. comments: true,
  13838. prefixIdentifiers: false
  13839. };
  13840. let currentOptions = defaultParserOptions;
  13841. let currentRoot = null;
  13842. let currentInput = "";
  13843. let currentOpenTag = null;
  13844. let currentProp = null;
  13845. let currentAttrValue = "";
  13846. let currentAttrStartIndex = -1;
  13847. let currentAttrEndIndex = -1;
  13848. let inPre = 0;
  13849. let inVPre = false;
  13850. let currentVPreBoundary = null;
  13851. const stack = [];
  13852. const tokenizer = new Tokenizer(stack, {
  13853. onerr: emitError,
  13854. ontext(start, end) {
  13855. onText(getSlice(start, end), start, end);
  13856. },
  13857. ontextentity(char, start, end) {
  13858. onText(char, start, end);
  13859. },
  13860. oninterpolation(start, end) {
  13861. if (inVPre) {
  13862. return onText(getSlice(start, end), start, end);
  13863. }
  13864. let innerStart = start + tokenizer.delimiterOpen.length;
  13865. let innerEnd = end - tokenizer.delimiterClose.length;
  13866. while (isWhitespace(currentInput.charCodeAt(innerStart))) {
  13867. innerStart++;
  13868. }
  13869. while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
  13870. innerEnd--;
  13871. }
  13872. let exp = getSlice(innerStart, innerEnd);
  13873. if (exp.includes("&")) {
  13874. {
  13875. exp = currentOptions.decodeEntities(exp, false);
  13876. }
  13877. }
  13878. addNode({
  13879. type: 5,
  13880. content: createExp(exp, false, getLoc(innerStart, innerEnd)),
  13881. loc: getLoc(start, end)
  13882. });
  13883. },
  13884. onopentagname(start, end) {
  13885. const name = getSlice(start, end);
  13886. currentOpenTag = {
  13887. type: 1,
  13888. tag: name,
  13889. ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
  13890. tagType: 0,
  13891. // will be refined on tag close
  13892. props: [],
  13893. children: [],
  13894. loc: getLoc(start - 1, end),
  13895. codegenNode: void 0
  13896. };
  13897. },
  13898. onopentagend(end) {
  13899. endOpenTag(end);
  13900. },
  13901. onclosetag(start, end) {
  13902. const name = getSlice(start, end);
  13903. if (!currentOptions.isVoidTag(name)) {
  13904. let found = false;
  13905. for (let i = 0; i < stack.length; i++) {
  13906. const e = stack[i];
  13907. if (e.tag.toLowerCase() === name.toLowerCase()) {
  13908. found = true;
  13909. if (i > 0) {
  13910. emitError(24, stack[0].loc.start.offset);
  13911. }
  13912. for (let j = 0; j <= i; j++) {
  13913. const el = stack.shift();
  13914. onCloseTag(el, end, j < i);
  13915. }
  13916. break;
  13917. }
  13918. }
  13919. if (!found) {
  13920. emitError(23, backTrack(start, 60));
  13921. }
  13922. }
  13923. },
  13924. onselfclosingtag(end) {
  13925. const name = currentOpenTag.tag;
  13926. currentOpenTag.isSelfClosing = true;
  13927. endOpenTag(end);
  13928. if (stack[0] && stack[0].tag === name) {
  13929. onCloseTag(stack.shift(), end);
  13930. }
  13931. },
  13932. onattribname(start, end) {
  13933. currentProp = {
  13934. type: 6,
  13935. name: getSlice(start, end),
  13936. nameLoc: getLoc(start, end),
  13937. value: void 0,
  13938. loc: getLoc(start)
  13939. };
  13940. },
  13941. ondirname(start, end) {
  13942. const raw = getSlice(start, end);
  13943. const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
  13944. if (!inVPre && name === "") {
  13945. emitError(26, start);
  13946. }
  13947. if (inVPre || name === "") {
  13948. currentProp = {
  13949. type: 6,
  13950. name: raw,
  13951. nameLoc: getLoc(start, end),
  13952. value: void 0,
  13953. loc: getLoc(start)
  13954. };
  13955. } else {
  13956. currentProp = {
  13957. type: 7,
  13958. name,
  13959. rawName: raw,
  13960. exp: void 0,
  13961. arg: void 0,
  13962. modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
  13963. loc: getLoc(start)
  13964. };
  13965. if (name === "pre") {
  13966. inVPre = tokenizer.inVPre = true;
  13967. currentVPreBoundary = currentOpenTag;
  13968. const props = currentOpenTag.props;
  13969. for (let i = 0; i < props.length; i++) {
  13970. if (props[i].type === 7) {
  13971. props[i] = dirToAttr(props[i]);
  13972. }
  13973. }
  13974. }
  13975. }
  13976. },
  13977. ondirarg(start, end) {
  13978. if (start === end) return;
  13979. const arg = getSlice(start, end);
  13980. if (inVPre) {
  13981. currentProp.name += arg;
  13982. setLocEnd(currentProp.nameLoc, end);
  13983. } else {
  13984. const isStatic = arg[0] !== `[`;
  13985. currentProp.arg = createExp(
  13986. isStatic ? arg : arg.slice(1, -1),
  13987. isStatic,
  13988. getLoc(start, end),
  13989. isStatic ? 3 : 0
  13990. );
  13991. }
  13992. },
  13993. ondirmodifier(start, end) {
  13994. const mod = getSlice(start, end);
  13995. if (inVPre) {
  13996. currentProp.name += "." + mod;
  13997. setLocEnd(currentProp.nameLoc, end);
  13998. } else if (currentProp.name === "slot") {
  13999. const arg = currentProp.arg;
  14000. if (arg) {
  14001. arg.content += "." + mod;
  14002. setLocEnd(arg.loc, end);
  14003. }
  14004. } else {
  14005. const exp = createSimpleExpression(mod, true, getLoc(start, end));
  14006. currentProp.modifiers.push(exp);
  14007. }
  14008. },
  14009. onattribdata(start, end) {
  14010. currentAttrValue += getSlice(start, end);
  14011. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  14012. currentAttrEndIndex = end;
  14013. },
  14014. onattribentity(char, start, end) {
  14015. currentAttrValue += char;
  14016. if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
  14017. currentAttrEndIndex = end;
  14018. },
  14019. onattribnameend(end) {
  14020. const start = currentProp.loc.start.offset;
  14021. const name = getSlice(start, end);
  14022. if (currentProp.type === 7) {
  14023. currentProp.rawName = name;
  14024. }
  14025. if (currentOpenTag.props.some(
  14026. (p) => (p.type === 7 ? p.rawName : p.name) === name
  14027. )) {
  14028. emitError(2, start);
  14029. }
  14030. },
  14031. onattribend(quote, end) {
  14032. if (currentOpenTag && currentProp) {
  14033. setLocEnd(currentProp.loc, end);
  14034. if (quote !== 0) {
  14035. if (currentAttrValue.includes("&")) {
  14036. currentAttrValue = currentOptions.decodeEntities(
  14037. currentAttrValue,
  14038. true
  14039. );
  14040. }
  14041. if (currentProp.type === 6) {
  14042. if (currentProp.name === "class") {
  14043. currentAttrValue = condense(currentAttrValue).trim();
  14044. }
  14045. if (quote === 1 && !currentAttrValue) {
  14046. emitError(13, end);
  14047. }
  14048. currentProp.value = {
  14049. type: 2,
  14050. content: currentAttrValue,
  14051. loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
  14052. };
  14053. if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
  14054. tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
  14055. }
  14056. } else {
  14057. let expParseMode = 0 /* Normal */;
  14058. currentProp.exp = createExp(
  14059. currentAttrValue,
  14060. false,
  14061. getLoc(currentAttrStartIndex, currentAttrEndIndex),
  14062. 0,
  14063. expParseMode
  14064. );
  14065. if (currentProp.name === "for") {
  14066. currentProp.forParseResult = parseForExpression(currentProp.exp);
  14067. }
  14068. }
  14069. }
  14070. if (currentProp.type !== 7 || currentProp.name !== "pre") {
  14071. currentOpenTag.props.push(currentProp);
  14072. }
  14073. }
  14074. currentAttrValue = "";
  14075. currentAttrStartIndex = currentAttrEndIndex = -1;
  14076. },
  14077. oncomment(start, end) {
  14078. if (currentOptions.comments) {
  14079. addNode({
  14080. type: 3,
  14081. content: getSlice(start, end),
  14082. loc: getLoc(start - 4, end + 3)
  14083. });
  14084. }
  14085. },
  14086. onend() {
  14087. const end = currentInput.length;
  14088. if (tokenizer.state !== 1) {
  14089. switch (tokenizer.state) {
  14090. case 5:
  14091. case 8:
  14092. emitError(5, end);
  14093. break;
  14094. case 3:
  14095. case 4:
  14096. emitError(
  14097. 25,
  14098. tokenizer.sectionStart
  14099. );
  14100. break;
  14101. case 28:
  14102. if (tokenizer.currentSequence === Sequences.CdataEnd) {
  14103. emitError(6, end);
  14104. } else {
  14105. emitError(7, end);
  14106. }
  14107. break;
  14108. case 6:
  14109. case 7:
  14110. case 9:
  14111. case 11:
  14112. case 12:
  14113. case 13:
  14114. case 14:
  14115. case 15:
  14116. case 16:
  14117. case 17:
  14118. case 18:
  14119. case 19:
  14120. // "
  14121. case 20:
  14122. // '
  14123. case 21:
  14124. emitError(9, end);
  14125. break;
  14126. }
  14127. }
  14128. for (let index = 0; index < stack.length; index++) {
  14129. onCloseTag(stack[index], end - 1);
  14130. emitError(24, stack[index].loc.start.offset);
  14131. }
  14132. },
  14133. oncdata(start, end) {
  14134. if (stack[0].ns !== 0) {
  14135. onText(getSlice(start, end), start, end);
  14136. } else {
  14137. emitError(1, start - 9);
  14138. }
  14139. },
  14140. onprocessinginstruction(start) {
  14141. if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  14142. emitError(
  14143. 21,
  14144. start - 1
  14145. );
  14146. }
  14147. }
  14148. });
  14149. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  14150. const stripParensRE = /^\(|\)$/g;
  14151. function parseForExpression(input) {
  14152. const loc = input.loc;
  14153. const exp = input.content;
  14154. const inMatch = exp.match(forAliasRE);
  14155. if (!inMatch) return;
  14156. const [, LHS, RHS] = inMatch;
  14157. const createAliasExpression = (content, offset, asParam = false) => {
  14158. const start = loc.start.offset + offset;
  14159. const end = start + content.length;
  14160. return createExp(
  14161. content,
  14162. false,
  14163. getLoc(start, end),
  14164. 0,
  14165. asParam ? 1 /* Params */ : 0 /* Normal */
  14166. );
  14167. };
  14168. const result = {
  14169. source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
  14170. value: void 0,
  14171. key: void 0,
  14172. index: void 0,
  14173. finalized: false
  14174. };
  14175. let valueContent = LHS.trim().replace(stripParensRE, "").trim();
  14176. const trimmedOffset = LHS.indexOf(valueContent);
  14177. const iteratorMatch = valueContent.match(forIteratorRE);
  14178. if (iteratorMatch) {
  14179. valueContent = valueContent.replace(forIteratorRE, "").trim();
  14180. const keyContent = iteratorMatch[1].trim();
  14181. let keyOffset;
  14182. if (keyContent) {
  14183. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  14184. result.key = createAliasExpression(keyContent, keyOffset, true);
  14185. }
  14186. if (iteratorMatch[2]) {
  14187. const indexContent = iteratorMatch[2].trim();
  14188. if (indexContent) {
  14189. result.index = createAliasExpression(
  14190. indexContent,
  14191. exp.indexOf(
  14192. indexContent,
  14193. result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
  14194. ),
  14195. true
  14196. );
  14197. }
  14198. }
  14199. }
  14200. if (valueContent) {
  14201. result.value = createAliasExpression(valueContent, trimmedOffset, true);
  14202. }
  14203. return result;
  14204. }
  14205. function getSlice(start, end) {
  14206. return currentInput.slice(start, end);
  14207. }
  14208. function endOpenTag(end) {
  14209. if (tokenizer.inSFCRoot) {
  14210. currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
  14211. }
  14212. addNode(currentOpenTag);
  14213. const { tag, ns } = currentOpenTag;
  14214. if (ns === 0 && currentOptions.isPreTag(tag)) {
  14215. inPre++;
  14216. }
  14217. if (currentOptions.isVoidTag(tag)) {
  14218. onCloseTag(currentOpenTag, end);
  14219. } else {
  14220. stack.unshift(currentOpenTag);
  14221. if (ns === 1 || ns === 2) {
  14222. tokenizer.inXML = true;
  14223. }
  14224. }
  14225. currentOpenTag = null;
  14226. }
  14227. function onText(content, start, end) {
  14228. {
  14229. const tag = stack[0] && stack[0].tag;
  14230. if (tag !== "script" && tag !== "style" && content.includes("&")) {
  14231. content = currentOptions.decodeEntities(content, false);
  14232. }
  14233. }
  14234. const parent = stack[0] || currentRoot;
  14235. const lastNode = parent.children[parent.children.length - 1];
  14236. if (lastNode && lastNode.type === 2) {
  14237. lastNode.content += content;
  14238. setLocEnd(lastNode.loc, end);
  14239. } else {
  14240. parent.children.push({
  14241. type: 2,
  14242. content,
  14243. loc: getLoc(start, end)
  14244. });
  14245. }
  14246. }
  14247. function onCloseTag(el, end, isImplied = false) {
  14248. if (isImplied) {
  14249. setLocEnd(el.loc, backTrack(end, 60));
  14250. } else {
  14251. setLocEnd(el.loc, lookAhead(end, 62) + 1);
  14252. }
  14253. if (tokenizer.inSFCRoot) {
  14254. if (el.children.length) {
  14255. el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
  14256. } else {
  14257. el.innerLoc.end = extend({}, el.innerLoc.start);
  14258. }
  14259. el.innerLoc.source = getSlice(
  14260. el.innerLoc.start.offset,
  14261. el.innerLoc.end.offset
  14262. );
  14263. }
  14264. const { tag, ns, children } = el;
  14265. if (!inVPre) {
  14266. if (tag === "slot") {
  14267. el.tagType = 2;
  14268. } else if (isFragmentTemplate(el)) {
  14269. el.tagType = 3;
  14270. } else if (isComponent(el)) {
  14271. el.tagType = 1;
  14272. }
  14273. }
  14274. if (!tokenizer.inRCDATA) {
  14275. el.children = condenseWhitespace(children);
  14276. }
  14277. if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
  14278. const first = children[0];
  14279. if (first && first.type === 2) {
  14280. first.content = first.content.replace(/^\r?\n/, "");
  14281. }
  14282. }
  14283. if (ns === 0 && currentOptions.isPreTag(tag)) {
  14284. inPre--;
  14285. }
  14286. if (currentVPreBoundary === el) {
  14287. inVPre = tokenizer.inVPre = false;
  14288. currentVPreBoundary = null;
  14289. }
  14290. if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
  14291. tokenizer.inXML = false;
  14292. }
  14293. }
  14294. function lookAhead(index, c) {
  14295. let i = index;
  14296. while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
  14297. return i;
  14298. }
  14299. function backTrack(index, c) {
  14300. let i = index;
  14301. while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
  14302. return i;
  14303. }
  14304. const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
  14305. function isFragmentTemplate({ tag, props }) {
  14306. if (tag === "template") {
  14307. for (let i = 0; i < props.length; i++) {
  14308. if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
  14309. return true;
  14310. }
  14311. }
  14312. }
  14313. return false;
  14314. }
  14315. function isComponent({ tag, props }) {
  14316. if (currentOptions.isCustomElement(tag)) {
  14317. return false;
  14318. }
  14319. if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
  14320. return true;
  14321. }
  14322. for (let i = 0; i < props.length; i++) {
  14323. const p = props[i];
  14324. if (p.type === 6) {
  14325. if (p.name === "is" && p.value) {
  14326. if (p.value.content.startsWith("vue:")) {
  14327. return true;
  14328. }
  14329. }
  14330. }
  14331. }
  14332. return false;
  14333. }
  14334. function isUpperCase(c) {
  14335. return c > 64 && c < 91;
  14336. }
  14337. const windowsNewlineRE = /\r\n/g;
  14338. function condenseWhitespace(nodes, tag) {
  14339. const shouldCondense = currentOptions.whitespace !== "preserve";
  14340. let removedWhitespace = false;
  14341. for (let i = 0; i < nodes.length; i++) {
  14342. const node = nodes[i];
  14343. if (node.type === 2) {
  14344. if (!inPre) {
  14345. if (isAllWhitespace(node.content)) {
  14346. const prev = nodes[i - 1] && nodes[i - 1].type;
  14347. const next = nodes[i + 1] && nodes[i + 1].type;
  14348. if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
  14349. removedWhitespace = true;
  14350. nodes[i] = null;
  14351. } else {
  14352. node.content = " ";
  14353. }
  14354. } else if (shouldCondense) {
  14355. node.content = condense(node.content);
  14356. }
  14357. } else {
  14358. node.content = node.content.replace(windowsNewlineRE, "\n");
  14359. }
  14360. }
  14361. }
  14362. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  14363. }
  14364. function isAllWhitespace(str) {
  14365. for (let i = 0; i < str.length; i++) {
  14366. if (!isWhitespace(str.charCodeAt(i))) {
  14367. return false;
  14368. }
  14369. }
  14370. return true;
  14371. }
  14372. function hasNewlineChar(str) {
  14373. for (let i = 0; i < str.length; i++) {
  14374. const c = str.charCodeAt(i);
  14375. if (c === 10 || c === 13) {
  14376. return true;
  14377. }
  14378. }
  14379. return false;
  14380. }
  14381. function condense(str) {
  14382. let ret = "";
  14383. let prevCharIsWhitespace = false;
  14384. for (let i = 0; i < str.length; i++) {
  14385. if (isWhitespace(str.charCodeAt(i))) {
  14386. if (!prevCharIsWhitespace) {
  14387. ret += " ";
  14388. prevCharIsWhitespace = true;
  14389. }
  14390. } else {
  14391. ret += str[i];
  14392. prevCharIsWhitespace = false;
  14393. }
  14394. }
  14395. return ret;
  14396. }
  14397. function addNode(node) {
  14398. (stack[0] || currentRoot).children.push(node);
  14399. }
  14400. function getLoc(start, end) {
  14401. return {
  14402. start: tokenizer.getPos(start),
  14403. // @ts-expect-error allow late attachment
  14404. end: end == null ? end : tokenizer.getPos(end),
  14405. // @ts-expect-error allow late attachment
  14406. source: end == null ? end : getSlice(start, end)
  14407. };
  14408. }
  14409. function cloneLoc(loc) {
  14410. return getLoc(loc.start.offset, loc.end.offset);
  14411. }
  14412. function setLocEnd(loc, end) {
  14413. loc.end = tokenizer.getPos(end);
  14414. loc.source = getSlice(loc.start.offset, end);
  14415. }
  14416. function dirToAttr(dir) {
  14417. const attr = {
  14418. type: 6,
  14419. name: dir.rawName,
  14420. nameLoc: getLoc(
  14421. dir.loc.start.offset,
  14422. dir.loc.start.offset + dir.rawName.length
  14423. ),
  14424. value: void 0,
  14425. loc: dir.loc
  14426. };
  14427. if (dir.exp) {
  14428. const loc = dir.exp.loc;
  14429. if (loc.end.offset < dir.loc.end.offset) {
  14430. loc.start.offset--;
  14431. loc.start.column--;
  14432. loc.end.offset++;
  14433. loc.end.column++;
  14434. }
  14435. attr.value = {
  14436. type: 2,
  14437. content: dir.exp.content,
  14438. loc
  14439. };
  14440. }
  14441. return attr;
  14442. }
  14443. function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
  14444. const exp = createSimpleExpression(content, isStatic, loc, constType);
  14445. return exp;
  14446. }
  14447. function emitError(code, index, message) {
  14448. currentOptions.onError(
  14449. createCompilerError(code, getLoc(index, index), void 0, message)
  14450. );
  14451. }
  14452. function reset() {
  14453. tokenizer.reset();
  14454. currentOpenTag = null;
  14455. currentProp = null;
  14456. currentAttrValue = "";
  14457. currentAttrStartIndex = -1;
  14458. currentAttrEndIndex = -1;
  14459. stack.length = 0;
  14460. }
  14461. function baseParse(input, options) {
  14462. reset();
  14463. currentInput = input;
  14464. currentOptions = extend({}, defaultParserOptions);
  14465. if (options) {
  14466. let key;
  14467. for (key in options) {
  14468. if (options[key] != null) {
  14469. currentOptions[key] = options[key];
  14470. }
  14471. }
  14472. }
  14473. {
  14474. if (!currentOptions.decodeEntities) {
  14475. throw new Error(
  14476. `[@vue/compiler-core] decodeEntities option is required in browser builds.`
  14477. );
  14478. }
  14479. }
  14480. tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
  14481. tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
  14482. const delimiters = options && options.delimiters;
  14483. if (delimiters) {
  14484. tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
  14485. tokenizer.delimiterClose = toCharCodes(delimiters[1]);
  14486. }
  14487. const root = currentRoot = createRoot([], input);
  14488. tokenizer.parse(currentInput);
  14489. root.loc = getLoc(0, input.length);
  14490. root.children = condenseWhitespace(root.children);
  14491. currentRoot = null;
  14492. return root;
  14493. }
  14494. function cacheStatic(root, context) {
  14495. walk(
  14496. root,
  14497. void 0,
  14498. context,
  14499. // Root node is unfortunately non-hoistable due to potential parent
  14500. // fallthrough attributes.
  14501. isSingleElementRoot(root, root.children[0])
  14502. );
  14503. }
  14504. function isSingleElementRoot(root, child) {
  14505. const { children } = root;
  14506. return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
  14507. }
  14508. function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
  14509. const { children } = node;
  14510. const toCache = [];
  14511. for (let i = 0; i < children.length; i++) {
  14512. const child = children[i];
  14513. if (child.type === 1 && child.tagType === 0) {
  14514. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  14515. if (constantType > 0) {
  14516. if (constantType >= 2) {
  14517. child.codegenNode.patchFlag = -1;
  14518. toCache.push(child);
  14519. continue;
  14520. }
  14521. } else {
  14522. const codegenNode = child.codegenNode;
  14523. if (codegenNode.type === 13) {
  14524. const flag = codegenNode.patchFlag;
  14525. if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
  14526. const props = getNodeProps(child);
  14527. if (props) {
  14528. codegenNode.props = context.hoist(props);
  14529. }
  14530. }
  14531. if (codegenNode.dynamicProps) {
  14532. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  14533. }
  14534. }
  14535. }
  14536. } else if (child.type === 12) {
  14537. const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
  14538. if (constantType >= 2) {
  14539. toCache.push(child);
  14540. continue;
  14541. }
  14542. }
  14543. if (child.type === 1) {
  14544. const isComponent = child.tagType === 1;
  14545. if (isComponent) {
  14546. context.scopes.vSlot++;
  14547. }
  14548. walk(child, node, context, false, inFor);
  14549. if (isComponent) {
  14550. context.scopes.vSlot--;
  14551. }
  14552. } else if (child.type === 11) {
  14553. walk(child, node, context, child.children.length === 1, true);
  14554. } else if (child.type === 9) {
  14555. for (let i2 = 0; i2 < child.branches.length; i2++) {
  14556. walk(
  14557. child.branches[i2],
  14558. node,
  14559. context,
  14560. child.branches[i2].children.length === 1,
  14561. inFor
  14562. );
  14563. }
  14564. }
  14565. }
  14566. let cachedAsArray = false;
  14567. if (toCache.length === children.length && node.type === 1) {
  14568. if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
  14569. node.codegenNode.children = getCacheExpression(
  14570. createArrayExpression(node.codegenNode.children)
  14571. );
  14572. cachedAsArray = true;
  14573. } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
  14574. const slot = getSlotNode(node.codegenNode, "default");
  14575. if (slot) {
  14576. slot.returns = getCacheExpression(
  14577. createArrayExpression(slot.returns)
  14578. );
  14579. cachedAsArray = true;
  14580. }
  14581. } 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) {
  14582. const slotName = findDir(node, "slot", true);
  14583. const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
  14584. if (slot) {
  14585. slot.returns = getCacheExpression(
  14586. createArrayExpression(slot.returns)
  14587. );
  14588. cachedAsArray = true;
  14589. }
  14590. }
  14591. }
  14592. if (!cachedAsArray) {
  14593. for (const child of toCache) {
  14594. child.codegenNode = context.cache(child.codegenNode);
  14595. }
  14596. }
  14597. function getCacheExpression(value) {
  14598. const exp = context.cache(value);
  14599. if (inFor && context.hmr) {
  14600. exp.needArraySpread = true;
  14601. }
  14602. return exp;
  14603. }
  14604. function getSlotNode(node2, name) {
  14605. if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
  14606. const slot = node2.children.properties.find(
  14607. (p) => p.key === name || p.key.content === name
  14608. );
  14609. return slot && slot.value;
  14610. }
  14611. }
  14612. if (toCache.length && context.transformHoist) {
  14613. context.transformHoist(children, context, node);
  14614. }
  14615. }
  14616. function getConstantType(node, context) {
  14617. const { constantCache } = context;
  14618. switch (node.type) {
  14619. case 1:
  14620. if (node.tagType !== 0) {
  14621. return 0;
  14622. }
  14623. const cached = constantCache.get(node);
  14624. if (cached !== void 0) {
  14625. return cached;
  14626. }
  14627. const codegenNode = node.codegenNode;
  14628. if (codegenNode.type !== 13) {
  14629. return 0;
  14630. }
  14631. if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
  14632. return 0;
  14633. }
  14634. if (codegenNode.patchFlag === void 0) {
  14635. let returnType2 = 3;
  14636. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  14637. if (generatedPropsType === 0) {
  14638. constantCache.set(node, 0);
  14639. return 0;
  14640. }
  14641. if (generatedPropsType < returnType2) {
  14642. returnType2 = generatedPropsType;
  14643. }
  14644. for (let i = 0; i < node.children.length; i++) {
  14645. const childType = getConstantType(node.children[i], context);
  14646. if (childType === 0) {
  14647. constantCache.set(node, 0);
  14648. return 0;
  14649. }
  14650. if (childType < returnType2) {
  14651. returnType2 = childType;
  14652. }
  14653. }
  14654. if (returnType2 > 1) {
  14655. for (let i = 0; i < node.props.length; i++) {
  14656. const p = node.props[i];
  14657. if (p.type === 7 && p.name === "bind" && p.exp) {
  14658. const expType = getConstantType(p.exp, context);
  14659. if (expType === 0) {
  14660. constantCache.set(node, 0);
  14661. return 0;
  14662. }
  14663. if (expType < returnType2) {
  14664. returnType2 = expType;
  14665. }
  14666. }
  14667. }
  14668. }
  14669. if (codegenNode.isBlock) {
  14670. for (let i = 0; i < node.props.length; i++) {
  14671. const p = node.props[i];
  14672. if (p.type === 7) {
  14673. constantCache.set(node, 0);
  14674. return 0;
  14675. }
  14676. }
  14677. context.removeHelper(OPEN_BLOCK);
  14678. context.removeHelper(
  14679. getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
  14680. );
  14681. codegenNode.isBlock = false;
  14682. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  14683. }
  14684. constantCache.set(node, returnType2);
  14685. return returnType2;
  14686. } else {
  14687. constantCache.set(node, 0);
  14688. return 0;
  14689. }
  14690. case 2:
  14691. case 3:
  14692. return 3;
  14693. case 9:
  14694. case 11:
  14695. case 10:
  14696. return 0;
  14697. case 5:
  14698. case 12:
  14699. return getConstantType(node.content, context);
  14700. case 4:
  14701. return node.constType;
  14702. case 8:
  14703. let returnType = 3;
  14704. for (let i = 0; i < node.children.length; i++) {
  14705. const child = node.children[i];
  14706. if (isString(child) || isSymbol(child)) {
  14707. continue;
  14708. }
  14709. const childType = getConstantType(child, context);
  14710. if (childType === 0) {
  14711. return 0;
  14712. } else if (childType < returnType) {
  14713. returnType = childType;
  14714. }
  14715. }
  14716. return returnType;
  14717. case 20:
  14718. return 2;
  14719. default:
  14720. return 0;
  14721. }
  14722. }
  14723. const allowHoistedHelperSet = /* @__PURE__ */ new Set([
  14724. NORMALIZE_CLASS,
  14725. NORMALIZE_STYLE,
  14726. NORMALIZE_PROPS,
  14727. GUARD_REACTIVE_PROPS
  14728. ]);
  14729. function getConstantTypeOfHelperCall(value, context) {
  14730. if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
  14731. const arg = value.arguments[0];
  14732. if (arg.type === 4) {
  14733. return getConstantType(arg, context);
  14734. } else if (arg.type === 14) {
  14735. return getConstantTypeOfHelperCall(arg, context);
  14736. }
  14737. }
  14738. return 0;
  14739. }
  14740. function getGeneratedPropsConstantType(node, context) {
  14741. let returnType = 3;
  14742. const props = getNodeProps(node);
  14743. if (props && props.type === 15) {
  14744. const { properties } = props;
  14745. for (let i = 0; i < properties.length; i++) {
  14746. const { key, value } = properties[i];
  14747. const keyType = getConstantType(key, context);
  14748. if (keyType === 0) {
  14749. return keyType;
  14750. }
  14751. if (keyType < returnType) {
  14752. returnType = keyType;
  14753. }
  14754. let valueType;
  14755. if (value.type === 4) {
  14756. valueType = getConstantType(value, context);
  14757. } else if (value.type === 14) {
  14758. valueType = getConstantTypeOfHelperCall(value, context);
  14759. } else {
  14760. valueType = 0;
  14761. }
  14762. if (valueType === 0) {
  14763. return valueType;
  14764. }
  14765. if (valueType < returnType) {
  14766. returnType = valueType;
  14767. }
  14768. }
  14769. }
  14770. return returnType;
  14771. }
  14772. function getNodeProps(node) {
  14773. const codegenNode = node.codegenNode;
  14774. if (codegenNode.type === 13) {
  14775. return codegenNode.props;
  14776. }
  14777. }
  14778. function createTransformContext(root, {
  14779. filename = "",
  14780. prefixIdentifiers = false,
  14781. hoistStatic = false,
  14782. hmr = false,
  14783. cacheHandlers = false,
  14784. nodeTransforms = [],
  14785. directiveTransforms = {},
  14786. transformHoist = null,
  14787. isBuiltInComponent = NOOP,
  14788. isCustomElement = NOOP,
  14789. expressionPlugins = [],
  14790. scopeId = null,
  14791. slotted = true,
  14792. ssr = false,
  14793. inSSR = false,
  14794. ssrCssVars = ``,
  14795. bindingMetadata = EMPTY_OBJ,
  14796. inline = false,
  14797. isTS = false,
  14798. onError = defaultOnError,
  14799. onWarn = defaultOnWarn,
  14800. compatConfig
  14801. }) {
  14802. const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
  14803. const context = {
  14804. // options
  14805. filename,
  14806. selfName: nameMatch && capitalize(camelize(nameMatch[1])),
  14807. prefixIdentifiers,
  14808. hoistStatic,
  14809. hmr,
  14810. cacheHandlers,
  14811. nodeTransforms,
  14812. directiveTransforms,
  14813. transformHoist,
  14814. isBuiltInComponent,
  14815. isCustomElement,
  14816. expressionPlugins,
  14817. scopeId,
  14818. slotted,
  14819. ssr,
  14820. inSSR,
  14821. ssrCssVars,
  14822. bindingMetadata,
  14823. inline,
  14824. isTS,
  14825. onError,
  14826. onWarn,
  14827. compatConfig,
  14828. // state
  14829. root,
  14830. helpers: /* @__PURE__ */ new Map(),
  14831. components: /* @__PURE__ */ new Set(),
  14832. directives: /* @__PURE__ */ new Set(),
  14833. hoists: [],
  14834. imports: [],
  14835. cached: [],
  14836. constantCache: /* @__PURE__ */ new WeakMap(),
  14837. temps: 0,
  14838. identifiers: /* @__PURE__ */ Object.create(null),
  14839. scopes: {
  14840. vFor: 0,
  14841. vSlot: 0,
  14842. vPre: 0,
  14843. vOnce: 0
  14844. },
  14845. parent: null,
  14846. grandParent: null,
  14847. currentNode: root,
  14848. childIndex: 0,
  14849. inVOnce: false,
  14850. // methods
  14851. helper(name) {
  14852. const count = context.helpers.get(name) || 0;
  14853. context.helpers.set(name, count + 1);
  14854. return name;
  14855. },
  14856. removeHelper(name) {
  14857. const count = context.helpers.get(name);
  14858. if (count) {
  14859. const currentCount = count - 1;
  14860. if (!currentCount) {
  14861. context.helpers.delete(name);
  14862. } else {
  14863. context.helpers.set(name, currentCount);
  14864. }
  14865. }
  14866. },
  14867. helperString(name) {
  14868. return `_${helperNameMap[context.helper(name)]}`;
  14869. },
  14870. replaceNode(node) {
  14871. {
  14872. if (!context.currentNode) {
  14873. throw new Error(`Node being replaced is already removed.`);
  14874. }
  14875. if (!context.parent) {
  14876. throw new Error(`Cannot replace root node.`);
  14877. }
  14878. }
  14879. context.parent.children[context.childIndex] = context.currentNode = node;
  14880. },
  14881. removeNode(node) {
  14882. if (!context.parent) {
  14883. throw new Error(`Cannot remove root node.`);
  14884. }
  14885. const list = context.parent.children;
  14886. const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
  14887. if (removalIndex < 0) {
  14888. throw new Error(`node being removed is not a child of current parent`);
  14889. }
  14890. if (!node || node === context.currentNode) {
  14891. context.currentNode = null;
  14892. context.onNodeRemoved();
  14893. } else {
  14894. if (context.childIndex > removalIndex) {
  14895. context.childIndex--;
  14896. context.onNodeRemoved();
  14897. }
  14898. }
  14899. context.parent.children.splice(removalIndex, 1);
  14900. },
  14901. onNodeRemoved: NOOP,
  14902. addIdentifiers(exp) {
  14903. },
  14904. removeIdentifiers(exp) {
  14905. },
  14906. hoist(exp) {
  14907. if (isString(exp)) exp = createSimpleExpression(exp);
  14908. context.hoists.push(exp);
  14909. const identifier = createSimpleExpression(
  14910. `_hoisted_${context.hoists.length}`,
  14911. false,
  14912. exp.loc,
  14913. 2
  14914. );
  14915. identifier.hoisted = exp;
  14916. return identifier;
  14917. },
  14918. cache(exp, isVNode = false) {
  14919. const cacheExp = createCacheExpression(
  14920. context.cached.length,
  14921. exp,
  14922. isVNode
  14923. );
  14924. context.cached.push(cacheExp);
  14925. return cacheExp;
  14926. }
  14927. };
  14928. return context;
  14929. }
  14930. function transform(root, options) {
  14931. const context = createTransformContext(root, options);
  14932. traverseNode(root, context);
  14933. if (options.hoistStatic) {
  14934. cacheStatic(root, context);
  14935. }
  14936. if (!options.ssr) {
  14937. createRootCodegen(root, context);
  14938. }
  14939. root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
  14940. root.components = [...context.components];
  14941. root.directives = [...context.directives];
  14942. root.imports = context.imports;
  14943. root.hoists = context.hoists;
  14944. root.temps = context.temps;
  14945. root.cached = context.cached;
  14946. root.transformed = true;
  14947. }
  14948. function createRootCodegen(root, context) {
  14949. const { helper } = context;
  14950. const { children } = root;
  14951. if (children.length === 1) {
  14952. const child = children[0];
  14953. if (isSingleElementRoot(root, child) && child.codegenNode) {
  14954. const codegenNode = child.codegenNode;
  14955. if (codegenNode.type === 13) {
  14956. convertToBlock(codegenNode, context);
  14957. }
  14958. root.codegenNode = codegenNode;
  14959. } else {
  14960. root.codegenNode = child;
  14961. }
  14962. } else if (children.length > 1) {
  14963. let patchFlag = 64;
  14964. if (children.filter((c) => c.type !== 3).length === 1) {
  14965. patchFlag |= 2048;
  14966. }
  14967. root.codegenNode = createVNodeCall(
  14968. context,
  14969. helper(FRAGMENT),
  14970. void 0,
  14971. root.children,
  14972. patchFlag,
  14973. void 0,
  14974. void 0,
  14975. true,
  14976. void 0,
  14977. false
  14978. );
  14979. } else ;
  14980. }
  14981. function traverseChildren(parent, context) {
  14982. let i = 0;
  14983. const nodeRemoved = () => {
  14984. i--;
  14985. };
  14986. for (; i < parent.children.length; i++) {
  14987. const child = parent.children[i];
  14988. if (isString(child)) continue;
  14989. context.grandParent = context.parent;
  14990. context.parent = parent;
  14991. context.childIndex = i;
  14992. context.onNodeRemoved = nodeRemoved;
  14993. traverseNode(child, context);
  14994. }
  14995. }
  14996. function traverseNode(node, context) {
  14997. context.currentNode = node;
  14998. const { nodeTransforms } = context;
  14999. const exitFns = [];
  15000. for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
  15001. const onExit = nodeTransforms[i2](node, context);
  15002. if (onExit) {
  15003. if (isArray(onExit)) {
  15004. exitFns.push(...onExit);
  15005. } else {
  15006. exitFns.push(onExit);
  15007. }
  15008. }
  15009. if (!context.currentNode) {
  15010. return;
  15011. } else {
  15012. node = context.currentNode;
  15013. }
  15014. }
  15015. switch (node.type) {
  15016. case 3:
  15017. if (!context.ssr) {
  15018. context.helper(CREATE_COMMENT);
  15019. }
  15020. break;
  15021. case 5:
  15022. if (!context.ssr) {
  15023. context.helper(TO_DISPLAY_STRING);
  15024. }
  15025. break;
  15026. // for container types, further traverse downwards
  15027. case 9:
  15028. for (let i2 = 0; i2 < node.branches.length; i2++) {
  15029. traverseNode(node.branches[i2], context);
  15030. }
  15031. break;
  15032. case 10:
  15033. case 11:
  15034. case 1:
  15035. case 0:
  15036. traverseChildren(node, context);
  15037. break;
  15038. }
  15039. context.currentNode = node;
  15040. let i = exitFns.length;
  15041. while (i--) {
  15042. exitFns[i]();
  15043. }
  15044. }
  15045. function createStructuralDirectiveTransform(name, fn) {
  15046. const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
  15047. return (node, context) => {
  15048. if (node.type === 1) {
  15049. const { props } = node;
  15050. if (node.tagType === 3 && props.some(isVSlot)) {
  15051. return;
  15052. }
  15053. const exitFns = [];
  15054. for (let i = 0; i < props.length; i++) {
  15055. const prop = props[i];
  15056. if (prop.type === 7 && matches(prop.name)) {
  15057. props.splice(i, 1);
  15058. i--;
  15059. const onExit = fn(node, prop, context);
  15060. if (onExit) exitFns.push(onExit);
  15061. }
  15062. }
  15063. return exitFns;
  15064. }
  15065. };
  15066. }
  15067. const PURE_ANNOTATION = `/*@__PURE__*/`;
  15068. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  15069. function createCodegenContext(ast, {
  15070. mode = "function",
  15071. prefixIdentifiers = mode === "module",
  15072. sourceMap = false,
  15073. filename = `template.vue.html`,
  15074. scopeId = null,
  15075. optimizeImports = false,
  15076. runtimeGlobalName = `Vue`,
  15077. runtimeModuleName = `vue`,
  15078. ssrRuntimeModuleName = "vue/server-renderer",
  15079. ssr = false,
  15080. isTS = false,
  15081. inSSR = false
  15082. }) {
  15083. const context = {
  15084. mode,
  15085. prefixIdentifiers,
  15086. sourceMap,
  15087. filename,
  15088. scopeId,
  15089. optimizeImports,
  15090. runtimeGlobalName,
  15091. runtimeModuleName,
  15092. ssrRuntimeModuleName,
  15093. ssr,
  15094. isTS,
  15095. inSSR,
  15096. source: ast.source,
  15097. code: ``,
  15098. column: 1,
  15099. line: 1,
  15100. offset: 0,
  15101. indentLevel: 0,
  15102. pure: false,
  15103. map: void 0,
  15104. helper(key) {
  15105. return `_${helperNameMap[key]}`;
  15106. },
  15107. push(code, newlineIndex = -2 /* None */, node) {
  15108. context.code += code;
  15109. },
  15110. indent() {
  15111. newline(++context.indentLevel);
  15112. },
  15113. deindent(withoutNewLine = false) {
  15114. if (withoutNewLine) {
  15115. --context.indentLevel;
  15116. } else {
  15117. newline(--context.indentLevel);
  15118. }
  15119. },
  15120. newline() {
  15121. newline(context.indentLevel);
  15122. }
  15123. };
  15124. function newline(n) {
  15125. context.push("\n" + ` `.repeat(n), 0 /* Start */);
  15126. }
  15127. return context;
  15128. }
  15129. function generate(ast, options = {}) {
  15130. const context = createCodegenContext(ast, options);
  15131. if (options.onContextCreated) options.onContextCreated(context);
  15132. const {
  15133. mode,
  15134. push,
  15135. prefixIdentifiers,
  15136. indent,
  15137. deindent,
  15138. newline,
  15139. scopeId,
  15140. ssr
  15141. } = context;
  15142. const helpers = Array.from(ast.helpers);
  15143. const hasHelpers = helpers.length > 0;
  15144. const useWithBlock = !prefixIdentifiers && mode !== "module";
  15145. const preambleContext = context;
  15146. {
  15147. genFunctionPreamble(ast, preambleContext);
  15148. }
  15149. const functionName = ssr ? `ssrRender` : `render`;
  15150. const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
  15151. const signature = args.join(", ");
  15152. {
  15153. push(`function ${functionName}(${signature}) {`);
  15154. }
  15155. indent();
  15156. if (useWithBlock) {
  15157. push(`with (_ctx) {`);
  15158. indent();
  15159. if (hasHelpers) {
  15160. push(
  15161. `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
  15162. `,
  15163. -1 /* End */
  15164. );
  15165. newline();
  15166. }
  15167. }
  15168. if (ast.components.length) {
  15169. genAssets(ast.components, "component", context);
  15170. if (ast.directives.length || ast.temps > 0) {
  15171. newline();
  15172. }
  15173. }
  15174. if (ast.directives.length) {
  15175. genAssets(ast.directives, "directive", context);
  15176. if (ast.temps > 0) {
  15177. newline();
  15178. }
  15179. }
  15180. if (ast.temps > 0) {
  15181. push(`let `);
  15182. for (let i = 0; i < ast.temps; i++) {
  15183. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  15184. }
  15185. }
  15186. if (ast.components.length || ast.directives.length || ast.temps) {
  15187. push(`
  15188. `, 0 /* Start */);
  15189. newline();
  15190. }
  15191. if (!ssr) {
  15192. push(`return `);
  15193. }
  15194. if (ast.codegenNode) {
  15195. genNode(ast.codegenNode, context);
  15196. } else {
  15197. push(`null`);
  15198. }
  15199. if (useWithBlock) {
  15200. deindent();
  15201. push(`}`);
  15202. }
  15203. deindent();
  15204. push(`}`);
  15205. return {
  15206. ast,
  15207. code: context.code,
  15208. preamble: ``,
  15209. map: context.map ? context.map.toJSON() : void 0
  15210. };
  15211. }
  15212. function genFunctionPreamble(ast, context) {
  15213. const {
  15214. ssr,
  15215. prefixIdentifiers,
  15216. push,
  15217. newline,
  15218. runtimeModuleName,
  15219. runtimeGlobalName,
  15220. ssrRuntimeModuleName
  15221. } = context;
  15222. const VueBinding = runtimeGlobalName;
  15223. const helpers = Array.from(ast.helpers);
  15224. if (helpers.length > 0) {
  15225. {
  15226. push(`const _Vue = ${VueBinding}
  15227. `, -1 /* End */);
  15228. if (ast.hoists.length) {
  15229. const staticHelpers = [
  15230. CREATE_VNODE,
  15231. CREATE_ELEMENT_VNODE,
  15232. CREATE_COMMENT,
  15233. CREATE_TEXT,
  15234. CREATE_STATIC
  15235. ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
  15236. push(`const { ${staticHelpers} } = _Vue
  15237. `, -1 /* End */);
  15238. }
  15239. }
  15240. }
  15241. genHoists(ast.hoists, context);
  15242. newline();
  15243. push(`return `);
  15244. }
  15245. function genAssets(assets, type, { helper, push, newline, isTS }) {
  15246. const resolver = helper(
  15247. type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
  15248. );
  15249. for (let i = 0; i < assets.length; i++) {
  15250. let id = assets[i];
  15251. const maybeSelfReference = id.endsWith("__self");
  15252. if (maybeSelfReference) {
  15253. id = id.slice(0, -6);
  15254. }
  15255. push(
  15256. `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
  15257. );
  15258. if (i < assets.length - 1) {
  15259. newline();
  15260. }
  15261. }
  15262. }
  15263. function genHoists(hoists, context) {
  15264. if (!hoists.length) {
  15265. return;
  15266. }
  15267. context.pure = true;
  15268. const { push, newline } = context;
  15269. newline();
  15270. for (let i = 0; i < hoists.length; i++) {
  15271. const exp = hoists[i];
  15272. if (exp) {
  15273. push(`const _hoisted_${i + 1} = `);
  15274. genNode(exp, context);
  15275. newline();
  15276. }
  15277. }
  15278. context.pure = false;
  15279. }
  15280. function isText(n) {
  15281. return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
  15282. }
  15283. function genNodeListAsArray(nodes, context) {
  15284. const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
  15285. context.push(`[`);
  15286. multilines && context.indent();
  15287. genNodeList(nodes, context, multilines);
  15288. multilines && context.deindent();
  15289. context.push(`]`);
  15290. }
  15291. function genNodeList(nodes, context, multilines = false, comma = true) {
  15292. const { push, newline } = context;
  15293. for (let i = 0; i < nodes.length; i++) {
  15294. const node = nodes[i];
  15295. if (isString(node)) {
  15296. push(node, -3 /* Unknown */);
  15297. } else if (isArray(node)) {
  15298. genNodeListAsArray(node, context);
  15299. } else {
  15300. genNode(node, context);
  15301. }
  15302. if (i < nodes.length - 1) {
  15303. if (multilines) {
  15304. comma && push(",");
  15305. newline();
  15306. } else {
  15307. comma && push(", ");
  15308. }
  15309. }
  15310. }
  15311. }
  15312. function genNode(node, context) {
  15313. if (isString(node)) {
  15314. context.push(node, -3 /* Unknown */);
  15315. return;
  15316. }
  15317. if (isSymbol(node)) {
  15318. context.push(context.helper(node));
  15319. return;
  15320. }
  15321. switch (node.type) {
  15322. case 1:
  15323. case 9:
  15324. case 11:
  15325. assert(
  15326. node.codegenNode != null,
  15327. `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
  15328. );
  15329. genNode(node.codegenNode, context);
  15330. break;
  15331. case 2:
  15332. genText(node, context);
  15333. break;
  15334. case 4:
  15335. genExpression(node, context);
  15336. break;
  15337. case 5:
  15338. genInterpolation(node, context);
  15339. break;
  15340. case 12:
  15341. genNode(node.codegenNode, context);
  15342. break;
  15343. case 8:
  15344. genCompoundExpression(node, context);
  15345. break;
  15346. case 3:
  15347. genComment(node, context);
  15348. break;
  15349. case 13:
  15350. genVNodeCall(node, context);
  15351. break;
  15352. case 14:
  15353. genCallExpression(node, context);
  15354. break;
  15355. case 15:
  15356. genObjectExpression(node, context);
  15357. break;
  15358. case 17:
  15359. genArrayExpression(node, context);
  15360. break;
  15361. case 18:
  15362. genFunctionExpression(node, context);
  15363. break;
  15364. case 19:
  15365. genConditionalExpression(node, context);
  15366. break;
  15367. case 20:
  15368. genCacheExpression(node, context);
  15369. break;
  15370. case 21:
  15371. genNodeList(node.body, context, true, false);
  15372. break;
  15373. // SSR only types
  15374. case 22:
  15375. break;
  15376. case 23:
  15377. break;
  15378. case 24:
  15379. break;
  15380. case 25:
  15381. break;
  15382. case 26:
  15383. break;
  15384. /* v8 ignore start */
  15385. case 10:
  15386. break;
  15387. default:
  15388. {
  15389. assert(false, `unhandled codegen node type: ${node.type}`);
  15390. const exhaustiveCheck = node;
  15391. return exhaustiveCheck;
  15392. }
  15393. }
  15394. }
  15395. function genText(node, context) {
  15396. context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
  15397. }
  15398. function genExpression(node, context) {
  15399. const { content, isStatic } = node;
  15400. context.push(
  15401. isStatic ? JSON.stringify(content) : content,
  15402. -3 /* Unknown */,
  15403. node
  15404. );
  15405. }
  15406. function genInterpolation(node, context) {
  15407. const { push, helper, pure } = context;
  15408. if (pure) push(PURE_ANNOTATION);
  15409. push(`${helper(TO_DISPLAY_STRING)}(`);
  15410. genNode(node.content, context);
  15411. push(`)`);
  15412. }
  15413. function genCompoundExpression(node, context) {
  15414. for (let i = 0; i < node.children.length; i++) {
  15415. const child = node.children[i];
  15416. if (isString(child)) {
  15417. context.push(child, -3 /* Unknown */);
  15418. } else {
  15419. genNode(child, context);
  15420. }
  15421. }
  15422. }
  15423. function genExpressionAsPropertyKey(node, context) {
  15424. const { push } = context;
  15425. if (node.type === 8) {
  15426. push(`[`);
  15427. genCompoundExpression(node, context);
  15428. push(`]`);
  15429. } else if (node.isStatic) {
  15430. const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
  15431. push(text, -2 /* None */, node);
  15432. } else {
  15433. push(`[${node.content}]`, -3 /* Unknown */, node);
  15434. }
  15435. }
  15436. function genComment(node, context) {
  15437. const { push, helper, pure } = context;
  15438. if (pure) {
  15439. push(PURE_ANNOTATION);
  15440. }
  15441. push(
  15442. `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
  15443. -3 /* Unknown */,
  15444. node
  15445. );
  15446. }
  15447. function genVNodeCall(node, context) {
  15448. const { push, helper, pure } = context;
  15449. const {
  15450. tag,
  15451. props,
  15452. children,
  15453. patchFlag,
  15454. dynamicProps,
  15455. directives,
  15456. isBlock,
  15457. disableTracking,
  15458. isComponent
  15459. } = node;
  15460. let patchFlagString;
  15461. if (patchFlag) {
  15462. {
  15463. if (patchFlag < 0) {
  15464. patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  15465. } else {
  15466. const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
  15467. patchFlagString = patchFlag + ` /* ${flagNames} */`;
  15468. }
  15469. }
  15470. }
  15471. if (directives) {
  15472. push(helper(WITH_DIRECTIVES) + `(`);
  15473. }
  15474. if (isBlock) {
  15475. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  15476. }
  15477. if (pure) {
  15478. push(PURE_ANNOTATION);
  15479. }
  15480. const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
  15481. push(helper(callHelper) + `(`, -2 /* None */, node);
  15482. genNodeList(
  15483. genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
  15484. context
  15485. );
  15486. push(`)`);
  15487. if (isBlock) {
  15488. push(`)`);
  15489. }
  15490. if (directives) {
  15491. push(`, `);
  15492. genNode(directives, context);
  15493. push(`)`);
  15494. }
  15495. }
  15496. function genNullableArgs(args) {
  15497. let i = args.length;
  15498. while (i--) {
  15499. if (args[i] != null) break;
  15500. }
  15501. return args.slice(0, i + 1).map((arg) => arg || `null`);
  15502. }
  15503. function genCallExpression(node, context) {
  15504. const { push, helper, pure } = context;
  15505. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  15506. if (pure) {
  15507. push(PURE_ANNOTATION);
  15508. }
  15509. push(callee + `(`, -2 /* None */, node);
  15510. genNodeList(node.arguments, context);
  15511. push(`)`);
  15512. }
  15513. function genObjectExpression(node, context) {
  15514. const { push, indent, deindent, newline } = context;
  15515. const { properties } = node;
  15516. if (!properties.length) {
  15517. push(`{}`, -2 /* None */, node);
  15518. return;
  15519. }
  15520. const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
  15521. push(multilines ? `{` : `{ `);
  15522. multilines && indent();
  15523. for (let i = 0; i < properties.length; i++) {
  15524. const { key, value } = properties[i];
  15525. genExpressionAsPropertyKey(key, context);
  15526. push(`: `);
  15527. genNode(value, context);
  15528. if (i < properties.length - 1) {
  15529. push(`,`);
  15530. newline();
  15531. }
  15532. }
  15533. multilines && deindent();
  15534. push(multilines ? `}` : ` }`);
  15535. }
  15536. function genArrayExpression(node, context) {
  15537. genNodeListAsArray(node.elements, context);
  15538. }
  15539. function genFunctionExpression(node, context) {
  15540. const { push, indent, deindent } = context;
  15541. const { params, returns, body, newline, isSlot } = node;
  15542. if (isSlot) {
  15543. push(`_${helperNameMap[WITH_CTX]}(`);
  15544. }
  15545. push(`(`, -2 /* None */, node);
  15546. if (isArray(params)) {
  15547. genNodeList(params, context);
  15548. } else if (params) {
  15549. genNode(params, context);
  15550. }
  15551. push(`) => `);
  15552. if (newline || body) {
  15553. push(`{`);
  15554. indent();
  15555. }
  15556. if (returns) {
  15557. if (newline) {
  15558. push(`return `);
  15559. }
  15560. if (isArray(returns)) {
  15561. genNodeListAsArray(returns, context);
  15562. } else {
  15563. genNode(returns, context);
  15564. }
  15565. } else if (body) {
  15566. genNode(body, context);
  15567. }
  15568. if (newline || body) {
  15569. deindent();
  15570. push(`}`);
  15571. }
  15572. if (isSlot) {
  15573. push(`)`);
  15574. }
  15575. }
  15576. function genConditionalExpression(node, context) {
  15577. const { test, consequent, alternate, newline: needNewline } = node;
  15578. const { push, indent, deindent, newline } = context;
  15579. if (test.type === 4) {
  15580. const needsParens = !isSimpleIdentifier(test.content);
  15581. needsParens && push(`(`);
  15582. genExpression(test, context);
  15583. needsParens && push(`)`);
  15584. } else {
  15585. push(`(`);
  15586. genNode(test, context);
  15587. push(`)`);
  15588. }
  15589. needNewline && indent();
  15590. context.indentLevel++;
  15591. needNewline || push(` `);
  15592. push(`? `);
  15593. genNode(consequent, context);
  15594. context.indentLevel--;
  15595. needNewline && newline();
  15596. needNewline || push(` `);
  15597. push(`: `);
  15598. const isNested = alternate.type === 19;
  15599. if (!isNested) {
  15600. context.indentLevel++;
  15601. }
  15602. genNode(alternate, context);
  15603. if (!isNested) {
  15604. context.indentLevel--;
  15605. }
  15606. needNewline && deindent(
  15607. true
  15608. /* without newline */
  15609. );
  15610. }
  15611. function genCacheExpression(node, context) {
  15612. const { push, helper, indent, deindent, newline } = context;
  15613. const { needPauseTracking, needArraySpread } = node;
  15614. if (needArraySpread) {
  15615. push(`[...(`);
  15616. }
  15617. push(`_cache[${node.index}] || (`);
  15618. if (needPauseTracking) {
  15619. indent();
  15620. push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
  15621. newline();
  15622. push(`(`);
  15623. }
  15624. push(`_cache[${node.index}] = `);
  15625. genNode(node.value, context);
  15626. if (needPauseTracking) {
  15627. push(`).cacheIndex = ${node.index},`);
  15628. newline();
  15629. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  15630. newline();
  15631. push(`_cache[${node.index}]`);
  15632. deindent();
  15633. }
  15634. push(`)`);
  15635. if (needArraySpread) {
  15636. push(`)]`);
  15637. }
  15638. }
  15639. const prohibitedKeywordRE = new RegExp(
  15640. "\\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"
  15641. );
  15642. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  15643. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  15644. const exp = node.content;
  15645. if (!exp.trim()) {
  15646. return;
  15647. }
  15648. try {
  15649. new Function(
  15650. asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
  15651. );
  15652. } catch (e) {
  15653. let message = e.message;
  15654. const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
  15655. if (keywordMatch) {
  15656. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  15657. }
  15658. context.onError(
  15659. createCompilerError(
  15660. 45,
  15661. node.loc,
  15662. void 0,
  15663. message
  15664. )
  15665. );
  15666. }
  15667. }
  15668. const transformExpression = (node, context) => {
  15669. if (node.type === 5) {
  15670. node.content = processExpression(
  15671. node.content,
  15672. context
  15673. );
  15674. } else if (node.type === 1) {
  15675. for (let i = 0; i < node.props.length; i++) {
  15676. const dir = node.props[i];
  15677. if (dir.type === 7 && dir.name !== "for") {
  15678. const exp = dir.exp;
  15679. const arg = dir.arg;
  15680. if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
  15681. dir.exp = processExpression(
  15682. exp,
  15683. context,
  15684. // slot args must be processed as function params
  15685. dir.name === "slot"
  15686. );
  15687. }
  15688. if (arg && arg.type === 4 && !arg.isStatic) {
  15689. dir.arg = processExpression(arg, context);
  15690. }
  15691. }
  15692. }
  15693. }
  15694. };
  15695. function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
  15696. {
  15697. {
  15698. validateBrowserExpression(node, context, asParams, asRawStatements);
  15699. }
  15700. return node;
  15701. }
  15702. }
  15703. const transformIf = createStructuralDirectiveTransform(
  15704. /^(if|else|else-if)$/,
  15705. (node, dir, context) => {
  15706. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  15707. const siblings = context.parent.children;
  15708. let i = siblings.indexOf(ifNode);
  15709. let key = 0;
  15710. while (i-- >= 0) {
  15711. const sibling = siblings[i];
  15712. if (sibling && sibling.type === 9) {
  15713. key += sibling.branches.length;
  15714. }
  15715. }
  15716. return () => {
  15717. if (isRoot) {
  15718. ifNode.codegenNode = createCodegenNodeForBranch(
  15719. branch,
  15720. key,
  15721. context
  15722. );
  15723. } else {
  15724. const parentCondition = getParentCondition(ifNode.codegenNode);
  15725. parentCondition.alternate = createCodegenNodeForBranch(
  15726. branch,
  15727. key + ifNode.branches.length - 1,
  15728. context
  15729. );
  15730. }
  15731. };
  15732. });
  15733. }
  15734. );
  15735. function processIf(node, dir, context, processCodegen) {
  15736. if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
  15737. const loc = dir.exp ? dir.exp.loc : node.loc;
  15738. context.onError(
  15739. createCompilerError(28, dir.loc)
  15740. );
  15741. dir.exp = createSimpleExpression(`true`, false, loc);
  15742. }
  15743. if (dir.exp) {
  15744. validateBrowserExpression(dir.exp, context);
  15745. }
  15746. if (dir.name === "if") {
  15747. const branch = createIfBranch(node, dir);
  15748. const ifNode = {
  15749. type: 9,
  15750. loc: cloneLoc(node.loc),
  15751. branches: [branch]
  15752. };
  15753. context.replaceNode(ifNode);
  15754. if (processCodegen) {
  15755. return processCodegen(ifNode, branch, true);
  15756. }
  15757. } else {
  15758. const siblings = context.parent.children;
  15759. const comments = [];
  15760. let i = siblings.indexOf(node);
  15761. while (i-- >= -1) {
  15762. const sibling = siblings[i];
  15763. if (sibling && sibling.type === 3) {
  15764. context.removeNode(sibling);
  15765. comments.unshift(sibling);
  15766. continue;
  15767. }
  15768. if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
  15769. context.removeNode(sibling);
  15770. continue;
  15771. }
  15772. if (sibling && sibling.type === 9) {
  15773. if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
  15774. context.onError(
  15775. createCompilerError(30, node.loc)
  15776. );
  15777. }
  15778. context.removeNode();
  15779. const branch = createIfBranch(node, dir);
  15780. if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
  15781. !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
  15782. branch.children = [...comments, ...branch.children];
  15783. }
  15784. {
  15785. const key = branch.userKey;
  15786. if (key) {
  15787. sibling.branches.forEach(({ userKey }) => {
  15788. if (isSameKey(userKey, key)) {
  15789. context.onError(
  15790. createCompilerError(
  15791. 29,
  15792. branch.userKey.loc
  15793. )
  15794. );
  15795. }
  15796. });
  15797. }
  15798. }
  15799. sibling.branches.push(branch);
  15800. const onExit = processCodegen && processCodegen(sibling, branch, false);
  15801. traverseNode(branch, context);
  15802. if (onExit) onExit();
  15803. context.currentNode = null;
  15804. } else {
  15805. context.onError(
  15806. createCompilerError(30, node.loc)
  15807. );
  15808. }
  15809. break;
  15810. }
  15811. }
  15812. }
  15813. function createIfBranch(node, dir) {
  15814. const isTemplateIf = node.tagType === 3;
  15815. return {
  15816. type: 10,
  15817. loc: node.loc,
  15818. condition: dir.name === "else" ? void 0 : dir.exp,
  15819. children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
  15820. userKey: findProp(node, `key`),
  15821. isTemplateIf
  15822. };
  15823. }
  15824. function createCodegenNodeForBranch(branch, keyIndex, context) {
  15825. if (branch.condition) {
  15826. return createConditionalExpression(
  15827. branch.condition,
  15828. createChildrenCodegenNode(branch, keyIndex, context),
  15829. // make sure to pass in asBlock: true so that the comment node call
  15830. // closes the current block.
  15831. createCallExpression(context.helper(CREATE_COMMENT), [
  15832. '"v-if"' ,
  15833. "true"
  15834. ])
  15835. );
  15836. } else {
  15837. return createChildrenCodegenNode(branch, keyIndex, context);
  15838. }
  15839. }
  15840. function createChildrenCodegenNode(branch, keyIndex, context) {
  15841. const { helper } = context;
  15842. const keyProperty = createObjectProperty(
  15843. `key`,
  15844. createSimpleExpression(
  15845. `${keyIndex}`,
  15846. false,
  15847. locStub,
  15848. 2
  15849. )
  15850. );
  15851. const { children } = branch;
  15852. const firstChild = children[0];
  15853. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
  15854. if (needFragmentWrapper) {
  15855. if (children.length === 1 && firstChild.type === 11) {
  15856. const vnodeCall = firstChild.codegenNode;
  15857. injectProp(vnodeCall, keyProperty, context);
  15858. return vnodeCall;
  15859. } else {
  15860. let patchFlag = 64;
  15861. if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
  15862. patchFlag |= 2048;
  15863. }
  15864. return createVNodeCall(
  15865. context,
  15866. helper(FRAGMENT),
  15867. createObjectExpression([keyProperty]),
  15868. children,
  15869. patchFlag,
  15870. void 0,
  15871. void 0,
  15872. true,
  15873. false,
  15874. false,
  15875. branch.loc
  15876. );
  15877. }
  15878. } else {
  15879. const ret = firstChild.codegenNode;
  15880. const vnodeCall = getMemoedVNodeCall(ret);
  15881. if (vnodeCall.type === 13) {
  15882. convertToBlock(vnodeCall, context);
  15883. }
  15884. injectProp(vnodeCall, keyProperty, context);
  15885. return ret;
  15886. }
  15887. }
  15888. function isSameKey(a, b) {
  15889. if (!a || a.type !== b.type) {
  15890. return false;
  15891. }
  15892. if (a.type === 6) {
  15893. if (a.value.content !== b.value.content) {
  15894. return false;
  15895. }
  15896. } else {
  15897. const exp = a.exp;
  15898. const branchExp = b.exp;
  15899. if (exp.type !== branchExp.type) {
  15900. return false;
  15901. }
  15902. if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
  15903. return false;
  15904. }
  15905. }
  15906. return true;
  15907. }
  15908. function getParentCondition(node) {
  15909. while (true) {
  15910. if (node.type === 19) {
  15911. if (node.alternate.type === 19) {
  15912. node = node.alternate;
  15913. } else {
  15914. return node;
  15915. }
  15916. } else if (node.type === 20) {
  15917. node = node.value;
  15918. }
  15919. }
  15920. }
  15921. const transformBind = (dir, _node, context) => {
  15922. const { modifiers, loc } = dir;
  15923. const arg = dir.arg;
  15924. let { exp } = dir;
  15925. if (exp && exp.type === 4 && !exp.content.trim()) {
  15926. {
  15927. exp = void 0;
  15928. }
  15929. }
  15930. if (!exp) {
  15931. if (arg.type !== 4 || !arg.isStatic) {
  15932. context.onError(
  15933. createCompilerError(
  15934. 52,
  15935. arg.loc
  15936. )
  15937. );
  15938. return {
  15939. props: [
  15940. createObjectProperty(arg, createSimpleExpression("", true, loc))
  15941. ]
  15942. };
  15943. }
  15944. transformBindShorthand(dir);
  15945. exp = dir.exp;
  15946. }
  15947. if (arg.type !== 4) {
  15948. arg.children.unshift(`(`);
  15949. arg.children.push(`) || ""`);
  15950. } else if (!arg.isStatic) {
  15951. arg.content = `${arg.content} || ""`;
  15952. }
  15953. if (modifiers.some((mod) => mod.content === "camel")) {
  15954. if (arg.type === 4) {
  15955. if (arg.isStatic) {
  15956. arg.content = camelize(arg.content);
  15957. } else {
  15958. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  15959. }
  15960. } else {
  15961. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  15962. arg.children.push(`)`);
  15963. }
  15964. }
  15965. if (!context.inSSR) {
  15966. if (modifiers.some((mod) => mod.content === "prop")) {
  15967. injectPrefix(arg, ".");
  15968. }
  15969. if (modifiers.some((mod) => mod.content === "attr")) {
  15970. injectPrefix(arg, "^");
  15971. }
  15972. }
  15973. return {
  15974. props: [createObjectProperty(arg, exp)]
  15975. };
  15976. };
  15977. const transformBindShorthand = (dir, context) => {
  15978. const arg = dir.arg;
  15979. const propName = camelize(arg.content);
  15980. dir.exp = createSimpleExpression(propName, false, arg.loc);
  15981. };
  15982. const injectPrefix = (arg, prefix) => {
  15983. if (arg.type === 4) {
  15984. if (arg.isStatic) {
  15985. arg.content = prefix + arg.content;
  15986. } else {
  15987. arg.content = `\`${prefix}\${${arg.content}}\``;
  15988. }
  15989. } else {
  15990. arg.children.unshift(`'${prefix}' + (`);
  15991. arg.children.push(`)`);
  15992. }
  15993. };
  15994. const transformFor = createStructuralDirectiveTransform(
  15995. "for",
  15996. (node, dir, context) => {
  15997. const { helper, removeHelper } = context;
  15998. return processFor(node, dir, context, (forNode) => {
  15999. const renderExp = createCallExpression(helper(RENDER_LIST), [
  16000. forNode.source
  16001. ]);
  16002. const isTemplate = isTemplateNode(node);
  16003. const memo = findDir(node, "memo");
  16004. const keyProp = findProp(node, `key`, false, true);
  16005. if (keyProp && keyProp.type === 7 && !keyProp.exp) {
  16006. transformBindShorthand(keyProp);
  16007. }
  16008. const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
  16009. const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
  16010. const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
  16011. const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
  16012. forNode.codegenNode = createVNodeCall(
  16013. context,
  16014. helper(FRAGMENT),
  16015. void 0,
  16016. renderExp,
  16017. fragmentFlag,
  16018. void 0,
  16019. void 0,
  16020. true,
  16021. !isStableFragment,
  16022. false,
  16023. node.loc
  16024. );
  16025. return () => {
  16026. let childBlock;
  16027. const { children } = forNode;
  16028. if (isTemplate) {
  16029. node.children.some((c) => {
  16030. if (c.type === 1) {
  16031. const key = findProp(c, "key");
  16032. if (key) {
  16033. context.onError(
  16034. createCompilerError(
  16035. 33,
  16036. key.loc
  16037. )
  16038. );
  16039. return true;
  16040. }
  16041. }
  16042. });
  16043. }
  16044. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
  16045. const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
  16046. if (slotOutlet) {
  16047. childBlock = slotOutlet.codegenNode;
  16048. if (isTemplate && keyProperty) {
  16049. injectProp(childBlock, keyProperty, context);
  16050. }
  16051. } else if (needFragmentWrapper) {
  16052. childBlock = createVNodeCall(
  16053. context,
  16054. helper(FRAGMENT),
  16055. keyProperty ? createObjectExpression([keyProperty]) : void 0,
  16056. node.children,
  16057. 64,
  16058. void 0,
  16059. void 0,
  16060. true,
  16061. void 0,
  16062. false
  16063. );
  16064. } else {
  16065. childBlock = children[0].codegenNode;
  16066. if (isTemplate && keyProperty) {
  16067. injectProp(childBlock, keyProperty, context);
  16068. }
  16069. if (childBlock.isBlock !== !isStableFragment) {
  16070. if (childBlock.isBlock) {
  16071. removeHelper(OPEN_BLOCK);
  16072. removeHelper(
  16073. getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
  16074. );
  16075. } else {
  16076. removeHelper(
  16077. getVNodeHelper(context.inSSR, childBlock.isComponent)
  16078. );
  16079. }
  16080. }
  16081. childBlock.isBlock = !isStableFragment;
  16082. if (childBlock.isBlock) {
  16083. helper(OPEN_BLOCK);
  16084. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  16085. } else {
  16086. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  16087. }
  16088. }
  16089. if (memo) {
  16090. const loop = createFunctionExpression(
  16091. createForLoopParams(forNode.parseResult, [
  16092. createSimpleExpression(`_cached`)
  16093. ])
  16094. );
  16095. loop.body = createBlockStatement([
  16096. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  16097. createCompoundExpression([
  16098. `if (_cached`,
  16099. ...keyExp ? [` && _cached.key === `, keyExp] : [],
  16100. ` && ${context.helperString(
  16101. IS_MEMO_SAME
  16102. )}(_cached, _memo)) return _cached`
  16103. ]),
  16104. createCompoundExpression([`const _item = `, childBlock]),
  16105. createSimpleExpression(`_item.memo = _memo`),
  16106. createSimpleExpression(`return _item`)
  16107. ]);
  16108. renderExp.arguments.push(
  16109. loop,
  16110. createSimpleExpression(`_cache`),
  16111. createSimpleExpression(String(context.cached.length))
  16112. );
  16113. context.cached.push(null);
  16114. } else {
  16115. renderExp.arguments.push(
  16116. createFunctionExpression(
  16117. createForLoopParams(forNode.parseResult),
  16118. childBlock,
  16119. true
  16120. )
  16121. );
  16122. }
  16123. };
  16124. });
  16125. }
  16126. );
  16127. function processFor(node, dir, context, processCodegen) {
  16128. if (!dir.exp) {
  16129. context.onError(
  16130. createCompilerError(31, dir.loc)
  16131. );
  16132. return;
  16133. }
  16134. const parseResult = dir.forParseResult;
  16135. if (!parseResult) {
  16136. context.onError(
  16137. createCompilerError(32, dir.loc)
  16138. );
  16139. return;
  16140. }
  16141. finalizeForParseResult(parseResult, context);
  16142. const { addIdentifiers, removeIdentifiers, scopes } = context;
  16143. const { source, value, key, index } = parseResult;
  16144. const forNode = {
  16145. type: 11,
  16146. loc: dir.loc,
  16147. source,
  16148. valueAlias: value,
  16149. keyAlias: key,
  16150. objectIndexAlias: index,
  16151. parseResult,
  16152. children: isTemplateNode(node) ? node.children : [node]
  16153. };
  16154. context.replaceNode(forNode);
  16155. scopes.vFor++;
  16156. const onExit = processCodegen && processCodegen(forNode);
  16157. return () => {
  16158. scopes.vFor--;
  16159. if (onExit) onExit();
  16160. };
  16161. }
  16162. function finalizeForParseResult(result, context) {
  16163. if (result.finalized) return;
  16164. {
  16165. validateBrowserExpression(result.source, context);
  16166. if (result.key) {
  16167. validateBrowserExpression(
  16168. result.key,
  16169. context,
  16170. true
  16171. );
  16172. }
  16173. if (result.index) {
  16174. validateBrowserExpression(
  16175. result.index,
  16176. context,
  16177. true
  16178. );
  16179. }
  16180. if (result.value) {
  16181. validateBrowserExpression(
  16182. result.value,
  16183. context,
  16184. true
  16185. );
  16186. }
  16187. }
  16188. result.finalized = true;
  16189. }
  16190. function createForLoopParams({ value, key, index }, memoArgs = []) {
  16191. return createParamsList([value, key, index, ...memoArgs]);
  16192. }
  16193. function createParamsList(args) {
  16194. let i = args.length;
  16195. while (i--) {
  16196. if (args[i]) break;
  16197. }
  16198. return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
  16199. }
  16200. const defaultFallback = createSimpleExpression(`undefined`, false);
  16201. const trackSlotScopes = (node, context) => {
  16202. if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
  16203. const vSlot = findDir(node, "slot");
  16204. if (vSlot) {
  16205. vSlot.exp;
  16206. context.scopes.vSlot++;
  16207. return () => {
  16208. context.scopes.vSlot--;
  16209. };
  16210. }
  16211. }
  16212. };
  16213. const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
  16214. props,
  16215. children,
  16216. false,
  16217. true,
  16218. children.length ? children[0].loc : loc
  16219. );
  16220. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  16221. context.helper(WITH_CTX);
  16222. const { children, loc } = node;
  16223. const slotsProperties = [];
  16224. const dynamicSlots = [];
  16225. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  16226. const onComponentSlot = findDir(node, "slot", true);
  16227. if (onComponentSlot) {
  16228. const { arg, exp } = onComponentSlot;
  16229. if (arg && !isStaticExp(arg)) {
  16230. hasDynamicSlots = true;
  16231. }
  16232. slotsProperties.push(
  16233. createObjectProperty(
  16234. arg || createSimpleExpression("default", true),
  16235. buildSlotFn(exp, void 0, children, loc)
  16236. )
  16237. );
  16238. }
  16239. let hasTemplateSlots = false;
  16240. let hasNamedDefaultSlot = false;
  16241. const implicitDefaultChildren = [];
  16242. const seenSlotNames = /* @__PURE__ */ new Set();
  16243. let conditionalBranchIndex = 0;
  16244. for (let i = 0; i < children.length; i++) {
  16245. const slotElement = children[i];
  16246. let slotDir;
  16247. if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
  16248. if (slotElement.type !== 3) {
  16249. implicitDefaultChildren.push(slotElement);
  16250. }
  16251. continue;
  16252. }
  16253. if (onComponentSlot) {
  16254. context.onError(
  16255. createCompilerError(37, slotDir.loc)
  16256. );
  16257. break;
  16258. }
  16259. hasTemplateSlots = true;
  16260. const { children: slotChildren, loc: slotLoc } = slotElement;
  16261. const {
  16262. arg: slotName = createSimpleExpression(`default`, true),
  16263. exp: slotProps,
  16264. loc: dirLoc
  16265. } = slotDir;
  16266. let staticSlotName;
  16267. if (isStaticExp(slotName)) {
  16268. staticSlotName = slotName ? slotName.content : `default`;
  16269. } else {
  16270. hasDynamicSlots = true;
  16271. }
  16272. const vFor = findDir(slotElement, "for");
  16273. const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
  16274. let vIf;
  16275. let vElse;
  16276. if (vIf = findDir(slotElement, "if")) {
  16277. hasDynamicSlots = true;
  16278. dynamicSlots.push(
  16279. createConditionalExpression(
  16280. vIf.exp,
  16281. buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
  16282. defaultFallback
  16283. )
  16284. );
  16285. } else if (vElse = findDir(
  16286. slotElement,
  16287. /^else(-if)?$/,
  16288. true
  16289. /* allowEmpty */
  16290. )) {
  16291. let j = i;
  16292. let prev;
  16293. while (j--) {
  16294. prev = children[j];
  16295. if (prev.type !== 3) {
  16296. break;
  16297. }
  16298. }
  16299. if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
  16300. let conditional = dynamicSlots[dynamicSlots.length - 1];
  16301. while (conditional.alternate.type === 19) {
  16302. conditional = conditional.alternate;
  16303. }
  16304. conditional.alternate = vElse.exp ? createConditionalExpression(
  16305. vElse.exp,
  16306. buildDynamicSlot(
  16307. slotName,
  16308. slotFunction,
  16309. conditionalBranchIndex++
  16310. ),
  16311. defaultFallback
  16312. ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
  16313. } else {
  16314. context.onError(
  16315. createCompilerError(30, vElse.loc)
  16316. );
  16317. }
  16318. } else if (vFor) {
  16319. hasDynamicSlots = true;
  16320. const parseResult = vFor.forParseResult;
  16321. if (parseResult) {
  16322. finalizeForParseResult(parseResult, context);
  16323. dynamicSlots.push(
  16324. createCallExpression(context.helper(RENDER_LIST), [
  16325. parseResult.source,
  16326. createFunctionExpression(
  16327. createForLoopParams(parseResult),
  16328. buildDynamicSlot(slotName, slotFunction),
  16329. true
  16330. )
  16331. ])
  16332. );
  16333. } else {
  16334. context.onError(
  16335. createCompilerError(
  16336. 32,
  16337. vFor.loc
  16338. )
  16339. );
  16340. }
  16341. } else {
  16342. if (staticSlotName) {
  16343. if (seenSlotNames.has(staticSlotName)) {
  16344. context.onError(
  16345. createCompilerError(
  16346. 38,
  16347. dirLoc
  16348. )
  16349. );
  16350. continue;
  16351. }
  16352. seenSlotNames.add(staticSlotName);
  16353. if (staticSlotName === "default") {
  16354. hasNamedDefaultSlot = true;
  16355. }
  16356. }
  16357. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  16358. }
  16359. }
  16360. if (!onComponentSlot) {
  16361. const buildDefaultSlotProperty = (props, children2) => {
  16362. const fn = buildSlotFn(props, void 0, children2, loc);
  16363. return createObjectProperty(`default`, fn);
  16364. };
  16365. if (!hasTemplateSlots) {
  16366. slotsProperties.push(buildDefaultSlotProperty(void 0, children));
  16367. } else if (implicitDefaultChildren.length && // #3766
  16368. // with whitespace: 'preserve', whitespaces between slots will end up in
  16369. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  16370. implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
  16371. if (hasNamedDefaultSlot) {
  16372. context.onError(
  16373. createCompilerError(
  16374. 39,
  16375. implicitDefaultChildren[0].loc
  16376. )
  16377. );
  16378. } else {
  16379. slotsProperties.push(
  16380. buildDefaultSlotProperty(void 0, implicitDefaultChildren)
  16381. );
  16382. }
  16383. }
  16384. }
  16385. const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
  16386. let slots = createObjectExpression(
  16387. slotsProperties.concat(
  16388. createObjectProperty(
  16389. `_`,
  16390. // 2 = compiled but dynamic = can skip normalization, but must run diff
  16391. // 1 = compiled and static = can skip normalization AND diff as optimized
  16392. createSimpleExpression(
  16393. slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
  16394. false
  16395. )
  16396. )
  16397. ),
  16398. loc
  16399. );
  16400. if (dynamicSlots.length) {
  16401. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  16402. slots,
  16403. createArrayExpression(dynamicSlots)
  16404. ]);
  16405. }
  16406. return {
  16407. slots,
  16408. hasDynamicSlots
  16409. };
  16410. }
  16411. function buildDynamicSlot(name, fn, index) {
  16412. const props = [
  16413. createObjectProperty(`name`, name),
  16414. createObjectProperty(`fn`, fn)
  16415. ];
  16416. if (index != null) {
  16417. props.push(
  16418. createObjectProperty(`key`, createSimpleExpression(String(index), true))
  16419. );
  16420. }
  16421. return createObjectExpression(props);
  16422. }
  16423. function hasForwardedSlots(children) {
  16424. for (let i = 0; i < children.length; i++) {
  16425. const child = children[i];
  16426. switch (child.type) {
  16427. case 1:
  16428. if (child.tagType === 2 || hasForwardedSlots(child.children)) {
  16429. return true;
  16430. }
  16431. break;
  16432. case 9:
  16433. if (hasForwardedSlots(child.branches)) return true;
  16434. break;
  16435. case 10:
  16436. case 11:
  16437. if (hasForwardedSlots(child.children)) return true;
  16438. break;
  16439. }
  16440. }
  16441. return false;
  16442. }
  16443. function isNonWhitespaceContent(node) {
  16444. if (node.type !== 2 && node.type !== 12)
  16445. return true;
  16446. return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
  16447. }
  16448. const directiveImportMap = /* @__PURE__ */ new WeakMap();
  16449. const transformElement = (node, context) => {
  16450. return function postTransformElement() {
  16451. node = context.currentNode;
  16452. if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
  16453. return;
  16454. }
  16455. const { tag, props } = node;
  16456. const isComponent = node.tagType === 1;
  16457. let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
  16458. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  16459. let vnodeProps;
  16460. let vnodeChildren;
  16461. let patchFlag = 0;
  16462. let vnodeDynamicProps;
  16463. let dynamicPropNames;
  16464. let vnodeDirectives;
  16465. let shouldUseBlock = (
  16466. // dynamic component may resolve to plain elements
  16467. isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
  16468. // updates inside get proper isSVG flag at runtime. (#639, #643)
  16469. // This is technically web-specific, but splitting the logic out of core
  16470. // leads to too much unnecessary complexity.
  16471. (tag === "svg" || tag === "foreignObject" || tag === "math")
  16472. );
  16473. if (props.length > 0) {
  16474. const propsBuildResult = buildProps(
  16475. node,
  16476. context,
  16477. void 0,
  16478. isComponent,
  16479. isDynamicComponent
  16480. );
  16481. vnodeProps = propsBuildResult.props;
  16482. patchFlag = propsBuildResult.patchFlag;
  16483. dynamicPropNames = propsBuildResult.dynamicPropNames;
  16484. const directives = propsBuildResult.directives;
  16485. vnodeDirectives = directives && directives.length ? createArrayExpression(
  16486. directives.map((dir) => buildDirectiveArgs(dir, context))
  16487. ) : void 0;
  16488. if (propsBuildResult.shouldUseBlock) {
  16489. shouldUseBlock = true;
  16490. }
  16491. }
  16492. if (node.children.length > 0) {
  16493. if (vnodeTag === KEEP_ALIVE) {
  16494. shouldUseBlock = true;
  16495. patchFlag |= 1024;
  16496. if (node.children.length > 1) {
  16497. context.onError(
  16498. createCompilerError(46, {
  16499. start: node.children[0].loc.start,
  16500. end: node.children[node.children.length - 1].loc.end,
  16501. source: ""
  16502. })
  16503. );
  16504. }
  16505. }
  16506. const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
  16507. vnodeTag !== TELEPORT && // explained above.
  16508. vnodeTag !== KEEP_ALIVE;
  16509. if (shouldBuildAsSlots) {
  16510. const { slots, hasDynamicSlots } = buildSlots(node, context);
  16511. vnodeChildren = slots;
  16512. if (hasDynamicSlots) {
  16513. patchFlag |= 1024;
  16514. }
  16515. } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  16516. const child = node.children[0];
  16517. const type = child.type;
  16518. const hasDynamicTextChild = type === 5 || type === 8;
  16519. if (hasDynamicTextChild && getConstantType(child, context) === 0) {
  16520. patchFlag |= 1;
  16521. }
  16522. if (hasDynamicTextChild || type === 2) {
  16523. vnodeChildren = child;
  16524. } else {
  16525. vnodeChildren = node.children;
  16526. }
  16527. } else {
  16528. vnodeChildren = node.children;
  16529. }
  16530. }
  16531. if (dynamicPropNames && dynamicPropNames.length) {
  16532. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  16533. }
  16534. node.codegenNode = createVNodeCall(
  16535. context,
  16536. vnodeTag,
  16537. vnodeProps,
  16538. vnodeChildren,
  16539. patchFlag === 0 ? void 0 : patchFlag,
  16540. vnodeDynamicProps,
  16541. vnodeDirectives,
  16542. !!shouldUseBlock,
  16543. false,
  16544. isComponent,
  16545. node.loc
  16546. );
  16547. };
  16548. };
  16549. function resolveComponentType(node, context, ssr = false) {
  16550. let { tag } = node;
  16551. const isExplicitDynamic = isComponentTag(tag);
  16552. const isProp = findProp(
  16553. node,
  16554. "is",
  16555. false,
  16556. true
  16557. /* allow empty */
  16558. );
  16559. if (isProp) {
  16560. if (isExplicitDynamic || false) {
  16561. let exp;
  16562. if (isProp.type === 6) {
  16563. exp = isProp.value && createSimpleExpression(isProp.value.content, true);
  16564. } else {
  16565. exp = isProp.exp;
  16566. if (!exp) {
  16567. exp = createSimpleExpression(`is`, false, isProp.arg.loc);
  16568. }
  16569. }
  16570. if (exp) {
  16571. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  16572. exp
  16573. ]);
  16574. }
  16575. } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
  16576. tag = isProp.value.content.slice(4);
  16577. }
  16578. }
  16579. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  16580. if (builtIn) {
  16581. if (!ssr) context.helper(builtIn);
  16582. return builtIn;
  16583. }
  16584. context.helper(RESOLVE_COMPONENT);
  16585. context.components.add(tag);
  16586. return toValidAssetId(tag, `component`);
  16587. }
  16588. function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
  16589. const { tag, loc: elementLoc, children } = node;
  16590. let properties = [];
  16591. const mergeArgs = [];
  16592. const runtimeDirectives = [];
  16593. const hasChildren = children.length > 0;
  16594. let shouldUseBlock = false;
  16595. let patchFlag = 0;
  16596. let hasRef = false;
  16597. let hasClassBinding = false;
  16598. let hasStyleBinding = false;
  16599. let hasHydrationEventBinding = false;
  16600. let hasDynamicKeys = false;
  16601. let hasVnodeHook = false;
  16602. const dynamicPropNames = [];
  16603. const pushMergeArg = (arg) => {
  16604. if (properties.length) {
  16605. mergeArgs.push(
  16606. createObjectExpression(dedupeProperties(properties), elementLoc)
  16607. );
  16608. properties = [];
  16609. }
  16610. if (arg) mergeArgs.push(arg);
  16611. };
  16612. const pushRefVForMarker = () => {
  16613. if (context.scopes.vFor > 0) {
  16614. properties.push(
  16615. createObjectProperty(
  16616. createSimpleExpression("ref_for", true),
  16617. createSimpleExpression("true")
  16618. )
  16619. );
  16620. }
  16621. };
  16622. const analyzePatchFlag = ({ key, value }) => {
  16623. if (isStaticExp(key)) {
  16624. const name = key.content;
  16625. const isEventHandler = isOn(name);
  16626. if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
  16627. // dedicated fast path.
  16628. name.toLowerCase() !== "onclick" && // omit v-model handlers
  16629. name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
  16630. !isReservedProp(name)) {
  16631. hasHydrationEventBinding = true;
  16632. }
  16633. if (isEventHandler && isReservedProp(name)) {
  16634. hasVnodeHook = true;
  16635. }
  16636. if (isEventHandler && value.type === 14) {
  16637. value = value.arguments[0];
  16638. }
  16639. if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
  16640. return;
  16641. }
  16642. if (name === "ref") {
  16643. hasRef = true;
  16644. } else if (name === "class") {
  16645. hasClassBinding = true;
  16646. } else if (name === "style") {
  16647. hasStyleBinding = true;
  16648. } else if (name !== "key" && !dynamicPropNames.includes(name)) {
  16649. dynamicPropNames.push(name);
  16650. }
  16651. if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
  16652. dynamicPropNames.push(name);
  16653. }
  16654. } else {
  16655. hasDynamicKeys = true;
  16656. }
  16657. };
  16658. for (let i = 0; i < props.length; i++) {
  16659. const prop = props[i];
  16660. if (prop.type === 6) {
  16661. const { loc, name, nameLoc, value } = prop;
  16662. let isStatic = true;
  16663. if (name === "ref") {
  16664. hasRef = true;
  16665. pushRefVForMarker();
  16666. }
  16667. if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
  16668. continue;
  16669. }
  16670. properties.push(
  16671. createObjectProperty(
  16672. createSimpleExpression(name, true, nameLoc),
  16673. createSimpleExpression(
  16674. value ? value.content : "",
  16675. isStatic,
  16676. value ? value.loc : loc
  16677. )
  16678. )
  16679. );
  16680. } else {
  16681. const { name, arg, exp, loc, modifiers } = prop;
  16682. const isVBind = name === "bind";
  16683. const isVOn = name === "on";
  16684. if (name === "slot") {
  16685. if (!isComponent) {
  16686. context.onError(
  16687. createCompilerError(40, loc)
  16688. );
  16689. }
  16690. continue;
  16691. }
  16692. if (name === "once" || name === "memo") {
  16693. continue;
  16694. }
  16695. if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
  16696. continue;
  16697. }
  16698. if (isVOn && ssr) {
  16699. continue;
  16700. }
  16701. if (
  16702. // #938: elements with dynamic keys should be forced into blocks
  16703. isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
  16704. // before children
  16705. isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
  16706. ) {
  16707. shouldUseBlock = true;
  16708. }
  16709. if (isVBind && isStaticArgOf(arg, "ref")) {
  16710. pushRefVForMarker();
  16711. }
  16712. if (!arg && (isVBind || isVOn)) {
  16713. hasDynamicKeys = true;
  16714. if (exp) {
  16715. if (isVBind) {
  16716. pushRefVForMarker();
  16717. pushMergeArg();
  16718. mergeArgs.push(exp);
  16719. } else {
  16720. pushMergeArg({
  16721. type: 14,
  16722. loc,
  16723. callee: context.helper(TO_HANDLERS),
  16724. arguments: isComponent ? [exp] : [exp, `true`]
  16725. });
  16726. }
  16727. } else {
  16728. context.onError(
  16729. createCompilerError(
  16730. isVBind ? 34 : 35,
  16731. loc
  16732. )
  16733. );
  16734. }
  16735. continue;
  16736. }
  16737. if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
  16738. patchFlag |= 32;
  16739. }
  16740. const directiveTransform = context.directiveTransforms[name];
  16741. if (directiveTransform) {
  16742. const { props: props2, needRuntime } = directiveTransform(prop, node, context);
  16743. !ssr && props2.forEach(analyzePatchFlag);
  16744. if (isVOn && arg && !isStaticExp(arg)) {
  16745. pushMergeArg(createObjectExpression(props2, elementLoc));
  16746. } else {
  16747. properties.push(...props2);
  16748. }
  16749. if (needRuntime) {
  16750. runtimeDirectives.push(prop);
  16751. if (isSymbol(needRuntime)) {
  16752. directiveImportMap.set(prop, needRuntime);
  16753. }
  16754. }
  16755. } else if (!isBuiltInDirective(name)) {
  16756. runtimeDirectives.push(prop);
  16757. if (hasChildren) {
  16758. shouldUseBlock = true;
  16759. }
  16760. }
  16761. }
  16762. }
  16763. let propsExpression = void 0;
  16764. if (mergeArgs.length) {
  16765. pushMergeArg();
  16766. if (mergeArgs.length > 1) {
  16767. propsExpression = createCallExpression(
  16768. context.helper(MERGE_PROPS),
  16769. mergeArgs,
  16770. elementLoc
  16771. );
  16772. } else {
  16773. propsExpression = mergeArgs[0];
  16774. }
  16775. } else if (properties.length) {
  16776. propsExpression = createObjectExpression(
  16777. dedupeProperties(properties),
  16778. elementLoc
  16779. );
  16780. }
  16781. if (hasDynamicKeys) {
  16782. patchFlag |= 16;
  16783. } else {
  16784. if (hasClassBinding && !isComponent) {
  16785. patchFlag |= 2;
  16786. }
  16787. if (hasStyleBinding && !isComponent) {
  16788. patchFlag |= 4;
  16789. }
  16790. if (dynamicPropNames.length) {
  16791. patchFlag |= 8;
  16792. }
  16793. if (hasHydrationEventBinding) {
  16794. patchFlag |= 32;
  16795. }
  16796. }
  16797. if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  16798. patchFlag |= 512;
  16799. }
  16800. if (!context.inSSR && propsExpression) {
  16801. switch (propsExpression.type) {
  16802. case 15:
  16803. let classKeyIndex = -1;
  16804. let styleKeyIndex = -1;
  16805. let hasDynamicKey = false;
  16806. for (let i = 0; i < propsExpression.properties.length; i++) {
  16807. const key = propsExpression.properties[i].key;
  16808. if (isStaticExp(key)) {
  16809. if (key.content === "class") {
  16810. classKeyIndex = i;
  16811. } else if (key.content === "style") {
  16812. styleKeyIndex = i;
  16813. }
  16814. } else if (!key.isHandlerKey) {
  16815. hasDynamicKey = true;
  16816. }
  16817. }
  16818. const classProp = propsExpression.properties[classKeyIndex];
  16819. const styleProp = propsExpression.properties[styleKeyIndex];
  16820. if (!hasDynamicKey) {
  16821. if (classProp && !isStaticExp(classProp.value)) {
  16822. classProp.value = createCallExpression(
  16823. context.helper(NORMALIZE_CLASS),
  16824. [classProp.value]
  16825. );
  16826. }
  16827. if (styleProp && // the static style is compiled into an object,
  16828. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  16829. (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
  16830. // v-bind:style with static literal object
  16831. styleProp.value.type === 17)) {
  16832. styleProp.value = createCallExpression(
  16833. context.helper(NORMALIZE_STYLE),
  16834. [styleProp.value]
  16835. );
  16836. }
  16837. } else {
  16838. propsExpression = createCallExpression(
  16839. context.helper(NORMALIZE_PROPS),
  16840. [propsExpression]
  16841. );
  16842. }
  16843. break;
  16844. case 14:
  16845. break;
  16846. default:
  16847. propsExpression = createCallExpression(
  16848. context.helper(NORMALIZE_PROPS),
  16849. [
  16850. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  16851. propsExpression
  16852. ])
  16853. ]
  16854. );
  16855. break;
  16856. }
  16857. }
  16858. return {
  16859. props: propsExpression,
  16860. directives: runtimeDirectives,
  16861. patchFlag,
  16862. dynamicPropNames,
  16863. shouldUseBlock
  16864. };
  16865. }
  16866. function dedupeProperties(properties) {
  16867. const knownProps = /* @__PURE__ */ new Map();
  16868. const deduped = [];
  16869. for (let i = 0; i < properties.length; i++) {
  16870. const prop = properties[i];
  16871. if (prop.key.type === 8 || !prop.key.isStatic) {
  16872. deduped.push(prop);
  16873. continue;
  16874. }
  16875. const name = prop.key.content;
  16876. const existing = knownProps.get(name);
  16877. if (existing) {
  16878. if (name === "style" || name === "class" || isOn(name)) {
  16879. mergeAsArray(existing, prop);
  16880. }
  16881. } else {
  16882. knownProps.set(name, prop);
  16883. deduped.push(prop);
  16884. }
  16885. }
  16886. return deduped;
  16887. }
  16888. function mergeAsArray(existing, incoming) {
  16889. if (existing.value.type === 17) {
  16890. existing.value.elements.push(incoming.value);
  16891. } else {
  16892. existing.value = createArrayExpression(
  16893. [existing.value, incoming.value],
  16894. existing.loc
  16895. );
  16896. }
  16897. }
  16898. function buildDirectiveArgs(dir, context) {
  16899. const dirArgs = [];
  16900. const runtime = directiveImportMap.get(dir);
  16901. if (runtime) {
  16902. dirArgs.push(context.helperString(runtime));
  16903. } else {
  16904. {
  16905. context.helper(RESOLVE_DIRECTIVE);
  16906. context.directives.add(dir.name);
  16907. dirArgs.push(toValidAssetId(dir.name, `directive`));
  16908. }
  16909. }
  16910. const { loc } = dir;
  16911. if (dir.exp) dirArgs.push(dir.exp);
  16912. if (dir.arg) {
  16913. if (!dir.exp) {
  16914. dirArgs.push(`void 0`);
  16915. }
  16916. dirArgs.push(dir.arg);
  16917. }
  16918. if (Object.keys(dir.modifiers).length) {
  16919. if (!dir.arg) {
  16920. if (!dir.exp) {
  16921. dirArgs.push(`void 0`);
  16922. }
  16923. dirArgs.push(`void 0`);
  16924. }
  16925. const trueExpression = createSimpleExpression(`true`, false, loc);
  16926. dirArgs.push(
  16927. createObjectExpression(
  16928. dir.modifiers.map(
  16929. (modifier) => createObjectProperty(modifier, trueExpression)
  16930. ),
  16931. loc
  16932. )
  16933. );
  16934. }
  16935. return createArrayExpression(dirArgs, dir.loc);
  16936. }
  16937. function stringifyDynamicPropNames(props) {
  16938. let propsNamesString = `[`;
  16939. for (let i = 0, l = props.length; i < l; i++) {
  16940. propsNamesString += JSON.stringify(props[i]);
  16941. if (i < l - 1) propsNamesString += ", ";
  16942. }
  16943. return propsNamesString + `]`;
  16944. }
  16945. function isComponentTag(tag) {
  16946. return tag === "component" || tag === "Component";
  16947. }
  16948. const transformSlotOutlet = (node, context) => {
  16949. if (isSlotOutlet(node)) {
  16950. const { children, loc } = node;
  16951. const { slotName, slotProps } = processSlotOutlet(node, context);
  16952. const slotArgs = [
  16953. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  16954. slotName,
  16955. "{}",
  16956. "undefined",
  16957. "true"
  16958. ];
  16959. let expectedLen = 2;
  16960. if (slotProps) {
  16961. slotArgs[2] = slotProps;
  16962. expectedLen = 3;
  16963. }
  16964. if (children.length) {
  16965. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  16966. expectedLen = 4;
  16967. }
  16968. if (context.scopeId && !context.slotted) {
  16969. expectedLen = 5;
  16970. }
  16971. slotArgs.splice(expectedLen);
  16972. node.codegenNode = createCallExpression(
  16973. context.helper(RENDER_SLOT),
  16974. slotArgs,
  16975. loc
  16976. );
  16977. }
  16978. };
  16979. function processSlotOutlet(node, context) {
  16980. let slotName = `"default"`;
  16981. let slotProps = void 0;
  16982. const nonNameProps = [];
  16983. for (let i = 0; i < node.props.length; i++) {
  16984. const p = node.props[i];
  16985. if (p.type === 6) {
  16986. if (p.value) {
  16987. if (p.name === "name") {
  16988. slotName = JSON.stringify(p.value.content);
  16989. } else {
  16990. p.name = camelize(p.name);
  16991. nonNameProps.push(p);
  16992. }
  16993. }
  16994. } else {
  16995. if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
  16996. if (p.exp) {
  16997. slotName = p.exp;
  16998. } else if (p.arg && p.arg.type === 4) {
  16999. const name = camelize(p.arg.content);
  17000. slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
  17001. }
  17002. } else {
  17003. if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
  17004. p.arg.content = camelize(p.arg.content);
  17005. }
  17006. nonNameProps.push(p);
  17007. }
  17008. }
  17009. }
  17010. if (nonNameProps.length > 0) {
  17011. const { props, directives } = buildProps(
  17012. node,
  17013. context,
  17014. nonNameProps,
  17015. false,
  17016. false
  17017. );
  17018. slotProps = props;
  17019. if (directives.length) {
  17020. context.onError(
  17021. createCompilerError(
  17022. 36,
  17023. directives[0].loc
  17024. )
  17025. );
  17026. }
  17027. }
  17028. return {
  17029. slotName,
  17030. slotProps
  17031. };
  17032. }
  17033. const transformOn$1 = (dir, node, context, augmentor) => {
  17034. const { loc, modifiers, arg } = dir;
  17035. if (!dir.exp && !modifiers.length) {
  17036. context.onError(createCompilerError(35, loc));
  17037. }
  17038. let eventName;
  17039. if (arg.type === 4) {
  17040. if (arg.isStatic) {
  17041. let rawName = arg.content;
  17042. if (rawName.startsWith("vnode")) {
  17043. context.onError(createCompilerError(51, arg.loc));
  17044. }
  17045. if (rawName.startsWith("vue:")) {
  17046. rawName = `vnode-${rawName.slice(4)}`;
  17047. }
  17048. const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
  17049. // for non-element and vnode lifecycle event listeners, auto convert
  17050. // it to camelCase. See issue #2249
  17051. toHandlerKey(camelize(rawName))
  17052. ) : (
  17053. // preserve case for plain element listeners that have uppercase
  17054. // letters, as these may be custom elements' custom events
  17055. `on:${rawName}`
  17056. );
  17057. eventName = createSimpleExpression(eventString, true, arg.loc);
  17058. } else {
  17059. eventName = createCompoundExpression([
  17060. `${context.helperString(TO_HANDLER_KEY)}(`,
  17061. arg,
  17062. `)`
  17063. ]);
  17064. }
  17065. } else {
  17066. eventName = arg;
  17067. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  17068. eventName.children.push(`)`);
  17069. }
  17070. let exp = dir.exp;
  17071. if (exp && !exp.content.trim()) {
  17072. exp = void 0;
  17073. }
  17074. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  17075. if (exp) {
  17076. const isMemberExp = isMemberExpression(exp);
  17077. const isInlineStatement = !(isMemberExp || isFnExpression(exp));
  17078. const hasMultipleStatements = exp.content.includes(`;`);
  17079. {
  17080. validateBrowserExpression(
  17081. exp,
  17082. context,
  17083. false,
  17084. hasMultipleStatements
  17085. );
  17086. }
  17087. if (isInlineStatement || shouldCache && isMemberExp) {
  17088. exp = createCompoundExpression([
  17089. `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  17090. exp,
  17091. hasMultipleStatements ? `}` : `)`
  17092. ]);
  17093. }
  17094. }
  17095. let ret = {
  17096. props: [
  17097. createObjectProperty(
  17098. eventName,
  17099. exp || createSimpleExpression(`() => {}`, false, loc)
  17100. )
  17101. ]
  17102. };
  17103. if (augmentor) {
  17104. ret = augmentor(ret);
  17105. }
  17106. if (shouldCache) {
  17107. ret.props[0].value = context.cache(ret.props[0].value);
  17108. }
  17109. ret.props.forEach((p) => p.key.isHandlerKey = true);
  17110. return ret;
  17111. };
  17112. const transformText = (node, context) => {
  17113. if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
  17114. return () => {
  17115. const children = node.children;
  17116. let currentContainer = void 0;
  17117. let hasText = false;
  17118. for (let i = 0; i < children.length; i++) {
  17119. const child = children[i];
  17120. if (isText$1(child)) {
  17121. hasText = true;
  17122. for (let j = i + 1; j < children.length; j++) {
  17123. const next = children[j];
  17124. if (isText$1(next)) {
  17125. if (!currentContainer) {
  17126. currentContainer = children[i] = createCompoundExpression(
  17127. [child],
  17128. child.loc
  17129. );
  17130. }
  17131. currentContainer.children.push(` + `, next);
  17132. children.splice(j, 1);
  17133. j--;
  17134. } else {
  17135. currentContainer = void 0;
  17136. break;
  17137. }
  17138. }
  17139. }
  17140. }
  17141. if (!hasText || // if this is a plain element with a single text child, leave it
  17142. // as-is since the runtime has dedicated fast path for this by directly
  17143. // setting textContent of the element.
  17144. // for component root it's always normalized anyway.
  17145. children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
  17146. // custom directives can potentially add DOM elements arbitrarily,
  17147. // we need to avoid setting textContent of the element at runtime
  17148. // to avoid accidentally overwriting the DOM elements added
  17149. // by the user through custom directives.
  17150. !node.props.find(
  17151. (p) => p.type === 7 && !context.directiveTransforms[p.name]
  17152. ) && // in compat mode, <template> tags with no special directives
  17153. // will be rendered as a fragment so its children must be
  17154. // converted into vnodes.
  17155. true)) {
  17156. return;
  17157. }
  17158. for (let i = 0; i < children.length; i++) {
  17159. const child = children[i];
  17160. if (isText$1(child) || child.type === 8) {
  17161. const callArgs = [];
  17162. if (child.type !== 2 || child.content !== " ") {
  17163. callArgs.push(child);
  17164. }
  17165. if (!context.ssr && getConstantType(child, context) === 0) {
  17166. callArgs.push(
  17167. 1 + (` /* ${PatchFlagNames[1]} */` )
  17168. );
  17169. }
  17170. children[i] = {
  17171. type: 12,
  17172. content: child,
  17173. loc: child.loc,
  17174. codegenNode: createCallExpression(
  17175. context.helper(CREATE_TEXT),
  17176. callArgs
  17177. )
  17178. };
  17179. }
  17180. }
  17181. };
  17182. }
  17183. };
  17184. const seen$1 = /* @__PURE__ */ new WeakSet();
  17185. const transformOnce = (node, context) => {
  17186. if (node.type === 1 && findDir(node, "once", true)) {
  17187. if (seen$1.has(node) || context.inVOnce || context.inSSR) {
  17188. return;
  17189. }
  17190. seen$1.add(node);
  17191. context.inVOnce = true;
  17192. context.helper(SET_BLOCK_TRACKING);
  17193. return () => {
  17194. context.inVOnce = false;
  17195. const cur = context.currentNode;
  17196. if (cur.codegenNode) {
  17197. cur.codegenNode = context.cache(
  17198. cur.codegenNode,
  17199. true
  17200. /* isVNode */
  17201. );
  17202. }
  17203. };
  17204. }
  17205. };
  17206. const transformModel$1 = (dir, node, context) => {
  17207. const { exp, arg } = dir;
  17208. if (!exp) {
  17209. context.onError(
  17210. createCompilerError(41, dir.loc)
  17211. );
  17212. return createTransformProps();
  17213. }
  17214. const rawExp = exp.loc.source.trim();
  17215. const expString = exp.type === 4 ? exp.content : rawExp;
  17216. const bindingType = context.bindingMetadata[rawExp];
  17217. if (bindingType === "props" || bindingType === "props-aliased") {
  17218. context.onError(createCompilerError(44, exp.loc));
  17219. return createTransformProps();
  17220. }
  17221. const maybeRef = false;
  17222. if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
  17223. context.onError(
  17224. createCompilerError(42, exp.loc)
  17225. );
  17226. return createTransformProps();
  17227. }
  17228. const propName = arg ? arg : createSimpleExpression("modelValue", true);
  17229. const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
  17230. let assignmentExp;
  17231. const eventArg = context.isTS ? `($event: any)` : `$event`;
  17232. {
  17233. assignmentExp = createCompoundExpression([
  17234. `${eventArg} => ((`,
  17235. exp,
  17236. `) = $event)`
  17237. ]);
  17238. }
  17239. const props = [
  17240. // modelValue: foo
  17241. createObjectProperty(propName, dir.exp),
  17242. // "onUpdate:modelValue": $event => (foo = $event)
  17243. createObjectProperty(eventName, assignmentExp)
  17244. ];
  17245. if (dir.modifiers.length && node.tagType === 1) {
  17246. const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
  17247. const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
  17248. props.push(
  17249. createObjectProperty(
  17250. modifiersKey,
  17251. createSimpleExpression(
  17252. `{ ${modifiers} }`,
  17253. false,
  17254. dir.loc,
  17255. 2
  17256. )
  17257. )
  17258. );
  17259. }
  17260. return createTransformProps(props);
  17261. };
  17262. function createTransformProps(props = []) {
  17263. return { props };
  17264. }
  17265. const seen = /* @__PURE__ */ new WeakSet();
  17266. const transformMemo = (node, context) => {
  17267. if (node.type === 1) {
  17268. const dir = findDir(node, "memo");
  17269. if (!dir || seen.has(node)) {
  17270. return;
  17271. }
  17272. seen.add(node);
  17273. return () => {
  17274. const codegenNode = node.codegenNode || context.currentNode.codegenNode;
  17275. if (codegenNode && codegenNode.type === 13) {
  17276. if (node.tagType !== 1) {
  17277. convertToBlock(codegenNode, context);
  17278. }
  17279. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  17280. dir.exp,
  17281. createFunctionExpression(void 0, codegenNode),
  17282. `_cache`,
  17283. String(context.cached.length)
  17284. ]);
  17285. context.cached.push(null);
  17286. }
  17287. };
  17288. }
  17289. };
  17290. function getBaseTransformPreset(prefixIdentifiers) {
  17291. return [
  17292. [
  17293. transformOnce,
  17294. transformIf,
  17295. transformMemo,
  17296. transformFor,
  17297. ...[],
  17298. ...[transformExpression] ,
  17299. transformSlotOutlet,
  17300. transformElement,
  17301. trackSlotScopes,
  17302. transformText
  17303. ],
  17304. {
  17305. on: transformOn$1,
  17306. bind: transformBind,
  17307. model: transformModel$1
  17308. }
  17309. ];
  17310. }
  17311. function baseCompile(source, options = {}) {
  17312. const onError = options.onError || defaultOnError;
  17313. const isModuleMode = options.mode === "module";
  17314. {
  17315. if (options.prefixIdentifiers === true) {
  17316. onError(createCompilerError(47));
  17317. } else if (isModuleMode) {
  17318. onError(createCompilerError(48));
  17319. }
  17320. }
  17321. const prefixIdentifiers = false;
  17322. if (options.cacheHandlers) {
  17323. onError(createCompilerError(49));
  17324. }
  17325. if (options.scopeId && !isModuleMode) {
  17326. onError(createCompilerError(50));
  17327. }
  17328. const resolvedOptions = extend({}, options, {
  17329. prefixIdentifiers
  17330. });
  17331. const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
  17332. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  17333. transform(
  17334. ast,
  17335. extend({}, resolvedOptions, {
  17336. nodeTransforms: [
  17337. ...nodeTransforms,
  17338. ...options.nodeTransforms || []
  17339. // user transforms
  17340. ],
  17341. directiveTransforms: extend(
  17342. {},
  17343. directiveTransforms,
  17344. options.directiveTransforms || {}
  17345. // user transforms
  17346. )
  17347. })
  17348. );
  17349. return generate(ast, resolvedOptions);
  17350. }
  17351. const noopDirectiveTransform = () => ({ props: [] });
  17352. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  17353. const V_MODEL_CHECKBOX = Symbol(
  17354. `vModelCheckbox`
  17355. );
  17356. const V_MODEL_TEXT = Symbol(`vModelText` );
  17357. const V_MODEL_SELECT = Symbol(
  17358. `vModelSelect`
  17359. );
  17360. const V_MODEL_DYNAMIC = Symbol(
  17361. `vModelDynamic`
  17362. );
  17363. const V_ON_WITH_MODIFIERS = Symbol(
  17364. `vOnModifiersGuard`
  17365. );
  17366. const V_ON_WITH_KEYS = Symbol(
  17367. `vOnKeysGuard`
  17368. );
  17369. const V_SHOW = Symbol(`vShow` );
  17370. const TRANSITION = Symbol(`Transition` );
  17371. const TRANSITION_GROUP = Symbol(
  17372. `TransitionGroup`
  17373. );
  17374. registerRuntimeHelpers({
  17375. [V_MODEL_RADIO]: `vModelRadio`,
  17376. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  17377. [V_MODEL_TEXT]: `vModelText`,
  17378. [V_MODEL_SELECT]: `vModelSelect`,
  17379. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  17380. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  17381. [V_ON_WITH_KEYS]: `withKeys`,
  17382. [V_SHOW]: `vShow`,
  17383. [TRANSITION]: `Transition`,
  17384. [TRANSITION_GROUP]: `TransitionGroup`
  17385. });
  17386. let decoder;
  17387. function decodeHtmlBrowser(raw, asAttr = false) {
  17388. if (!decoder) {
  17389. decoder = document.createElement("div");
  17390. }
  17391. if (asAttr) {
  17392. decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
  17393. return decoder.children[0].getAttribute("foo");
  17394. } else {
  17395. decoder.innerHTML = raw;
  17396. return decoder.textContent;
  17397. }
  17398. }
  17399. const parserOptions = {
  17400. parseMode: "html",
  17401. isVoidTag,
  17402. isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  17403. isPreTag: (tag) => tag === "pre",
  17404. isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
  17405. decodeEntities: decodeHtmlBrowser ,
  17406. isBuiltInComponent: (tag) => {
  17407. if (tag === "Transition" || tag === "transition") {
  17408. return TRANSITION;
  17409. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  17410. return TRANSITION_GROUP;
  17411. }
  17412. },
  17413. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  17414. getNamespace(tag, parent, rootNamespace) {
  17415. let ns = parent ? parent.ns : rootNamespace;
  17416. if (parent && ns === 2) {
  17417. if (parent.tag === "annotation-xml") {
  17418. if (tag === "svg") {
  17419. return 1;
  17420. }
  17421. if (parent.props.some(
  17422. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  17423. )) {
  17424. ns = 0;
  17425. }
  17426. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  17427. ns = 0;
  17428. }
  17429. } else if (parent && ns === 1) {
  17430. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  17431. ns = 0;
  17432. }
  17433. }
  17434. if (ns === 0) {
  17435. if (tag === "svg") {
  17436. return 1;
  17437. }
  17438. if (tag === "math") {
  17439. return 2;
  17440. }
  17441. }
  17442. return ns;
  17443. }
  17444. };
  17445. const transformStyle = (node) => {
  17446. if (node.type === 1) {
  17447. node.props.forEach((p, i) => {
  17448. if (p.type === 6 && p.name === "style" && p.value) {
  17449. node.props[i] = {
  17450. type: 7,
  17451. name: `bind`,
  17452. arg: createSimpleExpression(`style`, true, p.loc),
  17453. exp: parseInlineCSS(p.value.content, p.loc),
  17454. modifiers: [],
  17455. loc: p.loc
  17456. };
  17457. }
  17458. });
  17459. }
  17460. };
  17461. const parseInlineCSS = (cssText, loc) => {
  17462. const normalized = parseStringStyle(cssText);
  17463. return createSimpleExpression(
  17464. JSON.stringify(normalized),
  17465. false,
  17466. loc,
  17467. 3
  17468. );
  17469. };
  17470. function createDOMCompilerError(code, loc) {
  17471. return createCompilerError(
  17472. code,
  17473. loc,
  17474. DOMErrorMessages
  17475. );
  17476. }
  17477. const DOMErrorMessages = {
  17478. [53]: `v-html is missing expression.`,
  17479. [54]: `v-html will override element children.`,
  17480. [55]: `v-text is missing expression.`,
  17481. [56]: `v-text will override element children.`,
  17482. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  17483. [58]: `v-model argument is not supported on plain elements.`,
  17484. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  17485. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  17486. [61]: `v-show is missing expression.`,
  17487. [62]: `<Transition> expects exactly one child element or component.`,
  17488. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  17489. };
  17490. const transformVHtml = (dir, node, context) => {
  17491. const { exp, loc } = dir;
  17492. if (!exp) {
  17493. context.onError(
  17494. createDOMCompilerError(53, loc)
  17495. );
  17496. }
  17497. if (node.children.length) {
  17498. context.onError(
  17499. createDOMCompilerError(54, loc)
  17500. );
  17501. node.children.length = 0;
  17502. }
  17503. return {
  17504. props: [
  17505. createObjectProperty(
  17506. createSimpleExpression(`innerHTML`, true, loc),
  17507. exp || createSimpleExpression("", true)
  17508. )
  17509. ]
  17510. };
  17511. };
  17512. const transformVText = (dir, node, context) => {
  17513. const { exp, loc } = dir;
  17514. if (!exp) {
  17515. context.onError(
  17516. createDOMCompilerError(55, loc)
  17517. );
  17518. }
  17519. if (node.children.length) {
  17520. context.onError(
  17521. createDOMCompilerError(56, loc)
  17522. );
  17523. node.children.length = 0;
  17524. }
  17525. return {
  17526. props: [
  17527. createObjectProperty(
  17528. createSimpleExpression(`textContent`, true),
  17529. exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
  17530. context.helperString(TO_DISPLAY_STRING),
  17531. [exp],
  17532. loc
  17533. ) : createSimpleExpression("", true)
  17534. )
  17535. ]
  17536. };
  17537. };
  17538. const transformModel = (dir, node, context) => {
  17539. const baseResult = transformModel$1(dir, node, context);
  17540. if (!baseResult.props.length || node.tagType === 1) {
  17541. return baseResult;
  17542. }
  17543. if (dir.arg) {
  17544. context.onError(
  17545. createDOMCompilerError(
  17546. 58,
  17547. dir.arg.loc
  17548. )
  17549. );
  17550. }
  17551. function checkDuplicatedValue() {
  17552. const value = findDir(node, "bind");
  17553. if (value && isStaticArgOf(value.arg, "value")) {
  17554. context.onError(
  17555. createDOMCompilerError(
  17556. 60,
  17557. value.loc
  17558. )
  17559. );
  17560. }
  17561. }
  17562. const { tag } = node;
  17563. const isCustomElement = context.isCustomElement(tag);
  17564. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  17565. let directiveToUse = V_MODEL_TEXT;
  17566. let isInvalidType = false;
  17567. if (tag === "input" || isCustomElement) {
  17568. const type = findProp(node, `type`);
  17569. if (type) {
  17570. if (type.type === 7) {
  17571. directiveToUse = V_MODEL_DYNAMIC;
  17572. } else if (type.value) {
  17573. switch (type.value.content) {
  17574. case "radio":
  17575. directiveToUse = V_MODEL_RADIO;
  17576. break;
  17577. case "checkbox":
  17578. directiveToUse = V_MODEL_CHECKBOX;
  17579. break;
  17580. case "file":
  17581. isInvalidType = true;
  17582. context.onError(
  17583. createDOMCompilerError(
  17584. 59,
  17585. dir.loc
  17586. )
  17587. );
  17588. break;
  17589. default:
  17590. checkDuplicatedValue();
  17591. break;
  17592. }
  17593. }
  17594. } else if (hasDynamicKeyVBind(node)) {
  17595. directiveToUse = V_MODEL_DYNAMIC;
  17596. } else {
  17597. checkDuplicatedValue();
  17598. }
  17599. } else if (tag === "select") {
  17600. directiveToUse = V_MODEL_SELECT;
  17601. } else {
  17602. checkDuplicatedValue();
  17603. }
  17604. if (!isInvalidType) {
  17605. baseResult.needRuntime = context.helper(directiveToUse);
  17606. }
  17607. } else {
  17608. context.onError(
  17609. createDOMCompilerError(
  17610. 57,
  17611. dir.loc
  17612. )
  17613. );
  17614. }
  17615. baseResult.props = baseResult.props.filter(
  17616. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  17617. );
  17618. return baseResult;
  17619. };
  17620. const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
  17621. const isNonKeyModifier = /* @__PURE__ */ makeMap(
  17622. // event propagation management
  17623. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  17624. );
  17625. const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
  17626. const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
  17627. const resolveModifiers = (key, modifiers, context, loc) => {
  17628. const keyModifiers = [];
  17629. const nonKeyModifiers = [];
  17630. const eventOptionModifiers = [];
  17631. for (let i = 0; i < modifiers.length; i++) {
  17632. const modifier = modifiers[i].content;
  17633. if (isEventOptionModifier(modifier)) {
  17634. eventOptionModifiers.push(modifier);
  17635. } else {
  17636. if (maybeKeyModifier(modifier)) {
  17637. if (isStaticExp(key)) {
  17638. if (isKeyboardEvent(key.content.toLowerCase())) {
  17639. keyModifiers.push(modifier);
  17640. } else {
  17641. nonKeyModifiers.push(modifier);
  17642. }
  17643. } else {
  17644. keyModifiers.push(modifier);
  17645. nonKeyModifiers.push(modifier);
  17646. }
  17647. } else {
  17648. if (isNonKeyModifier(modifier)) {
  17649. nonKeyModifiers.push(modifier);
  17650. } else {
  17651. keyModifiers.push(modifier);
  17652. }
  17653. }
  17654. }
  17655. }
  17656. return {
  17657. keyModifiers,
  17658. nonKeyModifiers,
  17659. eventOptionModifiers
  17660. };
  17661. };
  17662. const transformClick = (key, event) => {
  17663. const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
  17664. return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
  17665. `(`,
  17666. key,
  17667. `) === "onClick" ? "${event}" : (`,
  17668. key,
  17669. `)`
  17670. ]) : key;
  17671. };
  17672. const transformOn = (dir, node, context) => {
  17673. return transformOn$1(dir, node, context, (baseResult) => {
  17674. const { modifiers } = dir;
  17675. if (!modifiers.length) return baseResult;
  17676. let { key, value: handlerExp } = baseResult.props[0];
  17677. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  17678. if (nonKeyModifiers.includes("right")) {
  17679. key = transformClick(key, `onContextmenu`);
  17680. }
  17681. if (nonKeyModifiers.includes("middle")) {
  17682. key = transformClick(key, `onMouseup`);
  17683. }
  17684. if (nonKeyModifiers.length) {
  17685. handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  17686. handlerExp,
  17687. JSON.stringify(nonKeyModifiers)
  17688. ]);
  17689. }
  17690. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  17691. (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
  17692. handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
  17693. handlerExp,
  17694. JSON.stringify(keyModifiers)
  17695. ]);
  17696. }
  17697. if (eventOptionModifiers.length) {
  17698. const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
  17699. key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  17700. }
  17701. return {
  17702. props: [createObjectProperty(key, handlerExp)]
  17703. };
  17704. });
  17705. };
  17706. const transformShow = (dir, node, context) => {
  17707. const { exp, loc } = dir;
  17708. if (!exp) {
  17709. context.onError(
  17710. createDOMCompilerError(61, loc)
  17711. );
  17712. }
  17713. return {
  17714. props: [],
  17715. needRuntime: context.helper(V_SHOW)
  17716. };
  17717. };
  17718. const transformTransition = (node, context) => {
  17719. if (node.type === 1 && node.tagType === 1) {
  17720. const component = context.isBuiltInComponent(node.tag);
  17721. if (component === TRANSITION) {
  17722. return () => {
  17723. if (!node.children.length) {
  17724. return;
  17725. }
  17726. if (hasMultipleChildren(node)) {
  17727. context.onError(
  17728. createDOMCompilerError(
  17729. 62,
  17730. {
  17731. start: node.children[0].loc.start,
  17732. end: node.children[node.children.length - 1].loc.end,
  17733. source: ""
  17734. }
  17735. )
  17736. );
  17737. }
  17738. const child = node.children[0];
  17739. if (child.type === 1) {
  17740. for (const p of child.props) {
  17741. if (p.type === 7 && p.name === "show") {
  17742. node.props.push({
  17743. type: 6,
  17744. name: "persisted",
  17745. nameLoc: node.loc,
  17746. value: void 0,
  17747. loc: node.loc
  17748. });
  17749. }
  17750. }
  17751. }
  17752. };
  17753. }
  17754. }
  17755. };
  17756. function hasMultipleChildren(node) {
  17757. const children = node.children = node.children.filter(
  17758. (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
  17759. );
  17760. const child = children[0];
  17761. return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
  17762. }
  17763. const ignoreSideEffectTags = (node, context) => {
  17764. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  17765. context.onError(
  17766. createDOMCompilerError(
  17767. 63,
  17768. node.loc
  17769. )
  17770. );
  17771. context.removeNode();
  17772. }
  17773. };
  17774. function isValidHTMLNesting(parent, child) {
  17775. if (parent in onlyValidChildren) {
  17776. return onlyValidChildren[parent].has(child);
  17777. }
  17778. if (child in onlyValidParents) {
  17779. return onlyValidParents[child].has(parent);
  17780. }
  17781. if (parent in knownInvalidChildren) {
  17782. if (knownInvalidChildren[parent].has(child)) return false;
  17783. }
  17784. if (child in knownInvalidParents) {
  17785. if (knownInvalidParents[child].has(parent)) return false;
  17786. }
  17787. return true;
  17788. }
  17789. const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
  17790. const emptySet = /* @__PURE__ */ new Set([]);
  17791. const onlyValidChildren = {
  17792. head: /* @__PURE__ */ new Set([
  17793. "base",
  17794. "basefront",
  17795. "bgsound",
  17796. "link",
  17797. "meta",
  17798. "title",
  17799. "noscript",
  17800. "noframes",
  17801. "style",
  17802. "script",
  17803. "template"
  17804. ]),
  17805. optgroup: /* @__PURE__ */ new Set(["option"]),
  17806. select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
  17807. // table
  17808. table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
  17809. tr: /* @__PURE__ */ new Set(["td", "th"]),
  17810. colgroup: /* @__PURE__ */ new Set(["col"]),
  17811. tbody: /* @__PURE__ */ new Set(["tr"]),
  17812. thead: /* @__PURE__ */ new Set(["tr"]),
  17813. tfoot: /* @__PURE__ */ new Set(["tr"]),
  17814. // these elements can not have any children elements
  17815. script: emptySet,
  17816. iframe: emptySet,
  17817. option: emptySet,
  17818. textarea: emptySet,
  17819. style: emptySet,
  17820. title: emptySet
  17821. };
  17822. const onlyValidParents = {
  17823. // sections
  17824. html: emptySet,
  17825. body: /* @__PURE__ */ new Set(["html"]),
  17826. head: /* @__PURE__ */ new Set(["html"]),
  17827. // table
  17828. td: /* @__PURE__ */ new Set(["tr"]),
  17829. colgroup: /* @__PURE__ */ new Set(["table"]),
  17830. caption: /* @__PURE__ */ new Set(["table"]),
  17831. tbody: /* @__PURE__ */ new Set(["table"]),
  17832. tfoot: /* @__PURE__ */ new Set(["table"]),
  17833. col: /* @__PURE__ */ new Set(["colgroup"]),
  17834. th: /* @__PURE__ */ new Set(["tr"]),
  17835. thead: /* @__PURE__ */ new Set(["table"]),
  17836. tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
  17837. // data list
  17838. dd: /* @__PURE__ */ new Set(["dl", "div"]),
  17839. dt: /* @__PURE__ */ new Set(["dl", "div"]),
  17840. // other
  17841. figcaption: /* @__PURE__ */ new Set(["figure"]),
  17842. // li: new Set(["ul", "ol"]),
  17843. summary: /* @__PURE__ */ new Set(["details"]),
  17844. area: /* @__PURE__ */ new Set(["map"])
  17845. };
  17846. const knownInvalidChildren = {
  17847. p: /* @__PURE__ */ new Set([
  17848. "address",
  17849. "article",
  17850. "aside",
  17851. "blockquote",
  17852. "center",
  17853. "details",
  17854. "dialog",
  17855. "dir",
  17856. "div",
  17857. "dl",
  17858. "fieldset",
  17859. "figure",
  17860. "footer",
  17861. "form",
  17862. "h1",
  17863. "h2",
  17864. "h3",
  17865. "h4",
  17866. "h5",
  17867. "h6",
  17868. "header",
  17869. "hgroup",
  17870. "hr",
  17871. "li",
  17872. "main",
  17873. "nav",
  17874. "menu",
  17875. "ol",
  17876. "p",
  17877. "pre",
  17878. "section",
  17879. "table",
  17880. "ul"
  17881. ]),
  17882. svg: /* @__PURE__ */ new Set([
  17883. "b",
  17884. "blockquote",
  17885. "br",
  17886. "code",
  17887. "dd",
  17888. "div",
  17889. "dl",
  17890. "dt",
  17891. "em",
  17892. "embed",
  17893. "h1",
  17894. "h2",
  17895. "h3",
  17896. "h4",
  17897. "h5",
  17898. "h6",
  17899. "hr",
  17900. "i",
  17901. "img",
  17902. "li",
  17903. "menu",
  17904. "meta",
  17905. "ol",
  17906. "p",
  17907. "pre",
  17908. "ruby",
  17909. "s",
  17910. "small",
  17911. "span",
  17912. "strong",
  17913. "sub",
  17914. "sup",
  17915. "table",
  17916. "u",
  17917. "ul",
  17918. "var"
  17919. ])
  17920. };
  17921. const knownInvalidParents = {
  17922. a: /* @__PURE__ */ new Set(["a"]),
  17923. button: /* @__PURE__ */ new Set(["button"]),
  17924. dd: /* @__PURE__ */ new Set(["dd", "dt"]),
  17925. dt: /* @__PURE__ */ new Set(["dd", "dt"]),
  17926. form: /* @__PURE__ */ new Set(["form"]),
  17927. li: /* @__PURE__ */ new Set(["li"]),
  17928. h1: headings,
  17929. h2: headings,
  17930. h3: headings,
  17931. h4: headings,
  17932. h5: headings,
  17933. h6: headings
  17934. };
  17935. const validateHtmlNesting = (node, context) => {
  17936. if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
  17937. const error = new SyntaxError(
  17938. `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
  17939. );
  17940. error.loc = node.loc;
  17941. context.onWarn(error);
  17942. }
  17943. };
  17944. const DOMNodeTransforms = [
  17945. transformStyle,
  17946. ...[transformTransition, validateHtmlNesting]
  17947. ];
  17948. const DOMDirectiveTransforms = {
  17949. cloak: noopDirectiveTransform,
  17950. html: transformVHtml,
  17951. text: transformVText,
  17952. model: transformModel,
  17953. // override compiler-core
  17954. on: transformOn,
  17955. // override compiler-core
  17956. show: transformShow
  17957. };
  17958. function compile(src, options = {}) {
  17959. return baseCompile(
  17960. src,
  17961. extend({}, parserOptions, options, {
  17962. nodeTransforms: [
  17963. // ignore <script> and <tag>
  17964. // this is not put inside DOMNodeTransforms because that list is used
  17965. // by compiler-ssr to generate vnode fallback branches
  17966. ignoreSideEffectTags,
  17967. ...DOMNodeTransforms,
  17968. ...options.nodeTransforms || []
  17969. ],
  17970. directiveTransforms: extend(
  17971. {},
  17972. DOMDirectiveTransforms,
  17973. options.directiveTransforms || {}
  17974. ),
  17975. transformHoist: null
  17976. })
  17977. );
  17978. }
  17979. {
  17980. initDev();
  17981. }
  17982. const compileCache = /* @__PURE__ */ Object.create(null);
  17983. function compileToFunction(template, options) {
  17984. if (!isString(template)) {
  17985. if (template.nodeType) {
  17986. template = template.innerHTML;
  17987. } else {
  17988. warn(`invalid template option: `, template);
  17989. return NOOP;
  17990. }
  17991. }
  17992. const key = genCacheKey(template, options);
  17993. const cached = compileCache[key];
  17994. if (cached) {
  17995. return cached;
  17996. }
  17997. if (template[0] === "#") {
  17998. const el = document.querySelector(template);
  17999. if (!el) {
  18000. warn(`Template element not found or is empty: ${template}`);
  18001. }
  18002. template = el ? el.innerHTML : ``;
  18003. }
  18004. const opts = extend(
  18005. {
  18006. hoistStatic: true,
  18007. onError: onError ,
  18008. onWarn: (e) => onError(e, true)
  18009. },
  18010. options
  18011. );
  18012. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  18013. opts.isCustomElement = (tag) => !!customElements.get(tag);
  18014. }
  18015. const { code } = compile(template, opts);
  18016. function onError(err, asWarning = false) {
  18017. const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
  18018. const codeFrame = err.loc && generateCodeFrame(
  18019. template,
  18020. err.loc.start.offset,
  18021. err.loc.end.offset
  18022. );
  18023. warn(codeFrame ? `${message}
  18024. ${codeFrame}` : message);
  18025. }
  18026. const render = new Function("Vue", code)(runtimeDom);
  18027. render._rc = true;
  18028. return compileCache[key] = render;
  18029. }
  18030. registerRuntimeCompiler(compileToFunction);
  18031. 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, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, 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 };